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
52 personal---fraction of Org's capabilities, and know that there is more
53 whenever they need it.
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 [[https://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 [[https://orgmode.org/elpa.html][Org ELPA page]].
106 *** Downloading Org as an archive
111 You can download Org latest release from [[https://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@code.orgmode.org:bzg/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 [[https://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 For a better experience, the three Org commands ~org-store-link~,
178 ~org-capture~ and ~org-agenda~ ought to be accessible anywhere in
179 Emacs, not just in Org buffers. To that effect, you need to bind them
180 to globally available keys, like the ones reserved for users (see
181 [[info:elisp::Key%20Binding%20Conventions]]). Here are suggested
182 bindings, please modify the keys to your own liking.
184 #+begin_src emacs-lisp
185 (global-set-key "\C-cl" 'org-store-link)
186 (global-set-key "\C-ca" 'org-agenda)
187 (global-set-key "\C-cc" 'org-capture)
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-error <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= ::
334 TODO keywords are written with all capitals, even if they are
337 - =boss=, =ARCHIVE= ::
339 User-defined tags are written in lowercase; built-in tags with
340 special meaning are written with all capitals.
342 - =Release=, =PRIORITY= ::
344 User-defined properties are capitalized; built-in properties with
345 special meaning are written with all capitals.
347 - =TITLE=, =BEGIN= ... =END= ::
349 Keywords and blocks are written in uppercase to enhance their
350 readability, but you can use lowercase in your Org files.
352 *** Key bindings and commands
357 The manual lists both the keys and the corresponding commands for
358 accessing a functionality. Org mode often uses the same key for
359 different functions, depending on context. The command that is bound
360 to such keys has a generic name, like ~org-metaright~. In the manual
361 we will, wherever possible, give the function that is internally
362 called by the generic command. For example, in the chapter on
363 document structure, {{{kbd(M-RIGHT)}}} will be listed to call
364 ~org-do-demote~, while in the chapter on tables, it will be listed to
365 call ~org-table-move-column-right~.
369 :DESCRIPTION: A tree works like your brain.
371 #+cindex: document structure
372 #+cindex: structure of document
374 Org is based on Outline mode and provides flexible commands to
375 edit the structure of the document.
379 :DESCRIPTION: Org is based on Outline mode.
382 #+cindex: Outline mode
384 Org is implemented on top of Outline mode. Outlines allow a document
385 to be organized in a hierarchical structure, which, least for me, is
386 the best representation of notes and thoughts. An overview of this
387 structure is achieved by folding, i.e., hiding large parts of the
388 document to show only the general document structure and the parts
389 currently being worked on. Org greatly simplifies the use of outlines
390 by compressing the entire show and hide functionalities into a single
391 command, ~org-cycle~, which is bound to the {{{kbd(TAB)}}} key.
395 :DESCRIPTION: How to typeset Org tree headlines.
398 #+cindex: outline tree
399 #+vindex: org-special-ctrl-a/e
400 #+vindex: org-special-ctrl-k
401 #+vindex: org-ctrl-k-protect-subtree
403 Headlines define the structure of an outline tree. The headlines in
404 Org start with one or more stars, on the left margin[fn:3]. For
408 ,* Top level headline
414 ,* Another top level headline
417 #+vindex: org-footnote-section
419 Note that the name defined in ~org-footnote-section~ is reserved. Do
420 not use it as a title for your own headings.
422 Some people find the many stars too noisy and would prefer an outline
423 that has whitespace followed by a single star as headline starters.
424 See [[*A Cleaner Outline View]].
426 #+vindex: org-cycle-separator-lines
427 An empty line after the end of a subtree is considered part of it and
428 is hidden when the subtree is folded. However, if you leave at least
429 two empty lines, one empty line remains visible after folding the
430 subtree, in order to structure the collapsed view. See the variable
431 ~org-cycle-separator-lines~ to modify this behavior.
433 ** Visibility Cycling
435 :DESCRIPTION: Show and hide, much simplified.
437 #+cindex: cycling, visibility
438 #+cindex: visibility cycling
439 #+cindex: trees, visibility
440 #+cindex: show hidden text
443 *** Global and local cycling
445 :DESCRIPTION: Cycling through various visibility states.
447 #+cindex: subtree visibility states
448 #+cindex: subtree cycling
449 #+cindex: folded, subtree visibility state
450 #+cindex: children, subtree visibility state
451 #+cindex: subtree, subtree visibility state
453 Outlines make it possible to hide parts of the text in the buffer.
454 Org uses just two commands, bound to {{{kbd(TAB)}}} and
455 {{{kbd(S-TAB)}}} to change the visibility in the buffer.
457 #+attr_texinfo: :sep ,
458 - {{{kbd(TAB)}}} (~org-cycle~) ::
462 /Subtree cycling/: Rotate current subtree among the states
465 ,-> FOLDED -> CHILDREN -> SUBTREE --.
466 '-----------------------------------'
469 #+vindex: org-cycle-emulate-tab
470 The cursor must be on a headline for this to work[fn:4].
472 - {{{kbd(S-TAB)}}} (~org-global-cycle~), {{{kbd(C-u TAB)}}} ::
474 #+cindex: global visibility states
475 #+cindex: global cycling
476 #+cindex: overview, global visibility state
477 #+cindex: contents, global visibility state
478 #+cindex: show all, global visibility state
481 #+findex: org-global-cycle
482 /Global cycling/: Rotate the entire buffer among the states
485 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
486 '--------------------------------------'
489 When {{{kbd(S-TAB)}}} is called with a numeric prefix argument N,
490 the CONTENTS view up to headlines of level N are shown. Note
491 that inside tables (see [[*Tables]]), {{{kbd(S-TAB)}}} jumps to the
492 previous field instead.
494 #+vindex: org-cycle-global-at-bob
495 You can run global cycling using {{{kbd(TAB)}}} only if point is
496 at the very beginning of the buffer, but not on a headline, and
497 ~org-cycle-global-at-bob~ is set to a non-~nil~ value.
499 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) ::
501 #+cindex: startup visibility
502 #+kindex: C-u C-u TAB
503 #+findex: org-set-startup-visibility
504 Switch back to the startup visibility of the buffer (see [[*Initial
507 - {{{kbd(C-u C-u C-u TAB)}}} (~outline-show-all~) ::
509 #+cindex: show all, command
510 #+kindex: C-u C-u C-u TAB
511 #+findex: outline-show-all
512 Show all, including drawers.
514 - {{{kbd(C-c C-r)}}} (~org-reveal~) ::
516 #+cindex: revealing context
519 Reveal context around point, showing the current entry, the
520 following heading and the hierarchy above. Useful for working
521 near a location that has been exposed by a sparse tree command
522 (see [[*Sparse Trees]]) or an agenda command (see [[*Commands in the
523 Agenda Buffer]]). With a prefix argument show, on each level, all
524 sibling headings. With a double prefix argument, also show the
525 entire subtree of the parent.
527 - {{{kbd(C-c C-k)}}} (~outline-show-branches~) ::
529 #+cindex: show branches, command
531 #+findex: outline-show-branches
532 Expose all the headings of the subtree, CONTENTS view for just
535 - {{{kbd(C-c TAB)}}} (~outline-show-children~) ::
537 #+cindex: show children, command
539 #+findex: outline-show-children
540 Expose all direct children of the subtree. With a numeric prefix
541 argument N, expose all children down to level N.
543 - {{{kbd(C-c C-x b)}}} (~org-tree-to-indirect-buffer~) ::
546 #+findex: org-tree-to-indirect-buffer
547 Show the current subtree in an indirect buffer[fn:5]. With
548 a numeric prefix argument, N, go up to level N and then take that
549 tree. If N is negative then go up that many levels. With
550 a {{{kbd(C-u)}}} prefix, do not remove the previously used
553 - {{{kbd(C-c C-x v)}}} (~org-copy-visible~) ::
556 #+findex: org-copy-visible
557 Copy the /visible/ text in the region into the kill ring.
559 *** Initial visibility
561 :DESCRIPTION: Setting the initial visibility state.
564 #+vindex: org-startup-folded
565 When Emacs first visits an Org file, the global state is set to
566 OVERVIEW, i.e., only the top level headlines are visible[fn:6]. This
567 can be configured through the variable ~org-startup-folded~, or on
568 a per-file basis by adding one of the following lines anywhere in the
571 #+cindex: STARTUP, keyword
576 ,#+STARTUP: showeverything
579 #+cindex: @samp{VISIBILITY}, property
581 Furthermore, any entries with a =VISIBILITY= property (see [[*Properties
582 and Columns]]) get their visibility adapted accordingly. Allowed values
583 for this property are =folded=, =children=, =content=, and ~all~.
585 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) ::
587 #+kindex: C-u C-u TAB
588 #+findex: org-set-startup-visibility
589 Switch back to the startup visibility of the buffer, i.e.,
590 whatever is requested by startup options and =VISIBILITY=
591 properties in individual entries.
593 *** Catching invisible edits
595 :DESCRIPTION: Preventing mistakes when editing invisible parts.
597 #+cindex: edits, catching invisible
599 #+vindex: org-catch-invisible-edits
600 Sometimes you may inadvertently edit an invisible part of the buffer
601 and be confused on what has been edited and how to undo the mistake.
602 Setting ~org-catch-invisible-edits~ to non-~nil~ helps preventing
603 this. See the docstring of this option on how Org should catch
604 invisible edits and process them.
608 :DESCRIPTION: Jumping to other headlines.
610 #+cindex: motion, between headlines
611 #+cindex: jumping, to headlines
612 #+cindex: headline navigation
614 The following commands jump to other headlines in the buffer.
616 - {{{kbd(C-c C-n)}}} (~outline-next-visible-heading~) ::
619 #+findex: outline-next-visible-heading
622 - {{{kbd(C-c C-p)}}} (~outline-previous-visible-heading~) ::
625 #+findex: outline-previous-visible-heading
628 - {{{kbd(C-c C-f)}}} (~org-forward-same-level~) ::
631 #+findex: org-forward-same-level
632 Next heading same level.
634 - {{{kbd(C-c C-b)}}} (~org-backward-same-level~) ::
637 #+findex: org-backward-same-level
638 Previous heading same level.
640 - {{{kbd(C-c C-u)}}} (~outline-up-heading~) ::
643 #+findex: outline-up-heading
644 Backward to higher level heading.
646 - {{{kbd(C-c C-j)}}} (~org-goto~) ::
650 #+vindex: org-goto-auto-isearch
651 Jump to a different place without changing the current outline
652 visibility. Shows the document structure in a temporary buffer,
653 where you can use the following keys to find your destination:
655 #+attr_texinfo: :columns 0.3 0.7
656 | {{{kbd(TAB)}}} | Cycle visibility. |
657 | {{{kbd(DOWN)}}} / {{{kbd(UP)}}} | Next/previous visible headline. |
658 | {{{kbd(RET)}}} | Select this location. |
659 | {{{kbd(/)}}} | Do a Sparse-tree search |
662 The following keys work if you turn off ~org-goto-auto-isearch~
664 #+attr_texinfo: :columns 0.3 0.7
665 | {{{kbd(n)}}} / {{{kbd(p)}}} | Next/previous visible headline. |
666 | {{{kbd(f)}}} / {{{kbd(b)}}} | Next/previous headline same level. |
667 | {{{kbd(u)}}} | One level up. |
668 | {{{kbd(0)}}} ... {{{kbd(9)}}} | Digit argument. |
669 | {{{kbd(q)}}} | Quit. |
671 #+vindex: org-goto-interface
673 See also the variable ~org-goto-interface~.
677 :DESCRIPTION: Changing sequence and level of headlines.
679 #+cindex: structure editing
680 #+cindex: headline, promotion and demotion
681 #+cindex: promotion, of subtrees
682 #+cindex: demotion, of subtrees
683 #+cindex: subtree, cut and paste
684 #+cindex: pasting, of subtrees
685 #+cindex: cutting, of subtrees
686 #+cindex: copying, of subtrees
687 #+cindex: sorting, of subtrees
688 #+cindex: subtrees, cut and paste
690 - {{{kbd(M-RET)}}} (~org-meta-return~) ::
693 #+findex: org-meta-return
694 #+vindex: org-M-RET-may-split-line
695 Insert a new heading, item or row.
697 If the command is used at the /beginning/ of a line, and if there
698 is a heading or a plain list item (see [[*Plain Lists]]) at point,
699 the new heading/item is created /before/ the current line. When
700 used at the beginning of a regular line of text, turn that line
703 When this command is used in the middle of a line, the line is
704 split and the rest of the line becomes the new item or headline.
705 If you do not want the line to be split, customize
706 ~org-M-RET-may-split-line~.
708 Calling the command with a {{{kbd(C-u)}}} prefix unconditionally
709 inserts a new heading at the end of the current subtree, thus
710 preserving its contents. With a double {{{kbd(C-u C-u)}}}
711 prefix, the new heading is created at the end of the parent
714 - {{{kbd(C-RET)}}} (~org-insert-heading-respect-content~) ::
717 #+findex: org-insert-heading-respect-content
718 Insert a new heading at the end of the current subtree.
720 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
723 #+findex: org-insert-todo-heading
724 #+vindex: org-treat-insert-todo-heading-as-state-change
725 Insert new TODO entry with same level as current heading. See
727 ~org-treat-insert-todo-heading-as-state-change~.
729 - {{{kbd(C-S-RET)}}} (~org-insert-todo-heading-respect-content~) ::
732 #+findex: org-insert-todo-heading-respect-content
733 Insert new TODO entry with same level as current heading. Like
734 {{{kbd(C-RET)}}}, the new headline is inserted after the current
737 - {{{kbd(TAB)}}} (~org-cycle~) ::
741 In a new entry with no text yet, the first {{{kbd(TAB)}}} demotes
742 the entry to become a child of the previous one. The next
743 {{{kbd(TAB)}}} makes it a parent, and so on, all the way to top
744 level. Yet another {{{kbd(TAB)}}}, and you are back to the
747 - {{{kbd(M-LEFT)}}} (~org-do-promote~) ::
750 #+findex: org-do-promote
751 Promote current heading by one level.
753 - {{{kbd(M-RIGHT)}}} (~org-do-demote~) ::
756 #+findex: org-do-demote
757 Demote current heading by one level.
759 - {{{kbd(M-S-LEFT)}}} (~org-promote-subtree~) ::
762 #+findex: org-promote-subtree
763 Promote the current subtree by one level.
765 - {{{kbd(M-S-RIGHT)}}} (~org-demote-subtree~) ::
768 #+findex: org-demote-subtree
769 Demote the current subtree by one level.
771 - {{{kbd(M-UP)}}} (~org-move-subtree-up~) ::
774 #+findex: org-move-subtree-up
775 Move subtree up, i.e., swap with previous subtree of same level.
777 - {{{kbd(M-DOWN)}}} (~org-move-subtree-down~) ::
780 #+findex: org-move-subtree-down
781 Move subtree down, i.e., swap with next subtree of same level.
783 - {{{kbd(C-c @)}}} (~org-mark-subtree~) ::
786 #+findex: org-mark-subtree
787 Mark the subtree at point. Hitting repeatedly marks subsequent
788 subtrees of the same level as the marked subtree.
790 - {{{kbd(C-c C-x C-w)}}} (~org-cut-subtree~) ::
792 #+kindex: C-c C-x C-w
793 #+findex: org-cut-subtree
794 Kill subtree, i.e., remove it from buffer but save in kill ring.
795 With a numeric prefix argument N, kill N sequential subtrees.
797 - {{{kbd(C-c C-x M-w)}}} (~org-copy-subtree~) ::
799 #+kindex: C-c C-x M-w
800 #+findex: org-copy-subtree
801 Copy subtree to kill ring. With a numeric prefix argument N,
802 copy the N sequential subtrees.
804 - {{{kbd(C-c C-x C-y)}}} (~org-paste-subtree~) ::
806 #+kindex: C-c C-x C-y
807 #+findex: org-paste-subtree
808 Yank subtree from kill ring. This does modify the level of the
809 subtree to make sure the tree fits in nicely at the yank
810 position. The yank level can also be specified with a numeric
811 prefix argument, or by yanking after a headline marker like
814 - {{{kbd(C-y)}}} (~org-yank~) ::
818 #+vindex: org-yank-adjusted-subtrees
819 #+vindex: org-yank-folded-subtrees
820 Depending on the variables ~org-yank-adjusted-subtrees~ and
821 ~org-yank-folded-subtrees~, Org's internal ~yank~ command pastes
822 subtrees folded and in a clever way, using the same command as
823 {{{kbd(C-c C-x C-y)}}}. With the default settings, no level
824 adjustment takes place, but the yanked tree is folded unless
825 doing so would swallow text previously visible. Any prefix
826 argument to this command forces a normal ~yank~ to be executed,
827 with the prefix passed along. A good way to force a normal yank
828 is {{{kbd(C-u C-y)}}}. If you use ~yank-pop~ after a yank, it
829 yanks previous kill items plainly, without adjustment and
832 - {{{kbd(C-c C-x c)}}} (~org-clone-subtree-with-time-shift~) ::
835 #+findex: org-clone-subtree-with-time-shift
836 Clone a subtree by making a number of sibling copies of it. You
837 are prompted for the number of copies to make, and you can also
838 specify if any timestamps in the entry should be shifted. This
839 can be useful, for example, to create a number of tasks related
840 to a series of lectures to prepare. For more details, see the
841 docstring of the command ~org-clone-subtree-with-time-shift~.
843 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
847 Refile entry or region to a different location. See [[Refile and
850 - {{{kbd(C-c ^)}}} (~org-sort~) ::
854 Sort same-level entries. When there is an active region, all
855 entries in the region are sorted. Otherwise the children of the
856 current headline are sorted. The command prompts for the sorting
857 method, which can be alphabetically, numerically, by time---first
858 timestamp with active preferred, creation time, scheduled time,
859 deadline time---by priority, by TODO keyword---in the sequence
860 the keywords have been defined in the setup---or by the value of
861 a property. Reverse sorting is possible as well. You can also
862 supply your own function to extract the sorting key. With
863 a {{{kbd(C-u)}}} prefix, sorting is case-sensitive.
865 - {{{kbd(C-x n s)}}} (~org-narrow-to-subtree~) ::
868 #+findex: org-narrow-to-subtree
869 Narrow buffer to current subtree.
871 - {{{kbd(C-x n b)}}} (~org-narrow-to-block~) ::
874 #+findex: org-narrow-to-block
875 Narrow buffer to current block.
877 - {{{kbd(C-x n w)}}} (~widen~) ::
881 Widen buffer to remove narrowing.
883 - {{{kbd(C-c *)}}} (~org-toggle-heading~) ::
886 #+findex: org-toggle-heading
887 Turn a normal line or plain list item into a headline---so that
888 it becomes a subheading at its location. Also turn a headline
889 into a normal line by removing the stars. If there is an active
890 region, turn all lines in the region into headlines. If the
891 first line in the region was an item, turn only the item lines
892 into headlines. Finally, if the first line is a headline, remove
893 the stars from all headlines in the region.
895 #+cindex: region, active
896 #+cindex: active region
897 #+cindex: transient mark mode
898 When there is an active region---i.e., when Transient Mark mode is
899 active---promotion and demotion work on all headlines in the region.
900 To select a region of headlines, it is best to place both point and
901 mark at the beginning of a line, mark at the beginning of the first
902 headline, and point at the line just after the last headline to
903 change. Note that when the cursor is inside a table (see [[*Tables]]),
904 the Meta-Cursor keys have different functionality.
908 :DESCRIPTION: Matches embedded in context.
910 #+cindex: sparse trees
911 #+cindex: trees, sparse
912 #+cindex: folding, sparse trees
913 #+cindex: occur, command
915 #+vindex: org-show-context-detail
916 An important feature of Org mode is the ability to construct /sparse
917 trees/ for selected information in an outline tree, so that the entire
918 document is folded as much as possible, but the selected information
919 is made visible along with the headline structure above it[fn:7].
920 Just try it out and you will see immediately how it works.
922 Org mode contains several commands creating such trees, all these
923 commands can be accessed through a dispatcher:
925 - {{{kbd(C-c /)}}} (~org-sparse-tree~) ::
928 #+findex: org-sparse-tree
929 This prompts for an extra key to select a sparse-tree creating
932 - {{{kbd(C-c / r)}}} or {{{kbd(C-c / /)}}} (~org-occur~) ::
937 #+vindex: org-remove-highlights-with-change
938 Prompts for a regexp and shows a sparse tree with all matches.
939 If the match is in a headline, the headline is made visible. If
940 the match is in the body of an entry, headline and body are made
941 visible. In order to provide minimal context, also the full
942 hierarchy of headlines above the match is shown, as well as the
943 headline following the match. Each match is also highlighted;
944 the highlights disappear when the buffer is changed by an editing
945 command, or by pressing {{{kbd(C-c C-c)}}}[fn:8]. When called
946 with a {{{kbd(C-u)}}} prefix argument, previous highlights are
947 kept, so several calls to this command can be stacked.
949 - {{{kbd(M-g n)}}} or {{{kbd(M-g M-n)}}} (~next-error~) ::
954 Jump to the next sparse tree match in this buffer.
956 - {{{kbd(M-g p)}}} or {{{kbd(M-g M-p)}}} (~previous-error~) ::
960 #+findex: previous-error
961 Jump to the previous sparse tree match in this buffer.
963 #+vindex: org-agenda-custom-commands
965 For frequently used sparse trees of specific search strings, you can
966 use the variable ~org-agenda-custom-commands~ to define fast keyboard
967 access to specific sparse trees. These commands will then be
968 accessible through the agenda dispatcher (see [[*The Agenda Dispatcher]]).
971 #+begin_src emacs-lisp
972 (setq org-agenda-custom-commands
973 '(("f" occur-tree "FIXME")))
977 defines the key {{{kbd(f)}}} as a shortcut for creating a sparse tree
978 matching the string =FIXME=.
980 The other sparse tree commands select headings based on TODO keywords,
981 tags, or properties and are discussed later in this manual.
984 #+cindex: printing sparse trees
985 #+cindex: visible text, printing
986 To print a sparse tree, you can use the Emacs command
987 ~ps-print-buffer-with-faces~ which does not print invisible parts of
988 the document. Or you can use the command {{{kbd(C-c C-e v)}}} to
989 export only the visible part of the document and print the resulting
994 :DESCRIPTION: Additional structure within an entry.
996 #+cindex: plain lists
997 #+cindex: lists, plain
998 #+cindex: lists, ordered
999 #+cindex: ordered lists
1001 Within an entry of the outline tree, hand-formatted lists can provide
1002 additional structure. They also provide a way to create lists of
1003 checkboxes (see [[*Checkboxes]]). Org supports editing such lists, and
1004 every exporter (see [[*Exporting]]) can parse and format them.
1006 Org knows ordered lists, unordered lists, and description lists.
1008 #+attr_texinfo: :indic @bullet
1009 - /Unordered/ list items start with =-=, =+=, or =*=[fn:9] as bullets.
1012 #+vindex: org-plain-list-ordered-item-terminator
1013 #+vindex: org-alphabetical-lists
1014 /Ordered/ list items start with a numeral followed by either
1015 a period or a right parenthesis[fn:10], such as =1.= or =1)=[fn:11]
1016 If you want a list to start with a different value---e.g.,
1017 20---start the text of the item with =[@20]=[fn:12]. Those
1018 constructs can be used in any item of the list in order to enforce
1019 a particular numbering.
1021 - /Description/ list items are unordered list items, and contain the
1022 separator =::= to distinguish the description /term/ from the
1025 Items belonging to the same list must have the same indentation on the
1026 first line. In particular, if an ordered list reaches number =10.=,
1027 then the 2-digit numbers must be written left-aligned with the other
1028 numbers in the list. An item ends before the next line that is less
1029 or equally indented than its bullet/number.
1031 A list ends whenever every item has ended, which means before any line
1032 less or equally indented than items at top level. It also ends before
1033 two blank lines. In that case, all items are closed. Here is an
1037 ,* Lord of the Rings
1038 My favorite scenes are (in this order)
1039 1. The attack of the Rohirrim
1040 2. Eowyn's fight with the witch king
1041 + this was already my favorite scene in the book
1042 + I really like Miranda Otto.
1043 3. Peter Jackson being shot by Legolas
1045 He makes a really funny face when it happens.
1046 But in the end, no individual scenes matter but the film as a whole.
1047 Important actors in this film are:
1048 - Elijah Wood :: He plays Frodo
1049 - Sean Astin :: He plays Sam, Frodo's friend. I still remember him
1050 very well from his role as Mikey Walsh in /The Goonies/.
1053 Org supports these lists by tuning filling and wrapping commands to
1054 deal with them correctly, and by exporting them properly (see
1055 [[Exporting]]). Since indentation is what governs the structure of these
1056 lists, many structural constructs like =#+BEGIN_= blocks can be
1057 indented to signal that they belong to a particular item.
1059 #+vindex: org-list-demote-modify-bullet
1060 #+vindex: org-list-indent-offset
1061 If you find that using a different bullet for a sub-list---than that
1062 used for the current list-level---improves readability, customize the
1063 variable ~org-list-demote-modify-bullet~. To get a greater difference
1064 of indentation between items and theirs sub-items, customize
1065 ~org-list-indent-offset~.
1067 #+vindex: org-list-automatic-rules
1068 The following commands act on items when the cursor is in the first
1069 line of an item---the line with the bullet or number. Some of them
1070 imply the application of automatic rules to keep list structure
1071 intact. If some of these actions get in your way, configure
1072 ~org-list-automatic-rules~ to disable them individually.
1074 #+attr_texinfo: :sep ,
1075 - {{{kbd(TAB)}}} (~org-cycle~) ::
1077 #+cindex: cycling, in plain lists
1080 #+vindex: org-cycle-include-plain-lists
1081 Items can be folded just like headline levels. Normally this
1082 works only if the cursor is on a plain list item. For more
1083 details, see the variable ~org-cycle-include-plain-lists~. If
1084 this variable is set to ~integrate~, plain list items are treated
1085 like low-level headlines. The level of an item is then given by
1086 the indentation of the bullet/number. Items are always
1087 subordinate to real headlines, however; the hierarchies remain
1088 completely separated. In a new item with no text yet, the first
1089 {{{kbd(TAB)}}} demotes the item to become a child of the previous
1090 one. Subsequent {{{kbd(TAB)}}}s move the item to meaningful
1091 levels in the list and eventually get it back to its initial
1094 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
1097 #+findex: org-insert-heading
1098 #+vindex: org-M-RET-may-split-line
1099 Insert new item at current level. With a prefix argument, force
1100 a new heading (see [[*Structure Editing]]). If this command is used
1101 in the middle of an item, that item is /split/ in two, and the
1102 second part becomes the new item[fn:13]. If this command is
1103 executed /before item's body/, the new item is created /before/
1106 - {{{kbd(M-S-RET)}}} ::
1109 Insert a new item with a checkbox (see [[Checkboxes]]).
1111 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}} ::
1115 #+cindex: shift-selection-mode
1116 #+vindex: org-support-shift-select
1117 #+vindex: org-list-use-circular-motion
1118 Jump to the previous/next item in the current list, but only if
1119 ~org-support-shift-select~ is off[fn:14]. If not, you can
1120 still use paragraph jumping commands like {{{kbd(C-UP)}}}
1121 and {{{kbd(C-DOWN)}}} to quite similar effect.
1123 - {{{kbd(M-UP)}}}, {{{kbd(M-DOWN)}}} ::
1127 Move the item including subitems up/down[fn:15], i.e., swap with
1128 previous/next item of same indentation. If the list is ordered,
1129 renumbering is automatic.
1131 - {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} ::
1135 Decrease/increase the indentation of an item, leaving children
1138 - {{{kbd(M-S-LEFT)}}}, {{{kbd(M-S-RIGHT)}}} ::
1142 Decrease/increase the indentation of the item, including
1143 subitems. Initially, the item tree is selected based on current
1144 indentation. When these commands are executed several times in
1145 direct succession, the initially selected region is used, even if
1146 the new indentation would imply a different hierarchy. To use
1147 the new hierarchy, break the command chain with a cursor motion
1150 As a special case, using this command on the very first item of
1151 a list moves the whole list. This behavior can be disabled by
1152 configuring ~org-list-automatic-rules~. The global indentation
1153 of a list has no influence on the text /after/ the list.
1155 - {{{kbd(C-c C-c)}}} ::
1158 If there is a checkbox (see [[Checkboxes]]) in the item line, toggle
1159 the state of the checkbox. In any case, verify bullets and
1160 indentation consistency in the whole list.
1162 - {{{kbd(C-c -)}}} ::
1165 #+vindex: org-plain-list-ordered-item-terminator
1166 Cycle the entire list level through the different
1167 itemize/enumerate bullets (=-=, =+=, =*=, =1.=, =1)=) or a subset
1168 of them, depending on ~org-plain-list-ordered-item-terminator~,
1169 the type of list, and its indentation. With a numeric prefix
1170 argument N, select the Nth bullet from this list. If there is an
1171 active region when calling this, selected text is changed into an
1172 item. With a prefix argument, all lines are converted to list
1173 items. If the first line already was a list item, any item
1174 marker is removed from the list. Finally, even without an active
1175 region, a normal line is converted into a list item.
1177 - {{{kbd(C-c *)}}} ::
1180 Turn a plain list item into a headline---so that it becomes
1181 a subheading at its location. See [[*Structure Editing]], for
1182 a detailed explanation.
1184 - {{{kbd(C-c C-*)}}} ::
1187 Turn the whole plain list into a subtree of the current heading.
1188 Checkboxes (see [[*Checkboxes]]) become TODO, respectively DONE,
1189 keywords when unchecked, respectively checked.
1191 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
1193 #+vindex: org-support-shift-select
1196 This command also cycles bullet styles when the cursor in on the
1197 bullet or anywhere in an item line, details depending on
1198 ~org-support-shift-select~.
1200 - {{{kbd(C-c ^)}}} ::
1203 #+cindex: sorting, of plain list
1204 Sort the plain list. Prompt for the sorting method: numerically,
1205 alphabetically, by time, or by custom function.
1209 :DESCRIPTION: Tucking stuff away.
1212 #+cindex: visibility cycling, drawers
1214 Sometimes you want to keep information associated with an entry, but
1215 you normally do not want to see it. For this, Org mode has /drawers/.
1216 They can contain anything but a headline and another drawer. Drawers
1220 ,** This is a headline
1221 Still outside the drawer
1223 This is inside the drawer.
1229 #+findex: org-insert-drawer
1230 You can interactively insert a drawer at point by calling
1231 ~org-insert-drawer~, which is bound to {{{kbd(C-c C-x d)}}}. With an
1232 active region, this command puts the region inside the drawer. With
1233 a prefix argument, this command calls ~org-insert-property-drawer~,
1234 which creates a =PROPERTIES= drawer right below the current headline.
1235 Org mode uses this special drawer for storing properties (see
1236 [[*Properties and Columns]]). You cannot use it for anything else.
1238 Completion over drawer keywords is also possible using
1239 {{{kbd(M-TAB)}}}[fn:16].
1241 Visibility cycling (see [[*Visibility Cycling]]) on the headline hides and
1242 shows the entry, but keep the drawer collapsed to a single line. In
1243 order to look inside the drawer, you need to move the cursor to the
1244 drawer line and press {{{kbd(TAB)}}} there.
1246 You can also arrange for state change notes (see [[Tracking TODO state
1247 changes]]) and clock times (see [[*Clocking Work Time]]) to be stored in
1248 a =LOGBOOK= drawer. If you want to store a quick note there, in
1249 a similar way to state changes, use
1251 - {{{kbd(C-c C-z)}}} ::
1254 Add a time-stamped note to the =LOGBOOK= drawer.
1258 :DESCRIPTION: Folding blocks.
1260 #+vindex: org-hide-block-startup
1261 #+cindex: blocks, folding
1263 Org mode uses =#+BEGIN= ... =#+END= blocks for various purposes from
1264 including source code examples (see [[*Literal Examples]]) to capturing
1265 time logging information (see [[*Clocking Work Time]]). These blocks can
1266 be folded and unfolded by pressing {{{kbd(TAB)}}} in the =#+BEGIN=
1267 line. You can also get all blocks folded at startup by configuring
1268 the variable ~org-hide-block-startup~ or on a per-file basis by using
1270 #+cindex: STARTUP, keyword
1272 ,#+STARTUP: hideblocks
1273 ,#+STARTUP: nohideblocks
1276 ** Creating Footnotes
1278 :DESCRIPTION: How footnotes are defined in Org's syntax.
1282 Org mode supports the creation of footnotes.
1284 A footnote is started by a footnote marker in square brackets in
1285 column 0, no indentation allowed. It ends at the next footnote
1286 definition, headline, or after two consecutive empty lines. The
1287 footnote reference is simply the marker in square brackets, inside
1288 text. Markers always start with =fn:=. For example:
1291 The Org homepage[fn:1] now looks a lot better than it used to.
1293 [fn:1] The link is: https://orgmode.org
1296 Org mode extends the number-based syntax to /named/ footnotes and
1297 optional inline definition. Here are the valid references:
1301 A named footnote reference, where {{{var(NAME)}}} is a unique
1302 label word, or, for simplicity of automatic creation, a number.
1304 - =[fn:: This is the inline definition of this footnote]= ::
1306 A LaTeX-like anonymous footnote where the definition is given
1307 directly at the reference point.
1309 - =[fn:NAME: a definition]= ::
1311 An inline definition of a footnote, which also specifies a name
1312 for the note. Since Org allows multiple references to the same
1313 note, you can then use =[fn:NAME]= to create additional
1316 #+vindex: org-footnote-auto-label
1317 Footnote labels can be created automatically, or you can create names
1318 yourself. This is handled by the variable ~org-footnote-auto-label~
1319 and its corresponding =STARTUP= keywords. See the docstring of that
1320 variable for details.
1322 #+texinfo: @noindent
1323 The following command handles footnotes:
1325 - {{{kbd(C-c C-x f)}}} ::
1327 The footnote action command.
1330 When the cursor is on a footnote reference, jump to the
1331 definition. When it is at a definition, jump to
1332 the---first---reference.
1334 #+vindex: org-footnote-define-inline
1335 #+vindex: org-footnote-section
1336 Otherwise, create a new footnote. Depending on the variable
1337 ~org-footnote-define-inline~[fn:17], the definition is placed
1338 right into the text as part of the reference, or separately into
1339 the location determined by the variable ~org-footnote-section~.
1341 When this command is called with a prefix argument, a menu of
1342 additional options is offered:
1344 #+attr_texinfo: :columns 0.1 0.9
1345 | {{{kbd(s)}}} | Sort the footnote definitions by reference sequence. |
1346 | {{{kbd(r)}}} | Renumber the simple =fn:N= footnotes. |
1347 | {{{kbd(S)}}} | Short for first {{{kbd(r)}}}, then {{{kbd(s)}}} action. |
1348 | {{{kbd(n)}}} | Rename all footnotes into a =fn:1= ... =fn:n= sequence. |
1349 | {{{kbd(d)}}} | Delete the footnote at point, including definition and references. |
1351 #+vindex: org-footnote-auto-adjust
1352 Depending on the variable ~org-footnote-auto-adjust~[fn:18],
1353 renumbering and sorting footnotes can be automatic after each
1354 insertion or deletion.
1356 - {{{kbd(C-c C-c)}}} ::
1359 If the cursor is on a footnote reference, jump to the definition.
1360 If it is at the definition, jump back to the reference. When
1361 called at a footnote location with a prefix argument, offer the
1362 same menu as {{{kbd(C-c C-x f)}}}.
1364 - {{{kbd(C-c C-o)}}} or {{{kbd(mouse-1/2)}}} ::
1369 Footnote labels are also links to the corresponding definition or
1370 reference, and you can use the usual commands to follow these
1375 :DESCRIPTION: Formal description of Org's syntax.
1378 A reference document providing a formal description of Org's syntax is
1379 available as [[https://orgmode.org/worg/dev/org-syntax.html][a draft on Worg]], written and maintained by Nicolas
1380 Goaziou. It defines Org's core internal concepts such as =headlines=,
1381 =sections=, =affiliated keywords=, =(greater) elements= and =objects=.
1382 Each part of an Org file falls into one of the categories above.
1384 To explore the abstract structure of an Org buffer, run this in
1387 : M-: (org-element-parse-buffer) <RET>
1389 #+texinfo: @noindent
1390 It outputs a list containing the buffer's content represented as an
1391 abstract structure. The export engine relies on the information
1392 stored in this list. Most interactive commands---e.g., for structure
1393 editing---also rely on the syntactic meaning of the surrounding
1396 #+cindex: syntax checker
1399 You can check syntax in your documents using ~org-lint~ command.
1403 :DESCRIPTION: Pure magic for quick formatting.
1406 #+cindex: editing tables
1408 Org comes with a fast and intuitive table editor. Spreadsheet-like
1409 calculations are supported using the Emacs Calc package (see
1412 ** Built-in Table Editor
1414 :DESCRIPTION: Simple tables.
1416 #+cindex: table editor, built-in
1418 Org makes it easy to format tables in plain ASCII. Any line with =|=
1419 as the first non-whitespace character is considered part of a table.
1420 =|= is also the column separator[fn:19]. A table might look like
1424 | Name | Phone | Age |
1425 |-------+-------+-----|
1426 | Peter | 1234 | 17 |
1427 | Anna | 4321 | 25 |
1430 A table is re-aligned automatically each time you press
1431 {{{kbd(TAB)}}}, {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} inside the table.
1432 {{{kbd(TAB)}}} also moves to the next field---{{{kbd(RET)}}} to the
1433 next row---and creates new table rows at the end of the table or
1434 before horizontal lines. The indentation of the table is set by the
1435 first line. Any line starting with =|-= is considered as a horizontal
1436 separator line and will be expanded on the next re-align to span the
1437 whole table width. So, to create the above table, you would only type
1444 #+texinfo: @noindent
1445 and then press {{{kbd(TAB)}}} to align the table and start filling in
1446 fields. Even faster would be to type =|Name|Phone|Age= followed by
1449 When typing text into a field, Org treats {{{kbd(DEL)}}},
1450 {{{kbd(Backspace)}}}, and all character keys in a special way, so that
1451 inserting and deleting avoids shifting other fields. Also, when
1452 typing /immediately/ after the cursor was moved into a new field with
1453 {{{kbd(TAB)}}}, {{{kbd(S-TAB)}}} or {{{kbd(RET)}}}, the field is
1454 automatically made blank. If this behavior is too unpredictable for
1455 you, configure the option ~org-table-auto-blank-field~.
1457 *** Creation and conversion
1462 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
1465 #+findex: org-table-create-or-convert-from-region
1466 Convert the active region to table. If every line contains at
1467 least one {{{kbd(TAB)}}} character, the function assumes that the
1468 material is tab separated. If every line contains a comma,
1469 comma-separated values (CSV) are assumed. If not, lines are
1470 split at whitespace into fields. You can use a prefix argument
1471 to force a specific separator: {{{kbd(C-u)}}} forces CSV,
1472 {{{kbd(C-u C-u)}}} forces {{{kbd(TAB)}}}, {{{kbd(C-u C-u C-u)}}}
1473 prompts for a regular expression to match the separator, and
1474 a numeric argument N indicates that at least N consecutive
1475 spaces, or alternatively a {{{kbd(TAB)}}} will be the separator.
1477 If there is no active region, this command creates an empty Org
1478 table. But it is easier just to start typing, like {{{kbd(|
1479 N a m e | P h o n e | A g e RET | - TAB)}}}.
1481 *** Re-aligning and field motion
1486 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
1489 #+findex: org-table-align
1490 Re-align the table without moving the cursor.
1492 - {{{kbd(TAB)}}} (~org-table-next-field~) ::
1495 #+findex: org-table-next-field
1496 Re-align the table, move to the next field. Creates a new row if
1499 - {{{kbd(C-c SPC)}}} (~org-table-blank-field~) ::
1502 #+findex: org-table-blank-field
1503 Blank the field at point.
1505 - {{{kbd(S-TAB)}}} (~org-table-previous-field~) ::
1508 #+findex: org-table-previous-field
1509 Re-align, move to previous field.
1511 - {{{kbd(RET)}}} (~org-table-next-row~) ::
1514 #+findex: org-table-next-row
1515 Re-align the table and move down to next row. Creates a new row
1516 if necessary. At the beginning or end of a line, {{{kbd(RET)}}}
1517 still inserts a new line, so it can be used to split a table.
1519 - {{{kbd(M-a)}}} (~org-table-beginning-of-field~) ::
1522 #+findex: org-table-beginning-of-field
1523 Move to beginning of the current table field, or on to the
1526 - {{{kbd(M-e)}}} (~org-table-end-of-field~) ::
1529 #+findex: org-table-end-of-field
1530 Move to end of the current table field, or on to the next field.
1532 *** Column and row editing
1537 - {{{kbd(M-LEFT)}}} (~org-table-move-column-left~) ::
1540 #+findex: org-table-move-column-left
1541 Move the current column left.
1543 - {{{kbd(M-RIGHT)}}} (~org-table-move-column-right~) ::
1546 #+findex: org-table-move-column-right
1547 Move the current column right.
1549 - {{{kbd(M-S-LEFT)}}} (~org-table-delete-column~) ::
1552 #+findex: org-table-delete-column
1553 Kill the current column.
1555 - {{{kbd(M-S-RIGHT)}}} (~org-table-insert-column~) ::
1558 #+findex: org-table-insert-column
1559 Insert a new column to the left of the cursor position.
1561 - {{{kbd(M-UP)}}} (~org-table-move-row-up~) ::
1564 #+findex: org-table-move-row-up
1565 Move the current row up.
1567 - {{{kbd(M-DOWN)}}} (~org-table-move-row-down~) ::
1570 #+findex: org-table-move-row-down
1571 Move the current row down.
1573 - {{{kbd(M-S-UP)}}} (~org-table-kill-row~) ::
1576 #+findex: org-table-kill-row
1577 Kill the current row or horizontal line.
1579 - {{{kbd(M-S-DOWN)}}} (~org-table-insert-row~) ::
1582 #+findex: org-table-insert-row
1583 Insert a new row above the current row. With a prefix argument,
1584 the line is created below the current one.
1586 - {{{kbd(C-c -)}}} (~org-table-insert-hline~) ::
1589 #+findex: org-table-insert-hline
1590 Insert a horizontal line below current row. With a prefix
1591 argument, the line is created above the current line.
1593 - {{{kbd(C-c RET)}}} (~org-table-hline-and-move~) ::
1596 #+findex: org-table-hline-and-move
1597 Insert a horizontal line below current row, and move the cursor
1598 into the row below that line.
1600 - {{{kbd(C-c ^)}}} (~org-table-sort-lines~) ::
1603 #+findex: org-table-sort-lines
1604 Sort the table lines in the region. The position of point
1605 indicates the column to be used for sorting, and the range of
1606 lines is the range between the nearest horizontal separator
1607 lines, or the entire table. If point is before the first column,
1608 you are prompted for the sorting column. If there is an active
1609 region, the mark specifies the first line and the sorting column,
1610 while point should be in the last line to be included into the
1611 sorting. The command prompts for the sorting type,
1612 alphabetically, numerically, or by time. You can sort in normal
1613 or reverse order. You can also supply your own key extraction
1614 and comparison functions. When called with a prefix argument,
1615 alphabetic sorting is case-sensitive.
1622 - {{{kbd(C-c C-x M-w)}}} (~org-table-copy-region~) ::
1624 #+kindex: C-c C-x M-w
1625 #+findex: org-table-copy-region
1626 Copy a rectangular region from a table to a special clipboard.
1627 Point and mark determine edge fields of the rectangle. If there
1628 is no active region, copy just the current field. The process
1629 ignores horizontal separator lines.
1631 - {{{kbd(C-c C-x C-w)}}} (~org-table-cut-region~) ::
1633 #+kindex: C-c C-x C-w
1634 #+findex: org-table-cut-region
1635 Copy a rectangular region from a table to a special clipboard,
1636 and blank all fields in the rectangle. So this is the "cut"
1639 - {{{kbd(C-c C-x C-y)}}} (~org-table-paste-rectangle~) ::
1641 #+kindex: C-c C-x C-y
1642 #+findex: org-table-paste-rectangle
1643 Paste a rectangular region into a table. The upper left corner
1644 ends up in the current field. All involved fields are
1645 overwritten. If the rectangle does not fit into the present
1646 table, the table is enlarged as needed. The process ignores
1647 horizontal separator lines.
1649 - {{{kbd(M-RET)}}} (~org-table-wrap-region~) ::
1652 #+findex: org-table-wrap-region
1653 Split the current field at the cursor position and move the rest
1654 to the line below. If there is an active region, and both point
1655 and mark are in the same column, the text in the column is
1656 wrapped to minimum width for the given number of lines.
1657 A numeric prefix argument may be used to change the number of
1658 desired lines. If there is no region, but you specify a prefix
1659 argument, the current field is made blank, and the content is
1660 appended to the field above.
1667 #+cindex: formula, in tables
1668 #+cindex: calculations, in tables
1670 - {{{kbd(C-c +)}}} (~org-table-sum~) ::
1673 #+findex: org-table-sum
1674 Sum the numbers in the current column, or in the rectangle
1675 defined by the active region. The result is shown in the echo
1676 area and can be inserted with {{{kbd(C-y)}}}.
1678 - {{{kbd(S-RET)}}} (~org-table-copy-down~) ::
1681 #+findex: org-table-copy-down
1682 #+vindex: org-table-copy-increment
1683 When current field is empty, copy from first non-empty field
1684 above. When not empty, copy current field down to next row and
1685 move cursor along with it. Depending on the variable
1686 ~org-table-copy-increment~, integer field values can be
1687 incremented during copy. Integers that are too large are not
1688 incremented, however. Also, a ~0~ prefix argument temporarily
1689 disables the increment. This key is also used by shift-selection
1690 and related modes (see [[*Packages that conflict with Org mode]]).
1697 - {{{kbd(C-c `)}}} (~org-table-edit-field~) ::
1700 #+findex: org-table-edit-field
1701 Edit the current field in a separate window. This is useful for
1702 fields that are not fully visible (see [[*Column Width and
1703 Alignment]]). When called with a {{{kbd(C-u)}}} prefix, just make
1704 the full field visible, so that it can be edited in place. When
1705 called with two {{{kbd(C-u)}}} prefixes, make the editor window
1706 follow the cursor through the table and always show the current
1707 field. The follow mode exits automatically when the cursor
1708 leaves the table, or when you repeat this command with {{{kbd(C-u
1711 - {{{kbd(M-x org-table-import)}}} ::
1713 #+findex: org-table-import
1714 Import a file as a table. The table should be TAB or whitespace
1715 separated. Use, for example, to import a spreadsheet table or
1716 data from a database, because these programs generally can write
1717 TAB-separated text files. This command works by inserting the
1718 file into the buffer and then converting the region to a table.
1719 Any prefix argument is passed on to the converter, which uses it
1720 to determine the separator.
1722 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
1725 #+findex: org-table-create-or-convert-from-region
1726 Tables can also be imported by pasting tabular text into the Org
1727 buffer, selecting the pasted text with {{{kbd(C-x C-x)}}} and
1728 then using the {{{kbd(C-c |)}}} command (see [[*Creation and
1731 - {{{kbd(M-x org-table-export)}}} ::
1733 #+findex: org-table-export
1734 #+vindex: org-table-export-default-format
1735 Export the table, by default as a TAB-separated file. Use for
1736 data exchange with, for example, spreadsheet or database
1737 programs. The format used to export the file can be configured
1738 in the variable ~org-table-export-default-format~. You may also
1739 use properties =TABLE_EXPORT_FILE= and =TABLE_EXPORT_FORMAT= to
1740 specify the file name and the format for table export in
1741 a subtree. Org supports quite general formats for exported
1742 tables. The exporter format is the same as the format used by
1743 Orgtbl radio tables, see [[*Translator functions]], for a detailed
1746 ** Column Width and Alignment
1748 :DESCRIPTION: Overrule the automatic settings.
1750 #+cindex: narrow columns in tables
1751 #+cindex: alignment in tables
1753 The width of columns is automatically determined by the table editor.
1754 The alignment of a column is determined automatically from the
1755 fraction of number-like versus non-number fields in the column.
1757 #+vindex: org-table-automatic-realign
1758 Editing a field may modify alignment of the table. Moving
1759 a contiguous row or column---i.e., using {{{kbd(TAB)}}} or
1760 {{{kbd(RET)}}}---automatically re-aligns it. If you want to disable
1761 this behavior, set ~org-table-automatic-realign~ to ~nil~. In any
1762 case, you can always align manually a table:
1764 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
1767 #+findex: org-table-align
1768 Align the current table.
1770 #+texinfo: @noindent
1771 #+vindex: org-startup-align-all-tables
1772 Setting the option ~org-startup-align-all-tables~ re-aligns all tables
1773 in a file upon visiting it. You can also set this option on
1774 a per-file basis with:
1781 Sometimes a single field or a few fields need to carry more text,
1782 leading to inconveniently wide columns. Maybe you want to hide away
1783 several columns or display them with a fixed width, regardless of
1784 content, as shown in the following example.
1787 |---+---------------------+--------| |---+-------…|…|
1788 | | <6> | | | | <6> …|…|
1789 | 1 | one | some | ----\ | 1 | one …|…|
1790 | 2 | two | boring | ----/ | 2 | two …|…|
1791 | 3 | This is a long text | column | | 3 | This i…|…|
1792 |---+---------------------+--------| |---+-------…|…|
1795 To set the width of a column, one field anywhere in the column may
1796 contain just the string =<N>= where {{{var(N)}}} specifies the width
1797 as a number of characters. You control displayed width of columns
1798 with the following tools:
1800 - {{{kbd(C-c TAB)}}} (~org-table-toggle-column-width~) ::
1803 #+findex: org-table-toggle-column-width
1804 Shrink or expand current column.
1806 If a width cookie specifies a width W for the column, shrinking
1807 it displays the first W visible characters only. Otherwise, the
1808 column is shrunk to a single character.
1810 When called before the first column or after the last one, ask
1811 for a list of column ranges to operate on.
1813 - {{{kbd(C-u C-c TAB)}}} (~org-table-shrink~) ::
1815 #+kindex: C-u C-c TAB
1816 #+findex: org-table-shrink
1817 Shrink all columns with a column width. Expand the others.
1819 - {{{kbd(C-u C-u C-c TAB)}}} (~org-table-expand~) ::
1821 #+kindex: C-u C-u C-c TAB
1822 #+findex: org-table-expand
1825 To see the full text of a shrunk field, hold the mouse over it---a
1826 tool-tip window then shows the full content. Alternatively {{{kbd(C-h
1827 .)}}} (~display-local-help~) reveals the full content. For
1828 convenience, any change to a shrunk column expands it.
1830 #+vindex: org-startup-shrink-all-tables
1831 Setting the option ~org-startup-shrink-all-tables~ shrinks all columns
1832 containing a width cookie in a file the moment it is visited. You can
1833 also set this option on a per-file basis with:
1837 If you would like to overrule the automatic alignment of number-rich
1838 columns to the right and of string-rich columns to the left, you can
1839 use =<r>=, =<c>= or =<l>= in a similar fashion. You may also combine
1840 alignment and field width like this: =<r10>=.
1842 Lines which only contain these formatting cookies are removed
1843 automatically upon exporting the document.
1847 :DESCRIPTION: Grouping to trigger vertical lines.
1849 #+cindex: grouping columns in tables
1851 When Org exports tables, it does so by default without vertical lines
1852 because that is visually more satisfying in general. Occasionally
1853 however, vertical lines can be useful to structure a table into groups
1854 of columns, much like horizontal lines can do for groups of rows. In
1855 order to specify column groups, you can use a special row where the
1856 first field contains only =/=. The further fields can either contain
1857 =<= to indicate that this column should start a group, =>= to indicate
1858 the end of a column, or =<>= (no space between =<= and =>=) to make
1859 a column a group of its own. Upon export, boundaries between column
1860 groups are marked with vertical lines. Here is an example:
1863 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1864 |---+-----+-----+-----+---------+------------|
1865 | / | < | | > | < | > |
1866 | 1 | 1 | 1 | 1 | 1 | 1 |
1867 | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
1868 | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
1869 |---+-----+-----+-----+---------+------------|
1870 ,#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
1873 It is also sufficient to just insert the column group starters after
1874 every vertical line you would like to have:
1877 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1878 |---+-----+-----+-----+---------+------------|
1882 ** The Orgtbl Minor Mode
1884 :DESCRIPTION: The table editor as minor mode.
1885 :ALT_TITLE: Orgtbl Mode
1887 #+cindex: Orgtbl mode
1888 #+cindex: minor mode for tables
1890 #+findex: orgtbl-mode
1891 If you like the intuitive way the Org table editor works, you might
1892 also want to use it in other modes like Text mode or Mail mode. The
1893 minor mode Orgtbl mode makes this possible. You can always toggle the
1894 mode with {{{kbd(M-x orgtbl-mode)}}}. To turn it on by default, for
1895 example in Message mode, use
1897 #+begin_src emacs-lisp
1898 (add-hook 'message-mode-hook 'turn-on-orgtbl)
1901 Furthermore, with some special setup, it is possible to maintain
1902 tables in arbitrary syntax with Orgtbl mode. For example, it is
1903 possible to construct LaTeX tables with the underlying ease and power
1904 of Orgtbl mode, including spreadsheet capabilities. For details, see
1905 [[*Tables in Arbitrary Syntax]].
1909 :DESCRIPTION: The table editor has spreadsheet capabilities.
1911 #+cindex: calculations, in tables
1912 #+cindex: spreadsheet capabilities
1913 #+cindex: Calc package
1915 The table editor makes use of the Emacs Calc package to implement
1916 spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms
1917 to derive fields from other fields. While fully featured, Org's
1918 implementation is not identical to other spreadsheets. For example,
1919 Org knows the concept of a /column formula/ that will be applied to
1920 all non-header fields in a column without having to copy the formula
1921 to each relevant field. There is also a formula debugger, and
1922 a formula editor with features for highlighting fields in the table
1923 corresponding to the references at the point in the formula, moving
1924 these references by arrow keys.
1928 :DESCRIPTION: How to refer to another field or range.
1930 #+cindex: references
1932 To compute fields in the table from other fields, formulas must
1933 reference other fields or ranges. In Org, fields can be referenced by
1934 name, by absolute coordinates, and by relative coordinates. To find
1935 out what the coordinates of a field are, press {{{kbd(C-c ?)}}} in
1936 that field, or press {{{kbd(C-c })}}} to toggle the display of a grid.
1938 **** Field references
1943 #+cindex: field references
1944 #+cindex: references, to fields
1945 Formulas can reference the value of another field in two ways. Like
1946 in any other spreadsheet, you may reference fields with
1947 a letter/number combination like =B3=, meaning the second field in the
1948 third row. However, Org prefers to use another, more general
1949 representation that looks like this:[fn:20]
1953 Column specifications can be absolute like =$1=, =$2=, ..., =$N=, or
1954 relative to the current column, i.e., the column of the field which is
1955 being computed, like =$+1= or =$-2=. =$<= and =$>= are immutable
1956 references to the first and last column, respectively, and you can use
1957 =$>>>= to indicate the third column from the right.
1959 The row specification only counts data lines and ignores horizontal
1960 separator lines, or "hlines". Like with columns, you can use absolute
1961 row numbers =@1=, =@2=, ..., =@N=, and row numbers relative to the
1962 current row like =@+3= or =@-1=. =@<= and =@>= are immutable
1963 references the first and last row in the table, respectively. You may
1964 also specify the row relative to one of the hlines: =@I= refers to the
1965 first hline, =@II= to the second, etc. =@-I= refers to the first such
1966 line above the current line, =@+I= to the first such line below the
1967 current line. You can also write =@III+2= which is the second data
1968 line after the third hline in the table.
1970 =@0= and =$0= refer to the current row and column, respectively, i.e.,
1971 to the row/column for the field being computed. Also, if you omit
1972 either the column or the row part of the reference, the current
1973 row/column is implied.
1975 Org's references with /unsigned/ numbers are fixed references in the
1976 sense that if you use the same reference in the formula for two
1977 different fields, the same field is referenced each time. Org's
1978 references with /signed/ numbers are floating references because the
1979 same reference operator can reference different fields depending on
1980 the field being calculated by the formula.
1982 Here are a few examples:
1984 #+attr_texinfo: :columns 0.2 0.8
1985 | =@2$3= | 2nd row, 3rd column (same as =C2=) |
1986 | =$5= | column 5 in the current row (same as =E&=) |
1987 | =@2= | current column, row 2 |
1988 | =@-1$-3= | field one row up, three columns to the left |
1989 | =@-I$2= | field just under hline above current row, column 2 |
1990 | =@>$5= | field in the last row, in column 5 |
1992 **** Range references
1997 #+cindex: range references
1998 #+cindex: references, to ranges
1999 You may reference a rectangular range of fields by specifying two
2000 field references connected by two dots =..=. If both fields are in
2001 the current row, you may simply use =$2..$7=, but if at least one
2002 field is in a different row, you need to use the general =@ROW$COLUMN=
2003 format at least for the first field, i.e., the reference must start
2004 with =@= in order to be interpreted correctly. Examples:
2006 #+attr_texinfo: :columns 0.2 0.8
2007 | =$1..$3= | first three fields in the current row |
2008 | =$P..$Q= | range, using column names (see [[*Advanced features]]) |
2009 | =$<<<..$>>= | start in third column, continue to the last but one |
2010 | =@2$1..@4$3= | six fields between these two fields (same as =A2..C4=) |
2011 | =@-1$-2..@-1= | 3 fields in the row above, starting from 2 columns on the left |
2012 | =@I..II= | between first and second hline, short for =@I..@II= |
2014 #+texinfo: @noindent
2015 Range references return a vector of values that can be fed into Calc
2016 vector functions. Empty fields in ranges are normally suppressed, so
2017 that the vector contains only the non-empty fields. For other options
2018 with the mode switches =E=, =N= and examples, see [[*Formula syntax for
2021 **** Field coordinates in formulas
2026 #+cindex: field coordinates
2027 #+cindex: coordinates, of field
2028 #+cindex: row, of field coordinates
2029 #+cindex: column, of field coordinates
2030 #+vindex: org-table-current-column
2031 #+vindex: org-table-current-dline
2032 One of the very first actions during evaluation of Calc formulas and
2033 Lisp formulas is to substitute =@#= and =$#= in the formula with the
2034 row or column number of the field where the current result will go to.
2035 The traditional Lisp formula equivalents are ~org-table-current-dline~
2036 and ~org-table-current-column~. Examples:
2038 - =if(@# % 2, $#, string(""))= ::
2040 Insert column number on odd rows, set field to empty on even
2043 - =$2 = '(identity remote(FOO, @@#$1))= ::
2045 Copy text or values of each row of column 1 of the table named
2046 {{{var(FOO)}}} into column 2 of the current table.
2048 - =@3 = 2 * remote(FOO, @@1$$#)= ::
2050 Insert the doubled value of each column of row 1 of the table
2051 named {{{var(FOO)}}} into row 3 of the current table.
2053 #+texinfo: @noindent
2054 For the second and third examples, table {{{var(FOO)}}} must have at
2055 least as many rows or columns as the current table. Note that this is
2056 inefficient[fn:21] for large number of rows.
2058 **** Named references
2062 #+cindex: named references
2063 #+cindex: references, named
2064 #+cindex: name, of column or field
2065 #+cindex: constants, in calculations
2066 #+cindex: @samp{CONSTANTS}, keyword
2067 #+vindex: org-table-formula-constants
2069 =$name= is interpreted as the name of a column, parameter or constant.
2070 Constants are defined globally through the variable
2071 ~org-table-formula-constants~, and locally---for the file---through
2072 a line like this example:
2074 : #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
2076 #+texinfo: @noindent
2077 #+vindex: constants-unit-system
2078 #+pindex: constants.el
2079 Also, properties (see [[*Properties and Columns]]) can be used as
2080 constants in table formulas: for a property =Xyz= use the name
2081 =$PROP_Xyz=, and the property will be searched in the current outline
2082 entry and in the hierarchy above it. If you have the =constants.el=
2083 package, it will also be used to resolve constants, including natural
2084 constants like =$h= for Planck's constant, and units like =$km= for
2085 kilometers[fn:22]. Column names and parameters can be specified in
2086 special table lines. These are described below, see [[*Advanced
2087 features]]. All names must start with a letter, and further consist
2088 of letters and numbers.
2090 **** Remote references
2095 #+cindex: remote references
2096 #+cindex: references, remote
2097 #+cindex: references, to a different table
2098 #+cindex: name, of column or field
2099 #+cindex: @samp{NAME}, keyword
2100 You may also reference constants, fields and ranges from a different
2101 table, either in the current file or even in a different file. The
2106 #+texinfo: @noindent
2107 where {{{var(NAME)}}} can be the name of a table in the current file
2108 as set by a =#+NAME:= line before the table. It can also be the ID of
2109 an entry, even in a different file, and the reference then refers to
2110 the first table in that entry. {{{var(REF)}}} is an absolute field or
2111 range reference as described above for example =@3$3= or =$somename=,
2112 valid in the referenced table.
2114 #+cindex: table indirection
2115 When {{{var(NAME)}}} has the format =@ROW$COLUMN=, it is substituted
2116 with the name or ID found in this field of the current table. For
2117 example =remote($1, @@>$2)= \Rightarrow =remote(year_2013, @@>$1)=. The format
2118 =B3= is not supported because it can not be distinguished from a plain
2121 *** Formula syntax for Calc
2123 :DESCRIPTION: Using Calc to compute stuff.
2125 #+cindex: formula syntax, Calc
2126 #+cindex: syntax, of formulas
2128 A formula can be any algebraic expression understood by the Emacs Calc
2129 package. Note that Calc has the non-standard convention that =/= has
2130 lower precedence than =*=, so that =a/b*c= is interpreted as
2131 =(a/(b*c))=. Before evaluation by ~calc-eval~ (see [[info:calc#Calling Calc from Your Programs][Calling Calc from
2132 Your Lisp Programs]]), variable substitution takes place according to
2133 the rules described above.
2135 #+cindex: vectors, in table calculations
2136 The range vectors can be directly fed into the Calc vector functions
2137 like ~vmean~ and ~vsum~.
2139 #+cindex: format specifier, in spreadsheet
2140 #+cindex: mode, for Calc
2141 #+vindex: org-calc-default-modes
2142 A formula can contain an optional mode string after a semicolon. This
2143 string consists of flags to influence Calc and other modes during
2144 execution. By default, Org uses the standard Calc modes (precision
2145 12, angular units degrees, fraction and symbolic modes off). The
2146 display format, however, has been changed to ~(float 8)~ to keep
2147 tables compact. The default settings can be configured using the
2148 variable ~org-calc-default-modes~.
2152 Set the internal Calc calculation precision to 20 digits.
2154 - =n3=, =s3=, =e2=, =f4= ::
2156 Normal, scientific, engineering or fixed format of the result of
2157 Calc passed back to Org. Calc formatting is unlimited in
2158 precision as long as the Calc calculation precision is greater.
2162 Degree and radian angle modes of Calc.
2166 Fraction and symbolic modes of Calc.
2170 Duration computations in Calc or Lisp, [[*Durations and time
2175 If and how to consider empty fields. Without =E= empty fields in
2176 range references are suppressed so that the Calc vector or Lisp
2177 list contains only the non-empty fields. With =E= the empty
2178 fields are kept. For empty fields in ranges or empty field
2179 references the value =nan= (not a number) is used in Calc
2180 formulas and the empty string is used for Lisp formulas. Add =N=
2181 to use 0 instead for both formula types. For the value of
2182 a field the mode =N= has higher precedence than =E=.
2186 Interpret all fields as numbers, use 0 for non-numbers. See the
2187 next section to see how this is essential for computations with
2188 Lisp formulas. In Calc formulas it is used only occasionally
2189 because there number strings are already interpreted as numbers
2194 Literal, for Lisp formulas only. See the next section.
2196 #+texinfo: @noindent
2197 Unless you use large integer numbers or high-precision calculation and
2198 display for floating point numbers you may alternatively provide
2199 a ~printf~ format specifier to reformat the Calc result after it has
2200 been passed back to Org instead of letting Calc already do the
2201 formatting[fn:23]. A few examples:
2203 | =$1+$2= | Sum of first and second field |
2204 | =$1+$2;%.2f= | Same, format result to two decimals |
2205 | =exp($2)+exp($1)= | Math functions can be used |
2206 | =$0;%.1f= | Reformat current cell to 1 decimal |
2207 | =($3-32)*5/9= | Degrees F \to C conversion |
2208 | =$c/$1/$cm= | Hz \to cm conversion, using =constants.el= |
2209 | =tan($1);Dp3s1= | Compute in degrees, precision 3, display SCI 1 |
2210 | =sin($1);Dp3%.1e= | Same, but use ~printf~ specifier for display |
2211 | =vmean($2..$7)= | Compute column range mean, using vector function |
2212 | =vmean($2..$7);EN= | Same, but treat empty fields as 0 |
2213 | =taylor($3,x=7,2)= | Taylor series of $3, at x=7, second degree |
2215 Calc also contains a complete set of logical operations (see [[info:calc#Logical%20Operations][Logical
2216 Operations]]). For example
2218 - =if($1 < 20, teen, string(""))= ::
2220 ="teen"= if age =$1= is less than 20, else the Org table result
2221 field is set to empty with the empty string.
2223 - =if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1= ::
2225 Sum of the first two columns. When at least one of the input
2226 fields is empty the Org table result field is set to empty. =E=
2227 is required to not convert empty fields to 0. =f-1= is an
2228 optional Calc format string similar to =%.1f= but leaves empty
2231 - =if(typeof(vmean($1..$7)) == 12, string(""), vmean($1..$7); E= ::
2233 Mean value of a range unless there is any empty field. Every
2234 field in the range that is empty is replaced by =nan= which lets
2235 =vmean= result in =nan=. Then =typeof == 12= detects the =nan=
2236 from ~vmean~ and the Org table result field is set to empty. Use
2237 this when the sample set is expected to never have missing
2240 - =if("$1..$7" == "[]", string(""), vmean($1..$7))= ::
2242 Mean value of a range with empty fields skipped. Every field in
2243 the range that is empty is skipped. When all fields in the range
2244 are empty the mean value is not defined and the Org table result
2245 field is set to empty. Use this when the sample set can have
2248 - =vmean($1..$7); EN= ::
2250 To complete the example before: Mean value of a range with empty
2251 fields counting as samples with value 0. Use this only when
2252 incomplete sample sets should be padded with 0 to the full size.
2254 You can add your own Calc functions defined in Emacs Lisp with
2255 ~defmath~ and use them in formula syntax for Calc.
2257 *** Emacs Lisp forms as formulas
2259 :DESCRIPTION: Writing formulas in Emacs Lisp.
2260 :ALT_TITLE: Formula syntax for Lisp
2262 #+cindex: Lisp forms, as table formulas
2264 It is also possible to write a formula in Emacs Lisp. This can be
2265 useful for string manipulation and control structures, if Calc's
2266 functionality is not enough.
2268 If a formula starts with a single-quote followed by an opening
2269 parenthesis, then it is evaluated as a Lisp form. The evaluation
2270 should return either a string or a number. Just as with Calc
2271 formulas, you can specify modes and a ~printf~ format after
2274 With Emacs Lisp forms, you need to be conscious about the way field
2275 references are interpolated into the form. By default, a reference is
2276 interpolated as a Lisp string (in double-quotes) containing the field.
2277 If you provide the =N= mode switch, all referenced elements are
2278 numbers---non-number fields will be zero---and interpolated as Lisp
2279 numbers, without quotes. If you provide the =L= flag, all fields are
2280 interpolated literally, without quotes. I.e., if you want a reference
2281 to be interpreted as a string by the Lisp form, enclose the reference
2282 operator itself in double-quotes, like ="$3"=. Ranges are inserted as
2283 space-separated fields, so you can embed them in list or vector
2286 Here are a few examples---note how the =N= mode is used when we do
2287 computations in Lisp:
2289 - ='(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))= ::
2291 Swap the first two characters of the content of column 1.
2295 Add columns 1 and 2, equivalent to Calc's =$1+$2=.
2297 - ='(apply '+ '($1..$4));N= ::
2299 Compute the sum of columns 1 to 4, like Calc's =vsum($1..$4)=.
2301 *** Durations and time values
2303 :DESCRIPTION: How to compute durations and time values.
2305 #+cindex: Duration, computing
2306 #+cindex: Time, computing
2307 #+vindex: org-table-duration-custom-format
2309 If you want to compute time values use the =T=, =t=, or =U= flag,
2310 either in Calc formulas or Elisp formulas:
2313 | Task 1 | Task 2 | Total |
2314 |---------+----------+----------|
2315 | 2:12 | 1:47 | 03:59:00 |
2316 | 2:12 | 1:47 | 03:59 |
2317 | 3:02:20 | -2:07:00 | 0.92 |
2318 ,#+TBLFM: @2$3=$1+$2;T::@3$3=$1+$2;U::@4$3=$1+$2;t
2321 Input duration values must be of the form =HH:MM[:SS]=, where seconds
2322 are optional. With the =T= flag, computed durations are displayed as
2323 =HH:MM:SS= (see the first formula above). With the =U= flag, seconds
2324 are omitted so that the result is only =HH:MM= (see second formula
2325 above). Zero-padding of the hours field depends upon the value of the
2326 variable ~org-table-duration-hour-zero-padding~.
2328 With the =t= flag, computed durations are displayed according to the
2329 value of the option ~org-table-duration-custom-format~, which defaults
2330 to ~hours~ and displays the result as a fraction of hours (see the
2331 third formula in the example above).
2333 Negative duration values can be manipulated as well, and integers are
2334 considered as seconds in addition and subtraction.
2336 *** Field and range formulas
2338 :DESCRIPTION: Formula for specific (ranges of) fields.
2340 #+cindex: field formula
2341 #+cindex: range formula
2342 #+cindex: formula, for individual table field
2343 #+cindex: formula, for range of fields
2345 To assign a formula to a particular field, type it directly into the
2346 field, preceded by =:==, for example =vsum(@II..III)=. When you press
2347 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with the cursor
2348 still in the field, the formula is stored as the formula for this
2349 field, evaluated, and the current field is replaced with the result.
2351 #+cindex: @samp{TBLFM}, keyword
2352 Formulas are stored in a special =TBLFM= keyword located directly
2353 below the table. If you type the equation in the fourth field of the
2354 third data line in the table, the formula looks like =@3$4=$1+$2=.
2355 When inserting/deleting/swapping column and rows with the appropriate
2356 commands, /absolute references/ (but not relative ones) in stored
2357 formulas are modified in order to still reference the same field. To
2358 avoid this from happening, in particular in range references, anchor
2359 ranges at the table borders (using =@<=, =@>=, =$<=, =$>=), or at
2360 hlines using the =@I= notation. Automatic adaptation of field
2361 references does of course not happen if you edit the table structure
2362 with normal editing commands---then you must fix the equations
2365 Instead of typing an equation into the field, you may also use the
2368 - {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
2371 #+findex: org-table-eval-formula
2372 Install a new formula for the current field. The command prompts
2373 for a formula with default taken from the =TBLFM= keyword,
2374 applies it to the current field, and stores it.
2376 The left-hand side of a formula can also be a special expression in
2377 order to assign the formula to a number of different fields. There is
2378 no keyboard shortcut to enter such range formulas. To add them, use
2379 the formula editor (see [[*Editing and debugging formulas]]) or edit the
2380 =TBLFM= keyword directly.
2384 Column formula, valid for the entire column. This is so common
2385 that Org treats these formulas in a special way, see [[*Column
2390 Row formula, applies to all fields in the specified row. =@>==
2395 Range formula, applies to all fields in the given rectangular
2396 range. This can also be used to assign a formula to some but not
2397 all fields in a row.
2401 Named field, see [[*Advanced features]].
2405 :DESCRIPTION: Formulas valid for an entire column.
2407 #+cindex: column formula
2408 #+cindex: formula, for table column
2410 When you assign a formula to a simple column reference like =$3==, the
2411 same formula is used in all fields of that column, with the following
2412 very convenient exceptions: (i) If the table contains horizontal
2413 separator hlines with rows above and below, everything before the
2414 first such hline is considered part of the table /header/ and is not
2415 modified by column formulas. Therefore a header is mandatory when you
2416 use column formulas and want to add hlines to group rows, like for
2417 example to separate a total row at the bottom from the summand rows
2418 above. (ii) Fields that already get a value from a field/range
2419 formula are left alone by column formulas. These conditions make
2420 column formulas very easy to use.
2422 To assign a formula to a column, type it directly into any field in
2423 the column, preceded by an equal sign, like ==$1+$2=. When you press
2424 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with the cursor
2425 still in the field, the formula is stored as the formula for the
2426 current column, evaluated and the current field replaced with the
2427 result. If the field contains only ===, the previously stored formula
2428 for this column is used. For each column, Org only remembers the most
2429 recently used formula. In the =TBLFM= keyword, column formulas look
2430 like =$4=$1+$2=. The left-hand side of a column formula can not be
2431 the name of column, it must be the numeric column reference or =$>=.
2433 Instead of typing an equation into the field, you may also use the
2436 - {{{kbd(C-c =)}}} (~org-table-eval-formula~) ::
2439 #+findex: org-table-eval-formula
2440 Install a new formula for the current column and replace current
2441 field with the result of the formula. The command prompts for
2442 a formula, with default taken from the =TBLFM= keyword, applies
2443 it to the current field and stores it. With a numeric prefix
2444 argument, e.g., {{{kbd(C-5 C-c =)}}}, the command applies it to
2445 that many consecutive fields in the current column.
2447 *** Lookup functions
2449 :DESCRIPTION: Lookup functions for searching tables.
2451 #+cindex: lookup functions in tables
2452 #+cindex: table lookup functions
2454 Org has three predefined Emacs Lisp functions for lookups in tables.
2456 - ~(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)~ ::
2458 #+findex: org-lookup-first
2459 Searches for the first element {{{var(S)}}} in list
2460 {{{var(S-LIST)}}} for which
2461 #+begin_src emacs-lisp
2464 is non-~nil~; returns the value from the corresponding position
2465 in list {{{var(R-LIST)}}}. The default {{{var(PREDICATE)}}} is
2466 ~equal~. Note that the parameters {{{var(VAL)}}} and
2467 {{{var(S)}}} are passed to {{{var(PREDICATE)}}} in the same order
2468 as the corresponding parameters are in the call to
2469 ~org-lookup-first~, where {{{var(VAL)}}} precedes
2470 {{{var(S-LIST)}}}. If {{{var(R-LIST)}}} is ~nil~, the matching
2471 element {{{var(S)}}} of {{{var(S-LIST)}}} is returned.
2473 - ~(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)~ ::
2475 #+findex: org-lookup-last
2476 Similar to ~org-lookup-first~ above, but searches for the /last/
2477 element for which {{{var(PREDICATE)}}} is non-~nil~.
2479 - ~(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)~ ::
2481 #+findex: org-lookup-all
2482 Similar to ~org-lookup-first~, but searches for /all/ elements
2483 for which {{{var(PREDICATE)}}} is non-~nil~, and returns /all/
2484 corresponding values. This function can not be used by itself in
2485 a formula, because it returns a list of values. However,
2486 powerful lookups can be built when this function is combined with
2487 other Emacs Lisp functions.
2489 If the ranges used in these functions contain empty fields, the =E=
2490 mode for the formula should usually be specified: otherwise empty
2491 fields are not included in {{{var(S-LIST)}}} and/or {{{var(R-LIST)}}}
2492 which can, for example, result in an incorrect mapping from an element
2493 of {{{var(S-LIST)}}} to the corresponding element of
2496 These three functions can be used to implement associative arrays,
2497 count matching cells, rank results, group data, etc. For practical
2498 examples see [[https://orgmode.org/worg/org-tutorials/org-lookups.html][this tutorial on Worg]].
2500 *** Editing and debugging formulas
2502 :DESCRIPTION: Fixing formulas.
2504 #+cindex: formula editing
2505 #+cindex: editing, of table formulas
2507 #+vindex: org-table-use-standard-references
2508 You can edit individual formulas in the minibuffer or directly in the
2509 field. Org can also prepare a special buffer with all active formulas
2510 of a table. When offering a formula for editing, Org converts
2511 references to the standard format (like =B3= or =D&=) if possible. If
2512 you prefer to only work with the internal format (like =@3$2= or
2513 =$4=), configure the variable ~org-table-use-standard-references~.
2515 - {{{kbd(C-c =)}}} or {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
2519 #+findex: org-table-eval-formula
2520 Edit the formula associated with the current column/field in the
2521 minibuffer. See [[*Column formulas]], and [[*Field and range formulas]].
2523 - {{{kbd(C-u C-u C-c =)}}} (~org-table-eval-formula~) ::
2525 #+kindex: C-u C-u C-c =
2526 #+findex: org-table-eval-formula
2527 Re-insert the active formula (either a field formula, or a column
2528 formula) into the current field, so that you can edit it directly
2529 in the field. The advantage over editing in the minibuffer is
2530 that you can use the command {{{kbd(C-c ?)}}}.
2532 - {{{kbd(C-c ?)}}} (~org-table-field-info~) ::
2535 #+findex: org-table-field-info
2536 While editing a formula in a table field, highlight the field(s)
2537 referenced by the reference at the cursor position in the
2540 - {{{kbd(C-c })}}} (~org-table-toggle-coordinate-overlays~) ::
2543 #+findex: org-table-toggle-coordinate-overlays
2544 Toggle the display of row and column numbers for a table, using
2545 overlays. These are updated each time the table is aligned; you
2546 can force it with {{{kbd(C-c C-c)}}}.
2548 - {{{kbd(C-c {)}}} (~org-table-toggle-formula-debugger~) ::
2551 #+findex: org-table-toggle-formula-debugger
2552 Toggle the formula debugger on and off. See below.
2554 - {{{kbd(C-c ')}}} (~org-table-edit-formulas~) ::
2557 #+findex: org-table-edit-formulas
2558 Edit all formulas for the current table in a special buffer,
2559 where the formulas are displayed one per line. If the current
2560 field has an active formula, the cursor in the formula editor
2561 marks it. While inside the special buffer, Org automatically
2562 highlights any field or range reference at the cursor position.
2563 You may edit, remove and add formulas, and use the following
2566 - {{{kbd(C-c C-c)}}} or {{{kbd(C-x C-s)}}} (~org-table-fedit-finish~) ::
2570 #+findex: org-table-fedit-finish
2571 Exit the formula editor and store the modified formulas. With
2572 {{{kbd(C-u)}}} prefix, also apply the new formulas to the
2575 - {{{kbd(C-c C-q)}}} (~org-table-fedit-abort~) ::
2578 #+findex: org-table-fedit-abort
2579 Exit the formula editor without installing changes.
2581 - {{{kbd(C-c C-r)}}} (~org-table-fedit-toggle-ref-type~) ::
2584 #+findex: org-table-fedit-toggle-ref-type
2585 Toggle all references in the formula editor between standard
2586 (like =B3=) and internal (like =@3$2=).
2588 - {{{kbd(TAB)}}} (~org-table-fedit-lisp-indent~) ::
2591 #+findex: org-table-fedit-lisp-indent
2592 Pretty-print or indent Lisp formula at point. When in a line
2593 containing a Lisp formula, format the formula according to
2594 Emacs Lisp rules. Another {{{kbd(TAB)}}} collapses the formula
2595 back again. In the open formula, {{{kbd(TAB)}}} re-indents
2596 just like in Emacs Lisp mode.
2598 - {{{kbd(M-TAB)}}} (~lisp-complete-symbol~) ::
2601 #+findex: lisp-complete-symbol
2602 Complete Lisp symbols, just like in Emacs Lisp mode.
2604 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}}, {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
2610 #+findex: org-table-fedit-ref-up
2611 #+findex: org-table-fedit-ref-down
2612 #+findex: org-table-fedit-ref-left
2613 #+findex: org-table-fedit-ref-right
2614 Shift the reference at point. For example, if the reference
2615 is =B3= and you press {{{kbd(S-RIGHT)}}}, it becomes =C3=.
2616 This also works for relative references and for hline
2619 - {{{kbd(M-S-UP)}}} (~org-table-fedit-line-up~) ::
2622 #+findex: org-table-fedit-line-up
2623 Move the test line for column formulas up in the Org buffer.
2625 - {{{kbd(M-S-DOWN)}}} (~org-table-fedit-line-down~) ::
2628 #+findex: org-table-fedit-line-down
2629 Move the test line for column formulas down in the Org buffer.
2631 - {{{kbd(M-UP)}}} (~org-table-fedit-scroll-up~) ::
2634 #+findex: org-table-fedit-scroll-up
2635 Scroll up the window displaying the table.
2637 - {{{kbd(M-DOWN)}}} (~org-table-fedit-scroll-down~) ::
2640 #+findex: org-table-fedit-scroll-down
2641 Scroll down the window displaying the table.
2643 - {{{kbd(C-c })}}} ::
2646 #+findex: org-table-toggle-coordinate-overlays
2647 Turn the coordinate grid in the table on and off.
2649 Making a table field blank does not remove the formula associated with
2650 the field, because that is stored in a different line---the =TBLFM=
2651 keyword line. During the next recalculation, the field will be filled
2652 again. To remove a formula from a field, you have to give an empty
2653 reply when prompted for the formula, or to edit the =TBLFM= keyword.
2656 You may edit the =TBLFM= keyword directly and re-apply the changed
2657 equations with {{{kbd(C-c C-c)}}} in that line or with the normal
2658 recalculation commands in the table.
2660 **** Using multiple =TBLFM= lines
2664 #+cindex: multiple formula lines
2665 #+cindex: @samp{TBLFM} keywords, multiple
2666 #+cindex: @samp{TBLFM}, switching
2669 You may apply the formula temporarily. This is useful when you switch
2670 the formula. Place multiple =TBLFM= keywords right after the table,
2671 and then press {{{kbd(C-c C-c)}}} on the formula to apply. Here is an
2683 #+texinfo: @noindent
2684 Pressing {{{kbd(C-c C-c)}}} in the line of =#+TBLFM: $2=$1*2= yields:
2695 #+texinfo: @noindent
2696 Note: If you recalculate this table, with {{{kbd(C-u C-c *)}}}, for
2697 example, you get the following result of applying only the first
2709 **** Debugging formulas
2713 #+cindex: formula debugging
2714 #+cindex: debugging, of table formulas
2716 When the evaluation of a formula leads to an error, the field content
2717 becomes the string =#ERROR=. If you would like to see what is going
2718 on during variable substitution and calculation in order to find
2719 a bug, turn on formula debugging in the Tbl menu and repeat the
2720 calculation, for example by pressing {{{kbd(C-u C-u C-c = RET)}}} in
2721 a field. Detailed information are displayed.
2723 *** Updating the table
2725 :DESCRIPTION: Recomputing all dependent fields.
2727 #+cindex: recomputing table fields
2728 #+cindex: updating, table
2730 Recalculation of a table is normally not automatic, but needs to be
2731 triggered by a command. To make recalculation at least
2732 semi-automatic, see [[*Advanced features]].
2734 In order to recalculate a line of a table or the entire table, use the
2737 - {{{kbd(C-c *)}}} (~org-table-recalculate~) ::
2740 #+findex: org-table-recalculate
2741 Recalculate the current row by first applying the stored column
2742 formulas from left to right, and all field/range formulas in the
2745 - {{{kbd(C-u C-c *)}}} or {{{kbd(C-u C-c C-c)}}} ::
2748 #+kindex: C-u C-c C-c
2749 Recompute the entire table, line by line. Any lines before the
2750 first hline are left alone, assuming that these are part of the
2753 - {{{kbd(C-u C-u C-c *)}}} or {{{kbd(C-u C-u C-c C-c)}}} (~org-table-iterate~) ::
2755 #+kindex: C-u C-u C-c *
2756 #+kindex: C-u C-u C-c C-c
2757 #+findex: org-table-iterate
2758 Iterate the table by recomputing it until no further changes
2759 occur. This may be necessary if some computed fields use the
2760 value of other fields that are computed /later/ in the
2761 calculation sequence.
2763 - {{{kbd(M-x org-table-recalculate-buffer-tables)}}} ::
2765 #+findex: org-table-recalculate-buffer-tables
2766 Recompute all tables in the current buffer.
2768 - {{{kbd(M-x org-table-iterate-buffer-tables)}}} ::
2770 #+findex: org-table-iterate-buffer-tables
2771 Iterate all tables in the current buffer, in order to converge
2772 table-to-table dependencies.
2774 *** Advanced features
2776 :DESCRIPTION: Field and column names, automatic recalculation...
2779 If you want the recalculation of fields to happen automatically, or if
2780 you want to be able to assign /names/[fn:24] to fields and columns,
2781 you need to reserve the first column of the table for special marking
2784 - {{{kbd(C-#)}}} (~org-table-rotate-recalc-marks~) ::
2787 #+findex: org-table-rotate-recalc-marks
2788 Rotate the calculation mark in first column through the states
2789 =#=, =*=, =!=, =$=. When there is an active region, change all
2790 marks in the region.
2792 Here is an example of a table that collects exam results of students
2793 and makes use of these features:
2796 |---+---------+--------+--------+--------+-------+------|
2797 | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2798 |---+---------+--------+--------+--------+-------+------|
2799 | ! | | P1 | P2 | P3 | Tot | |
2800 | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
2801 | ^ | | m1 | m2 | m3 | mt | |
2802 |---+---------+--------+--------+--------+-------+------|
2803 | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
2804 | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
2805 |---+---------+--------+--------+--------+-------+------|
2806 | | Average | | | | 25.0 | |
2807 | ^ | | | | | at | |
2808 | $ | max=50 | | | | | |
2809 |---+---------+--------+--------+--------+-------+------|
2810 ,#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f
2813 #+texinfo: @noindent
2814 *Important*: please note that for these special tables, recalculating
2815 the table with {{{kbd(C-u C-c *)}}} only affects rows that are marked
2816 =#= or =*=, and fields that have a formula assigned to the field
2817 itself. The column formulas are not applied in rows with empty first
2820 #+cindex: marking characters, tables
2821 The marking characters have the following meaning:
2825 The fields in this line define names for the columns, so that you
2826 may refer to a column as =$Tot= instead of =$6=.
2830 This row defines names for the fields /above/ the row. With such
2831 a definition, any formula in the table may use =$m1= to refer to
2832 the value =10=. Also, if you assign a formula to a names field,
2833 it is stored as =$name = ...=.
2837 Similar to =^=, but defines names for the fields in the row
2842 Fields in this row can define /parameters/ for formulas. For
2843 example, if a field in a =$= row contains =max=50=, then formulas
2844 in this table can refer to the value 50 using =$max=. Parameters
2845 work exactly like constants, only that they can be defined on
2850 Fields in this row are automatically recalculated when pressing
2851 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(S-TAB)}}} in this row.
2852 Also, this row is selected for a global recalculation with
2853 {{{kbd(C-u C-c *)}}}. Unmarked lines are left alone by this
2858 Selects this line for global recalculation with {{{kbd(C-u C-c
2859 *)}}}, but not for automatic recalculation. Use this when
2860 automatic recalculation slows down editing too much.
2864 Do not export this line. Useful for lines that contain the
2865 narrowing =<N>= markers or column group markers.
2867 Finally, just to whet your appetite for what can be done with the
2868 fantastic Calc package, here is a table that computes the Taylor
2869 series of degree n at location x for a couple of functions.
2872 |---+-------------+---+-----+--------------------------------------|
2873 | | Func | n | x | Result |
2874 |---+-------------+---+-----+--------------------------------------|
2875 | # | exp(x) | 1 | x | 1 + x |
2876 | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
2877 | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
2878 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2879 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
2880 | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
2881 |---+-------------+---+-----+--------------------------------------|
2882 ,#+TBLFM: $5=taylor($2,$4,$3);n3
2887 :DESCRIPTION: Plotting from Org tables.
2889 #+cindex: graph, in tables
2890 #+cindex: plot tables using Gnuplot
2892 Org Plot can produce graphs of information stored in Org tables,
2893 either graphically or in ASCII art.
2895 *** Graphical plots using Gnuplot
2900 #+cindex: @samp{PLOT}, keyword
2901 Org Plot can produce 2D and 3D graphs of information stored in Org
2902 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
2903 that you have both Gnuplot and Gnuplot mode installed on your system,
2904 then call {{{kbd(C-c \quot g)}}} or {{{kbd(M-x org-plot/gnuplot)}}} on the
2908 ,#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
2909 | Sede | Max cites | H-index |
2910 |-----------+-----------+---------|
2911 | Chile | 257.72 | 21.39 |
2912 | Leeds | 165.77 | 19.68 |
2913 | Sao Paolo | 71.00 | 11.50 |
2914 | Stockholm | 134.19 | 14.33 |
2915 | Morels | 257.56 | 17.67 |
2918 Notice that Org Plot is smart enough to apply the table's headers as
2919 labels. Further control over the labels, type, content, and
2920 appearance of plots can be exercised through the =PLOT= keyword
2921 preceding a table. See below for a complete list of Org Plot options.
2922 For more information and examples see the [[https://orgmode.org/worg/org-tutorials/org-plot.html][Org Plot tutorial]].
2931 Specify any Gnuplot option to be set when graphing.
2935 Specify the title of the plot.
2939 Specify which column of the table to use as the =x= axis.
2943 Specify the columns to graph as a Lisp style list, surrounded by
2944 parentheses and separated by spaces for example =dep:(3 4)= to
2945 graph the third and fourth columns. Defaults to graphing all
2946 other columns aside from the =ind= column.
2950 Specify whether the plot is =2d=, =3d=, or =grid=.
2954 Specify a =with= option to be inserted for every column being
2955 plotted, e.g., =lines=, =points=, =boxes=, =impulses=. Defaults
2960 If you want to plot to a file, specify
2961 ="path/to/desired/output-file"=.
2965 List of labels to be used for the =deps=. Defaults to the column
2966 headers if they exist.
2970 Specify an entire line to be inserted in the Gnuplot script.
2974 When plotting =3d= or =grid= types, set this to =t= to graph
2975 a flat mapping rather than a =3d= slope.
2979 Specify format of Org mode timestamps as they will be parsed by
2980 Gnuplot. Defaults to =%Y-%m-%d-%H:%M:%S=.
2984 If you want total control, you can specify a script file---place
2985 the file name between double-quotes---which will be used to plot.
2986 Before plotting, every instance of =$datafile= in the specified
2987 script will be replaced with the path to the generated data file.
2988 Note: even if you set this option, you may still want to specify
2989 the plot type, as that can impact the content of the data file.
2996 While the cursor is on a column, typing {{{kbd(C-c " a)}}} or
2997 {{{kbd(M-x orgtbl-ascii-plot)}}} create a new column containing an
2998 ASCII-art bars plot. The plot is implemented through a regular column
2999 formula. When the source column changes, the bar plot may be updated
3000 by refreshing the table, for example typing {{{kbd(C-u C-c *)}}}.
3003 | Sede | Max cites | |
3004 |---------------+-----------+--------------|
3005 | Chile | 257.72 | WWWWWWWWWWWW |
3006 | Leeds | 165.77 | WWWWWWWh |
3007 | Sao Paolo | 71.00 | WWW; |
3008 | Stockholm | 134.19 | WWWWWW: |
3009 | Morelia | 257.56 | WWWWWWWWWWWH |
3010 | Rochefourchat | 0.00 | |
3011 ,#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
3014 The formula is an Elisp call.
3016 #+attr_texinfo: :options orgtbl-ascii-draw value min max &optional width
3018 Draw an ASCII bar in a table.
3020 {{{var(VALUE)}}} is the value to plot.
3022 {{{var(MIN)}}} is the value displayed as an empty bar. {{{var(MAX)}}}
3023 is the value filling all the {{{var(WIDTH)}}}. Sources values outside
3024 this range are displayed as =too small= or =too large=.
3026 {{{var(WIDTH)}}} is the number of characters of the bar plot. It
3032 :DESCRIPTION: Notes in context.
3034 #+cindex: hyperlinks
3036 Like HTML, Org provides links inside a file, external links to
3037 other files, Usenet articles, emails, and much more.
3041 :DESCRIPTION: How links in Org are formatted.
3043 #+cindex: link format
3044 #+cindex: format, of links
3046 Org recognizes plain URL-like links and activate them as clickable
3047 links. The general link format, however, looks like this:
3049 : [[LINK][DESCRIPTION]]
3051 #+texinfo: @noindent
3056 #+texinfo: @noindent
3057 Once a link in the buffer is complete (all brackets present), Org
3058 changes the display so that =DESCRIPTION= is displayed instead of
3059 =[[LINK][DESCRIPTION]]= and =LINK= is displayed instead of =[[LINK]]=. Links are be
3060 highlighted in the face ~org-link~, which by default is an underlined
3061 face. You can directly edit the visible part of a link. Note that
3062 this can be either the LINK part, if there is no description, or the
3063 {{{var(DESCRIPTION)}}} part. To edit also the invisible
3064 {{{var(LINK)}}} part, use {{{kbd(C-c C-l)}}} with the cursor on the
3067 If you place the cursor at the beginning or just behind the end of the
3068 displayed text and press {{{kbd(BS)}}}, you remove
3069 the---invisible---bracket at that location. This makes the link
3070 incomplete and the internals are again displayed as plain text.
3071 Inserting the missing bracket hides the link internals again. To show
3072 the internal structure of all links, use the menu: Org \rarr Hyperlinks \rarr
3077 :DESCRIPTION: Links to other places in the current file.
3079 #+cindex: internal links
3080 #+cindex: links, internal
3081 #+cindex: targets, for links
3083 #+cindex: @samp{CUSTOM_ID}, property
3084 If the link does not look like a URL, it is considered to be internal
3085 in the current file. The most important case is a link like
3086 =[[#my-custom-id]]= which links to the entry with the =CUSTOM_ID= property
3087 =my-custom-id=. You are responsible yourself to make sure these
3088 custom IDs are unique in a file.
3090 Links such as =[[My Target]]= or =[[My Target][Find my target]]= lead to a text search in
3093 The link can be followed with {{{kbd(C-c C-o)}}} when the cursor is on
3094 the link, or with a mouse click (see [[*Handling Links]]). Links to
3095 custom IDs point to the corresponding headline. The preferred match
3096 for a text link is a /dedicated target/: the same string in double
3097 angular brackets, like =<<My Target>>=.
3099 #+cindex: @samp{NAME}, keyword
3100 If no dedicated target exists, the link tries to match the exact name
3101 of an element within the buffer. Naming is done with the =NAME=
3102 keyword, which has to be put in the line before the element it refers
3103 to, as in the following example
3112 If none of the above succeeds, Org searches for a headline that is
3113 exactly the link text but may also include a TODO keyword and
3116 During export, internal links are used to mark objects and assign them
3117 a number. Marked objects are then referenced by links pointing to
3118 them. In particular, links without a description appear as the number
3119 assigned to the marked object[fn:26]. In the following excerpt from
3124 2. <<target>>another item
3125 Here we refer to item [[target]].
3128 #+texinfo: @noindent
3129 The last sentence will appear as =Here we refer to item 2= when
3132 In non-Org files, the search looks for the words in the link text. In
3133 the above example the search would be for =target=.
3135 Following a link pushes a mark onto Org's own mark ring. You can
3136 return to the previous position with {{{kbd(C-c &)}}}. Using this
3137 command several times in direct succession goes back to positions
3142 :DESCRIPTION: Make targets trigger links in plain text.
3144 #+cindex: radio targets
3145 #+cindex: targets, radio
3146 #+cindex: links, radio targets
3148 Org can automatically turn any occurrences of certain target names in
3149 normal text into a link. So without explicitly creating a link, the
3150 text connects to the target radioing its position. Radio targets are
3151 enclosed by triple angular brackets. For example, a target =<<<My
3152 Target>>>= causes each occurrence of =my target= in normal text to
3153 become activated as a link. The Org file is scanned automatically for
3154 radio targets only when the file is first loaded into Emacs. To
3155 update the target list during editing, press {{{kbd(C-c C-c)}}} with
3156 the cursor on or at a target.
3160 :DESCRIPTION: URL-like links to the world.
3162 #+cindex: links, external
3163 #+cindex: external links
3164 #+cindex: Gnus links
3165 #+cindex: BBDB links
3168 #+cindex: file links
3169 #+cindex: Rmail links
3170 #+cindex: MH-E links
3171 #+cindex: Usenet links
3172 #+cindex: shell links
3173 #+cindex: Info links
3174 #+cindex: Elisp links
3176 Org supports links to files, websites, Usenet and email messages, BBDB
3177 database entries and links to both IRC conversations and their logs.
3178 External links are URL-like locators. They start with a short
3179 identifying string followed by a colon. There can be no space after
3180 the colon. The following list shows examples for each link type.
3182 | =http://www.astro.uva.nl/=dominik= | on the web |
3183 | =doi:10.1000/182= | DOI for an electronic resource |
3184 | =file:/home/dominik/images/jupiter.jpg= | file, absolute path |
3185 | =/home/dominik/images/jupiter.jpg= | same as above |
3186 | =file:papers/last.pdf= | file, relative path |
3187 | =./papers/last.pdf= | same as above |
3188 | =file:/ssh:me@some.where:papers/last.pdf= | file, path on remote machine |
3189 | =/ssh:me@some.where:papers/last.pdf= | same as above |
3190 | =file:sometextfile::NNN= | file, jump to line number |
3191 | =file:projects.org= | another Org file |
3192 | =file:projects.org::some words= | text search in Org file[fn:27] |
3193 | =file:projects.org::*task title= | heading search in Org file |
3194 | =file+sys:/path/to/file= | open via OS, like double-click |
3195 | =file+emacs:/path/to/file= | force opening by Emacs |
3196 | =docview:papers/last.pdf::NNN= | open in doc-view mode at page |
3197 | =id:B7423F4D-2E8A-471B-8810-C40F074717E9= | Link to heading by ID |
3198 | =news:comp.emacs= | Usenet link |
3199 | =mailto:adent@galaxy.net= | Mail link |
3200 | =mhe:folder= | MH-E folder link |
3201 | =mhe:folder#id= | MH-E message link |
3202 | =rmail:folder= | Rmail folder link |
3203 | =rmail:folder#id= | Rmail message link |
3204 | =gnus:group= | Gnus group link |
3205 | =gnus:group#id= | Gnus article link |
3206 | =bbdb:R.*Stallman= | BBDB link (with regexp) |
3207 | =irc:/irc.com/#emacs/bob= | IRC link |
3208 | =info:org#External links= | Info node link |
3209 | =shell:ls *.org= | A shell command |
3210 | =elisp:org-agenda= | Interactive Elisp command |
3211 | =elisp:(find-file-other-frame "Elisp.org")= | Elisp form to evaluate |
3214 #+cindex: Wanderlust links
3215 On top of these built-in link types, some are available through the
3216 =contrib/= directory (see [[*Installation]]). For example, these links to
3217 VM or Wanderlust messages are available when you load the
3218 corresponding libraries from the =contrib/= directory:
3220 | =vm:folder= | VM folder link |
3221 | =vm:folder#id= | VM message link |
3222 | =vm://myself@some.where.org/folder#id= | VM on remote machine |
3223 | =vm-imap:account:folder= | VM IMAP folder link |
3224 | =vm-imap:account:folder#id= | VM IMAP message link |
3225 | =wl:folder= | Wanderlust folder link |
3226 | =wl:folder#id= | Wanderlust message link |
3228 For customizing Org to add new link types, see [[*Adding Hyperlink
3231 A link should be enclosed in double brackets and may contain
3232 a descriptive text to be displayed instead of the URL (see [[*Link
3233 Format]]), for example:
3235 : [[http://www.gnu.org/software/emacs/][GNU Emacs]]
3237 #+texinfo: @noindent
3238 If the description is a file name or URL that points to an image, HTML
3239 export (see [[*HTML Export]]) inlines the image as a clickable button. If
3240 there is no description at all and the link points to an image, that
3241 image is inlined into the exported HTML file.
3243 #+cindex: square brackets, around links
3244 #+cindex: angular brackets, around links
3245 #+cindex: plain text external links
3246 Org also finds external links in the normal text and activates them as
3247 links. If spaces must be part of the link (for example in
3248 =bbdb:Richard Stallman=), or if you need to remove ambiguities about
3249 the end of the link, enclose them in square or angular brackets.
3253 :DESCRIPTION: Creating, inserting and following.
3255 #+cindex: links, handling
3257 Org provides methods to create a link in the correct syntax, to insert
3258 it into an Org file, and to follow the link.
3260 #+findex: org-store-link
3261 #+cindex: storing links
3262 The main function is ~org-store-link~, called with {{{kbd(M-x
3263 org-store-link)}}}. Because of its importance, we suggest to bind it
3264 to a widely available key (see [[*Activation]]). It stores a link to the
3265 current location. The link is stored for later insertion into an Org
3266 buffer---see below. What kind of link is created depends on the
3269 - /Org mode buffers/ ::
3271 For Org files, if there is a =<<target>>= at the cursor, the link
3272 points to the target. Otherwise it points to the current
3273 headline, which is also the description[fn:28].
3275 #+vindex: org-link-to-org-use-id
3276 #+cindex: @samp{CUSTOM_ID}, property
3277 #+cindex: @samp{ID}, property
3278 If the headline has a =CUSTOM_ID= property, store a link to this
3279 custom ID. In addition or alternatively, depending on the value
3280 of ~org-link-to-org-use-id~, create and/or use a globally unique
3281 ID property for the link[fn:29]. So using this command in Org
3282 buffers potentially creates two links: a human-readable link from
3283 the custom ID, and one that is globally unique and works even if
3284 the entry is moved from file to file. Later, when inserting the
3285 link, you need to decide which one to use.
3287 - /Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus/ ::
3289 Pretty much all Emacs mail clients are supported. The link
3290 points to the current article, or, in some Gnus buffers, to the
3291 group. The description is constructed from the author and the
3294 - /Web browsers: W3, W3M and EWW/ ::
3296 Here the link is the current URL, with the page title as
3299 - /Contacts: BBDB/ ::
3301 Links created in a BBDB buffer point to the current entry.
3305 #+vindex: org-irc-links-to-logs
3306 For IRC links, if the variable ~org-irc-link-to-logs~ is
3307 non-~nil~, create a =file= style link to the relevant point in
3308 the logs for the current conversation. Otherwise store an =irc=
3309 style link to the user/channel/server under the point.
3313 For any other file, the link points to the file, with a search
3314 string (see [[*Search Options in File Links]]) pointing to the
3315 contents of the current line. If there is an active region, the
3316 selected words form the basis of the search string. If the
3317 automatically created link is not working correctly or accurately
3318 enough, you can write custom functions to select the search
3319 string and to do the search for particular file types (see
3320 [[*Custom Searches]]).
3322 You can also define dedicated links to other files. See [[*Adding
3327 When the cursor is in an agenda view, the created link points to
3328 the entry referenced by the current line.
3330 From an Org buffer, the following commands create, navigate or, more
3331 generally, act on links.
3333 #+attr_texinfo: :sep ,
3334 - {{{kbd(C-c C-l)}}} (~org-insert-link~) ::
3337 #+findex: org-insert-link
3338 #+cindex: link completion
3339 #+cindex: completion, of links
3340 #+cindex: inserting links
3341 #+vindex: org-keep-stored-link-after-insertion
3342 Insert a link[fn:30]. This prompts for a link to be inserted
3343 into the buffer. You can just type a link, using text for an
3344 internal link, or one of the link type prefixes mentioned in the
3345 examples above. The link is inserted into the buffer, along with
3346 a descriptive text[fn:31]. If some text was selected at this
3347 time, it becomes the default description.
3349 - /Inserting stored links/ ::
3351 All links stored during the current session are part of the
3352 history for this prompt, so you can access them with
3353 {{{kbd(UP)}}} and {{{kbd(DOWN)}}} (or {{{kbd(M-p)}}},
3356 - /Completion support/ ::
3358 Completion with {{{kbd(TAB)}}} helps you to insert valid link
3359 prefixes like =http= or =ftp=, including the prefixes defined
3360 through link abbreviations (see [[*Link Abbreviations]]). If you
3361 press {{{kbd(RET)}}} after inserting only the prefix, Org
3362 offers specific completion support for some link types[fn:32].
3363 For example, if you type {{{kbd(f i l e RET)}}}---alternative
3364 access: {{{kbd(C-u C-c C-l)}}}, see below---Org offers file
3365 name completion, and after {{{kbd(b b d b RET)}}} you can
3366 complete contact names.
3368 - {{{kbd(C-u C-c C-l)}}} ::
3370 #+cindex: file name completion
3371 #+cindex: completion, of file names
3372 #+kindex: C-u C-c C-l
3373 When {{{kbd(C-c C-l)}}} is called with a {{{kbd(C-u)}}} prefix
3374 argument, insert a link to a file. You may use file name
3375 completion to select the name of the file. The path to the file
3376 is inserted relative to the directory of the current Org file, if
3377 the linked file is in the current directory or in a sub-directory
3378 of it, or if the path is written relative to the current
3379 directory using =../=. Otherwise an absolute path is used, if
3380 possible with =~/= for your home directory. You can force an
3381 absolute path with two {{{kbd(C-u)}}} prefixes.
3383 - {{{kbd(C-c C-l)}}} (with cursor on existing link) ::
3385 #+cindex: following links
3386 When the cursor is on an existing link, {{{kbd(C-c C-l)}}} allows
3387 you to edit the link and description parts of the link.
3389 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
3392 #+findex: org-open-at-point
3393 #+vindex: org-file-apps
3394 Open link at point. This launches a web browser for URL (using
3395 ~browse-url-at-point~), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
3396 for the corresponding links, and execute the command in a shell
3397 link. When the cursor is on an internal link, this command runs
3398 the corresponding search. When the cursor is on a TAG list in
3399 a headline, it creates the corresponding TAGS view. If the
3400 cursor is on a timestamp, it compiles the agenda for that date.
3401 Furthermore, it visits text and remote files in =file= links with
3402 Emacs and select a suitable application for local non-text files.
3403 Classification of files is based on file extension only. See
3404 option ~org-file-apps~. If you want to override the default
3405 application and visit the file with Emacs, use a {{{kbd(C-u)}}}
3406 prefix. If you want to avoid opening in Emacs, use a {{{kbd(C-u
3409 #+vindex: org-link-frame-setup
3410 If the cursor is on a headline, but not on a link, offer all
3411 links in the headline and entry text. If you want to setup the
3412 frame configuration for following links, customize
3413 ~org-link-frame-setup~.
3417 #+vindex: org-return-follows-link
3419 When ~org-return-follows-link~ is set, {{{kbd(RET)}}} also
3420 follows the link at point.
3422 - {{{kbd(mouse-2)}}} or {{{kbd(mouse-1)}}} ::
3426 On links, {{{kbd(mouse-1)}}} and {{{kbd(mouse-2)}}} opens the
3427 link just as {{{kbd(C-c C-o)}}} does.
3429 - {{{kbd(mouse-3)}}} ::
3431 #+vindex: org-display-internal-link-with-indirect-buffer
3433 Like {{{kbd(mouse-2)}}}, but force file links to be opened with
3434 Emacs, and internal links to be displayed in another
3437 - {{{kbd(C-c C-x C-v)}}} (~org-toggle-inline-images~) ::
3439 #+cindex: inlining images
3440 #+cindex: images, inlining
3441 #+vindex: org-startup-with-inline-images
3442 #+kindex: C-c C-x C-v
3443 #+findex: org-toggle-inline-images
3444 Toggle the inline display of linked images. Normally this only
3445 inlines images that have no description part in the link, i.e.,
3446 images that are inlined during export. When called with a prefix
3447 argument, also display images that do have a link description.
3448 You can ask for inline images to be displayed at startup by
3449 configuring the variable ~org-startup-with-inline-images~[fn:34].
3451 - {{{kbd(C-c %)}}} (~org-mark-ring-push~) ::
3454 #+findex: org-mark-ring-push
3456 Push the current position onto the mark ring, to be able to
3457 return easily. Commands following an internal link do this
3460 - {{{kbd(C-c &)}}} (~org-mark-ring-goto~) ::
3463 #+findex: org-mark-ring-goto
3464 #+cindex: links, returning to
3465 Jump back to a recorded position. A position is recorded by the
3466 commands following internal links, and by {{{kbd(C-c %)}}}.
3467 Using this command several times in direct succession moves
3468 through a ring of previously recorded positions.
3470 - {{{kbd(C-c C-x C-n)}}} (~org-next-link~), {{{kbd(C-c C-x C-p)}}} (~org-previous-link~) ::
3472 #+kindex: C-c C-x C-p
3473 #+findex: org-previous-link
3474 #+kindex: C-c C-x C-n
3475 #+findex: org-next-link
3476 #+cindex: links, finding next/previous
3477 Move forward/backward to the next link in the buffer. At the
3478 limit of the buffer, the search fails once, and then wraps
3479 around. The key bindings for this are really too long; you might
3480 want to bind this also to {{{kbd(M-n)}}} and {{{kbd(M-p)}}}.
3482 #+begin_src emacs-lisp
3483 (add-hook 'org-load-hook
3485 (define-key org-mode-map "\M-n" 'org-next-link)
3486 (define-key org-mode-map "\M-p" 'org-previous-link)))
3489 ** Using Links Outside Org
3491 :DESCRIPTION: Linking from my C source code?
3494 #+findex: org-insert-link-global
3495 #+findex: org-open-at-point-global
3496 You can insert and follow links that have Org syntax not only in Org,
3497 but in any Emacs buffer. For this, Org provides two functions:
3498 ~org-insert-link-global~ and ~org-open-at-point-global~.
3500 You might want to bind them to globally available keys. See
3501 [[*Activation]] for some advice.
3503 ** Link Abbreviations
3505 :DESCRIPTION: Shortcuts for writing complex links.
3507 #+cindex: link abbreviations
3508 #+cindex: abbreviation, links
3510 Long URL can be cumbersome to type, and often many similar links are
3511 needed in a document. For this you can use link abbreviations. An
3512 abbreviated link looks like this
3514 : [[linkword:tag][description]]
3516 #+texinfo: @noindent
3517 #+vindex: org-link-abbrev-alist
3518 where the tag is optional. The /linkword/ must be a word, starting
3519 with a letter, followed by letters, numbers, =-=, and =_=.
3520 Abbreviations are resolved according to the information in the
3521 variable ~org-link-abbrev-alist~ that relates the linkwords to
3522 replacement text. Here is an example:
3524 #+begin_src emacs-lisp
3525 (setq org-link-abbrev-alist
3526 '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
3527 ("url-to-ja" . "http://translate.google.fr/translate?sl=en&tl=ja&u=%h")
3528 ("google" . "http://www.google.com/search?q=")
3529 ("gmap" . "http://maps.google.com/maps?q=%s")
3530 ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
3531 ("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")))
3534 If the replacement text contains the string =%s=, it is replaced with
3535 the tag. Using =%h= instead of =%s= percent-encodes the tag (see the
3536 example above, where we need to encode the URL parameter). Using
3537 =%(my-function)= passes the tag to a custom function, and replace it
3538 by the resulting string.
3540 If the replacement text do not contain any specifier, it is simply
3541 appended to the string in order to create the link.
3543 Instead of a string, you may also specify a function that will be
3544 called with the tag as the only argument to create the link.
3546 With the above setting, you could link to a specific bug with
3547 =[[bugzilla:129]]=, search the web for =OrgMode= with =[[google:OrgMode]]=,
3548 show the map location of the Free Software Foundation =[[gmap:51
3549 Franklin Street, Boston]]= or of Carsten office =[[omap:Science Park 904,
3550 Amsterdam, The Netherlands]]= and find out what the Org author is doing
3551 besides Emacs hacking with =[[ads:Dominik,C]]=.
3553 If you need special abbreviations just for a single Org buffer, you
3554 can define them in the file with
3556 #+cindex: @samp{LINK}, keyword
3558 ,#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
3559 ,#+LINK: google http://www.google.com/search?q=%s
3562 #+texinfo: @noindent
3563 In-buffer completion (see [[*Completion]]) can be used after =[= to
3564 complete link abbreviations. You may also define a function that
3565 implements special (e.g., completion) support for inserting such
3566 a link with {{{kbd(C-c C-l)}}}. Such a function should not accept any
3567 arguments, and return the full link with prefix. You can set the link
3568 completion function like this:
3570 #+begin_src emacs-lisp
3571 (org-link-set-parameter "type" :complete #'some-completion-function)
3574 ** Search Options in File Links
3576 :DESCRIPTION: Linking to a specific location.
3577 :ALT_TITLE: Search Options
3579 #+cindex: search option in file links
3580 #+cindex: file links, searching
3582 File links can contain additional information to make Emacs jump to
3583 a particular location in the file when following a link. This can be
3584 a line number or a search option after a double colon[fn:35]. For
3585 example, when the command ~org-store-link~ creates a link (see
3586 [[*Handling Links]]) to a file, it encodes the words in the current line
3587 as a search string that can be used to find this line back later when
3588 following the link with {{{kbd(C-c C-o)}}}.
3590 Here is the syntax of the different ways to attach a search to a file
3591 link, together with an explanation:
3594 [[file:~/code/main.c::255]]
3595 [[file:~/xx.org::My Target]]
3596 [[file:~/xx.org::*My Target]]
3597 [[file:~/xx.org::#my-custom-id]]
3598 [[file:~/xx.org::/regexp/]]
3607 Search for a link target =<<My Target>>=, or do a text search for
3608 =my target=, similar to the search in internal links, see
3609 [[*Internal Links]]. In HTML export (see [[*HTML Export]]), such a file
3610 link becomes a HTML reference to the corresponding named anchor
3615 In an Org file, restrict search to headlines.
3617 - =#my-custom-id= ::
3619 Link to a heading with a =CUSTOM_ID= property
3623 Do a regular expression search for {{{var(REGEXP)}}}. This uses
3624 the Emacs command ~occur~ to list all matches in a separate
3625 window. If the target file is in Org mode, ~org-occur~ is used
3626 to create a sparse tree with the matches.
3628 As a degenerate case, a file link with an empty file name can be used
3629 to search the current file. For example, =[[file:::find me]]= does
3630 a search for =find me= in the current file, just as =[[find me]]= would.
3634 :DESCRIPTION: When the default search is not enough.
3636 #+cindex: custom search strings
3637 #+cindex: search strings, custom
3639 The default mechanism for creating search strings and for doing the
3640 actual search related to a file link may not work correctly in all
3641 cases. For example, BibTeX database files have many entries like
3642 ~year="1993"~ which would not result in good search strings, because
3643 the only unique identification for a BibTeX entry is the citation key.
3645 #+vindex: org-create-file-search-functions
3646 #+vindex: org-execute-file-search-functions
3647 If you come across such a problem, you can write custom functions to
3648 set the right search string for a particular file type, and to do the
3649 search for the string in the file. Using ~add-hook~, these functions
3650 need to be added to the hook variables
3651 ~org-create-file-search-functions~ and
3652 ~org-execute-file-search-functions~. See the docstring for these
3653 variables for more information. Org actually uses this mechanism for
3654 BibTeX database files, and you can use the corresponding code as an
3655 implementation example. See the file =org-bibtex.el=.
3659 :DESCRIPTION: Every tree branch can be a TODO item.
3661 #+cindex: TODO items
3663 Org mode does not maintain TODO lists as separate documents[fn:36].
3664 Instead, TODO items are an integral part of the notes file, because
3665 TODO items usually come up while taking notes! With Org mode, simply
3666 mark any entry in a tree as being a TODO item. In this way,
3667 information is not duplicated, and the entire context from which the
3668 TODO item emerged is always present.
3670 Of course, this technique for managing TODO items scatters them
3671 throughout your notes file. Org mode compensates for this by
3672 providing methods to give you an overview of all the things that you
3675 ** Basic TODO Functionality
3677 :DESCRIPTION: Marking and displaying TODO entries.
3678 :ALT_TITLE: TODO Basics
3681 Any headline becomes a TODO item when it starts with the word =TODO=,
3684 : *** TODO Write letter to Sam Fortune
3686 #+texinfo: @noindent
3687 The most important commands to work with TODO entries are:
3689 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
3692 #+cindex: cycling, of TODO states
3693 Rotate the TODO state of the current item among
3696 ,-> (unmarked) -> TODO -> DONE --.
3697 '--------------------------------'
3700 If TODO keywords have fast access keys (see [[*Fast access to
3701 TODO states]]), prompt for a TODO keyword through the fast
3702 selection interface; this is the default behavior when
3703 ~org-use-fast-todo-selection~ is non-~nil~.
3705 The same rotation can also be done "remotely" from the timeline
3706 and agenda buffers with the {{{kbd(t)}}} command key (see
3707 [[*Commands in the Agenda Buffer]]).
3709 - {{{kbd(C-u C-c C-t)}}} ::
3711 #+kindex: C-u C-c C-t
3712 When TODO keywords have no selection keys, select a specific
3713 keyword using completion; otherwise force cycling through TODO
3714 states with no prompt. When ~org-use-fast-todo-selection~ is set
3715 to ~prefix~, use the fast selection interface.
3717 - {{{kbd(S-RIGHT)}}} {{{kbd(S-LEFT)}}} ::
3721 #+vindex: org-treat-S-cursor-todo-selection-as-state-change
3722 Select the following/preceding TODO state, similar to cycling.
3723 Useful mostly if more than two TODO states are possible (see
3724 [[*Extended Use of TODO Keywords]]). See also [[*Packages that
3725 conflict with Org mode]], for a discussion of the interaction with
3726 ~shift-selection-mode~. See also the variable
3727 ~org-treat-S-cursor-todo-selection-as-state-change~.
3729 - {{{kbd(C-c / t)}}} (~org-show-todo-tree~) ::
3732 #+cindex: sparse tree, for TODO
3733 #+vindex: org-todo-keywords
3734 #+findex: org-show-todo-tree
3735 View TODO items in a /sparse tree/ (see [[*Sparse Trees]]). Folds
3736 the entire buffer, but shows all TODO items---with not-DONE
3737 state---and the headings hierarchy above them. With a prefix
3738 argument, or by using {{{kbd(C-c / T)}}}, search for a specific
3739 TODO. You are prompted for the keyword, and you can also give
3740 a list of keywords like =KWD1|KWD2|...= to list entries that
3741 match any one of these keywords. With a numeric prefix argument
3742 N, show the tree for the Nth keyword in the variable
3743 ~org-todo-keywords~. With two prefix arguments, find all TODO
3744 states, both un-done and done.
3746 - {{{kbd(C-c a t)}}} (~org-todo-list~) ::
3749 Show the global TODO list. Collects the TODO items (with
3750 not-DONE states) from all agenda files (see [[*Agenda Views]]) into
3751 a single buffer. The new buffer is in Org Agenda mode, which
3752 provides commands to examine and manipulate the TODO entries from
3753 the new buffer (see [[*Commands in the Agenda Buffer]]). See [[*The
3754 global TODO list]], for more information.
3756 - {{{kbd(S-M-RET)}}} (~org-insert-todo-heading~) ::
3759 #+findex: org-insert-todo-heading
3760 Insert a new TODO entry below the current one.
3762 #+vindex: org-todo-state-tags-triggers
3763 #+texinfo: @noindent
3764 Changing a TODO state can also trigger tag changes. See the docstring
3765 of the option ~org-todo-state-tags-triggers~ for details.
3767 ** Extended Use of TODO Keywords
3769 :DESCRIPTION: Workflow and assignments.
3770 :ALT_TITLE: TODO Extensions
3772 #+cindex: extended TODO keywords
3774 #+vindex: org-todo-keywords
3775 By default, marked TODO entries have one of only two states: TODO and
3776 DONE. Org mode allows you to classify TODO items in more complex ways
3777 with /TODO keywords/ (stored in ~org-todo-keywords~). With special
3778 setup, the TODO keyword system can work differently in different
3781 Note that /tags/ are another way to classify headlines in general and
3782 TODO items in particular (see [[*Tags]]).
3784 *** TODO keywords as workflow states
3786 :DESCRIPTION: From TODO to DONE in steps.
3787 :ALT_TITLE: Workflow states
3789 #+cindex: TODO workflow
3790 #+cindex: workflow states as TODO keywords
3792 You can use TODO keywords to indicate different /sequential/ states in
3793 the process of working on an item, for example[fn:37]:
3795 #+begin_src emacs-lisp
3796 (setq org-todo-keywords
3797 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
3800 The vertical bar separates the TODO keywords (states that /need
3801 action/) from the DONE states (which need /no further action/). If
3802 you do not provide the separator bar, the last state is used as the
3805 #+cindex: completion, of TODO keywords
3806 With this setup, the command {{{kbd(C-c C-t)}}} cycles an entry from
3807 =TODO= to =FEEDBACK=, then to =VERIFY=, and finally to =DONE= and
3808 =DELEGATED=. You may also use a numeric prefix argument to quickly
3809 select a specific state. For example {{{kbd(C-3 C-c C-t)}}} changes
3810 the state immediately to =VERIFY=. Or you can use {{{kbd(S-LEFT)}}}
3811 to go backward through the sequence. If you define many keywords, you
3812 can use in-buffer completion (see [[*Completion]]) or even a special
3813 one-key selection scheme (see [[*Fast access to TODO states]]) to insert
3814 these words into the buffer. Changing a TODO state can be logged with
3815 a timestamp, see [[*Tracking TODO state changes]], for more information.
3817 *** TODO keywords as types
3819 :DESCRIPTION: I do this, Fred does the rest.
3820 :ALT_TITLE: TODO types
3822 #+cindex: TODO types
3823 #+cindex: names as TODO keywords
3824 #+cindex: types as TODO keywords
3826 The second possibility is to use TODO keywords to indicate different
3827 /types/ of action items. For example, you might want to indicate that
3828 items are for "work" or "home". Or, when you work with several people
3829 on a single project, you might want to assign action items directly to
3830 persons, by using their names as TODO keywords. This would be set up
3833 #+begin_src emacs-lisp
3834 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
3837 In this case, different keywords do not indicate a sequence, but
3838 rather different types. So the normal work flow would be to assign
3839 a task to a person, and later to mark it DONE. Org mode supports this
3840 style by adapting the workings of the command {{{kbd(C-c
3841 C-t)}}}[fn:38]. When used several times in succession, it still
3842 cycles through all names, in order to first select the right type for
3843 a task. But when you return to the item after some time and execute
3844 {{{kbd(C-c C-t)}}} again, it will switch from any name directly to
3845 =DONE=. Use prefix arguments or completion to quickly select
3846 a specific name. You can also review the items of a specific TODO
3847 type in a sparse tree by using a numeric prefix to {{{kbd(C-c / t)}}}.
3848 For example, to see all things Lucy has to do, you would use
3849 {{{kbd(C-3 C-c / t)}}}. To collect Lucy's items from all agenda files
3850 into a single buffer, you would use the numeric prefix argument as
3851 well when creating the global TODO list: {{{kbd(C-3 C-c a t)}}}.
3853 *** Multiple keyword sets in one file
3855 :DESCRIPTION: Mixing it all, still finding your way.
3856 :ALT_TITLE: Multiple sets in one file
3858 #+cindex: TODO keyword sets
3860 Sometimes you may want to use different sets of TODO keywords in
3861 parallel. For example, you may want to have the basic TODO/DONE, but
3862 also a workflow for bug fixing, and a separate state indicating that
3863 an item has been canceled---so it is not DONE, but also does not
3864 require action. Your setup would then look like this:
3866 #+begin_src emacs-lisp
3867 (setq org-todo-keywords
3868 '((sequence "TODO" "|" "DONE")
3869 (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
3870 (sequence "|" "CANCELED")))
3873 The keywords should all be different, this helps Org mode to keep
3874 track of which subsequence should be used for a given entry. In this
3875 setup, {{{kbd(C-c C-t)}}} only operates within a subsequence, so it
3876 switches from =DONE= to (nothing) to =TODO=, and from =FIXED= to
3877 (nothing) to =REPORT=. Therefore you need a mechanism to initially
3878 select the correct sequence. Besides the obvious ways like typing
3879 a keyword or using completion, you may also apply the following
3882 #+attr_texinfo: :sep ,
3883 - {{{kbd(C-u C-u C-c C-t)}}}, {{{kbd(C-S-RIGHT)}}}, {{{kbd(C-S-LEFT)}}} ::
3887 #+kindex: C-u C-u C-c C-t
3888 These keys jump from one TODO subset to the next. In the above
3889 example, {{{kbd(C-u C-u C-c C-t)}}} or {{{kbd(C-S-RIGHT)}}} would
3890 jump from =TODO= or =DONE= to =REPORT=, and any of the words in
3891 the second row to =CANCELED=. Note that the {{{kbd(C-S-)}}} key
3892 binding conflict with ~shift-selection-mode~ (see [[*Packages
3893 that conflict with Org mode]]).
3895 - {{{kbd(S-RIGHT)}}}, {{{kbd(S-LEFT)}}} ::
3899 {{{kbd(S-LEFT)}}} and {{{kbd(S-RIGHT)}}} walk through /all/
3900 keywords from all sets, so for example {{{kbd(S-RIGHT)}}} would
3901 switch from =DONE= to =REPORT= in the example above. For
3902 a discussion of the interaction with ~shift-selection-mode~, see
3903 [[*Packages that conflict with Org mode]].
3905 *** Fast access to TODO states
3907 :DESCRIPTION: Single letter selection of state.
3910 If you would like to quickly change an entry to an arbitrary TODO
3911 state instead of cycling through the states, you can set up keys for
3912 single-letter access to the states. This is done by adding the
3913 selection character after each keyword, in parentheses[fn:39]. For
3916 #+begin_src emacs-lisp
3917 (setq org-todo-keywords
3918 '((sequence "TODO(t)" "|" "DONE(d)")
3919 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
3920 (sequence "|" "CANCELED(c)")))
3923 #+vindex: org-fast-tag-selection-include-todo
3924 If you then press {{{kbd(C-c C-t)}}} followed by the selection key,
3925 the entry is switched to this state. {{{kbd(SPC)}}} can be used to
3926 remove any TODO keyword from an entry[fn:40].
3928 *** Setting up keywords for individual files
3930 :DESCRIPTION: Different files, different requirements.
3931 :ALT_TITLE: Per-file keywords
3933 #+cindex: keyword options
3934 #+cindex: per-file keywords
3935 #+cindex: @samp{TODO}, keyword
3936 #+cindex: @samp{TYP_TODO}, keyword
3937 #+cindex: @samp{SEQ_TODO}, keyword
3939 It can be very useful to use different aspects of the TODO mechanism
3940 in different files. For file-local settings, you need to add special
3941 lines to the file which set the keywords and interpretation for that
3942 file only. For example, to set one of the two examples discussed
3943 above, you need one of the following lines, starting in column zero
3944 anywhere in the file:
3946 : #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
3948 #+texinfo: @noindent
3949 you may also write =#+SEQ_TODO= to be explicit about the
3950 interpretation, but it means the same as =#+TODO=, or
3952 : #+TYP_TODO: Fred Sara Lucy Mike | DONE
3954 A setup for using several sets in parallel would be:
3957 ,#+TODO: TODO | DONE
3958 ,#+TODO: REPORT BUG KNOWNCAUSE | FIXED
3962 #+cindex: completion, of option keywords
3964 #+texinfo: @noindent
3965 To make sure you are using the correct keyword, type =#+= into the
3966 buffer and then use {{{kbd(M-TAB)}}} completion.
3968 #+cindex: DONE, final TODO keyword
3969 Remember that the keywords after the vertical bar---or the last
3970 keyword if no bar is there---must always mean that the item is DONE,
3971 although you may use a different word. After changing one of these
3972 lines, use {{{kbd(C-c C-c)}}} with the cursor still in the line to
3973 make the changes known to Org mode[fn:41].
3975 *** Faces for TODO keywords
3977 :DESCRIPTION: Highlighting states.
3979 #+cindex: faces, for TODO keywords
3981 #+vindex: org-todo, face
3982 #+vindex: org-done, face
3983 #+vindex: org-todo-keyword-faces
3984 Org mode highlights TODO keywords with special faces: ~org-todo~ for
3985 keywords indicating that an item still has to be acted upon, and
3986 ~org-done~ for keywords indicating that an item is finished. If you
3987 are using more than two different states, you might want to use
3988 special faces for some of them. This can be done using the variable
3989 ~org-todo-keyword-faces~. For example:
3991 #+begin_src emacs-lisp
3992 (setq org-todo-keyword-faces
3993 '(("TODO" . org-warning) ("STARTED" . "yellow")
3994 ("CANCELED" . (:foreground "blue" :weight bold))))
3997 #+vindex: org-faces-easy-properties
3998 While using a list with face properties as shown for =CANCELED=
3999 /should/ work, this does not always seem to be the case. If
4000 necessary, define a special face and use that. A string is
4001 interpreted as a color. The variable ~org-faces-easy-properties~
4002 determines if that color is interpreted as a foreground or
4005 *** TODO dependencies
4007 :DESCRIPTION: When one task needs to wait for others.
4009 #+cindex: TODO dependencies
4010 #+cindex: dependencies, of TODO states
4012 #+vindex: org-enforce-todo-dependencies
4013 #+cindex: @samp{ORDERED}, property
4014 The structure of Org files---hierarchy and lists---makes it easy to
4015 define TODO dependencies. Usually, a parent TODO task should not be
4016 marked DONE until all subtasks, defined as children tasks, are marked
4017 as DONE. And sometimes there is a logical sequence to a number of
4018 (sub)tasks, so that one task cannot be acted upon before all siblings
4019 above it are done. If you customize the variable
4020 ~org-enforce-todo-dependencies~, Org blocks entries from changing
4021 state to DONE while they have children that are not DONE.
4022 Furthermore, if an entry has a property =ORDERED=, each of its
4023 children is blocked until all earlier siblings are marked DONE. Here
4027 ,* TODO Blocked until (two) is done
4036 ,** TODO b, needs to wait for (a)
4037 ,** TODO c, needs to wait for (a) and (b)
4040 #+cindex: TODO dependencies, NOBLOCKING
4041 #+cindex: NOBLOCKING, property
4042 You can ensure an entry is never blocked by using the =NOBLOCKING=
4046 ,* This entry is never blocked
4052 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
4055 #+findex: org-toggle-ordered-property
4056 #+vindex: org-track-ordered-property-with-tag
4057 Toggle the =ORDERED= property of the current entry. A property
4058 is used for this behavior because this should be local to the
4059 current entry, not inherited like a tag. However, if you would
4060 like to /track/ the value of this property with a tag for better
4061 visibility, customize the variable
4062 ~org-track-ordered-property-with-tag~.
4064 - {{{kbd(C-u C-u C-u C-c C-t)}}} ::
4066 #+kindex: C-u C-u C-u C-c C-t
4067 Change TODO state, circumventing any state blocking.
4069 #+vindex: org-agenda-dim-blocked-tasks
4070 If you set the variable ~org-agenda-dim-blocked-tasks~, TODO entries
4071 that cannot be closed because of such dependencies are shown in
4072 a dimmed font or even made invisible in agenda views (see [[*Agenda
4075 #+cindex: checkboxes and TODO dependencies
4076 #+vindex: org-enforce-todo-dependencies
4077 You can also block changes of TODO states by looking at checkboxes
4078 (see [[*Checkboxes]]). If you set the variable
4079 ~org-enforce-todo-checkbox-dependencies~, an entry that has unchecked
4080 checkboxes is blocked from switching to DONE.
4082 If you need more complex dependency structures, for example
4083 dependencies between entries in different trees or files, check out
4084 the contributed module =org-depend.el=.
4088 :DESCRIPTION: Dates and notes for progress.
4090 #+cindex: progress logging
4091 #+cindex: logging, of progress
4093 Org mode can automatically record a timestamp and possibly a note when
4094 you mark a TODO item as DONE, or even each time you change the state
4095 of a TODO item. This system is highly configurable, settings can be
4096 on a per-keyword basis and can be localized to a file or even
4097 a subtree. For information on how to clock working time for a task,
4098 see [[*Clocking Work Time]].
4102 :DESCRIPTION: When was this entry marked DONE?
4105 The most basic logging is to keep track of /when/ a certain TODO item
4106 was finished. This is achieved with[fn:42]
4108 #+begin_src emacs-lisp
4109 (setq org-log-done 'time)
4112 #+vindex: org-closed-keep-when-no-todo
4113 #+texinfo: @noindent
4114 Then each time you turn an entry from a TODO (not-done) state into any
4115 of the DONE states, a line =CLOSED: [timestamp]= is inserted just
4116 after the headline. If you turn the entry back into a TODO item
4117 through further state cycling, that line is removed again. If you
4118 turn the entry back to a non-TODO state (by pressing {{{kbd(C-c C-t
4119 SPC)}}} for example), that line is also removed, unless you set
4120 ~org-closed-keep-when-no-todo~ to non-~nil~. If you want to record
4121 a note along with the timestamp, use[fn:43]
4123 #+begin_src emacs-lisp
4124 (setq org-log-done 'note)
4127 #+texinfo: @noindent
4128 You are then be prompted for a note, and that note is stored below the
4129 entry with a =Closing Note= heading.
4131 *** Tracking TODO state changes
4133 :DESCRIPTION: When did the status change?
4135 #+cindex: drawer, for state change recording
4137 #+vindex: org-log-states-order-reversed
4138 #+vindex: org-log-into-drawer
4139 #+cindex: @samp{LOG_INTO_DRAWER}, property
4140 When TODO keywords are used as workflow states (see [[*TODO keywords as workflow states][*Workflow states]]),
4141 you might want to keep track of when a state change occurred and maybe
4142 take a note about this change. You can either record just
4143 a timestamp, or a time-stamped note for a change. These records are
4144 inserted after the headline as an itemized list, newest first[fn:44].
4145 When taking a lot of notes, you might want to get the notes out of the
4146 way into a drawer (see [[*Drawers]]). Customize the variable
4147 ~org-log-into-drawer~ to get this behavior---the recommended drawer
4148 for this is called =LOGBOOK=[fn:45]. You can also overrule the
4149 setting of this variable for a subtree by setting a =LOG_INTO_DRAWER=
4152 Since it is normally too much to record a note for every state, Org
4153 mode expects configuration on a per-keyword basis for this. This is
4154 achieved by adding special markers =!= (for a timestamp) or =@= (for
4155 a note with timestamp) in parentheses after each keyword. For
4156 example, with the setting
4158 #+begin_src emacs-lisp
4159 (setq org-todo-keywords
4160 '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)")))
4163 To record a timestamp without a note for TODO keywords configured with
4164 =@=, just type {{{kbd(C-c C-c)}}} to enter a blank note when prompted.
4166 #+vindex: org-log-done
4168 you not only define global TODO keywords and fast access keys, but
4169 also request that a time is recorded when the entry is set to =DONE=,
4170 and that a note is recorded when switching to =WAIT= or
4171 =CANCELED=[fn:46]. The setting for =WAIT= is even more special: the
4172 =!= after the slash means that in addition to the note taken when
4173 entering the state, a timestamp should be recorded when /leaving/ the
4174 =WAIT= state, if and only if the /target/ state does not configure
4175 logging for entering it. So it has no effect when switching from
4176 =WAIT= to =DONE=, because =DONE= is configured to record a timestamp
4177 only. But when switching from =WAIT= back to =TODO=, the =/!= in the
4178 =WAIT= setting now triggers a timestamp even though =TODO= has no
4181 You can use the exact same syntax for setting logging preferences local
4184 : #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)
4186 #+cindex: @samp{LOGGING}, property
4187 In order to define logging settings that are local to a subtree or
4188 a single item, define a =LOGGING= property in this entry. Any
4189 non-empty =LOGGING= property resets all logging settings to ~nil~.
4190 You may then turn on logging for this specific tree using =STARTUP=
4191 keywords like =lognotedone= or =logrepeat=, as well as adding state
4192 specific settings like =TODO(!)=. For example:
4195 ,* TODO Log each state with only a time
4197 :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
4199 ,* TODO Only log when switching to WAIT, and when repeating
4201 :LOGGING: WAIT(@) logrepeat
4203 ,* TODO No logging at all
4209 *** Tracking your habits
4211 :DESCRIPTION: How consistent have you been?
4214 #+cindex: STYLE, property
4216 Org has the ability to track the consistency of a special category of
4217 TODO, called "habits." A habit has the following properties:
4219 1. You have enabled the ~habits~ module by customizing the variable
4222 2. The habit is a TODO item, with a TODO keyword representing an open
4225 3. The property =STYLE= is set to the value =habit=.
4227 4. The TODO has a scheduled date, usually with a =.+= style repeat
4228 interval. A =++= style may be appropriate for habits with time
4229 constraints, e.g., must be done on weekends, or a =+= style for an
4230 unusual habit that can have a backlog, e.g., weekly reports.
4232 5. The TODO may also have minimum and maximum ranges specified by
4233 using the syntax =.+2d/3d=, which says that you want to do the task
4234 at least every three days, but at most every two days.
4236 6. You must also have state logging for the DONE state enabled (see
4237 [[*Tracking TODO state changes]]), in order for historical data to be
4238 represented in the consistency graph. If it is not enabled it is
4239 not an error, but the consistency graphs are largely meaningless.
4241 To give you an idea of what the above rules look like in action, here's an
4242 actual habit with some history:
4246 SCHEDULED: <2009-10-17 Sat .+2d/4d>
4249 :LAST_REPEAT: [2009-10-19 Mon 00:36]
4251 - State "DONE" from "TODO" [2009-10-15 Thu]
4252 - State "DONE" from "TODO" [2009-10-12 Mon]
4253 - State "DONE" from "TODO" [2009-10-10 Sat]
4254 - State "DONE" from "TODO" [2009-10-04 Sun]
4255 - State "DONE" from "TODO" [2009-10-02 Fri]
4256 - State "DONE" from "TODO" [2009-09-29 Tue]
4257 - State "DONE" from "TODO" [2009-09-25 Fri]
4258 - State "DONE" from "TODO" [2009-09-19 Sat]
4259 - State "DONE" from "TODO" [2009-09-16 Wed]
4260 - State "DONE" from "TODO" [2009-09-12 Sat]
4263 What this habit says is: I want to shave at most every 2 days---given
4264 by the =SCHEDULED= date and repeat interval---and at least every
4265 4 days. If today is the 15th, then the habit first appears in the
4266 agenda on Oct 17, after the minimum of 2 days has elapsed, and will
4267 appear overdue on Oct 19, after four days have elapsed.
4269 What's really useful about habits is that they are displayed along
4270 with a consistency graph, to show how consistent you've been at
4271 getting that task done in the past. This graph shows every day that
4272 the task was done over the past three weeks, with colors for each day.
4273 The colors used are:
4275 - Blue :: If the task was not to be done yet on that day.
4276 - Green :: If the task could have been done on that day.
4277 - Yellow :: If the task was going to be overdue the next day.
4278 - Red :: If the task was overdue on that day.
4280 In addition to coloring each day, the day is also marked with an
4281 asterisk if the task was actually done that day, and an exclamation
4282 mark to show where the current day falls in the graph.
4284 There are several configuration variables that can be used to change
4285 the way habits are displayed in the agenda.
4287 - ~org-habit-graph-column~ ::
4289 #+vindex: org-habit-graph-column
4290 The buffer column at which the consistency graph should be drawn.
4291 This overwrites any text in that column, so it is a good idea to
4292 keep your habits' titles brief and to the point.
4294 - ~org-habit-preceding-days~ ::
4296 #+vindex: org-habit-preceding-days
4297 The amount of history, in days before today, to appear in
4300 - ~org-habit-following-days~ ::
4302 #+vindex: org-habit-following-days
4303 The number of days after today that appear in consistency graphs.
4305 - ~org-habit-show-habits-only-for-today~ ::
4307 #+vindex: org-habit-show-habits-only-for-today
4308 If non-~nil~, only show habits in today's agenda view. This is
4309 set to true by default.
4311 Lastly, pressing {{{kbd(K)}}} in the agenda buffer causes habits to
4312 temporarily be disabled and do not appear at all. Press {{{kbd(K)}}}
4313 again to bring them back. They are also subject to tag filtering, if
4314 you have habits which should only be done in certain contexts, for
4319 :DESCRIPTION: Some things are more important than others.
4321 #+cindex: priorities
4322 #+cindex: priority cookie
4324 If you use Org mode extensively, you may end up with enough TODO items
4325 that it starts to make sense to prioritize them. Prioritizing can be
4326 done by placing a /priority cookie/ into the headline of a TODO item,
4329 : *** TODO [#A] Write letter to Sam Fortune
4331 #+vindex: org-priority-faces
4332 #+texinfo: @noindent
4333 By default, Org mode supports three priorities: =A=, =B=, and =C=.
4334 =A= is the highest priority. An entry without a cookie is treated
4335 just like priority =B=. Priorities make a difference only for sorting
4336 in the agenda (see [[*Weekly/daily agenda]]); outside the agenda, they
4337 have no inherent meaning to Org mode. The cookies can be highlighted
4338 with special faces by customizing the variable ~org-priority-faces~.
4340 Priorities can be attached to any outline node; they do not need to be
4343 #+attr_texinfo: :sep ;
4344 - {{{kbd(C-c \,)}}} (~org-priority~) ::
4347 #+findex: org-priority
4348 Set the priority of the current headline. The command prompts
4349 for a priority character =A=, =B= or =C=. When you press
4350 {{{kbd(SPC)}}} instead, the priority cookie is removed from the
4351 headline. The priorities can also be changed "remotely" from the
4352 timeline and agenda buffer with the {{{kbd(\,)}}} command (see
4353 [[*Commands in the Agenda Buffer]]).
4355 - {{{kbd(S-UP)}}} (~org-priority-up~); {{{kbd(S-DOWN)}}} (~org-priority-down~) ::
4359 #+findex: org-priority-up
4360 #+findex: org-priority-down
4361 #+vindex: org-priority-start-cycle-with-default
4362 Increase/decrease priority of current headline[fn:47]. Note that
4363 these keys are also used to modify timestamps (see [[*Creating
4364 Timestamps]]). See also [[*Packages that conflict with Org mode]], for
4365 a discussion of the interaction with ~shift-selection-mode~.
4367 #+vindex: org-highest-priority
4368 #+vindex: org-lowest-priority
4369 #+vindex: org-default-priority
4370 You can change the range of allowed priorities by setting the
4371 variables ~org-highest-priority~, ~org-lowest-priority~, and
4372 ~org-default-priority~. For an individual buffer, you may set these
4373 values (highest, lowest, default) like this (please make sure that the
4374 highest priority is earlier in the alphabet than the lowest priority):
4376 #+cindex: @samp{PRIORITIES}, keyword
4377 : #+PRIORITIES: A C B
4379 ** Breaking Down Tasks into Subtasks
4381 :DESCRIPTION: Splitting a task into manageable pieces.
4382 :ALT_TITLE: Breaking Down Tasks
4384 #+cindex: tasks, breaking down
4385 #+cindex: statistics, for TODO items
4387 #+vindex: org-agenda-todo-list-sublevels
4388 It is often advisable to break down large tasks into smaller,
4389 manageable subtasks. You can do this by creating an outline tree
4390 below a TODO item, with detailed subtasks on the tree[fn:48]. To keep
4391 the overview over the fraction of subtasks that are already completed,
4392 insert either =[/]= or =[%]= anywhere in the headline. These cookies
4393 are updated each time the TODO status of a child changes, or when
4394 pressing {{{kbd(C-c C-c)}}} on the cookie. For example:
4397 ,* Organize Party [33%]
4398 ,** TODO Call people [1/2]
4402 ,** DONE Talk to neighbor
4405 #+cindex: @samp{COOKIE_DATA}, property
4406 If a heading has both checkboxes and TODO children below it, the
4407 meaning of the statistics cookie become ambiguous. Set the property
4408 =COOKIE_DATA= to either =checkbox= or =todo= to resolve this issue.
4410 #+vindex: org-hierarchical-todo-statistics
4411 If you would like to have the statistics cookie count any TODO entries
4412 in the subtree (not just direct children), configure the variable
4413 ~org-hierarchical-todo-statistics~. To do this for a single subtree,
4414 include the word =recursive= into the value of the =COOKIE_DATA=
4418 ,* Parent capturing statistics [2/20]
4420 :COOKIE_DATA: todo recursive
4424 If you would like a TODO entry to automatically change to DONE when
4425 all children are done, you can use the following setup:
4427 #+begin_src emacs-lisp
4428 (defun org-summary-todo (n-done n-not-done)
4429 "Switch entry to DONE when all subentries are done, to TODO otherwise."
4430 (let (org-log-done org-log-states) ; turn off logging
4431 (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
4433 (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
4436 Another possibility is the use of checkboxes to identify (a hierarchy
4437 of) a large number of subtasks (see [[*Checkboxes]]).
4441 :DESCRIPTION: Tick-off lists.
4443 #+cindex: checkboxes
4445 #+vindex: org-list-automatic-rules
4446 Every item in a plain list[fn:49] (see [[*Plain Lists]]) can be made into
4447 a checkbox by starting it with the string =[ ]=. This feature is
4448 similar to TODO items (see [[*TODO Items]]), but is more lightweight.
4449 Checkboxes are not included into the global TODO list, so they are
4450 often great to split a task into a number of simple steps. Or you can
4451 use them in a shopping list. To toggle a checkbox, use {{{kbd(C-c
4452 C-c)}}}, or use the mouse (thanks to Piotr Zielinski's
4455 Here is an example of a checkbox list.
4458 ,* TODO Organize party [2/4]
4459 - [-] call people [1/3]
4464 - [ ] think about what music to play
4465 - [X] talk to the neighbors
4468 Checkboxes work hierarchically, so if a checkbox item has children
4469 that are checkboxes, toggling one of the children checkboxes makes the
4470 parent checkbox reflect if none, some, or all of the children are
4473 #+cindex: statistics, for checkboxes
4474 #+cindex: checkbox statistics
4475 #+cindex: @samp{COOKIE_DATA}, property
4476 #+vindex: org-hierarchical-checkbox-statistics
4477 The =[2/4]= and =[1/3]= in the first and second line are cookies
4478 indicating how many checkboxes present in this entry have been checked
4479 off, and the total number of checkboxes present. This can give you an
4480 idea on how many checkboxes remain, even without opening a folded
4481 entry. The cookies can be placed into a headline or into (the first
4482 line of) a plain list item. Each cookie covers checkboxes of direct
4483 children structurally below the headline/item on which the cookie
4484 appears[fn:50]. You have to insert the cookie yourself by typing
4485 either =[/]= or =[%]=. With =[/]= you get an =n out of m= result, as
4486 in the examples above. With =[%]= you get information about the
4487 percentage of checkboxes checked (in the above example, this would be
4488 =[50%]= and =[33%]=, respectively). In a headline, a cookie can count
4489 either checkboxes below the heading or TODO states of children, and it
4490 displays whatever was changed last. Set the property =COOKIE_DATA= to
4491 either =checkbox= or =todo= to resolve this issue.
4493 #+cindex: blocking, of checkboxes
4494 #+cindex: checkbox blocking
4495 #+cindex: @samp{ORDERED}, property
4496 If the current outline node has an =ORDERED= property, checkboxes must
4497 be checked off in sequence, and an error is thrown if you try to check
4498 off a box while there are unchecked boxes above it.
4500 #+texinfo: @noindent
4501 The following commands work with checkboxes:
4503 - {{{kbd(C-c C-c)}}} (~org-toggle-checkbox~) ::
4506 #+findex: org-toggle-checkbox
4507 Toggle checkbox status or---with prefix argument---checkbox
4508 presence at point. With a single prefix argument, add an empty
4509 checkbox or remove the current one[fn:51]. With a double prefix
4510 argument, set it to =[-]=, which is considered to be an
4513 - {{{kbd(C-c C-x C-b)}}} (~org-toggle-checkbox~) ::
4515 #+kindex: C-c C-x C-b
4516 Toggle checkbox status or---with prefix argument---checkbox
4517 presence at point. With double prefix argument, set it to =[-]=,
4518 which is considered to be an intermediate state.
4520 - If there is an active region, toggle the first checkbox in the
4521 region and set all remaining boxes to the same status as the
4522 first. With a prefix argument, add or remove the checkbox for
4523 all items in the region.
4525 - If the cursor is in a headline, toggle checkboxes in the region
4526 between this headline and the next---so /not/ the entire
4529 - If there is no active region, just toggle the checkbox at
4532 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
4535 #+findex: org-insert-todo-heading
4536 Insert a new item with a checkbox. This works only if the cursor
4537 is already in a plain list item (see [[*Plain Lists]]).
4539 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
4542 #+findex: org-toggle-ordered-property
4543 #+vindex: org-track-ordered-property-with-tag
4544 Toggle the =ORDERED= property of the entry, to toggle if
4545 checkboxes must be checked off in sequence. A property is used
4546 for this behavior because this should be local to the current
4547 entry, not inherited like a tag. However, if you would like to
4548 /track/ the value of this property with a tag for better
4549 visibility, customize ~org-track-ordered-property-with-tag~.
4551 - {{{kbd(C-c #)}}} (~org-update-statistics-cookies~) ::
4554 #+findex: org-update-statistics-cookies
4555 Update the statistics cookie in the current outline entry. When
4556 called with a {{{kbd(C-u)}}} prefix, update the entire file.
4557 Checkbox statistic cookies are updated automatically if you
4558 toggle checkboxes with {{{kbd(C-c C-c)}}} and make new ones with
4559 {{{kbd(M-S-RET)}}}. TODO statistics cookies update when changing
4560 TODO states. If you delete boxes/entries or add/change them by
4561 hand, use this command to get things back into sync.
4565 :DESCRIPTION: Tagging headlines and matching sets of tags.
4568 #+cindex: headline tagging
4569 #+cindex: matching, tags
4570 #+cindex: sparse tree, tag based
4572 An excellent way to implement labels and contexts for
4573 cross-correlating information is to assign /tags/ to headlines. Org
4574 mode has extensive support for tags.
4576 #+vindex: org-tag-faces
4577 Every headline can contain a list of tags; they occur at the end of
4578 the headline. Tags are normal words containing letters, numbers, =_=,
4579 and =@=. Tags must be preceded and followed by a single colon, e.g.,
4580 =:work:=. Several tags can be specified, as in =:work:urgent:=. Tags
4581 by default are in bold face with the same color as the headline. You
4582 may specify special faces for specific tags using the variable
4583 ~org-tag-faces~, in much the same way as you can for TODO keywords
4584 (see [[*Faces for TODO keywords]]).
4588 :DESCRIPTION: Tags use the tree structure of an outline.
4590 #+cindex: tag inheritance
4591 #+cindex: inheritance, of tags
4592 #+cindex: sublevels, inclusion into tags match
4594 /Tags/ make use of the hierarchical structure of outline trees. If
4595 a heading has a certain tag, all subheadings inherit the tag as well.
4596 For example, in the list
4599 ,* Meeting with the French group :work:
4600 ,** Summary by Frank :boss:notes:
4601 ,*** TODO Prepare slides for him :action:
4604 #+texinfo: @noindent
4605 the final heading has the tags =work=, =boss=, =notes=, and =action=
4606 even though the final heading is not explicitly marked with those
4607 tags. You can also set tags that all entries in a file should inherit
4608 just as if these tags were defined in a hypothetical level zero that
4609 surrounds the entire file. Use a line like this[fn:52]
4611 #+cindex: @samp{FILETAGS}, keyword
4612 : #+FILETAGS: :Peter:Boss:Secret:
4614 #+vindex: org-use-tag-inheritance
4615 #+vindex: org-tags-exclude-from-inheritance
4616 #+texinfo: @noindent
4617 To limit tag inheritance to specific tags, or to turn it off entirely,
4618 use the variables ~org-use-tag-inheritance~ and
4619 ~org-tags-exclude-from-inheritance~.
4621 #+vindex: org-tags-match-list-sublevels
4622 When a headline matches during a tags search while tag inheritance is
4623 turned on, all the sublevels in the same tree---for a simple match
4624 form---match as well[fn:53]. The list of matches may then become
4625 very long. If you only want to see the first tags match in a subtree,
4626 configure the variable ~org-tags-match-list-sublevels~ (not
4629 #+vindex: org-agenda-use-tag-inheritance
4630 Tag inheritance is relevant when the agenda search tries to match
4631 a tag, either in the ~tags~ or ~tags-todo~ agenda types. In other
4632 agenda types, ~org-use-tag-inheritance~ has no effect. Still, you may
4633 want to have your tags correctly set in the agenda, so that tag
4634 filtering works fine, with inherited tags. Set
4635 ~org-agenda-use-tag-inheritance~ to control this: the default value
4636 includes all agenda types, but setting this to ~nil~ can really speed
4637 up agenda generation.
4641 :DESCRIPTION: How to assign tags to a headline.
4643 #+cindex: setting tags
4644 #+cindex: tags, setting
4647 Tags can simply be typed into the buffer at the end of a headline.
4648 After a colon, {{{kbd(M-TAB)}}} offers completion on tags. There is
4649 also a special command for inserting tags:
4651 - {{{kbd(C-c C-q)}}} (~org-set-tags-command~) ::
4654 #+findex: org-set-tags-command
4655 #+cindex: completion, of tags
4656 #+vindex: org-tags-column
4657 Enter new tags for the current headline. Org mode either offers
4658 completion or a special single-key interface for setting tags,
4659 see below. After pressing {{{kbd(RET)}}}, the tags are inserted
4660 and aligned to ~org-tags-column~. When called with
4661 a {{{kbd(C-u)}}} prefix, all tags in the current buffer are
4662 aligned to that column, just to make things look nice. Tags are
4663 automatically realigned after promotion, demotion, and TODO state
4664 changes (see [[*Basic TODO Functionality]]).
4666 - {{{kbd(C-c C-c)}}} (~org-set-tags-command~) ::
4669 When the cursor is in a headline, this does the same as
4672 #+vindex: org-tag-alist
4673 Org supports tag insertion based on a /list of tags/. By default this
4674 list is constructed dynamically, containing all tags currently used in
4675 the buffer. You may also globally specify a hard list of tags with
4676 the variable ~org-tag-alist~. Finally you can set the default tags
4677 for a given file with lines like
4679 #+cindex: @samp{TAGS}, keyword
4681 ,#+TAGS: @work @home @tennisclub
4682 ,#+TAGS: laptop car pc sailboat
4685 If you have globally defined your preferred set of tags using the
4686 variable ~org-tag-alist~, but would like to use a dynamic tag list in
4687 a specific file, add an empty =TAGS= keyword to that file:
4691 #+vindex: org-tag-persistent-alist
4692 If you have a preferred set of tags that you would like to use in
4693 every file, in addition to those defined on a per-file basis by =TAGS=
4694 keyword, then you may specify a list of tags with the variable
4695 ~org-tag-persistent-alist~. You may turn this off on a per-file basis
4696 by adding a =STARTUP= keyword to that file:
4700 By default Org mode uses the standard minibuffer completion facilities
4701 for entering tags. However, it also implements another, quicker, tag
4702 selection method called /fast tag selection/. This allows you to
4703 select and deselect tags with just a single key press. For this to
4704 work well you should assign unique letters to most of your commonly
4705 used tags. You can do this globally by configuring the variable
4706 ~org-tag-alist~ in your Emacs init file. For example, you may find
4707 the need to tag many items in different files with =@home=. In this
4708 case you can set something like:
4710 #+begin_src emacs-lisp
4711 (setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l)))
4714 #+texinfo: @noindent
4715 If the tag is only relevant to the file you are working on, then you
4716 can instead set the =TAGS= keyword as:
4718 : #+TAGS: @work(w) @home(h) @tennisclub(t) laptop(l) pc(p)
4720 #+texinfo: @noindent
4721 The tags interface shows the available tags in a splash window. If
4722 you want to start a new line after a specific tag, insert =\n= into
4725 : #+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p)
4727 #+texinfo: @noindent
4728 or write them in two lines:
4731 ,#+TAGS: @work(w) @home(h) @tennisclub(t)
4732 ,#+TAGS: laptop(l) pc(p)
4735 #+texinfo: @noindent
4736 You can also group together tags that are mutually exclusive by using
4739 : #+TAGS: { @work(w) @home(h) @tennisclub(t) } laptop(l) pc(p)
4741 #+texinfo: @noindent
4742 you indicate that at most one of =@work=, =@home=, and =@tennisclub=
4743 should be selected. Multiple such groups are allowed.
4745 #+texinfo: @noindent
4746 Do not forget to press {{{kbd(C-c C-c)}}} with the cursor in one of
4747 these lines to activate any changes.
4749 #+texinfo: @noindent
4750 To set these mutually exclusive groups in the variable
4751 ~org-tags-alist~, you must use the dummy tags ~:startgroup~ and
4752 ~:endgroup~ instead of the braces. Similarly, you can use ~:newline~
4753 to indicate a line break. The previous example would be set globally
4754 by the following configuration:
4756 #+begin_src emacs-lisp
4757 (setq org-tag-alist '((:startgroup . nil)
4758 ("@work" . ?w) ("@home" . ?h)
4759 ("@tennisclub" . ?t)
4761 ("laptop" . ?l) ("pc" . ?p)))
4764 If at least one tag has a selection key then pressing {{{kbd(C-c
4765 C-c)}}} automatically presents you with a special interface, listing
4766 inherited tags, the tags of the current headline, and a list of all
4767 valid tags with corresponding keys[fn:54].
4769 Pressing keys assigned to tags adds or removes them from the list of
4770 tags in the current line. Selecting a tag in a group of mutually
4771 exclusive tags turns off any other tag from that group.
4773 In this interface, you can also use the following special keys:
4778 Enter a tag in the minibuffer, even if the tag is not in the
4779 predefined list. You can complete on all tags present in the
4780 buffer. You can also add several tags: just separate them with
4786 Clear all tags for this line.
4791 Accept the modified set.
4796 Abort without installing changes.
4801 If {{{kbd(q)}}} is not assigned to a tag, it aborts like
4807 Turn off groups of mutually exclusive tags. Use this to (as an
4808 exception) assign several tags from such a group.
4813 Toggle auto-exit after the next change (see below). If you are
4814 using expert mode, the first {{{kbd(C-c)}}} displays the
4817 #+texinfo: @noindent
4818 This method lets you assign tags to a headline with very few keys.
4819 With the above setup, you could clear the current tags and set
4820 =@home=, =laptop= and =pc= tags with just the following keys:
4821 {{{kbd(C-c C-c SPC h l p RET)}}}. Switching from =@home= to =@work=
4822 would be done with {{{kbd(C-c C-c w RET)}}} or alternatively with
4823 {{{kbd(C-c C-c C-c w)}}}. Adding the non-predefined tag =Sarah= could
4824 be done with {{{kbd(C-c C-c TAB S a r a h RET)}}}.
4826 #+vindex: org-fast-tag-selection-single-key
4827 If you find that most of the time you need only a single key press to
4828 modify your list of tags, set the variable
4829 ~org-fast-tag-selection-single-key~. Then you no longer have to press
4830 {{{kbd(RET)}}} to exit fast tag selection---it exits after the first
4831 change. If you then occasionally need more keys, press {{{kbd(C-c)}}}
4832 to turn off auto-exit for the current tag selection process (in
4833 effect: start selection with {{{kbd(C-c C-c C-c)}}} instead of
4834 {{{kbd(C-c C-c)}}}). If you set the variable to the value ~expert~,
4835 the special window is not even shown for single-key tag selection, it
4836 comes up only when you press an extra {{{kbd(C-c)}}}.
4840 :DESCRIPTION: Create a hierarchy of tags.
4842 #+cindex: group tags
4843 #+cindex: tags, groups
4844 #+cindex: tags hierarchy
4846 Tags can be defined in hierarchies. A tag can be defined as a /group
4847 tag/ for a set of other tags. The group tag can be seen as the
4848 "broader term" for its set of tags. Defining multiple group tags and
4849 nesting them creates a tag hierarchy.
4851 One use-case is to create a taxonomy of terms (tags) that can be used
4852 to classify nodes in a document or set of documents.
4854 When you search for a group tag, it return matches for all members in
4855 the group and its subgroups. In an agenda view, filtering by a group
4856 tag displays or hide headlines tagged with at least one of the members
4857 of the group or any of its subgroups. This makes tag searches and
4858 filters even more flexible.
4860 You can set group tags by using brackets and inserting a colon between
4861 the group tag and its related tags---beware that all whitespaces are
4862 mandatory so that Org can parse this line correctly:
4864 : #+TAGS: [ GTD : Control Persp ]
4866 In this example, =GTD= is the group tag and it is related to two other
4867 tags: =Control=, =Persp=. Defining =Control= and =Persp= as group
4868 tags creates an hierarchy of tags:
4871 ,#+TAGS: [ Control : Context Task ]
4872 ,#+TAGS: [ Persp : Vision Goal AOF Project ]
4875 That can conceptually be seen as a hierarchy of tags:
4887 You can use the ~:startgrouptag~, ~:grouptags~ and ~:endgrouptag~
4888 keyword directly when setting ~org-tag-alist~ directly:
4890 #+begin_src emacs-lisp
4891 (setq org-tag-alist '((:startgrouptag)
4905 The tags in a group can be mutually exclusive if using the same group
4906 syntax as is used for grouping mutually exclusive tags together; using
4909 : #+TAGS: { Context : @Home @Work @Call }
4911 When setting ~org-tag-alist~ you can use ~:startgroup~ and ~:endgroup~
4912 instead of ~:startgrouptag~ and ~:endgrouptag~ to make the tags
4915 Furthermore, the members of a group tag can also be regular
4916 expressions, creating the possibility of a more dynamic and rule-based
4917 tag structure. The regular expressions in the group must be specified
4918 within curly brackets. Here is an expanded example:
4921 ,#+TAGS: [ Vision : {V@.+} ]
4922 ,#+TAGS: [ Goal : {G@.+} ]
4923 ,#+TAGS: [ AOF : {AOF@.+} ]
4924 ,#+TAGS: [ Project : {P@.+} ]
4927 Searching for the tag =Project= now lists all tags also including
4928 regular expression matches for =P@.+=, and similarly for tag searches
4929 on =Vision=, =Goal= and =AOF=. For example, this would work well for
4930 a project tagged with a common project-identifier,
4931 e.g. =P@2014_OrgTags=.
4934 #+findex: org-toggle-tags-groups
4935 #+vindex: org-group-tags
4936 If you want to ignore group tags temporarily, toggle group tags
4937 support with ~org-toggle-tags-groups~, bound to {{{kbd(C-c C-x q)}}}.
4938 If you want to disable tag groups completely, set ~org-group-tags~ to
4943 :DESCRIPTION: Searching for combinations of tags.
4945 #+cindex: tag searches
4946 #+cindex: searching for tags
4948 Once a system of tags has been set up, it can be used to collect
4949 related information into special lists.
4951 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
4955 #+findex: org-match-sparse-tree
4956 Create a sparse tree with all headlines matching a tags search.
4957 With a {{{kbd(C-u)}}} prefix argument, ignore headlines that are
4960 - {{{kbd(C-c a m)}}} (~org-tags-view~) ::
4963 #+findex: org-tags-view
4964 Create a global list of tag matches from all agenda files. See
4965 [[*Matching tags and properties]].
4967 - {{{kbd(C-c a M)}}} (~org-tags-view~) ::
4970 #+vindex: org-tags-match-list-sublevels
4971 Create a global list of tag matches from all agenda files, but
4972 check only TODO items and force checking subitems (see the option
4973 ~org-tags-match-list-sublevels~).
4975 These commands all prompt for a match string which allows basic
4976 Boolean logic like =+boss+urgent-project1=, to find entries with tags
4977 =boss= and =urgent=, but not =project1=, or =Kathy|Sally= to find
4978 entries which are tagged, like =Kathy= or =Sally=. The full syntax of
4979 the search string is rich and allows also matching against TODO
4980 keywords, entry levels and properties. For a complete description
4981 with many examples, see [[*Matching tags and properties]].
4983 * Properties and Columns
4985 :DESCRIPTION: Storing information about an entry.
4987 #+cindex: properties
4989 A property is a key-value pair associated with an entry. Properties
4990 can be set so they are associated with a single entry, with every
4991 entry in a tree, or with every entry in an Org file.
4993 There are two main applications for properties in Org mode. First,
4994 properties are like tags, but with a value. Imagine maintaining
4995 a file where you document bugs and plan releases for a piece of
4996 software. Instead of using tags like =release_1=, =release_2=, you
4997 can use a property, say =Release=, that in different subtrees has
4998 different values, such as =1.0= or =2.0=. Second, you can use
4999 properties to implement (very basic) database capabilities in an Org
5000 buffer. Imagine keeping track of your music CDs, where properties
5001 could be things such as the album, artist, date of release, number of
5004 Properties can be conveniently edited and viewed in column view (see
5009 :DESCRIPTION: How properties are spelled out.
5011 #+cindex: property syntax
5012 #+cindex: drawer, for properties
5014 Properties are key--value pairs. When they are associated with
5015 a single entry or with a tree they need to be inserted into a special
5016 drawer (see [[*Drawers]]) with the name =PROPERTIES=, which has to be
5017 located right below a headline, and its planning line (see [[*Deadlines
5018 and Scheduling]]) when applicable. Each property is specified on
5019 a single line, with the key---surrounded by colons---first, and the
5020 value after it. Keys are case-insensitive. Here is an example:
5025 ,*** Goldberg Variations
5027 :Title: Goldberg Variations
5028 :Composer: J.S. Bach
5030 :Publisher: Deutsche Grammophon
5035 Depending on the value of ~org-use-property-inheritance~, a property
5036 set this way is associated either with a single entry, or with the
5037 sub-tree defined by the entry, see [[*Property Inheritance]].
5039 You may define the allowed values for a particular property =Xyz= by
5040 setting a property =Xyz_ALL=. This special property is /inherited/,
5041 so if you set it in a level 1 entry, it applies to the entire tree.
5042 When allowed values are defined, setting the corresponding property
5043 becomes easier and is less prone to typing errors. For the example
5044 with the CD collection, we can pre-define publishers and the number of
5045 disks in a box like this:
5050 :NDisks_ALL: 1 2 3 4
5051 :Publisher_ALL: "Deutsche Grammophon" Philips EMI
5055 If you want to set properties that can be inherited by any entry in
5056 a file, use a line like:
5058 #+cindex: @samp{_ALL} suffix, in properties
5059 #+cindex: @samp{PROPERTY}, keyword
5060 : #+PROPERTY: NDisks_ALL 1 2 3 4
5062 #+cindex: @samp{+} suffix, in properties
5063 If you want to add to the value of an existing property, append a =+=
5064 to the property name. The following results in the property =var=
5065 having the value =foo=1 bar=2=.
5068 ,#+PROPERTY: var foo=1
5069 ,#+PROPERTY: var+ bar=2
5072 It is also possible to add to the values of inherited properties. The
5073 following results in the =Genres= property having the value =Classic
5074 Baroque= under the =Goldberg Variations= subtree.
5082 ,*** Goldberg Variations
5084 :Title: Goldberg Variations
5085 :Composer: J.S. Bach
5087 :Publisher: Deutsche Grammophon
5093 Note that a property can only have one entry per drawer.
5095 #+vindex: org-global-properties
5096 Property values set with the global variable ~org-global-properties~
5097 can be inherited by all entries in all Org files.
5099 #+texinfo: @noindent
5100 The following commands help to work with properties:
5102 #+attr_texinfo: :sep ,
5103 - {{{kbd(M-TAB)}}} (~pcomplete~) ::
5107 After an initial colon in a line, complete property keys. All
5108 keys used in the current file are offered as possible
5111 - {{{kbd(C-c C-x p)}}} (~org-set-property~) ::
5114 #+findex: org-set-property
5115 Set a property. This prompts for a property name and a value.
5116 If necessary, the property drawer is created as well.
5118 - {{{kbd(C-u M-x org-insert-drawer)}}} ::
5120 #+findex: org-insert-drawer
5121 Insert a property drawer into the current entry. The drawer is
5122 inserted early in the entry, but after the lines with planning
5123 information like deadlines.
5125 - {{{kbd(C-c C-c)}}} (~org-property-action~) ::
5128 #+findex: org-property-action
5129 With the cursor in a property drawer, this executes property
5132 - {{{kbd(C-c C-c s)}}} (~org-set-property~) ::
5135 #+findex: org-set-property
5136 Set a property in the current entry. Both the property and the value
5137 can be inserted using completion.
5139 - {{{kbd(S-RIGHT)}}} (~org-property-next-allowed-values~), {{{kbd(S-LEFT)}}} (~org-property-previous-allowed-value~) ::
5143 Switch property at point to the next/previous allowed value.
5145 - {{{kbd(C-c C-c d)}}} (~org-delete-property~) ::
5148 #+findex: org-delete-property
5149 Remove a property from the current entry.
5151 - {{{kbd(C-c C-c D)}}} (~org-delete-property-globally~) ::
5154 #+findex: org-delete-property-globally
5155 Globally remove a property, from all entries in the current file.
5157 - {{{kbd(C-c C-c c)}}} (~org-compute-property-at-point~) ::
5160 #+findex: org-compute-property-at-point
5161 Compute the property at point, using the operator and scope from
5162 the nearest column format definition.
5164 ** Special Properties
5166 :DESCRIPTION: Access to other Org mode features.
5168 #+cindex: properties, special
5170 Special properties provide an alternative access method to Org mode
5171 features, like the TODO state or the priority of an entry, discussed
5172 in the previous chapters. This interface exists so that you can
5173 include these states in a column view (see [[*Column View]]), or to use
5174 them in queries. The following property names are special and should
5175 not be used as keys in the properties drawer:
5177 #+cindex: @samp{ALLTAGS}, special property
5178 #+cindex: @samp{BLOCKED}, special property
5179 #+cindex: @samp{CLOCKSUM}, special property
5180 #+cindex: @samp{CLOCKSUM_T}, special property
5181 #+cindex: @samp{CLOSED}, special property
5182 #+cindex: @samp{DEADLINE}, special property
5183 #+cindex: @samp{FILE}, special property
5184 #+cindex: @samp{ITEM}, special property
5185 #+cindex: @samp{PRIORITY}, special property
5186 #+cindex: @samp{SCHEDULED}, special property
5187 #+cindex: @samp{TAGS}, special property
5188 #+cindex: @samp{TIMESTAMP}, special property
5189 #+cindex: @samp{TIMESTAMP_IA}, special property
5190 #+cindex: @samp{TODO}, special property
5191 | =ALLTAGS= | All tags, including inherited ones. |
5192 | =BLOCKED= | ~t~ if task is currently blocked by children or siblings. |
5193 | =CATEGORY= | The category of an entry. |
5194 | =CLOCKSUM= | The sum of CLOCK intervals in the subtree. ~org-clock-sum~ |
5195 | | must be run first to compute the values in the current buffer. |
5196 | =CLOCKSUM_T= | The sum of CLOCK intervals in the subtree for today. |
5197 | | ~org-clock-sum-today~ must be run first to compute the |
5198 | | values in the current buffer. |
5199 | =CLOSED= | When was this entry closed? |
5200 | =DEADLINE= | The deadline time string, without the angular brackets. |
5201 | =FILE= | The filename the entry is located in. |
5202 | =ITEM= | The headline of the entry. |
5203 | =PRIORITY= | The priority of the entry, a string with a single letter. |
5204 | =SCHEDULED= | The scheduling timestamp, without the angular brackets. |
5205 | =TAGS= | The tags defined directly in the headline. |
5206 | =TIMESTAMP= | The first keyword-less timestamp in the entry. |
5207 | =TIMESTAMP_IA= | The first inactive timestamp in the entry. |
5208 | =TODO= | The TODO keyword of the entry. |
5210 ** Property Searches
5212 :DESCRIPTION: Matching property values.
5214 #+cindex: properties, searching
5215 #+cindex: searching, of properties
5217 To create sparse trees and special lists with selection based on
5218 properties, the same commands are used as for tag searches (see [[*Tag
5221 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
5225 #+findex: org-match-sparse-tree
5226 Create a sparse tree with all matching entries. With
5227 a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not
5230 - {{{kbd(C-c a m)}}}, ~org-tags-view~ ::
5233 Create a global list of tag/property matches from all agenda
5236 - {{{kbd(C-c a M)}}} (~org-tags-view~) ::
5239 #+findex: org-tags-view
5240 #+vindex: org-tags-match-list-sublevels
5241 Create a global list of tag matches from all agenda files, but
5242 check only TODO items and force checking of subitems (see the
5243 option ~org-tags-match-list-sublevels~).
5245 The syntax for the search string is described in [[*Matching tags and
5248 There is also a special command for creating sparse trees based on a
5251 - {{{kbd(C-c / p)}}} ::
5254 Create a sparse tree based on the value of a property. This
5255 first prompts for the name of a property, and then for a value.
5256 A sparse tree is created with all entries that define this
5257 property with the given value. If you enclose the value in curly
5258 braces, it is interpreted as a regular expression and matched
5259 against the property values.
5261 ** Property Inheritance
5263 :DESCRIPTION: Passing values down a tree.
5265 #+cindex: properties, inheritance
5266 #+cindex: inheritance, of properties
5268 #+vindex: org-use-property-inheritance
5269 The outline structure of Org documents lends itself to an inheritance
5270 model of properties: if the parent in a tree has a certain property,
5271 the children can inherit this property. Org mode does not turn this
5272 on by default, because it can slow down property searches
5273 significantly and is often not needed. However, if you find
5274 inheritance useful, you can turn it on by setting the variable
5275 ~org-use-property-inheritance~. It may be set to ~t~ to make all
5276 properties inherited from the parent, to a list of properties that
5277 should be inherited, or to a regular expression that matches inherited
5278 properties. If a property has the value ~nil~, this is interpreted as
5279 an explicit un-define of the property, so that inheritance search
5280 stops at this value and returns ~nil~.
5282 Org mode has a few properties for which inheritance is hard-coded, at
5283 least for the special applications for which they are used:
5287 #+cindex: @samp{COLUMNS}, property
5288 The =COLUMNS= property defines the format of column view (see
5289 [[*Column View]]). It is inherited in the sense that the level where
5290 a =COLUMNS= property is defined is used as the starting point for
5291 a column view table, independently of the location in the subtree
5292 from where columns view is turned on.
5296 #+cindex: @samp{CATEGORY}, property
5297 For agenda view, a category set through a =CATEGORY= property
5298 applies to the entire subtree.
5302 #+cindex: @samp{ARCHIVE}, property
5303 For archiving, the =ARCHIVE= property may define the archive
5304 location for the entire subtree (see [[*Moving a tree to an archive
5309 #+cindex: @samp{LOGGING}, property
5310 The =LOGGING= property may define logging settings for an entry
5311 or a subtree (see [[*Tracking TODO state changes]]).
5315 :DESCRIPTION: Tabular viewing and editing.
5318 A great way to view and edit properties in an outline tree is /column
5319 view/. In column view, each outline node is turned into a table row.
5320 Columns in this table provide access to properties of the entries.
5321 Org mode implements columns by overlaying a tabular structure over the
5322 headline of each item. While the headlines have been turned into
5323 a table row, you can still change the visibility of the outline tree.
5324 For example, you get a compact table by switching to "contents"
5325 view---{{{kbd(S-TAB)}}} {{{kbd(S-TAB)}}}, or simply {{{kbd(c)}}}
5326 while column view is active---but you can still open, read, and edit
5327 the entry below each headline. Or, you can switch to column view
5328 after executing a sparse tree command and in this way get a table only
5329 for the selected items. Column view also works in agenda buffers (see
5330 [[*Agenda Views]]) where queries have collected selected items, possibly
5331 from a number of files.
5333 *** Defining columns
5335 :DESCRIPTION: The COLUMNS format property.
5337 #+cindex: column view, for properties
5338 #+cindex: properties, column view
5340 Setting up a column view first requires defining the columns. This is
5341 done by defining a column format line.
5343 **** Scope of column definitions
5345 :DESCRIPTION: Where defined, where valid?
5348 To define a column format for an entire file, use a line like:
5350 #+cindex: @samp{COLUMNS}, keyword
5351 : #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
5353 To specify a format that only applies to a specific tree, add
5354 a =COLUMNS= property to the top node of that tree, for example:
5357 ,** Top node for columns view
5359 :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
5363 If a =COLUMNS= property is present in an entry, it defines columns for
5364 the entry itself, and for the entire subtree below it. Since the
5365 column definition is part of the hierarchical structure of the
5366 document, you can define columns on level 1 that are general enough
5367 for all sublevels, and more specific columns further down, when you
5368 edit a deeper part of the tree.
5370 **** Column attributes
5372 :DESCRIPTION: Appearance and content of a column.
5375 A column definition sets the attributes of a column. The general
5376 definition looks like this:
5378 : %[WIDTH]PROPERTY[(TITLE)][{SUMMARY-TYPE}]
5380 #+texinfo: @noindent
5381 Except for the percent sign and the property name, all items are
5382 optional. The individual parts have the following meaning:
5384 - {{{var(WIDTH)}}} ::
5386 An integer specifying the width of the column in characters. If
5387 omitted, the width is determined automatically.
5389 - {{{var(PROPERTY)}}} ::
5391 The property that should be edited in this column. Special
5392 properties representing meta data are allowed here as well (see
5393 [[*Special Properties]]).
5395 - {{{var(TITLE)}}} ::
5397 The header text for the column. If omitted, the property name is
5400 - {{{var(SUMMARY-TYPE)}}} ::
5402 The summary type. If specified, the column values for parent
5403 nodes are computed from the children[fn:55].
5405 Supported summary types are:
5407 | =+= | Sum numbers in this column. |
5408 | =+;%.1f= | Like =+=, but format result with =%.1f=. |
5409 | =$= | Currency, short for =+;%.2f=. |
5410 | =min= | Smallest number in column. |
5411 | =max= | Largest number. |
5412 | =mean= | Arithmetic mean of numbers. |
5413 | =X= | Checkbox status, =[X]= if all children are =[X]=. |
5414 | =X/= | Checkbox status, =[n/m]=. |
5415 | =X%= | Checkbox status, =[n%]=. |
5416 | =:= | Sum times, HH:MM, plain numbers are hours. |
5417 | =:min= | Smallest time value in column. |
5418 | =:max= | Largest time value. |
5419 | =:mean= | Arithmetic mean of time values. |
5420 | =@min= | Minimum age[fn:56] (in days/hours/mins/seconds). |
5421 | =@max= | Maximum age (in days/hours/mins/seconds). |
5422 | =@mean= | Arithmetic mean of ages (in days/hours/mins/seconds). |
5423 | =est+= | Add low-high estimates. |
5425 #+texinfo: @noindent
5426 #+vindex: org-columns-summary-types
5427 You can also define custom summary types by setting
5428 ~org-columns-summary-types~.
5430 The =est+= summary type requires further explanation. It is used for
5431 combining estimates, expressed as low-high ranges. For example,
5432 instead of estimating a particular task will take 5 days, you might
5433 estimate it as 5--6 days if you're fairly confident you know how much
5434 work is required, or 1--10 days if you do not really know what needs
5435 to be done. Both ranges average at 5.5 days, but the first represents
5436 a more predictable delivery.
5438 When combining a set of such estimates, simply adding the lows and
5439 highs produces an unrealistically wide result. Instead, =est+= adds
5440 the statistical mean and variance of the sub-tasks, generating a final
5441 estimate from the sum. For example, suppose you had ten tasks, each
5442 of which was estimated at 0.5 to 2 days of work. Straight addition
5443 produces an estimate of 5 to 20 days, representing what to expect if
5444 everything goes either extremely well or extremely poorly. In
5445 contrast, =est+= estimates the full job more realistically, at 10--15
5448 Here is an example for a complete columns definition, along with
5449 allowed values[fn:57].
5452 :COLUMNS: %25ITEM %9Approved(Approved?){X} %Owner %11Status \
5453 %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T
5454 :Owner_ALL: Tammy Mark Karl Lisa Don
5455 :Status_ALL: "In progress" "Not started yet" "Finished" ""
5456 :Approved_ALL: "[ ]" "[X]"
5459 #+texinfo: @noindent
5460 The first column, =%25ITEM=, means the first 25 characters of the item
5461 itself, i.e., of the headline. You probably always should start the
5462 column definition with the =ITEM= specifier. The other specifiers
5463 create columns =Owner= with a list of names as allowed values, for
5464 =Status= with four different possible values, and for a checkbox field
5465 =Approved=. When no width is given after the =%= character, the
5466 column is exactly as wide as it needs to be in order to fully display
5467 all values. The =Approved= column does have a modified title
5468 (=Approved?=, with a question mark). Summaries are created for the
5469 =Time_Estimate= column by adding time duration expressions like HH:MM,
5470 and for the =Approved= column, by providing an =[X]= status if all
5471 children have been checked. The =CLOCKSUM= and =CLOCKSUM_T= columns
5472 are special, they lists the sums of CLOCK intervals in the subtree,
5473 either for all clocks or just for today.
5475 *** Using column view
5477 :DESCRIPTION: How to create and use column view.
5480 **** Turning column view on or off
5485 - {{{kbd(C-c C-x C-c)}}} (~org-columns~) ::
5487 #+kindex: C-c C-x C-c
5488 #+vindex: org-columns
5489 #+vindex: org-columns-default-format
5490 Turn on column view. If the cursor is before the first headline
5491 in the file, column view is turned on for the entire file, using
5492 the =#+COLUMNS= definition. If the cursor is somewhere inside
5493 the outline, this command searches the hierarchy, up from point,
5494 for a =COLUMNS= property that defines a format. When one is
5495 found, the column view table is established for the tree starting
5496 at the entry that contains the =COLUMNS= property. If no such
5497 property is found, the format is taken from the =#+COLUMNS= line
5498 or from the variable ~org-columns-default-format~, and column
5499 view is established for the current entry and its subtree.
5501 - {{{kbd(r)}}} or {{{kbd(g)}}} (~org-columns-redo~) ::
5505 #+findex: org-columns-redo
5506 Recreate the column view, to include recent changes made in the
5509 - {{{kbd(q)}}} (~org-columns-quit~) ::
5512 #+findex: org-columns-quit
5520 #+attr_texinfo: :sep and
5521 - {{{kbd(LEFT)}}}, {{{kbd(RIGHT)}}}, {{{kbd(UP)}}}, {{{kbd(DOWN)}}} ::
5523 Move through the column view from field to field.
5525 - {{{kbd(1..9\,0)}}} ::
5528 Directly select the Nth allowed value, {{{kbd(0)}}} selects the
5531 - {{{kbd(n)}}} or {{{kbd(S-RIGHT)}}} (~org-columns-next-allowed-value~) and {{{kbd(p)}}} or {{{kbd(S-LEFT)}}} (~org-columns-previous-allowed-value~) ::
5537 #+findex: org-columns-next-allowed-value
5538 #+findex: org-columns-previous-allowed-value
5539 Switch to the next/previous allowed value of the field. For
5540 this, you have to have specified allowed values for a property.
5542 - {{{kbd(e)}}} (~org-columns-edit-value~) ::
5545 #+findex: org-columns-edit-value
5546 Edit the property at point. For the special properties, this
5547 invokes the same interface that you normally use to change that
5548 property. For example, the tag completion or fast selection
5549 interface pops up when editing a =TAGS= property.
5551 - {{{kbd(C-c C-c)}}} (~org-columns-set-tags-or-toggle~) ::
5554 #+findex: org-columns-set-tags-or-toggle
5555 When there is a checkbox at point, toggle it.
5557 - {{{kbd(v)}}} (~org-columns-show-value~) ::
5560 #+findex: org-columns-show-value
5561 View the full value of this property. This is useful if the
5562 width of the column is smaller than that of the value.
5564 - {{{kbd(a)}}} (~org-columns-edit-allowed~) ::
5567 #+findex: org-columns-edit-allowed
5568 Edit the list of allowed values for this property. If the list
5569 is found in the hierarchy, the modified values is stored there.
5570 If no list is found, the new value is stored in the first entry
5571 that is part of the current column view.
5573 **** Modifying column view on-the-fly:
5578 #+attr_texinfo: :sep and
5579 - {{{kbd(<)}}} (~org-columns-narrow~) and {{{kbd(>)}}} (~org-columns-widen~) ::
5583 #+findex: org-columns-narrow
5584 #+findex: org-columns-widen
5585 Make the column narrower/wider by one character.
5587 - {{{kbd(S-M-RIGHT)}}} (~org-columns-new~) ::
5590 #+findex: org-columns-new
5591 Insert a new column, to the left of the current column.
5593 - {{{kbd(S-M-LEFT)}}} (~org-columns-delete~) ::
5596 #+findex: org-columns-delete
5597 Delete the current column.
5599 *** Capturing column view
5601 :DESCRIPTION: A dynamic block for column view.
5604 Since column view is just an overlay over a buffer, it cannot be
5605 exported or printed directly. If you want to capture a column view,
5606 use a =columnview= dynamic block (see [[*Dynamic Blocks]]). The frame of
5607 this block looks like this:
5609 #+cindex: @samp{BEGIN columnview}
5612 ,#+BEGIN: columnview :hlines 1 :id "label"
5617 #+texinfo: @noindent
5618 This dynamic block has the following parameters:
5622 This is the most important parameter. Column view is a feature
5623 that is often localized to a certain (sub)tree, and the capture
5624 block might be at a different location in the file. To identify
5625 the tree whose view to capture, you can use four values:
5629 Use the tree in which the capture block is located.
5633 Make a global view, including all headings in the file.
5635 - =file:FILENAME= ::
5637 Run column view at the top of the {{{var(FILENAME)}}} file
5641 #+cindex: @samp{ID}, property
5642 Call column view in the tree that has an =ID= property with
5643 the value {{{var(LABEL)}}}. You can use {{{kbd(M-x
5644 org-id-copy)}}} to create a globally unique ID for the
5645 current entry and copy it to the kill-ring.
5649 When ~t~, insert an hline after every line. When a number N,
5650 insert an hline before each headline with level ~<= N~.
5654 When non-~nil~, force column groups to get vertical lines.
5658 When set to a number, do not capture entries below this level.
5660 - =:skip-empty-rows= ::
5662 When non-~nil~, skip rows where the only non-empty specifier of
5663 the column view is =ITEM=.
5667 When non-~nil~, indent each =ITEM= field according to its level.
5669 #+texinfo: @noindent
5670 The following commands insert or update the dynamic block:
5672 - {{{kbd(C-c C-x i)}}} (~org-insert-columns-dblock~) ::
5675 #+findex: org-insert-columns-dblock
5676 Insert a dynamic block capturing a column view. Prompt for the
5677 scope or ID of the view.
5679 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
5682 #+kindex: C-c C-x C-u
5683 #+findex: org-dblock-update
5684 Update dynamic block at point. The cursor needs to be in the
5685 =#+BEGIN= line of the dynamic block.
5687 - {{{kbd(C-u C-c C-x C-u)}}} (~org-update-all-dblocks~) ::
5689 #+kindex: C-u C-c C-x C-u
5690 Update all dynamic blocks (see [[*Dynamic Blocks]]). This is useful
5691 if you have several clock table blocks, column-capturing blocks
5692 or other dynamic blocks in a buffer.
5694 You can add formulas to the column view table and you may add plotting
5695 instructions in front of the table---these survive an update of the
5696 block. If there is a =TBLFM= keyword after the table, the table is
5697 recalculated automatically after an update.
5699 An alternative way to capture and process property values into a table
5700 is provided by Eric Schulte's =org-collector.el= which is
5701 a contributed package[fn:58]. It provides a general API to collect
5702 properties from entries in a certain scope, and arbitrary Lisp
5703 expressions to process these values before inserting them into a table
5708 :DESCRIPTION: Making items useful for planning.
5713 #+cindex: date stamp
5715 To assist project planning, TODO items can be labeled with a date
5716 and/or a time. The specially formatted string carrying the date and
5717 time information is called a /timestamp/ in Org mode. This may be
5718 a little confusing because timestamp is often used as indicating when
5719 something was created or last changed. However, in Org mode this term
5720 is used in a much wider sense.
5722 ** Timestamps, Deadlines and Scheduling
5724 :DESCRIPTION: Assigning a time to a tree entry.
5725 :ALT_TITLE: Timestamps
5727 #+cindex: timestamps
5728 #+cindex: ranges, time
5729 #+cindex: date stamps
5731 #+cindex: scheduling
5733 A timestamp is a specification of a date (possibly with a time or
5734 a range of times) in a special format, either =<2003-09-16 Tue>= or
5735 =<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=[fn:59].
5736 A timestamp can appear anywhere in the headline or body of an Org tree
5737 entry. Its presence causes entries to be shown on specific dates in
5738 the agenda (see [[*Weekly/daily agenda]]). We distinguish:
5740 - Plain timestamp; Event; Appointment ::
5743 #+cindex: appointment
5744 A simple timestamp just assigns a date/time to an item. This is
5745 just like writing down an appointment or event in a paper agenda.
5746 In the timeline and agenda displays, the headline of an entry
5747 associated with a plain timestamp is shown exactly on that date.
5750 ,* Meet Peter at the movies
5751 <2006-11-01 Wed 19:15>
5752 ,* Discussion on climate change
5753 <2006-11-02 Thu 20:00-22:00>
5756 - Timestamp with repeater interval ::
5758 #+cindex: timestamp, with repeater interval
5759 A timestamp may contain a /repeater interval/, indicating that it
5760 applies not only on the given date, but again and again after
5761 a certain interval of N days (d), weeks (w), months (m), or years
5762 (y). The following shows up in the agenda every Wednesday:
5765 ,* Pick up Sam at school
5766 <2007-05-16 Wed 12:30 +1w>
5769 - Diary-style sexp entries ::
5771 #+cindex: diary style timestamps
5772 #+cindex: sexp timestamps
5773 For more complex date specifications, Org mode supports using the
5774 special sexp diary entries implemented in the Emacs
5775 calendar/diary package[fn:60]. For example, with optional time:
5778 ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
5779 <%%(org-float t 4 2)>
5782 - Time/Date range ::
5785 #+cindex: date range
5786 Two timestamps connected by =--= denote a range. The headline is
5787 shown on the first and last day of the range, and on any dates
5788 that are displayed and fall in the range. Here is an example:
5791 ,** Meeting in Amsterdam
5792 <2004-08-23 Mon>--<2004-08-26 Thu>
5795 - Inactive timestamp ::
5797 #+cindex: timestamp, inactive
5798 #+cindex: inactive timestamp
5799 Just like a plain timestamp, but with square brackets instead of
5800 angular ones. These timestamps are inactive in the sense that
5801 they do /not/ trigger an entry to show up in the agenda.
5804 ,* Gillian comes late for the fifth time
5808 ** Creating Timestamps
5810 :DESCRIPTION: Commands to insert timestamps.
5813 For Org mode to recognize timestamps, they need to be in the specific
5814 format. All commands listed below produce timestamps in the correct
5817 #+attr_texinfo: :sep ,
5818 - {{{kbd(C-c .)}}} (~org-time-stamp~) ::
5821 #+findex: org-time-stamp
5822 Prompt for a date and insert a corresponding timestamp. When the
5823 cursor is at an existing timestamp in the buffer, the command is
5824 used to modify this timestamp instead of inserting a new one.
5825 When this command is used twice in succession, a time range is
5828 - {{{kbd(C-c !)}}} (~org-time-stamp-inactive~) ::
5831 #+findex: org-time-stamp-inactive
5832 Like {{{kbd(C-c .)}}}, but insert an inactive timestamp that does
5833 not cause an agenda entry.
5835 - {{{kbd(C-u C-c .)}}}, {{{kbd(C-u C-c !)}}} ::
5840 #+vindex: org-time-stamp-rounding-minutes
5841 Like {{{kbd(C-c .)}}} and {{{kbd(C-c !)}}}, but use the
5842 alternative format which contains date and time. The default
5843 time can be rounded to multiples of 5 minutes, see the option
5844 ~org-time-stamp-rounding-minutes~.
5846 - {{{kbd(C-c C-c)}}} ::
5849 Normalize timestamp, insert/fix day name if missing or wrong.
5851 - {{{kbd(C-c <)}}} (~org-date-from-calendar~) ::
5854 #+findex: org-date-from-calendar
5855 Insert a timestamp corresponding to the cursor date in the Calendar.
5857 - {{{kbd(C-c >)}}} (~org-goto-calendar~) ::
5860 #+findex: org-goto-calendar
5861 Access the Emacs calendar for the current date. If there is a
5862 timestamp in the current line, go to the corresponding date instead.
5864 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
5867 #+findex: org-open-at-point
5868 Access the agenda for the date given by the timestamp or -range
5869 at point (see [[*Weekly/daily agenda]]).
5871 - {{{kbd(S-LEFT)}}} (~org-timestamp-down-day~), {{{kbd(S-RIGHT)}}} (~org-timestamp-up-day~) ::
5875 #+findex: org-timestamp-down-day
5876 #+findex: org-timestamp-up-day
5877 Change date at cursor by one day. These key bindings conflict
5878 with shift-selection and related modes (see [[*Packages that
5879 conflict with Org mode]]).
5881 - {{{kbd(S-UP)}}} (~org-timestamp-up~), {{{kbd(S-DOWN)}}} (~org-timestamp-down~) ::
5885 Change the item under the cursor in a timestamp. The cursor can
5886 be on a year, month, day, hour or minute. When the timestamp
5887 contains a time range like =15:30-16:30=, modifying the first
5888 time also shifts the second, shifting the time block with
5889 constant length. To change the length, modify the second time.
5890 Note that if the cursor is in a headline and not at a timestamp,
5891 these same keys modify the priority of an item. (see
5892 [[*Priorities]]). The key bindings also conflict with
5893 shift-selection and related modes (see [[*Packages that conflict
5896 - {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
5899 #+findex: org-evaluate-time-range
5900 #+cindex: evaluate time range
5901 Evaluate a time range by computing the difference between start
5902 and end. With a prefix argument, insert result after the time
5903 range (in a table: into the following column).
5905 *** The date/time prompt
5907 :DESCRIPTION: How Org mode helps you enter dates and times.
5909 #+cindex: date, reading in minibuffer
5910 #+cindex: time, reading in minibuffer
5912 #+vindex: org-read-date-prefer-future
5913 When Org mode prompts for a date/time, the default is shown in default
5914 date/time format, and the prompt therefore seems to ask for a specific
5915 format. But it in fact accepts date/time information in a variety of
5916 formats. Generally, the information should start at the beginning of
5917 the string. Org mode finds whatever information is in there and
5918 derives anything you have not specified from the /default date and
5919 time/. The default is usually the current date and time, but when
5920 modifying an existing timestamp, or when entering the second stamp of
5921 a range, it is taken from the stamp in the buffer. When filling in
5922 information, Org mode assumes that most of the time you want to enter
5923 a date in the future: if you omit the month/year and the given
5924 day/month is /before/ today, it assumes that you mean a future
5925 date[fn:61]. If the date has been automatically shifted into the
5926 future, the time prompt shows this with =(=>F)=.
5928 For example, let's assume that today is *June 13, 2006*. Here is how
5929 various inputs are interpreted, the items filled in by Org mode are in
5932 | =3-2-5= | \rArr{} 2003-02-05 |
5933 | =2/5/3= | \rArr{} 2003-02-05 |
5934 | =14= | \rArr{} *2006*-*06*-14 |
5935 | =12= | \rArr{} *2006*-*07*-12 |
5936 | =2/5= | \rArr{} *2007*-02-05 |
5937 | =Fri= | \rArr{} nearest Friday (default date or later) |
5938 | =sep 15= | \rArr{} *2006*-09-15 |
5939 | =feb 15= | \rArr{} *2007*-02-15 |
5940 | =sep 12 9= | \rArr{} 2009-09-12 |
5941 | =12:45= | \rArr{} *2006*-*06*-*13* 12:45 |
5942 | =22 sept 0:34= | \rArr{} *2006*-09-22 0:34 |
5943 | =w4= | \rArr{} ISO week for of the current year *2006* |
5944 | =2012 w4 fri= | \rArr{} Friday of ISO week 4 in 2012 |
5945 | =2012-w04-5= | \rArr{} Same as above |
5947 Furthermore you can specify a relative date by giving, as the /first/
5948 thing in the input: a plus/minus sign, a number and a letter---=d=,
5949 =w=, =m= or =y=---to indicate change in days, weeks, months, or
5950 years. With a single plus or minus, the date is always relative to
5951 today. With a double plus or minus, it is relative to the default
5952 date. If instead of a single letter, you use the abbreviation of day
5953 name, the date is the Nth such day, e.g.:
5955 | =+0= | \rArr{} today |
5956 | =.= | \rArr{} today |
5957 | =+4d= | \rArr{} four days from today |
5958 | =+4= | \rArr{} same as +4d |
5959 | =+2w= | \rArr{} two weeks from today |
5960 | =++5= | \rArr{} five days from default date |
5961 | =+2tue= | \rArr{} second Tuesday from now |
5963 #+vindex: parse-time-months
5964 #+vindex: parse-time-weekdays
5965 The function understands English month and weekday abbreviations. If
5966 you want to use un-abbreviated names and/or other languages, configure
5967 the variables ~parse-time-months~ and ~parse-time-weekdays~.
5969 #+vindex: org-read-date-force-compatible-dates
5970 Not all dates can be represented in a given Emacs implementation. By
5971 default Org mode forces dates into the compatibility range 1970--2037
5972 which works on all Emacs implementations. If you want to use dates
5973 outside of this range, read the docstring of the variable
5974 ~org-read-date-force-compatible-dates~.
5976 You can specify a time range by giving start and end times or by
5977 giving a start time and a duration (in HH:MM format). Use one or two
5978 dash(es) as the separator in the former case and use =+= as the
5979 separator in the latter case, e.g.:
5981 | =11am-1:15pm= | \rArr{} 11:00-13:15 |
5982 | =11am--1:15pm= | \rArr{} same as above |
5983 | =11am+2:15= | \rArr{} same as above |
5985 #+cindex: calendar, for selecting date
5986 #+vindex: org-popup-calendar-for-date-prompt
5987 Parallel to the minibuffer prompt, a calendar is popped up[fn:62].
5988 When you exit the date prompt, either by clicking on a date in the
5989 calendar, or by pressing {{{kbd(RET)}}}, the date selected in the
5990 calendar is combined with the information entered at the prompt. You
5991 can control the calendar fully from the minibuffer:
6005 #+attr_texinfo: :columns 0.25 0.55
6006 | {{{kbd(RET)}}} | Choose date at cursor in calendar. |
6007 | {{{kbd(mouse-1)}}} | Select date by clicking on it. |
6008 | {{{kbd(S-RIGHT)}}} | One day forward. |
6009 | {{{kbd(S-LEFT)}}} | One day backward. |
6010 | {{{kbd(S-DOWN)}}} | One week forward. |
6011 | {{{kbd(S-UP)}}} | One week backward. |
6012 | {{{kbd(M-S-RIGHT)}}} | One month forward. |
6013 | {{{kbd(M-S-LEFT)}}} | One month backward. |
6014 | {{{kbd(>)}}} | Scroll calendar forward by one month. |
6015 | {{{kbd(<)}}} | Scroll calendar backward by one month. |
6016 | {{{kbd(M-v)}}} | Scroll calendar forward by 3 months. |
6017 | {{{kbd(C-v)}}} | Scroll calendar backward by 3 months. |
6019 #+vindex: org-read-date-display-live
6020 The actions of the date/time prompt may seem complex, but I assure you
6021 they will grow on you, and you will start getting annoyed by pretty
6022 much any other way of entering a date/time out there. To help you
6023 understand what is going on, the current interpretation of your input
6024 is displayed live in the minibuffer[fn:63].
6026 *** Custom time format
6028 :DESCRIPTION: Making dates look different.
6030 #+cindex: custom date/time format
6031 #+cindex: time format, custom
6032 #+cindex: date format, custom
6034 #+vindex: org-display-custom-times
6035 #+vindex: org-time-stamp-custom-formats
6036 Org mode uses the standard ISO notation for dates and times as it is
6037 defined in ISO 8601. If you cannot get used to this and require
6038 another representation of date and time to keep you happy, you can get
6039 it by customizing the variables ~org-display-custom-times~ and
6040 ~org-time-stamp-custom-formats~.
6042 - {{{kbd(C-c C-x C-t)}}} (~org-toggle-time-stamp-overlays~) ::
6044 #+kindex: C-c C-x C-t
6045 #+findex: org-toggle-time-stamp-overlays
6046 Toggle the display of custom formats for dates and times.
6048 #+texinfo: @noindent
6049 Org mode needs the default format for scanning, so the custom
6050 date/time format does not /replace/ the default format. Instead, it
6051 is put /over/ the default format using text properties. This has the
6052 following consequences:
6054 - You cannot place the cursor onto a timestamp anymore, only before or
6057 - The {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} keys can no longer be used
6058 to adjust each component of a timestamp. If the cursor is at the
6059 beginning of the stamp, {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} change
6060 the stamp by one day, just like {{{kbd(S-LEFT)}}}
6061 {{{kbd(S-RIGHT)}}}. At the end of the stamp, change the time by one
6064 - If the timestamp contains a range of clock times or a repeater,
6065 these are not overlaid, but remain in the buffer as they were.
6067 - When you delete a timestamp character-by-character, it only
6068 disappears from the buffer after /all/ (invisible) characters
6069 belonging to the ISO timestamp have been removed.
6071 - If the custom timestamp format is longer than the default and you
6072 are using dates in tables, table alignment will be messed up. If
6073 the custom format is shorter, things do work as expected.
6075 ** Deadlines and Scheduling
6077 :DESCRIPTION: Planning your work.
6080 A timestamp may be preceded by special keywords to facilitate
6081 planning. Both the timestamp and the keyword have to be positioned
6082 immediately after the task they refer to.
6086 #+cindex: @samp{DEADLINE}
6087 Meaning: the task (most likely a TODO item, though not
6088 necessarily) is supposed to be finished on that date.
6090 #+vindex: org-deadline-warning-days
6091 On the deadline date, the task is listed in the agenda. In
6092 addition, the agenda for /today/ carries a warning about the
6093 approaching or missed deadline, starting
6094 ~org-deadline-warning-days~ before the due date, and continuing
6095 until the entry is marked DONE. An example:
6098 ,*** TODO write article about the Earth for the Guide
6099 DEADLINE: <2004-02-29 Sun>
6100 The editor in charge is [[bbdb:Ford Prefect]]
6103 #+vindex: org-agenda-skip-deadline-prewarning-if-scheduled
6104 You can specify a different lead time for warnings for a specific
6105 deadlines using the following syntax. Here is an example with
6106 a warning period of 5 days =DEADLINE: <2004-02-29 Sun -5d>=.
6107 This warning is deactivated if the task gets scheduled and you
6108 set ~org-agenda-skip-deadline-prewarning-if-scheduled~ to ~t~.
6112 #+cindex: @samp{SCHEDULED}
6113 Meaning: you are planning to start working on that task on the
6116 #+vindex: org-agenda-skip-scheduled-if-done
6117 The headline is listed under the given date[fn:64]. In addition,
6118 a reminder that the scheduled date has passed is present in the
6119 compilation for /today/, until the entry is marked DONE, i.e.,
6120 the task is automatically forwarded until completed.
6123 ,*** TODO Call Trillian for a date on New Years Eve.
6124 SCHEDULED: <2004-12-25 Sat>
6127 #+vindex: org-scheduled-delay-days
6128 #+vindex: org-agenda-skip-scheduled-delay-if-deadline
6129 If you want to /delay/ the display of this task in the agenda,
6130 use =SCHEDULED: <2004-12-25 Sat -2d>=: the task is still
6131 scheduled on the 25th but will appear two days later. In case
6132 the task contains a repeater, the delay is considered to affect
6133 all occurrences; if you want the delay to only affect the first
6134 scheduled occurrence of the task, use =--2d= instead. See
6135 ~org-scheduled-delay-days~ and
6136 ~org-agenda-skip-scheduled-delay-if-deadline~ for details on how
6137 to control this globally or per agenda.
6139 #+texinfo: @noindent
6140 *Important:* Scheduling an item in Org mode should /not/ be
6141 understood in the same way that we understand /scheduling
6142 a meeting/. Setting a date for a meeting is just a simple
6143 appointment, you should mark this entry with a simple plain
6144 timestamp, to get this item shown on the date where it applies.
6145 This is a frequent misunderstanding by Org users. In Org mode,
6146 /scheduling/ means setting a date when you want to start working
6149 You may use timestamps with repeaters in scheduling and deadline
6150 entries. Org mode issues early and late warnings based on the
6151 assumption that the timestamp represents the /nearest instance/ of the
6152 repeater. However, the use of diary S-exp entries like
6154 : <%%(org-float t 42)>
6156 #+texinfo: @noindent
6157 in scheduling and deadline timestamps is limited. Org mode does not
6158 know enough about the internals of each S-exp function to issue early
6159 and late warnings. However, it shows the item on each day where the
6160 S-exp entry matches.
6162 *** Inserting deadlines or schedules
6164 :DESCRIPTION: Planning items.
6165 :ALT_TITLE: Inserting deadline/schedule
6168 The following commands allow you to quickly insert a deadline or to
6169 schedule an item:[fn:65]
6171 - {{{kbd(C-c C-d)}}} (~org-deadline~) ::
6174 #+findex: org-deadline
6175 #+vindex: org-log-redeadline
6176 Insert =DEADLINE= keyword along with a stamp. The insertion
6177 happens in the line directly following the headline. Remove any
6178 =CLOSED= timestamp . When called with a prefix argument, also
6179 remove any existing deadline from the entry. Depending on the
6180 variable ~org-log-redeadline~, take a note when changing an
6181 existing deadline[fn:66].
6183 - {{{kbd(C-c C-s)}}} (~org-schedule~) ::
6186 #+findex: org-schedule
6187 #+vindex: org-log-reschedule
6188 Insert =SCHEDULED= keyword along with a stamp. The insertion
6189 happens in the line directly following the headline. Remove any
6190 =CLOSED= timestamp. When called with a prefix argument, also
6191 remove the scheduling date from the entry. Depending on the
6192 variable ~org-log-reschedule~, take a note when changing an
6193 existing scheduling time[fn:67].
6195 - {{{kbd(C-c C-x C-k)}}} (~org-mark-entry-for-agenda-action~) ::
6197 #+kindex: C-c C-x C-k
6200 #+findex: org-mark-entry-for-agenda-action
6201 Mark the current entry for agenda action. After you have marked
6202 the entry like this, you can open the agenda or the calendar to
6203 find an appropriate date. With the cursor on the selected date,
6204 press {{{kbd(k s)}}} or {{{kbd(k d)}}} to schedule the marked
6207 - {{{kbd(C-c / d)}}} (~org-check-deadlines~) ::
6210 #+findex: org-check-deadlines
6211 #+cindex: sparse tree, for deadlines
6212 #+vindex: org-deadline-warning-days
6213 Create a sparse tree with all deadlines that are either past-due,
6214 or which will become due within ~org-deadline-warning-days~.
6215 With {{{kbd(C-u)}}} prefix, show all deadlines in the file. With
6216 a numeric prefix, check that many days. For example, {{{kbd(C-1
6217 C-c / d)}}} shows all deadlines due tomorrow.
6219 - {{{kbd(C-c / b)}}}, ~org-check-before-date~ ::
6222 #+findex: org-check-before-date
6223 Sparse tree for deadlines and scheduled items before a given
6226 - {{{kbd(C-c / a)}}}, ~org-check-after-date~ ::
6229 #+findex: org-check-after-date
6230 Sparse tree for deadlines and scheduled items after a given date.
6232 Note that ~org-schedule~ and ~org-deadline~ supports setting the date
6233 by indicating a relative time e.g., =+1d= sets the date to the next
6234 day after today, and =--1w= sets the date to the previous week before
6235 any current timestamp.
6239 :DESCRIPTION: Items that show up again and again.
6241 #+cindex: tasks, repeated
6242 #+cindex: repeated tasks
6244 Some tasks need to be repeated again and again. Org mode helps to
6245 organize such tasks using a so-called repeater in a =DEADLINE=,
6246 =SCHEDULED=, or plain timestamp. In the following example:
6249 ,** TODO Pay the rent
6250 DEADLINE: <2005-10-01 Sat +1m>
6254 the =+1m= is a repeater; the intended interpretation is that the task
6255 has a deadline on =<2005-10-01>= and repeats itself every (one) month
6256 starting from that time. You can use yearly, monthly, weekly, daily
6257 and hourly repeat cookies by using the ~y/w/m/d/h~ letters. If you
6258 need both a repeater and a special warning period in a deadline entry,
6259 the repeater should come first and the warning period last: =DEADLINE:
6260 <2005-10-01 Sat +1m -3d>=.
6262 #+vindex: org-todo-repeat-to-state
6263 Deadlines and scheduled items produce entries in the agenda when they
6264 are over-due, so it is important to be able to mark such an entry as
6265 completed once you have done so. When you mark a =DEADLINE= or
6266 a =SCHEDULED= with the TODO keyword =DONE=, it no longer produces
6267 entries in the agenda. The problem with this is, however, is that
6268 then also the /next/ instance of the repeated entry will not be
6269 active. Org mode deals with this in the following way: when you try
6270 to mark such an entry DONE, using {{{kbd(C-c C-t)}}}, it shifts the
6271 base date of the repeating timestamp by the repeater interval, and
6272 immediately sets the entry state back to TODO[fn:68]. In the example
6273 above, setting the state to DONE would actually switch the date like
6277 ,** TODO Pay the rent
6278 DEADLINE: <2005-11-01 Tue +1m>
6281 To mark a task with a repeater as DONE, use {{{kbd(C-- 1 C-c C-t)}}},
6282 i.e., ~org-todo~ with a numeric prefix argument of =-1=.
6284 #+vindex: org-log-repeat
6285 A timestamp[fn:69] is added under the deadline, to keep a record that
6286 you actually acted on the previous instance of this deadline.
6288 As a consequence of shifting the base date, this entry is no longer
6289 visible in the agenda when checking past dates, but all future
6290 instances will be visible.
6292 With the =+1m= cookie, the date shift is always exactly one month. So
6293 if you have not paid the rent for three months, marking this entry
6294 DONE still keeps it as an overdue deadline. Depending on the task,
6295 this may not be the best way to handle it. For example, if you forgot
6296 to call your father for 3 weeks, it does not make sense to call him
6297 3 times in a single day to make up for it. Finally, there are tasks
6298 like changing batteries which should always repeat a certain time
6299 /after/ the last time you did it. For these tasks, Org mode has
6300 special repeaters =++= and =.+=. For example:
6303 ,** TODO Call Father
6304 DEADLINE: <2008-02-10 Sun ++1w>
6305 Marking this DONE shifts the date by at least one week, but also
6306 by as many weeks as it takes to get this date into the future.
6307 However, it stays on a Sunday, even if you called and marked it
6310 ,** TODO Empty kitchen trash
6311 DEADLINE: <2008-02-08 Fri 20:00 ++1d>
6312 Marking this DONE shifts the date by at least one day, and also
6313 by as many days as it takes to get the timestamp into the future.
6314 Since there is a time in the timestamp, the next deadline in the
6315 future will be on today's date if you complete the task before
6318 ,** TODO Check the batteries in the smoke detectors
6319 DEADLINE: <2005-11-01 Tue .+1m>
6320 Marking this DONE will shift the date to one month after today.
6323 #+vindex: org-agenda-skip-scheduled-if-deadline-is-shown
6324 You may have both scheduling and deadline information for a specific
6325 task. If the repeater is set for the scheduling information only, you
6326 probably want the repeater to be ignored after the deadline. If so,
6327 set the variable ~org-agenda-skip-scheduled-if-deadline-is-shown~ to
6328 ~repeated-after-deadline~. However, any scheduling information
6329 without a repeater is no longer relevant once the task is done, and
6330 thus, removed upon repeating the task. If you want both scheduling
6331 and deadline information to repeat after the same interval, set the
6332 same repeater for both timestamps.
6334 An alternative to using a repeater is to create a number of copies of
6335 a task subtree, with dates shifted in each copy. The command
6336 {{{kbd(C-c C-x c)}}} was created for this purpose; it is described in
6337 [[*Structure Editing]].
6339 ** Clocking Work Time
6341 :DESCRIPTION: Tracking how long you spend on a task.
6343 #+cindex: clocking time
6344 #+cindex: time clocking
6346 Org mode allows you to clock the time you spend on specific tasks in
6347 a project. When you start working on an item, you can start the
6348 clock. When you stop working on that task, or when you mark the task
6349 done, the clock is stopped and the corresponding time interval is
6350 recorded. It also computes the total time spent on each
6351 subtree[fn:70] of a project. And it remembers a history or tasks
6352 recently clocked, to that you can jump quickly between a number of
6353 tasks absorbing your time.
6355 To save the clock history across Emacs sessions, use:
6357 #+begin_src emacs-lisp
6358 (setq org-clock-persist 'history)
6359 (org-clock-persistence-insinuate)
6362 #+vindex: org-clock-persist
6363 When you clock into a new task after resuming Emacs, the incomplete
6364 clock[fn:71] is retrieved (see [[*Resolving idle time]]) and you are
6365 prompted about what to do with it.
6367 *** Clocking commands
6369 :DESCRIPTION: Starting and stopping a clock.
6372 #+attr_texinfo: :sep ,
6373 - {{{kbd(C-c C-x C-i)}}} (~org-clock-in~) ::
6375 #+kindex: C-c C-x C-i
6376 #+findex: org-clock-in
6377 #+vindex: org-clock-into-drawer
6378 #+vindex: org-clock-continuously
6379 #+cindex: @samp{LOG_INTO_DRAWER}, property
6380 Start the clock on the current item (clock-in). This inserts the
6381 CLOCK keyword together with a timestamp. If this is not the
6382 first clocking of this item, the multiple CLOCK lines are wrapped
6383 into a =LOGBOOK= drawer (see also the variable
6384 ~org-clock-into-drawer~). You can also overrule the setting of
6385 this variable for a subtree by setting a =CLOCK_INTO_DRAWER= or
6386 =LOG_INTO_DRAWER= property. When called with a {{{kbd(C-u)}}}
6387 prefix argument, select the task from a list of recently clocked
6388 tasks. With two {{{kbd(C-u C-u)}}} prefixes, clock into the task
6389 at point and mark it as the default task; the default task is
6390 always be available with letter {{{kbd(d)}}} when selecting
6391 a clocking task. With three {{{kbd(C-u C-u C-u)}}} prefixes,
6392 force continuous clocking by starting the clock when the last
6395 #+cindex: @samp{CLOCK_MODELINE_TOTAL}, property
6396 #+cindex: @samp{LAST_REPEAT}, property
6397 #+vindex: org-clock-modeline-total
6398 #+vindex: org-clock-in-prepare-hook
6399 While the clock is running, Org shows the current clocking time
6400 in the mode line, along with the title of the task. The clock
6401 time shown is all time ever clocked for this task and its
6402 children. If the task has an effort estimate (see [[*Effort
6403 Estimates]]), the mode line displays the current clocking time
6404 against it[fn:72]. If the task is a repeating one (see [[*Repeated
6405 tasks]]), show only the time since the last reset of the
6406 task[fn:73]. You can exercise more control over show time with
6407 the =CLOCK_MODELINE_TOTAL= property. It may have the values
6408 =current= to show only the current clocking instance, =today= to
6409 show all time clocked on this tasks today---see also the
6410 variable ~org-extend-today-until~, ~all~ to include all time, or
6411 ~auto~ which is the default[fn:74]. Clicking with
6412 {{{kbd(mouse-1)}}} onto the mode line entry pops up a menu with
6415 - {{{kbd(C-c C-x C-o)}}} (~org-clock-out~) ::
6417 #+kindex: C-c C-x C-o
6418 #+findex: org-clock-out
6419 #+vindex: org-log-note-clock-out
6420 Stop the clock (clock-out). This inserts another timestamp at
6421 the same location where the clock was last started. It also
6422 directly computes the resulting time in inserts it after the time
6423 range as ==>HH:MM=. See the variable ~org-log-note-clock-out~
6424 for the possibility to record an additional note together with
6425 the clock-out timestamp[fn:75].
6427 - {{{kbd(C-c C-x C-x)}}} (~org-clock-in-last~) ::
6429 #+kindex: C-c C-x C-x
6430 #+findex: org-clock-in-last
6431 #+vindex: org-clock-continuously
6432 Re-clock the last clocked task. With one {{{kbd(C-u)}}} prefix
6433 argument, select the task from the clock history. With two
6434 {{{kbd(C-u)}}} prefixes, force continuous clocking by starting
6435 the clock when the last clock stopped.
6437 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
6439 #+kindex: C-c C-x C-e
6440 #+findex: org-clock-modify-effort-estimate
6441 Update the effort estimate for the current clock task.
6443 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
6447 #+findex: org-evaluate-time-range
6448 Recompute the time interval after changing one of the timestamps.
6449 This is only necessary if you edit the timestamps directly. If
6450 you change them with {{{kbd(S-<cursor>)}}} keys, the update is
6453 - {{{kbd(C-S-UP)}}} (~org-clock-timestamps-up~), {{{kbd(C-S-DOWN)}}} (~org-clock-timestamps-down~) ::
6456 #+findex: org-clock-timestamps-up
6458 #+findex: org-clock-timestamps-down
6459 On CLOCK log lines, increase/decrease both timestamps so that the
6460 clock duration keeps the same value.
6462 - {{{kbd(S-M-UP)}}} (~org-timestamp-up~), {{{kbd(S-M-DOWN)}}} (~org-timestamp-down~) ::
6465 #+findex: org-clock-timestamp-up
6467 #+findex: org-clock-timestamp-down
6468 On =CLOCK= log lines, increase/decrease the timestamp at point
6469 and the one of the previous, or the next, clock timestamp by the
6470 same duration. For example, if you hit {{{kbd(S-M-UP)}}} to
6471 increase a clocked-out timestamp by five minutes, then the
6472 clocked-in timestamp of the next clock is increased by five
6475 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
6479 Changing the TODO state of an item to DONE automatically stops
6480 the clock if it is running in this same item.
6482 - {{{kbd(C-c C-x C-q)}}} (~org-clock-cancel~) ::
6484 #+kindex: C-c C-x C-q
6485 #+findex: org-clock-cancel
6486 Cancel the current clock. This is useful if a clock was started
6487 by mistake, or if you ended up working on something else.
6489 - {{{kbd(C-c C-x C-j)}}} (~org-clock-goto~) ::
6491 #+kindex: C-c C-x C-j
6492 #+findex: or-clock-goto
6493 Jump to the headline of the currently clocked in task. With
6494 a {{{kbd(C-u)}}} prefix argument, select the target task from
6495 a list of recently clocked tasks.
6497 - {{{kbd(C-c C-x C-d)}}} (~org-clock-display~) ::
6499 #+kindex: C-c C-x C-d
6500 #+findex: org-clock-display
6501 #+vindex: org-remove-highlights-with-change
6502 Display time summaries for each subtree in the current buffer.
6503 This puts overlays at the end of each headline, showing the total
6504 time recorded under that heading, including the time of any
6505 subheadings. You can use visibility cycling to study the tree,
6506 but the overlays disappear when you change the buffer (see
6507 variable ~org-remove-highlights-with-change~) or press {{{kbd(C-c
6510 The {{{kbd(l)}}} key may be used in the agenda (see [[*Weekly/daily
6511 agenda]]) to show which tasks have been worked on or closed during
6514 *Important:* note that both ~org-clock-out~ and ~org-clock-in-last~
6515 can have a global keybinding and do not modify the window disposition.
6519 :DESCRIPTION: Detailed reports.
6521 #+cindex: clocktable, dynamic block
6522 #+cindex: report, of clocked time
6524 Org mode can produce quite complex reports based on the time clocking
6525 information. Such a report is called a /clock table/, because it is
6526 formatted as one or several Org tables.
6528 #+attr_texinfo: :sep ,
6529 - {{{kbd(C-c C-x C-r)}}} (~org-clock-report~) ::
6531 #+kindex: C-c C-x C-r
6532 #+findex: org-clock-report
6533 Insert a dynamic block (see [[*Dynamic Blocks]]) containing a clock
6534 report as an Org mode table into the current file. When the
6535 cursor is at an existing clock table, just update it. When
6536 called with a prefix argument, jump to the first clock report in
6537 the current document and update it. The clock table includes
6540 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
6543 #+kindex: C-c C-x C-u
6544 #+findex: org-dblock-update
6545 Update dynamic block at point. The cursor needs to be in the
6546 =BEGIN= line of the dynamic block.
6548 - {{{kbd(C-u C-c C-x C-u)}}} ::
6550 #+kindex: C-u C-c C-x C-u
6551 Update all dynamic blocks (see [[*Dynamic Blocks]]). This is useful
6552 if you have several clock table blocks in a buffer.
6554 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} (~org-clocktable-try-shift~) ::
6558 #+findex: org-clocktable-try-shift
6559 Shift the current =:block= interval and update the table. The
6560 cursor needs to be in the =#+BEGIN: clocktable= line for this
6561 command. If =:block= is =today=, it is shifted to =today-1=,
6564 Here is an example of the frame for a clock table as it is inserted
6565 into the buffer with the {{{kbd(C-c C-x C-r)}}} command:
6567 #+cindex: @samp{BEGIN clocktable}
6569 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
6573 #+texinfo: @noindent
6574 #+vindex: org-clocktable-defaults
6575 The =#+BEGIN= line and specify a number of options to define the
6576 scope, structure, and formatting of the report. Defaults for all
6577 these options can be configured in the variable
6578 ~org-clocktable-defaults~.
6580 #+texinfo: @noindent
6581 First there are options that determine which clock entries are to
6586 Maximum level depth to which times are listed in the table.
6587 Clocks at deeper levels are summed into the upper level.
6591 The scope to consider. This can be any of the following:
6593 | ~nil~ | the current buffer or narrowed region |
6594 | ~file~ | the full current buffer |
6595 | ~subtree~ | the subtree where the clocktable is located |
6596 | ~treeN~ | the surrounding level N tree, for example =tree3= |
6597 | ~tree~ | the surrounding level 1 tree |
6598 | ~agenda~ | all agenda files |
6599 | =("file" ...)= | scan these files |
6600 | =FUNCTION= | scan files returned by calling FUNCTION with no argument |
6601 | ~file-with-archives~ | current file and its archives |
6602 | ~agenda-with-archives~ | all agenda files, including archives |
6606 The time block to consider. This block is specified either
6607 absolutely, or relative to the current time and may be any of
6610 | =2007-12-31= | New year eve 2007 |
6611 | =2007-12= | December 2007 |
6612 | =2007-W50= | ISO-week 50 in 2007 |
6613 | =2007-Q2= | 2nd quarter in 2007 |
6614 | =2007= | the year 2007 |
6615 | ~today~, ~yesterday~, ~today-N~ | a relative day |
6616 | ~thisweek~, ~lastweek~, ~thisweek-N~ | a relative week |
6617 | ~thismonth~, ~lastmonth~, ~thismonth-N~ | a relative month |
6618 | ~thisyear~, ~lastyear~, ~thisyear-N~ | a relative year |
6619 | ~untilnow~ | all clocked time ever |
6621 #+vindex: org-clock-display-default-range
6622 When this option is not set, Org falls back to the value in
6623 ~org-clock-display-default-range~, which defaults to the current
6626 Use {{{kbd(S-LEFT)}}} or {{{kbd(S-RIGHT)}}} to shift the time
6631 A time string specifying when to start considering times.
6632 Relative times like ="<-2w>"= can also be used. See [[*Matching
6633 tags and properties]] for relative time syntax.
6637 A time string specifying when to stop considering times.
6638 Relative times like ="<now>"= can also be used. See [[*Matching
6639 tags and properties]] for relative time syntax.
6643 The starting day of the week. The default is 1 for Monday.
6647 The starting day of the month. The default is 1 for the first.
6651 Set to ~week~ or ~day~ to split the table into chunks. To use
6652 this, ~:block~ or ~:tstart~, ~:tend~ are needed.
6656 Do not show steps that have zero time.
6660 Do not show table sections from files which did not contribute.
6664 A tags match to select entries that should contribute. See
6665 [[*Matching tags and properties]] for the match syntax.
6667 #+findex: org-clocktable-write-default
6668 Then there are options that determine the formatting of the table.
6669 There options are interpreted by the function
6670 ~org-clocktable-write-default~, but you can specify your own function
6671 using the =:formatter= parameter.
6675 When ~t~, emphasize level one and level two items.
6679 Language[fn:76] to use for descriptive cells like "Task".
6683 Link the item headlines in the table to their origins.
6687 An integer to limit the width of the headline column in the Org
6688 table. If you write it like =50!=, then the headline is also
6689 shortened in export.
6693 Indent each headline field according to its level.
6697 Number of columns to be used for times. If this is smaller than
6698 =:maxlevel=, lower levels are lumped into one column.
6702 Should a level number column be included?
6706 A cons cell containing the column to sort and a sorting type.
6707 E.g., =:sort (1 . ?a)= sorts the first column alphabetically.
6711 Abbreviation for =:level nil :indent t :narrow 40! :tcolumns 1=.
6712 All are overwritten except if there is an explicit =:narrow=.
6716 A timestamp for the entry, when available. Look for SCHEDULED,
6717 DEADLINE, TIMESTAMP and TIMESTAMP_IA special properties (see
6718 [[*Special Properties]]), in this order.
6722 List of properties shown in the table. Each property gets its
6727 When this flag is non-~nil~, the values for =:properties= are
6732 Content of a =TBLFM= keyword to be added and evaluated. As
6733 a special case, =:formula %= adds a column with % time. If you
6734 do not specify a formula here, any existing formula below the
6735 clock table survives updates and is evaluated.
6739 A function to format clock data and insert it into the buffer.
6741 To get a clock summary of the current level 1 tree, for the current
6742 day, you could write:
6745 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
6749 #+texinfo: @noindent
6750 To use a specific time range you could write[fn:77]
6753 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
6754 :tend "<2006-08-10 Thu 12:00>"
6758 A range starting a week ago and ending right now could be written as
6761 ,#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
6765 A summary of the current subtree with % times would be:
6768 ,#+BEGIN: clocktable :scope subtree :link t :formula %
6772 A horizontally compact representation of everything clocked during
6776 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
6780 *** Resolving idle time and continuous clocking
6782 :DESCRIPTION: Resolving time when you've been idle.
6783 :ALT_TITLE: Resolving idle time
6786 **** Resolving idle time
6791 #+cindex: resolve idle time
6792 #+cindex: idle, resolve, dangling
6794 If you clock in on a work item, and then walk away from your
6795 computer---perhaps to take a phone call---you often need to
6796 "resolve" the time you were away by either subtracting it from the
6797 current clock, or applying it to another one.
6799 #+vindex: org-clock-idle-time
6800 #+vindex: org-clock-x11idle-program-name
6801 By customizing the variable ~org-clock-idle-time~ to some integer,
6802 such as 10 or 15, Emacs can alert you when you get back to your
6803 computer after being idle for that many minutes[fn:78], and ask what
6804 you want to do with the idle time. There will be a question waiting
6805 for you when you get back, indicating how much idle time has passed
6806 constantly updated with the current amount, as well as a set of
6807 choices to correct the discrepancy:
6812 To keep some or all of the minutes and stay clocked in, press
6813 {{{kbd(k)}}}. Org asks how many of the minutes to keep. Press
6814 {{{kbd(RET)}}} to keep them all, effectively changing nothing, or
6815 enter a number to keep that many minutes.
6820 If you use the shift key and press {{{kbd(K)}}}, it keeps however
6821 many minutes you request and then immediately clock out of that
6822 task. If you keep all of the minutes, this is the same as just
6823 clocking out of the current task.
6828 To keep none of the minutes, use {{{kbd(s)}}} to subtract all the
6829 away time from the clock, and then check back in from the moment
6835 To keep none of the minutes and just clock out at the start of
6836 the away time, use the shift key and press {{{kbd(S)}}}.
6837 Remember that using shift always leave you clocked out, no matter
6838 which option you choose.
6843 To cancel the clock altogether, use {{{kbd(C)}}}. Note that if
6844 instead of canceling you subtract the away time, and the
6845 resulting clock amount is less than a minute, the clock is still
6846 canceled rather than cluttering up the log with an empty entry.
6848 What if you subtracted those away minutes from the current clock, and
6849 now want to apply them to a new clock? Simply clock in to any task
6850 immediately after the subtraction. Org will notice that you have
6851 subtracted time "on the books", so to speak, and will ask if you want
6852 to apply those minutes to the next task you clock in on.
6854 There is one other instance when this clock resolution magic occurs.
6855 Say you were clocked in and hacking away, and suddenly your cat chased
6856 a mouse who scared a hamster that crashed into your UPS's power
6857 button! You suddenly lose all your buffers, but thanks to auto-save
6858 you still have your recent Org mode changes, including your last clock
6861 If you restart Emacs and clock into any task, Org will notice that you
6862 have a dangling clock which was never clocked out from your last
6863 session. Using that clock's starting time as the beginning of the
6864 unaccounted-for period, Org will ask how you want to resolve that
6865 time. The logic and behavior is identical to dealing with away time
6866 due to idleness; it is just happening due to a recovery event rather
6867 than a set amount of idle time.
6869 You can also check all the files visited by your Org agenda for
6870 dangling clocks at any time using {{{kbd(M-x org-resolve-clocks
6871 RET)}}} (or {{{kbd(C-c C-x C-z)}}}).
6873 **** Continuous clocking
6877 #+cindex: continuous clocking
6879 #+vindex: org-clock-continuously
6880 You may want to start clocking from the time when you clocked out the
6881 previous task. To enable this systematically, set
6882 ~org-clock-continuously~ to non-~nil~. Each time you clock in, Org
6883 retrieves the clock-out time of the last clocked entry for this
6884 session, and start the new clock from there.
6886 If you only want this from time to time, use three universal prefix
6887 arguments with ~org-clock-in~ and two {{{kbd(C-u C-u)}}} with
6888 ~org-clock-in-last~.
6892 :DESCRIPTION: Planning work effort in advance.
6894 #+cindex: effort estimates
6895 #+cindex: @samp{EFFORT}, property
6896 #+vindex: org-effort-property
6898 If you want to plan your work in a very detailed way, or if you need
6899 to produce offers with quotations of the estimated work effort, you
6900 may want to assign effort estimates to entries. If you are also
6901 clocking your work, you may later want to compare the planned effort
6902 with the actual working time, a great way to improve planning
6903 estimates. Effort estimates are stored in a special property
6904 =EFFORT=. You can set the effort for an entry with the following
6907 - {{{kbd(C-c C-x e)}}} (~org-set-effort~) ::
6910 #+findex: org-set-effort
6911 Set the effort estimate for the current entry. With a prefix
6912 argument, set it to the next allowed value---see below. This
6913 command is also accessible from the agenda with the {{{kbd(e)}}}
6916 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
6918 #+kindex: C-c C-x C-e
6919 #+findex: org-clock-modify-effort-estimate
6920 Modify the effort estimate of the item currently being clocked.
6922 Clearly the best way to work with effort estimates is through column
6923 view (see [[*Column View]]). You should start by setting up discrete
6924 values for effort estimates, and a =COLUMNS= format that displays
6925 these values together with clock sums---if you want to clock your
6926 time. For a specific buffer you can use:
6929 ,#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
6930 ,#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM
6934 #+vindex: org-global-properties
6935 #+vindex: org-columns-default-format
6936 or, even better, you can set up these values globally by customizing
6937 the variables ~org-global-properties~ and
6938 ~org-columns-default-format~. In particular if you want to use this
6939 setup also in the agenda, a global setup may be advised.
6941 The way to assign estimates to individual items is then to switch to
6942 column mode, and to use {{{kbd(S-RIGHT)}}} and {{{kbd(S-LEFT)}}} to
6943 change the value. The values you enter are immediately summed up in
6944 the hierarchy. In the column next to it, any clocked time is
6947 #+vindex: org-agenda-columns-add-appointments-to-effort-sum
6948 If you switch to column view in the daily/weekly agenda, the effort
6949 column summarizes the estimated work effort for each day[fn:79], and
6950 you can use this to find space in your schedule. To get an overview
6951 of the entire part of the day that is committed, you can set the
6952 option ~org-agenda-columns-add-appointments-to-effort-sum~. The
6953 appointments on a day that take place over a specified time interval
6954 are then also added to the load estimate of the day.
6956 Effort estimates can be used in secondary agenda filtering that is
6957 triggered with the {{{kbd(/)}}} key in the agenda (see [[*Commands in
6958 the Agenda Buffer]]). If you have these estimates defined consistently,
6959 two or three key presses narrow down the list to stuff that fits into
6960 an available time slot.
6962 ** Taking Notes with a Relative Timer
6964 :DESCRIPTION: Notes with a running timer.
6967 #+cindex: relative timer
6968 #+cindex: countdown timer
6970 Org provides two types of timers. There is a relative timer that
6971 counts up, which can be useful when taking notes during, for example,
6972 a meeting or a video viewing. There is also a countdown timer.
6974 The relative and countdown are started with separate commands.
6976 - {{{kbd(C-c C-x 0)}}} (~org-timer-start~) ::
6979 #+findex: org-timer-start
6980 Start or reset the relative timer. By default, the timer is set
6981 to 0. When called with a {{{kbd(C-u)}}} prefix, prompt the user
6982 for a starting offset. If there is a timer string at point, this
6983 is taken as the default, providing a convenient way to restart
6984 taking notes after a break in the process. When called with
6985 a double prefix argument {{{kbd(C-u C-u)}}}, change all timer
6986 strings in the active region by a certain amount. This can be
6987 used to fix timer strings if the timer was not started at exactly
6990 - {{{kbd(C-c C-x ;)}}} (~org-timer-set-timer~) ::
6993 #+findex: org-timer-set-timer
6994 #+vindex: org-timer-default-timer
6995 Start a countdown timer. The user is prompted for a duration.
6996 ~org-timer-default-timer~ sets the default countdown value.
6997 Giving a numeric prefix argument overrides this default value.
6998 This command is available as {{{kbd(;)}}} in agenda buffers.
7000 Once started, relative and countdown timers are controlled with the
7003 - {{{kbd(C-c C-x .)}}} (~org-timer~) ::
7007 Insert a relative time into the buffer. The first time you use
7008 this, the timer starts. Using a prefix argument restarts it.
7010 - {{{kbd(C-c C-x -)}}} (~org-timer-item~) ::
7013 #+findex: org-timer-item
7014 Insert a description list item with the current relative time.
7015 With a prefix argument, first reset the timer to 0.
7017 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
7020 #+findex: org-insert-heading
7021 Once the timer list is started, you can also use
7022 {{{kbd(M-RET)}}} to insert new timer items.
7024 - {{{kbd(C-c C-x \,)}}} (~org-timer-pause-or-continue~) ::
7027 #+findex: org-timer-pause-or-continue
7028 Pause the timer, or continue it if it is already paused.
7030 - {{{kbd(C-c C-x _)}}} (~org-timer-stop~) ::
7033 #+findex: org-timer-stop
7034 Stop the timer. After this, you can only start a new timer, not
7035 continue the old one. This command also removes the timer from
7038 * Capture, Refile, Archive
7040 :DESCRIPTION: The ins and outs for projects.
7044 An important part of any organization system is the ability to quickly
7045 capture new ideas and tasks, and to associate reference material with
7046 them. Org does this using a process called /capture/. It also can
7047 store files related to a task (/attachments/) in a special directory.
7048 Once in the system, tasks and projects need to be moved around.
7049 Moving completed project trees to an archive file keeps the system
7054 :DESCRIPTION: Capturing new stuff.
7058 Capture lets you quickly store notes with little interruption of your
7059 work flow. Org's method for capturing new items is heavily inspired
7060 by John Wiegley's excellent Remember package.
7062 *** Setting up capture
7064 :DESCRIPTION: Where notes will be stored.
7067 The following customization sets a default target file for notes.
7069 #+vindex: org-default-notes-file
7070 #+begin_src emacs-lisp
7071 (setq org-default-notes-file (concat org-directory "/notes.org"))
7074 You may also define a global key for capturing new material (see
7079 :DESCRIPTION: Commands to invoke and terminate capture.
7082 - {{{kbd(M-x org-capture)}}} (~org-capture~) ::
7084 #+findex: org-capture
7086 Display the capture templates menu. If you have templates
7087 defined (see [[*Capture templates]]), it offers these templates for
7088 selection or use a new Org outline node as the default template.
7089 It inserts the template into the target file and switch to an
7090 indirect buffer narrowed to this new node. You may then insert
7091 the information you want.
7093 - {{{kbd(C-c C-c)}}} (~org-capture-finalize~) ::
7095 #+kindex: C-c C-c @r{(Capture buffer)}
7096 #+findex: org-capture-finalize
7097 Once you have finished entering information into the capture
7098 buffer, {{{kbd(C-c C-c)}}} returns you to the window
7099 configuration before the capture process, so that you can resume
7100 your work without further distraction. When called with a prefix
7101 argument, finalize and then jump to the captured item.
7103 - {{{kbd(C-c C-w)}}} (~org-capture-refile~) ::
7105 #+kindex: C-c C-w @r{(Capture buffer)}
7106 #+findex: org-capture-refile
7107 Finalize the capture process by refiling the note to a different
7108 place (see [[*Refile and Copy]]). Please realize that this is
7109 a normal refiling command that will be executed---so the cursor
7110 position at the moment you run this command is important. If you
7111 have inserted a tree with a parent and children, first move the
7112 cursor back to the parent. Any prefix argument given to this
7113 command is passed on to the ~org-refile~ command.
7115 - {{{kbd(C-c C-k)}}} (~org-capture-kill~) ::
7117 #+kindex: C-c C-k @r{(Capture buffer)}
7118 #+findex: org-capture-kill
7119 Abort the capture process and return to the previous state.
7121 #+kindex: k c @r{(Agenda)}
7122 You can also call ~org-capture~ in a special way from the agenda,
7123 using the {{{kbd(k c)}}} key combination. With this access, any
7124 timestamps inserted by the selected capture template defaults to the
7125 cursor date in the agenda, rather than to the current date.
7127 To find the locations of the last stored capture, use ~org-capture~
7128 with prefix commands:
7130 - {{{kbd(C-u M-x org-capture)}}} ::
7132 Visit the target location of a capture template. You get to
7133 select the template in the usual way.
7135 - {{{kbd(C-u C-u M-x org-capture)}}} ::
7137 Visit the last stored capture item in its buffer.
7139 #+vindex: org-capture-bookmark
7140 #+vindex: org-capture-last-stored
7141 You can also jump to the bookmark ~org-capture-last-stored~, which is
7142 automatically created unless you set ~org-capture-bookmark~ to ~nil~.
7144 To insert the capture at point in an Org buffer, call ~org-capture~
7145 with a ~C-0~ prefix argument.
7147 *** Capture templates
7149 :DESCRIPTION: Define the outline of different note types.
7151 #+cindex: templates, for Capture
7153 You can use templates for different types of capture items, and for
7154 different target locations. The easiest way to create such templates
7155 is through the customize interface.
7159 #+kindex: C @r{(Capture menu}
7160 #+vindex: org-capture-templates
7161 Customize the variable ~org-capture-templates~.
7163 Before we give the formal description of template definitions, let's
7164 look at an example. Say you would like to use one template to create
7165 general TODO entries, and you want to put these entries under the
7166 heading =Tasks= in your file =~/org/gtd.org=. Also, a date tree in
7167 the file =journal.org= should capture journal entries. A possible
7168 configuration would look like:
7170 #+begin_src emacs-lisp
7171 (setq org-capture-templates
7172 '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
7173 "* TODO %?\n %i\n %a")
7174 ("j" "Journal" entry (file+datetree "~/org/journal.org")
7175 "* %?\nEntered on %U\n %i\n %a")))
7178 #+texinfo: @noindent
7179 If you then press {{{kbd(t)}}} from the capture menu, Org will prepare
7180 the template for you like this:
7184 [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
7187 #+texinfo: @noindent
7188 During expansion of the template, ~%a~ has been replaced by a link to
7189 the location from where you called the capture command. This can be
7190 extremely useful for deriving tasks from emails, for example. You
7191 fill in the task definition, press {{{kbd(C-c C-c)}}} and Org returns
7192 you to the same place where you started the capture process.
7194 To define special keys to capture to a particular template without
7195 going through the interactive template selection, you can create your
7196 key binding like this:
7198 #+begin_src emacs-lisp
7199 (define-key global-map "\C-cx"
7200 (lambda () (interactive) (org-capture nil "x")))
7203 **** Template elements
7205 :DESCRIPTION: What is needed for a complete template entry.
7208 Now lets look at the elements of a template definition. Each entry in
7209 ~org-capture-templates~ is a list with the following items:
7213 The keys that selects the template, as a string, characters only,
7214 for example ="a"=, for a template to be selected with a single
7215 key, or ="bt"= for selection with two keys. When using several
7216 keys, keys using the same prefix key must be sequential in the
7217 list and preceded by a 2-element entry explaining the prefix key,
7220 #+begin_src emacs-lisp
7221 ("b" "Templates for marking stuff to buy")
7224 #+texinfo: @noindent
7225 If you do not define a template for the {{{kbd(C)}}} key, this
7226 key opens the Customize buffer for this complex variable.
7230 A short string describing the template, shown during selection.
7234 The type of entry, a symbol. Valid values are:
7238 An Org mode node, with a headline. Will be filed as the child
7239 of the target entry or as a top-level entry. The target file
7240 should be an Org file.
7244 A plain list item, placed in the first plain list at the
7245 target location. Again the target file should be an Org
7250 A checkbox item. This only differs from the plain list item
7251 by the default template.
7255 A new line in the first table at the target location. Where
7256 exactly the line will be inserted depends on the properties
7257 ~:prepend~ and ~:table-line-pos~ (see below).
7261 Text to be inserted as it is.
7265 #+vindex: org-default-notes-file
7266 #+vindex: org-directory
7267 Specification of where the captured item should be placed. In
7268 Org files, targets usually define a node. Entries will become
7269 children of this node. Other types will be added to the table or
7270 list in the body of this node. Most target specifications
7271 contain a file name. If that file name is the empty string, it
7272 defaults to ~org-default-notes-file~. A file can also be given
7273 as a variable or as a function called with no argument. When an
7274 absolute path is not specified for a target, it is taken as
7275 relative to ~org-directory~.
7279 - =(file "path/to/file")= ::
7281 Text will be placed at the beginning or end of that file.
7283 - =(id "id of existing org entry")= ::
7285 Filing as child of this entry, or in the body of the entry.
7287 - =(file+headline "filename" "node headline")= ::
7289 Fast configuration if the target heading is unique in the file.
7291 - =(file+olp "filename" "Level 1 heading" "Level 2" ...)= ::
7293 For non-unique headings, the full path is safer.
7295 - =(file+regexp "filename" "regexp to find location")= ::
7297 Use a regular expression to position the cursor.
7299 - =(file+olp+datetree "filename" [ "Level 1 heading" ...])= ::
7301 This target[fn:80] creates a heading in a date tree[fn:81] for
7302 today's date. If the optional outline path is given, the tree
7303 will be built under the node it is pointing to, instead of at
7304 top level. Check out the ~:time-prompt~ and ~:tree-type~
7305 properties below for additional options.
7307 - ~(file+function "filename" function-finding-location)~ ::
7309 A function to find the right location in the file.
7313 File to the entry that is currently being clocked.
7315 - ~(function function-finding-location)~ ::
7317 Most general way: write your own function which both visits the
7318 file and moves point to the right location.
7322 The template for creating the capture item. If you leave this
7323 empty, an appropriate default template will be used. Otherwise
7324 this is a string with escape codes, which will be replaced
7325 depending on time and context of the capture call. The string
7326 with escapes may be loaded from a template file, using the
7327 special syntax =(file "template filename")=. See below for more
7332 The rest of the entry is a property list of additional options.
7333 Recognized properties are:
7337 Normally new captured information will be appended at the
7338 target location (last child, last table line, last list item,
7339 ...). Setting this property changes that.
7341 - ~:immediate-finish~ ::
7343 When set, do not offer to edit the information, just file it
7344 away immediately. This makes sense if the template only needs
7345 information that can be added automatically.
7349 Set this to the number of lines to insert before and after the
7350 new item. Default 0, and the only other common value is 1.
7354 Start the clock in this item.
7358 Keep the clock running when filing the captured entry.
7360 - ~:clock-resume~ ::
7362 If starting the capture interrupted a clock, restart that clock
7363 when finished with the capture. Note that ~:clock-keep~ has
7364 precedence over ~:clock-resume~. When setting both to
7365 non-~nil~, the current clock will run and the previous one will
7370 Prompt for a date/time to be used for date/week trees and when
7371 filling the template. Without this property, capture uses the
7372 current date and time. Even if this property has not been set,
7373 you can force the same behavior by calling ~org-capture~ with
7374 a {{{kbd(C-1)}}} prefix argument.
7378 When ~week~, make a week tree instead of the month tree, i.e.,
7379 place the headings for each day under a heading with the
7384 Do not narrow the target buffer, simply show the full buffer. Default
7385 is to narrow it so that you only see the new material.
7387 - ~:table-line-pos~ ::
7389 Specification of the location in the table where the new line
7390 should be inserted. It should be a string like =II-3= meaning
7391 that the new line should become the third line before the
7392 second horizontal separator line.
7396 If the target file was not yet visited when capture was invoked, kill
7397 the buffer again after capture is completed.
7399 **** Template expansion
7401 :DESCRIPTION: Filling in information about time and context.
7404 In the template itself, special "%-escapes"[fn:82] allow dynamic
7405 insertion of content. The templates are expanded in the order given
7410 Insert the contents of the file given by {{{var(FILE)}}}.
7414 Evaluate Elisp SEXP and replace with the result. The
7415 {{{var(SEXP)}}} must return a string.
7419 The result of format-time-string on the {{{var(FORMAT)}}}
7424 Timestamp, date only.
7428 Timestamp, with date and time.
7432 Like ~%t~, ~%T~ above, but inactive timestamps.
7436 Initial content, the region when capture is called while the
7437 region is active. The entire text will be indented like ~%i~
7442 Annotation, normally the link created with ~org-store-link~.
7446 Like ~%a~, but prompt for the description part.
7450 Like ~%a~, but only insert the literal link.
7454 Current kill ring head.
7458 Content of the X clipboard.
7462 Title of the currently clocked task.
7466 Link to the currently clocked task.
7470 User name (taken from ~user-full-name~).
7474 File visited by current buffer when org-capture was called.
7478 Full path of the file or directory visited by current buffer.
7482 Specific information for certain link types, see below.
7486 Prompt for tags, with completion on tags in target file.
7490 Prompt for tags, with completion all tags in all agenda files.
7494 Like ~%t~, but prompt for date. Similarly ~%^T~, ~%^u~, ~%^U~. You may
7495 define a prompt like ~%^{Birthday}t~.
7499 Interactive selection of which kill or clip to use.
7503 Like ~%^C~, but insert as link.
7507 Prompt the user for a value for property PROP.
7511 Prompt the user for a string and replace this sequence with it.
7512 You may specify a default value and a completion table with
7513 ~%^{prompt|default|completion2|completion3...}~. The arrow keys
7514 access a prompt-specific history.
7518 Insert the text entered at the Nth ~%^{PROMPT}~, where N is
7519 a number, starting from 1.
7523 After completing the template, position cursor here.
7525 #+texinfo: @noindent
7526 #+vindex: org-store-link-props
7527 For specific link types, the following keywords are defined[fn:83]:
7529 #+vindex: org-from-is-user-regexp
7530 | Link type | Available keywords |
7531 |--------------+----------------------------------------------------------|
7532 | bbdb | ~%:name~, ~%:company~ |
7533 | irc | ~%:server~, ~%:port~, ~%:nick~ |
7534 | mh, rmail | ~%:type~, ~%:subject~, ~%:message-id~ |
7535 | | ~%:from~, ~%:fromname~, ~%:fromaddress~ |
7536 | | ~%:to~, ~%:toname~, ~%:toaddress~ |
7537 | | ~%:date~ (message date header field) |
7538 | | ~%:date-timestamp~ (date as active timestamp) |
7539 | | ~%:date-timestamp-inactive~ (date as inactive timestamp) |
7540 | | ~%:fromto~ (either "to NAME" or "from NAME")[fn:84] |
7541 | gnus | ~%:group~, for messages also all email fields |
7542 | w3, w3m | ~%:url~ |
7543 | info | ~%:file~, ~%:node~ |
7544 | calendar | ~%:date~ |
7545 | org-protocol | ~%:link~, ~%:description~, ~%:annotation~ |
7547 **** Templates in contexts
7549 :DESCRIPTION: Only show a template in a specific context.
7552 #+vindex: org-capture-templates-contexts
7553 To control whether a capture template should be accessible from
7554 a specific context, you can customize
7555 ~org-capture-templates-contexts~. Let's say, for example, that you
7556 have a capture template "p" for storing Gnus emails containing
7557 patches. Then you would configure this option like this:
7559 #+begin_src emacs-lisp
7560 (setq org-capture-templates-contexts
7561 '(("p" (in-mode . "message-mode"))))
7564 You can also tell that the command key {{{kbd(p)}}} should refer to
7565 another template. In that case, add this command key like this:
7567 #+begin_src emacs-lisp
7568 (setq org-capture-templates-contexts
7569 '(("p" "q" (in-mode . "message-mode"))))
7572 See the docstring of the variable for more information.
7576 :DESCRIPTION: Add files to tasks.
7578 #+cindex: attachments
7579 #+vindex: org-attach-directory
7581 It is often useful to associate reference material with an outline
7582 node/task. Small chunks of plain text can simply be stored in the
7583 subtree of a project. Hyperlinks (see [[*Hyperlinks]]) can establish
7584 associations with files that live elsewhere on your computer or in the
7585 cloud, like emails or source code files belonging to a project.
7586 Another method is /attachments/, which are files located in
7587 a directory belonging to an outline node. Org uses directories named
7588 by the unique ID of each entry. These directories are located in the
7589 ~data~ directory which lives in the same directory where your Org file
7590 lives[fn:85]. If you initialize this directory with =git init=, Org
7591 automatically commits changes when it sees them. The attachment
7592 system has been contributed to Org by John Wiegley.
7594 In cases where it seems better to do so, you can attach a directory of
7595 your choice to an entry. You can also make children inherit the
7596 attachment directory from a parent, so that an entire subtree uses the
7597 same attached directory.
7599 #+texinfo: @noindent
7600 The following commands deal with attachments:
7602 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
7605 #+findex: org-attach
7606 The dispatcher for commands related to the attachment system.
7607 After these keys, a list of commands is displayed and you must
7608 press an additional key to select a command:
7610 - {{{kbd(a)}}} (~org-attach-attach~) ::
7613 #+findex: org-attach-attach
7614 #+vindex: org-attach-method
7615 Select a file and move it into the task's attachment
7616 directory. The file is copied, moved, or linked, depending
7617 on ~org-attach-method~. Note that hard links are not
7618 supported on all systems.
7620 - {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} ::
7625 Attach a file using the copy/move/link method. Note that
7626 hard links are not supported on all systems.
7628 - {{{kbd(n)}}} (~org-attach-new~) ::
7631 #+findex: org-attach-new
7632 Create a new attachment as an Emacs buffer.
7634 - {{{kbd(z)}}} (~org-attach-sync~) ::
7637 #+findex: org-attach-sync
7638 Synchronize the current task with its attachment directory, in case
7639 you added attachments yourself.
7641 - {{{kbd(o)}}} (~org-attach-open~) ::
7644 #+findex: org-attach-open
7645 #+vindex: org-file-apps
7646 Open current task's attachment. If there is more than one,
7647 prompt for a file name first. Opening follows the rules set
7648 by ~org-file-apps~. For more details, see the information
7649 on following hyperlinks (see [[*Handling Links]]).
7651 - {{{kbd(O)}}} (~org-attach-open-in-emacs~) ::
7654 #+findex: org-attach-open-in-emacs
7655 Also open the attachment, but force opening the file in
7658 - {{{kbd(f)}}} (~org-attach-reveal~) ::
7661 #+findex: org-attach-reveal
7662 Open the current task's attachment directory.
7664 - {{{kbd(F)}}} (~org-attach-reveal-in-emacs~) ::
7667 #+findex: org-attach-reveal-in-emacs
7668 Also open the directory, but force using Dired in Emacs.
7670 - {{{kbd(d)}}} (~org-attach-delete-one~) ::
7673 Select and delete a single attachment.
7675 - {{{kbd(D)}}} (~org-attach-delete-all~) ::
7678 Delete all of a task's attachments. A safer way is to open
7679 the directory in Dired and delete from there.
7681 - {{{kbd(s)}}} (~org-attach-set-directory~) ::
7684 #+cindex: @samp{ATTACH_DIR}, property
7685 Set a specific directory as the entry's attachment
7686 directory. This works by putting the directory path into
7687 the =ATTACH_DIR= property.
7689 - {{{kbd(i)}}} (~org-attach-set-inherit~) ::
7692 #+cindex: @samp{ATTACH_DIR_INHERIT}, property
7693 Set the =ATTACH_DIR_INHERIT= property, so that children use
7694 the same directory for attachments as the parent does.
7696 #+cindex: attach from Dired
7697 #+findex: org-attach-dired-to-subtree
7698 It is possible to attach files to a subtree from a Dired buffer. To
7699 use this feature, have one window in Dired mode containing the file(s)
7700 to be attached and another window with point in the subtree that shall
7701 get the attachments. In the Dired window, with point on a file,
7702 {{{kbd(M-x org-attach-dired-to-subtree)}}} attaches the file to the
7703 subtree using the attachment method set by variable
7704 ~org-attach-method~. When files are marked in the Dired window then
7705 all marked files get attached.
7707 Add the following lines to the Emacs init file to have {{{kbd(C-c C-x
7708 a)}}} attach files in Dired buffers.
7710 #+begin_src emacs-lisp
7711 (add-hook 'dired-mode-hook
7713 (define-key dired-mode-map
7715 #'org-attach-dired-to-subtree))))
7718 The following code shows how to bind the previous command with
7719 a specific attachment method.
7721 #+begin_src emacs-lisp
7722 (add-hook 'dired-mode-hook
7724 (define-key dired-mode-map (kbd "C-c C-x c")
7727 (let ((org-attach-method 'cp))
7728 (call-interactively #'org-attach-dired-to-subtree))))))
7733 :DESCRIPTION: Getting input from RSS feeds.
7736 #+cindex: Atom feeds
7738 Org can add and change entries based on information found in RSS feeds
7739 and Atom feeds. You could use this to make a task out of each new
7740 podcast in a podcast feed. Or you could use a phone-based
7741 note-creating service on the web to import tasks into Org. To access
7742 feeds, configure the variable ~org-feed-alist~. The docstring of this
7743 variable has detailed information. With the following
7745 #+begin_src emacs-lisp
7746 (setq org-feed-alist
7748 "http://rss.slashdot.org/Slashdot/slashdot"
7749 "~/txt/org/feeds.org" "Slashdot Entries")))
7752 #+texinfo: @noindent
7753 new items from the feed provided by =rss.slashdot.org= result in new
7754 entries in the file =~/org/feeds.org= under the heading =Slashdot
7755 Entries=, whenever the following command is used:
7757 - {{{kbd(C-c C-x g)}}} (~org-feed-update-all~) ::
7760 Collect items from the feeds configured in ~org-feed-alist~ and
7763 - {{{kbd(C-c C-x G)}}} (~org-feed-goto-inbox~) ::
7766 Prompt for a feed name and go to the inbox configured for this feed.
7768 Under the same headline, Org creates a drawer =FEEDSTATUS= in which it
7769 stores information about the status of items in the feed, to avoid
7770 adding the same item several times.
7772 For more information, including how to read atom feeds, see
7773 =org-feed.el= and the docstring of ~org-feed-alist~.
7775 ** Protocols for External Access
7777 :DESCRIPTION: External access to Emacs and Org.
7778 :ALT_TITLE: Protocols
7780 #+cindex: protocols, for external access
7782 Org protocol is a means to trigger custom actions in Emacs from
7783 external applications. Any application that supports calling external
7784 programs with an URL as argument may be used with this functionality.
7785 For example, you can configure bookmarks in your web browser to send
7786 a link to the current page to Org and create a note from it using
7787 capture (see [[*Capture]]). You can also create a bookmark that tells
7788 Emacs to open the local source file of a remote website you are
7791 #+cindex: Org protocol, set-up
7792 #+cindex: Installing Org protocol
7793 In order to use Org protocol from an application, you need to register
7794 =org-protocol://= as a valid scheme-handler. External calls are
7795 passed to Emacs through the =emacsclient= command, so you also need to
7796 ensure an Emacs server is running. More precisely, when the
7799 : emacsclient org-protocol://PROTOCOL?key1=val1&key2=val2
7801 #+texinfo: @noindent
7802 Emacs calls the handler associated to {{{var(PROTOCOL)}}} with
7803 argument =(:key1 val1 :key2 val2)=.
7805 #+cindex: protocol, new protocol
7806 #+cindex: defining new protocols
7807 Org protocol comes with three predefined protocols, detailed in the
7808 following sections. Configure ~org-protocol-protocol-alist~ to define
7811 *** ~store-link~ protocol
7813 :DESCRIPTION: Store a link, push URL to kill-ring.
7815 #+cindex: store-link protocol
7816 #+cindex: protocol, store-link
7818 Using ~store-link~ handler, you can copy links, insertable through
7819 {{{kbd(M-x org-insert-link)}}} or yanking thereafter. More precisely,
7822 : emacsclient org-protocol://store-link?url=URL&title=TITLE
7824 #+texinfo: @noindent
7825 stores the following link:
7829 In addition, {{{var(URL)}}} is pushed on the kill-ring for yanking.
7830 You need to encode {{{var(URL)}}} and {{{var(TITLE)}}} if they contain
7831 slashes, and probably quote those for the shell.
7833 To use this feature from a browser, add a bookmark with an arbitrary
7834 name, e.g., =Org: store-link= and enter this as /Location/:
7837 javascript:location.href='org-protocol://store-link?url='+
7838 encodeURIComponent(location.href);
7841 *** ~capture~ protocol
7843 :DESCRIPTION: Fill a buffer with external information.
7845 #+cindex: capture protocol
7846 #+cindex: protocol, capture
7848 Activating "capture" handler pops up a =Capture= buffer and fills the
7849 capture template associated to the =X= key with them.
7851 : emacsclient org-protocol://capture?template=X?url=URL?title=TITLE?body=BODY
7853 To use this feature, add a bookmark with an arbitrary name, e.g.
7854 =Org: capture= and enter this as =Location=:
7857 javascript:location.href='org-protocol://template=x'+
7858 '&url='+encodeURIComponent(window.location.href)+
7859 '&title='+encodeURIComponent(document.title)+
7860 '&body='+encodeURIComponent(window.getSelection());
7863 #+vindex: org-protocol-default-template-key
7864 The result depends on the capture template used, which is set in the
7865 bookmark itself, as in the example above, or in
7866 ~org-protocol-default-template-key~.
7868 The following template placeholders are available:
7872 %:description The webpage title
7873 %:annotation Equivalent to [[%:link][%:description]]
7874 %i The selected text
7877 *** ~open-source~ protocol
7879 :DESCRIPTION: Edit published contents.
7881 #+cindex: open-source protocol
7882 #+cindex: protocol, open-source
7884 The ~open-source~ handler is designed to help with editing local
7885 sources when reading a document. To that effect, you can use
7886 a bookmark with the following location:
7889 javascript:location.href='org-protocol://open-source?&url='+
7890 encodeURIComponent(location.href)
7893 #+vindex: org-protocol-project-alist
7894 The variable ~org-protocol-project-alist~ maps URLs to local file
7895 names, by stripping URL parameters from the end and replacing the
7896 ~:base-url~ with ~:working-directory~ and ~:online-suffix~ with
7897 ~:working-suffix~. For example, assuming you own a local copy of
7898 =https://orgmode.org/worg/= contents at =/home/user/worg=, you can set
7899 ~org-protocol-project-alist~ to the following
7901 #+begin_src emacs-lisp
7902 (setq org-protocol-project-alist
7904 :base-url "https://orgmode.org/worg/"
7905 :working-directory "/home/user/worg/"
7906 :online-suffix ".html"
7907 :working-suffix ".org")))
7910 #+texinfo: @noindent
7911 If you are now browsing
7912 =https://orgmode.org/worg/org-contrib/org-protocol.html= and find
7913 a typo or have an idea about how to enhance the documentation, simply
7914 click the bookmark and start editing.
7916 #+cindex: rewritten URL in open-source protocol
7917 #+cindex: protocol, open-source rewritten URL
7918 However, such mapping may not yield the desired results. Suppose you
7919 maintain an online store located at =http://example.com/=. The local
7920 sources reside in =/home/user/example/=. It is common practice to
7921 serve all products in such a store through one file and rewrite URLs
7922 that do not match an existing file on the server. That way, a request
7923 to =http://example.com/print/posters.html= might be rewritten on the
7924 server to something like
7925 =http://example.com/shop/products.php/posters.html.php=. The
7926 ~open-source~ handler probably cannot find a file named
7927 =/home/user/example/print/posters.html.php= and fails.
7929 Such an entry in ~org-protocol-project-alist~ may hold an additional
7930 property ~:rewrites~. This property is a list of cons cells, each of
7931 which maps a regular expression to a path relative to the
7932 ~:working-directory~.
7934 Now map the URL to the path =/home/user/example/products.php= by
7935 adding ~:rewrites~ rules like this:
7937 #+begin_src emacs-lisp
7938 (setq org-protocol-project-alist
7940 :base-url "http://example.com/"
7941 :working-directory "/home/user/example/"
7942 :online-suffix ".php"
7943 :working-suffix ".php"
7944 :rewrites (("example.com/print/" . "products.php")
7945 ("example.com/$" . "index.php")))))
7948 #+texinfo: @noindent
7949 Since =example.com/$= is used as a regular expression, it maps
7950 =http://example.com/=, =https://example.com=,
7951 =http://www.example.com/= and similar to
7952 =/home/user/example/index.php=.
7954 The ~:rewrites~ rules are searched as a last resort if and only if no
7955 existing file name is matched.
7957 #+cindex: protocol, open-source, set-up mapping
7958 #+cindex: mappings in open-source protocol
7959 #+findex: org-protocol-create
7960 #+findex: org-protocol-create-for-org
7961 Two functions can help you filling ~org-protocol-project-alist~ with
7962 valid contents: ~org-protocol-create~ and
7963 ~org-protocol-create-for-org~. The latter is of use if you're editing
7964 an Org file that is part of a publishing project.
7968 :DESCRIPTION: Moving/copying a tree from one place to another.
7970 #+cindex: refiling notes
7971 #+cindex: copying notes
7973 When reviewing the captured data, you may want to refile or to copy
7974 some of the entries into a different list, for example into a project.
7975 Cutting, finding the right location, and then pasting the note is
7976 cumbersome. To simplify this process, you can use the following
7979 - {{{kbd(C-c M-w)}}} (~org-copy~) ::
7983 Copying works like refiling, except that the original note is not
7986 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
7989 #+findex: org-refile
7990 #+vindex: org-reverse-note-order
7991 #+vindex: org-refile-targets
7992 #+vindex: org-refile-use-outline-path
7993 #+vindex: org-outline-path-complete-in-steps
7994 #+vindex: org-refile-allow-creating-parent-nodes
7995 #+vindex: org-log-refile
7996 Refile the entry or region at point. This command offers
7997 possible locations for refiling the entry and lets you select one
7998 with completion. The item (or all items in the region) is filed
7999 below the target heading as a subitem. Depending on
8000 ~org-reverse-note-order~, it is either the first or last subitem.
8002 By default, all level 1 headlines in the current buffer are
8003 considered to be targets, but you can have more complex
8004 definitions across a number of files. See the variable
8005 ~org-refile-targets~ for details. If you would like to select
8006 a location via a file-path-like completion along the outline
8007 path, see the variables ~org-refile-use-outline-path~ and
8008 ~org-outline-path-complete-in-steps~. If you would like to be
8009 able to create new nodes as new parents for refiling on the fly,
8010 check the variable ~org-refile-allow-creating-parent-nodes~.
8011 When the variable ~org-log-refile~[fn:86] is set, a timestamp or
8012 a note is recorded whenever an entry is refiled.
8014 - {{{kbd(C-u C-c C-w)}}} ::
8016 #+kindex: C-u C-c C-w
8017 Use the refile interface to jump to a heading.
8019 - {{{kbd(C-u C-u C-c C-w)}}} (~org-refile-goto-last-stored~) ::
8021 #+kindex: C-u C-u C-c C-w
8022 #+findex: org-refile-goto-last-stored
8023 Jump to the location where ~org-refile~ last moved a tree to.
8025 - {{{kbd(C-2 C-c C-w)}}} ::
8027 #+kindex: C-2 C-c C-w
8028 Refile as the child of the item currently being clocked.
8030 - {{{kbd(C-3 C-c C-w)}}} ::
8032 #+kindex: C-3 C-c C-w
8033 #+vindex: org-refile-keep
8034 Refile and keep the entry in place. Also see ~org-refile-keep~
8035 to make this the default behavior, and beware that this may
8036 result in duplicated ~ID~ properties.
8038 - {{{kbd(C-0 C-c C-w)}}} or {{{kbd(C-u C-u C-u C-c C-w)}}} (~org-refile-cache-clear~) ::
8040 #+kindex: C-u C-u C-u C-c C-w
8041 #+kindex: C-0 C-c C-w
8042 #+findex: org-refile-cache-clear
8043 #+vindex: org-refile-use-cache
8044 Clear the target cache. Caching of refile targets can be turned
8045 on by setting ~org-refile-use-cache~. To make the command see
8046 new possible targets, you have to clear the cache with this
8051 :DESCRIPTION: What to do with finished products.
8055 When a project represented by a (sub)tree is finished, you may want to
8056 move the tree out of the way and to stop it from contributing to the
8057 agenda. Archiving is important to keep your working files compact and
8058 global searches like the construction of agenda views fast.
8060 - {{{kbd(C-c C-x C-a)}}} (~org-archive-subtree-default~) ::
8062 #+kindex: C-c C-x C-a
8063 #+findex: org-archive-subtree-default
8064 #+vindex: org-archive-default-command
8065 Archive the current entry using the command specified in the
8066 variable ~org-archive-default-command~.
8068 *** Moving a tree to an archive file
8070 :DESCRIPTION: Moving a tree to an archive file.
8071 :ALT_TITLE: Moving subtrees
8073 #+cindex: external archiving
8075 The most common archiving action is to move a project tree to another
8076 file, the archive file.
8078 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd(C-c $)}}} (~org-archive-subtree~) ::
8080 #+kindex: C-c C-x C-s
8082 #+findex: org-archive-subtree
8083 #+vindex: org-archive-location
8084 Archive the subtree starting at the cursor position to the
8085 location given by ~org-archive-location~.
8087 - {{{kbd(C-u C-c C-x C-s)}}} ::
8089 #+kindex: C-u C-c C-x C-s
8090 Check if any direct children of the current headline could be
8091 moved to the archive. To do this, check each subtree for open
8092 TODO entries. If none is found, the command offers to move it to
8093 the archive location. If the cursor is /not/ on a headline when
8094 this command is invoked, check level 1 trees.
8096 - {{{kbd(C-u C-u C-c C-x C-s)}}} ::
8098 #+kindex: C-u C-u C-c C-x C-s
8099 As above, but check subtree for timestamps instead of TODO
8100 entries. The command offers to archive the subtree if it /does/
8101 contain a timestamp, and that timestamp is in the past.
8103 #+cindex: archive locations
8104 The default archive location is a file in the same directory as the
8105 current file, with the name derived by appending =_archive= to the
8106 current file name. You can also choose what heading to file archived
8107 items under, with the possibility to add them to a datetree in a file.
8108 For information and examples on how to specify the file and the
8109 heading, see the documentation string of the variable
8110 ~org-archive-location~.
8112 There is also an in-buffer option for setting this variable, for
8115 #+cindex: @samp{ARCHIVE}, keyword
8116 : #+ARCHIVE: %s_done::
8118 #+texinfo: @noindent
8119 #+cindex: ARCHIVE, property
8120 If you would like to have a special archive location for a single
8121 entry or a (sub)tree, give the entry an =ARCHIVE= property with the
8122 location as the value (see [[*Properties and Columns]]).
8124 #+vindex: org-archive-save-context-info
8125 When a subtree is moved, it receives a number of special properties
8126 that record context information like the file from where the entry
8127 came, its outline path the archiving time etc. Configure the variable
8128 ~org-archive-save-context-info~ to adjust the amount of information
8131 *** Internal archiving
8133 :DESCRIPTION: Switch off a tree but keep it in the file.
8136 #+cindex: @samp{ARCHIVE}, tag
8137 If you want to just switch off---for agenda views---certain subtrees
8138 without moving them to a different file, you can use the =ARCHIVE=
8141 A headline that is marked with the =ARCHIVE= tag (see [[*Tags]]) stays at
8142 its location in the outline tree, but behaves in the following way:
8145 #+vindex: org-cycle-open-archived-trees
8146 It does not open when you attempt to do so with a visibility cycling
8147 command (see [[*Visibility Cycling]]). You can force cycling archived
8148 subtrees with {{{kbd(C-TAB)}}}, or by setting the option
8149 ~org-cycle-open-archived-trees~. Also normal outline commands, like
8150 ~outline-show-all~, open archived subtrees.
8153 #+vindex: org-sparse-tree-open-archived-trees
8154 During sparse tree construction (see [[*Sparse Trees]]), matches in
8155 archived subtrees are not exposed, unless you configure the option
8156 ~org-sparse-tree-open-archived-trees~.
8159 #+vindex: org-agenda-skip-archived-trees
8160 During agenda view construction (see [[*Agenda Views]]), the content of
8161 archived trees is ignored unless you configure the option
8162 ~org-agenda-skip-archived-trees~, in which case these trees are
8163 always included. In the agenda you can press {{{kbd(v a)}}} to get
8164 archives temporarily included.
8167 #+vindex: org-export-with-archived-trees
8168 Archived trees are not exported (see [[*Exporting]]), only the headline
8169 is. Configure the details using the variable
8170 ~org-export-with-archived-trees~.
8173 #+vindex: org-columns-skip-archived-trees
8174 Archived trees are excluded from column view unless the variable
8175 ~org-columns-skip-archived-trees~ is configured to ~nil~.
8177 The following commands help manage the =ARCHIVE= tag:
8179 - {{{kbd(C-c C-x a)}}} (~org-toggle-archive-tag~) ::
8182 #+findex: org-toggle-archive-tag
8183 Toggle the archive tag for the current headline. When the tag is
8184 set, the headline changes to a shadowed face, and the subtree
8187 - {{{kbd(C-u C-c C-x a)}}} ::
8189 #+kindex: C-u C-c C-x a
8190 Check if any direct children of the current headline should be
8191 archived. To do this, check each subtree for open TODO entries.
8192 If none is found, the command offers to set the =ARCHIVE= tag for
8193 the child. If the cursor is /not/ on a headline when this
8194 command is invoked, check the level 1 trees.
8196 - {{{kbd(C-TAB)}}}, ~org-force-cycle-archived~ ::
8199 Cycle a tree even if it is tagged with =ARCHIVE=.
8201 - {{{kbd(C-c C-x A)}}} (~org-archive-to-archive-sibling~) ::
8204 #+findex: org-archive-to-archive-sibling
8205 Move the current entry to the /Archive Sibling/. This is
8206 a sibling of the entry with the heading =Archive= and the archive
8207 tag. The entry becomes a child of that sibling and in this way
8208 retains a lot of its original context, including inherited tags
8209 and approximate position in the outline.
8213 :DESCRIPTION: Collecting information into views.
8215 #+cindex: agenda views
8217 Due to the way Org works, TODO items, time-stamped items, and tagged
8218 headlines can be scattered throughout a file or even a number of
8219 files. To get an overview of open action items, or of events that are
8220 important for a particular date, this information must be collected,
8221 sorted and displayed in an organized way.
8223 Org can select items based on various criteria and display them in
8224 a separate buffer. Seven different view types are provided:
8226 - an /agenda/ that is like a calendar and shows information for
8229 - a /TODO list/ that covers all unfinished action items,
8231 - a /match view/, showings headlines based on the tags, properties,
8232 and TODO state associated with them,
8234 - a /timeline view/ that shows all events in a single Org file, in
8237 - a /text search view/ that shows all entries from multiple files that
8238 contain specified keywords,
8240 - a /stuck projects view/ showing projects that currently do not move
8243 - /custom views/ that are special searches and combinations of
8246 #+texinfo: @noindent
8247 The extracted information is displayed in a special /agenda buffer/.
8248 This buffer is read-only, but provides commands to visit the
8249 corresponding locations in the original Org files, and even to edit
8250 these files remotely.
8252 #+vindex: org-agenda-skip-comment-trees
8253 #+vindex: org-agenda-skip-archived-trees
8254 #+cindex: commented entries, in agenda views
8255 #+cindex: archived entries, in agenda views
8256 By default, the report ignores commented (see [[*Comment Lines]]) and
8257 archived (see [[*Internal archiving]]) entries. You can override this by
8258 setting ~org-agenda-skip-comment-trees~ and
8259 ~org-agenda-skip-archived-trees~ to ~nil~.
8261 #+vindex: org-agenda-window-setup
8262 #+vindex: org-agenda-restore-windows-after-quit
8263 Two variables control how the agenda buffer is displayed and whether
8264 the window configuration is restored when the agenda exits:
8265 ~org-agenda-window-setup~ and ~org-agenda-restore-windows-after-quit~.
8269 :DESCRIPTION: Files being searched for agenda information.
8271 #+cindex: agenda files
8272 #+cindex: files for agenda
8274 #+vindex: org-agenda-files
8275 The information to be shown is normally collected from all /agenda
8276 files/, the files listed in the variable ~org-agenda-files~[fn:87].
8277 If a directory is part of this list, all files with the extension
8278 =.org= in this directory are part of the list.
8280 Thus, even if you only work with a single Org file, that file should
8281 be put into the list[fn:88]. You can customize ~org-agenda-files~,
8282 but the easiest way to maintain it is through the following commands
8284 #+attr_texinfo: :sep and
8285 - {{{kbd(C-c [)}}} (~org-agenda-file-to-front~) ::
8288 #+findex: org-agenda-file-to-front
8289 #+cindex: files, adding to agenda list
8290 Add current file to the list of agenda files. The file is added
8291 to the front of the list. If it was already in the list, it is
8292 moved to the front. With a prefix argument, file is added/moved
8295 - {{{kbd(C-c ])}}} (~org-remove-file~) ::
8298 #+findex: org-remove-file
8299 Remove current file from the list of agenda files.
8301 - {{{kbd(C-')}}} and {{{kbd(C-\,)}}} (~org-cycle-agenda-files~) ::
8305 #+findex: org-cycle-agenda-files
8306 #+cindex: cycling, of agenda files
8307 Cycle through agenda file list, visiting one file after the other.
8309 - {{{kbd(M-x org-switchb)}}} ::
8311 #+findex: org-switchb
8312 Command to use an iswitchb-like interface to switch to and
8313 between Org buffers.
8315 #+texinfo: @noindent
8316 The Org menu contains the current list of files and can be used to
8319 If you would like to focus the agenda temporarily on a file not in
8320 this list, or on just one file in the list, or even on only a subtree
8321 in a file, then this can be done in different ways. For a single
8322 agenda command, you may press {{{kbd(<)}}} once or several times in
8323 the dispatcher (see [[*The Agenda Dispatcher]]). To restrict the agenda
8324 scope for an extended period, use the following commands:
8326 - {{{kbd(C-c C-x <)}}} (~org-agenda-set-restriction-lock~) ::
8329 #+findex: org-agenda-set-restriction-lock
8330 Permanently restrict the agenda to the current subtree. When
8331 called with a prefix argument, or with the cursor before the
8332 first headline in a file, set the agenda scope to the entire
8333 file. This restriction remains in effect until removed with
8334 {{{kbd(C-c C-x >)}}}, or by typing either {{{kbd(<)}}} or
8335 {{{kbd(>)}}} in the agenda dispatcher. If there is a window
8336 displaying an agenda view, the new restriction takes effect
8339 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
8342 #+findex: org-agenda-remove-restriction-lock
8343 Remove the permanent restriction created by {{{kbd(C-c C-x <)}}}.
8345 #+texinfo: @noindent
8346 When working with =speedbar.el=, you can use the following commands in
8349 - {{{kbd(<)}}} (~org-speedbar-set-agenda-restriction~) ::
8351 #+findex: org-speedbar-set-agenda-restriction
8352 Permanently restrict the agenda to the item---either an Org file
8353 or a subtree in such a file---at the cursor in the Speedbar
8354 frame. If there is a window displaying an agenda view, the new
8355 restriction takes effect immediately.
8357 - {{{kbd(>)}}} (~org-agenda-remove-restriction-lock~) ::
8359 #+findex: org-agenda-remove-restriction-lock
8360 Lift the restriction.
8362 ** The Agenda Dispatcher
8364 :DESCRIPTION: Keyboard access to agenda views.
8365 :ALT_TITLE: Agenda Dispatcher
8367 #+cindex: agenda dispatcher
8368 #+cindex: dispatching agenda commands
8370 The views are created through a dispatcher, accessible with {{{kbd(M-x
8371 org-agenda)}}}, or, better, bound to a global key (see [[*Activation]]).
8372 It displays a menu from which an additional letter is required to
8373 execute a command. The dispatcher offers the following default
8378 Create the calendar-like agenda (see [[*Weekly/daily agenda]]).
8380 - {{{kbd(t)}}} or {{{kbd(T)}}} ::
8382 Create a list of all TODO items (see [[*The global TODO list]]).
8384 - {{{kbd(m)}}} or {{{kbd(M)}}} ::
8386 Create a list of headlines matching a given expression (see
8387 [[*Matching tags and properties]]).
8391 #+kindex: s @r{(Agenda dispatcher)}
8392 Create a list of entries selected by a boolean expression of
8393 keywords and/or regular expressions that must or must not occur
8398 #+kindex: / @r{(Agenda dispatcher)}
8399 #+vindex: org-agenda-text-search-extra-files
8400 Search for a regular expression in all agenda files and
8401 additionally in the files listed in
8402 ~org-agenda-text-search-extra-files~. This uses the Emacs
8403 command ~multi-occur~. A prefix argument can be used to specify
8404 the number of context lines for each match, default is
8407 - {{{kbd(#)}}} or {{{kbd(!)}}} ::
8409 Create a list of stuck projects (see [[*Stuck projects]]).
8413 #+kindex: < @r{(Agenda dispatcher)}
8414 Restrict an agenda command to the current buffer[fn:89]. After
8415 pressing {{{kbd(<)}}}, you still need to press the character
8416 selecting the command.
8420 #+kindex: < < @r{(Agenda dispatcher)}
8421 If there is an active region, restrict the following agenda
8422 command to the region. Otherwise, restrict it to the current
8423 subtree[fn:90]. After pressing {{{kbd(< <)}}}, you still need to
8424 press the character selecting the command.
8428 #+kindex: * @r{(Agenda dispatcher)}
8429 #+vindex: org-agenda-sticky
8430 #+findex: org-toggle-sticky-agenda
8431 Toggle sticky agenda views. By default, Org maintains only
8432 a single agenda buffer and rebuilds it each time you change the
8433 view, to make sure everything is always up to date. If you
8434 switch between views often and the build time bothers you, you
8435 can turn on sticky agenda buffers (make this the default by
8436 customizing the variable ~org-agenda-sticky~). With sticky
8437 agendas, the dispatcher only switches to the selected view, you
8438 need to update it by hand with {{{kbd(r)}}} or {{{kbd(g)}}}. You
8439 can toggle sticky agenda view any time with
8440 ~org-toggle-sticky-agenda~.
8442 You can also define custom commands that are accessible through the
8443 dispatcher, just like the default commands. This includes the
8444 possibility to create extended agenda buffers that contain several
8445 blocks together, for example the weekly agenda, the global TODO list
8446 and a number of special tags matches. See [[*Custom Agenda Views]].
8448 ** The Built-in Agenda Views
8450 :DESCRIPTION: What is available out of the box?
8451 :ALT_TITLE: Built-in Agenda Views
8454 In this section we describe the built-in views.
8456 *** Weekly/daily agenda
8458 :DESCRIPTION: The calendar page with current tasks.
8461 #+cindex: weekly agenda
8462 #+cindex: daily agenda
8464 The purpose of the weekly/daily /agenda/ is to act like a page of
8465 a paper agenda, showing all the tasks for the current week or day.
8467 - {{{kbd(M-x org-agenda a)}}} (~org-agenda-list~) ::
8469 #+kindex: a @r{(Agenda dispatcher)}
8470 #+findex: org-agenda-list
8471 #+cindex: org-agenda, command
8472 Compile an agenda for the current week from a list of Org files.
8473 The agenda shows the entries for each day. With a numeric prefix
8474 argument[fn:91]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you
8475 may set the number of days to be displayed.
8477 #+vindex: org-agenda-span
8478 #+vindex: org-agenda-start-day
8479 #+vindex: org-agenda-start-on-weekday
8480 The default number of days displayed in the agenda is set by the
8481 variable ~org-agenda-span~. This variable can be set to any number of
8482 days you want to see by default in the agenda, or to a span name, such
8483 a ~day~, ~week~, ~month~ or ~year~. For weekly agendas, the default
8484 is to start on the previous Monday (see
8485 ~org-agenda-start-on-weekday~). You can also set the start date using
8486 a date shift: ~(setq org-agenda-start-day "+10d")~ starts the agenda
8487 ten days from today in the future.
8489 Remote editing from the agenda buffer means, for example, that you can
8490 change the dates of deadlines and appointments from the agenda buffer.
8491 The commands available in the Agenda buffer are listed in [[*Commands in
8492 the Agenda Buffer]].
8494 **** Calendar/Diary integration
8498 #+cindex: calendar integration
8499 #+cindex: diary integration
8501 Emacs contains the calendar and diary by Edward M. Reingold. The
8502 calendar displays a three-month calendar with holidays from different
8503 countries and cultures. The diary allows you to keep track of
8504 anniversaries, lunar phases, sunrise/set, recurrent appointments
8505 (weekly, monthly) and more. In this way, it is quite complementary to
8506 Org. It can be very useful to combine output from Org with the diary.
8508 In order to include entries from the Emacs diary into Org mode's
8509 agenda, you only need to customize the variable
8511 #+begin_src emacs-lisp
8512 (setq org-agenda-include-diary t)
8515 #+texinfo: @noindent
8516 After that, everything happens automatically. All diary entries
8517 including holidays, anniversaries, etc., are included in the agenda
8518 buffer created by Org mode. {{{kbd(SPC)}}}, {{{kbd(TAB)}}}, and
8519 {{{kbd(RET)}}} can be used from the agenda buffer to jump to the diary
8520 file in order to edit existing diary entries. The {{{kbd(i)}}}
8521 command to insert new entries for the current date works in the agenda
8522 buffer, as well as the commands {{{kbd(S)}}}, {{{kbd(M)}}}, and
8523 {{{kbd(C)}}} to display Sunrise/Sunset times, show lunar phases and to
8524 convert to other calendars, respectively. {{{kbd(c)}}} can be used to
8525 switch back and forth between calendar and agenda.
8527 If you are using the diary only for S-exp entries and holidays, it is
8528 faster to not use the above setting, but instead to copy or even move
8529 the entries into an Org file. Org mode evaluates diary-style sexp
8530 entries, and does it faster because there is no overhead for first
8531 creating the diary display. Note that the sexp entries must start at
8532 the left margin, no whitespace is allowed before them, as seen in the
8533 following segment of an Org file:[fn:92]
8540 %%(org-calendar-holiday) ; special function for holiday names
8546 %%(org-anniversary 1956 5 14) Arthur Dent is %d years old
8547 %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old
8550 **** Anniversaries from BBDB
8554 #+cindex: BBDB, anniversaries
8555 #+cindex: anniversaries, from BBDB
8557 #+findex: org-bbdb-anniversaries
8558 If you are using the Insidious Big Brother Database to store your
8559 contacts, you very likely prefer to store anniversaries in BBDB rather
8560 than in a separate Org or diary file. Org supports this and can show
8561 BBDB anniversaries as part of the agenda. All you need to do is to
8562 add the following to one of your agenda files:
8569 %%(org-bbdb-anniversaries)
8572 You can then go ahead and define anniversaries for a BBDB record.
8573 Basically, you need to press {{{kbd(C-o anniversary RET)}}} with the
8574 cursor in a BBDB record and then add the date in the format
8575 =YYYY-MM-DD= or =MM-DD=, followed by a space and the class of the
8576 anniversary (=birthday=, =wedding=, or a format string). If you omit
8577 the class, it defaults to =birthday=. Here are a few examples, the
8578 header for the file =org-bbdb.el= contains more detailed information.
8584 2008-04-14 %s released version 6.01 of Org mode, %d years ago
8587 After a change to BBDB, or for the first agenda display during an
8588 Emacs session, the agenda display suffers a short delay as Org updates
8589 its hash with anniversaries. However, from then on things will be
8590 very fast, much faster in fact than a long list of
8591 =%%(diary-anniversary)= entries in an Org or Diary file.
8593 #+findex: org-bbdb-anniversaries-future
8594 If you would like to see upcoming anniversaries with a bit of
8595 forewarning, you can use the following instead:
8602 %%(org-bbdb-anniversaries-future 3)
8605 That will give you three days' warning: on the anniversary date itself
8606 and the two days prior. The argument is optional: if omitted, it
8609 **** Appointment reminders
8613 #+cindex: @file{appt.el}
8614 #+cindex: appointment reminders
8615 #+cindex: appointment
8618 #+cindex: APPT_WARNTIME, keyword
8619 Org can interact with Emacs appointments notification facility. To
8620 add the appointments of your agenda files, use the command
8621 ~org-agenda-to-appt~. This command lets you filter through the list
8622 of your appointments and add only those belonging to a specific
8623 category or matching a regular expression. It also reads
8624 a =APPT_WARNTIME= property which overrides the value of
8625 ~appt-message-warning-time~ for this appointment. See the docstring
8628 *** The global TODO list
8630 :DESCRIPTION: All unfinished action items.
8631 :ALT_TITLE: Global TODO list
8633 #+cindex: global TODO list
8634 #+cindex: TODO list, global
8636 The global TODO list contains all unfinished TODO items formatted and
8637 collected into a single place.
8639 - {{{kbd(M-x org-agenda t)}}} (~org-todo-list~) ::
8641 #+kindex: t @r{(Agenda dispatcher)}
8642 #+findex: org-todo-list
8643 Show the global TODO list. This collects the TODO items from all
8644 agenda files (see [[*Agenda Views]]) into a single buffer. By
8645 default, this lists items with a state the is not a DONE state.
8646 The buffer is in ~agenda-mode~, so there are commands to examine
8647 and manipulate the TODO entries directly from that buffer (see
8648 [[*Commands in the Agenda Buffer]]).
8650 - {{{kbd(M-x org-agenda T)}}} (~org-todo-list~) ::
8652 #+kindex: T @r{(Agenda dispatcher)}
8653 #+findex: org-todo-list
8654 #+cindex: TODO keyword matching
8655 #+vindex: org-todo-keywords
8656 Like the above, but allows selection of a specific TODO keyword.
8657 You can also do this by specifying a prefix argument to
8658 {{{kbd(t)}}}. You are prompted for a keyword, and you may also
8659 specify several keywords by separating them with =|= as the
8660 boolean OR operator. With a numeric prefix, the Nth keyword in
8661 ~org-todo-keywords~ is selected.
8664 The {{{kbd(r)}}} key in the agenda buffer regenerates it, and you
8665 can give a prefix argument to this command to change the selected
8666 TODO keyword, for example {{{kbd(3 r)}}}. If you often need
8667 a search for a specific keyword, define a custom command for it
8668 (see [[*The Agenda Dispatcher]]).
8670 Matching specific TODO keywords can also be done as part of
8671 a tags search (see [[*Tag Searches]]).
8673 Remote editing of TODO items means that you can change the state of
8674 a TODO entry with a single key press. The commands available in the
8675 TODO list are described in [[*Commands in the Agenda Buffer]].
8677 #+cindex: sublevels, inclusion into TODO list
8678 Normally the global TODO list simply shows all headlines with TODO
8679 keywords. This list can become very long. There are two ways to keep
8683 #+vindex: org-agenda-todo-ignore-scheduled
8684 #+vindex: org-agenda-todo-ignore-deadlines
8685 #+vindex: org-agenda-todo-ignore-timestamp
8686 #+vindex: org-agenda-todo-ignore-with-date
8687 Some people view a TODO item that has been /scheduled/ for execution
8688 or have a /deadline/ (see [[*Timestamps, Deadlines and Scheduling]]) as
8689 no longer /open/. Configure the variables
8690 ~org-agenda-todo-ignore-scheduled~,
8691 ~org-agenda-todo-ignore-deadlines~,
8692 ~org-agenda-todo-ignore-timestamp~ and/or
8693 ~org-agenda-todo-ignore-with-date~ to exclude such items from the
8697 #+vindex: org-agenda-todo-list-sublevels
8698 TODO items may have sublevels to break up the task into subtasks.
8699 In such cases it may be enough to list only the highest level TODO
8700 headline and omit the sublevels from the global list. Configure the
8701 variable ~org-agenda-todo-list-sublevels~ to get this behavior.
8703 *** Matching tags and properties
8705 :DESCRIPTION: Structured information with fine-tuned search.
8707 #+cindex: matching, of tags
8708 #+cindex: matching, of properties
8710 #+cindex: match view
8712 If headlines in the agenda files are marked with /tags/ (see [[*Tags]]),
8713 or have properties (see [[*Properties and Columns]]), you can select
8714 headlines based on this metadata and collect them into an agenda
8715 buffer. The match syntax described here also applies when creating
8716 sparse trees with {{{kbd(C-c / m)}}}.
8718 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) ::
8720 #+kindex: m @r{(Agenda dispatcher)}
8721 #+findex: org-tags-view
8722 Produce a list of all headlines that match a given set of tags.
8723 The command prompts for a selection criterion, which is a boolean
8724 logic expression with tags, like =+work+urgent-withboss= or
8725 =work|home= (see [[*Tags]]). If you often need a specific search,
8726 define a custom command for it (see [[*The Agenda Dispatcher]]).
8728 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
8730 #+kindex: M @r{(Agenda dispatcher)}
8731 #+findex: org-tags-view
8732 #+vindex: org-tags-match-list-sublevels
8733 #+vindex: org-agenda-tags-todo-honor-ignore-options
8734 Like {{{kbd(m)}}}, but only select headlines that are also TODO
8735 items and force checking subitems (see the variable
8736 ~org-tags-match-list-sublevels~). To exclude scheduled/deadline
8737 items, see the variable
8738 ~org-agenda-tags-todo-honor-ignore-options~. Matching specific
8739 TODO keywords together with a tags match is also possible, see
8742 The commands available in the tags list are described in [[*Commands in
8743 the Agenda Buffer]].
8745 #+cindex: boolean logic, for agenda searches
8746 A search string can use Boolean operators =&= for AND and =|= for OR.
8747 =&= binds more strongly than =|=. Parentheses are currently not
8748 implemented. Each element in the search is either a tag, a regular
8749 expression matching tags, or an expression like =PROPERTY OPERATOR
8750 VALUE= with a comparison operator, accessing a property value. Each
8751 element may be preceded by =-= to select against it, and =+= is
8752 syntactic sugar for positive selection. The AND operator =&= is
8753 optional when =+= or =-= is present. Here are some examples, using
8758 Select headlines tagged =work=, but discard those also tagged
8763 Selects lines tagged =work= or =laptop=.
8765 - ~work|laptop+night~ ::
8767 Like before, but require the =laptop= lines to be tagged
8770 #+cindex: regular expressions, with tags search
8771 Instead of a tag, you may also specify a regular expression enclosed
8772 in curly braces. For example, =work+{^boss.*}= matches headlines that
8773 contain the tag =:work:= and any tag /starting/ with =boss=.
8775 #+cindex: group tags, as regular expressions
8776 Group tags (see [[*Tag Hierarchy]]) are expanded as regular expressions.
8777 E.g., if =work= is a group tag for the group =:work:lab:conf:=, then
8778 searching for =work= also searches for ={\(?:work\|lab\|conf\)}= and
8779 searching for =-work= searches for all headlines but those with one of
8780 the tags in the group (i.e., =-{\(?:work\|lab\|conf\)}=).
8782 #+cindex: TODO keyword matching, with tags search
8783 #+cindex: level, for tags/property match
8784 #+cindex: category, for tags/property match
8785 #+vindex: org-odd-levels-only
8786 You may also test for properties (see [[*Properties and Columns]]) at the
8787 same time as matching tags. The properties may be real properties, or
8788 special properties that represent other metadata (see [[*Special
8789 Properties]]). For example, the property =TODO= represents the TODO
8790 keyword of the entry. Or, the property =LEVEL= represents the level
8791 of an entry. So searching =+LEVEL=3+boss-TODO​="DONE"= lists all level
8792 three headlines that have the tag =boss= and are /not/ marked with the
8793 TODO keyword =DONE=. In buffers with ~org-odd-levels-only~ set,
8794 =LEVEL= does not count the number of stars, but =LEVEL=2= corresponds
8797 Here are more examples:
8799 - =work+TODO​="WAITING"= ::
8801 Select =work=-tagged TODO lines with the specific TODO keyword
8804 - =work+TODO​="WAITING"|home+TODO​="WAITING"= ::
8806 Waiting tasks both at work and at home.
8808 When matching properties, a number of different operators can be used
8809 to test the value of a property. Here is a complex example:
8812 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2
8813 +With={Sarah|Denny}+SCHEDULED>="<2008-10-11>"
8816 #+texinfo: @noindent
8817 The type of comparison depends on how the comparison value is written:
8819 - If the comparison value is a plain number, a numerical comparison is
8820 done, and the allowed operators are =<=, ===, =>=, =<==, =>==, and
8823 - If the comparison value is enclosed in double-quotes, a string
8824 comparison is done, and the same operators are allowed.
8826 - If the comparison value is enclosed in double-quotes /and/ angular
8827 brackets (like =DEADLINE<​="<2008-12-24 18:30>"=), both values are
8828 assumed to be date/time specifications in the standard Org way, and
8829 the comparison is done accordingly. Valid values also include
8830 ="<now>"= for now (including time), ="<today>"=, and ="<tomorrow>"=
8831 for these days at 0:00 hours, i.e., without a time specification.
8832 You can also use strings like ="<+5d>"= or ="<-2m>"= with units =d=,
8833 =w=, =m=, and =y= for day, week, month, and year, respectively.
8835 - If the comparison value is enclosed in curly braces, a regexp match
8836 is performed, with === meaning that the regexp matches the property
8837 value, and =<>= meaning that it does not match.
8839 So the search string in the example finds entries tagged =work= but
8840 not =boss=, which also have a priority value =A=, a =Coffee= property
8841 with the value =unlimited=, an =EFFORT= property that is numerically
8842 smaller than 2, a =With= property that is matched by the regular
8843 expression =Sarah|Denny=, and that are scheduled on or after October
8846 You can configure Org mode to use property inheritance during
8847 a search, but beware that this can slow down searches considerably.
8848 See [[*Property Inheritance]], for details.
8850 For backward compatibility, and also for typing speed, there is also
8851 a different way to test TODO states in a search. For this, terminate
8852 the tags/property part of the search string (which may include several
8853 terms connected with =|=) with a =/= and then specify a Boolean
8854 expression just for TODO keywords. The syntax is then similar to that
8855 for tags, but should be applied with care: for example, a positive
8856 selection on several TODO keywords cannot meaningfully be combined
8857 with boolean AND. However, /negative selection/ combined with AND can
8858 be meaningful. To make sure that only lines are checked that actually
8859 have any TODO keyword (resulting in a speed-up), use {{{kbd(M-x
8860 org-agenda M)}}}, or equivalently start the TODO part after the slash
8861 with =!=. Using {{{kbd(M-x org-agenda M)}}} or =/!= does not match
8862 TODO keywords in a DONE state. Examples:
8866 Same as =work+TODO​="WAITING"=.
8868 - =work/!-WAITING-NEXT= ::
8870 Select =work=-tagged TODO lines that are neither =WAITING= nor
8873 - =work/!+WAITING|+NEXT= ::
8875 Select =work=-tagged TODO lines that are either =WAITING= or
8880 :DESCRIPTION: Find entries by searching for text.
8882 #+cindex: search view
8883 #+cindex: text search
8884 #+cindex: searching, for text
8886 This agenda view is a general text search facility for Org mode
8887 entries. It is particularly useful to find notes.
8889 - {{{kbd(M-x org-agenda s)}}} (~org-search-view~) ::
8891 #+kindex: s @r{(Agenda dispatcher)}
8892 #+findex: org-search-view
8893 This is a special search that lets you select entries by matching
8894 a substring or specific words using a boolean logic.
8896 For example, the search string =computer equipment= matches entries
8897 that contain =computer equipment= as a substring, even if the two
8898 words are separated by more space or a line break.
8900 Search view can also search for specific keywords in the entry, using
8901 Boolean logic. The search string =+computer
8902 +wifi -ethernet -{8\.11[bg]}= matches note entries that contain the
8903 keywords =computer= and =wifi=, but not the keyword =ethernet=, and
8904 which are also not matched by the regular expression =8\.11[bg]=,
8905 meaning to exclude both =8.11b= and =8.11g=. The first =+= is
8906 necessary to turn on boolean search, other =+= characters are
8907 optional. For more details, see the docstring of the command
8910 You can incrementally adjust a boolean search with the following keys
8912 #+attr_texinfo: :columns 0.1 0.6
8913 | {{{kbd([)}}} | Add a positive search word |
8914 | {{{kbd(])}}} | Add a negative search word |
8915 | {{{kbd({)}}} | Add a positive regular expression |
8916 | {{{kbd(})}}} | Add a negative regular expression |
8918 #+vindex: org-agenda-text-search-extra-files
8919 Note that in addition to the agenda files, this command also searches
8920 the files listed in ~org-agenda-text-search-extra-files~.
8924 :DESCRIPTION: Find projects you need to review.
8926 #+pindex: GTD, Getting Things Done
8928 If you are following a system like David Allen's GTD to organize your
8929 work, one of the "duties" you have is a regular review to make sure
8930 that all projects move along. A /stuck/ project is a project that has
8931 no defined next actions, so it never shows up in the TODO lists Org
8932 mode produces. During the review, you need to identify such projects
8933 and define next actions for them.
8935 - {{{kbd(M-x org-agenda #)}}} (~org-agenda-list-stuck-projects~) ::
8937 #+kindex: # @r{(Agenda dispatcher)}
8938 #+findex: org-agenda-list-stuck-projects
8939 List projects that are stuck.
8941 - {{{kbd(M-x org-agenda !)}}} ::
8943 #+kindex: ! @r{(Agenda dispatcher)}
8944 #+vindex: org-stuck-projects
8945 Customize the variable ~org-stuck-projects~ to define what
8946 a stuck project is and how to find it.
8948 You almost certainly need to configure this view before it works for
8949 you. The built-in default assumes that all your projects are level-2
8950 headlines, and that a project is not stuck if it has at least one
8951 entry marked with a TODO keyword =TODO= or =NEXT= or =NEXTACTION=.
8953 Let's assume that you, in your own way of using Org mode, identify
8954 projects with a tag =:PROJECT:=, and that you use a TODO keyword
8955 =MAYBE= to indicate a project that should not be considered yet.
8956 Let's further assume that the TODO keyword =DONE= marks finished
8957 projects, and that =NEXT= and =TODO= indicate next actions. The tag
8958 =:@shop:= indicates shopping and is a next action even without the
8959 NEXT tag. Finally, if the project contains the special word =IGNORE=
8960 anywhere, it should not be listed either. In this case you would
8961 start by identifying eligible projects with a tags/TODO match (see
8962 [[*Tag Searches]]) =+PROJECT/-MAYBE-DONE=, and then check for =TODO=,
8963 =NEXT=, =@shop=, and =IGNORE= in the subtree to identify projects that
8964 are not stuck. The correct customization for this is:
8966 #+begin_src emacs-lisp
8967 (setq org-stuck-projects
8968 '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@shop")
8972 Note that if a project is identified as non-stuck, the subtree of this
8973 entry is searched for stuck projects.
8975 ** Presentation and Sorting
8977 :DESCRIPTION: How agenda items are prepared for display.
8979 #+cindex: presentation, of agenda items
8981 #+vindex: org-agenda-prefix-format
8982 #+vindex: org-agenda-tags-column
8983 Before displaying items in an agenda view, Org mode visually prepares
8984 the items and sorts them. Each item occupies a single line. The line
8985 starts with a /prefix/ that contains the /category/ (see [[*Categories]])
8986 of the item and other important information. You can customize in
8987 which column tags are displayed through ~org-agenda-tags-column~. You
8988 can also customize the prefix using the option
8989 ~org-agenda-prefix-format~. This prefix is followed by a cleaned-up
8990 version of the outline headline associated with the item.
8994 :DESCRIPTION: Not all tasks are equal.
8997 #+cindex: @samp{CATEGORY}, keyword
8999 The category is a broad label assigned to each agenda item. By
9000 default, the category is simply derived from the file name, but you
9001 can also specify it with a special line in the buffer, like
9004 : #+CATEGORY: Thesis
9006 #+texinfo: @noindent
9007 #+cindex: @samp{CATEGORY}, property
9008 If you would like to have a special category for a single entry or
9009 a (sub)tree, give the entry a =CATEGORY= property with the special
9010 category you want to apply as the value.
9012 #+texinfo: @noindent
9013 The display in the agenda buffer looks best if the category is not
9014 longer than 10 characters.
9016 #+texinfo: @noindent
9017 #+vindex: org-agenda-category-icon-alist
9018 You can set up icons for category by customizing the
9019 ~org-agenda-category-icon-alist~ variable.
9021 *** Time-of-day specifications
9023 :DESCRIPTION: How the agenda knows the time.
9025 #+cindex: time-of-day specification
9027 Org mode checks each agenda item for a time-of-day specification. The
9028 time can be part of the timestamp that triggered inclusion into the
9031 : <2005-05-10 Tue 19:00>
9033 #+texinfo: @noindent
9034 Time ranges can be specified with two timestamps:
9036 : <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
9038 In the headline of the entry itself, a time(range) may also appear as
9039 plain text (like =12:45= or a =8:30-1pm=). If the agenda integrates
9040 the Emacs diary (see [[*Weekly/daily agenda]]), time specifications in
9041 diary entries are recognized as well.
9043 For agenda display, Org mode extracts the time and displays it in
9044 a standard 24 hour format as part of the prefix. The example times in
9045 the previous paragraphs would end up in the agenda like this:
9048 8:30-13:00 Arthur Dent lies in front of the bulldozer
9049 12:45...... Ford Prefect arrives and takes Arthur to the pub
9050 19:00...... The Vogon reads his poem
9051 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
9055 If the agenda is in single-day mode, or for the display of today, the
9056 timed entries are embedded in a time grid, like
9059 8:00...... ------------------
9060 8:30-13:00 Arthur Dent lies in front of the bulldozer
9061 10:00...... ------------------
9062 12:00...... ------------------
9063 12:45...... Ford Prefect arrives and takes Arthur to the pub
9064 14:00...... ------------------
9065 16:00...... ------------------
9066 18:00...... ------------------
9067 19:00...... The Vogon reads his poem
9068 20:00...... ------------------
9069 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
9072 #+vindex: org-agenda-use-time-grid
9073 #+vindex: org-agenda-time-grid
9074 The time grid can be turned on and off with the variable
9075 ~org-agenda-use-time-grid~, and can be configured with
9076 ~org-agenda-time-grid~.
9078 *** Sorting of agenda items
9080 :DESCRIPTION: The order of things.
9082 #+cindex: sorting, of agenda items
9083 #+cindex: priorities, of agenda items
9085 Before being inserted into a view, the items are sorted. How this is
9086 done depends on the type of view.
9089 #+vindex: org-agenda-files
9090 For the daily/weekly agenda, the items for each day are sorted. The
9091 default order is to first collect all items containing an explicit
9092 time-of-day specification. These entries are shown at the beginning
9093 of the list, as a /schedule/ for the day. After that, items remain
9094 grouped in categories, in the sequence given by ~org-agenda-files~.
9095 Within each category, items are sorted by priority (see
9096 [[*Priorities]]), which is composed of the base priority (2000 for
9097 priority =A=, 1000 for =B=, and 0 for =C=), plus additional
9098 increments for overdue scheduled or deadline items.
9100 - For the TODO list, items remain in the order of categories, but
9101 within each category, sorting takes place according to priority (see
9102 [[*Priorities]]). The priority used for sorting derives from the
9103 priority cookie, with additions depending on how close an item is to
9104 its due or scheduled date.
9106 - For tags matches, items are not sorted at all, but just appear in
9107 the sequence in which they are found in the agenda files.
9109 #+vindex: org-agenda-sorting-strategy
9110 Sorting can be customized using the variable
9111 ~org-agenda-sorting-strategy~, and may also include criteria based on
9112 the estimated effort of an entry (see [[*Effort Estimates]]).
9114 *** Filtering/limiting agenda times
9116 :DESCRIPTION: Dynamically narrow the agenda.
9119 Agenda built-in or customized commands are statically defined. Agenda
9120 filters and limits provide two ways of dynamically narrowing down the
9121 list of agenda entries: /filters/ and /limits/. Filters only act on
9122 the display of the items, while limits take effect before the list of
9123 agenda entries is built. Filters are more often used interactively,
9124 while limits are mostly useful when defined as local variables within
9125 custom agenda commands.
9127 **** Filtering in the agenda
9131 #+cindex: agenda filtering
9132 #+cindex: filtering entries, in agenda
9133 #+cindex: tag filtering, in agenda
9134 #+cindex: category filtering, in agenda
9135 #+cindex: top headline filtering, in agenda
9136 #+cindex: effort filtering, in agenda
9137 #+cindex: query editing, in agenda
9139 - {{{kbd(/)}}} (~org-agenda-filter-by-tag~) ::
9141 #+findex: org-agenda-filter-by-tag
9142 #+vindex: org-agenda-tag-filter-preset
9143 Filter the agenda view with respect to a tag and/or effort
9144 estimates. The difference between this and a custom agenda
9145 command is that filtering is very fast, so that you can switch
9146 quickly between different filters without having to recreate the
9149 You are prompted for a tag selection letter; {{{kbd(SPC)}}} means
9150 any tag at all. Pressing {{{kbd(TAB)}}} at that prompt offers
9151 completion to select a tag, including any tags that do not have
9152 a selection character. The command then hides all entries that
9153 do not contain or inherit this tag. When called with prefix
9154 argument, remove the entries that /do/ have the tag. A second
9155 {{{kbd(/)}}} at the prompt turns off the filter and shows any
9156 hidden entries. Pressing {{{kbd(+)}}} or {{{kbd(-)}}} switches
9157 between filtering and excluding the next tag.
9159 #+vindex: org-agenda-auto-exclude-function
9160 Org also supports automatic, context-aware tag filtering. If the
9161 variable ~org-agenda-auto-exclude-function~ is set to
9162 a user-defined function, that function can decide which tags
9163 should be excluded from the agenda automatically. Once this is
9164 set, the {{{kbd(/)}}} command then accepts {{{kbd(RET)}}} as
9165 a sub-option key and runs the auto exclusion logic. For example,
9166 let's say you use a =Net= tag to identify tasks which need
9167 network access, an =Errand= tag for errands in town, and a =Call=
9168 tag for making phone calls. You could auto-exclude these tags
9169 based on the availability of the Internet, and outside of
9170 business hours, with something like this:
9172 #+begin_src emacs-lisp
9173 (defun org-my-auto-exclude-function (tag)
9175 ((string= tag "Net")
9176 (/= 0 (call-process "/sbin/ping" nil nil nil
9177 "-c1" "-q" "-t1" "mail.gnu.org")))
9178 ((or (string= tag "Errand") (string= tag "Call"))
9179 (let ((hour (nth 2 (decode-time))))
9180 (or (< hour 8) (> hour 21)))))
9183 (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
9186 - {{{kbd(<)}}} (~org-agenda-filter-by-category~) ::
9188 #+findex: org-agenda-filter-by-category
9189 Filter the current agenda view with respect to the category of
9190 the item at point. Pressing {{{kbd(<)}}} another time removes
9191 this filter. When called with a prefix argument exclude the
9192 category of the item at point from the agenda.
9194 #+vindex: org-agenda-category-filter-preset
9195 You can add a filter preset in custom agenda commands through the
9196 option ~org-agenda-category-filter-preset~. See [[*Setting options
9197 for custom commands]].
9199 - {{{kbd(^)}}} (~org-agenda-filter-by-top-headline~) ::
9201 #+findex: org-agenda-filter-by-top-headline
9202 Filter the current agenda view and only display the siblings and
9203 the parent headline of the one at point.
9205 - {{{kbd(=)}}} (~org-agenda-filter-by-regexp~) ::
9207 #+findex: org-agenda-filter-by-regexp
9208 Filter the agenda view by a regular expression: only show agenda
9209 entries matching the regular expression the user entered. When
9210 called with a prefix argument, it filters /out/ entries matching
9211 the regexp. With two universal prefix arguments, it removes all
9212 the regexp filters, which can be accumulated.
9214 #+vindex: org-agenda-regexp-filter-preset
9215 You can add a filter preset in custom agenda commands through the
9216 option ~org-agenda-regexp-filter-preset~. See [[*Setting options
9217 for custom commands]].
9219 - {{{kbd(_)}}} (~org-agenda-filter-by-effort~) ::
9221 #+findex: org-agenda-filter-by-effort
9222 Filter the agenda view with respect to effort estimates. You
9223 first need to set up allowed efforts globally, for example
9225 #+begin_src emacs-lisp
9226 (setq org-global-properties
9227 '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
9230 #+vindex: org-sort-agenda-noeffort-is-high
9231 You can then filter for an effort by first typing an operator,
9232 one of {{{kbd(<)}}}, {{{kbd(>)}}} and {{{kbd(=)}}}, and then the
9233 one-digit index of an effort estimate in your array of allowed
9234 values, where {{{kbd(0)}}} means the 10th value. The filter then
9235 restricts to entries with effort smaller-or-equal, equal, or
9236 larger-or-equal than the selected value. For application of the
9237 operator, entries without a defined effort are treated according
9238 to the value of ~org-sort-agenda-noeffort-is-high~.
9240 When called with a prefix argument, it removes entries matching
9241 the condition. With two universal prefix arguments, it clears
9242 effort filters, which can be accumulated.
9244 #+vindex: org-agenda-effort-filter-preset
9245 You can add a filter preset in custom agenda commands through the
9246 option ~org-agenda-effort-filter-preset~. See [[*Setting options
9247 for custom commands]].
9249 - {{{kbd(|)}}} (~org-agenda-filter-remove-all~) ::
9251 Remove all filters in the current agenda view.
9253 **** Setting limits for the agenda
9257 #+cindex: limits, in agenda
9259 Here is a list of options that you can set, either globally, or
9260 locally in your custom agenda views (see [[*Custom Agenda Views]]).
9262 - ~org-agenda-max-entries~ ::
9264 #+vindex: org-agenda-max-entries
9265 Limit the number of entries.
9267 - ~org-agenda-max-effort~ ::
9269 #+vindex: org-agenda-max-effort
9270 Limit the duration of accumulated efforts (as minutes).
9272 - ~org-agenda-max-todos~ ::
9274 #+vindex: org-agenda-max-todos
9275 Limit the number of entries with TODO keywords.
9277 - ~org-agenda-max-tags~ ::
9279 #+vindex: org-agenda-max-tags
9280 Limit the number of tagged entries.
9282 When set to a positive integer, each option excludes entries from
9283 other categories: for example, ~(setq org-agenda-max-effort 100)~
9284 limits the agenda to 100 minutes of effort and exclude any entry that
9285 has no effort property. If you want to include entries with no effort
9286 property, use a negative value for ~org-agenda-max-effort~. One
9287 useful setup is to use ~org-agenda-max-entries~ locally in a custom
9288 command. For example, this custom command displays the next five
9289 entries with a =NEXT= TODO keyword.
9291 #+begin_src emacs-lisp
9292 (setq org-agenda-custom-commands
9294 ((org-agenda-max-entries 5)))))
9297 Once you mark one of these five entry as DONE, rebuilding the agenda
9298 will again the next five entries again, including the first entry that
9299 was excluded so far.
9301 You can also dynamically set temporary limits, which are lost when
9302 rebuilding the agenda:
9304 - {{{kbd(~ )}}} (~org-agenda-limit-interactively~) ::
9306 #+findex: org-agenda-limit-interactively
9307 This prompts for the type of limit to apply and its value.
9309 ** Commands in the Agenda Buffer
9311 :DESCRIPTION: Remote editing of Org trees.
9312 :ALT_TITLE: Agenda Commands
9314 #+cindex: commands, in agenda buffer
9316 Entries in the agenda buffer are linked back to the Org file or diary
9317 file where they originate. You are not allowed to edit the agenda
9318 buffer itself, but commands are provided to show and jump to the
9319 original entry location, and to edit the Org files "remotely" from the
9320 agenda buffer. In this way, all information is stored only once,
9321 removing the risk that your agenda and note files may diverge.
9323 Some commands can be executed with mouse clicks on agenda lines. For
9324 the other commands, the cursor needs to be in the desired line.
9330 #+cindex: motion commands in agenda
9332 - {{{kbd(n)}}} (~org-agenda-next-line~) ::
9335 #+findex: org-agenda-next-line
9336 Next line (same as {{{kbd(DOWN)}}} and {{{kbd(C-n)}}}).
9338 - {{{kbd(p)}}} (~org-agenda-previous-line~) ::
9341 #+findex: org-agenda-previous-line
9342 Previous line (same as {{{kbd(UP)}}} and {{{kbd(C-p)}}}).
9344 *** View/Go to Org file
9348 #+cindex: view file commands in agenda
9350 - {{{kbd(SPC)}}} or {{{kbd(mouse-3)}}} (~org-agenda-show-and-scroll-up~) ::
9354 #+findex: org-agenda-show-and-scroll-up
9355 Display the original location of the item in another window.
9356 With a prefix argument, make sure that drawers stay folded.
9358 - {{{kbd(L)}}} (~org-agenda-recenter~) ::
9360 #+findex: org-agenda-recenter
9361 Display original location and recenter that window.
9363 - {{{kbd(TAB)}}} or {{{kbd(mouse-2)}}} (~org-agenda-goto~) ::
9367 #+findex: org-agenda-goto
9368 Go to the original location of the item in another window.
9370 - {{{kbd(RET)}}} (~org-agenda-switch-to~) ::
9373 #+findex: org-agenda-switch-to
9374 Go to the original location of the item and delete other windows.
9376 - {{{kbd(F)}}} (~org-agenda-follow-mode~) ::
9379 #+findex: org-agenda-follow-mode
9380 #+vindex: org-agenda-start-with-follow-mode
9381 Toggle Follow mode. In Follow mode, as you move the cursor
9382 through the agenda buffer, the other window always shows the
9383 corresponding location in the Org file. The initial setting for
9384 this mode in new agenda buffers can be set with the variable
9385 ~org-agenda-start-with-follow-mode~.
9387 - {{{kbd(C-c C-x b)}}} (~org-agenda-tree-to-indirect-buffer~) ::
9390 #+findex: org-agenda-tree-to-indirect-buffer
9391 Display the entire subtree of the current item in an indirect
9392 buffer. With a numeric prefix argument N, go up to level N and
9393 then take that tree. If N is negative, go up that many levels.
9394 With a {{{kbd(C-u)}}} prefix, do not remove the previously used
9397 - {{{kbd(C-c C-o)}}} (~org-agenda-open-link~) ::
9400 #+findex: org-agenda-open-link
9401 Follow a link in the entry. This offers a selection of any links
9402 in the text belonging to the referenced Org node. If there is
9403 only one link, follow it without a selection prompt.
9409 #+cindex: change agenda display
9410 #+cindex: display changing, in agenda
9412 #+attr_texinfo: :sep ,
9416 Interactively select another agenda view and append it to the
9422 Delete other windows.
9424 - {{{kbd(v d)}}} or short {{{kbd(d)}}} (~org-agenda-day-view~) ::
9428 #+findex: org-agenda-day-view
9429 Switch to day view. When switching to day view, this setting
9430 becomes the default for subsequent agenda refreshes. A numeric
9431 prefix argument may be used to jump directly to a specific day of
9432 the year. For example, {{{kbd(32 d)}}} jumps to February 1st.
9433 When setting day view, a year may be encoded in the prefix
9434 argument as well. For example, {{{kbd(200712 d)}}} jumps to
9435 January 12, 2007. If such a year specification has only one or
9436 two digits, it is expanded into one of the 30 next years or the
9439 - {{{kbd(v w)}}} or short {{{kbd(w)}}} (~org-agenda-week-view~) ::
9443 #+findex: org-agenda-week-view
9444 Switch to week view. When switching week view, this setting
9445 becomes the default for subsequent agenda refreshes. A numeric
9446 prefix argument may be used to jump directly to a specific day of
9447 the ISO week. For example {{{kbd(9 w)}}} to ISO week number 9.
9448 When setting week view, a year may be encoded in the prefix
9449 argument as well. For example, {{{kbd(200712 w)}}} jumps to week
9450 12 in 2007. If such a year specification has only one or two
9451 digits, it is expanded into one of the 30 next years or the last
9454 - {{{kbd(v m)}}} (~org-agenda-month-view~) ::
9457 #+findex: org-agenda-month-view
9458 Switch to month view. Because month views are slow to create,
9459 they do not become the default for subsequent agenda refreshes.
9460 A numeric prefix argument may be used to jump directly to
9461 a specific day of the month. When setting month view, a year may
9462 be encoded in the prefix argument as well. For example,
9463 {{{kbd(200712 m)}}} jumps to December, 2007. If such a year
9464 specification has only one or two digits, it is expanded into one
9465 of the 30 next years or the last 69 years.
9467 - {{{kbd(v y)}}} (~org-agenda-year-view~) ::
9470 #+findex: org-agenda-year-view
9471 Switch to year view. Because year views are slow to create, they
9472 do not become the default for subsequent agenda refreshes.
9473 A numeric prefix argument may be used to jump directly to
9474 a specific day of the year.
9476 - {{{kbd(v SPC)}}} (~org-agenda-reset-view~) ::
9479 #+findex: org-agenda-reset-view
9480 #+vindex: org-agenda-span
9481 Reset the current view to ~org-agenda-span~.
9483 - {{{kbd(f)}}} (~org-agenda-later~) ::
9486 #+findex: org-agenda-later
9487 Go forward in time to display the span following the current one.
9488 For example, if the display covers a week, switch to the
9489 following week. With a prefix argument, repeat that many times.
9491 - {{{kbd(b)}}} (~org-agenda-earlier~) ::
9494 #+findex: org-agenda-earlier
9495 Go backward in time to display earlier dates.
9497 - {{{kbd(.)}}} (~org-agenda-goto-today~) ::
9500 #+findex: org-agenda-goto-today
9503 - {{{kbd(j)}}} (~org-agenda-goto-date~) ::
9506 #+findex: org-agenda-goto-date
9507 Prompt for a date and go there.
9509 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
9512 #+findex: org-agenda-clock-goto
9513 Go to the currently clocked-in task /in the agenda buffer/.
9515 - {{{kbd(D)}}} (~org-agenda-toggle-diary~) ::
9518 #+findex: org-agenda-toggle-diary
9519 Toggle the inclusion of diary entries. See [[*Weekly/daily agenda]].
9521 - {{{kbd(v l)}}} or {{{kbd(v L)}}} or short {{{kbd(l)}}} (~org-agenda-log-mode~) ::
9526 #+findex: org-agenda-log-mode
9527 #+vindex: org-log-done
9528 #+vindex: org-agenda-log-mode-items
9529 Toggle Logbook mode. In Logbook mode, entries that were marked
9530 DONE while logging was on (see the variable ~org-log-done~) are
9531 shown in the agenda, as are entries that have been clocked on
9532 that day. You can configure the entry types that should be
9533 included in log mode using the variable
9534 ~org-agenda-log-mode-items~. When called with a {{{kbd(C-u)}}}
9535 prefix, show all possible logbook entries, including state
9536 changes. When called with two prefix arguments {{{kbd(C-u
9537 C-u)}}}, show only logging information, nothing else. {{{kbd(v
9538 L)}}} is equivalent to {{{kbd(C-u v l)}}}.
9540 - {{{kbd(v [)}}} or short {{{kbd([)}}} (~org-agenda-manipulate-query-add~) ::
9544 #+findex: org-agenda-manipulate-query-add
9545 Include inactive timestamps into the current view. Only for
9546 weekly/daily agenda and timeline views.
9548 - {{{kbd(v a)}}} (~org-agenda-archives-mode~) ::
9551 #+findex: org-agenda-archives-mode
9552 Toggle Archives mode. In Archives mode, trees that are archived
9553 (see [[*Internal archiving]]) are also scanned when producing the
9554 agenda. To exit archives mode, press {{{kbd(v a)}}} again.
9559 Toggle Archives mode. Include all archive files as well.
9561 - {{{kbd(v R)}}} or short {{{kbd(R)}}} (~org-agenda-clockreport-mode~) ::
9565 #+findex: org-agenda-clockreport-mode
9566 #+vindex: org-agenda-start-with-clockreport-mode
9567 #+vindex: org-clock-report-include-clocking-task
9568 Toggle Clockreport mode. In Clockreport mode, the daily/weekly
9569 agenda always shows a table with the clocked times for the time
9570 span and file scope covered by the current agenda view. The
9571 initial setting for this mode in new agenda buffers can be set
9572 with the variable ~org-agenda-start-with-clockreport-mode~. By
9573 using a prefix argument when toggling this mode (i.e., {{{kbd(C-u
9574 R)}}}), the clock table does not show contributions from entries
9575 that are hidden by agenda filtering[fn:94]. See also the
9576 variable ~org-clock-report-include-clocking-task~.
9581 #+vindex: org-agenda-clock-consistency-checks
9582 Show overlapping clock entries, clocking gaps, and other clocking
9583 problems in the current agenda range. You can then visit
9584 clocking lines and fix them manually. See the variable
9585 ~org-agenda-clock-consistency-checks~ for information on how to
9586 customize the definition of what constituted a clocking problem.
9587 To return to normal agenda display, press {{{kbd(l)}}} to exit
9590 - {{{kbd(v E)}}} or short {{{kbd(E)}}} (~org-agenda-entry-text-mode~) ::
9594 #+findex: org-agenda-entry-text-mode
9595 #+vindex: org-agenda-start-with-entry-text-mode
9596 #+vindex: org-agenda-entry-text-maxlines
9597 Toggle entry text mode. In entry text mode, a number of lines
9598 from the Org outline node referenced by an agenda line are
9599 displayed below the line. The maximum number of lines is given
9600 by the variable ~org-agenda-entry-text-maxlines~. Calling this
9601 command with a numeric prefix argument temporarily modifies that
9602 number to the prefix value.
9604 - {{{kbd(G)}}} (~org-agenda-toggle-time-grid~) ::
9607 #+vindex: org-agenda-use-time-grid
9608 #+vindex: org-agenda-time-grid
9609 Toggle the time grid on and off. See also the variables
9610 ~org-agenda-use-time-grid~ and ~org-agenda-time-grid~.
9612 - {{{kbd(r)}}} (~org-agenda-redo~), {{{kbd(g)}}} ::
9616 #+findex: org-agenda-redo
9617 Recreate the agenda buffer, for example to reflect the changes
9618 after modification of the timestamps of items with
9619 {{{kbd(S-LEFT)}}} and {{{kbd(S-RIGHT)}}}. When the
9620 buffer is the global TODO list, a prefix argument is interpreted
9621 to create a selective list for a specific TODO keyword.
9623 - {{{kbd(C-x C-s)}}} or short {{{kbd(s)}}} (~org-save-all-org-buffers~) ::
9626 #+findex: org-save-all-org-buffers
9628 Save all Org buffers in the current Emacs session, and also the
9631 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
9633 #+kindex: C-c C-x C-c
9634 #+findex: org-agenda-columns
9635 #+vindex: org-columns-default-format
9636 Invoke column view (see [[*Column View]]) in the agenda buffer. The
9637 column view format is taken from the entry at point, or, if there
9638 is no entry at point, from the first entry in the agenda view.
9639 So whatever the format for that entry would be in the original
9640 buffer (taken from a property, from a =COLUMNS= keyword, or from
9641 the default variable ~org-columns-default-format~) is used in the
9644 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
9647 #+findex: org-agenda-remove-restriction-lock
9648 Remove the restriction lock on the agenda, if it is currently
9649 restricted to a file or subtree (see [[*Agenda Files]]).
9651 - {{{kbd(M-UP)}}} (~org-agenda-drag-line-backward~) ::
9654 #+findex: org-agenda-drag-line-backward
9655 Drag the line at point backward one line. With a numeric prefix
9656 argument, drag backward by that many lines.
9658 Moving agenda lines does not persist after an agenda refresh and
9659 does not modify the contributing Org files.
9661 - {{{kbd(M-DOWN)}}} (~org-agenda-drag-line-forward~) ::
9664 #+findex: org-agenda-drag-line-forward
9665 Drag the line at point forward one line. With a numeric prefix
9666 argument, drag forward by that many lines.
9672 #+cindex: remote editing, from agenda
9674 - {{{kbd(0--9)}}} ::
9678 - {{{kbd(C-_)}}} (~org-agenda-undo~) ::
9681 #+findex: org-agenda-undo
9682 #+cindex: undoing remote-editing events
9683 #+cindex: remote editing, undo
9684 Undo a change due to a remote editing command. The change is
9685 undone both in the agenda buffer and in the remote buffer.
9687 - {{{kbd(t)}}} (~org-agenda-todo~) ::
9690 #+findex: org-agenda-todo
9691 Change the TODO state of the item, both in the agenda and in the
9694 - {{{kbd(C-S-RIGHT)}}} (~org-agenda-todo-nextset~) ::
9697 #+findex: org-agenda-todo-nextset
9698 Switch to the next set of TODO keywords.
9700 - {{{kbd(C-S-LEFT)}}}, ~org-agenda-todo-previousset~ ::
9703 Switch to the previous set of TODO keywords.
9705 - {{{kbd(C-k)}}} (~org-agenda-kill~) ::
9708 #+findex: org-agenda-kill
9709 #+vindex: org-agenda-confirm-kill
9710 Delete the current agenda item along with the entire subtree
9711 belonging to it in the original Org file. If the text to be
9712 deleted remotely is longer than one line, the kill needs to be
9713 confirmed by the user. See variable ~org-agenda-confirm-kill~.
9715 - {{{kbd(C-c C-w)}}} (~org-agenda-refile~) ::
9718 #+findex: org-agenda-refile
9719 Refile the entry at point.
9721 - {{{kbd(C-c C-x C-a)}}} or short {{{kbd(a)}}} (~org-agenda-archive-default-with-confirmation~) ::
9723 #+kindex: C-c C-x C-a
9725 #+findex: org-agenda-archive-default-with-confirmation
9726 #+vindex: org-archive-default-command
9727 Archive the subtree corresponding to the entry at point using the
9728 default archiving command set in ~org-archive-default-command~.
9729 When using the {{{kbd(a)}}} key, confirmation is required.
9731 - {{{kbd(C-c C-x a)}}} (~org-agenda-toggle-archive-tag~) ::
9734 #+findex: org-agenda-toggle-archive-tag
9735 Toggle the archive tag (see [[*Internal archiving]]) for the current
9738 - {{{kbd(C-c C-x A)}}} (~org-agenda-archive-to-archive-sibling~) ::
9741 #+findex: org-agenda-archive-to-archive-sibling
9742 Move the subtree corresponding to the current entry to its
9745 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd($)}}} (~org-agenda-archive~) ::
9747 #+kindex: C-c C-x C-s
9749 #+findex: org-agenda-archive
9750 Archive the subtree corresponding to the current headline. This
9751 means the entry is moved to the configured archive location, most
9752 likely a different file.
9754 - {{{kbd(T)}}} (~org-agenda-show-tags~) ::
9757 #+findex: org-agenda-show-tags
9758 #+vindex: org-agenda-show-inherited-tags
9759 Show all tags associated with the current item. This is useful
9760 if you have turned off ~org-agenda-show-inherited-tags~, but
9761 still want to see all tags of a headline occasionally.
9763 - {{{kbd(:)}}} (~org-agenda-set-tags~) ::
9766 #+findex: org-agenda-set-tags
9767 Set tags for the current headline. If there is an active region
9768 in the agenda, change a tag for all headings in the region.
9770 - {{{kbd(\,)}}} (~org-agenda-priority~) ::
9773 #+findex: org-agenda-priority
9774 Set the priority for the current item. Org mode prompts for the
9775 priority character. If you reply with {{{kbd(SPC)}}}, the
9776 priority cookie is removed from the entry.
9778 - {{{kbd(P)}}} (~org-agenda-show-priority~) ::
9781 #+findex: org-agenda-show-priority
9782 Display weighted priority of current item.
9784 - {{{kbd(+)}}} or {{{kbd(S-UP)}}} (~org-agenda-priority-up~) ::
9788 #+findex: org-agenda-priority-up
9789 Increase the priority of the current item. The priority is
9790 changed in the original buffer, but the agenda is not resorted.
9791 Use the {{{kbd(r)}}} key for this.
9793 - {{{kbd(-)}}} or {{{kbd(S-DOWN)}}} (~org-agenda-priority-down~) ::
9797 #+findex: org-agenda-priority-down
9798 Decrease the priority of the current item.
9800 - {{{kbd(C-c C-z)}}} or short {{{kbd(z)}}} (~org-agenda-add-note~) ::
9804 #+findex: org-agenda-add-note
9805 #+vindex: org-log-into-drawer
9806 Add a note to the entry. This note is recorded, and then filed
9807 to the same location where state change notes are put. Depending
9808 on ~org-log-into-drawer~, this may be inside a drawer.
9810 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
9813 #+findex: org-attach
9814 Dispatcher for all command related to attachments.
9816 - {{{kbd(C-c C-s)}}} (~org-agenda-schedule~) ::
9819 #+findex: org-agenda-schedule
9820 Schedule this item. With a prefix argument, remove the
9821 scheduling timestamp
9823 - {{{kbd(C-c C-d)}}} (~org-agenda-deadline~) ::
9826 #+findex: org-agenda-deadline
9827 Set a deadline for this item. With a prefix argument, remove the
9830 - {{{kbd(S-RIGHT)}}} (~org-agenda-do-date-later~) ::
9833 #+findex: org-agenda-do-date-later
9834 Change the timestamp associated with the current line by one day
9835 into the future. If the date is in the past, the first call to
9836 this command moves it to today. With a numeric prefix argument,
9837 change it by that many days. For example, {{{kbd(3
9838 6 5 S-RIGHT)}}} changes it by a year. With a {{{kbd(C-u)}}}
9839 prefix, change the time by one hour. If you immediately repeat
9840 the command, it will continue to change hours even without the
9841 prefix argument. With a double {{{kbd(C-u C-u)}}} prefix, do the
9842 same for changing minutes. The stamp is changed in the original
9843 Org file, but the change is not directly reflected in the agenda
9844 buffer. Use {{{kbd(r)}}} or {{{kbd(g)}}} to update the buffer.
9846 - {{{kbd(S-LEFT)}}} (~org-agenda-do-date-earlier~) ::
9849 #+findex: org-agenda-do-date-earlier
9850 Change the timestamp associated with the current line by one day
9853 - {{{kbd(>)}}} (~org-agenda-date-prompt~) ::
9856 #+findex: org-agenda-date-prompt
9857 Change the timestamp associated with the current line. The key
9858 {{{kbd(>)}}} has been chosen, because it is the same as
9859 {{{kbd(S-.)}}} on my keyboard.
9861 - {{{kbd(I)}}} (~org-agenda-clock-in~) ::
9864 #+findex: org-agenda-clock-in
9865 Start the clock on the current item. If a clock is running
9866 already, it is stopped first.
9868 - {{{kbd(O)}}} (~org-agenda-clock-out~) ::
9871 #+findex: org-agenda-clock-out
9872 Stop the previously started clock.
9874 - {{{kbd(X)}}} (~org-agenda-clock-cancel~) ::
9877 #+findex: org-agenda-clock-cancel
9878 Cancel the currently running clock.
9880 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
9883 #+findex: org-agenda-clock-goto
9884 Jump to the running clock in another window.
9886 - {{{kbd(k)}}} (~org-agenda-capture~) ::
9889 #+findex: org-agenda-capture
9890 #+cindex: capturing, from agenda
9891 #+vindex: org-capture-use-agenda-date
9892 Like ~org-capture~, but use the date at point as the default date
9893 for the capture template. See ~org-capture-use-agenda-date~ to
9894 make this the default behavior of ~org-capture~.
9896 *** Bulk remote editing selected entries
9900 #+cindex: remote editing, bulk, from agenda
9901 #+vindex: org-agenda-bulk-custom-functions
9903 - {{{kbd(m)}}} (~org-agenda-bulk-mark~) ::
9905 #+findex: org-agenda-bulk-mark
9907 Mark the entry at point for bulk action. If there is an active
9908 region in the agenda, mark the entries in the region. With
9909 numeric prefix argument, mark that many successive entries.
9911 - {{{kbd(*)}}} (~org-agenda-bulk-mark-all~) ::
9913 #+findex: org-agenda-bulk-mark-all
9915 Mark all visible agenda entries for bulk action.
9917 - {{{kbd(u)}}} (~org-agenda-bulk-unmark~) ::
9919 #+findex: org-agenda-bulk-unmark
9921 Unmark entry for bulk action.
9923 - {{{kbd(U)}}} (~org-agenda-bulk-remove-all-marks~) ::
9925 #+findex: org-agenda-bulk-remove-all-marks
9927 Unmark all marked entries for bulk action.
9929 - {{{kbd(M-m)}}} (~org-agenda-bulk-toggle~) ::
9931 #+findex: org-agenda-bulk-toggle
9933 Toggle mark of the entry at point for bulk action.
9935 - {{{kbd(M-*)}}} (~org-agenda-bulk-toggle-all~) ::
9937 #+findex: org-agenda-bulk-toggle-all
9939 Mark entries matching a regular expression for bulk action.
9941 - {{{kbd(%)}}} (~org-agenda-bulk-mark-regexp~) ::
9943 #+findex: org-agenda-bulk-mark-regexp
9945 Mark entries matching a regular expression for bulk action.
9947 - {{{kbd(B)}}} (~org-agenda-bulk-action~) ::
9949 #+findex: org-agenda-bulk-action
9950 #+vindex: org-agenda-bulk-persistent-marks
9952 Bulk action: act on all marked entries in the agenda. This
9953 prompts for another key to select the action to be applied. The
9954 prefix argument to {{{kbd(B)}}} is passed through to the
9955 {{{kbd(s)}}} and {{{kbd(d)}}} commands, to bulk-remove these
9956 special timestamps. By default, marks are removed after the
9957 bulk. If you want them to persist, set
9958 ~org-agenda-bulk-persistent-marks~ to ~t~ or hit {{{kbd(p)}}} at
9963 Toggle persistent marks.
9967 Archive all selected entries.
9971 Archive entries by moving them to their respective archive
9976 Change TODO state. This prompts for a single TODO keyword and
9977 changes the state of all selected entries, bypassing blocking
9978 and suppressing logging notes---but not timestamps.
9982 Add a tag to all selected entries.
9986 Remove a tag from all selected entries.
9990 Schedule all items to a new date. To shift existing schedule
9991 dates by a fixed number of days, use something starting with
9992 double plus at the prompt, for example =++8d= or =++2w=.
9996 Set deadline to a specific date.
10000 Prompt for a single refile target and move all entries. The
10001 entries are no longer in the agenda; refresh ({{{kbd(g)}}}) to
10006 Reschedule randomly into the coming N days. N is prompted for.
10007 With a prefix argument ({{{kbd(C-u B S)}}}), scatter only
10012 #+vindex: org-agenda-bulk-custom-functions
10013 Apply a function[fn:95] to marked entries. For example, the
10014 function below sets the =CATEGORY= property of the entries to
10017 #+begin_src emacs-lisp
10018 (defun set-category ()
10020 (let ((marker (or (org-get-at-bol 'org-hd-marker)
10021 (org-agenda-error))))
10022 (org-with-point-at marker
10023 (org-back-to-heading t)
10024 (org-set-property "CATEGORY" "web"))))
10027 *** Calendar commands
10031 #+cindex: calendar commands, from agenda
10033 - {{{kbd(c)}}} (~org-agenda-goto-calendar~) ::
10036 #+findex: org-agenda-goto-calendar
10037 Open the Emacs calendar and move to the date at the agenda
10040 - {{{kbd(c)}}} (~org-calendar-goto-agenda~) ::
10043 #+findex: org-calendar-goto-agenda
10044 When in the calendar, compute and show the Org agenda for the
10045 date at the cursor.
10047 - {{{kbd(i)}}} (~org-agenda-diary-entry~) ::
10049 #+findex: org-agenda-diary-entry
10051 #+cindex: diary entries, creating from agenda
10052 Insert a new entry into the diary, using the date at the cursor
10053 and (for block entries) the date at the mark. This adds to the
10054 Emacs diary file[fn:96], in a way similar to the {{{kbd(i)}}}
10055 command in the calendar. The diary file pops up in another
10056 window, where you can add the entry.
10058 #+vindex: org-agenda-diary-file
10059 If you configure ~org-agenda-diary-file~ to point to an Org file,
10060 Org creates entries in that file instead. Most entries are
10061 stored in a date-based outline tree that will later make it easy
10062 to archive appointments from previous months/years. The tree is
10063 built under an entry with a =DATE_TREE= property, or else with
10064 years as top-level entries. Emacs prompts you for the entry
10065 text---if you specify it, the entry is created in
10066 ~org-agenda-diary-file~ without further interaction. If you
10067 directly press {{{kbd(RET)}}} at the prompt without typing text,
10068 the target file is shown in another window for you to finish the
10069 entry there. See also the {{{kbd(k r)}}} command.
10071 - {{{kbd(M)}}} (~org-agenda-phases-of-moon~) ::
10074 #+findex: org-agenda-phases-of-moon
10075 Show the phases of the moon for the three months around current
10078 - {{{kbd(S)}}} (~org-agenda-sunrise-sunset~) ::
10081 #+findex: org-agenda-sunrise-sunset
10082 Show sunrise and sunset times. The geographical location must be
10083 set with calendar variables, see the documentation for the Emacs
10086 - {{{kbd(C)}}} (~org-agenda-convert-date~) ::
10089 #+findex: org-agenda-convert-date
10090 Convert the date at cursor into many other cultural and historic
10093 - {{{kbd(H)}}} (~org-agenda-holidays~) ::
10096 #+findex: org-agenda-holidays
10097 Show holidays for three months around the cursor date.
10104 - {{{kbd(q)}}} (~org-agenda-quit~) ::
10106 #+findex: org-agenda-quit
10108 Quit agenda, remove the agenda buffer.
10110 - {{{kbd(x)}}} (~org-agenda-exit~) ::
10112 #+findex: org-agenda-exit
10114 #+cindex: agenda files, removing buffers
10115 Exit agenda, remove the agenda buffer and all buffers loaded by
10116 Emacs for the compilation of the agenda. Buffers created by the
10117 user to visit Org files are not removed.
10119 ** Custom Agenda Views
10121 :DESCRIPTION: Defining special searches and views.
10123 #+cindex: custom agenda views
10124 #+cindex: agenda views, custom
10126 Custom agenda commands serve two purposes: to store and quickly access
10127 frequently used TODO and tags searches, and to create special
10128 composite agenda buffers. Custom agenda commands are accessible
10129 through the dispatcher (see [[*The Agenda Dispatcher]]), just like the
10132 *** Storing searches
10134 :DESCRIPTION: Type once, use often.
10137 The first application of custom searches is the definition of keyboard
10138 shortcuts for frequently used searches, either creating an agenda
10139 buffer, or a sparse tree (the latter covering of course only the
10142 #+kindex: C @r{(Agenda dispatcher)}
10143 #+vindex: org-agenda-custom-commands
10144 #+cindex: agenda views, main example
10145 #+cindex: agenda, as an agenda views
10146 #+cindex: agenda*, as an agenda views
10147 #+cindex: tags, as an agenda view
10148 #+cindex: todo, as an agenda view
10149 #+cindex: tags-todo
10150 #+cindex: todo-tree
10151 #+cindex: occur-tree
10152 #+cindex: tags-tree
10153 Custom commands are configured in the variable
10154 ~org-agenda-custom-commands~. You can customize this variable, for
10155 example by pressing {{{kbd(C)}}} from the agenda dispatcher (see [[*The
10156 Agenda Dispatcher]]). You can also directly set it with Emacs Lisp in
10157 the Emacs init file. The following example contains all valid agenda
10160 #+begin_src emacs-lisp
10161 (setq org-agenda-custom-commands
10164 ("w" todo "WAITING")
10165 ("W" todo-tree "WAITING")
10166 ("u" tags "+boss-urgent")
10167 ("v" tags-todo "+boss-urgent")
10168 ("U" tags-tree "+boss-urgent")
10169 ("f" occur-tree "\\<FIXME\\>")
10170 ("h" . "HOME+Name tags searches") ;description for "h" prefix
10171 ("hl" tags "+home+Lisa")
10172 ("hp" tags "+home+Peter")
10173 ("hk" tags "+home+Kim")))
10176 #+texinfo: @noindent
10177 The initial string in each entry defines the keys you have to press
10178 after the dispatcher command in order to access the command. Usually
10179 this will be just a single character, but if you have many similar
10180 commands, you can also define two-letter combinations where the first
10181 character is the same in several combinations and serves as a prefix
10182 key[fn:97]. The second parameter is the search type, followed by the
10183 string or regular expression to be used for the matching. The example
10184 above will therefore define:
10188 as a global search for agenda entries planned[fn:98] this
10193 as the same search, but only for entries with an hour
10194 specification like =[h]h:mm=---think of them as appointments.
10198 as a global search for TODO entries with =WAITING= as the TODO
10203 as the same search, but only in the current buffer and displaying
10204 the results as a sparse tree.
10208 as a global tags search for headlines tagged =boss= but not
10213 The same search, but limiting it to headlines that are also TODO
10218 as the same search, but only in the current buffer and displaying
10219 the result as a sparse tree.
10223 to create a sparse tree (again, current buffer only) with all
10224 entries containing the word =FIXME=.
10228 as a prefix command for a =HOME= tags search where you have to
10229 press an additional key ({{{kbd(l)}}}, {{{kbd(p)}}} or
10230 {{{kbd(k)}}}) to select a name (Lisa, Peter, or Kim) as
10231 additional tag to match.
10233 Note that ~*-tree~ agenda views need to be called from an Org buffer
10234 as they operate on the current buffer only.
10238 :DESCRIPTION: All the stuff you need in a single buffer.
10240 #+cindex: block agenda
10241 #+cindex: agenda, with block views
10243 Another possibility is the construction of agenda views that comprise
10244 the results of /several/ commands, each of which creates a block in
10245 the agenda buffer. The available commands include ~agenda~ for the
10246 daily or weekly agenda (as created with {{{kbd(a)}}}) , ~alltodo~ for
10247 the global TODO list (as constructed with {{{kbd(t)}}}), and the
10248 matching commands discussed above: ~todo~, ~tags~, and ~tags-todo~.
10249 Here are two examples:
10251 #+begin_src emacs-lisp
10252 (setq org-agenda-custom-commands
10253 '(("h" "Agenda and Home-related tasks"
10257 ("o" "Agenda and Office-related tasks"
10260 (tags "office")))))
10263 #+texinfo: @noindent
10264 This defines {{{kbd(h)}}} to create a multi-block view for stuff you
10265 need to attend to at home. The resulting agenda buffer contains your
10266 agenda for the current week, all TODO items that carry the tag =home=,
10267 and also all lines tagged with =garden=. Finally the command
10268 {{{kbd(o)}}} provides a similar view for office tasks.
10270 *** Setting options for custom commands
10272 :DESCRIPTION: Changing the rules.
10273 :ALT_TITLE: Setting options
10275 #+cindex: options, for custom agenda views
10277 #+vindex: org-agenda-custom-commands
10278 Org mode contains a number of variables regulating agenda construction
10279 and display. The global variables define the behavior for all agenda
10280 commands, including the custom commands. However, if you want to
10281 change some settings just for a single custom view, you can do so.
10282 Setting options requires inserting a list of variable names and values
10283 at the right spot in ~org-agenda-custom-commands~. For example:
10285 #+begin_src emacs-lisp
10286 (setq org-agenda-custom-commands
10287 '(("w" todo "WAITING"
10288 ((org-agenda-sorting-strategy '(priority-down))
10289 (org-agenda-prefix-format " Mixed: ")))
10290 ("U" tags-tree "+boss-urgent"
10291 ((org-show-context-detail 'minimal)))
10293 ((org-agenda-files '("~org/notes.org"))
10294 (org-agenda-text-search-extra-files nil)))))
10297 #+texinfo: @noindent
10298 Now the {{{kbd(w)}}} command sorts the collected entries only by
10299 priority, and the prefix format is modified to just say =Mixed:=
10300 instead of giving the category of the entry. The sparse tags tree of
10301 {{{kbd(U)}}} now turns out ultra-compact, because neither the headline
10302 hierarchy above the match, nor the headline following the match are
10303 shown. The command {{{kbd(N)}}} does a text search limited to only
10306 For command sets creating a block agenda, ~org-agenda-custom-commands~
10307 has two separate spots for setting options. You can add options that
10308 should be valid for just a single command in the set, and options that
10309 should be valid for all commands in the set. The former are just
10310 added to the command entry; the latter must come after the list of
10311 command entries. Going back to the block agenda example (see [[*Block
10312 agenda]]), let's change the sorting strategy for the {{{kbd(h)}}}
10313 commands to ~priority-down~, but let's sort the results for GARDEN
10314 tags query in the opposite order, ~priority-up~. This would look like
10317 #+begin_src emacs-lisp
10318 (setq org-agenda-custom-commands
10319 '(("h" "Agenda and Home-related tasks"
10323 ((org-agenda-sorting-strategy '(priority-up)))))
10324 ((org-agenda-sorting-strategy '(priority-down))))
10325 ("o" "Agenda and Office-related tasks"
10328 (tags "office")))))
10331 As you see, the values and parentheses setting is a little complex.
10332 When in doubt, use the customize interface to set this variable---it
10333 fully supports its structure. Just one caveat: when setting options
10334 in this interface, the /values/ are just Lisp expressions. So if the
10335 value is a string, you need to add the double-quotes around the value
10338 #+vindex: org-agenda-custom-commands-contexts
10339 To control whether an agenda command should be accessible from
10340 a specific context, you can customize
10341 ~org-agenda-custom-commands-contexts~. Let's say for example that you
10342 have an agenda command {{{kbd(o)}}} displaying a view that you only
10343 need when reading emails. Then you would configure this option like
10346 #+begin_src emacs-lisp
10347 (setq org-agenda-custom-commands-contexts
10348 '(("o" (in-mode . "message-mode"))))
10351 You can also tell that the command key {{{kbd(o)}}} should refer to
10352 another command key {{{kbd(r)}}}. In that case, add this command key
10355 #+begin_src emacs-lisp
10356 (setq org-agenda-custom-commands-contexts
10357 '(("o" "r" (in-mode . "message-mode"))))
10360 See the docstring of the variable for more information.
10362 ** Exporting Agenda Views
10364 :DESCRIPTION: Writing a view to a file.
10366 #+cindex: agenda views, exporting
10368 If you are away from your computer, it can be very useful to have
10369 a printed version of some agenda views to carry around. Org mode can
10370 export custom agenda views as plain text, HTML[fn:99], Postscript,
10371 PDF[fn:100], and iCalendar files. If you want to do this only
10372 occasionally, use the following command:
10374 - {{{kbd(C-x C-w)}}} (~org-agenda-write~) ::
10376 #+findex: org-agenda-write
10377 #+cindex: exporting agenda views
10378 #+cindex: agenda views, exporting
10380 #+vindex: org-agenda-exporter-settings
10381 Write the agenda view to a file.
10383 If you need to export certain agenda views frequently, you can
10384 associate any custom agenda command with a list of output file
10385 names[fn:101]. Here is an example that first defines custom commands
10386 for the agenda and the global TODO list, together with a number of
10387 files to which to export them. Then we define two block agenda
10388 commands and specify file names for them as well. File names can be
10389 relative to the current working directory, or absolute.
10391 #+begin_src emacs-lisp
10392 (setq org-agenda-custom-commands
10393 '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
10394 ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
10395 ("h" "Agenda and Home-related tasks"
10400 ("~/views/home.html"))
10401 ("o" "Agenda and Office-related tasks"
10406 ("~/views/office.ps" "~/calendars/office.ics"))))
10409 The extension of the file name determines the type of export. If it
10410 is =.html=, Org mode uses the htmlize package to convert the buffer to
10411 HTML and save it to this file name. If the extension is =.ps=,
10412 ~ps-print-buffer-with-faces~ is used to produce Postscript output. If
10413 the extension is =.ics=, iCalendar export is run export over all files
10414 that were used to construct the agenda, and limit the export to
10415 entries listed in the agenda. Any other extension produces a plain
10418 The export files are /not/ created when you use one of those
10419 commands interactively because this might use too much overhead.
10420 Instead, there is a special command to produce /all/ specified
10423 - {{{kbd(e)}}} (~org-store-agenda-views~) ::
10425 #+kindex: e @r{(Agenda dispatcher)}
10426 #+findex: org-store-agenda-views
10427 Export all agenda views that have export file names associated
10430 You can use the options section of the custom agenda commands to also
10431 set options for the export commands. For example:
10433 #+begin_src emacs-lisp
10434 (setq org-agenda-custom-commands
10436 ((ps-number-of-columns 2)
10437 (ps-landscape-mode t)
10438 (org-agenda-prefix-format " [ ] ")
10439 (org-agenda-with-colors nil)
10440 (org-agenda-remove-tags t))
10441 ("theagenda.ps"))))
10444 #+texinfo: @noindent
10445 #+vindex: org-agenda-exporter-settings
10446 This command sets two options for the Postscript exporter, to make it
10447 print in two columns in landscape format---the resulting page can be
10448 cut in two and then used in a paper agenda. The remaining settings
10449 modify the agenda prefix to omit category and scheduling information,
10450 and instead include a checkbox to check off items. We also remove the
10451 tags to make the lines compact, and we do not want to use colors for
10452 the black-and-white printer. Settings specified in
10453 ~org-agenda-exporter-settings~ also apply, e.g.,
10455 #+begin_src emacs-lisp
10456 (setq org-agenda-exporter-settings
10457 '((ps-number-of-columns 2)
10458 (ps-landscape-mode t)
10459 (org-agenda-add-entry-text-maxlines 5)
10460 (htmlize-output-type 'css)))
10463 #+texinfo: @noindent
10464 but the settings in ~org-agenda-custom-commands~ take precedence.
10466 #+texinfo: @noindent
10467 From the command line you may also use:
10470 emacs -eval (org-batch-store-agenda-views) -kill
10473 #+texinfo: @noindent
10474 or, if you need to modify some parameters[fn:102]
10477 emacs -eval '(org-batch-store-agenda-views \
10478 org-agenda-span (quote month) \
10479 org-agenda-start-day "2007-11-01" \
10480 org-agenda-include-diary nil \
10481 org-agenda-files (quote ("~/org/project.org")))' \
10485 #+texinfo: @noindent
10486 which creates the agenda views restricted to the file
10487 =~/org/project.org=, without diary entries and with a 30-day extent.
10489 You can also extract agenda information in a way that allows further
10490 processing by other programs. See [[*Extracting Agenda Information]], for
10493 ** Using Column View in the Agenda
10495 :DESCRIPTION: Using column view for collected entries.
10496 :ALT_TITLE: Agenda Column View
10498 #+cindex: column view, in agenda
10499 #+cindex: agenda, column view
10501 Column view (see [[*Column View]]) is normally used to view and edit
10502 properties embedded in the hierarchical structure of an Org file. It
10503 can be quite useful to use column view also from the agenda, where
10504 entries are collected by certain criteria.
10506 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
10507 #+kindex: C-c C-x C-c
10508 #+findex: org-agenda-columns
10510 Turn on column view in the agenda.
10512 To understand how to use this properly, it is important to realize
10513 that the entries in the agenda are no longer in their proper outline
10514 environment. This causes the following issues:
10517 #+vindex: org-columns-default-format
10518 #+vindex: org-overriding-columns-format
10519 Org needs to make a decision which columns format to use. Since
10520 the entries in the agenda are collected from different files, and
10521 different files may have different columns formats, this is
10522 a non-trivial problem. Org first checks if the variable
10523 ~org-agenda-overriding-columns-format~ is currently set, and if so,
10524 takes the format from there. Otherwise it takes the format
10525 associated with the first item in the agenda, or, if that item does
10526 not have a specific format (defined in a property, or in its file),
10527 it uses ~org-columns-default-format~.
10530 #+cindex: @samp{CLOCKSUM}, special property
10531 If any of the columns has a summary type defined (see [[*Column
10532 attributes]]), turning on column view in the agenda visits all
10533 relevant agenda files and make sure that the computations of this
10534 property are up to date. This is also true for the special
10535 =CLOCKSUM= property. Org then sums the values displayed in the
10536 agenda. In the daily/weekly agenda, the sums cover a single day;
10537 in all other views they cover the entire block.
10539 It is important to realize that the agenda may show the same entry
10540 /twice/---for example as scheduled and as a deadline---and it may
10541 show two entries from the same hierarchy (for example a /parent/
10542 and its /child/). In these cases, the summation in the agenda
10543 leads to incorrect results because some values count double.
10545 3. When the column view in the agenda shows the =CLOCKSUM= property,
10546 that is always the entire clocked time for this item. So even in
10547 the daily/weekly agenda, the clocksum listed in column view may
10548 originate from times outside the current view. This has the
10549 advantage that you can compare these values with a column listing
10550 the planned total effort for a task---one of the major
10551 applications for column view in the agenda. If you want
10552 information about clocked time in the displayed period use clock
10553 table mode (press {{{kbd(R)}}} in the agenda).
10556 #+cindex: @samp{CLOCKSUM_T}, special property
10557 When the column view in the agenda shows the =CLOCKSUM_T= property,
10558 that is always today's clocked time for this item. So even in the
10559 weekly agenda, the clocksum listed in column view only originates
10560 from today. This lets you compare the time you spent on a task for
10561 today, with the time already spent---via =CLOCKSUM=---and with
10562 the planned total effort for it.
10564 * Markup for Rich Export
10566 :DESCRIPTION: Prepare text for rich export.
10570 When exporting Org documents, the exporter tries to reflect the
10571 structure of the document as accurately as possible in the back-end.
10572 Since export targets like HTML and LaTeX allow much richer formatting,
10573 Org mode has rules on how to prepare text for rich export. This
10574 section summarizes the markup rules used in an Org mode buffer.
10578 :DESCRIPTION: The basic unit of text.
10580 #+cindex: paragraphs, markup rules
10582 Paragraphs are separated by at least one empty line. If you need to
10583 enforce a line break within a paragraph, use ~\\~ at the end of
10586 To preserve the line breaks, indentation and blank lines in a region,
10587 but otherwise use normal formatting, you can use this construct, which
10588 can also be used to format poetry.
10590 #+cindex: @samp{BEGIN_VERSE}
10591 #+cindex: verse blocks
10594 Great clouds overhead
10595 Tiny black birds rise and fall
10602 When quoting a passage from another document, it is customary to
10603 format this as a paragraph that is indented on both the left and the
10604 right margin. You can include quotations in Org documents like this:
10606 #+cindex: @samp{BEGIN_QUOTE}
10607 #+cindex: quote blocks
10610 Everything should be made as simple as possible,
10611 but not any simpler ---Albert Einstein
10615 If you would like to center some text, do it like this:
10617 #+cindex: @samp{BEGIN_CENTER}
10618 #+cindex: center blocks
10621 Everything should be made as simple as possible, \\
10622 but not any simpler
10626 ** Emphasis and Monospace
10628 :DESCRIPTION: Bold, italic, etc.
10630 #+cindex: underlined text, markup rules
10631 #+cindex: bold text, markup rules
10632 #+cindex: italic text, markup rules
10633 #+cindex: verbatim text, markup rules
10634 #+cindex: code text, markup rules
10635 #+cindex: strike-through text, markup rules
10637 You can make words =*bold*=, =/italic/=, =_underlined_=, ==verbatim==
10638 and =~code~=, and, if you must, =+strike-through+=. Text in the code
10639 and verbatim string is not processed for Org mode specific syntax; it
10640 is exported verbatim.
10642 #+vindex: org-fontify-emphasized-text
10643 To turn off fontification for marked up text, you can set
10644 ~org-fontify-emphasized-text~ to ~nil~. To narrow down the list of
10645 available markup syntax, you can customize ~org-emphasis-alist~.
10647 ** Horizontal Rules
10649 :DESCRIPTION: Make a line.
10651 #+cindex: horizontal rules, markup rules
10653 A line consisting of only dashes, and at least 5 of them, is exported
10654 as a horizontal line.
10656 ** Images and Tables
10658 :DESCRIPTION: Images, tables and caption mechanism.
10660 #+cindex: tables, markup rules
10661 #+cindex: @samp{CAPTION}, keyword
10662 #+cindex: @samp{NAME}, keyword
10664 Both the native Org mode tables (see [[*Tables]]) and tables formatted
10665 with the =table.el= package are exported properly. For Org mode
10666 tables, the lines before the first horizontal separator line become
10667 table header lines. You can use the following lines somewhere before
10668 the table to assign a caption and a label for cross references, and in
10669 the text you can refer to the object with =[[tab:basic-data]]= (see
10670 [[*Internal Links]]):
10673 ,#+CAPTION: This is the caption for the next table (or link)
10674 ,#+NAME: tab:basic-data
10679 Optionally, the caption can take the form:
10681 : #+CAPTION[Caption for list of tables]: Caption for table.
10683 #+cindex: inlined images, markup rules
10684 Some back-ends allow you to directly include images into the exported
10685 document. Org does this, if a link to an image file does not have
10686 a description part, for example =[[./img/a.jpg]]=. If you wish to define
10687 a caption for the image and maybe a label for internal cross
10688 references, make sure that the link is on a line by itself and precede
10689 it with =CAPTION= and =NAME= keywords as follows:
10692 ,#+CAPTION: This is the caption for the next figure link (or table)
10693 ,#+NAME: fig:SED-HR4049
10697 #+texinfo: @noindent
10698 Such images can be displayed within the buffer. See [[*Handling Links][the discussion of
10701 Even though images and tables are prominent examples of captioned
10702 structures, the same caption mechanism can apply to many
10703 others---e.g., LaTeX equations, source code blocks. Depending on the
10704 export back-end, those may or may not be handled.
10706 ** Literal Examples
10708 :DESCRIPTION: Source code examples with special formatting.
10710 #+cindex: literal examples, markup
10711 #+cindex: code line references, markup
10713 You can include literal examples that should not be subjected to
10714 markup. Such examples are typeset in monospace, so this is well
10715 suited for source code and similar examples.
10717 #+cindex: @samp{BEGIN_EXAMPLE}
10718 #+cindex: example block
10721 Some example from a text file.
10725 Note that such blocks may be /indented/ in order to align nicely with
10726 indented text and in particular with plain list structure (see
10727 [[*Plain Lists]]). For simplicity when using small examples, you can
10728 also start the example lines with a colon followed by a space. There
10729 may also be additional whitespace before the colon:
10733 : Some example from a text file.
10736 #+cindex: formatting source code, markup rules
10737 #+vindex: org-latex-listings
10738 If the example is source code from a programming language, or any
10739 other text that can be marked up by Font Lock in Emacs, you can ask
10740 for the example to look like the fontified Emacs buffer[fn:103]. This
10741 is done with the code block, where you also need to specify the name
10742 of the major mode that should be used to fontify the example[fn:104],
10743 see [[*Structure Templates]] for shortcuts to easily insert code blocks.
10745 #+cindex: @samp{BEGIN_SRC}
10746 #+cindex: src block
10748 ,#+BEGIN_SRC emacs-lisp
10749 (defun org-xor (a b)
10755 Both in =example= and in =src= snippets, you can add a =-n= switch to
10756 the end of the =#+BEGIN= line, to get the lines of the example
10757 numbered. The =-n= takes an optional numeric argument specifying the
10758 starting line number of the block. If you use a =+n= switch, the
10759 numbering from the previous numbered snippet is continued in the
10760 current one. The =+n= switch can also take a numeric argument. This
10761 adds the value of the argument to the last line of the previous block
10762 to determine the starting line number.
10765 ,#+BEGIN_SRC emacs-lisp -n 20
10766 ;; This exports with line number 20.
10767 (message "This is line 21")
10770 ,#+BEGIN_SRC emacs-lisp +n 10
10771 ;; This is listed as line 31.
10772 (message "This is line 32")
10776 In literal examples, Org interprets strings like =(ref:name)= as
10777 labels, and use them as targets for special hyperlinks like
10778 =[[(name)]]=---i.e., the reference name enclosed in single parenthesis.
10779 In HTML, hovering the mouse over such a link remote-highlights the
10780 corresponding code line, which is kind of cool.
10782 You can also add a =-r= switch which /removes/ the labels from the
10783 source code[fn:105]. With the =-n= switch, links to these references
10784 are labeled by the line numbers from the code listing. Otherwise
10785 links use the labels with no parentheses. Here is an example:
10787 #+begin_example -l "(dumb-reference:%s)"
10788 ,#+BEGIN_SRC emacs-lisp -n -r
10789 (save-excursion (ref:sc)
10790 (goto-char (point-min)) (ref:jump)
10792 In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
10793 jumps to point-min.
10796 #+cindex: indentation, in source blocks
10797 Finally, you can use =-i= to preserve the indentation of a specific
10798 code block (see [[*Editing Source Code]]).
10800 #+vindex: org-coderef-label-format
10801 If the syntax for the label format conflicts with the language syntax,
10802 use a =-l= switch to change the format, for example
10804 : #+BEGIN_SRC pascal -n -r -l "((%s))"
10806 #+texinfo: @noindent
10807 See also the variable ~org-coderef-label-format~.
10809 HTML export also allows examples to be published as text areas (see
10810 [[*Text areas in HTML export]]).
10812 Because the =#+BEGIN= ... =#+END= patterns need to be added so often,
10813 a shortcut is provided (see [[*Structure Templates]]).
10815 - {{{kbd(C-c ')}}} (~org-edit-special~) ::
10818 #+findex: org-edit-special
10819 Edit the source code example at point in its native mode. This
10820 works by switching to a temporary buffer with the source code.
10821 You need to exit by pressing {{{kbd(C-c ')}}} again[fn:106]. The
10822 edited version then replaces the old version in the Org buffer.
10823 Fixed-width regions---where each line starts with a colon
10824 followed by a space---are edited using ~artist-mode~[fn:107] to
10825 allow creating ASCII drawings easily. Using this command in an
10826 empty line creates a new fixed-width region.
10828 #+cindex: storing link, in a source code buffer
10829 Calling ~org-store-link~ (see [[*Handling Links]]) while editing a source
10830 code example in a temporary buffer created with {{{kbd(C-c ')}}}
10831 prompts for a label. Make sure that it is unique in the current
10832 buffer, and insert it with the proper formatting like =(ref:label)= at
10833 the end of the current line. Then the label is stored as a link
10834 =(label)=, for retrieval with {{{kbd(C-c C-l)}}}.
10838 :DESCRIPTION: Greek letters and other symbols.
10840 #+cindex: math symbols
10841 #+cindex: special symbols
10842 #+cindex: @TeX{} macros
10843 #+cindex: @LaTeX{} fragments, markup rules
10844 #+cindex: HTML entities
10845 #+cindex: @LaTeX{} entities
10847 You can use LaTeX-like syntax to insert special symbols---named
10848 entities---like =\alpha= to indicate the Greek letter, or =\to= to indicate
10849 an arrow. Completion for these symbols is available, just type =\=
10850 and maybe a few letters, and press {{{kbd(M-TAB)}}} to see possible
10851 completions. If you need such a symbol inside a word, terminate it
10852 with a pair of curly brackets. For example
10855 Pro tip: Given a circle \Gamma of diameter d, the length of its
10856 circumference is \pi{}d.
10859 #+findex: org-entities-help
10860 #+vindex: org-entities-user
10861 A large number of entities is provided, with names taken from both
10862 HTML and LaTeX; you can comfortably browse the complete list from
10863 a dedicated buffer using the command ~org-entities-help~. It is also
10864 possible to provide your own special symbols in the variable
10865 ~org-entities-user~.
10867 During export, these symbols are transformed into the native format of
10868 the exporter back-end. Strings like =\alpha= are exported as =α= in
10869 the HTML output, and as =\(\alpha\)= in the LaTeX output. Similarly, =\nbsp=
10870 becomes = = in HTML and =~= in LaTeX.
10872 #+cindex: escaping characters
10873 Entities may also be used as a way to escape markup in an Org
10874 document, e.g., =\under{}not underlined\under= exports as =_not underlined_=.
10876 #+cindex: special symbols, in-buffer display
10877 If you would like to see entities displayed as UTF-8 characters, use
10878 the following command[fn:108]:
10880 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
10881 #+kindex: C-c C-x \
10882 #+findex: org-toggle-pretty-entities
10884 Toggle display of entities as UTF-8 characters. This does not
10885 change the buffer content which remains plain ASCII, but it
10886 overlays the UTF-8 character for display purposes only.
10888 #+cindex: shy hyphen, special symbol
10889 #+cindex: dash, special symbol
10890 #+cindex: ellipsis, special symbol
10891 In addition to regular entities defined above, Org exports in
10892 a special way[fn:109] the following commonly used character
10893 combinations: =\-= is treated as a shy hyphen, =--= and =---= are
10894 converted into dashes, and =...= becomes a compact set of dots.
10896 ** Subscripts and Superscripts
10898 :DESCRIPTION: Simple syntax for raising/lowering text.
10900 #+cindex: subscript
10901 #+cindex: superscript
10903 =^= and =_= are used to indicate super- and subscripts. To increase
10904 the readability of ASCII text, it is not necessary, but OK, to
10905 surround multi-character sub- and superscripts with curly braces. For
10909 The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand,
10910 the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}.
10913 #+vindex: org-use-sub-superscripts
10914 If you write a text where the underscore is often used in a different
10915 context, Org's convention to always interpret these as subscripts can
10916 get in your way. Configure the variable ~org-use-sub-superscripts~ to
10917 change this convention. For example, when setting this variable to
10918 ~{}~, =a_b= is not interpreted as a subscript, but =a_{b}= is.
10920 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~~) ::
10921 #+kindex: C-c C-x \
10922 #+findex: org-toggle-pretty-entities
10924 In addition to showing entities as UTF-8 characters, this command
10925 also formats sub- and superscripts in a WYSIWYM way.
10929 :DESCRIPTION: LaTeX can be freely used inside Org documents.
10931 #+cindex: @TeX{} interpretation
10932 #+cindex: @LaTeX{} interpretation
10934 Plain ASCII is normally sufficient for almost all note taking.
10935 Exceptions include scientific notes, which often require mathematical
10936 symbols and the occasional formula. LaTeX[fn:110] is widely used to
10937 typeset scientific documents. Org mode supports embedding LaTeX code
10938 into its files, because many academics are used to writing and reading
10939 LaTeX source code, and because it can be readily processed to produce
10940 pretty output for a number of export back-ends.
10942 *** LaTeX fragments
10944 :DESCRIPTION: Complex formulas made easy.
10946 #+cindex: @LaTeX{} fragments
10948 #+vindex: org-format-latex-header
10949 Org mode can contain LaTeX math fragments, and it supports ways to
10950 process these for several export back-ends. When exporting to LaTeX,
10951 the code is left as it is. When exporting to HTML, Org can use either
10952 [[http://www.mathjax.org][MathJax]] (see [[*Math formatting in HTML export]]) or transcode the math
10953 into images (see [[*Previewing LaTeX fragments]]).
10955 LaTeX fragments do not need any special marking at all. The following
10956 snippets are identified as LaTeX source code:
10958 - Environments of any kind[fn:111]. The only requirement is that the
10959 =\begin= statement appears on a new line, preceded by only
10962 - Text within the usual LaTeX math delimiters. To avoid conflicts
10963 with currency specifications, single =$= characters are only
10964 recognized as math delimiters if the enclosed text contains at most
10965 two line breaks, is directly attached to the =$= characters with no
10966 whitespace in between, and if the closing =$= is followed by
10967 whitespace, punctuation or a dash. For the other delimiters, there
10968 is no such restriction, so when in doubt, use =\(...\)= as inline
10971 #+texinfo: @noindent
10975 \begin{equation} % arbitrary environments,
10976 x=\sqrt{b} % even tables, figures
10977 \end{equation} % etc
10979 If $a^2=b$ and \( b=2 \), then the solution must be
10980 either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
10983 #+vindex: org-export-with-latex
10984 LaTeX processing can be configured with the variable
10985 ~org-export-with-latex~. The default setting is ~t~ which means
10986 MathJax for HTML, and no processing for ASCII and LaTeX back-ends.
10987 You can also set this variable on a per-file basis using one of these
10990 | =#+OPTIONS: tex:t= | Do the right thing automatically (MathJax) |
10991 | =#+OPTIONS: tex:nil= | Do not process LaTeX fragments at all |
10992 | =#+OPTIONS: tex:verbatim= | Verbatim export, for jsMath or so |
10994 *** Previewing LaTeX fragments
10996 :DESCRIPTION: What will this snippet look like?
10998 #+cindex: @LaTeX{} fragments, preview
11000 #+vindex: org-preview-latex-default-process
11001 If you have a working LaTeX installation and =dvipng=, =dvisvgm= or
11002 =convert= installed[fn:112], LaTeX fragments can be processed to
11003 produce images of the typeset expressions to be used for inclusion
11004 while exporting to HTML (see [[*LaTeX fragments]]), or for inline
11005 previewing within Org mode.
11007 #+vindex: org-format-latex-options
11008 #+vindex: org-format-latex-header
11009 You can customize the variables ~org-format-latex-options~ and
11010 ~org-format-latex-header~ to influence some aspects of the preview.
11011 In particular, the ~:scale~ (and for HTML export, ~:html-scale~)
11012 property of the former can be used to adjust the size of the preview
11015 - {{{kbd(C-c C-x C-l)}}} (~org-toggle-latex-fragment~) ::
11016 #+kindex: C-c C-x C-l
11017 #+findex: org-toggle-latex-fragment
11019 Produce a preview image of the LaTeX fragment at point and
11020 overlay it over the source code. If there is no fragment at
11021 point, process all fragments in the current entry (between two
11022 headlines). When called with a prefix argument, process the
11023 entire subtree. When called with two prefix arguments, or when
11024 the cursor is before the first headline, process the entire
11027 #+vindex: org-startup-with-latex-preview
11028 You can turn on the previewing of all LaTeX fragments in a file with
11030 : #+STARTUP: latexpreview
11032 To disable it, simply use
11034 : #+STARTUP: nolatexpreview
11036 *** Using CDLaTeX to enter math
11038 :DESCRIPTION: Speed up entering of formulas.
11039 :ALT_TITLE: CDLaTeX mode
11041 #+cindex: CD@LaTeX{}
11043 CDLaTeX mode is a minor mode that is normally used in combination with
11044 a major LaTeX mode like AUCTeX in order to speed-up insertion of
11045 environments and math templates. Inside Org mode, you can make use of
11046 some of the features of CDLaTeX mode. You need to install
11047 =cdlatex.el= and =texmathp.el= (the latter comes also with AUCTeX)
11048 from [[http://www.astro.uva.nl/~dominik/Tools/cdlatex]]. Do not use
11049 CDLaTeX mode itself under Org mode, but use the light version
11050 ~org-cdlatex-mode~ that comes as part of Org mode. Turn it on for the
11051 current buffer with {{{kbd(M-x org-cdlatex-mode)}}}, or for all Org
11054 #+begin_src emacs-lisp
11055 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
11058 When this mode is enabled, the following features are present (for
11059 more details see the documentation of CDLaTeX mode):
11061 #+attr_texinfo: :sep ,
11062 - {{{kbd(C-c {)}}} ::
11065 Insert an environment template.
11067 - {{{kbd(TAB)}}} ::
11070 The {{{kbd(TAB)}}} key expands the template if the cursor is
11071 inside a LaTeX fragment[fn:113]. For example, {{{kbd(TAB)}}}
11072 expands =fr= to =\frac{}{}= and position the cursor correctly
11073 inside the first brace. Another {{{kbd(TAB)}}} gets you into the
11076 Even outside fragments, {{{kbd(TAB)}}} expands environment
11077 abbreviations at the beginning of a line. For example, if you
11078 write =equ= at the beginning of a line and press {{{kbd(TAB)}}},
11079 this abbreviation is expanded to an =equation= environment. To
11080 get a list of all abbreviations, type {{{kbd(M-x
11081 cdlatex-command-help)}}}.
11083 - {{{kbd(^)}}}, {{{kbd(_)}}} ::
11086 #+vindex: cdlatex-simplify-sub-super-scripts
11088 Pressing {{{kbd(_)}}} and {{{kbd(^)}}} inside a LaTeX fragment
11089 inserts these characters together with a pair of braces. If you
11090 use {{{kbd(TAB)}}} to move out of the braces, and if the braces
11091 surround only a single character or macro, they are removed again
11092 (depending on the variable ~cdlatex-simplify-sub-super-scripts~).
11097 Pressing the backquote followed by a character inserts math
11098 macros, also outside LaTeX fragments. If you wait more than 1.5
11099 seconds after the backquote, a help window pops up.
11104 Pressing the single-quote followed by another character modifies
11105 the symbol before point with an accent or a font. If you wait
11106 more than 1.5 seconds after the single-quote, a help window pops
11107 up. Character modification works only inside LaTeX fragments;
11108 outside the quote is normal.
11112 :DESCRIPTION: Sharing and publishing notes.
11114 #+cindex: exporting
11116 Sometimes, you may want to pretty print your notes, publish them on
11117 the web or even share them with people not using Org. In these cases,
11118 the Org export facilities can be used to convert your documents to
11119 a variety of other formats, while retaining as much structure (see
11120 [[*Document Structure]]) and markup (see [[*Markup for Rich Export]]) as
11123 #+cindex: export back-end
11124 Libraries responsible for such translation are called back-ends. Org
11125 ships with the following ones
11127 - /ascii/ (ASCII format)
11128 - /beamer/ (LaTeX Beamer format)
11129 - /html/ (HTML format)
11130 - /icalendar/ (iCalendar format)
11131 - /latex/ (LaTeX format)
11132 - /md/ (Markdown format)
11133 - /odt/ (OpenDocument Text format)
11134 - /org/ (Org format)
11135 - /texinfo/ (Texinfo format)
11136 - /man/ (Man page format)
11138 #+texinfo: @noindent
11139 Org also uses additional libraries located in =contrib/= directory
11140 (see [[*Installation]]). Users can install additional export libraries
11141 for additional formats from the Emacs packaging system. For easy
11142 discovery, these packages have a common naming scheme: ~ox-NAME~,
11143 where {{{var(NAME)}}} is one of the formats. For example,
11144 ~ox-koma-letter~ /koma-letter/ back-end.
11146 #+vindex: org-export-backends
11147 Org loads back-ends for the following formats by default: ASCII, HTML,
11148 iCalendar, LaTeX and ODT. Org can load additional back-ends either of
11149 two ways: through the ~org-export-backends~ variable configuration;
11150 or, by requiring the library in the Emacs init file like this:
11152 #+begin_src emacs-lisp
11156 ** The Export Dispatcher
11158 :DESCRIPTION: The main interface.
11160 #+cindex: dispatcher, for export commands
11161 #+cindex: Export, dispatcher
11163 The export dispatcher is the main interface for Org's exports.
11164 A hierarchical menu presents the currently configured export formats.
11165 Options are shown as easy toggle switches on the same screen.
11167 #+vindex: org-export-dispatch-use-expert-ui
11168 Org also has a minimal prompt interface for the export dispatcher.
11169 When the variable ~org-export-dispatch-use-expert-ui~ is set to
11170 a non-~nil~ value, Org prompts in the minibuffer. To switch back to
11171 the hierarchical menu, press {{{kbd(?)}}}.
11173 - {{{kbd(C-c C-e)}}} (~org-export~) ::
11175 #+findex: org-export
11177 Invokes the export dispatcher interface. The options show
11178 default settings. The {{{kbd(C-u)}}} prefix argument preserves
11179 options from the previous export, including any sub-tree
11182 Org exports the entire buffer by default. If the Org buffer has an
11183 active region, then Org exports just that region.
11185 Within the dispatcher interface, the following key combinations can
11186 further alter what is exported, and how.
11188 - {{{kbd(C-a)}}} ::
11189 #+kindex: C-c C-e C-a
11191 Toggle asynchronous export. Asynchronous export uses an external
11192 Emacs process with a specially configured initialization file to
11193 complete the exporting process in the background thereby
11194 releasing the current interface. This is particularly useful
11195 when exporting long documents.
11197 Output from an asynchronous export is saved on the "the export
11198 stack". To view this stack, call the export dispatcher with
11199 a double {{{kbd(C-u)}}} prefix argument. If already in the
11200 export dispatcher menu, {{{kbd(&)}}} displays the stack.
11202 #+vindex: org-export-async-init-file
11203 To make the background export process the default, customize the
11204 variable, ~org-export-in-background~. Additionally, you can set
11205 the initialization file used by the background process with
11206 ~org-export-async-init-file~.
11208 #+vindex: org-export-in-background
11209 You can make asynchronous export the default by setting
11210 ~org-export-in-background~.
11212 - {{{kbd(C-b)}}} ::
11213 #+kindex: C-c C-e C-b
11215 Toggle body-only export. Useful for excluding headers and
11216 footers in the export. Affects only those back-end formats that
11217 have such sections---like =<head>...</head>= in HTML.
11220 #+kindex: C-c C-e C-s
11222 Toggle sub-tree export. When turned on, Org exports only the
11223 sub-tree starting from the cursor position at the time the export
11224 dispatcher was invoked. Org uses the top heading of this
11225 sub-tree as the document's title. If the cursor is not on
11226 a heading, Org uses the nearest enclosing header. If the cursor
11227 is in the document preamble, Org signals an error and aborts
11230 #+vindex: org-export-initial-scope
11231 To make the sub-tree export the default, customize the variable
11232 ~org-export-initial-scope~.
11234 - {{{kbd(C-v)}}} ::
11235 #+kindex: C-c C-e C-v
11237 Toggle visible-only export. Useful for exporting only visible
11238 parts of an Org document by adjusting outline visibility
11243 :DESCRIPTION: Common export settings.
11245 #+cindex: options, for export
11246 #+cindex: Export, settings
11248 #+cindex: @samp{OPTIONS}, keyword
11249 Export options can be set: globally with variables; for an individual
11250 file by making variables buffer-local with in-buffer settings (see
11251 [[*Summary of In-Buffer Settings]]), by setting individual keywords, or by
11252 specifying them in a compact form with the =OPTIONS= keyword; or for
11253 a tree by setting properties (see [[*Properties and Columns]]). Options
11254 set at a specific level override options set at a more general level.
11256 #+cindex: SETUPFILE, keyword
11257 In-buffer settings may appear anywhere in the file, either directly or
11258 indirectly through a file included using =#+SETUPFILE: filename or
11259 URL= syntax. Option keyword sets tailored to a particular back-end
11260 can be inserted from the export dispatcher (see [[*The Export
11261 Dispatcher]]) using the =Insert template= command by pressing
11262 {{{kbd(#)}}}. To insert keywords individually, a good way to make
11263 sure the keyword is correct is to type =#+= and then to use
11264 {{{kbd(M-TAB)}}}[fn:16] for completion.
11266 The export keywords available for every back-end, and their equivalent
11267 global variables, include:
11271 #+cindex: @samp{AUTHOR}, keyword
11272 #+vindex: user-full-name
11273 The document author (~user-full-name~).
11277 #+cindex: @samp{CREATOR}, keyword
11278 #+vindex: org-expot-creator-string
11279 Entity responsible for output generation
11280 (~org-export-creator-string~).
11284 #+cindex: @samp{DATE}, keyword
11285 #+vindex: org-export-date-timestamp-format
11286 A date or a time-stamp[fn:114].
11290 #+cindex: @samp{EMAIL}, keyword
11291 #+vindex: user-mail-address
11292 The email address (~user-mail-address~).
11296 #+cindex: @samp{LANGUAGE}, keyword
11297 #+vindex: org-export-default-language
11298 Language to use for translating certain strings
11299 (~org-export-default-language~). With =#+LANGUAGE: fr=, for
11300 example, Org translates =Table of contents= to the French =Table
11305 #+cindex: @samp{SELECT_TAGS}, keyword
11306 #+vindex: org-export-select-tags
11307 The default value is ~("export")~. When a tree is tagged with
11308 =export= (~org-export-select-tags~), Org selects that tree and
11309 its sub-trees for export. Org excludes trees with =noexport=
11310 tags, see below. When selectively exporting files with =export=
11311 tags set, Org does not export any text that appears before the
11314 - =EXCLUDE_TAGS= ::
11316 #+cindex: @samp{EXCLUDE_TAGS}, keyword
11317 #+vindex: org-export-exclude-tags
11318 The default value is ~("noexport")~. When a tree is tagged with
11319 =noexport= (~org-export-exclude-tags~), Org excludes that tree
11320 and its sub-trees from export. Entries tagged with =noexport=
11321 are unconditionally excluded from the export, even if they have
11322 an =export= tag. Even if a sub-tree is not exported, Org
11323 executes any code blocks contained there.
11327 #+cindex: @samp{TITLE}, keyword
11328 #+cindex: document title
11329 Org displays this title. For long titles, use multiple =#+TITLE=
11332 - =EXPORT_FILE_NAME= ::
11334 #+cindex: @samp{EXPORT_FILE_NAME}, keyword
11335 The name of the output file to be generated. Otherwise, Org
11336 generates the file name based on the buffer name and the
11337 extension based on the back-end format.
11339 The =OPTIONS= keyword is a compact form. To configure multiple
11340 options, use several =OPTIONS= lines. =OPTIONS= recognizes the
11341 following arguments.
11345 #+vindex: org-export-with-smart-quotes
11346 Toggle smart quotes (~org-export-with-smart-quotes~). Depending
11347 on the language used, when activated, Org treats pairs of double
11348 quotes as primary quotes, pairs of single quotes as secondary
11349 quotes, and single quote marks as apostrophes.
11353 #+vindex: org-export-with-emphasize
11354 Toggle emphasized text (~org-export-with-emphasize~).
11358 #+vindex: org-export-with-special-strings
11359 Toggle conversion of special strings
11360 (~org-export-with-special-strings~).
11364 #+vindex: org-export-with-fixed-width
11365 Toggle fixed-width sections (~org-export-with-fixed-width~).
11369 #+vindex: org-export-with-timestamps
11370 Toggle inclusion of time/date active/inactive stamps
11371 (~org-export-with-timestamps~).
11375 #+vindex: org-export-preserve-breaks
11376 Toggles whether to preserve line breaks
11377 (~org-export-preserve-breaks~).
11381 #+vindex: org-export-with-sub-superscripts
11382 Toggle TeX-like syntax for sub- and superscripts. If you write
11383 =^:{}=, =a_{b}= is interpreted, but the simple =a_b= is left as
11384 it is (~org-export-with-sub-superscripts~).
11388 #+vindex: org-export-with-archived-trees
11389 Configure how archived trees are exported. When set to
11390 ~headline~, the export process skips the contents and processes
11391 only the headlines (~org-export-with-archived-trees~).
11395 #+vindex: org-export-with-author
11396 Toggle inclusion of author name into exported file
11397 (~org-export-with-author~).
11399 - ~broken-links~ ::
11401 #+vindex: org-export-with-broken-links
11402 Toggles if Org should continue exporting upon finding a broken
11403 internal link. When set to ~mark~, Org clearly marks the problem
11404 link in the output (~org-export-with-broken-links~).
11408 #+vindex: org-export-with-clocks
11409 Toggle inclusion of CLOCK keywords (~org-export-with-clocks~).
11413 #+vindex: org-export-with-creator
11414 Toggle inclusion of creator information in the exported file
11415 (~org-export-with-creator~).
11419 #+vindex: org-export-with-drawers
11420 Toggles inclusion of drawers, or list of drawers to include, or
11421 list of drawers to exclude (~org-export-with-drawers~).
11425 #+vindex: org-export-with-date
11426 Toggle inclusion of a date into exported file
11427 (~org-export-with-date~).
11431 #+vindex: org-export-with-entities
11432 Toggle inclusion of entities (~org-export-with-entities~).
11436 #+vindex: org-export-with-email
11437 Toggle inclusion of the author's e-mail into exported file
11438 (~org-export-with-email~).
11442 #+vindex: org-export-with-footnotes
11443 Toggle the inclusion of footnotes (~org-export-with-footnotes~).
11447 #+vindex: org-export-headline-levels
11448 Set the number of headline levels for export
11449 (~org-export-headline-levels~). Below that level, headlines are
11450 treated differently. In most back-ends, they become list items.
11454 #+vindex: org-export-with-inlinetasks
11455 Toggle inclusion of inlinetasks (~org-export-with-inlinetasks~).
11459 #+vindex: org-export-with-section-numbers
11460 #+cindex: @samp{UNNUMBERED}, property
11461 Toggle section-numbers (~org-export-with-section-numbers~). When
11462 set to number N, Org numbers only those headlines at level N or
11463 above. Set =UNNUMBERED= property to non-~nil~ to disable
11464 numbering of heading and subheadings entirely. Moreover, when
11465 the value is =notoc= the headline, and all its children, do not
11466 appear in the table of contents either (see [[*Table of Contents]]).
11470 #+vindex: org-export-with-planning
11471 Toggle export of planning information
11472 (~org-export-with-planning~). "Planning information" comes from
11473 lines located right after the headline and contain any
11474 combination of these cookies: =SCHEDULED=, =DEADLINE=, or
11479 #+vindex: org-export-with-priority
11480 Toggle inclusion of priority cookies
11481 (~org-export-with-priority~).
11485 #+vindex: org-export-with-properties
11486 Toggle inclusion of property drawers, or list the properties to
11487 include (~org-export-with-properties~).
11491 #+vindex: org-export-with-statistics-cookies
11492 Toggle inclusion of statistics cookies
11493 (~org-export-with-statistics-cookies~).
11497 #+vindex: org-export-with-tags
11498 Toggle inclusion of tags, may also be ~not-in-toc~
11499 (~org-export-with-tags~).
11503 #+vindex: org-export-with-tasks
11504 Toggle inclusion of tasks (TODO items); or ~nil~ to remove all
11505 tasks; or ~todo~ to remove DONE tasks; or list the keywords to
11506 keep (~org-export-with-tasks~).
11510 #+vindex: org-export-with-latex
11511 ~nil~ does not export; ~t~ exports; ~verbatim~ keeps everything
11512 in verbatim (~org-export-with-latex~).
11516 #+vindex: org-export-time-stamp-file
11517 Toggle inclusion of the creation time in the exported file
11518 (~org-export-time-stamp-file~).
11522 #+vindex: org-export-with-title
11523 Toggle inclusion of title (~org-export-with-title~).
11527 #+vindex: org-export-with-toc
11528 Toggle inclusion of the table of contents, or set the level limit
11529 (~org-export-with-toc~).
11533 #+vindex: org-export-with-todo-keywords
11534 Toggle inclusion of TODO keywords into exported text
11535 (~org-export-with-todo-keywords~).
11539 #+vindex: org-export-with-tables
11540 Toggle inclusion of tables (~org-export-with-tables~).
11542 When exporting sub-trees, special node properties in them can override
11543 the above keywords. They are special because they have an =EXPORT_=
11544 prefix. For example, =DATE= and =EXPORT_FILE_NAME= keywords become,
11545 respectively, =EXPORT_DATE= and =EXPORT_FILE_NAME=. Except for
11546 =SETUPFILE=, all other keywords listed above have an =EXPORT_=
11549 #+cindex: @samp{BIND}, keyword
11550 #+vindex: org-export-allow-bind-keywords
11551 If ~org-export-allow-bind-keywords~ is non-~nil~, Emacs variables can
11552 become buffer-local during export by using the =BIND= keyword. Its
11553 syntax is =#+BIND: variable value=. This is particularly useful for
11554 in-buffer settings that cannot be changed using keywords.
11556 ** Table of Contents
11558 :DESCRIPTION: The if and where of the table of contents.
11560 #+cindex: table of contents
11561 #+cindex: list of tables
11562 #+cindex: list of listings
11564 #+cindex: @samp{toc}, in @samp{OPTIONS} keyword
11565 #+vindex: org-export-with-toc
11566 The table of contents includes all headlines in the document. Its
11567 depth is therefore the same as the headline levels in the file. If
11568 you need to use a different depth, or turn it off entirely, set the
11569 ~org-export-with-toc~ variable accordingly. You can achieve the same
11570 on a per file basis, using the following =toc= item in =OPTIONS=
11574 ,#+OPTIONS: toc:2 (only include two levels in TOC)
11575 ,#+OPTIONS: toc:nil (no default TOC at all)
11578 #+cindex: excluding entries from table of contents
11579 #+cindex: table of contents, exclude entries
11580 Org includes both numbered and unnumbered headlines in the table of
11581 contents[fn:115]. If you need to exclude an unnumbered headline,
11582 along with all its children, set the =UNNUMBERED= property to =notoc=
11586 ,* Subtree not numbered, not in table of contents either
11592 #+cindex: @samp{TOC}, keyword
11593 Org normally inserts the table of contents directly before the first
11594 headline of the file. To move the table of contents to a different
11595 location, first turn off the default with ~org-export-with-toc~
11596 variable or with =#+OPTIONS: toc:nil=. Then insert =#+TOC: headlines
11597 N= at the desired location(s).
11600 ,#+OPTIONS: toc:nil
11602 ,#+TOC: headlines 2
11605 To adjust the table of contents depth for a specific section of the
11606 Org document, append an additional =local= parameter. This parameter
11607 becomes a relative depth for the current level. The following example
11608 inserts a local table of contents, with direct children only.
11612 ,#+TOC: headlines 1 local
11615 Note that for this feature to work properly in LaTeX export, the Org
11616 file requires the inclusion of the titletoc package. Because of
11617 compatibility issues, titletoc has to be loaded /before/ hyperref.
11618 Customize the ~org-latex-default-packages-alist~ variable.
11620 Use the =TOC= keyword to generate list of tables---respectively, all
11621 listings---with captions.
11628 #+cindex: @samp{ALT_TITLE}, property
11629 Normally Org uses the headline for its entry in the table of contents.
11630 But with =ALT_TITLE= property, a different entry can be specified for
11631 the table of contents.
11635 :DESCRIPTION: Include additional files into a document.
11637 #+cindex: include files, during export
11638 #+cindex: Export, include files
11639 #+cindex: @samp{INCLUDE}, keyword
11641 During export, you can include the content of another file. For
11642 example, to include your =.emacs= file, you could use:
11644 : #+INCLUDE: "~/.emacs" src emacs-lisp
11646 #+texinfo: @noindent
11647 The optional second and third parameter are the markup (e.g., =quote=,
11648 =example=, or =src=), and, if the markup is =src=, the language for
11649 formatting the contents. The markup is optional; if it is not given,
11650 assume text is in Org syntax and process it normally. The =INCLUDE=
11651 keyword also allows additional parameters =:prefix1= and =:prefix= to
11652 specify prefixes for the first line and for each following line,
11653 =:minlevel= in order to get Org mode content demoted to a specified
11654 level, as well as any options accepted by the selected markup. For
11655 example, to include a file as an item, use:
11657 : #+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " "
11659 You can also include a portion of a file by specifying a lines range
11660 using the =:lines= parameter. The line at the upper end of the range
11661 is not included. The start and/or the end of the range may be omitted
11662 to use the obvious defaults.
11664 - =#+INCLUDE: "~/.emacs" :lines "5-10"= ::
11666 Include lines 5 to 10, 10 excluded.
11668 - =#+INCLUDE: "~/.emacs" :lines "-10"= ::
11670 Include lines 1 to 10, 10 excluded.
11672 - =#+INCLUDE: "~/.emacs" :lines "10-"= ::
11674 Include lines from 10 to EOF.
11676 You can visit the file being included with the following command.
11678 - {{{kbd(C-c ')}}} (~org-edit~special~) ::
11680 #+findex: org-edit-special
11682 Visit the include file at point.
11684 ** Macro Replacement
11686 :DESCRIPTION: Use macros to create templates.
11688 #+cindex: macro replacement, during export
11689 #+cindex: @samp{MACRO}, keyword
11691 #+vindex: org-export-global-macros
11692 Macros replace text snippets during export. Macros are defined
11693 globally in ~org-export-global-macros~, or document-wise with the
11696 : #+MACRO: name replacement text; $1, $2 are arguments
11698 #+texinfo: @noindent
11699 which can be referenced using ={{{name(arg1, arg2)}}}=[fn:116]. For
11703 ,#+MACRO: poem The rose is $1, The violet's $2. Life's ordered: Org assists you.
11704 {{{poem(red,blue)}}}
11707 #+texinfo: @noindent
11710 : The rose is red, The violet's blue. Life's ordered: Org assists you.
11712 As a special case, Org parses any replacement text starting with
11713 =(eval= as an Emacs Lisp expression and evaluates it accordingly.
11714 Within such templates, arguments become strings. Thus, the following
11717 : #+MACRO: gnucheck (eval (concat "GNU/" (capitalize $1)))
11719 #+texinfo: @noindent
11720 turns ={{{gnucheck(linux)}}}= into =GNU/Linux= during export.
11722 Org recognizes macro references in following Org markup areas:
11723 paragraphs, headlines, verse blocks, tables cells and lists. Org also
11724 recognizes macro references in keywords, such as =CAPTION=, =TITLE=,
11725 =AUTHOR=, =DATE=, and for some back-end specific export options.
11727 Org comes with following pre-defined macros:
11729 #+attr_texinfo: :sep ;
11730 - ={{{keyword(NAME)}}}=; ={{{title}}}=; ={{{author}}}=; ={{{email}}}= ::
11732 #+cindex: @samp{keyword}, macro
11733 #+cindex: @samp{title}, macro
11734 #+cindex: @samp{author}, macro
11735 #+cindex: @samp{email}, macro
11736 The =keyword= macro collects all values from {{{var(NAME)}}}
11737 keywords throughout the buffer, separated with white space.
11738 =title=, =author= and =email= macros are shortcuts for,
11739 respectively, ={{{keyword(TITLE)}}}=, ={{{keyword(AUTHOR)}}}= and
11740 ={{{keyword(EMAIL)}}}=.
11742 - ={{{date}}}=; ={{{date(FORMAT)}}}= ::
11744 #+cindex: @samp{date}, macro
11745 This macro refers to the =DATE= keyword. {{{var(FORMAT)}}} is an
11746 optional argument to the =date= macro that is used only if =DATE=
11747 is a single timestamp. {{{var(FORMAT)}}} should be a format
11748 string understood by ~format-time-string~.
11750 - ={{{time(FORMAT)}}}=; ={{{modification-time(FORMAT, VC)}}}= ::
11752 #+cindex: @samp{time}, macro
11753 #+cindex: @samp{modification-time}, macro
11754 These macros refer to the document's date and time of export and
11755 date and time of modification. {{{var(FORMAT)}}} is a string
11756 understood by ~format-time-string~. If the second argument to
11757 the ~modification-time~ macro is non-~nil~, Org uses =vc.el= to
11758 retrieve the document's modification time from the version
11759 control system. Otherwise Org reads the file attributes.
11761 - ={{{input-file}}}= ::
11763 #+cindex: @samp{input-file}, macro
11764 This macro refers to the filename of the exported file.
11766 - ={{{property(PROPERTY-NAME)}}}=; ={{{property(PROPERTY-NAME, SEARCH OPTION)}}}= ::
11768 #+cindex: @samp{property}, macro
11769 This macro returns the value of property {{{var(PROPERTY-NAME)}}}
11770 in the current entry. If {{{var(SEARCH-OPTION)}}} (see [[*Search
11771 Options in File Links]]) refers to a remote entry, use it instead.
11773 - ={{{n}}}=; ={{{n(NAME)}}}=; ={{{n(NAME, ACTION)}}}= ::
11775 #+cindex: @samp{n}, macro
11776 #+cindex: counter, macro
11777 This macro implements custom counters by returning the number of
11778 times the macro has been expanded so far while exporting the
11779 buffer. You can create more than one counter using different
11780 {{{var(NAME)}}} values. If {{{var(ACTION)}}} is =-=, previous
11781 value of the counter is held, i.e., the specified counter is not
11782 incremented. If the value is a number, the specified counter is
11783 set to that value. If it is any other non-empty string, the
11784 specified counter is reset to 1. You may leave {{{var(NAME)}}}
11785 empty to reset the default counter.
11787 #+vindex: org-hide-macro-markers
11788 The surrounding brackets can be made invisible by setting
11789 ~org-hide-macro-markers~ non-~nil~.
11791 Org expands macros at the very beginning of the export process.
11795 :DESCRIPTION: What will not be exported.
11797 #+cindex: exporting, not
11799 #+cindex: comment lines
11800 Lines starting with zero or more whitespace characters followed by one
11801 =#= and a whitespace are treated as comments and, as such, are not
11804 #+cindex: @samp{BEGIN_COMMENT}
11805 #+cindex: comment block
11806 Likewise, regions surrounded by =#+BEGIN_COMMENT= ... =#+END_COMMENT=
11809 #+cindex: comment trees
11810 Finally, a =COMMENT= keyword at the beginning of an entry, but after
11811 any other keyword or priority cookie, comments out the entire subtree.
11812 In this case, the subtree is not exported and no code block within it
11813 is executed either[fn:117]. The command below helps changing the
11814 comment status of a headline.
11816 - {{{kbd(C-c ;)}}} (~org-toggle-comment~) ::
11818 #+findex: org-toggle-comment
11820 Toggle the =COMMENT= keyword at the beginning of an entry.
11822 ** ASCII/Latin-1/UTF-8 export
11824 :DESCRIPTION: Exporting to flat files with encoding.
11826 #+cindex: ASCII export
11827 #+cindex: Latin-1 export
11828 #+cindex: UTF-8 export
11830 ASCII export produces an output file containing only plain ASCII
11831 characters. This is the simplest and most direct text output. It
11832 does not contain any Org markup. Latin-1 and UTF-8 export use
11833 additional characters and symbols available in these encoding
11834 standards. All three of these export formats offer the most basic of
11835 text output for maximum portability.
11837 #+vindex: org-ascii-text-width
11838 On export, Org fills and justifies text according to the text width
11839 set in ~org-ascii-text-width~.
11841 #+vindex: org-ascii-links-to-notes
11842 Org exports links using a footnote-like style where the descriptive
11843 part is in the text and the link is in a note before the next heading.
11844 See the variable ~org-ascii-links-to-notes~ for details.
11846 *** ASCII export commands
11851 #+attr_texinfo: :sep ,
11852 - {{{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)}}} ::
11853 #+kindex: C-c C-e t a
11854 #+kindex: C-c C-e t l
11855 #+kindex: C-c C-e t u
11856 #+findex: org-ascii-export-to-ascii
11858 Export as an ASCII file with a =.txt= extension. For
11859 =myfile.org=, Org exports to =myfile.txt=, overwriting without
11860 warning. For =myfile.txt=, Org exports to =myfile.txt.txt= in
11861 order to prevent data loss.
11863 #+attr_texinfo: :sep ,
11864 - {{{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)}}} ::
11865 #+kindex: C-c C-e t A
11866 #+kindex: C-c C-e t L
11867 #+kindex: C-c C-e t U
11868 #+findex: org-ascii-export-to-ascii
11870 Export to a temporary buffer. Does not create a file.
11872 *** ASCII specific export settings
11877 The ASCII export back-end has one extra keyword for customizing ASCII
11878 output. Setting this keyword works similar to the general options
11879 (see [[*Export Settings]]).
11883 #+cindex: @samp{SUBTITLE}, keyword
11884 The document subtitle. For long subtitles, use multiple
11885 =#+SUBTITLE= lines in the Org file. Org prints them on one
11886 continuous line, wrapping into multiple lines if necessary.
11888 *** Header and sectioning structure
11893 Org converts the first three outline levels into headlines for ASCII
11894 export. The remaining levels are turned into lists. To change this
11895 cut-off point where levels become lists, see [[*Export Settings]].
11897 *** Quoting ASCII text
11902 To insert text within the Org file by the ASCII back-end, use one the
11903 following constructs, inline, keyword, or export block:
11905 #+cindex: @samp{ASCII}, keyword
11906 #+cindex: @samp{BEGIN_EXPORT ascii}
11908 Inline text @@ascii:and additional text@@ within a paragraph.
11910 ,#+ASCII: Some text
11912 ,#+BEGIN_EXPORT ascii
11913 Org exports text in this block only when using ASCII back-end.
11917 *** ASCII specific attributes
11921 #+cindex: @samp{ATTR_ASCII}, keyword
11922 #+cindex: horizontal rules, in ASCII export
11924 ASCII back-end recognizes only one attribute, ~:width~, which
11925 specifies the width of an horizontal rule in number of characters.
11926 The keyword and syntax for specifying widths is:
11929 ,#+ATTR_ASCII: :width 10
11933 *** ASCII special blocks
11937 #+cindex: special blocks, in ASCII export
11938 #+cindex: @samp{BEGIN_JUSTIFYLEFT}
11939 #+cindex: @samp{BEGIN_JUSTIFYRIGHT}
11941 Besides =#+BEGIN_CENTER= blocks (see [[*Paragraphs]]), ASCII back-end has
11942 these two left and right justification blocks:
11945 ,#+BEGIN_JUSTIFYLEFT
11946 It's just a jump to the left...
11949 ,#+BEGIN_JUSTIFYRIGHT
11950 ...and then a step to the right.
11951 ,#+END_JUSTIFYRIGHT
11955 #+cindex: Beamer export
11957 Org uses Beamer export to convert an Org file tree structure into
11958 high-quality interactive slides for presentations. Beamer is a LaTeX
11959 document class for creating presentations in PDF, HTML, and other
11960 popular display formats.
11962 *** Beamer export commands
11964 :DESCRIPTION: For creating Beamer documents.
11967 - {{{kbd(C-c C-e l b)}}} (~org-beamer-export-to-latex~) ::
11968 #+kindex: C-c C-e l b
11969 #+findex: org-beamer-export-to-latex
11971 Export as LaTeX file with a =.tex= extension. For =myfile.org=,
11972 Org exports to =myfile.tex=, overwriting without warning.
11974 - {{{kbd(C-c C-e l B)}}} (~org-beamer-export-as-latex~) ::
11975 #+kindex: C-c C-e l B
11976 #+findex: org-beamer-export-as-latex
11978 Export to a temporary buffer. Does not create a file.
11980 - {{{kbd(C-c C-e l P)}}} (~org-beamer-export-to-pdf~) ::
11981 #+kindex: C-c C-e l P
11982 #+findex: org-beamer-export-to-pdf
11984 Export as LaTeX file and then convert it to PDF format.
11986 - {{{kbd(C-c C-e l O)}}} ::
11987 #+kindex: C-c C-e l O
11989 Export as LaTeX file, convert it to PDF format, and then open the
11992 *** Beamer specific export settings
11994 :DESCRIPTION: For customizing Beamer export.
11997 Beamer export back-end has several additional keywords for customizing
11998 Beamer output. These keywords work similar to the general options
11999 settings (see [[*Export Settings]]).
12001 - =BEAMER_THEME= ::
12003 #+cindex: @samp{BEAMER_THEME}, keyword
12004 #+vindex: org-beamer-theme
12005 The Beamer layout theme (~org-beamer-theme~). Use square
12006 brackets for options. For example:
12008 : #+BEAMER_THEME: Rochester [height=20pt]
12010 - =BEAMER_FONT_THEME= ::
12012 #+cindex: @samp{BEAMER_FONT_THEME}, keyword
12013 The Beamer font theme.
12015 - =BEAMER_INNER_THEME= ::
12017 #+cindex: @samp{BEAMER_INNER_THEME}, keyword
12018 The Beamer inner theme.
12020 - =BEAMER_OUTER_THEME= ::
12022 #+cindex: @samp{BEAMER_OUTER_THEME}, keyword
12023 The Beamer outer theme.
12025 - =BEAMER_HEADER= ::
12027 #+cindex: @samp{BEAMER_HEADER}, keyword
12028 Arbitrary lines inserted in the preamble, just before the
12029 =hyperref= settings.
12033 #+cindex: @samp{DESCRIPTION}, keyword
12034 The document description. For long descriptions, use multiple
12035 =DESCRIPTION= keywords. By default, =hyperref= inserts
12036 =DESCRIPTION= as metadata. Use ~org-latex-hyperref-template~ to
12037 configure document metadata. Use ~org-latex-title-command~ to
12038 configure typesetting of description as part of front matter.
12042 #+cindex: @samp{KEYWORDS}, keyword
12043 The keywords for defining the contents of the document. Use
12044 multiple =KEYWORDS= lines if necessary. By default, =hyperref=
12045 inserts =KEYWORDS= as metadata. Use
12046 ~org-latex-hyperref-template~ to configure document metadata.
12047 Use ~org-latex-title-command~ to configure typesetting of
12048 keywords as part of front matter.
12052 #+cindex: @samp{SUBTITLE}, keyword
12053 Document's subtitle. For typesetting, use
12054 ~org-beamer-subtitle-format~ string. Use
12055 ~org-latex-hyperref-template~ to configure document metadata.
12056 Use ~org-latex-title-command~ to configure typesetting of
12057 subtitle as part of front matter.
12059 *** Frames and Blocks in Beamer
12061 :DESCRIPTION: For composing Beamer slides.
12064 Org transforms heading levels into Beamer's sectioning elements,
12065 frames and blocks. Any Org tree with a not-too-deep-level nesting
12066 should in principle be exportable as a Beamer presentation.
12069 #+vindex: org-beamer-frame-level
12070 Org headlines become Beamer frames when the heading level in Org is
12071 equal to ~org-beamer-frame-level~ or =H= value in a =OPTIONS= line
12072 (see [[*Export Settings]]).
12074 #+cindex: @samp{BEAMER_ENV}, property
12075 Org overrides headlines to frames conversion for the current tree of
12076 an Org file if it encounters the =BEAMER_ENV= property set to
12077 =frame= or =fullframe=. Org ignores whatever
12078 ~org-beamer-frame-level~ happens to be for that headline level in
12079 the Org tree. In Beamer terminology, a full frame is a frame
12082 - Org exports a Beamer frame's objects as block environments. Org can
12083 enforce wrapping in special block types when =BEAMER_ENV= property
12084 is set[fn:118]. For valid values see
12085 ~org-beamer-environments-default~. To add more values, see
12086 ~org-beamer-environments-extra~.
12087 #+vindex: org-beamer-environments-default
12088 #+vindex: org-beamer-environments-extra
12091 #+cindex: @samp{BEAMER_REF}, property
12092 If =BEAMER_ENV= is set to =appendix=, Org exports the entry as an
12093 appendix. When set to =note=, Org exports the entry as a note
12094 within the frame or between frames, depending on the entry's heading
12095 level. When set to =noteNH=, Org exports the entry as a note
12096 without its title. When set to =againframe=, Org exports the entry
12097 with =\againframe= command, which makes setting the =BEAMER_REF=
12098 property mandatory because =\againframe= needs frame to resume.
12100 When =ignoreheading= is set, Org export ignores the entry's headline
12101 but not its content. This is useful for inserting content between
12102 frames. It is also useful for properly closing a =column=
12103 environment. @end itemize
12105 #+cindex: @samp{BEAMER_ACT}, property
12106 #+cindex: @samp{BEAMER_OPT}, property
12107 When =BEAMER_ACT= is set for a headline, Org export translates that
12108 headline as an overlay or action specification. When enclosed in
12109 square brackets, Org export makes the overlay specification
12110 a default. Use =BEAMER_OPT= to set any options applicable to the
12111 current Beamer frame or block. The Beamer export back-end wraps
12112 with appropriate angular or square brackets. It also adds the
12113 =fragile= option for any code that may require a verbatim block.
12115 #+cindex: @samp{BEAMER_COL}, property
12116 To create a column on the Beamer slide, use the =BEAMER_COL=
12117 property for its headline in the Org file. Set the value of
12118 =BEAMER_COL= to a decimal number representing the fraction of the
12119 total text width. Beamer export uses this value to set the column's
12120 width and fills the column with the contents of the Org entry. If
12121 the Org entry has no specific environment defined, Beamer export
12122 ignores the heading. If the Org entry has a defined environment,
12123 Beamer export uses the heading as title. Behind the scenes, Beamer
12124 export automatically handles LaTeX column separations for contiguous
12125 headlines. To manually adjust them for any unique configurations
12126 needs, use the =BEAMER_ENV= property.
12128 *** Beamer specific syntax
12130 :DESCRIPTION: For using in Org documents.
12133 Since Org's Beamer export back-end is an extension of the LaTeX
12134 back-end, it recognizes other LaTeX specific syntax---for example,
12135 =#+LATEX:= or =#+ATTR_LATEX:=. See [[*LaTeX Export]], for details.
12137 Beamer export wraps the table of contents generated with =toc:t=
12138 =OPTION= keyword in a =frame= environment. Beamer export does not
12139 wrap the table of contents generated with =TOC= keyword (see [[*Table of
12140 Contents]]). Use square brackets for specifying options.
12142 : #+TOC: headlines [currentsection]
12144 Insert Beamer-specific code using the following constructs:
12146 #+cindex: @samp{BEAMER}, keyword
12147 #+cindex: @samp{BEGIN_EXPORT beamer}
12151 ,#+BEGIN_EXPORT beamer
12152 Only Beamer export back-end exports this.
12155 Text @@beamer:some code@@ within a paragraph.
12158 Inline constructs, such as the last one above, are useful for adding
12159 overlay specifications to objects with ~bold~, ~item~, ~link~,
12160 ~radio-target~ and ~target~ types. Enclose the value in angular
12161 brackets and place the specification at the beginning of the object as
12162 shown in this example:
12164 : A *@@beamer:<2->@@useful* feature
12166 #+cindex: @samp{ATTR_BEAMER}, keyword
12167 Beamer export recognizes the =ATTR_BEAMER= keyword with the following
12168 attributes from Beamer configurations: =:environment= for changing
12169 local Beamer environment, =:overlay= for specifying Beamer overlays in
12170 angular or square brackets, and =:options= for inserting optional
12174 ,#+ATTR_BEAMER: :environment nonindentlist
12175 - item 1, not indented
12176 - item 2, not indented
12177 - item 3, not indented
12181 ,#+ATTR_BEAMER: :overlay <+->
12187 ,#+ATTR_BEAMER: :options [Lagrange]
12188 Let $G$ be a finite group, and let $H$ be
12189 a subgroup of $G$. Then the order of $H$ divides the order of $G$.
12192 *** Editing support
12194 :DESCRIPTION: Editing support.
12197 The ~org-beamer-mode~ is a special minor mode for faster editing of
12200 : #+STARTUP: beamer
12202 - {{{kbd(C-c C-b)}}} (~org-beamer-select-environment~) ::
12204 #+findex: org-beamer-select-environment
12206 The ~org-beamer-mode~ provides this key for quicker selections in
12207 Beamer normal environments, and for selecting the =BEAMER_COL=
12210 *** A Beamer example
12212 :DESCRIPTION: A complete presentation.
12215 Here is an example of an Org document ready for Beamer export.
12218 ;#+TITLE: Example Presentation
12219 ;#+AUTHOR: Carsten Dominik
12220 ;#+OPTIONS: H:2 toc:t num:t
12221 ;#+LATEX_CLASS: beamer
12222 ;#+LATEX_CLASS_OPTIONS: [presentation]
12223 ;#+BEAMER_THEME: Madrid
12224 ;#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) %8BEAMER_OPT(Opt)
12226 ,* This is the first structural section
12229 ,*** Thanks to Eric Fraga :B_block:
12234 for the first viable Beamer setup in Org
12235 ,*** Thanks to everyone else :B_block:
12241 for contributing to the discussion
12242 ,**** This will be formatted as a beamer note :B_note:
12246 ,** Frame 2 (where we will not use columns)
12248 Please test this stuff!
12253 :DESCRIPTION: Exporting to HTML.
12255 #+cindex: HTML export
12257 Org mode contains an HTML exporter with extensive HTML formatting
12258 compatible with XHTML 1.0 strict standard.
12260 *** HTML export commands
12262 :DESCRIPTION: Invoking HTML export.
12265 - {{{kbd(C-c C-e h h)}}} (~org-html-export-to-html~) ::
12266 #+kindex: C-c C-e h h
12267 #+kindex: C-c C-e h o
12268 #+findex: org-html-export-to-html
12270 Export as HTML file with a =.html= extension. For =myfile.org=,
12271 Org exports to =myfile.html=, overwriting without warning.
12272 {{{kbd{C-c C-e h o)}}} exports to HTML and opens it in a web
12275 - {{{kbd(C-c C-e h H)}}} (~org-html-export-as-html~) ::
12276 #+kindex: C-c C-e h H
12277 #+findex: org-html-export-as-html
12279 Exports to a temporary buffer. Does not create a file.
12281 *** HTML specific export settings
12283 :DESCRIPTION: Settings for HTML export.
12286 HTML export has a number of keywords, similar to the general options
12287 settings described in [[*Export Settings]].
12291 #+cindex: @samp{DESCRIPTION}, keyword
12292 This is the document's description, which the HTML exporter
12293 inserts it as a HTML meta tag in the HTML file. For long
12294 descriptions, use multiple =DESCRIPTION= lines. The exporter
12295 takes care of wrapping the lines properly.
12297 - =HTML_DOCTYPE= ::
12299 #+cindex: @samp{HTML_DOCTYPE}, keyword
12300 #+vindex: org-html-doctype
12301 Specify the document type, for example: HTML5
12302 (~org-html-doctype~).
12304 - =HTML_CONTAINER= ::
12306 #+cindex: @samp{HTML_CONTAINER}, keyword
12307 #+vindex: org-html-container-element
12308 Specify the HTML container, such as =div=, for wrapping sections
12309 and elements (~org-html-container-element~).
12311 - =HTML_LINK_HOME= ::
12313 #+cindex: @samp{HTML_LINK_HOME}, keyword
12314 #+vindex: org-html-link-home
12315 The URL for home link (~org-html-link-home~).
12317 - =HTML_LINK_UP= ::
12319 #+cindex: @samp{HTML_LINK_UP}, keyword
12320 #+vindex: org-html-link-up
12321 The URL for the up link of exported HTML pages
12322 (~org-html-link-up~).
12324 - =HTML_MATHJAX= ::
12326 #+cindex: @samp{HTML_MATHJAX}, keyword
12327 #+vindex: org-html-mathjax-options
12328 Options for MathJax (~org-html-mathjax-options~). MathJax is
12329 used to typeset LaTeX math in HTML documents. See [[*Math
12330 formatting in HTML export]], for an example.
12334 #+cindex: @samp{HTML_HEAD}, keyword
12335 #+vindex: org-html-head
12336 Arbitrary lines for appending to the HTML document's head
12339 - =HTML_HEAD_EXTRA= ::
12341 #+cindex: @samp{HTML_HEAD_EXTRA}, keyword
12342 #+vindex: org-html-head-extra
12343 More arbitrary lines for appending to the HTML document's head
12344 (~org-html-head-extra~).
12348 #+cindex: @samp{KEYWORDS}, keyword
12349 Keywords to describe the document's content. HTML exporter
12350 inserts these keywords as HTML meta tags. For long keywords, use
12351 multiple =KEYWORDS= lines.
12353 - =LATEX_HEADER= ::
12355 #+cindex: @samp{LATEX_HEADER}, keyword
12356 Arbitrary lines for appending to the preamble; HTML exporter
12357 appends when transcoding LaTeX fragments to images (see [[*Math
12358 formatting in HTML export]]).
12362 #+cindex: @samp{SUBTITLE}, keyword
12363 The document's subtitle. HTML exporter formats subtitle if
12364 document type is =HTML5= and the CSS has a =subtitle= class.
12366 Some of these keywords are explained in more detail in the following
12367 sections of the manual.
12371 :DESCRIPTION: Exporting various (X)HTML flavors.
12374 Org can export to various (X)HTML flavors.
12376 #+vindex: org-html-doctype
12377 #+vindex: org-html-doctype-alist
12378 Set the ~org-html-doctype~ variable for different (X)HTML variants.
12379 Depending on the variant, the HTML exporter adjusts the syntax of HTML
12380 conversion accordingly. Org includes the following ready-made
12384 - ~"html4-transitional"~
12385 - ~"html4-frameset"~
12387 - ~"xhtml-transitional"~
12388 - ~"xhtml-frameset"~
12393 #+texinfo: @noindent
12394 See the variable ~org-html-doctype-alist~ for details. The default is
12397 #+vindex: org-html-html5-fancy
12398 #+cindex: @samp{HTML5}, export new elements
12399 Org's HTML exporter does not by default enable new block elements
12400 introduced with the HTML5 standard. To enable them, set
12401 ~org-html-html5-fancy~ to non-~nil~. Or use an =OPTIONS= line in the
12402 file to set =html5-fancy=.
12404 HTML5 documents can now have arbitrary =#+BEGIN= ... =#+END= blocks.
12413 #+texinfo: @noindent
12422 #+texinfo: @noindent
12426 ,#+ATTR_HTML: :controls controls :width 350
12428 ,#+HTML: <source src="movie.mp4" type="video/mp4">
12429 ,#+HTML: <source src="movie.ogg" type="video/ogg">
12430 Your browser does not support the video tag.
12434 #+texinfo: @noindent
12438 <video controls="controls" width="350">
12439 <source src="movie.mp4" type="video/mp4">
12440 <source src="movie.ogg" type="video/ogg">
12441 <p>Your browser does not support the video tag.</p>
12445 #+vindex: org-html-html5-elements
12446 When special blocks do not have a corresponding HTML5 element, the
12447 HTML exporter reverts to standard translation (see
12448 ~org-html-html5-elements~). For example, =#+BEGIN_lederhosen= exports
12449 to ~<div class="lederhosen">~.
12451 Special blocks cannot have headlines. For the HTML exporter to wrap
12452 the headline and its contents in ~<section>~ or ~<article>~ tags, set
12453 the =HTML_CONTAINER= property for the headline.
12455 *** HTML preamble and postamble
12457 :DESCRIPTION: Inserting preamble and postamble.
12459 #+vindex: org-html-preamble
12460 #+vindex: org-html-postamble
12461 #+vindex: org-html-preamble-format
12462 #+vindex: org-html-postamble-format
12463 #+vindex: org-html-validation-link
12464 #+vindex: org-export-creator-string
12465 #+vindex: org-export-time-stamp-file
12467 The HTML exporter has delineations for preamble and postamble. The
12468 default value for ~org-html-preamble~ is ~t~, which makes the HTML
12469 exporter insert the preamble. See the variable
12470 ~org-html-preamble-format~ for the format string.
12472 Set ~org-html-preamble~ to a string to override the default format
12473 string. If the string is a function, the HTML exporter expects the
12474 function to return a string upon execution. The HTML exporter inserts
12475 this string in the preamble. The HTML exporter does not insert
12476 a preamble if ~org-html-preamble~ is set ~nil~.
12478 The default value for ~org-html-postamble~ is ~auto~, which makes the
12479 HTML exporter build a postamble from looking up author's name, email
12480 address, creator's name, and date. Set ~org-html-postamble~ to ~t~ to
12481 insert the postamble in the format specified in the
12482 ~org-html-postamble-format~ variable. The HTML exporter does not
12483 insert a postamble if ~org-html-postamble~ is set to ~nil~.
12485 *** Quoting HTML tags
12487 :DESCRIPTION: Using direct HTML in Org files.
12490 The HTML export back-end transforms =<= and =>= to =<= and =>=.
12492 To include raw HTML code in the Org file so the HTML export back-end
12493 can insert that HTML code in the output, use this inline syntax:
12494 =@@html:...@@=. For example:
12496 : @@html:<b>@@bold text@@html:</b>@@
12498 #+cindex: @samp{HTML}, keyword
12499 #+cindex: @samp{BEGIN_EXPORT html}
12500 For larger raw HTML code blocks, use these HTML export code blocks:
12503 ,#+HTML: Literal HTML code for export
12505 ,#+BEGIN_EXPORT html
12506 All lines between these markers are exported literally
12510 *** Links in HTML export
12512 :DESCRIPTION: Inserting and formatting links.
12514 #+cindex: links, in HTML export
12515 #+cindex: internal links, in HTML export
12516 #+cindex: external links, in HTML export
12518 The HTML export back-end transforms Org's internal links (see
12519 [[*Internal Links]]) to equivalent HTML links in the output. The back-end
12520 similarly handles Org's automatic links created by radio targets (see
12521 [[*Radio Targets]]) similarly. For Org links to external files, the
12522 back-end transforms the links to /relative/ paths.
12524 #+vindex: org-html-link-org-files-as-html
12525 For Org links to other =.org= files, the back-end automatically
12526 changes the file extension to =.html= and makes file paths relative.
12527 If the =.org= files have an equivalent =.html= version at the same
12528 location, then the converted links should work without any further
12529 manual intervention. However, to disable this automatic path
12530 translation, set ~org-html-link-org-files-as-html~ to ~nil~. When
12531 disabled, the HTML export back-end substitutes the ID-based links in
12532 the HTML output. For more about linking files when publishing to
12533 a directory, see [[*Publishing links]].
12535 Org files can also have special directives to the HTML export
12536 back-end. For example, by using =#+ATTR_HTML= lines to specify new
12537 format attributes to ~<a>~ or ~<img>~ tags. This example shows
12538 changing the link's title and style:
12540 #+cindex: @samp{ATTR_HTML}, keyword
12542 ,#+ATTR_HTML: :title The Org mode homepage :style color:red;
12543 [[https://orgmode.org]]
12546 *** Tables in HTML export
12548 :DESCRIPTION: How to modify the formatting of tables.
12550 #+cindex: tables, in HTML
12551 #+vindex: org-export-html-table-tag
12553 The HTML export back-end uses ~org-html-table-default-attributes~ when
12554 exporting Org tables to HTML. By default, the exporter does not draw
12555 frames and cell borders. To change for this for a table, use the
12556 following lines before the table in the Org file:
12558 #+cindex: @samp{CAPTION}, keyword
12559 #+cindex: @samp{ATTR_HTML}, keyword
12561 ,#+CAPTION: This is a table with lines around and between cells
12562 ,#+ATTR_HTML: border="2" rules="all" frame="border"
12565 The HTML export back-end preserves column groupings in Org tables (see
12566 [[*Column Groups]]) when exporting to HTML.
12568 Additional options for customizing tables for HTML export.
12570 - ~org-html-table-align-individual-fields~ ::
12572 #+vindex: org-html-table-align-individual-fields
12573 Non-~nil~ attaches style attributes for alignment to each table
12576 - ~org-html-table-caption-above~ ::
12578 #+vindex: org-html-table-caption-above
12579 Non-~nil~ places caption string at the beginning of the table.
12581 - ~org-html-table-data-tags~ ::
12583 #+vindex: org-html-table-data-tags
12584 Opening and ending tags for table data fields.
12586 - ~org-html-table-default-attributes~ ::
12588 #+vindex: org-html-table-default-attributes
12589 Default attributes and values for table tags.
12591 - ~org-html-table-header-tags~ ::
12593 #+vindex: org-html-table-header-tags
12594 Opening and ending tags for table's header fields.
12596 - ~org-html-table-row-tags~ ::
12598 #+vindex: org-html-table-row-tags
12599 Opening and ending tags for table rows.
12601 - ~org-html-table-use-header-tags-for-first-column~ ::
12603 #+vindex: org-html-table-use-header-tags-for-first-column
12604 Non-~nil~ formats column one in tables with header tags.
12606 *** Images in HTML export
12608 :DESCRIPTION: How to insert figures into HTML output.
12610 #+cindex: images, inline in HTML
12611 #+cindex: inlining images in HTML
12613 The HTML export back-end has features to convert Org image links to
12614 HTML inline images and HTML clickable image links.
12616 #+vindex: org-html-inline-images
12617 When the link in the Org file has no description, the HTML export
12618 back-end by default in-lines that image. For example:
12619 =[[file:myimg.jpg]]= is in-lined, while =[[file:myimg.jpg][the image]]= links to the text,
12620 =the image=. For more details, see the variable
12621 ~org-html-inline-images~.
12623 On the other hand, if the description part of the Org link is itself
12624 another link, such as =file:= or =http:= URL pointing to an image, the
12625 HTML export back-end in-lines this image and links to the main image.
12626 This Org syntax enables the back-end to link low-resolution thumbnail
12627 to the high-resolution version of the image, as shown in this example:
12629 : [[file:highres.jpg][file:thumb.jpg]]
12631 To change attributes of in-lined images, use =#+ATTR_HTML= lines in
12632 the Org file. This example shows realignment to right, and adds ~alt~
12633 and ~title~ attributes in support of text viewers and modern web
12634 accessibility standards.
12636 #+cindex: @samp{CAPTION}, keyword
12637 #+cindex: @samp{ATTR_HTML}, keyword
12639 ,#+CAPTION: A black cat stalking a spider
12640 ,#+ATTR_HTML: :alt cat/spider image :title Action! :align right
12644 #+texinfo: @noindent
12645 The HTML export back-end copies the =http= links from the Org file as
12648 *** Math formatting in HTML export
12650 :DESCRIPTION: Beautiful math also on the web.
12655 #+cindex: ImageMagick
12657 #+vindex: org-html-mathjax-options~
12658 LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two
12659 different ways on HTML pages. The default is to use the [[http://www.mathjax.org][MathJax]],
12660 which should work out of the box with Org[fn:119]. Some MathJax
12661 display options can be configured via ~org-html-mathjax-options~, or
12662 in the buffer. For example, with the following settings,
12665 ,#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
12666 ,#+HTML_MATHJAX: cancel.js noErrors.js
12669 #+texinfo: @noindent
12670 equation labels are displayed on the left margin and equations are
12671 five em from the left margin. In addition, it loads the two MathJax
12672 extensions =cancel.js= and =noErrors.js=[fn:120].
12674 #+vindex: org-html-mathjax-template
12675 See the docstring of ~org-html-mathjax-options~ for all supported
12676 variables. The MathJax template can be configure via
12677 ~org-html-mathjax-template~.
12679 If you prefer, you can also request that LaTeX fragments are processed
12680 into small images that will be inserted into the browser page. Before
12681 the availability of MathJax, this was the default method for Org
12682 files. This method requires that the dvipng program, dvisvgm or
12683 ImageMagick suite is available on your system. You can still get this
12686 : #+OPTIONS: tex:dvipng
12688 : #+OPTIONS: tex:dvisvgm
12690 #+texinfo: @noindent
12693 : #+OPTIONS: tex:imagemagick
12695 *** Text areas in HTML export
12697 :DESCRIPTION: An alternate way to show an example.
12700 #+cindex: text areas, in HTML
12701 Before Org mode's Babel, one popular approach to publishing code in
12702 HTML was by using =:textarea=. The advantage of this approach was
12703 that copying and pasting was built into browsers with simple
12704 JavaScript commands. Even editing before pasting was made simple.
12706 The HTML export back-end can create such text areas. It requires an
12707 =#+ATTR_HTML= line as shown in the example below with the =:textarea=
12708 option. This must be followed by either an example or a source code
12709 block. Other Org block types do not honor the =:textarea= option.
12711 By default, the HTML export back-end creates a text area 80 characters
12712 wide and height just enough to fit the content. Override these
12713 defaults with =:width= and =:height= options on the =#+ATTR_HTML=
12717 ,#+ATTR_HTML: :textarea t :width 40
12719 (defun org-xor (a b)
12727 :DESCRIPTION: Changing the appearance of the output.
12729 #+cindex: CSS, for HTML export
12730 #+cindex: HTML export, CSS
12732 #+vindex: org-export-html-todo-kwd-class-prefix
12733 #+vindex: org-export-html-tag-class-prefix
12734 You can modify the CSS style definitions for the exported file. The
12735 HTML exporter assigns the following special CSS classes[fn:121] to
12736 appropriate parts of the document---your style specifications may
12737 change these, in addition to any of the standard classes like for
12738 headlines, tables, etc.
12740 | ~p.author~ | author information, including email |
12741 | ~p.date~ | publishing date |
12742 | ~p.creator~ | creator info, about org mode version |
12743 | ~.title~ | document title |
12744 | ~.subtitle~ | document subtitle |
12745 | ~.todo~ | TODO keywords, all not-done states |
12746 | ~.done~ | the DONE keywords, all states that count as done |
12747 | ~.WAITING~ | each TODO keyword also uses a class named after itself |
12748 | ~.timestamp~ | timestamp |
12749 | ~.timestamp-kwd~ | keyword associated with a timestamp, like =SCHEDULED= |
12750 | ~.timestamp-wrapper~ | span around keyword plus timestamp |
12751 | ~.tag~ | tag in a headline |
12752 | ~._HOME~ | each tag uses itself as a class, "@" replaced by "_" |
12753 | ~.target~ | target for links |
12754 | ~.linenr~ | the line number in a code example |
12755 | ~.code-highlighted~ | for highlighting referenced code lines |
12756 | ~div.outline-N~ | div for outline level N (headline plus text) |
12757 | ~div.outline-text-N~ | extra div for text at outline level N |
12758 | ~.section-number-N~ | section number in headlines, different for each level |
12759 | ~.figure-number~ | label like "Figure 1:" |
12760 | ~.table-number~ | label like "Table 1:" |
12761 | ~.listing-number~ | label like "Listing 1:" |
12762 | ~div.figure~ | how to format an in-lined image |
12763 | ~pre.src~ | formatted source code |
12764 | ~pre.example~ | normal example |
12765 | ~p.verse~ | verse paragraph |
12766 | ~div.footnotes~ | footnote section headline |
12767 | ~p.footnote~ | footnote definition paragraph, containing a footnote |
12768 | ~.footref~ | a footnote reference number (always a <sup>) |
12769 | ~.footnum~ | footnote number in footnote definition (always <sup>) |
12770 | ~.org-svg~ | default class for a linked =.svg= image |
12772 #+vindex: org-html-style-default
12773 #+vindex: org-html-head
12774 #+vindex: org-html-head-extra
12775 #+cindex: @samp{HTML_INCLUDE_STYLE}, keyword
12776 The HTML export back-end includes a compact default style in each
12777 exported HTML file. To override the default style with another style,
12778 use these keywords in the Org file. They will replace the global
12779 defaults the HTML exporter uses.
12781 #+cindex: @samp{HTML_HEAD}, keyword
12782 #+cindex: @samp{HTML_HEAD_EXTRA}, keyword
12784 ,#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
12785 ,#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
12788 #+vindex: org-html-head-include-default-style
12789 To just turn off the default style, customize
12790 ~org-html-head-include-default-style~ variable, or use this option
12791 line in the Org file.
12793 #+cindex: @samp{html-style}, @samp{OPTIONS} item
12794 : #+OPTIONS: html-style:nil
12796 For longer style definitions, either use several =HTML_HEAD= and
12797 =HTML_HEAD_EXTRA= keywords, or use ~<style> ... </style>~ blocks
12798 around them. Both of these approaches can avoid referring to an
12801 #+cindex: @samp{HTML_CONTAINER_CLASS}, property
12802 In order to add styles to a sub-tree, use the =HTML_CONTAINER_CLASS=
12803 property to assign a class to the tree. In order to specify CSS
12804 styles for a particular headline, you can use the id specified in
12805 a =CUSTOM_ID= property.
12807 Never change the ~org-html-style-default~ constant. Instead use other
12808 simpler ways of customizing as described above.
12810 *** JavaScript supported display of web pages
12812 :DESCRIPTION: Info and folding in a web browser.
12813 :ALT_TITLE: JavaScript support
12816 Sebastian Rose has written a JavaScript program especially designed to
12817 enhance the web viewing experience of HTML files created with Org.
12818 This program enhances large files in two different ways of viewing.
12819 One is an /Info/-like mode where each section is displayed separately
12820 and navigation can be done with the {{{kbd(n)}}} and {{{kbd(p)}}}
12821 keys, and some other keys as well, press {{{kbd(?)}}} for an overview
12822 of the available keys. The second one has a /folding/ view, much like
12823 Org provides inside Emacs. The script is available at
12824 https://orgmode.org/org-info.js and the documentation at
12825 https://orgmode.org/worg/code/org-info-js/. The script is hosted on
12826 https://orgmode.org, but for reliability, prefer installing it on your
12829 To use this program, just add this line to the Org file:
12831 #+cindex: @samp{INFOJS_OPT}, keyword
12832 : #+INFOJS_OPT: view:info toc:nil
12834 #+texinfo: @noindent
12835 The HTML header now has the code needed to automatically invoke the
12836 script. For setting options, use the syntax from the above line for
12837 options described below:
12841 The path to the script. The default is to grab the script from
12842 [[https://orgmode.org/org-info.js]], but you might want to have
12843 a local copy and use a path like =../scripts/org-info.js=.
12847 Initial view when the website is first shown. Possible values are:
12849 | =info= | Info-like interface with one section per page |
12850 | =overview= | Folding interface, initially showing only top-level |
12851 | =content= | Folding interface, starting with all headlines visible |
12852 | =showall= | Folding interface, all headlines and text visible |
12856 Maximum headline level still considered as an independent section
12857 for info and folding modes. The default is taken from
12858 ~org-export-headline-levels~, i.e., the =H= switch in =OPTIONS=.
12859 If this is smaller than in ~org-export-headline-levels~, each
12860 info/folding section can still contain child headlines.
12864 Should the table of contents /initially/ be visible? Even when
12865 =nil=, you can always get to the "toc" with {{{kbd(i)}}}.
12869 The depth of the table of contents. The defaults are taken from
12870 the variables ~org-export-headline-levels~ and
12871 ~org-export-with-toc~.
12875 Does the CSS of the page specify a fixed position for the "toc"?
12876 If yes, the toc is displayed as a section.
12880 Should there be short contents (children) in each section? Make
12881 this =above= if the section should be above initial text.
12885 Headings are highlighted when the mouse is over them. Should be
12886 =underline= (default) or a background color like =#cccccc=.
12890 Should view-toggle buttons be everywhere? When =nil= (the
12891 default), only one such button is present.
12893 #+texinfo: @noindent
12894 #+vindex: org-infojs-options
12895 #+vindex: org-export-html-use-infojs
12896 You can choose default values for these options by customizing the
12897 variable ~org-infojs-options~. If you always want to apply the script
12898 to your pages, configure the variable ~org-export-html-use-infojs~.
12902 :DESCRIPTION: Exporting to @LaTeX{} and processing to PDF.
12904 #+cindex: @LaTeX{} export
12905 #+cindex: PDF export
12907 The LaTeX export back-end can handle complex documents, incorporate
12908 standard or custom LaTeX document classes, generate documents using
12909 alternate LaTeX engines, and produce fully linked PDF files with
12910 indexes, bibliographies, and tables of contents, destined for
12911 interactive online viewing or high-quality print publication.
12913 While the details are covered in-depth in this section, here are some
12914 quick references to variables for the impatient: for engines, see
12915 ~org-latex-compiler~; for build sequences, see
12916 ~org-latex-pdf-process~; for packages, see
12917 ~org-latex-default-packages-alist~ and ~org-latex-packages-alist~.
12919 An important note about the LaTeX export back-end: it is sensitive to
12920 blank lines in the Org document. That's because LaTeX itself depends
12921 on blank lines to tell apart syntactical elements, such as paragraphs.
12923 *** LaTeX/PDF export commands
12925 :DESCRIPTION: For producing @LaTeX{} and PDF documents.
12928 - {{{kbd(C-c C-e l l)}}} (~org-latex-export-to-latex~) ::
12930 #+kindex: C-c C-e l l
12931 #+findex: org-latex-export-to-latex~
12932 Export to a LaTeX file with a =.tex= extension. For
12933 =myfile.org=, Org exports to =myfile.tex=, overwriting without
12936 - {{{kbd(C-c C-e l L)}}} (~org-latex-export-as-latex~) ::
12938 #+kindex: C-c C-e l L
12939 #+findex: org-latex-export-as-latex
12940 Export to a temporary buffer. Do not create a file.
12942 - {{{kbd(C-c C-e l p)}}} (~org-latex-export-to-pdf~) ::
12944 #+kindex: C-c C-e l p
12945 #+findex: org-latex-export-to-pdf
12946 Export as LaTeX file and convert it to PDF file.
12948 - {{{kbd(C-c C-e l o)}}} ::
12950 #+kindex: C-c C-e l o
12951 Export as LaTeX file and convert it to PDF, then open the PDF
12952 using the default viewer.
12954 - {{{kbd(M-x org-export-region-as-latex)}}} ::
12956 Convert the region to LaTeX under the assumption that it was in Org
12957 mode syntax before. This is a global command that can be invoked in
12960 #+vindex: org-latex-compiler
12961 #+vindex: org-latex-bibtex-compiler
12962 #+vindex: org-latex-default-packages-alist
12966 #+cindex: @samp{LATEX_COMPILER}, keyword
12967 The LaTeX export back-end can use any of these LaTeX engines:
12968 =pdflatex=, =xelatex=, and =lualatex=. These engines compile LaTeX
12969 files with different compilers, packages, and output options. The
12970 LaTeX export back-end finds the compiler version to use from
12971 ~org-latex-compiler~ variable or the =#+LATEX_COMPILER= keyword in the
12972 Org file. See the docstring for the
12973 ~org-latex-default-packages-alist~ for loading packages with certain
12974 compilers. Also see ~org-latex-bibtex-compiler~ to set the
12975 bibliography compiler[fn:122].
12977 *** LaTeX specific export settings
12979 :DESCRIPTION: Unique to this @LaTeX{} back-end.
12982 The LaTeX export back-end has several additional keywords for
12983 customizing LaTeX output. Setting these keywords works similar to the
12984 general options (see [[*Export Settings]]).
12986 #+attr_texinfo: :sep ,
12988 #+cindex: @samp{DESCRIPTION}, keyword
12989 #+vindex: org-latex-hyperref-template
12990 #+vindex: org-latex-title-command
12991 The document's description. The description along with author
12992 name, keywords, and related file metadata are inserted in the
12993 output file by the hyperref package. See
12994 ~org-latex-hyperref-template~ for customizing metadata items.
12995 See ~org-latex-title-command~ for typesetting description into
12996 the document's front matter. Use multiple =DESCRIPTION= keywords
12997 for long descriptions.
13001 #+cindex: @samp{LATEX_CLASS}, keyword
13002 #+vindex: org-latex-default-class
13003 #+vindex: org-latex-classes
13004 This is LaTeX document class, such as /article/, /report/,
13005 /book/, and so on, which contain predefined preamble and headline
13006 level mapping that the LaTeX export back-end needs. The back-end
13007 reads the default class name from the ~org-latex-default-class~
13008 variable. Org has /article/ as the default class. A valid
13009 default class must be an element of ~org-latex-classes~.
13011 - =LATEX_CLASS_OPTIONS= ::
13013 #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword
13014 Options the LaTeX export back-end uses when calling the LaTeX
13017 - =LATEX_COMPILER= ::
13019 #+cindex: @samp{LATEX_COMPILER}, keyword
13020 #+vindex: org-latex-compiler
13021 The compiler, such as =pdflatex=, =xelatex=, =lualatex=, for
13022 producing the PDF. See ~org-latex-compiler~.
13024 - =LATEX_HEADER=, =LATEX_HEADER_EXTRA= ::
13026 #+cindex: @samp{LATEX_HEADER}, keyword
13027 #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword
13028 #+vindex: org-latex-classes
13029 Arbitrary lines to add to the document's preamble, before the
13030 hyperref settings. See ~org-latex-classes~ for adjusting the
13031 structure and order of the LaTeX headers.
13035 #+cindex: @samp{KEYWORDS}, keyword
13036 #+vindex: org-latex-hyperref-template
13037 #+vindex: org-latex-title-command
13038 The keywords for the document. The description along with author
13039 name, keywords, and related file metadata are inserted in the
13040 output file by the hyperref package. See
13041 ~org-latex-hyperref-template~ for customizing metadata items.
13042 See ~org-latex-title-command~ for typesetting description into
13043 the document's front matter. Use multiple =KEYWORDS= lines if
13048 #+cindex: @samp{SUBTITLE}, keyword
13049 #+vindex: org-latex-subtitle-separate
13050 #+vindex: org-latex-subtitle-format
13051 The document's subtitle. It is typeset as per
13052 ~org-latex-subtitle-format~. If ~org-latex-subtitle-separate~ is
13053 non-~nil~, it is typed as part of the ~\title~ macro. See
13054 ~org-latex-hyperref-template~ for customizing metadata items.
13055 See ~org-latex-title-command~ for typesetting description
13056 into the document's front matter.
13058 The following sections have further details.
13060 *** LaTeX header and sectioning structure
13062 :DESCRIPTION: Setting up the export file structure.
13063 :ALT_TITLE: LaTeX header and sectioning
13065 #+cindex: @LaTeX{} class
13066 #+cindex: @LaTeX{} sectioning structure
13067 #+cindex: @LaTeX{} header
13068 #+cindex: header, for @LaTeX{} files
13069 #+cindex: sectioning structure, for @LaTeX{} export
13071 The LaTeX export back-end converts the first three of Org's outline
13072 levels into LaTeX headlines. The remaining Org levels are exported as
13073 lists. To change this globally for the cut-off point between levels
13074 and lists, (see [[*Export Settings]]).
13076 By default, the LaTeX export back-end uses the /article/ class.
13078 #+vindex: org-latex-default-class
13079 #+vindex: org-latex-classes
13080 #+vindex: org-latex-default-packages-alist
13081 #+vindex: org-latex-packages-alist
13082 To change the default class globally, edit ~org-latex-default-class~.
13083 To change the default class locally in an Org file, add option lines
13084 =#+LATEX_CLASS: myclass=. To change the default class for just a part
13085 of the Org file, set a sub-tree property, =EXPORT_LATEX_CLASS=. The
13086 class name entered here must be valid member of ~org-latex-classes~.
13087 This variable defines a header template for each class into which the
13088 exporter splices the values of ~org-latex-default-packages-alist~ and
13089 ~org-latex-packages-alist~. Use the same three variables to define
13090 custom sectioning or custom classes.
13092 #+cindex: @samp{LATEX_CLASS}, keyword
13093 #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword
13094 #+cindex: @samp{EXPORT_LATEX_CLASS}, property
13095 #+cindex: @samp{EXPORT_LATEX_CLASS_OPTIONS}, property
13096 The LaTeX export back-end sends the =LATEX_CLASS_OPTIONS= keyword and
13097 =EXPORT_LATEX_CLASS_OPTIONS= property as options to the LaTeX
13098 ~\documentclass~ macro. The options and the syntax for specifying
13099 them, including enclosing them in square brackets, follow LaTeX
13102 : #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
13104 #+cindex: @samp{LATEX_HEADER}, keyword
13105 #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword
13106 The LaTeX export back-end appends values from =LATEX_HEADER= and
13107 =LATEX_HEADER_EXTRA= keywords to the LaTeX header. The docstring for
13108 ~org-latex-classes~ explains in more detail. Also note that LaTeX
13109 export back-end does not append =LATEX_HEADER_EXTRA= to the header
13110 when previewing LaTeX snippets (see [[*Previewing LaTeX fragments]]).
13112 A sample Org file with the above headers:
13115 ,#+LATEX_CLASS: article
13116 ,#+LATEX_CLASS_OPTIONS: [a4paper]
13117 ,#+LATEX_HEADER: \usepackage{xyz}
13125 *** Quoting LaTeX code
13127 :DESCRIPTION: Incorporating literal @LaTeX{} code.
13130 The LaTeX export back-end can insert any arbitrary LaTeX code, see
13131 [[*Embedded LaTeX]]. There are three ways to embed such code in the Org
13132 file and they all use different quoting syntax.
13134 #+cindex: inline, in @LaTeX{} export
13135 Inserting in-line quoted with @ symbols:
13137 : Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph.
13139 #+cindex: @samp{LATEX}, keyword
13140 Inserting as one or more keyword lines in the Org file:
13142 : #+LATEX: any arbitrary LaTeX code
13144 #+cindex: @samp{BEGIN_EXPORT latex}
13145 Inserting as an export block in the Org file, where the back-end
13146 exports any code between begin and end markers:
13149 ,#+BEGIN_EXPORT latex
13150 any arbitrary LaTeX code
13154 *** Tables in LaTeX export
13156 :DESCRIPTION: Options for exporting tables to @LaTeX{}.
13158 #+cindex: tables, in @LaTeX{} export
13160 The LaTeX export back-end can pass several LaTeX attributes for table
13161 contents and layout. Besides specifying label and caption (see
13162 [[*Images and Tables]]), the other valid LaTeX attributes include:
13164 #+attr_texinfo: :sep ,
13167 #+vindex: org-latex-default-table-mode
13168 The LaTeX export back-end wraps the table differently depending
13169 on the mode for accurate rendering of math symbols. Mode is
13170 either =table=, =math=, =inline-math= or =verbatim=.
13172 For =math= or =inline-math= mode, LaTeX export back-end wraps the
13173 table in a math environment, but every cell in it is exported
13174 as-is. The LaTeX export back-end determines the default mode
13175 from ~org-latex-default-table-mode~. The LaTeX export back-end
13176 merges contiguous tables in the same mode into a single
13179 - =:environment= ::
13181 #+vindex: org-latex-default-table-environment
13182 Set the default LaTeX table environment for the LaTeX export
13183 back-end to use when exporting Org tables. Common LaTeX table
13184 environments are provided by these packages: tabularx, longtable,
13185 array, tabu, and bmatrix. For packages, such as tabularx and
13186 tabu, or any newer replacements, include them in the
13187 ~org-latex-packages-alist~ variable so the LaTeX export back-end
13188 can insert the appropriate load package headers in the converted
13189 LaTeX file. Look in the docstring for the
13190 ~org-latex-packages-alist~ variable for configuring these
13191 packages for LaTeX snippet previews, if any.
13195 Use =CAPTION= keyword to set a simple caption for a table (see
13196 [[*Images and Tables]]). For custom captions, use =:caption=
13197 attribute, which accepts raw LaTeX code. =:caption= value
13198 overrides =CAPTION= value.
13200 - =:float=, =:placement= ::
13202 The table environments by default are not floats in LaTeX. To
13203 make them floating objects use =:float= with one of the following
13204 options: =sideways=, =multicolumn=, =t=, and =nil=.
13206 LaTeX floats can also have additional layout =:placement=
13207 attributes. These are the usual =[h t b p ! H]= permissions
13208 specified in square brackets. Note that for =:float sideways=
13209 tables, the LaTeX export back-end ignores =:placement=
13212 - =:align=, =:font=, =:width= ::
13214 The LaTeX export back-end uses these attributes for regular
13215 tables to set their alignments, fonts, and widths.
13219 When =:spread= is non-~nil~, the LaTeX export back-end spreads or
13220 shrinks the table by the =:width= for tabu and longtabu
13221 environments. =:spread= has no effect if =:width= is not set.
13223 - =:booktabs=, =:center=, =:rmlines= ::
13225 #+vindex: org-latex-tables-booktabs
13226 #+vindex: org-latex-tables-centered
13227 All three commands are toggles. =:booktabs= brings in modern
13228 typesetting enhancements to regular tables. The booktabs package
13229 has to be loaded through ~org-latex-packages-alist~. =:center=
13230 is for centering the table. =:rmlines= removes all but the very
13231 first horizontal line made of ASCII characters from "table.el"
13234 - =:math-prefix=, =:math-suffix=, =:math-arguments= ::
13236 The LaTeX export back-end inserts =:math-prefix= string value in
13237 a math environment before the table. The LaTeX export back-end
13238 inserts =:math-suffix= string value in a math environment after
13239 the table. The LaTeX export back-end inserts =:math-arguments=
13240 string value between the macro name and the table's contents.
13241 =:math-arguments= comes in use for matrix macros that require
13242 more than one argument, such as =qbordermatrix=.
13244 LaTeX table attributes help formatting tables for a wide range of
13245 situations, such as matrix product or spanning multiple pages:
13248 ,#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
13252 ,#+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
13255 ,#+ATTR_LATEX: :mode math :environment bmatrix
13260 Set the caption with the LaTeX command
13261 =\bicaption{HeadingA}{HeadingB}=:
13264 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
13269 *** Images in LaTeX export
13271 :DESCRIPTION: How to insert figures into @LaTeX{} output.
13273 #+cindex: images, inline in LaTeX
13274 #+cindex: inlining images in LaTeX
13275 #+cindex: @samp{ATTR_LATEX}, keyword
13277 The LaTeX export back-end processes image links in Org files that do
13278 not have descriptions, such as these links =[[file:img.jpg]]= or
13279 =[[./img.jpg]]=, as direct image insertions in the final PDF output. In
13280 the PDF, they are no longer links but actual images embedded on the
13281 page. The LaTeX export back-end uses =\includegraphics= macro to
13282 insert the image. But for TikZ (http://sourceforge.net/projects/pgf/)
13283 images, the back-end uses an ~\input~ macro wrapped within
13284 a ~tikzpicture~ environment.
13286 For specifying image =:width=, =:height=, and other =:options=, use
13290 ,#+ATTR_LATEX: :width 5cm :options angle=90
13291 [[./img/sed-hr4049.pdf]]
13294 For custom commands for captions, use the =:caption= attribute. It
13295 overrides the default =#+CAPTION= value:
13298 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
13299 [[./img/sed-hr4049.pdf]]
13302 When captions follow the method as described in [[*Images and Tables]],
13303 the LaTeX export back-end wraps the picture in a floating =figure=
13304 environment. To float an image without specifying a caption, set the
13305 =:float= attribute to one of the following:
13309 For a standard =figure= environment; used by default whenever an
13310 image has a caption.
13314 To span the image across multiple columns of a page; the back-end
13315 wraps the image in a =figure*= environment.
13319 For text to flow around the image on the right; the figure
13320 occupies the left half of the page.
13324 For a new page with the image sideways, rotated ninety degrees,
13325 in a =sidewaysfigure= environment; overrides =:placement=
13330 To avoid a =:float= even if using a caption.
13332 #+texinfo: @noindent
13333 Use the =placement= attribute to modify a floating environment's
13337 ,#+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement {r}{0.4\textwidth}
13341 #+vindex: org-latex-images-centered
13342 #+cindex: center image in LaTeX export
13343 #+cindex: image, centering in LaTeX export
13344 The LaTeX export back-end centers all images by default. Setting
13345 =:center= to =nil= disables centering. To disable centering globally,
13346 set ~org-latex-images-centered~ to =t=.
13348 Set the =:comment-include= attribute to non-~nil~ value for the LaTeX
13349 export back-end to comment out the =\includegraphics= macro.
13351 *** Plain lists in LaTeX export
13353 :DESCRIPTION: Attributes specific to lists.
13356 #+cindex: plain lists, in @LaTeX{} export
13357 #+cindex: @samp{ATTR_LATEX}, keyword
13358 The LaTeX export back-end accepts the =environment= and =options=
13359 attributes for plain lists. Both attributes work together for
13360 customizing lists, as shown in the examples:
13363 ,#+LATEX_HEADER: \usepackage[inline]{enumitem}
13364 Some ways to say "Hello":
13365 ,#+ATTR_LATEX: :environment itemize*
13366 ,#+ATTR_LATEX: :options [label={}, itemjoin={,}, itemjoin*={, and}]
13372 Since LaTeX supports only four levels of nesting for lists, use an
13373 external package, such as =enumitem= in LaTeX, for levels deeper than
13377 ,#+LATEX_HEADER: \usepackage{enumitem}
13378 ,#+LATEX_HEADER: \renewlist{itemize}{itemize}{9}
13379 ,#+LATEX_HEADER: \setlist[itemize]{label=$\circ$}
13387 *** Source blocks in LaTeX export
13389 :DESCRIPTION: Attributes specific to source code blocks.
13391 #+cindex: source blocks, in @LaTeX{} export
13392 #+cindex: @samp{ATTR_LATEX}, keyword
13394 The LaTeX export back-end can make source code blocks into floating
13395 objects through the attributes =:float= and =:options=. For =:float=:
13399 Makes a source block float; by default floats any source block
13404 Spans the source block across multiple columns of a page.
13408 Avoids a =:float= even if using a caption; useful for source code
13409 blocks that may not fit on a page.
13412 ,#+ATTR_LATEX: :float nil
13413 ,#+BEGIN_SRC emacs-lisp
13414 Lisp code that may not fit in a single page.
13418 #+vindex: org-latex-listings-options
13419 #+vindex: org-latex-minted-options
13420 The LaTeX export back-end passes string values in =:options= to LaTeX
13421 packages for customization of that specific source block. In the
13422 example below, the =:options= are set for Minted. Minted is a source
13423 code highlighting LaTeX package with many configurable options.
13426 ,#+ATTR_LATEX: :options commentstyle=\bfseries
13427 ,#+BEGIN_SRC emacs-lisp
13429 (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
13433 To apply similar configuration options for all source blocks in
13434 a file, use the ~org-latex-listings-options~ and
13435 ~org-latex-minted-options~ variables.
13437 *** Example blocks in LaTeX export
13439 :DESCRIPTION: Attributes specific to example blocks.
13441 #+cindex: example blocks, in @LaTeX{} export
13442 #+cindex: verbatim blocks, in @LaTeX{} export
13443 #+cindex: @samp{ATTR_LATEX}, keyword
13445 The LaTeX export back-end wraps the contents of example blocks in
13446 a =verbatim= environment. To change this behavior to use another
13447 environment globally, specify an appropriate export filter (see
13448 [[*Advanced Configuration]]). To change this behavior to use another
13449 environment for each block, use the =:environment= parameter to
13450 specify a custom environment.
13453 ,#+ATTR_LATEX: :environment myverbatim
13455 This sentence is false.
13459 *** Special blocks in LaTeX export
13461 :DESCRIPTION: Attributes specific to special blocks.
13464 #+cindex: special blocks, in @LaTeX{} export
13465 #+cindex: abstract, in @LaTeX{} export
13466 #+cindex: proof, in @LaTeX{} export
13467 #+cindex: @samp{ATTR_LATEX}, keyword
13469 For other special blocks in the Org file, the LaTeX export back-end
13470 makes a special environment of the same name. The back-end also takes
13471 =:options=, if any, and appends as-is to that environment's opening
13472 string. For example:
13476 We demonstrate how to solve the Syracuse problem.
13479 ,#+ATTR_LATEX: :options [Proof of important theorem]
13482 Therefore, any even number greater than 2 is the sum of two primes.
13486 #+texinfo: @noindent
13491 We demonstrate how to solve the Syracuse problem.
13494 \begin{proof}[Proof of important theorem]
13496 Therefore, any even number greater than 2 is the sum of two primes.
13500 If you need to insert a specific caption command, use =:caption=
13501 attribute. It overrides standard =CAPTION= value, if any. For
13505 ,#+ATTR_LATEX: :caption \MyCaption{HeadingA}
13511 *** Horizontal rules in LaTeX export
13513 :DESCRIPTION: Attributes specific to horizontal rules.
13515 #+cindex: horizontal rules, in @LaTeX{} export
13516 #+cindex: @samp{ATTR_LATEX}, keyword
13518 The LaTeX export back-end converts horizontal rules by the specified
13519 =:width= and =:thickness= attributes. For example:
13522 ,#+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
13528 :DESCRIPTION: Exporting to Markdown.
13530 #+cindex: Markdown export
13532 The Markdown export back-end, "md", converts an Org file to a Markdown
13533 format, as defined at http://daringfireball.net/projects/markdown/.
13535 Since "md" is built on top of the HTML back-end, any Org constructs
13536 not supported by Markdown, such as tables, the underlying "html"
13537 back-end (see [[*HTML Export]]) converts them.
13539 *** Markdown export commands
13544 - {{{kbd(C-c C-e m m)}}} (~org-md-export-to-markdown~) ::
13546 #+kindex: C-c C-c m m
13547 #+findex: org-md-export-to-markdown
13548 Export to a text file with Markdown syntax. For =myfile.org=,
13549 Org exports to =myfile.md=, overwritten without warning.
13551 - {{{kbd(C-c C-e m M)}}} (~org-md-export-as-markdown~) ::
13553 #+kindex: C-c C-c m M
13554 #+findex: org-md-export-as-markdown
13555 Export to a temporary buffer. Does not create a file.
13557 - {{{kbd(C-c C-e m o)}}} ::
13559 #+kindex: C-c C-e m o
13560 Export as a text file with Markdown syntax, then open it.
13562 *** Header and sectioning structure
13567 #+vindex: org-md-headline-style
13568 Based on ~org-md-headline-style~, Markdown export can generate
13569 headlines of both /atx/ and /setext/ types. /atx/ limits headline
13570 levels to two whereas /setext/ limits headline levels to six. Beyond
13571 these limits, the export back-end converts headlines to lists. To set
13572 a limit to a level before the absolute limit (see [[*Export Settings]]).
13574 ** OpenDocument Text Export
13576 :DESCRIPTION: Exporting to OpenDocument Text.
13579 #+cindex: OpenDocument
13580 #+cindex: export, OpenDocument
13581 #+cindex: LibreOffice
13583 The ODT export back-end handles creating of OpenDocument Text (ODT)
13584 format. Documents created by this exporter use the
13585 {{{cite(OpenDocument-v1.2 specification)}}}[fn:123] and are compatible
13586 with LibreOffice 3.4.
13588 *** Pre-requisites for ODT export
13590 :DESCRIPTION: Required packages.
13594 The ODT export back-end relies on the zip program to create the final
13595 compressed ODT output. Check if =zip= is locally available and
13596 executable. Without it, export cannot finish.
13598 *** ODT export commands
13600 :DESCRIPTION: Invoking export.
13603 - {{{kbd(C-c C-e o o)}}} (~org-export-to-odt~) ::
13605 #+kindex: C-c C-e o o
13606 #+findex: org-export-to-odt
13607 Export as OpenDocument Text file.
13609 #+cindex: @samp{EXPORT_FILE_NAME}, property
13610 #+vindex: org-odt-preferred-output-format
13612 If ~org-odt-preferred-output-format~ is specified, the ODT export
13613 back-end automatically converts the exported file to that format.
13615 For =myfile.org=, Org exports to =myfile.odt=, overwriting
13616 without warning. The ODT export back-end exports a region only
13617 if a region was active.
13619 If the selected region is a single tree, the ODT export back-end
13620 makes the tree head the document title. Incidentally, {{{kbd(C-c
13621 @)}}} selects the current sub-tree. If the tree head entry has,
13622 or inherits, an =EXPORT_FILE_NAME= property, the ODT export
13623 back-end uses that for file name.
13625 - {{{kbd(C-c C-e o O)}}} ::
13627 #+kindex: C-c C-e o O
13628 Export as an OpenDocument Text file and open the resulting file.
13630 #+vindex: org-export-odt-preferred-output-format
13631 If ~org-export-odt-preferred-output-format~ is specified, open
13632 the converted file instead. See [[*Automatically exporting to
13635 *** ODT specific export settings
13637 :DESCRIPTION: Configuration options.
13640 The ODT export back-end has several additional keywords for
13641 customizing ODT output. Setting these keywords works similar to the
13642 general options (see [[*Export Settings]]).
13646 #+cindex: @samp{DESCRIPTION}, keyword
13647 This is the document's description, which the ODT export back-end
13648 inserts as document metadata. For long descriptions, use
13649 multiple lines, prefixed with =DESCRIPTION=.
13653 #+cindex: @samp{KEYWORDS}, keyword
13654 The keywords for the document. The ODT export back-end inserts
13655 the description along with author name, keywords, and related
13656 file metadata as metadata in the output file. Use multiple
13657 =KEYWORDS= if necessary.
13659 - =ODT_STYLES_FILE= ::
13661 #+cindex: @samp{ODT_STYLES_FILE}, keyword
13662 #+vindex: org-odt-styles-file
13663 The ODT export back-end uses the ~org-odt-styles-file~ by
13664 default. See [[*Applying custom styles]] for details.
13668 #+cindex: @samp{SUBTITLE}, keyword
13669 The document subtitle.
13671 *** Extending ODT export
13673 :DESCRIPTION: Producing DOC, PDF files.
13676 The ODT export back-end can produce documents in other formats besides
13677 ODT using a specialized ODT converter process. Its common interface
13678 works with popular converters to produce formats such as =doc=, or
13679 convert a document from one format, say =csv=, to another format, say
13682 #+cindex: @file{unoconv}
13683 #+vindex: org-odt-convert-process
13684 Customize ~org-odt-convert-process~ variable to point to =unoconv=,
13685 which is the ODT's preferred converter. Working installations of
13686 LibreOffice would already have =unoconv= installed. Alternatively,
13687 other converters may be substituted here. See [[*Configuring
13688 a document converter]].
13690 **** Automatically exporting to other formats
13695 #+vindex: org-odt-preferred-output-format
13696 If ODT format is just an intermediate step to get to other formats,
13697 such as =doc=, =docx=, =rtf=, or =pdf=, etc., then extend the ODT
13698 export back-end to directly produce that format. Specify the final
13699 format in the ~org-odt-preferred-output-format~ variable. This is one
13700 way to extend (see [[*ODT export commands]]).
13702 **** Converting between document formats
13707 The Org export back-end is made to be inter-operable with a wide range
13708 of text document format converters. Newer generation converters, such
13709 as LibreOffice and Pandoc, can handle hundreds of formats at once.
13710 Org provides a consistent interaction with whatever converter is
13711 installed. Here are some generic commands:
13713 - {{{kbd(M-x org-odt-convert)}}} ::
13715 #+findex: org-odt-convert
13716 Convert an existing document from one format to another. With
13717 a prefix argument, opens the newly produced file.
13719 *** Applying custom styles
13721 :DESCRIPTION: Styling the output.
13723 #+cindex: styles, custom
13724 #+cindex: template, custom
13726 The ODT export back-end comes with many OpenDocument styles (see
13727 [[*Working with OpenDocument style files]]). To expand or further
13728 customize these built-in style sheets, either edit the style sheets
13729 directly or generate them using an application such as LibreOffice.
13730 The example here shows creating a style using LibreOffice.
13732 **** Applying custom styles: the easy way
13737 1. Create a sample =example.org= file with settings as shown below,
13738 and export it to ODT format.
13740 : #+OPTIONS: H:10 num:t
13742 2. Open the above =example.odt= using LibreOffice. Use the /Stylist/
13743 to locate the target styles, which typically have the "Org" prefix.
13744 Open one, modify, and save as either OpenDocument Text (ODT) or
13745 OpenDocument Template (OTT) file.
13748 #+vindex: org-odt-styles-file
13749 Customize the variable ~org-odt-styles-file~ and point it to the
13750 newly created file. For additional configuration options, see
13751 [[x-overriding-factory-styles][Overriding factory styles]].
13753 #+cindex: @samp{ODT_STYLES_FILE}, keyword
13754 To apply an ODT style to a particular file, use the
13755 =ODT_STYLES_FILE= keyword as shown in the example below:
13757 : #+ODT_STYLES_FILE: "/path/to/example.ott"
13759 #+texinfo: @noindent
13762 : #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
13764 **** Using third-party styles and templates
13769 The ODT export back-end relies on many templates and style names.
13770 Using third-party styles and templates can lead to mismatches.
13771 Templates derived from built in ODT templates and styles seem to have
13774 *** Links in ODT export
13776 :DESCRIPTION: Handling and formatting links.
13778 #+cindex: links, in ODT export
13780 ODT exporter creates native cross-references for internal links. It
13781 creates Internet-style links for all other links.
13783 A link with no description and pointing to a regular, un-itemized,
13784 outline heading is replaced with a cross-reference and section number
13787 A =\ref{label}=-style reference to an image, table etc., is replaced
13788 with a cross-reference and sequence number of the labeled entity. See
13789 [[*Labels and captions in ODT export]].
13791 *** Tables in ODT export
13793 :DESCRIPTION: Org tables conversions.
13796 #+cindex: tables, in ODT export
13798 The ODT export back-end handles native Org mode tables (see [[*Tables]])
13799 and simple =table.el= tables. Complex =table.el= tables having column
13800 or row spans are not supported. Such tables are stripped from the
13803 By default, the ODT export back-end exports a table with top and
13804 bottom frames and with ruled lines separating row and column groups
13805 (see [[*Column Groups]]). All tables are typeset to occupy the same
13806 width. The ODT export back-end honors any table alignments and
13807 relative widths for columns (see [[*Column Width and Alignment]]).
13809 Note that the ODT export back-end interprets column widths as weighted
13810 ratios, the default weight being 1.
13812 #+cindex: @samp{ATTR_ODT}, keyword
13813 Specifying =:rel-width= property on an =ATTR_ODT= line controls the
13814 width of the table. For example:
13817 ,#+ATTR_ODT: :rel-width 50
13818 | Area/Month | Jan | Feb | Mar | Sum |
13819 |---------------+-------+-------+-------+-------|
13821 | <l13> | <r5> | <r5> | <r5> | <r6> |
13822 | North America | 1 | 21 | 926 | 948 |
13823 | Middle East | 6 | 75 | 844 | 925 |
13824 | Asia Pacific | 9 | 27 | 790 | 826 |
13825 |---------------+-------+-------+-------+-------|
13826 | Sum | 16 | 123 | 2560 | 2699 |
13829 On export, the above table takes 50% of text width area. The exporter
13830 sizes the columns in the ratio: 13:5:5:5:6. The first column is
13831 left-aligned and rest of the columns, right-aligned. Vertical rules
13832 separate the header and the last column. Horizontal rules separate
13833 the header and the last row.
13835 For even more customization, create custom table styles and associate
13836 them with a table using the =ATTR_ODT= keyword. See [[*Customizing
13837 tables in ODT export]].
13839 *** Images in ODT export
13841 :DESCRIPTION: Inserting images.
13843 #+cindex: images, embedding in ODT
13844 #+cindex: embedding images in ODT
13846 **** Embedding images
13851 The ODT export back-end processes image links in Org files that do not
13852 have descriptions, such as these links =[[file:img.jpg]]= or =[[./img.jpg]]=,
13853 as direct image insertions in the final output. Either of these
13860 **** Embedding clickable images
13865 For clickable images, provide a link whose description is another link
13866 to an image file. For example, to embed an image
13867 =org-mode-unicorn.png= which when clicked jumps to https://orgmode.org
13868 website, do the following
13870 : [[https://orgmode.org][./org-mode-unicorn.png]]
13872 **** Sizing and scaling of embedded images
13877 #+cindex: @samp{ATTR_ODT}, keyword
13879 Control the size and scale of the embedded images with the =ATTR_ODT=
13882 #+cindex: identify, ImageMagick
13883 #+vindex: org-odt-pixels-per-inch
13884 The ODT export back-end starts with establishing the size of the image
13885 in the final document. The dimensions of this size are measured in
13886 centimeters. The back-end then queries the image file for its
13887 dimensions measured in pixels. For this measurement, the back-end
13888 relies on ImageMagick's identify program or Emacs ~create-image~ and
13889 ~image-size~ API. ImageMagick is the preferred choice for large file
13890 sizes or frequent batch operations. The back-end then converts the
13891 pixel dimensions using ~org-odt-pixels-per-inch~ into the familiar 72
13892 dpi or 96 dpi. The default value for this is in
13893 ~display-pixels-per-inch~, which can be tweaked for better results
13894 based on the capabilities of the output device. Here are some common
13895 image scaling operations:
13897 - Explicitly size the image ::
13899 To embed =img.png= as a 10 cm x 10 cm image, do the following:
13902 ,#+ATTR_ODT: :width 10 :height 10
13906 - Scale the image ::
13908 To embed =img.png= at half its size, do the following:
13911 ,#+ATTR_ODT: :scale 0.5
13915 - Scale the image to a specific width ::
13917 To embed =img.png= with a width of 10 cm while retaining the
13918 original height:width ratio, do the following:
13921 ,#+ATTR_ODT: :width 10
13925 - Scale the image to a specific height ::
13927 To embed =img.png= with a height of 10 cm while retaining the
13928 original height:width ratio, do the following:
13931 ,#+ATTR_ODT: :height 10
13935 **** Anchoring of images
13940 #+cindex: @samp{ATTR_ODT}, keyword
13941 The ODT export back-end can anchor images to ="as-char"=,
13942 ="paragraph"=, or ="page"=. Set the preferred anchor using the
13943 =:anchor= property of the =ATTR_ODT= line.
13945 To create an image that is anchored to a page:
13948 ,#+ATTR_ODT: :anchor "page"
13952 *** Math formatting in ODT export
13954 :DESCRIPTION: Formatting @LaTeX{} fragments.
13957 The ODT exporter has special support for handling math.
13959 **** LaTeX math snippets
13961 :DESCRIPTION: Embedding in @LaTeX{} format.
13964 LaTeX math snippets (see [[*LaTeX fragments]]) can be embedded in the ODT
13965 document in one of the following ways:
13970 Add this line to the Org file. This option is activated on
13975 With this option, LaTeX fragments are first converted into MathML
13976 fragments using an external LaTeX-to-MathML converter program.
13977 The resulting MathML fragments are then embedded as an
13978 OpenDocument Formula in the exported document.
13980 #+vindex: org-latex-to-mathml-convert-command
13981 #+vindex: org-latex-to-mathml-jar-file
13982 You can specify the LaTeX-to-MathML converter by customizing the
13983 variables ~org-latex-to-mathml-convert-command~ and
13984 ~org-latex-to-mathml-jar-file~.
13986 If you prefer to use MathToWeb[fn:124] as your converter, you can
13987 configure the above variables as shown below.
13989 #+begin_src emacs-lisp
13990 (setq org-latex-to-mathml-convert-command
13991 "java -jar %j -unicode -force -df %o %I"
13992 org-latex-to-mathml-jar-file
13993 "/path/to/mathtoweb.jar")
13996 To use LaTeX​ML[fn:125] use
13998 #+begin_src emacs-lisp
13999 (setq org-latex-to-mathml-convert-command
14000 "latexmlmath \"%i\" --presentationmathml=%o")
14003 To quickly verify the reliability of the LaTeX-to-MathML
14004 converter, use the following commands:
14006 - {{{kbd(M-x org-export-as-odf)}}} ::
14008 Convert a LaTeX math snippet to an OpenDocument formula
14011 - {{{kbd(M-x org-export-as-odf-and-open)}}} ::
14013 Convert a LaTeX math snippet to an OpenDocument formula
14014 (=.odf=) file and open the formula file with the
14015 system-registered application.
14021 #+cindex: ImageMagick
14022 Add this line to the Org file. This option is activated on
14025 : #+OPTIONS: tex:dvipng
14027 : #+OPTIONS: tex:dvisvgm
14029 #+texinfo: @noindent
14032 : #+OPTIONS: tex:imagemagick
14034 Under this option, LaTeX fragments are processed into PNG or SVG
14035 images and the resulting images are embedded in the exported
14036 document. This method requires dvipng program, dvisvgm or
14037 ImageMagick programs.
14039 **** MathML and OpenDocument formula files
14041 :DESCRIPTION: Embedding in native format.
14044 When embedding LaTeX math snippets in ODT documents is not reliable,
14045 there is one more option to try. Embed an equation by linking to its
14046 MathML (=.mml=) source or its OpenDocument formula (=.odf=) file as
14049 : [[./equation.mml]]
14051 #+texinfo: @noindent
14054 : [[./equation.odf]]
14056 *** Labels and captions in ODT export
14058 :DESCRIPTION: Rendering objects.
14061 ODT format handles labeling and captioning of objects based on their
14062 types. Inline images, tables, LaTeX fragments, and Math formulas are
14063 numbered and captioned separately. Each object also gets a unique
14064 sequence number based on its order of first appearance in the Org
14065 file. Each category has its own sequence. A caption is just a label
14066 applied to these objects.
14069 ,#+CAPTION: Bell curve
14070 ,#+NAME: fig:SED-HR4049
14074 When rendered, it may show as follows in the exported document:
14076 : Figure 2: Bell curve
14078 #+vindex: org-odt-category-map-alist
14079 To modify the category component of the caption, customize the option
14080 ~org-odt-category-map-alist~. For example, to tag embedded images
14081 with the string "Illustration" instead of the default string "Figure",
14082 use the following setting:
14084 #+begin_src emacs-lisp
14085 (setq org-odt-category-map-alist
14086 '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
14089 With the above modification, the previous example changes to:
14091 : Illustration 2: Bell curve
14093 *** Literal examples in ODT export
14095 :DESCRIPTION: For source code and example blocks.
14098 The ODT export back-end supports literal examples (see [[*Literal
14099 Examples]]) with full fontification. Internally, the ODT export
14100 back-end relies on =htmlfontify.el= to generate the style definitions
14101 needed for fancy listings. The auto-generated styles get =OrgSrc=
14102 prefix and inherit colors from the faces used by Emacs Font Lock
14103 library for that source language.
14105 #+vindex: org-odt-fontify-srcblocks
14106 For custom fontification styles, customize the
14107 ~org-odt-create-custom-styles-for-srcblocks~ option.
14109 #+vindex: org-odt-create-custom-styles-for-srcblocks
14110 To turn off fontification of literal examples, customize the
14111 ~org-odt-fontify-srcblocks~ option.
14113 *** Advanced topics in ODT export
14115 :DESCRIPTION: For power users.
14118 The ODT export back-end has extensive features useful for power users
14119 and frequent uses of ODT formats.
14121 **** Configuring a document converter
14123 :DESCRIPTION: Registering a document converter.
14127 #+cindex: doc, docx, rtf
14128 #+cindex: converter
14130 The ODT export back-end works with popular converters with little or
14131 no extra configuration. See [[*Extending ODT export]]. The following is
14132 for unsupported converters or tweaking existing defaults.
14134 - Register the converter ::
14136 #+vindex: org-export-odt-convert-processes
14137 Add the name of the converter to the ~org-odt-convert-processes~
14138 variable. Note that it also requires how the converter is
14139 invoked on the command line. See the variable's docstring for
14142 - Configure its capabilities ::
14144 #+vindex: org-export-odt-convert-capabilities
14145 Specify which formats the converter can handle by customizing the
14146 variable ~org-odt-convert-capabilities~. Use the entry for the
14147 default values in this variable for configuring the new
14148 converter. Also see its docstring for details.
14150 - Choose the converter ::
14152 #+vindex: org-export-odt-convert-process
14153 Select the newly added converter as the preferred one by
14154 customizing the option ~org-odt-convert-process~.
14156 **** Working with OpenDocument style files
14158 :DESCRIPTION: Exploring internals.
14161 #+cindex: styles, custom
14162 #+cindex: template, custom
14164 This section explores the internals of the ODT exporter; the means by which
14165 it produces styled documents; the use of automatic and custom OpenDocument
14168 The ODT exporter relies on two files for generating its output. These
14169 files are bundled with the distribution under the directory pointed to
14170 by the variable ~org-odt-styles-dir~. The two files are:
14172 - =OrgOdtStyles.xml= <<x-orgodtstyles-xml>> ::
14174 This file contributes to the =styles.xml= file of the final ODT
14175 document. This file gets modified for the following purposes:
14177 1. To control outline numbering based on user settings;
14179 2. To add styles generated by =htmlfontify.el= for fontification of
14182 - =OrgOdtContentTemplate.xml= <<x-orgodtcontenttemplate-xml>> ::
14184 This file contributes to the =content.xml= file of the final ODT
14185 document. The contents of the Org outline are inserted between the
14186 =<office:text>= ... =</office:text>= elements of this file.
14188 Apart from serving as a template file for the final =content.xml=,
14189 the file serves the following purposes:
14191 1. It contains automatic styles for formatting of tables which are
14192 referenced by the exporter;
14194 2. It contains =<text:sequence-decl>= ... =</text:sequence-decl>=
14195 elements that control numbering of tables, images, equations, and
14198 <<x-overriding-factory-styles>> The following two variables control
14199 the location from where the ODT exporter picks up the custom styles
14200 and content template files. Customize these variables to override the
14201 factory styles used by the exporter.
14203 - ~org-odt-styles-file~ ::
14205 The ODT export back-end uses the file pointed to by this
14206 variable, such as =styles.xml=, for the final output. It can
14207 take one of the following values:
14211 Use this file instead of the default =styles.xml=
14213 - =FILE.odt= or =FILE.ott= ::
14215 Use the =styles.xml= contained in the specified OpenDocument
14216 Text or Template file
14218 - =FILE.odt= or =FILE.ott= and a subset of included files ::
14220 Use the =styles.xml= contained in the specified OpenDocument
14221 Text or Template file. Additionally extract the specified
14222 member files and embed those within the final ODT document.
14224 Use this option if the =styles.xml= file references additional
14225 files like header and footer images.
14229 Use the default =styles.xml=.
14231 - ~org-odt-content-template-file~ ::
14233 Use this variable to specify the blank =content.xml= used in the
14236 **** Creating one-off styles
14238 :DESCRIPTION: Customizing styles, highlighting...
14242 The ODT export back-end can read embedded raw OpenDocument XML from
14243 the Org file. Such direct formatting is useful for one-off instances.
14245 - Embedding ODT tags as part of regular text ::
14247 Enclose OpenDocument syntax in =@@odt:...@@= for inline markup.
14248 For example, to highlight a region of text do the following:
14251 @@odt:<text:span text:style-name="Highlight">This is highlighted
14252 text</text:span>@@. But this is regular text.
14255 *Hint:* To see the above example in action, edit the =styles.xml=
14256 (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom /Highlight/ style as shown
14260 <style:style style:name="Highlight" style:family="text">
14261 <style:text-properties fo:background-color="#ff0000"/>
14265 - Embedding a one-line OpenDocument XML ::
14267 #+cindex: @samp{ODT}, keyword
14268 The ODT export back-end can read one-liner options with =#+ODT:=
14269 in the Org file. For example, to force a page break:
14272 ,#+ODT: <text:p text:style-name="PageBreak"/>
14275 *Hint:* To see the above example in action, edit your
14276 =styles.xml= (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom =PageBreak=
14277 style as shown below.
14280 <style:style style:name="PageBreak" style:family="paragraph"
14281 style:parent-style-name="Text_20_body">
14282 <style:paragraph-properties fo:break-before="page"/>
14286 - Embedding a block of OpenDocument XML ::
14288 The ODT export back-end can also read ODT export blocks for
14289 OpenDocument XML. Such blocks use the =#+BEGIN_EXPORT odt=
14290 ... =#+END_EXPORT= constructs.
14292 For example, to create a one-off paragraph that uses bold text,
14296 ,#+BEGIN_EXPORT odt
14297 <text:p text:style-name="Text_20_body_20_bold">
14298 This paragraph is specially formatted and uses bold text.
14303 **** Customizing tables in ODT export
14305 :DESCRIPTION: Defining table templates.
14308 #+cindex: tables, in ODT export
14309 #+cindex: @samp{ATTR_ODT}, keyword
14311 Override the default table format by specifying a custom table style
14312 with the =#+ATTR_ODT= line. For a discussion on default formatting of
14313 tables, see [[*Tables in ODT export]].
14315 This feature closely mimics the way table templates are defined in the
14316 OpenDocument-v1.2 specification.[fn:126]
14318 #+vindex: org-odt-table-styles
14319 For quick preview of this feature, install the settings below and export the
14320 table that follows:
14322 #+begin_src emacs-lisp
14323 (setq org-export-odt-table-styles
14324 (append org-export-odt-table-styles
14325 '(("TableWithHeaderRowAndColumn" "Custom"
14326 ((use-first-row-styles . t)
14327 (use-first-column-styles . t)))
14328 ("TableWithFirstRowandLastRow" "Custom"
14329 ((use-first-row-styles . t)
14330 (use-last-row-styles . t))))))
14334 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
14335 | Name | Phone | Age |
14336 | Peter | 1234 | 17 |
14337 | Anna | 4321 | 25 |
14340 The example above used =Custom= template and installed two table
14341 styles =TableWithHeaderRowAndColumn= and
14342 =TableWithFirstRowandLastRow=. *Important:* The OpenDocument styles
14343 needed for producing the above template were pre-defined. They are
14344 available in the section marked =Custom Table Template= in
14345 =OrgOdtContentTemplate.xml= (see [[x-orgodtcontenttemplate-xml][Factory styles]]). For adding new
14346 templates, define new styles there.
14348 To use this feature proceed as follows:
14350 1. Create a table template[fn:127].
14352 A table template is set of =table-cell= and =paragraph= styles for
14353 each of the following table cell categories:
14365 The names for the above styles must be chosen based on the name of
14366 the table template using a well-defined convention.
14368 The naming convention is better illustrated with an example. For
14369 a table template with the name =Custom=, the needed style names are
14370 listed in the following table.
14372 | Cell type | Cell style | Paragraph style |
14373 |--------------+------------------------------+-----------------------------------|
14374 | Body | =CustomTableCell= | =CustomTableParagraph= |
14375 | First column | =CustomFirstColumnTableCell= | =CustomFirstColumnTableParagraph= |
14376 | Last column | =CustomLastColumnTableCell= | =CustomLastColumnTableParagraph= |
14377 | First row | =CustomFirstRowTableCell= | =CustomFirstRowTableParagraph= |
14378 | Last row | =CustomLastRowTableCell= | =CustomLastRowTableParagraph= |
14379 | Even row | =CustomEvenRowTableCell= | =CustomEvenRowTableParagraph= |
14380 | Odd row | =CustomOddRowTableCell= | =CustomOddRowTableParagraph= |
14381 | Even column | =CustomEvenColumnTableCell= | =CustomEvenColumnTableParagraph= |
14382 | Odd column | =CustomOddColumnTableCell= | =CustomOddColumnTableParagraph= |
14384 To create a table template with the name =Custom=, define the above
14385 styles in the =<office:automatic-styles>= ...
14386 =</office:automatic-styles>= element of the content template file
14387 (see [[x-orgodtcontenttemplate-xml][Factory styles]]).
14389 2. Define a table style[fn:128].
14391 #+vindex: org-odt-table-styles
14392 To define a table style, create an entry for the style in the
14393 variable ~org-odt-table-styles~ and specify the following:
14395 - the name of the table template created in step (1),
14396 - the set of cell styles in that template that are to be activated.
14398 For example, the entry below defines two different table styles
14399 =TableWithHeaderRowAndColumn= and =TableWithFirstRowandLastRow=
14400 based on the same template =Custom=. The styles achieve their
14401 intended effect by selectively activating the individual cell
14402 styles in that template.
14404 #+begin_src emacs-lisp
14405 (setq org-export-odt-table-styles
14406 (append org-export-odt-table-styles
14407 '(("TableWithHeaderRowAndColumn" "Custom"
14408 ((use-first-row-styles . t)
14409 (use-first-column-styles . t)))
14410 ("TableWithFirstRowandLastRow" "Custom"
14411 ((use-first-row-styles . t)
14412 (use-last-row-styles . t))))))
14415 3. Associate a table with the table style.
14417 To do this, specify the table style created in step (2) as part of
14418 the =ATTR_ODT= line as shown below.
14421 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
14422 | Name | Phone | Age |
14423 | Peter | 1234 | 17 |
14424 | Anna | 4321 | 25 |
14427 **** Validating OpenDocument XML
14429 :DESCRIPTION: Debugging corrupted OpenDocument files.
14433 Sometimes ODT format files may not open due to =.odt= file corruption.
14434 To verify if such a file is corrupt, validate it against the
14435 OpenDocument Relax NG Compact (RNC) syntax schema. But first the
14436 =.odt= files have to be decompressed using =zip=. Note that =.odt=
14437 files are ZIP archives: [[info:emacs::File Archives]]. The contents of
14438 ODT files are in XML. For general help with validation---and
14439 schema-sensitive editing---of XML files:
14440 [[info:nxml-mode::Introduction]].
14442 #+vindex: org-export-odt-schema-dir
14443 Customize ~org-odt-schema-dir~ to point to a directory with
14444 OpenDocument RNC files and the needed schema-locating rules. The ODT
14445 export back-end takes care of updating the
14446 ~rng-schema-locating-files~.
14450 :DESCRIPTION: Exporting to Org.
14453 #+cindex: Org export
14454 /org/ export back-end creates a normalized version of the Org document
14455 in current buffer. The exporter evaluates Babel code (see [[*Evaluating
14456 Code Blocks]]) and removes content specific to other back-ends.
14458 *** Org export commands
14463 - {{{kbd(C-c C-e O o)}}} (~org-org-export-to-org~) ::
14465 #+kindex: C-c C-e O o
14466 #+findex: org-org-export-to-org
14467 Export as an Org file with a =.org= extension. For =myfile.org=,
14468 Org exports to =myfile.org.org=, overwriting without warning.
14470 - {{{kbd(C-c C-e O v)}}} (~~) ::
14472 #+kindex: C-c C-e O v
14473 Export to an Org file, then open it.
14477 :DESCRIPTION: Exporting to Texinfo.
14480 *** Texinfo export commands
14482 :DESCRIPTION: Invoking commands.
14485 - {{{kbd(C-c C-e i t)}}} (~org-texinfo-export-to-texinfo~) ::
14487 #+kindex: C-c C-e i t
14488 #+findex: org-texinfo-export-to-texinfo
14489 Export as a Texinfo file with =.texi= extension. For
14490 =myfile.org=, Org exports to =myfile.texi=, overwriting without
14493 - {{{kbd(C-c C-e i i)}}} (~org-texinfo-export-to-info~) ::
14495 #+kindex: C-c C-e i i
14496 #+findex: org-texinfo-export-to-info
14497 #+vindex: org-texinfo-info-process
14498 Export to Texinfo format first and then process it to make an
14499 Info file. To generate other formats, such as DocBook, customize
14500 the ~org-texinfo-info-process~ variable.
14502 *** Texinfo specific export settings
14504 :DESCRIPTION: Setting the environment.
14507 The Texinfo export back-end has several additional keywords for
14508 customizing Texinfo output. Setting these keywords works similar to
14509 the general options (see [[*Export Settings]]).
14513 #+cindex: @samp{SUBTITLE}, keyword
14514 The document subtitle.
14518 #+cindex: @samp{SUBAUTHOR}, keyword
14519 Additional authors for the document.
14521 - =TEXINFO_FILENAME= ::
14523 #+cindex: @samp{TEXINFO_FILENAME}, keyword
14524 The Texinfo filename.
14526 - =TEXINFO_CLASS= ::
14528 #+cindex: @samp{TEXINFO_CLASS}, keyword
14529 #+vindex: org-texinfo-default-class
14530 The default document class (~org-texinfo-default-class~), which
14531 must be a member of ~org-texinfo-classes~.
14533 - =TEXINFO_HEADER= ::
14535 #+cindex: @samp{TEXINFO_HEADER}, keyword
14536 Arbitrary lines inserted at the end of the header.
14538 - =TEXINFO_POST_HEADER= ::
14540 #+cindex: @samp{TEXINFO_POST_HEADER}, keyword
14541 Arbitrary lines inserted after the end of the header.
14543 - =TEXINFO_DIR_CATEGORY= ::
14545 #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword
14546 The directory category of the document.
14548 - =TEXINFO_DIR_TITLE= ::
14550 #+cindex: @samp{TEXINFO_DIR_TITLE}, keyword
14551 The directory title of the document.
14553 - =TEXINFO_DIR_DESC= ::
14555 #+cindex: @samp{TEXINFO_DIR_DESC}, keyword
14556 The directory description of the document.
14558 - =TEXINFO_PRINTED_TITLE= ::
14560 #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword
14561 The printed title of the document.
14563 *** Texinfo file header
14565 :DESCRIPTION: Generating the header.
14568 #+cindex: @samp{TEXINFO_FILENAME}, keyword
14569 After creating the header for a Texinfo file, the Texinfo back-end
14570 automatically generates a name and destination path for the Info file.
14571 To override this default with a more sensible path and name, specify
14572 the =TEXINFO_FILENAME= keyword.
14574 #+vindex: org-texinfo-coding-system
14575 #+cindex: @samp{TEXINFO_HEADER}, keyword
14576 Along with the output's file name, the Texinfo header also contains
14577 language details (see [[*Export Settings]]) and encoding system as set in
14578 the ~org-texinfo-coding-system~ variable. Insert =TEXINFO_HEADER=
14579 keywords for each additional command in the header, for example:
14581 : #+TEXINFO_HEADER: @synindex
14583 #+cindex: @samp{TEXINFO_CLASS}, keyword
14584 #+vindex: org-texinfo-classes
14585 Instead of repeatedly installing the same set of commands, define
14586 a class in ~org-texinfo-classes~ once, and then activate it in the
14587 document by setting the =TEXINFO_CLASS= keyword to that class.
14589 *** Texinfo title and copyright page
14591 :DESCRIPTION: Creating preamble pages.
14594 #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword
14595 The default template for hard copy output has a title page with
14596 =TITLE= and =AUTHOR= keywords (see [[*Export Settings]]). To replace the
14597 regular title with something different for the printed version, use
14598 the =TEXINFO_PRINTED_TITLE= and =SUBTITLE= keywords. Both expect raw
14599 Texinfo code for setting their values.
14601 #+cindex: @samp{SUBAUTHOR}, keyword
14602 If one =AUTHOR= line is not sufficient, add multiple =SUBAUTHOR=
14603 keywords. They have to be set in raw Texinfo code.
14606 ,#+AUTHOR: Jane Smith
14607 ,#+SUBAUTHOR: John Doe
14608 ,#+TEXINFO_PRINTED_TITLE: This Long Title@@inlinefmt{tex,@*} Is Broken in @TeX{}
14611 #+cindex: @samp{COPYING}, property
14612 Copying material is defined in a dedicated headline with a non-~nil~
14613 =COPYING= property. The back-end inserts the contents within
14614 a =@copying= command at the beginning of the document. The heading
14615 itself does not appear in the structure of the document.
14617 Copyright information is printed on the back of the title page.
14625 This is a short example of a complete Texinfo file, version 1.0.
14627 Copyright \copy 2016 Free Software Foundation, Inc.
14630 *** Info directory file
14632 :DESCRIPTION: Installing a manual in Info file hierarchy.
14635 #+cindex: @samp{dir} file, in Texinfo export
14636 #+cindex: Info directory file, in Texinfo export
14637 #+cindex: @code{install-info}, in Texinfo export
14639 #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword
14640 #+cindex: @samp{TEXINFO_DIR_TITLE}, keyword
14641 #+cindex: @samp{TEXINFO_DIR_DESC}, keyword
14642 The end result of the Texinfo export process is the creation of an
14643 Info file. This Info file's metadata has variables for category,
14644 title, and description: =TEXINFO_DIR_CATEGORY=, =TEXINFO_DIR_TITLE=,
14645 and =TEXINFO_DIR_DESC= keywords that establish where in the Info
14646 hierarchy the file fits.
14648 Here is an example that writes to the Info directory file:
14651 ,#+TEXINFO_DIR_CATEGORY: Emacs
14652 ,#+TEXINFO_DIR_TITLE: Org Mode: (org)
14653 ,#+TEXINFO_DIR_DESC: Outline-based notes management and organizer
14656 *** Headings and sectioning structure
14658 :DESCRIPTION: Building document structure.
14661 #+vindex: org-texinfo-classes
14662 #+vindex: org-texinfo-default-class
14663 #+cindex: @samp{TEXINFO_CLASS}, keyword
14664 The Texinfo export back-end uses a pre-defined scheme to convert Org
14665 headlines to equivalent Texinfo structuring commands. A scheme like
14666 this maps top-level headlines to numbered chapters tagged as
14667 ~@chapter~ and lower-level headlines to unnumbered chapters tagged as
14668 ~@unnumbered~. To override such mappings to introduce ~@part~ or
14669 other Texinfo structuring commands, define a new class in
14670 ~org-texinfo-classes~. Activate the new class with the
14671 =TEXINFO_CLASS= keyword. When no new class is defined and activated,
14672 the Texinfo export back-end defaults to the
14673 ~org-texinfo-default-class~.
14675 If an Org headline's level has no associated Texinfo structuring
14676 command, or is below a certain threshold (see [[*Export Settings]]), then
14677 the Texinfo export back-end makes it into a list item.
14679 #+cindex: @samp{APPENDIX}, property
14680 The Texinfo export back-end makes any headline with a non-~nil~
14681 =APPENDIX= property into an appendix. This happens independent of the
14682 Org headline level or the =TEXINFO_CLASS= keyword.
14684 #+cindex: @samp{ALT_TITLE}, property
14685 #+cindex: @samp{DESCRIPTION}, property
14686 The Texinfo export back-end creates a menu entry after the Org
14687 headline for each regular sectioning structure. To override this with
14688 a shorter menu entry, use the =ALT_TITLE= property (see [[*Table of
14689 Contents]]). Texinfo menu entries also have an option for a longer
14690 =DESCRIPTION= property. Here's an example that uses both to override
14691 the default menu entry:
14694 ,* Controlling Screen Display
14696 :ALT_TITLE: Display
14697 :DESCRIPTION: Controlling Screen Display
14701 #+cindex: Top node, in Texinfo export
14702 The text before the first headline belongs to the /Top/ node, i.e.,
14703 the node in which a reader enters an Info manual. As such, it is
14704 expected not to appear in printed output generated from the =.texi=
14705 file. See [[info:texinfo::The%20Top%20Node]], for more information.
14709 :DESCRIPTION: Creating indices.
14712 #+cindex: @samp{CINDEX}, keyword
14713 #+cindex: concept index, in Texinfo export
14714 #+cindex: @samp{FINDEX}, keyword
14715 #+cindex: function index, in Texinfo export
14716 #+cindex: @samp{KINDEX}, keyword
14717 #+cindex: keystroke index, in Texinfo export
14718 #+cindex: @samp{PINDEX}, keyword
14719 #+cindex: program index, in Texinfo export
14720 #+cindex: @samp{TINDEX}, keyword
14721 #+cindex: data type index, in Texinfo export
14722 #+cindex: @samp{VINDEX}, keyword
14723 #+cindex: variable index, in Texinfo export
14724 The Texinfo export back-end recognizes these indexing keywords if used
14725 in the Org file: =CINDEX=, =FINDEX=, =KINDEX=, =PINDEX=, =TINDEX= and
14726 =VINDEX=. Write their value as verbatim Texinfo code; in particular,
14727 ={=, =}= and =@= characters need to be escaped with =@= if they do not
14728 belong to a Texinfo command.
14730 : #+CINDEX: Defining indexing entries
14732 #+cindex: @samp{INDEX}, property
14733 For the back-end to generate an index entry for a headline, set the
14734 =INDEX= property to =cp= or =vr=. These abbreviations come from
14735 Texinfo that stand for concept index and variable index. The Texinfo
14736 manual has abbreviations for all other kinds of indexes. The back-end
14737 exports the headline as an unnumbered chapter or section command, and
14738 then inserts the index after its contents.
14747 *** Quoting Texinfo code
14749 :DESCRIPTION: Incorporating literal Texinfo code.
14752 Use any of the following three methods to insert or escape raw Texinfo
14755 #+cindex: @samp{TEXINFO}, keyword
14756 #+cindex: @samp{BEGIN_EXPORT texinfo}
14758 Richard @@texinfo:@sc{@@Stallman@@texinfo:}@@ commence' GNU.
14760 ,#+TEXINFO: @need800
14761 This paragraph is preceded by...
14763 ,#+BEGIN_EXPORT texinfo
14764 @auindex Johnson, Mark
14765 @auindex Lakoff, George
14769 *** Plain lists in Texinfo export
14771 :DESCRIPTION: List attributes.
14774 #+cindex: @samp{ATTR_TEXINFO}, keyword
14775 #+cindex: two-column tables, in Texinfo export
14777 #+cindex: table types, in Texinfo export
14778 The Texinfo export back-end by default converts description lists in
14779 the Org file using the default command =@table=, which results in
14780 a table with two columns. To change this behavior, specify
14781 =:table-type= with =ftable= or =vtable= attributes. For more
14782 information, see [[info:texinfo::Two-column Tables]].
14784 #+vindex: org-texinfo-table-default-markup
14785 The Texinfo export back-end by default also applies a text highlight
14786 based on the defaults stored in ~org-texinfo-table-default-markup~.
14787 To override the default highlight command, specify another one with
14788 the =:indic= attribute.
14790 #+cindex: multiple items in Texinfo lists
14791 Org syntax is limited to one entry per list item. Nevertheless, the
14792 Texinfo export back-end can split that entry according to any text
14793 provided through the =:sep= attribute. Each part then becomes a new
14794 entry in the first column of the table.
14796 The following example illustrates all the attributes above:
14799 ,#+ATTR_TEXINFO: :table-type vtable :sep , :indic asis
14800 - foo, bar :: This is the common text for variables foo and bar.
14803 #+texinfo: @noindent
14810 This is the common text for variables foo and bar.
14814 *** Tables in Texinfo export
14816 :DESCRIPTION: Table attributes.
14819 #+cindex: @samp{ATTR_TEXINFO}, keyword
14820 When exporting tables, the Texinfo export back-end uses the widest
14821 cell width in each column. To override this and instead specify as
14822 fractions of line length, use the =:columns= attribute. See example
14826 ,#+ATTR_TEXINFO: :columns .5 .5
14827 | a cell | another cell |
14830 *** Images in Texinfo export
14832 :DESCRIPTION: Image attributes.
14835 #+cindex: @samp{ATTR_TEXINFO}, keyword
14836 Insert a file link to the image in the Org file, and the Texinfo
14837 export back-end inserts the image. These links must have the usual
14838 supported image extensions and no descriptions. To scale the image,
14839 use =:width= and =:height= attributes. For alternate text, use =:alt=
14840 and specify the text using Texinfo code, as shown in the example:
14843 ,#+ATTR_TEXINFO: :width 1in :alt Alternate @i{text}
14847 *** Special blocks in Texinfo export
14849 :DESCRIPTION: Special block attributes.
14852 #+cindex: @samp{ATTR_TEXINFO}, keyword
14854 The Texinfo export back-end converts special blocks to commands with
14855 the same name. It also adds any =:options= attributes to the end of
14856 the command, as shown in this example:
14859 ,#+ATTR_TEXINFO: :options org-org-export-to-org ...
14861 A somewhat obsessive function name.
14865 #+texinfo: @noindent
14869 @defun org-org-export-to-org ...
14870 A somewhat obsessive function name.
14874 *** A Texinfo example
14876 :DESCRIPTION: Processing Org to Texinfo.
14879 Here is a more detailed example Org file. See
14880 [[info:texinfo::GNU%20Sample%20Texts]] for an equivalent example using
14884 ,#+TITLE: GNU Sample {{{version}}}
14885 ,#+SUBTITLE: for version {{{version}}}, {{{updated}}}
14886 ,#+AUTHOR: A.U. Thor
14887 ,#+EMAIL: bug-sample@gnu.org
14889 ,#+OPTIONS: ':t toc:t author:t email:t
14892 ,#+MACRO: version 2.0
14893 ,#+MACRO: updated last updated 4 March 2014
14895 ,#+TEXINFO_FILENAME: sample.info
14896 ,#+TEXINFO_HEADER: @syncodeindex pg cp
14898 ,#+TEXINFO_DIR_CATEGORY: Texinfo documentation system
14899 ,#+TEXINFO_DIR_TITLE: sample: (sample)
14900 ,#+TEXINFO_DIR_DESC: Invoking sample
14902 ,#+TEXINFO_PRINTED_TITLE: GNU Sample
14904 This manual is for GNU Sample (version {{{version}}},
14912 This manual is for GNU Sample (version {{{version}}},
14913 {{{updated}}}), which is an example in the Texinfo documentation.
14915 Copyright \copy 2016 Free Software Foundation, Inc.
14918 Permission is granted to copy, distribute and/or modify this
14919 document under the terms of the GNU Free Documentation License,
14920 Version 1.3 or any later version published by the Free Software
14921 Foundation; with no Invariant Sections, with no Front-Cover Texts,
14922 and with no Back-Cover Texts. A copy of the license is included in
14923 the section entitled "GNU Free Documentation License".
14929 ,#+CINDEX: invoking @command{sample}
14931 This is a sample manual. There is no sample program to invoke, but
14932 if there were, you could see its basic usage and command line
14935 ,* GNU Free Documentation License
14940 ,#+TEXINFO: @include fdl.texi
14948 ** iCalendar Export
14950 :DESCRIPTION: Exporting to iCalendar.
14952 #+cindex: iCalendar export
14954 A large part of Org mode's interoperability success is its ability to
14955 easily export to or import from external applications. The iCalendar
14956 export back-end takes calendar data from Org files and exports to the
14957 standard iCalendar format.
14959 #+vindex: org-icalendar-include-todo
14960 #+vindex: org-icalendar-use-deadline
14961 #+vindex: org-icalendar-use-scheduled
14962 The iCalendar export back-end can also incorporate TODO entries based
14963 on the configuration of the ~org-icalendar-include-todo~ variable.
14964 The back-end exports plain timestamps as =VEVENT=, TODO items as
14965 =VTODO=, and also create events from deadlines that are in non-TODO
14966 items. The back-end uses the deadlines and scheduling dates in Org
14967 TODO items for setting the start and due dates for the iCalendar TODO
14968 entry. Consult the ~org-icalendar-use-deadline~ and
14969 ~org-icalendar-use-scheduled~ variables for more details.
14971 #+vindex: org-icalendar-categories
14972 #+vindex: org-icalendar-alarm-time
14973 For tags on the headline, the iCalendar export back-end makes them
14974 into iCalendar categories. To tweak the inheritance of tags and TODO
14975 states, configure the variable ~org-icalendar-categories~. To assign
14976 clock alarms based on time, configure the ~org-icalendar-alarm-time~
14979 #+vindex: org-icalendar-store-UID
14980 #+cindex: @samp{ID}, property
14981 The iCalendar format standard requires globally unique identifier---or
14982 UID---for each entry. The iCalendar export back-end creates UIDs
14983 during export. To save a copy of the UID in the Org file set the
14984 variable ~org-icalendar-store-UID~. The back-end looks for the =ID=
14985 property of the entry for re-using the same UID for subsequent
14988 Since a single Org entry can result in multiple iCalendar
14989 entries---timestamp, deadline, scheduled item, or TODO item---Org adds
14990 prefixes to the UID, depending on which part of the Org entry
14991 triggered the creation of the iCalendar entry. Prefixing ensures UIDs
14992 remains unique, yet enable synchronization programs trace the
14995 - {{{kbd(C-c C-e c f)}}} (~org-icalendar-export-to-ics~) ::
14997 #+kindex: C-c C-e c f
14998 #+findex: org-icalendar-export-to-ics
14999 Create iCalendar entries from the current Org buffer and store
15000 them in the same directory, using a file extension =.ics=.
15002 - {{{kbd(C-c C-e c a)}}} (~org-icalendar-export-agenda-files~) ::
15004 #+kindex: C-c C-e c a
15005 #+findex: org-icalendar-export-agenda-files
15006 Create iCalendar entries from Org files in ~org-agenda-files~ and
15007 store in a separate iCalendar file for each Org file.
15009 - {{{kbd(C-c C-e c c)}}} (~org-icalendar-combine-agenda-files~) ::
15011 #+kindex: C-c C-e c c
15012 #+findex: org-icalendar-combine-agenda-files
15013 #+vindex: org-icalendar-combined-agenda-file
15014 Create a combined iCalendar file from Org files in
15015 ~org-agenda-files~ and write it to
15016 ~org-icalendar-combined-agenda-file~ file name.
15018 #+cindex: @samp{SUMMARY}, property
15019 #+cindex: @samp{DESCRIPTION}, property
15020 #+cindex: @samp{LOCATION}, property
15021 #+cindex: @samp{TIMEZONE}, property
15022 The iCalendar export back-end includes =SUMMARY=, =DESCRIPTION=,
15023 =LOCATION= and =TIMEZONE= properties from the Org entries when
15024 exporting. To force the back-end to inherit the =LOCATION= and
15025 =TIMEZONE= properties, configure the ~org-use-property-inheritance~
15028 #+vindex: org-icalendar-include-body
15029 When Org entries do not have =SUMMARY=, =DESCRIPTION= and =LOCATION=
15030 properties, the iCalendar export back-end derives the summary from the
15031 headline, and derives the description from the body of the Org item.
15032 The ~org-icalendar-include-body~ variable limits the maximum number of
15033 characters of the content are turned into its description.
15035 The =TIMEZONE= property can be used to specify a per-entry time zone,
15036 and is applied to any entry with timestamp information. Time zones
15037 should be specified as per the IANA time zone database format, e.g.,
15038 =Asia/Almaty=. Alternately, the property value can be =UTC=, to force
15039 UTC time for this entry only.
15041 Exporting to iCalendar format depends in large part on the
15042 capabilities of the destination application. Some are more lenient
15043 than others. Consult the Org mode FAQ for advice on specific
15046 ** Other Built-in Back-ends
15048 :DESCRIPTION: Exporting to a man page.
15051 Other export back-ends included with Org are:
15053 - =ox-man.el=: Export to a man page.
15055 To activate such back-ends, either customize ~org-export-backends~ or
15056 load directly with ~(require 'ox-man)~. On successful load, the
15057 back-end adds new keys in the export dispatcher (see [[*The Export
15060 Follow the comment section of such files, for example, =ox-man.el=,
15061 for usage and configuration details.
15063 ** Advanced Configuration
15065 :DESCRIPTION: Fine-tuning the export output.
15073 #+vindex: org-export-before-processing-hook
15074 #+vindex: org-export-before-parsing-hook
15075 The export process executes two hooks before the actual exporting
15076 begins. The first hook, ~org-export-before-processing-hook~, runs
15077 before any expansions of macros, Babel code, and include keywords in
15078 the buffer. The second hook, ~org-export-before-parsing-hook~, runs
15079 before the buffer is parsed.
15081 Functions added to these hooks are called with a single argument: the
15082 export back-end actually used, as a symbol. You may use them for
15083 heavy duty structural modifications of the document. For example, you
15084 can remove every headline in the buffer during export like this:
15086 #+begin_src emacs-lisp
15087 (defun my-headline-removal (backend)
15088 "Remove all headlines in the current buffer.
15089 BACKEND is the export back-end being used, as a symbol."
15091 (lambda () (delete-region (point) (line-beginning-position 2)))))
15093 (add-hook 'org-export-before-parsing-hook 'my-headline-removal)
15101 #+cindex: Filters, exporting
15102 Filters are lists of functions to be applied to certain parts for
15103 a given back-end. The output from the first function in the filter is
15104 passed on to the next function in the filter. The final output is the
15105 output from the final function in the filter.
15107 The Org export process has many filter sets applicable to different
15108 types of objects, plain text, parse trees, export options, and final
15109 output formats. The filters are named after the element type or
15110 object type: ~org-export-filter-TYPE-functions~, where {{{var(TYPE)}}}
15111 is the type targeted by the filter. Valid types are:
15113 #+attr_texinfo: :columns 0.33 0.33 0.33
15114 | body | bold | babel-call |
15115 | center-block | clock | code |
15116 | diary-sexp | drawer | dynamic-block |
15117 | entity | example-block | export-block |
15118 | export-snippet | final-output | fixed-width |
15119 | footnote-definition | footnote-reference | headline |
15120 | horizontal-rule | inline-babel-call | inline-src-block |
15121 | inlinetask | italic | item |
15122 | keyword | latex-environment | latex-fragment |
15123 | line-break | link | node-property |
15124 | options | paragraph | parse-tree |
15125 | plain-list | plain-text | planning |
15126 | property-drawer | quote-block | radio-target |
15127 | section | special-block | src-block |
15128 | statistics-cookie | strike-through | subscript |
15129 | superscript | table | table-cell |
15130 | table-row | target | timestamp |
15131 | underline | verbatim | verse-block |
15133 Here is an example filter that replaces non-breaking spaces ~Â ~ in the
15134 Org buffer with =~= for the LaTeX back-end.
15136 #+begin_src emacs-lisp
15137 (defun my-latex-filter-nobreaks (text backend info)
15138 "Ensure \"Â \" are properly handled in LaTeX export."
15139 (when (org-export-derived-backend-p backend 'latex)
15140 (replace-regexp-in-string "Â " "~" text)))
15142 (add-to-list 'org-export-filter-plain-text-functions
15143 'my-latex-filter-nobreaks)
15146 A filter requires three arguments: the code to be transformed, the
15147 name of the back-end, and some optional information about the export
15148 process. The third argument can be safely ignored. Note the use of
15149 ~org-export-derived-backend-p~ predicate that tests for /latex/
15150 back-end or any other back-end, such as /beamer/, derived from
15153 *** Defining filters for individual files
15158 The Org export can filter not just for back-ends, but also for
15159 specific files through the =BIND= keyword. Here is an example with
15160 two filters; one removes brackets from time stamps, and the other
15161 removes strike-through text. The filter functions are defined in
15162 a code block in the same Org file, which is a handy location for
15166 ,#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
15167 ,#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
15168 ,#+BEGIN_SRC emacs-lisp :exports results :results none
15169 (defun tmp-f-timestamp (s backend info)
15170 (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
15171 (defun tmp-f-strike-through (s backend info) "")
15175 *** Extending an existing back-end
15180 Some parts of the conversion process can be extended for certain
15181 elements so as to introduce a new or revised translation. That is how
15182 the HTML export back-end was extended to handle Markdown format. The
15183 extensions work seamlessly so any aspect of filtering not done by the
15184 extended back-end is handled by the original back-end. Of all the
15185 export customization in Org, extending is very powerful as it operates
15186 at the parser level.
15188 For this example, make the /ascii/ back-end display the language used
15189 in a source code block. Also make it display only when some attribute
15190 is non-~nil~, like the following:
15192 : #+ATTR_ASCII: :language t
15194 Then extend /ascii/ back-end with a custom "my-ascii" back-end.
15196 #+begin_src emacs-lisp
15197 (defun my-ascii-src-block (src-block contents info)
15198 "Transcode a SRC-BLOCK element from Org to ASCII.
15199 CONTENTS is nil. INFO is a plist used as a communication
15201 (if (not (org-export-read-attribute :attr_ascii src-block :language))
15202 (org-export-with-backend 'ascii src-block contents info)
15204 (format ",--[ %s ]--\n%s`----"
15205 (org-element-property :language src-block)
15206 (replace-regexp-in-string
15208 (org-element-normalize-string
15209 (org-export-format-code-default src-block info)))))))
15211 (org-export-define-derived-backend 'my-ascii 'ascii
15212 :translate-alist '((src-block . my-ascii-src-block)))
15215 The ~my-ascii-src-block~ function looks at the attribute above the
15216 current element. If not true, hands over to /ascii/ back-end. If
15217 true, which it is in this example, it creates a box around the code
15218 and leaves room for the inserting a string for language. The last
15219 form creates the new back-end that springs to action only when
15220 translating ~src-block~ type elements.
15222 To use the newly defined back-end, evaluate the following from an Org
15225 #+begin_src emacs-lisp
15226 (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
15229 Further steps to consider would be an interactive function,
15230 self-installing an item in the export dispatcher menu, and other
15231 user-friendly improvements.
15233 ** Export in Foreign Buffers
15235 :DESCRIPTION: Author tables and lists in Org syntax.
15238 The export back-ends in Org often include commands to convert selected
15239 regions. A convenient feature of this in-place conversion is that the
15240 exported output replaces the original source. Here are such
15243 - ~org-html-convert-region-to-html~ ::
15245 #+findex: org-html-convert-region-to-html
15246 Convert the selected region into HTML.
15248 - ~org-latex-convert-region-to-latex~ ::
15250 #+findex: org-latex-convert-region-to-latex
15251 Convert the selected region into LaTeX.
15253 - ~org-texinfo-convert-region-to-texinfo~ ::
15255 #+findex: org-texinfo-convert-region-to-texinfo
15256 Convert the selected region into Texinfo.
15258 - ~org-md-convert-region-to-md~ ::
15260 #+findex: org-md-convert-region-to-md
15261 Convert the selected region into Markdown.
15263 In-place conversions are particularly handy for quick conversion of
15264 tables and lists in foreign buffers. For example, turn on the minor
15265 mode {{{kbd(M-x orgstruct-mode)}}} in an HTML buffer, then use the
15266 convenient Org keyboard commands to create a list, select it, and
15267 covert it to HTML with {{{kbd(M-x org-html-convert-region-to-html)}}}.
15271 :DESCRIPTION: Create a web site of linked Org files.
15273 #+cindex: publishing
15275 Org includes a publishing management system that allows you to
15276 configure automatic HTML conversion of /projects/ composed of
15277 interlinked Org files. You can also configure Org to automatically
15278 upload your exported HTML pages and related attachments, such as
15279 images and source code files, to a web server.
15281 You can also use Org to convert files into PDF, or even combine HTML
15282 and PDF conversion so that files are available in both formats on the
15285 Publishing has been contributed to Org by David O'Toole.
15289 :DESCRIPTION: Defining projects.
15291 Publishing needs significant configuration to specify files,
15292 destination and many other properties of a project.
15294 *** The variable ~org-publish-project-alist~
15296 :DESCRIPTION: The central configuration variable.
15297 :ALT_TITLE: Project alist
15299 #+cindex: projects, for publishing
15301 #+vindex: org-publish-project-alist
15302 Publishing is configured almost entirely through setting the value of
15303 one variable, called ~org-publish-project-alist~. Each element of the
15304 list configures one project, and may be in one of the two following
15307 #+begin_src emacs-lisp
15308 ("project-name" :property value :property value ...)
15311 #+texinfo: @noindent
15312 i.e., a well-formed property list with alternating keys and values,
15315 #+begin_src emacs-lisp
15316 ("project-name" :components ("project-name" "project-name" ...))
15319 In both cases, projects are configured by specifying property values.
15320 A project defines the set of files that are to be published, as well
15321 as the publishing configuration to use when publishing those files.
15322 When a project takes the second form listed above, the individual
15323 members of the ~:components~ property are taken to be sub-projects,
15324 which group together files requiring different publishing options.
15325 When you publish such a "meta-project", all the components are also
15326 published, in the sequence given.
15328 *** Sources and destinations for files
15330 :DESCRIPTION: From here to there.
15331 :ALT_TITLE: Sources and destinations
15333 #+cindex: directories, for publishing
15335 Most properties are optional, but some should always be set. In
15336 particular, Org needs to know where to look for source files, and
15337 where to put published files.
15339 - ~:base-directory~ ::
15341 Directory containing publishing source files.
15343 - ~:publishing-directory~ ::
15345 Directory where output files are published. You can directly
15346 publish to a webserver using a file name syntax appropriate for
15347 the Emacs tramp package. Or you can publish to a local directory
15348 and use external tools to upload your website (see [[*Uploading
15351 - ~:preparation-function~ ::
15353 Function or list of functions to be called before starting the
15354 publishing process, for example, to run =make= for updating files
15355 to be published. Each preparation function is called with
15356 a single argument, the project property list.
15358 - ~:completion-function~ ::
15360 Function or list of functions called after finishing the
15361 publishing process, for example, to change permissions of the
15362 resulting files. Each completion function is called with
15363 a single argument, the project property list.
15365 *** Selecting files
15367 :DESCRIPTION: What files are part of the project?
15369 #+cindex: files, selecting for publishing
15371 By default, all files with extension =.org= in the base directory are
15372 considered part of the project. This can be modified by setting the
15373 following properties
15375 - ~:base-extension~ ::
15377 Extension---without the dot---of source files. This actually
15378 is a regular expression. Set this to the symbol ~any~ if you
15379 want to get all files in ~:base-directory~, even without
15384 Regular expression to match file names that should not be published,
15385 even though they have been selected on the basis of their extension.
15389 List of files to be included regardless of ~:base-extension~ and
15394 Non-~nil~ means, check base-directory recursively for files to
15397 *** Publishing action
15399 :DESCRIPTION: Setting the function doing the publishing.
15401 #+cindex: action, for publishing
15403 Publishing means that a file is copied to the destination directory
15404 and possibly transformed in the process. The default transformation
15405 is to export Org files as HTML files, and this is done by the function
15406 ~org-publish-org-to-html~ which calls the HTML exporter (see [[*HTML
15407 Export]]). But you can also publish your content as PDF files using
15408 ~org-publish-org-to-pdf~, or as ASCII, Texinfo, etc., using the
15409 corresponding functions.
15411 If you want to publish the Org file as an =.org= file but with
15412 /archived/, /commented/, and /tag-excluded/ trees removed, use
15413 ~org-publish-org-to-org~. This produces =file.org= and put it in the
15414 publishing directory. If you want a htmlized version of this file,
15415 set the parameter ~:htmlized-source~ to ~t~. It produces
15416 =file.org.html= in the publishing directory[fn:129].
15418 Other files like images only need to be copied to the publishing
15419 destination; for this you can use ~org-publish-attachment~. For
15420 non-Org files, you always need to specify the publishing function:
15422 - ~:publishing-function~ ::
15424 Function executing the publication of a file. This may also be
15425 a list of functions, which are all called in turn.
15427 - ~:plain-source~ ::
15429 Non-~nil~ means, publish plain source.
15431 - ~:htmlized-source~ ::
15433 Non-~nil~ means, publish htmlized source.
15435 The function must accept three arguments: a property list containing
15436 at least a ~:publishing-directory~ property, the name of the file to
15437 be published, and the path to the publishing directory of the output
15438 file. It should take the specified file, make the necessary
15439 transformation, if any, and place the result into the destination
15442 *** Options for the exporters
15444 :DESCRIPTION: Tweaking HTML/@LaTeX{} export.
15445 :ALT_TITLE: Publishing options
15447 #+cindex: options, for publishing
15448 #+cindex: publishing options
15450 The property list can be used to set many export options for the HTML
15451 and LaTeX exporters. In most cases, these properties correspond to
15452 user variables in Org. The table below lists these properties along
15453 with the variable they belong to. See the documentation string for
15454 the respective variable for details.
15456 #+vindex: org-publish-project-alist
15457 When a property is given a value in ~org-publish-project-alist~, its
15458 setting overrides the value of the corresponding user variable, if
15459 any, during publishing. Options set within a file (see [[*Export
15460 Settings]]), however, override everything.
15462 **** Generic properties
15467 | ~:archived-trees~ | ~org-export-with-archived-trees~ |
15468 | ~:exclude-tags~ | ~org-export-exclude-tags~ |
15469 | ~:headline-levels~ | ~org-export-headline-levels~ |
15470 | ~:language~ | ~org-export-default-language~ |
15471 | ~:preserve-breaks~ | ~org-export-preserve-breaks~ |
15472 | ~:section-numbers~ | ~org-export-with-section-numbers~ |
15473 | ~:select-tags~ | ~org-export-select-tags~ |
15474 | ~:with-author~ | ~org-export-with-author~ |
15475 | ~:with-broken-links~ | ~org-export-with-broken-links~ |
15476 | ~:with-clocks~ | ~org-export-with-clocks~ |
15477 | ~:with-creator~ | ~org-export-with-creator~ |
15478 | ~:with-date~ | ~org-export-with-date~ |
15479 | ~:with-drawers~ | ~org-export-with-drawers~ |
15480 | ~:with-email~ | ~org-export-with-email~ |
15481 | ~:with-emphasize~ | ~org-export-with-emphasize~ |
15482 | ~:with-fixed-width~ | ~org-export-with-fixed-width~ |
15483 | ~:with-footnotes~ | ~org-export-with-footnotes~ |
15484 | ~:with-latex~ | ~org-export-with-latex~ |
15485 | ~:with-planning~ | ~org-export-with-planning~ |
15486 | ~:with-priority~ | ~org-export-with-priority~ |
15487 | ~:with-properties~ | ~org-export-with-properties~ |
15488 | ~:with-special-strings~ | ~org-export-with-special-strings~ |
15489 | ~:with-sub-superscript~ | ~org-export-with-sub-superscripts~ |
15490 | ~:with-tables~ | ~org-export-with-tables~ |
15491 | ~:with-tags~ | ~org-export-with-tags~ |
15492 | ~:with-tasks~ | ~org-export-with-tasks~ |
15493 | ~:with-timestamps~ | ~org-export-with-timestamps~ |
15494 | ~:with-title~ | ~org-export-with-title~ |
15495 | ~:with-toc~ | ~org-export-with-toc~ |
15496 | ~:with-todo-keywords~ | ~org-export-with-todo-keywords~ |
15498 **** ASCII specific properties
15503 | ~:ascii-bullets~ | ~org-ascii-bullets~ |
15504 | ~:ascii-caption-above~ | ~org-ascii-caption-above~ |
15505 | ~:ascii-charset~ | ~org-ascii-charset~ |
15506 | ~:ascii-global-margin~ | ~org-ascii-global-margin~ |
15507 | ~:ascii-format-drawer-function~ | ~org-ascii-format-drawer-function~ |
15508 | ~:ascii-format-inlinetask-function~ | ~org-ascii-format-inlinetask-function~ |
15509 | ~:ascii-headline-spacing~ | ~org-ascii-headline-spacing~ |
15510 | ~:ascii-indented-line-width~ | ~org-ascii-indented-line-width~ |
15511 | ~:ascii-inlinetask-width~ | ~org-ascii-inlinetask-width~ |
15512 | ~:ascii-inner-margin~ | ~org-ascii-inner-margin~ |
15513 | ~:ascii-links-to-notes~ | ~org-ascii-links-to-notes~ |
15514 | ~:ascii-list-margin~ | ~org-ascii-list-margin~ |
15515 | ~:ascii-paragraph-spacing~ | ~org-ascii-paragraph-spacing~ |
15516 | ~:ascii-quote-margin~ | ~org-ascii-quote-margin~ |
15517 | ~:ascii-table-keep-all-vertical-lines~ | ~org-ascii-table-keep-all-vertical-lines~ |
15518 | ~:ascii-table-use-ascii-art~ | ~org-ascii-table-use-ascii-art~ |
15519 | ~:ascii-table-widen-columns~ | ~org-ascii-table-widen-columns~ |
15520 | ~:ascii-text-width~ | ~org-ascii-text-width~ |
15521 | ~:ascii-underline~ | ~org-ascii-underline~ |
15522 | ~:ascii-verbatim-format~ | ~org-ascii-verbatim-format~ |
15524 **** Beamer specific properties
15529 | ~:beamer-theme~ | ~org-beamer-theme~ |
15530 | ~:beamer-column-view-format~ | ~org-beamer-column-view-format~ |
15531 | ~:beamer-environments-extra~ | ~org-beamer-environments-extra~ |
15532 | ~:beamer-frame-default-options~ | ~org-beamer-frame-default-options~ |
15533 | ~:beamer-outline-frame-options~ | ~org-beamer-outline-frame-options~ |
15534 | ~:beamer-outline-frame-title~ | ~org-beamer-outline-frame-title~ |
15535 | ~:beamer-subtitle-format~ | ~org-beamer-subtitle-format~ |
15537 **** HTML specific properties
15542 | ~:html-allow-name-attribute-in-anchors~ | ~org-html-allow-name-attribute-in-anchors~ |
15543 | ~:html-checkbox-type~ | ~org-html-checkbox-type~ |
15544 | ~:html-container~ | ~org-html-container-element~ |
15545 | ~:html-divs~ | ~org-html-divs~ |
15546 | ~:html-doctype~ | ~org-html-doctype~ |
15547 | ~:html-extension~ | ~org-html-extension~ |
15548 | ~:html-footnote-format~ | ~org-html-footnote-format~ |
15549 | ~:html-footnote-separator~ | ~org-html-footnote-separator~ |
15550 | ~:html-footnotes-section~ | ~org-html-footnotes-section~ |
15551 | ~:html-format-drawer-function~ | ~org-html-format-drawer-function~ |
15552 | ~:html-format-headline-function~ | ~org-html-format-headline-function~ |
15553 | ~:html-format-inlinetask-function~ | ~org-html-format-inlinetask-function~ |
15554 | ~:html-head-extra~ | ~org-html-head-extra~ |
15555 | ~:html-head-include-default-style~ | ~org-html-head-include-default-style~ |
15556 | ~:html-head-include-scripts~ | ~org-html-head-include-scripts~ |
15557 | ~:html-head~ | ~org-html-head~ |
15558 | ~:html-home/up-format~ | ~org-html-home/up-format~ |
15559 | ~:html-html5-fancy~ | ~org-html-html5-fancy~ |
15560 | ~:html-indent~ | ~org-html-indent~ |
15561 | ~:html-infojs-options~ | ~org-html-infojs-options~ |
15562 | ~:html-infojs-template~ | ~org-html-infojs-template~ |
15563 | ~:html-inline-image-rules~ | ~org-html-inline-image-rules~ |
15564 | ~:html-inline-images~ | ~org-html-inline-images~ |
15565 | ~:html-link-home~ | ~org-html-link-home~ |
15566 | ~:html-link-org-files-as-html~ | ~org-html-link-org-files-as-html~ |
15567 | ~:html-link-up~ | ~org-html-link-up~ |
15568 | ~:html-link-use-abs-url~ | ~org-html-link-use-abs-url~ |
15569 | ~:html-mathjax-options~ | ~org-html-mathjax-options~ |
15570 | ~:html-mathjax-template~ | ~org-html-mathjax-template~ |
15571 | ~:html-metadata-timestamp-format~ | ~org-html-metadata-timestamp-format~ |
15572 | ~:html-postamble-format~ | ~org-html-postamble-format~ |
15573 | ~:html-postamble~ | ~org-html-postamble~ |
15574 | ~:html-preamble-format~ | ~org-html-preamble-format~ |
15575 | ~:html-preamble~ | ~org-html-preamble~ |
15576 | ~:html-table-align-individual-field~ | ~de{org-html-table-align-individual-fields~ |
15577 | ~:html-table-attributes~ | ~org-html-table-default-attributes~ |
15578 | ~:html-table-caption-above~ | ~org-html-table-caption-above~ |
15579 | ~:html-table-data-tags~ | ~org-html-table-data-tags~ |
15580 | ~:html-table-header-tags~ | ~org-html-table-header-tags~ |
15581 | ~:html-table-row-tags~ | ~org-html-table-row-tags~ |
15582 | ~:html-table-use-header-tags-for-first-column~ | ~org-html-table-use-header-tags-for-first-column~ |
15583 | ~:html-tag-class-prefix~ | ~org-html-tag-class-prefix~ |
15584 | ~:html-text-markup-alist~ | ~org-html-text-markup-alist~ |
15585 | ~:html-todo-kwd-class-prefix~ | ~org-html-todo-kwd-class-prefix~ |
15586 | ~:html-toplevel-hlevel~ | ~org-html-toplevel-hlevel~ |
15587 | ~:html-use-infojs~ | ~org-html-use-infojs~ |
15588 | ~:html-validation-link~ | ~org-html-validation-link~ |
15589 | ~:html-viewport~ | ~org-html-viewport~ |
15590 | ~:html-xml-declaration~ | ~org-html-xml-declaration~ |
15592 **** LaTeX specific properties
15597 | ~:latex-active-timestamp-format~ | ~org-latex-active-timestamp-format~ |
15598 | ~:latex-caption-above~ | ~org-latex-caption-above~ |
15599 | ~:latex-classes~ | ~org-latex-classes~ |
15600 | ~:latex-class~ | ~org-latex-default-class~ |
15601 | ~:latex-compiler~ | ~org-latex-compiler~ |
15602 | ~:latex-default-figure-position~ | ~org-latex-default-figure-position~ |
15603 | ~:latex-default-table-environment~ | ~org-latex-default-table-environment~ |
15604 | ~:latex-default-table-mode~ | ~org-latex-default-table-mode~ |
15605 | ~:latex-diary-timestamp-format~ | ~org-latex-diary-timestamp-format~ |
15606 | ~:latex-footnote-defined-format~ | ~org-latex-footnote-defined-format~ |
15607 | ~:latex-footnote-separator~ | ~org-latex-footnote-separator~ |
15608 | ~:latex-format-drawer-function~ | ~org-latex-format-drawer-function~ |
15609 | ~:latex-format-headline-function~ | ~org-latex-format-headline-function~ |
15610 | ~:latex-format-inlinetask-function~ | ~org-latex-format-inlinetask-function~ |
15611 | ~:latex-hyperref-template~ | ~org-latex-hyperref-template~ |
15612 | ~:latex-image-default-height~ | ~org-latex-image-default-height~ |
15613 | ~:latex-image-default-option~ | ~org-latex-image-default-option~ |
15614 | ~:latex-image-default-width~ | ~org-latex-image-default-width~ |
15615 | ~:latex-images-centered~ | ~org-latex-images-centered~ |
15616 | ~:latex-inactive-timestamp-format~ | ~org-latex-inactive-timestamp-format~ |
15617 | ~:latex-inline-image-rules~ | ~org-latex-inline-image-rules~ |
15618 | ~:latex-link-with-unknown-path-format~ | ~org-latex-link-with-unknown-path-format~ |
15619 | ~:latex-listings-langs~ | ~org-latex-listings-langs~ |
15620 | ~:latex-listings-options~ | ~org-latex-listings-options~ |
15621 | ~:latex-listings~ | ~org-latex-listings~ |
15622 | ~:latex-minted-langs~ | ~org-latex-minted-langs~ |
15623 | ~:latex-minted-options~ | ~org-latex-minted-options~ |
15624 | ~:latex-prefer-user-labels~ | ~org-latex-prefer-user-labels~ |
15625 | ~:latex-subtitle-format~ | ~org-latex-subtitle-format~ |
15626 | ~:latex-subtitle-separate~ | ~org-latex-subtitle-separate~ |
15627 | ~:latex-table-scientific-notation~ | ~org-latex-table-scientific-notation~ |
15628 | ~:latex-tables-booktabs~ | ~org-latex-tables-booktabs~ |
15629 | ~:latex-tables-centered~ | ~org-latex-tables-centered~ |
15630 | ~:latex-text-markup-alist~ | ~org-latex-text-markup-alist~ |
15631 | ~:latex-title-command~ | ~org-latex-title-command~ |
15632 | ~:latex-toc-command~ | ~org-latex-toc-command~ |
15634 **** Markdown specific properties
15639 | ~:md-footnote-format~ | ~org-md-footnote-format~ |
15640 | ~:md-footnotes-section~ | ~org-md-footnotes-section~ |
15641 | ~:md-headline-style~ | ~org-md-headline-style~ |
15643 **** ODT specific properties
15648 | ~:odt-content-template-file~ | ~org-odt-content-template-file~ |
15649 | ~:odt-display-outline-level~ | ~org-odt-display-outline-level~ |
15650 | ~:odt-fontify-srcblocks~ | ~org-odt-fontify-srcblocks~ |
15651 | ~:odt-format-drawer-function~ | ~org-odt-format-drawer-function~ |
15652 | ~:odt-format-headline-function~ | ~org-odt-format-headline-function~ |
15653 | ~:odt-format-inlinetask-function~ | ~org-odt-format-inlinetask-function~ |
15654 | ~:odt-inline-formula-rules~ | ~org-odt-inline-formula-rules~ |
15655 | ~:odt-inline-image-rules~ | ~org-odt-inline-image-rules~ |
15656 | ~:odt-pixels-per-inch~ | ~org-odt-pixels-per-inch~ |
15657 | ~:odt-styles-file~ | ~org-odt-styles-file~ |
15658 | ~:odt-table-styles~ | ~org-odt-table-styles~ |
15659 | ~:odt-use-date-fields~ | ~org-odt-use-date-fields~ |
15661 **** Texinfo specific properties
15666 | ~:texinfo-active-timestamp-format~ | ~org-texinfo-active-timestamp-format~ |
15667 | ~:texinfo-classes~ | ~org-texinfo-classes~ |
15668 | ~:texinfo-class~ | ~org-texinfo-default-class~ |
15669 | ~:texinfo-table-default-markup~ | ~org-texinfo-table-default-markup~ |
15670 | ~:texinfo-diary-timestamp-format~ | ~org-texinfo-diary-timestamp-format~ |
15671 | ~:texinfo-filename~ | ~org-texinfo-filename~ |
15672 | ~:texinfo-format-drawer-function~ | ~org-texinfo-format-drawer-function~ |
15673 | ~:texinfo-format-headline-function~ | ~org-texinfo-format-headline-function~ |
15674 | ~:texinfo-format-inlinetask-function~ | ~org-texinfo-format-inlinetask-function~ |
15675 | ~:texinfo-inactive-timestamp-format~ | ~org-texinfo-inactive-timestamp-format~ |
15676 | ~:texinfo-link-with-unknown-path-format~ | ~org-texinfo-link-with-unknown-path-format~ |
15677 | ~:texinfo-node-description-column~ | ~org-texinfo-node-description-column~ |
15678 | ~:texinfo-table-scientific-notation~ | ~org-texinfo-table-scientific-notation~ |
15679 | ~:texinfo-tables-verbatim~ | ~org-texinfo-tables-verbatim~ |
15680 | ~:texinfo-text-markup-alist~ | ~org-texinfo-text-markup-alist~ |
15682 *** Publishing links
15684 :DESCRIPTION: Which links keep working after publishing?
15686 #+cindex: links, publishing
15688 To create a link from one Org file to another, you would use something
15689 like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see [[*External Links]]). When
15690 published, this link becomes a link to =foo.html=. You can thus
15691 interlink the pages of your "Org web" project and the links will work
15692 as expected when you publish them to HTML. If you also publish the
15693 Org source file and want to link to it, use an =http= link instead of
15694 a =file:= link, because =file= links are converted to link to the
15695 corresponding =.html= file.
15697 You may also link to related files, such as images. Provided you are
15698 careful with relative file names, and provided you have also
15699 configured Org to upload the related files, these links will work too.
15700 See [[*Example: complex publishing configuration]], for an example of this
15703 Eventually, links between published documents can contain some search
15704 options (see [[*Search Options in File Links]]), which will be resolved to
15705 the appropriate location in the linked file. For example, once
15706 published to HTML, the following links all point to a dedicated anchor
15710 [[file:foo.org::*heading]]
15711 [[file:foo.org::#custom-id]]
15712 [[file:foo.org::target]]
15715 *** Generating a sitemap
15717 :DESCRIPTION: Generating a list of all pages.
15718 :ALT_TITLE: Site map
15720 #+cindex: sitemap, of published pages
15722 The following properties may be used to control publishing of
15723 a map of files for a given project.
15725 - ~:auto-sitemap~ ::
15727 When non-~nil~, publish a sitemap during
15728 ~org-publish-current-project~ or ~org-publish-all~.
15730 - ~:sitemap-filename~ ::
15732 Filename for output of sitemap. Defaults to =sitemap.org=, which
15733 becomes =sitemap.html=.
15735 - ~:sitemap-title~ ::
15737 Title of sitemap page. Defaults to name of file.
15739 - ~:sitemap-format-entry~ ::
15741 #+findex: org-publish-find-date
15742 #+findex: org-publish-find-property
15743 #+findex: org-publish-find-title
15744 With this option one can tell how a site-map entry is formatted
15745 in the site-map. It is a function called with three arguments:
15746 the file or directory name relative to base directory of the
15747 project, the site-map style and the current project. It is
15748 expected to return a string. Default value turns file names into
15749 links and use document titles as descriptions. For specific
15750 formatting needs, one can use ~org-publish-find-date~,
15751 ~org-publish-find-title~ and ~org-publish-find-property~, to
15752 retrieve additional information about published documents.
15754 - ~:sitemap-function~ ::
15756 Plug-in function to use for generation of the sitemap. It is
15757 called with two arguments: the title of the site-map and
15758 a representation of the files and directories involved in the
15759 project as a nested list, which can further be transformed using
15760 ~org-list-to-generic~, ~org-list-to-subtree~ and alike. Default
15761 value generates a plain list of links to all files in the
15764 - ~:sitemap-sort-folders~ ::
15766 Where folders should appear in the sitemap. Set this to ~first~
15767 (default) or ~last~ to display folders first or last,
15768 respectively. When set to ~ignore~, folders are ignored
15769 altogether. Any other value mixes files and folders. This
15770 variable has no effect when site-map style is ~tree~.
15772 - ~:sitemap-sort-files~ ::
15774 How the files are sorted in the site map. Set this to
15775 ~alphabetically~ (default), ~chronologically~ or
15776 ~anti-chronologically~. ~chronologically~ sorts the files with
15777 older date first while ~anti-chronologically~ sorts the files
15778 with newer date first. ~alphabetically~ sorts the files
15779 alphabetically. The date of a file is retrieved with
15780 ~org-publish-find-date~.
15782 - ~:sitemap-ignore-case~ ::
15784 Should sorting be case-sensitive? Default ~nil~.
15786 - ~:sitemap-file-entry-format~ ::
15788 With this option one can tell how a sitemap's entry is formatted
15789 in the sitemap. This is a format string with some escape
15790 sequences: ~%t~ stands for the title of the file, ~%a~ stands for
15791 the author of the file and ~%d~ stands for the date of the file.
15792 The date is retrieved with the ~org-publish-find-date~ function
15793 and formatted with ~org-publish-sitemap-date-format~. Default
15796 - ~:sitemap-date-format~ ::
15798 Format string for the ~format-time-string~ function that tells
15799 how a sitemap entry's date is to be formatted. This property
15800 bypasses ~org-publish-sitemap-date-format~ which defaults to
15803 *** Generating an index
15805 :DESCRIPTION: An index that reaches across pages.
15807 #+cindex: index, in a publishing project
15809 Org mode can generate an index across the files of a publishing project.
15813 When non-~nil~, generate in index in the file =theindex.org= and
15814 publish it as =theindex.html=.
15816 The file is created when first publishing a project with the
15817 ~:makeindex~ set. The file only contains a statement =#+INCLUDE:
15818 "theindex.inc"=. You can then build around this include statement by
15819 adding a title, style information, etc.
15821 #+cindex: @samp{INDEX}, keyword
15822 Index entries are specified with =INDEX= keyword. An entry that
15823 contains an exclamation mark creates a sub item.
15826 ,*** Curriculum Vitae
15828 ,#+INDEX: Application!CV
15833 :DESCRIPTION: How to get files up on the server.
15838 For those people already utilizing third party sync tools such as
15839 Rsync or Unison, it might be preferable not to use the built-in remote
15840 publishing facilities of Org mode which rely heavily on Tramp. Tramp,
15841 while very useful and powerful, tends not to be so efficient for
15842 multiple file transfer and has been known to cause problems under
15845 Specialized synchronization utilities offer several advantages. In
15846 addition to timestamp comparison, they also do content and
15847 permissions/attribute checks. For this reason you might prefer to
15848 publish your web to a local directory---possibly even /in place/ with
15849 your Org files---and then use Unison or Rsync to do the
15850 synchronization with the remote host.
15852 Since Unison, for example, can be configured as to which files to
15853 transfer to a certain remote destination, it can greatly simplify the
15854 project publishing definition. Simply keep all files in the correct
15855 location, process your Org files with ~org-publish~ and let the
15856 synchronization tool do the rest. You do not need, in this scenario,
15857 to include attachments such as JPG, CSS or PNG files in the project
15858 definition since the third-party tool syncs them.
15860 Publishing to a local directory is also much faster than to a remote
15861 one, so that you can afford more easily to republish entire projects.
15862 If you set ~org-publish-use-timestamps-flag~ to ~nil~, you gain the
15863 main benefit of re-including any changed external files such as source
15864 example files you might include with =INCLUDE= keyword. The timestamp
15865 mechanism in Org is not smart enough to detect if included files have
15868 ** Sample Configuration
15870 :DESCRIPTION: Example projects.
15873 Below we provide two example configurations. The first one is
15874 a simple project publishing only a set of Org files. The second
15875 example is more complex, with a multi-component project.
15877 *** Example: simple publishing configuration
15879 :DESCRIPTION: One-component publishing.
15880 :ALT_TITLE: Simple example
15883 This example publishes a set of Org files to the =public_html=
15884 directory on the local machine.
15886 #+begin_src emacs-lisp
15887 (setq org-publish-project-alist
15889 :base-directory "~/org/"
15890 :publishing-directory "~/public_html"
15891 :section-numbers nil
15892 :table-of-contents nil
15893 :style "<link rel=\"stylesheet\"
15894 href=\"../other/mystyle.css\"
15895 type=\"text/css\"/>")))
15898 *** Example: complex publishing configuration
15900 :DESCRIPTION: A multi-component publishing example.
15901 :ALT_TITLE: Complex example
15904 This more complicated example publishes an entire website, including
15905 Org files converted to HTML, image files, Emacs Lisp source code, and
15906 style sheets. The publishing directory is remote and private files
15909 To ensure that links are preserved, care should be taken to replicate
15910 your directory structure on the web server, and to use relative file
15911 paths. For example, if your Org files are kept in =~/org/= and your
15912 publishable images in =~/images/=, you would link to an image with
15914 : file:../images/myimage.png
15916 On the web server, the relative path to the image should be the same.
15917 You can accomplish this by setting up an =images/= folder in the right
15918 place on the web server, and publishing images to it.
15920 #+begin_src emacs-lisp
15921 (setq org-publish-project-alist
15923 :base-directory "~/org/"
15924 :base-extension "org"
15925 :publishing-directory "/ssh:user@host:~/html/notebook/"
15926 :publishing-function org-html-publish-to-html
15927 :exclude "PrivatePage.org" ;; regexp
15929 :section-numbers nil
15931 :html-head "<link rel=\"stylesheet\"
15932 href=\"../other/mystyle.css\" type=\"text/css\"/>"
15936 :base-directory "~/images/"
15937 :base-extension "jpg\\|gif\\|png"
15938 :publishing-directory "/ssh:user@host:~/html/images/"
15939 :publishing-function org-publish-attachment)
15942 :base-directory "~/other/"
15943 :base-extension "css\\|el"
15944 :publishing-directory "/ssh:user@host:~/html/other/"
15945 :publishing-function org-publish-attachment)
15946 ("website" :components ("orgfiles" "images" "other"))))
15949 ** Triggering Publication
15951 :DESCRIPTION: Publication commands.
15954 Once properly configured, Org can publish with the following commands:
15956 - {{{kbd(C-c C-e X)}}} (~org-publish~) ::
15958 #+kindex: C-c C-e X
15959 #+findex: org-publish
15960 Prompt for a specific project and publish all files that belong
15963 - {{{kbd(C-c C-e P)}}} (~org-publish-current-project~) ::
15965 #+kindex: C-c C-e P
15966 #+findex: org-publish-current-project
15967 Publish the project containing the current file.
15969 - {{{kbd(C-c C-e F)}}} (~org-publish-current-file~) ::
15971 #+kindex: C-c C-e F
15972 #+findex: org-publish-current-file
15973 Publish only the current file.
15975 - {{{kbd(C-c C-e E)}}} (~org-publish-all~) ::
15977 #+kindex: C-c C-e E
15978 #+findex: org-publish-all
15979 Publish every project.
15981 #+vindex: org-publish-use-timestamps-flag
15982 Org uses timestamps to track when a file has changed. The above
15983 functions normally only publish changed files. You can override this
15984 and force publishing of all files by giving a prefix argument to any
15985 of the commands above, or by customizing the variable
15986 ~org-publish-use-timestamps-flag~. This may be necessary in
15987 particular if files include other files via =SETUPFILE= or =INCLUDE=
15990 * Working with Source Code
15992 :DESCRIPTION: Export, evaluate, and tangle code blocks.
15994 #+cindex: source code, working with
15996 Source code here refers to any plain text collection of computer
15997 instructions, possibly with comments, written using a human-readable
15998 programming language. Org can manage source code in an Org document
15999 when the source code is identified with begin and end markers.
16000 Working with source code begins with identifying source code blocks.
16001 A source code block can be placed almost anywhere in an Org document;
16002 it is not restricted to the preamble or the end of the document.
16003 However, Org cannot manage a source code block if it is placed inside
16004 an Org comment or within a fixed width section.
16006 Here is an example source code block in the Emacs Lisp language:
16009 ,#+BEGIN_SRC emacs-lisp
16010 (defun org-xor (a b)
16016 Org can manage the source code in the block delimited by =#+BEGIN_SRC=
16017 ... =#+END_SRC= in several ways that can simplify housekeeping tasks
16018 essential to modern source code maintenance. Org can edit, format,
16019 extract, export, and publish source code blocks. Org can also compile
16020 and execute a source code block, then capture the results. The Org
16021 mode literature sometimes refers to source code blocks as /live code/
16022 blocks because they can alter the content of the Org document or the
16023 material that it exports. Users can control how live they want each
16024 source code block by tweaking the header arguments (see [[*Using
16025 Header Arguments]]) for compiling, execution, extraction, and
16028 Source code blocks are one of many Org block types, which also include
16029 =quote=, =export=, =verse=, =latex=, =example=, and =verbatim=. This
16030 section pertains to blocks between =#+BEGIN_SRC= and =#+END_SRC=.
16032 For editing and formatting a source code block, Org uses an
16033 appropriate Emacs major mode that includes features specifically
16034 designed for source code in that language.
16036 Org can extract one or more source code blocks and write them to one
16037 or more source files---a process known as /tangling/ in literate
16038 programming terminology.
16040 For exporting and publishing, Org's back-ends can format a source code
16041 block appropriately, often with native syntax highlighting.
16043 For executing and compiling a source code block, the user can
16044 configure Org to select the appropriate compiler. Org provides
16045 facilities to collect the result of the execution or compiler output,
16046 insert it into the Org document, and/or export it. In addition to
16047 text results, Org can insert links to other data types, including
16048 audio, video, and graphics. Org can also link a compiler error
16049 message to the appropriate line in the source code block.
16051 An important feature of Org's management of source code blocks is the
16052 ability to pass variables, functions, and results to one another using
16053 a common syntax for source code blocks in any language. Although most
16054 literate programming facilities are restricted to one language or
16055 another, Org's language-agnostic approach lets the literate programmer
16056 match each programming task with the appropriate computer language and
16057 to mix them all together in a single Org document. This
16058 interoperability among languages explains why Org's source code
16059 management facility was named /Org Babel/ by its originators, Eric
16060 Schulte and Dan Davison.
16062 Org mode fulfills the promise of easy verification and maintenance of
16063 publishing reproducible research by keeping text, data, code,
16064 configuration settings of the execution environment, the results of
16065 the execution, and associated narratives, claims, references, and
16066 internal and external links in a single Org document.
16068 Details of Org's facilities for working with source code are described
16069 in the following sections.
16071 ** Structure of Code Blocks
16073 :DESCRIPTION: Code block syntax described.
16075 #+cindex: code block, structure
16076 #+cindex: source code, block structure
16077 #+cindex: @samp{NAME} keyword, in source blocks
16078 #+cindex: @samp{BEGIN_SRC}
16080 Org offers two ways to structure source code in Org documents: in
16081 a source code block, and directly inline. Both specifications are
16084 A source code block conforms to this structure:
16088 ,#+BEGIN_SRC <language> <switches> <header arguments>
16093 Do not be put-off by having to remember the source block syntax. Org
16094 mode offers a command for wrapping existing text in a block (see
16095 [[*Structure Templates]]). Org also works with other completion systems
16096 in Emacs, some of which predate Org and have custom domain-specific
16097 languages for defining templates. Regular use of templates reduces
16098 errors, increases accuracy, and maintains consistency.
16100 #+cindex: source code, inline
16101 An inline code block conforms to this structure:
16103 : src_<language>{<body>}
16105 #+texinfo: @noindent
16108 : src_<language>[<header arguments>]{<body>}
16110 - =#+NAME: <name>= ::
16112 Optional. Names the source block so it can be called, like
16113 a function, from other source blocks or inline code to evaluate
16114 or to capture the results. Code from other blocks, other files,
16115 and from table formulas (see [[*The spreadsheet]]) can use the name
16116 to reference a source block. This naming serves the same purpose
16117 as naming Org tables. Org mode requires unique names. For
16118 duplicate names, Org mode's behavior is undefined.
16120 - =#+BEGIN_SRC= ... =#+END_SRC= ::
16122 Mandatory. They mark the start and end of a block that Org
16123 requires. The =#+BEGIN_SRC= line takes additional arguments, as
16128 #+cindex: language, in code blocks
16129 Mandatory. It is the identifier of the source code language in
16130 the block. See [[*Languages]], for identifiers of supported
16135 #+cindex: switches, in code blocks
16136 Optional. Switches provide finer control of the code execution,
16137 export, and format (see the discussion of switches in [[*Literal
16140 - =<header arguments>= ::
16142 #+cindex: header arguments, in code blocks
16143 Optional. Heading arguments control many aspects of evaluation,
16144 export and tangling of code blocks (see [[*Using Header Arguments]]).
16145 Using Org's properties feature, header arguments can be
16146 selectively applied to the entire buffer or specific sub-trees of
16151 Source code in the dialect of the specified language identifier.
16153 ** Using Header Arguments
16155 :DESCRIPTION: Different ways to set header arguments.
16158 Org comes with many header arguments common to all languages. New
16159 header arguments are added for specific languages as they become
16160 available for use in source code blocks. A header argument is
16161 specified with an initial colon followed by the argument's name in
16164 Since header arguments can be set in several ways, Org prioritizes
16165 them in case of overlaps or conflicts by giving local settings
16166 a higher priority. Header values in function calls, for example,
16167 override header values from global defaults.
16169 *** System-wide header arguments
16173 #+vindex: org-babel-default-header-args
16175 #+vindex: org-babel-default-header-args
16176 System-wide values of header arguments can be specified by customizing
16177 the ~org-babel-default-header-args~ variable, which defaults to the
16182 :results => "replace"
16188 The example below sets =:noweb= header arguments to =yes=, which makes
16189 Org expand =:noweb= references by default.
16191 #+begin_src emacs-lisp
16192 (setq org-babel-default-header-args
16193 (cons '(:noweb . "yes")
16194 (assq-delete-all :noweb org-babel-default-header-args)))
16197 #+cindex: language specific default header arguments
16198 #+cindex: default header arguments per language
16199 Each language can have separate default header arguments by
16200 customizing the variable ~org-babel-default-header-args:<LANG>~, where
16201 {{{var(<LANG>)}}} is the name of the language. For details, see the
16202 language-specific online documentation at
16203 https://orgmode.org/worg/org-contrib/babel/.
16205 *** Header arguments in Org mode properties
16210 For header arguments applicable to the buffer, use =PROPERTY= keyword
16211 anywhere in the Org file (see [[*Property Syntax]]).
16213 The following example makes all the R code blocks execute in the same
16214 session. Setting =:results= to =silent= ignores the results of
16215 executions for all blocks, not just R code blocks; no results inserted
16219 ,#+PROPERTY: header-args:R :session *R*
16220 ,#+PROPERTY: header-args :results silent
16223 #+vindex: org-use-property-inheritance
16224 Header arguments set through Org's property drawers (see [[*Property
16225 Syntax]]) apply at the sub-tree level on down. Since these property
16226 drawers can appear anywhere in the file hierarchy, Org uses outermost
16227 call or source block to resolve the values. Org ignores
16228 ~org-use-property-inheritance~ setting.
16230 In this example, =:cache= defaults to =yes= for all code blocks in the
16236 :header-args: :cache yes
16240 #+kindex: C-c C-x p
16241 #+findex: org-set-property
16242 Properties defined through ~org-set-property~ function, bound to
16243 {{{kbd(C-c C-x p)}}}, apply to all active languages. They override
16244 properties set in ~org-babel-default-header-args~.
16246 #+cindex: language specific header arguments properties
16247 #+cindex: header arguments per language
16248 Language-specific header arguments are also read from properties
16249 =header-args:<LANG>= where {{{var(<LANG>)}}} is the language
16250 identifier. For example,
16255 :header-args:clojure: :session *clojure-1*
16256 :header-args:R: :session *R*
16260 :header-args:clojure: :session *clojure-2*
16264 #+texinfo: @noindent
16265 would force separate sessions for Clojure blocks in =Heading= and
16266 =Subheading=, but use the same session for all R blocks. Blocks in
16267 =Subheading= inherit settings from =Heading=.
16269 *** Code block specific header arguments
16274 Header arguments are most commonly set at the source code block level,
16275 on the =#+BEGIN_SRC= line. Arguments set at this level take
16276 precedence over those set in the ~org-babel-default-header-args~
16277 variable, and also those set as header properties.
16279 In the following example, setting =:results= to =silent= makes it
16280 ignore results of the code execution. Setting =:exports= to =code=
16281 exports only the body of the code block to HTML or LaTeX.
16285 ,#+BEGIN_SRC haskell :results silent :exports code :var n=0
16287 fac n = n * fac (n-1)
16291 The same header arguments in an inline code block:
16293 : src_haskell[:exports both]{fac 5}
16295 #+cindex: @samp{HEADER}, keyword
16296 Code block header arguments can span multiple lines using =#+HEADER:=
16297 on each line. Note that Org currently accepts the plural spelling of
16298 =#+HEADER:= only as a convenience for backward-compatibility. It may
16299 be removed at some point.
16301 Multi-line header arguments on an unnamed code block:
16304 ,#+HEADER: :var data1=1
16305 ,#+BEGIN_SRC emacs-lisp :var data2=2
16306 (message "data1:%S, data2:%S" data1 data2)
16313 Multi-line header arguments on a named code block:
16316 ,#+NAME: named-block
16317 ,#+HEADER: :var data=2
16318 ,#+BEGIN_SRC emacs-lisp
16319 (message "data:%S" data)
16322 ,#+RESULTS: named-block
16326 *** Header arguments in function calls
16331 Header arguments in function calls are the most specific and override
16332 all other settings in case of an overlap. They get the highest
16333 priority. Two =#+CALL:= examples are shown below. For the complete
16334 syntax of =CALL= keyword, see [[*Evaluating Code Blocks]].
16336 In this example, =:exports results= header argument is applied to the
16337 evaluation of the =#+CALL:= line.
16339 : #+CALL: factorial(n=5) :exports results
16341 In this example, =:session special= header argument is applied to the
16342 evaluation of =factorial= code block.
16344 : #+CALL: factorial[:session special](n=5)
16346 ** Environment of a Code Block
16348 :DESCRIPTION: Arguments, sessions, working directory...
16351 *** Passing arguments
16356 #+cindex: passing arguments to code blocks
16357 #+cindex: arguments, in code blocks
16358 #+cindex: @samp{var}, header argument
16359 Use =var= for passing arguments to source code blocks. The specifics
16360 of variables in code blocks vary by the source language and are
16361 covered in the language-specific documentation. The syntax for =var=,
16362 however, is the same for all languages. This includes declaring
16363 a variable, and assigning a default value.
16365 The following syntax is used to pass arguments to code blocks using
16366 the =var= header argument.
16370 #+texinfo: @noindent
16371 {{{var(NAME)}}} is the name of the variable bound in the code block
16372 body. {{{var(ASSIGN)}}} is a literal value, such as a string,
16373 a number, a reference to a table, a list, a literal example, another
16374 code block---with or without arguments---or the results of evaluating
16377 Here are examples of passing values by reference:
16381 A table named with a =NAME= keyword.
16384 ,#+NAME: example-table
16390 ,#+NAME: table-length
16391 ,#+BEGIN_SRC emacs-lisp :var table=example-table
16395 ,#+RESULTS: table-length
16399 When passing a table, you can treat specially the row, or the
16400 column, containing labels for the columns, or the rows, in the
16403 #+cindex: @samp{colnames}, header argument
16404 The =colnames= header argument accepts =yes=, =no=, or =nil=
16405 values. The default value is =nil=: if an input table has column
16406 names---because the second row is a horizontal rule---then Org
16407 removes the column names, processes the table, puts back the
16408 column names, and then writes the table to the results block.
16409 Using =yes=, Org does the same to the first row, even if the
16410 initial table does not contain any horizontal rule. When set to
16411 =no=, Org does not pre-process column names at all.
16420 ,#+BEGIN_SRC python :var tab=less-cols :colnames nil
16421 return [[val + '*' for val in row] for row in tab]
16431 #+cindex: @samp{rownames}, header argument
16432 Similarly, the =rownames= header argument can take two values:
16433 =yes= or =no=. When set to =yes=, Org removes the first column,
16434 processes the table, puts back the first column, and then writes
16435 the table to the results block. The default is =no=, which means
16436 Org does not pre-process the first column. Note that Emacs Lisp
16437 code blocks ignore =rownames= header argument because of the ease
16438 of table-handling in Emacs.
16441 ,#+NAME: with-rownames
16442 | one | 1 | 2 | 3 | 4 | 5 |
16443 | two | 6 | 7 | 8 | 9 | 10 |
16445 ,#+BEGIN_SRC python :var tab=with-rownames :rownames yes
16446 return [[val + 10 for val in row] for row in tab]
16450 | one | 11 | 12 | 13 | 14 | 15 |
16451 | two | 16 | 17 | 18 | 19 | 20 |
16456 A simple named list.
16459 ,#+NAME: example-list
16465 ,#+BEGIN_SRC emacs-lisp :var x=example-list
16473 Note that only the top level list items are passed along. Nested
16474 list items are ignored.
16476 - code block without arguments ::
16478 A code block name, as assigned by =NAME= keyword from the example
16479 above, optionally followed by parentheses.
16482 ,#+BEGIN_SRC emacs-lisp :var length=table-length()
16490 - code block with arguments ::
16492 A code block name, as assigned by =NAME= keyword, followed by
16493 parentheses and optional arguments passed within the parentheses.
16497 ,#+BEGIN_SRC emacs-lisp :var input=8
16505 ,#+BEGIN_SRC emacs-lisp :var input=double(input=1)
16509 ,#+RESULTS: squared
16513 - literal example ::
16515 A literal example block named with a =NAME= keyword.
16518 ,#+NAME: literal-example
16524 ,#+NAME: read-literal-example
16525 ,#+BEGIN_SRC emacs-lisp :var x=literal-example
16526 (concatenate #'string x " for you.")
16529 ,#+RESULTS: read-literal-example
16530 : A literal example
16531 : on two lines for you.
16534 Indexing variable values enables referencing portions of a variable.
16535 Indexes are 0 based with negative values counting backwards from the
16536 end. If an index is separated by commas then each subsequent section
16537 indexes as the next dimension. Note that this indexing occurs
16538 /before/ other table-related header arguments are applied, such as
16539 =hlines=, =colnames= and =rownames=. The following example assigns
16540 the last cell of the first row the table =example-table= to the
16544 ,#+NAME: example-table
16550 ,#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
16558 Two integers separated by a colon reference a range of variable
16559 values. In that case the entire inclusive range is referenced. For
16560 example the following assigns the middle three rows of =example-table=
16564 ,#+NAME: example-table
16571 ,#+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
16581 To pick the entire range, use an empty index, or the single character
16582 =*=. =0:-1= does the same thing. Example below shows how to
16583 reference the first column only.
16586 ,#+NAME: example-table
16592 ,#+BEGIN_SRC emacs-lisp :var data=example-table[,0]
16600 Index referencing can be used for tables and code blocks. Index
16601 referencing can handle any number of dimensions. Commas delimit
16602 multiple dimensions, as shown below.
16606 ,#+BEGIN_SRC emacs-lisp
16607 '(((1 2 3) (4 5 6) (7 8 9))
16608 ((10 11 12) (13 14 15) (16 17 18))
16609 ((19 20 21) (22 23 24) (25 26 27)))
16612 ,#+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
16620 Note that row names and column names are not removed prior to variable
16621 indexing. You need to take them into account, even when =colnames= or
16622 =rownames= header arguments remove them.
16624 Emacs lisp code can also set the values for variables. To
16625 differentiate a value from Lisp code, Org interprets any value
16626 starting with =(=, =[=, ='= or =`= as Emacs Lisp code. The result of
16627 evaluating that code is then assigned to the value of that variable.
16628 The following example shows how to reliably query and pass the file
16629 name of the Org mode buffer to a code block using headers. We need
16630 reliability here because the file's name could change once the code in
16631 the block starts executing.
16634 ,#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
16639 Note that values read from tables and lists are not mistakenly
16640 evaluated as Emacs Lisp code, as illustrated in the following example.
16646 ,#+HEADERS: :var data=table[0,0]
16660 #+cindex: using sessions in code blocks
16661 #+cindex: @samp{session}, header argument
16662 Two code blocks can share the same environment. The =session= header
16663 argument is for running multiple source code blocks under one session.
16664 Org runs code blocks with the same session name in the same
16665 interpreter process.
16669 Default. Each code block gets a new interpreter process to
16670 execute. The process terminates once the block is evaluated.
16672 - {{{var(STRING)}}} ::
16674 Any string besides =none= turns that string into the name of that
16675 session. For example, =:session STRING= names it =STRING=. If
16676 =session= has no value, then the session name is derived from the
16677 source language identifier. Subsequent blocks with the same
16678 source code language use the same session. Depending on the
16679 language, state variables, code from other blocks, and the
16680 overall interpreted environment may be shared. Some interpreted
16681 languages support concurrent sessions when subsequent source code
16682 language blocks change session names.
16684 Only languages that provide interactive evaluation can have session
16685 support. Not all languages provide this support, such as C and ditaa.
16686 Even languages, such as Python and Haskell, that do support
16687 interactive evaluation impose limitations on allowable language
16688 constructs that can run interactively. Org inherits those limitations
16689 for those code blocks running in a session.
16691 *** Choosing a working directory
16696 #+cindex: working directory, in a code block
16697 #+cindex: @samp{dir}, header argument
16698 The =dir= header argument specifies the default directory during code
16699 block execution. If it is absent, then the directory associated with
16700 the current buffer is used. In other words, supplying =:dir PATH=
16701 temporarily has the same effect as changing the current directory with
16702 {{{kbd(M-x cd PATH)}}}, and then not setting =dir=. Under the
16703 surface, =dir= simply sets the value of the Emacs variable
16704 ~default-directory~.
16706 For example, to save the plot file in the =Work/= folder of the home
16707 directory---notice tilde is expanded:
16710 ,#+BEGIN_SRC R :file myplot.png :dir ~/Work
16711 matplot(matrix(rnorm(100), 10), type="l")
16715 To evaluate the code block on a remote machine, supply a remote
16716 directory name using Tramp syntax. For example:
16719 ,#+BEGIN_SRC R :file plot.png :dir /scp:dand@yakuba.princeton.edu:
16720 plot(1:10, main=system("hostname", intern=TRUE))
16724 Org first captures the text results as usual for insertion in the Org
16725 file. Then Org also inserts a link to the remote file, thanks to
16726 Emacs Tramp. Org constructs the remote path to the file name from
16727 =dir= and ~default-directory~, as illustrated here:
16729 : [[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
16731 When =dir= is used with =session=, Org sets the starting directory for
16732 a new session. But Org does not alter the directory of an already
16735 Do not use =dir= with =:exports results= or with =:exports both= to
16736 avoid Org inserting incorrect links to remote files. That is because
16737 Org does not expand ~default directory~ to avoid some underlying
16738 portability issues.
16740 *** Inserting headers and footers
16745 #+cindex: headers, in code blocks
16746 #+cindex: footers, in code blocks
16747 #+cindex: @samp{prologue}, header argument
16748 The =prologue= header argument is for appending to the top of the code
16749 block for execution, like a reset instruction. For example, you may
16750 use =:prologue "reset"= in a Gnuplot code block or, for every such
16753 #+begin_src emacs-lisp
16754 (add-to-list 'org-babel-default-header-args:gnuplot
16755 '((:prologue . "reset")))
16759 #+cindex: @samp{epilogue}, header argument
16760 Likewise, the value of the =epilogue= header argument is for appending
16761 to the end of the code block for execution.
16763 ** Evaluating Code Blocks
16765 :DESCRIPTION: Place results of evaluation in the Org buffer.
16767 #+cindex: code block, evaluating
16768 #+cindex: source code, evaluating
16769 #+cindex: @samp{RESULTS}, keyword
16771 A note about security: With code evaluation comes the risk of harm.
16772 Org safeguards by prompting for user's permission before executing any
16773 code in the source block. To customize this safeguard, or disable it,
16774 see [[*Code Evaluation and Security Issues]].
16776 *** How to evaluate source code
16781 Org captures the results of the code block evaluation and inserts them
16782 in the Org file, right after the code block. The insertion point is
16783 after a newline and the =RESULTS= keyword. Org creates the =RESULTS=
16784 keyword if one is not already there.
16786 By default, Org enables only Emacs Lisp code blocks for execution.
16787 See [[*Languages]] to enable other languages.
16790 #+kindex: C-c C-v e
16791 #+findex: org-babel-execute-src-block
16792 Org provides many ways to execute code blocks. {{{kbd(C-c C-c)}}} or
16793 {{{kbd(C-c C-v e)}}} with the point on a code block[fn:130] calls the
16794 ~org-babel-execute-src-block~ function, which executes the code in the
16795 block, collects the results, and inserts them in the buffer.
16797 #+cindex: @samp{CALL}, keyword
16798 #+vindex: org-babel-inline-result-wrap
16799 By calling a named code block[fn:131] from an Org mode buffer or
16800 a table. Org can call the named code blocks from the current Org mode
16801 buffer or from the "Library of Babel" (see [[*Library of Babel]]).
16803 The syntax for =CALL= keyword is:
16806 ,#+CALL: <name>(<arguments>)
16807 ,#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
16810 The syntax for inline named code blocks is:
16813 ... call_<name>(<arguments>) ...
16814 ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
16817 When inline syntax is used, the result is wrapped based on the
16818 variable ~org-babel-inline-result-wrap~, which by default is set to
16819 ~"=%s="~ to produce verbatim text suitable for markup.
16823 This is the name of the code block (see [[*Structure of Code
16824 Blocks]]) to be evaluated in the current document. If the block is
16825 located in another file, start =<name>= with the file name
16826 followed by a colon. For example, in order to execute a block
16827 named =clear-data= in =file.org=, you can write the following:
16829 : #+CALL: file.org:clear-data()
16833 Org passes arguments to the code block using standard function
16834 call syntax. For example, a =#+CALL:= line that passes =4= to
16835 a code block named =double=, which declares the header argument
16836 =:var n=2=, would be written as:
16838 : #+CALL: double(n=4)
16840 #+texinfo: @noindent
16841 Note how this function call syntax is different from the header
16844 - =<inside header arguments>= ::
16846 Org passes inside header arguments to the named code block using
16847 the header argument syntax. Inside header arguments apply to
16848 code block evaluation. For example, =[:results output]= collects
16849 results printed to stdout during code execution of that block.
16850 Note how this header argument syntax is different from the
16851 function call syntax.
16853 - =<end header arguments>= ::
16855 End header arguments affect the results returned by the code
16856 block. For example, =:results html= wraps the results in
16857 a =#+BEGIN_EXPORT html= block before inserting the results in the
16860 *** Limit code block evaluation
16865 #+cindex: @samp{eval}, header argument
16866 #+cindex: control code block evaluation
16867 The =eval= header argument can limit evaluation of specific code
16868 blocks and =CALL= keyword. It is useful for protection against
16869 evaluating untrusted code blocks by prompting for a confirmation.
16871 - =never= or =no= ::
16873 Org never evaluates the source code.
16877 Org prompts the user for permission to evaluate the source code.
16879 - =never-export= or =no-export= ::
16881 Org does not evaluate the source code when exporting, yet the
16882 user can evaluate it interactively.
16884 - =query-export= ::
16886 Org prompts the user for permission to evaluate the source code
16889 If =eval= header argument is not set, then Org determines whether to
16890 evaluate the source code from the ~org-confirm-babel-evaluate~
16891 variable (see [[*Code Evaluation and Security Issues]]).
16893 *** Cache results of evaluation
16898 #+cindex: @samp{cache}, header argument
16899 #+cindex: cache results of code evaluation
16900 The =cache= header argument is for caching results of evaluating code
16901 blocks. Caching results can avoid re-evaluating a code block that
16902 have not changed since the previous run. To benefit from the cache
16903 and avoid redundant evaluations, the source block must have a result
16904 already present in the buffer, and neither the header
16905 arguments---including the value of =var= references---nor the text of
16906 the block itself has changed since the result was last computed. This
16907 feature greatly helps avoid long-running calculations. For some edge
16908 cases, however, the cached results may not be reliable.
16910 The caching feature is best for when code blocks are pure functions,
16911 that is functions that return the same value for the same input
16912 arguments (see [[*Environment of a Code Block]]), and that do not have
16913 side effects, and do not rely on external variables other than the
16914 input arguments. Functions that depend on a timer, file system
16915 objects, and random number generators are clearly unsuitable for
16918 A note of warning: when =cache= is used in a session, caching may
16919 cause unexpected results.
16921 When the caching mechanism tests for any source code changes, it does
16922 not expand Noweb style references (see [[*Noweb Reference Syntax]]). For
16923 reasons why, see http://thread.gmane.org/gmane.emacs.orgmode/79046.
16925 The =cache= header argument can have one of two values: =yes= or =no=.
16929 Default. No caching of results; code block evaluated every
16934 Whether to run the code or return the cached results is
16935 determined by comparing the SHA1 hash value of the combined code
16936 block and arguments passed to it. This hash value is packed on
16937 the =#+RESULTS:= line from previous evaluation. When hash values
16938 match, Org does not evaluate the code block. When hash values
16939 mismatch, Org evaluates the code block, inserts the results,
16940 recalculates the hash value, and updates =#+RESULTS:= line.
16942 In this example, both functions are cached. But =caller= runs only if
16943 the result from =random= has changed since the last run.
16947 ,#+BEGIN_SRC R :cache yes
16951 ,#+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
16955 ,#+BEGIN_SRC emacs-lisp :var x=random :cache yes
16959 ,#+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
16963 ** Results of Evaluation
16965 :DESCRIPTION: Choosing a results type, post-processing...
16967 #+cindex: code block, results of evaluation
16968 #+cindex: source code, results of evaluation
16970 #+cindex: @samp{results}, header argument
16971 How Org handles results of a code block execution depends on many
16972 header arguments working together. The primary determinant, however,
16973 is the =results= header argument. It accepts four classes of options.
16974 Each code block can take only one option per class:
16978 For how the results should be collected from the code block;
16982 For which type of result the code block will return; affects how
16983 Org processes and inserts results in the Org buffer;
16987 For the result; affects how Org processes and inserts results in
16992 For processing results after evaluation of the code block;
16999 Collection options specify the results. Choose one of the options;
17000 they are mutually exclusive.
17004 Default. Functional mode. Org gets the value by wrapping the
17005 code in a function definition in the language of the source
17006 block. That is why when using =:results value=, code should
17007 execute like a function and return a value. For languages like
17008 Python, an explicit ~return~ statement is mandatory when using
17009 =:results value=. Result is the value returned by the last
17010 statement in the code block.
17012 When evaluating the code block in a session (see [[*Environment of
17013 a Code Block]]), Org passes the code to an interpreter running as
17014 an interactive Emacs inferior process. Org gets the value from
17015 the source code interpreter's last statement output. Org has to
17016 use language-specific methods to obtain the value. For example,
17017 from the variable ~_~ in Python and Ruby, and the value of
17018 ~.Last.value~ in R.
17022 Scripting mode. Org passes the code to an external process
17023 running the interpreter. Org returns the contents of the
17024 standard output stream as text results.
17026 When using a session, Org passes the code to the interpreter
17027 running as an interactive Emacs inferior process. Org
17028 concatenates any text output from the interpreter and returns the
17029 collection as a result.
17031 Note that this collection is not the same as that would be
17032 collected from stdout of a non-interactive interpreter running as
17033 an external process. Compare for example these two blocks:
17036 ,#+BEGIN_SRC python :results output
17047 In the above non-session mode, the "2" is not printed; so it does
17048 not appear in results.
17051 ,#+BEGIN_SRC python :results output :session
17063 In the above session, the interactive interpreter receives and
17064 prints "2". Results show that.
17071 Type tells what result types to expect from the execution of the code
17072 block. Choose one of the options; they are mutually exclusive. The
17073 default behavior is to automatically determine the result type.
17075 #+attr_texinfo: :sep ,
17076 - =table=, =vector= ::
17078 Interpret the results as an Org table. If the result is a single
17079 value, create a table with one row and one column. Usage
17080 example: =:results value table=.
17082 #+cindex: @samp{hlines}, header argument
17083 In-between each table row or below the table headings, sometimes
17084 results have horizontal lines, which are also known as "hlines".
17085 The =hlines= argument with the default =no= value strips such
17086 lines from the input table. For most code, this is desirable, or
17087 else those =hline= symbols raise unbound variable errors.
17088 A =yes= accepts such lines, as demonstrated in the following
17100 ,#+BEGIN_SRC python :var tab=many-cols :hlines no
17104 ,#+RESULTS: no-hline
17110 ,#+BEGIN_SRC python :var tab=many-cols :hlines yes
17124 Interpret the results as an Org list. If the result is a single
17125 value, create a list of one element.
17127 - =scalar=, =verbatim= ::
17129 Interpret literally and insert as quoted text. Do not create
17130 a table. Usage example: =:results value verbatim=.
17134 Interpret as a filename. Save the results of execution of the
17135 code block to that file, then insert a link to it. You can
17136 control both the filename and the description associated to the
17139 #+cindex: @samp{file}, header argument
17140 #+cindex: @samp{output-dir}, header argument
17141 Org first tries to generate the filename from the value of the
17142 =file= header argument and the directory specified using the
17143 =output-dir= header arguments. If =output-dir= is not specified,
17144 Org assumes it is the current directory.
17147 ,#+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/
17153 #+cindex: @samp{file-ext}, header argument
17154 If =file= is missing, Org generates the base name of the output
17155 file from the name of the code block, and its extension from the
17156 =file-ext= header argument. In that case, both the name and the
17157 extension are mandatory.
17161 ,#+BEGIN_SRC asymptote :results value file :file-ext pdf
17167 #+cindex: @samp{file-desc}, header argument
17168 The =file-desc= header argument defines the description (see
17169 [[*Link Format]]) for the link. If =file-desc= has no value, Org
17170 uses the generated file name for both the "link" and
17171 "description" parts of the link.
17178 Format pertains to the type of the result returned by the code block.
17179 Choose one of the options; they are mutually exclusive. The default
17180 follows from the type specified above.
17184 Interpreted as raw Org mode. Inserted directly into the buffer.
17185 Aligned if it is a table. Usage example: =:results value raw=.
17189 Results enclosed in a =BEGIN_SRC org= block. For comma-escape,
17190 either {{{kbd(TAB)}}} in the block, or export the file. Usage
17191 example: =:results value org=.
17195 Results enclosed in a =BEGIN_EXPORT html= block. Usage example:
17196 =:results value html=.
17200 Results enclosed in a =BEGIN_EXPORT latex= block. Usage example:
17201 =:results value latex=.
17205 Result enclosed in a code block. Useful for parsing. Usage
17206 example: =:results value code=.
17210 Result converted to pretty-print source code. Enclosed in a code
17211 block. Languages supported: Emacs Lisp, Python, and Ruby. Usage
17212 example: =:results value pp=.
17216 Result wrapped in a =RESULTS= drawer. Useful for containing
17217 =raw= or =org= results for later scripting and automated
17218 processing. Usage example: =:results value drawer=.
17225 Handling options after collecting the results.
17229 Do not insert results in the Org mode buffer, but echo them in
17230 the minibuffer. Usage example: =:results output silent=.
17234 Default. Insert results in the Org buffer. Remove previous
17235 results. Usage example: =:results output replace=.
17239 Append results to the Org buffer. Latest results are at the
17240 bottom. Does not remove previous results. Usage example:
17241 =:results output append=.
17245 Prepend results to the Org buffer. Latest results are at the
17246 top. Does not remove previous results. Usage example: =:results
17249 *** Post-processing
17254 #+cindex: @samp{post}, header argument
17255 #+cindex: @samp{*this*}, in @samp{post} header argument
17256 The =post= header argument is for post-processing results from block
17257 evaluation. When =post= has any value, Org binds the results to
17258 ~*this*~ variable for easy passing to =var= header argument
17259 specifications (see [[*Environment of a Code Block]]). That makes results
17260 available to other code blocks, or even for direct Emacs Lisp code
17263 The following two examples illustrate =post= header argument in
17264 action. The first one shows how to attach an =ATTR_LATEX= keyword
17269 ,#+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
17270 echo "#+ATTR_LATEX: :width $width"
17274 ,#+HEADER: :file /tmp/it.png
17275 ,#+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer
17285 ,#+ATTR_LATEX :width 5cm
17286 [[file:/tmp/it.png]]
17290 The second example shows use of =colnames= header argument in =post=
17291 to pass data between code blocks.
17295 ,#+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f"
17296 (mapcar (lambda (row)
17297 (mapcar (lambda (cell)
17305 ,#+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*)
17307 data.frame(foo=rnorm(1))
17316 ** Exporting Code Blocks
17318 :DESCRIPTION: Export contents and/or results.
17320 #+cindex: code block, exporting
17321 #+cindex: source code, exporting
17323 It is possible to export the /code/ of code blocks, the /results/ of
17324 code block evaluation, /both/ the code and the results of code block
17325 evaluation, or /none/. Org defaults to exporting /code/ for most
17326 languages. For some languages, such as ditaa, Org defaults to
17327 /results/. To export just the body of code blocks, see [[*Literal
17328 Examples]]. To selectively export sub-trees of an Org document, see
17331 #+cindex: @samp{export}, header argument
17332 The =exports= header argument is to specify if that part of the Org
17333 file is exported to, say, HTML or LaTeX formats.
17337 The default. The body of code is included into the exported
17338 file. Example: =:exports code=.
17342 The results of evaluation of the code is included in the exported
17343 file. Example: =:exports results=.
17347 Both the code and results of evaluation are included in the
17348 exported file. Example: =:exports both=.
17352 Neither the code nor the results of evaluation is included in the
17353 exported file. Whether the code is evaluated at all depends on
17354 other options. Example: =:exports none=.
17356 #+vindex: org-export-use-babel
17357 To stop Org from evaluating code blocks to speed exports, use the
17358 header argument =:eval never-export= (see [[*Evaluating Code Blocks]]).
17359 To stop Org from evaluating code blocks for greater security, set the
17360 ~org-export-use-babel~ variable to ~nil~, but understand that header
17361 arguments will have no effect.
17363 Turning off evaluation comes in handy when batch processing. For
17364 example, markup languages for wikis, which have a high risk of
17365 untrusted code. Stopping code block evaluation also stops evaluation
17366 of all header arguments of the code block. This may not be desirable
17367 in some circumstances. So during export, to allow evaluation of just
17368 the header arguments but not any code evaluation in the source block,
17369 set =:eval never-export= (see [[*Evaluating Code Blocks]]).
17371 Org never evaluates code blocks in commented sub-trees when exporting
17372 (see [[*Comment Lines]]). On the other hand, Org does evaluate code
17373 blocks in sub-trees excluded from export (see [[*Export Settings]]).
17375 ** Extracting Source Code
17377 :DESCRIPTION: Create pure source code files.
17380 #+cindex: source code, extracting
17381 #+cindex: code block, extracting source code
17383 Extracting source code from code blocks is a basic task in literate
17384 programming. Org has features to make this easy. In literate
17385 programming parlance, documents on creation are /woven/ with code and
17386 documentation, and on export, the code is tangled for execution by
17387 a computer. Org facilitates weaving and tangling for producing,
17388 maintaining, sharing, and exporting literate programming documents.
17389 Org provides extensive customization options for extracting source
17392 When Org tangles code blocks, it expands, merges, and transforms them.
17393 Then Org recomposes them into one or more separate files, as
17394 configured through the options. During this tangling process, Org
17395 expands variables in the source code, and resolves any Noweb style
17396 references (see [[*Noweb Reference Syntax]]).
17398 *** Header arguments
17403 #+cindex: @samp{tangle}, header argument
17404 The =tangle= header argument specifies if the code block is exported
17409 Export the code block to source file. The file name for the
17410 source file is derived from the name of the Org file, and the
17411 file extension is derived from the source code language
17412 identifier. Example: =:tangle yes=.
17416 The default. Do not extract the code in a source code file.
17417 Example: =:tangle no=.
17419 - {{{var(FILENAME)}}} ::
17421 Export the code block to source file whose file name is derived
17422 from any string passed to the =tangle= header argument. Org
17423 derives the file name as being relative to the directory of the
17424 Org file's location. Example: =:tangle FILENAME=.
17426 #+cindex: @samp{mkdirp}, header argument
17427 The =mkdirp= header argument creates parent directories for tangled
17428 files if the directory does not exist. =yes= enables directory
17429 creation and =no= inhibits directory creation.
17431 #+cindex: @samp{comments}, header argument
17432 The =comments= header argument controls inserting comments into
17433 tangled files. These are above and beyond whatever comments may
17434 already exist in the code block.
17438 The default. Do not insert any extra comments during tangling.
17442 Wrap the code block in comments. Include links pointing back to
17443 the place in the Org file from where the code was tangled.
17447 Kept for backward compatibility; same as =link=.
17451 Nearest headline text from Org file is inserted as comment. The
17452 exact text that is inserted is picked from the leading context of
17457 Includes both =link= and =org= options.
17461 Includes =link= option, expands Noweb references (see [[*Noweb
17462 Reference Syntax]]), and wraps them in link comments inside the
17463 body of the code block.
17465 #+cindex: @samp{padline}, header argument
17466 The =padline= header argument controls insertion of newlines to pad
17467 source code in the tangled file.
17471 Default. Insert a newline before and after each code block in
17476 Do not insert newlines to pad the tangled code blocks.
17478 #+cindex: @samp{shebang}, header argument
17479 The =shebang= header argument can turn results into executable script
17480 files. By setting it to a string value---for example, =:shebang
17481 "#!/bin/bash"=---Org inserts that string as the first line of the
17482 tangled file that the code block is extracted to. Org then turns on
17483 the tangled file's executable permission.
17485 #+cindex: @samp{no-expand}, header argument
17486 By default Org expands code blocks during tangling. The =no-expand=
17487 header argument turns off such expansions. Note that one side-effect
17488 of expansion by ~org-babel-expand-src-block~ also assigns values (see
17489 [[*Environment of a Code Block]]) to variables. Expansions also replace
17490 Noweb references with their targets (see [[*Noweb Reference Syntax]]).
17491 Some of these expansions may cause premature assignment, hence this
17492 option. This option makes a difference only for tangling. It has no
17493 effect when exporting since code blocks for execution have to be
17501 - ~org-babel-tangle~ ::
17503 #+findex: org-babel-tangle
17504 #+kindex: C-c C-v t
17505 Tangle the current file. Bound to {{{kbd(C-c C-v t)}}}.
17507 With prefix argument only tangle the current code block.
17509 - ~org-babel-tangle-file~ ::
17511 #+findex: org-babel-tangle-file
17512 #+kindex: C-c C-v f
17513 Choose a file to tangle. Bound to {{{kbd(C-c C-v f)}}}.
17520 - ~org-babel-post-tangle-hook~ ::
17522 #+vindex: org-babel-post-tangle-hook
17523 This hook is run from within code files tangled by
17524 ~org-babel-tangle~, making it suitable for post-processing,
17525 compilation, and evaluation of code in the tangled files.
17527 *** Jumping between code and Org
17532 #+findex: org-babel-tangle-jump-to-org
17533 Debuggers normally link errors and messages back to the source code.
17534 But for tangled files, we want to link back to the Org file, not to
17535 the tangled source file. To make this extra jump, Org uses
17536 ~org-babel-tangle-jump-to-org~ function with two additional source
17537 code block header arguments:
17539 1. Set =padline= to true---this is the default setting.
17540 2. Set =comments= to =link=, which makes Org insert links to the Org
17545 :DESCRIPTION: List of supported code block languages.
17547 #+cindex: babel, languages
17548 #+cindex: source code, languages
17549 #+cindex: code block, languages
17551 Code blocks in the following languages are supported.
17553 | Language | Identifier | Language | Identifier |
17554 |------------+------------+----------------+------------|
17555 | Asymptote | asymptote | Awk | awk |
17556 | C | C | C++ | C++ |
17557 | Clojure | clojure | CSS | css |
17558 | D | d | ditaa | ditaa |
17559 | Graphviz | dot | Emacs Calc | calc |
17560 | Emacs Lisp | emacs-lisp | Fortran | fortran |
17561 | Gnuplot | gnuplot | Haskell | haskell |
17562 | Java | java | Javascript | js |
17563 | LaTeX | latex | Ledger | ledger |
17564 | Lisp | lisp | Lilypond | lilypond |
17565 | Lua | lua | MATLAB | matlab |
17566 | Mscgen | mscgen | Objective Caml | ocaml |
17567 | Octave | octave | Org mode | org |
17568 | Oz | oz | Perl | perl |
17569 | Plantuml | plantuml | Processing.js | processing |
17570 | Python | python | R | R |
17571 | Ruby | ruby | Sass | sass |
17572 | Scheme | scheme | GNU Screen | screen |
17573 | Sed | sed | shell | sh |
17574 | SQL | sql | SQLite | sqlite |
17575 | Vala | vala | | |
17577 Additional documentation for some languages is at
17578 https://orgmode.org/worg/org-contrib/babel/languages.html.
17580 #+vindex: org-babel-load-languages
17581 By default, only Emacs Lisp is enabled for evaluation. To enable or
17582 disable other languages, customize the ~org-babel-load-languages~
17583 variable either through the Emacs customization interface, or by
17584 adding code to the init file as shown next.
17586 In this example, evaluation is disabled for Emacs Lisp, and enabled
17589 #+begin_src emacs-lisp
17590 (org-babel-do-load-languages
17591 'org-babel-load-languages
17592 '((emacs-lisp . nil)
17596 Note that this is not the only way to enable a language. Org also
17597 enables languages when loaded with ~require~ statement. For example,
17598 the following enables execution of Clojure code blocks:
17600 #+begin_src emacs-lisp
17601 (require 'ob-clojure)
17604 ** Editing Source Code
17606 :DESCRIPTION: Language major-mode editing.
17608 #+cindex: code block, editing
17609 #+cindex: source code, editing
17612 Use {{{kbd(C-c ')}}} to edit the current code block. It opens a new
17613 major-mode edit buffer containing the body of the source code block,
17614 ready for any edits. Use {{{kbd(C-c ')}}} again to close the buffer
17615 and return to the Org buffer.
17618 #+vindex: org-edit-src-auto-save-idle-delay
17619 #+cindex: auto-save, in code block editing
17620 {{{kbd(C-x C-s)}}} saves the buffer and updates the contents of the
17621 Org buffer. Set ~org-edit-src-auto-save-idle-delay~ to save the base
17622 buffer after a certain idle delay time. Set
17623 ~org-edit-src-turn-on-auto-save~ to auto-save this buffer into
17624 a separate file using Auto-save mode.
17626 While editing the source code in the major mode, the Org Src minor
17627 mode remains active. It provides these customization variables as
17628 described below. For even more variables, look in the customization
17629 group ~org-edit-structure~.
17631 - ~org-src-lang-modes~ ::
17633 #+vindex: org-src-lang-modes
17634 If an Emacs major-mode named ~<LANG>-mode~ exists, where
17635 {{{var(<LANG>)}}} is the language identifier from code block's
17636 header line, then the edit buffer uses that major mode. Use this
17637 variable to arbitrarily map language identifiers to major modes.
17639 - ~org-src-window-setup~ ::
17641 #+vindex: org-src-window-setup
17642 For specifying Emacs window arrangement when the new edit buffer
17645 - ~org-src-preserve-indentation~ ::
17647 #+cindex: indentation, in code blocks
17648 #+vindex: org-src-preserve-indentation
17649 Default is ~nil~. Source code is indented. This indentation
17650 applies during export or tangling, and depending on the context,
17651 may alter leading spaces and tabs. When non-~nil~, source code
17652 is aligned with the leftmost column. No lines are modified
17653 during export or tangling, which is very useful for white-space
17654 sensitive languages, such as Python.
17656 - ~org-src-ask-before-returning-to-edit-buffer~ ::
17658 #+vindex: org-src-ask-before-returning-to-edit-buffer
17659 When ~nil~, Org returns to the edit buffer without further
17660 prompts. The default prompts for a confirmation.
17662 #+vindex: org-src-fontify-natively
17663 #+vindex: org-src-block-faces
17664 Set ~org-src-fontify-natively~ to non-~nil~ to turn on native code
17665 fontification in the /Org/ buffer. Fontification of code blocks can
17666 give visual separation of text and code on the display page. To
17667 further customize the appearance of ~org-block~ for specific
17668 languages, customize ~org-src-block-faces~. The following example
17669 shades the background of regular blocks, and colors source blocks only
17670 for Python and Emacs Lisp languages.
17672 #+begin_src emacs-lisp
17674 (set-face-attribute 'org-block nil :background
17676 (face-attribute 'default :background) 3))
17678 (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
17679 ("python" (:background "#E5FFB8"))))
17682 ** Noweb Reference Syntax
17684 :DESCRIPTION: Literate programming in Org mode.
17686 #+cindex: code block, Noweb reference
17687 #+cindex: syntax, Noweb
17688 #+cindex: source code, Noweb reference
17690 Org supports named blocks in Noweb[fn:132] style syntax:
17692 : <<CODE-BLOCK-ID>>
17694 Org can replace the construct with the source code, or the results of
17695 evaluation, of the code block identified as {{{var(CODE-BLOCK-ID)}}}.
17697 #+cindex: @samp{noweb}, header argument
17698 The =noweb= header argument controls expansion of Noweb syntax
17699 references. Expansions occur when source code blocks are evaluated,
17700 tangled, or exported.
17704 Default. No expansion of Noweb syntax references in the body of
17705 the code when evaluating, tangling, or exporting.
17709 Expansion of Noweb syntax references in the body of the code
17710 block when evaluating, tangling, or exporting.
17714 Expansion of Noweb syntax references in the body of the code
17715 block when tangling. No expansion when evaluating or exporting.
17719 Expansion of Noweb syntax references in the body of the code
17720 block when evaluating or tangling. No expansion when exporting.
17722 - =strip-export= ::
17724 Expansion of Noweb syntax references in the body of the code
17725 block when expanding prior to evaluating or tangling. Removes
17726 Noweb syntax references when exporting.
17730 Expansion of Noweb syntax references in the body of the code
17731 block only before evaluating.
17733 In the following example,
17736 ,#+NAME: initialization
17737 ,#+BEGIN_SRC emacs-lisp
17738 (setq sentence "Never a foot too far, even.")
17741 ,#+BEGIN_SRC emacs-lisp :noweb yes
17747 #+texinfo: @noindent
17748 the second code block is expanded as
17751 ,#+BEGIN_SRC emacs-lisp :noweb yes
17752 (setq sentence "Never a foot too far, even.")
17757 Noweb insertions honor prefix characters that appear before the Noweb
17758 syntax reference. This behavior is illustrated in the following
17759 example. Because the =<<example>>= Noweb reference appears behind the
17760 SQL comment syntax, each line of the expanded Noweb reference is
17767 multi-line body of example
17771 #+texinfo: @noindent
17775 ,#+BEGIN_SRC sql :noweb yes
17780 #+texinfo: @noindent
17784 ,#+BEGIN_SRC sql :noweb yes
17786 ---multi-line body of example
17790 Since this change does not affect Noweb replacement text without
17791 newlines in them, inline Noweb references are acceptable.
17793 This feature can also be used for management of indentation in
17794 exported code snippets. With:
17798 ,#+BEGIN_SRC python :exports none
17799 print('do things when true')
17803 ,#+begin_src python :exports none
17804 print('do things when false')
17808 #+texinfo: @noindent
17812 ,#+begin_src python :noweb yes :results output
17820 #+texinfo: @noindent
17825 print('do things when true')
17827 print('do things when false')
17830 #+cindex: @samp{noweb-ref}, header argument
17831 When expanding Noweb style references, Org concatenates code blocks by
17832 matching the reference name to either the code block name or, if none
17833 is found, to the =noweb-ref= header argument.
17835 For simple concatenation, set this =noweb-ref= header argument at the
17836 sub-tree or file level. In the example Org file shown next, the body
17837 of the source code in each block is extracted for concatenation to
17838 a pure code file when tangled.
17841 ,#+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
17844 ,* the mount point of the fullest disk
17846 :header-args: :noweb-ref fullest-disk
17849 ,** query all mounted disks
17854 ,** strip the header row
17859 ,** output mount point of fullest disk
17861 |awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
17865 #+cindex: @samp{noweb-sep}, header argument
17866 By default a newline separates each noweb reference concatenation. To
17867 change this newline separator, edit the =noweb-sep= header argument.
17869 Eventually, Org can include the results of a code block rather than
17870 its body. To that effect, append parentheses, possibly including
17871 arguments, to the code block name, as shown below.
17873 : <<code-block-name(optional arguments)>>
17875 Note that when using the above approach to a code block's results, the
17876 code block name set by =NAME= keyword is required; the reference set
17877 by =noweb-ref= does not work in that case.
17879 Here is an example that demonstrates how the exported content changes
17880 when Noweb style references are used with parentheses versus without.
17885 ,#+BEGIN_SRC python :var num=0 :results output :exports none
17890 #+texinfo: @noindent
17894 ,#+BEGIN_SRC text :noweb yes
17899 #+texinfo: @noindent
17904 Below, a similar Noweb style reference is used, but with parentheses,
17905 while setting a variable =num= to 10:
17908 ,#+BEGIN_SRC text :noweb yes
17909 <<some-code(num=10)>>
17913 #+texinfo: @noindent
17914 Note that now the expansion contains the results of the code block
17915 =some-code=, not the code block itself:
17919 ** Library of Babel
17921 :DESCRIPTION: Use and contribute to a library of useful code blocks.
17923 #+cindex: babel, library of
17924 #+cindex: source code, library
17925 #+cindex: code block, library
17927 The "Library of Babel" is a collection of code blocks. Like
17928 a function library, these code blocks can be called from other Org
17929 files. A collection of useful code blocks is available on [[https://orgmode.org/worg/library-of-babel.html][Worg]]. For
17930 remote code block evaluation syntax, see [[*Evaluating Code Blocks]].
17932 #+kindex: C-c C-v i
17933 #+findex: org-babel-lob-ingest
17934 For any user to add code to the library, first save the code in
17935 regular code blocks of an Org file, and then load the Org file with
17936 ~org-babel-lob-ingest~, which is bound to {{{kbd(C-c C-v i)}}}.
17938 ** Key bindings and Useful Functions
17940 :DESCRIPTION: Work quickly with code blocks.
17942 #+cindex: code block, key bindings
17944 Many common Org mode key sequences are re-bound depending on
17947 Active key bindings in code blocks:
17950 #+findex: org-babel-execute-src-block
17952 #+findex: org-babel-open-src-block-result
17954 #+findex: org-babel-load-in-session
17956 #+findex: org-babel-pop-to-session
17957 #+attr_texinfo: :columns 0.2 0.55
17958 | Key binding | Function |
17959 |--------------------+-----------------------------------|
17960 | {{{kbd(C-c C-c)}}} | ~org-babel-execute-src-block~ |
17961 | {{{kbd(C-c C-o)}}} | ~org-babel-open-src-block-result~ |
17962 | {{{kbd(M-UP)}}} | ~org-babel-load-in-session~ |
17963 | {{{kbd(M-DOWN)}}} | ~org-babel-pop-to-session~ |
17965 Active key bindings in Org mode buffer:
17967 #+kindex: C-c C-v p
17968 #+kindex: C-c C-v C-p
17969 #+kindex: C-c C-v n
17970 #+kindex: C-c C-v C-n
17971 #+kindex: C-c C-v e
17972 #+kindex: C-c C-v C-e
17973 #+kindex: C-c C-v o
17974 #+kindex: C-c C-v C-o
17975 #+kindex: C-c C-v v
17976 #+kindex: C-c C-v C-v
17977 #+kindex: C-c C-v u
17978 #+kindex: C-c C-v C-u
17979 #+kindex: C-c C-v g
17980 #+kindex: C-c C-v C-g
17981 #+kindex: C-c C-v r
17982 #+kindex: C-c C-v C-r
17983 #+kindex: C-c C-v b
17984 #+kindex: C-c C-v C-b
17985 #+kindex: C-c C-v s
17986 #+kindex: C-c C-v C-s
17987 #+kindex: C-c C-v d
17988 #+kindex: C-c C-v C-d
17989 #+kindex: C-c C-v t
17990 #+kindex: C-c C-v C-t
17991 #+kindex: C-c C-v f
17992 #+kindex: C-c C-v C-f
17993 #+kindex: C-c C-v c
17994 #+kindex: C-c C-v C-c
17995 #+kindex: C-c C-v j
17996 #+kindex: C-c C-v C-j
17997 #+kindex: C-c C-v l
17998 #+kindex: C-c C-v C-l
17999 #+kindex: C-c C-v i
18000 #+kindex: C-c C-v C-i
18001 #+kindex: C-c C-v I
18002 #+kindex: C-c C-v C-I
18003 #+kindex: C-c C-v z
18004 #+kindex: C-c C-v C-z
18005 #+kindex: C-c C-v a
18006 #+kindex: C-c C-v C-a
18007 #+kindex: C-c C-v h
18008 #+kindex: C-c C-v C-h
18009 #+kindex: C-c C-v x
18010 #+kindex: C-c C-v C-x
18011 #+findex: org-babel-previous-src-block
18012 #+findex: org-babel-next-src-block
18013 #+findex: org-babel-execute-maybe
18014 #+findex: org-babel-open-src-block-result
18015 #+findex: org-babel-expand-src-block
18016 #+findex: org-babel-goto-src-block-head
18017 #+findex: org-babel-goto-named-src-block
18018 #+findex: org-babel-goto-named-result
18019 #+findex: org-babel-execute-buffer
18020 #+findex: org-babel-execute-subtree
18021 #+findex: org-babel-demarcate-block
18022 #+findex: org-babel-tangle
18023 #+findex: org-babel-tangle-file
18024 #+findex: org-babel-check-src-block
18025 #+findex: org-babel-insert-header-arg
18026 #+findex: org-babel-load-in-session
18027 #+findex: org-babel-lob-ingest
18028 #+findex: org-babel-view-src-block-info
18029 #+findex: org-babel-switch-to-session-with-code
18030 #+findex: org-babel-sha1-hash
18031 #+findex: org-babel-describe-bindings
18032 #+findex: org-babel-do-key-sequence-in-edit-buffer
18033 #+attr_texinfo: :columns 0.45 0.55
18034 | Key binding | Function |
18035 |------------------------------------------------+--------------------------------------------|
18036 | {{{kbd(C-c C-v p)}}} or {{{kbd(C-c C-v C-p)}}} | ~org-babel-previous-src-block~ |
18037 | {{{kbd(C-c C-v n)}}} or {{{kbd(C-c C-v C-n)}}} | ~org-babel-next-src-block~ |
18038 | {{{kbd(C-c C-v e)}}} or {{{kbd(C-c C-v C-e)}}} | ~org-babel-execute-maybe~ |
18039 | {{{kbd(C-c C-v o)}}} or {{{kbd(C-c C-v C-o)}}} | ~org-babel-open-src-block-result~ |
18040 | {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} | ~org-babel-expand-src-block~ |
18041 | {{{kbd(C-c C-v u)}}} or {{{kbd(C-c C-v C-u)}}} | ~org-babel-goto-src-block-head~ |
18042 | {{{kbd(C-c C-v g)}}} or {{{kbd(C-c C-v C-g)}}} | ~org-babel-goto-named-src-block~ |
18043 | {{{kbd(C-c C-v r)}}} or {{{kbd(C-c C-v C-r)}}} | ~org-babel-goto-named-result~ |
18044 | {{{kbd(C-c C-v b)}}} or {{{kbd(C-c C-v C-b)}}} | ~org-babel-execute-buffer~ |
18045 | {{{kbd(C-c C-v s)}}} or {{{kbd(C-c C-v C-s)}}} | ~org-babel-execute-subtree~ |
18046 | {{{kbd(C-c C-v d)}}} or {{{kbd(C-c C-v C-d)}}} | ~org-babel-demarcate-block~ |
18047 | {{{kbd(C-c C-v t)}}} or {{{kbd(C-c C-v C-t)}}} | ~org-babel-tangle~ |
18048 | {{{kbd(C-c C-v f)}}} or {{{kbd(C-c C-v C-f)}}} | ~org-babel-tangle-file~ |
18049 | {{{kbd(C-c C-v c)}}} or {{{kbd(C-c C-v C-c)}}} | ~org-babel-check-src-block~ |
18050 | {{{kbd(C-c C-v j)}}} or {{{kbd(C-c C-v C-j)}}} | ~org-babel-insert-header-arg~ |
18051 | {{{kbd(C-c C-v l)}}} or {{{kbd(C-c C-v C-l)}}} | ~org-babel-load-in-session~ |
18052 | {{{kbd(C-c C-v i)}}} or {{{kbd(C-c C-v C-i)}}} | ~org-babel-lob-ingest~ |
18053 | {{{kbd(C-c C-v I)}}} or {{{kbd(C-c C-v C-I)}}} | ~org-babel-view-src-block-info~ |
18054 | {{{kbd(C-c C-v z)}}} or {{{kbd(C-c C-v C-z)}}} | ~org-babel-switch-to-session-with-code~ |
18055 | {{{kbd(C-c C-v a)}}} or {{{kbd(C-c C-v C-a)}}} | ~org-babel-sha1-hash~ |
18056 | {{{kbd(C-c C-v h)}}} or {{{kbd(C-c C-v C-h)}}} | ~org-babel-describe-bindings~ |
18057 | {{{kbd(C-c C-v x)}}} or {{{kbd(C-c C-v C-x)}}} | ~org-babel-do-key-sequence-in-edit-buffer~ |
18061 :DESCRIPTION: Call functions from the command line.
18063 #+cindex: code block, batch execution
18064 #+cindex: source code, batch execution
18066 Org mode features, including working with source code facilities can
18067 be invoked from the command line. This enables building shell scripts
18068 for batch processing, running automated system tasks, and expanding
18069 Org mode's usefulness.
18071 The sample script shows batch processing of multiple files using
18072 ~org-babel-tangle~.
18076 # Tangle files with Org mode
18078 emacs -Q --batch --eval "
18080 (require 'ob-tangle)
18081 (dolist (file command-line-args-left)
18082 (with-current-buffer (find-file-noselect file)
18083 (org-babel-tangle))))
18089 :DESCRIPTION: All the rest which did not fit elsewhere.
18094 :DESCRIPTION: M-@key{TAB} guesses completions.
18096 #+cindex: completion, of @TeX{} symbols
18097 #+cindex: completion, of TODO keywords
18098 #+cindex: completion, of dictionary words
18099 #+cindex: completion, of option keywords
18100 #+cindex: completion, of tags
18101 #+cindex: completion, of property keys
18102 #+cindex: completion, of link abbreviations
18103 #+cindex: @TeX{} symbol completion
18104 #+cindex: TODO keywords completion
18105 #+cindex: dictionary word completion
18106 #+cindex: option keyword completion
18107 #+cindex: tag completion
18108 #+cindex: link abbreviations, completion of
18110 Org has in-buffer completions. Unlike minibuffer completions, which
18111 are useful for quick command interactions, Org's in-buffer completions
18112 are more suitable for content creation in Org documents. Type one or
18113 more letters and invoke the hot key to complete the text in-place.
18114 Depending on the context and the keys, Org offers different types of
18115 completions. No minibuffer is involved. Such mode-specific hot keys
18116 have become an integral part of Emacs and Org provides several
18119 - {{{kbd(M-TAB)}}} ::
18122 Complete word at point.
18124 - At the beginning of a headline, complete TODO keywords.
18126 - After =\=, complete TeX symbols supported by the exporter.
18128 - After =*=, complete headlines in the current buffer so that
18129 they can be used in search links like:
18131 : [[*find this headline]]
18133 - After =:= in a headline, complete tags. Org deduces the list
18134 of tags from the =TAGS= in-buffer option (see [[*Setting Tags]]),
18135 the variable ~org-tag-alist~, or from all tags used in the
18138 - After =:= and not in a headline, complete property keys. The
18139 list of keys is constructed dynamically from all keys used in
18140 the current buffer.
18142 - After =[=, complete link abbreviations (see [[*Link
18145 - After =#+=, complete the special keywords like =TYP_TODO= or
18146 file-specific =OPTIONS=. After option keyword is complete,
18147 pressing {{{kbd(M-TAB)}}} again inserts example settings for
18150 - After =STARTUP= keyword, complete startup items.
18152 - When point is anywhere else, complete dictionary words using
18155 ** Structure Templates
18157 :DESCRIPTION: Quick insertion of structural elements.
18159 #+cindex: template insertion
18160 #+cindex: insertion, of templates
18162 With just a few keystrokes, it is possible to insert empty structural
18163 blocks, such as =#+BEGIN_SRC= ... =#+END_SRC=, or to wrap existing
18164 text in such a block.
18166 - {{{kbd(C-c C-x w)}}} (~org-insert-structure-template~) ::
18168 Prompt for a type of block structure, and insert the block at
18169 point. If the region is active, it is wrapped in the block.
18170 First prompts the user for a key, which is used to look up
18171 a structure type from the values below. If the key is
18172 {{{kbd(TAB)}}}, the user is prompted to enter a type.
18174 #+vindex: org-structure-template-alist
18175 Available structure types are defined in
18176 ~org-structure-template-alist~, see the docstring for adding or
18180 #+cindex: template expansion
18181 #+cindex: insertion, of templates
18182 #+vindex: org-tempo-keywords-alist
18183 #+vindex: org-structure-template-alist
18184 Org Tempo expands snippets to structures defined in
18185 ~org-structure-template-alist~ and ~org-tempo-keywords-alist~. For
18186 example, {{{kbd(< s TAB)}}} creates a code block. Enable it by
18187 customizing ~org-modules~ or add ~(require 'org-tempo)~ to your Emacs
18191 #+attr_texinfo: :columns 0.1 0.9
18192 | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= |
18193 | {{{kbd(c)}}} | =#+BEGIN_CENTER= ... =#+END_CENTER= |
18194 | {{{kbd(C)}}} | =#+BEGIN_COMMENT= ... =#+END_COMMENT= |
18195 | {{{kbd(e)}}} | =#+BEGIN_EXAMPLE= ... =#+END_EXAMPLE= |
18196 | {{{kbd(h)}}} | =#+BEGIN_EXPORT html= ... =#+END_EXPORT= |
18197 | {{{kbd(l)}}} | =#+BEGIN_EXPORT latex= ... =#+END_EXPORT= |
18198 | {{{kbd(q)}}} | =#+BEGIN_QUOTE= ... =#+END_QUOTE= |
18199 | {{{kbd(s)}}} | =#+BEGIN_SRC= ... =#+END_SRC= |
18200 | {{{kbd(v)}}} | =#+BEGIN_VERSE= ... =#+END_VERSE= |
18205 :DESCRIPTION: Electric commands at the beginning of a headline.
18207 #+cindex: speed keys
18209 Single keystrokes can execute custom commands in an Org file when the
18210 cursor is on a headline. Without the extra burden of a meta or
18211 modifier key, Speed Keys can speed navigation or execute custom
18212 commands. Besides faster navigation, Speed Keys may come in handy on
18213 small mobile devices that do not have full keyboards. Speed Keys may
18214 also work on TTY devices known for their problems when entering Emacs
18217 #+vindex: org-use-speed-commands
18218 By default, Org has Speed Keys disabled. To activate Speed Keys, set
18219 the variable ~org-use-speed-commands~ to a non-~nil~ value. To
18220 trigger a Speed Key, the cursor must be at the beginning of an Org
18221 headline, before any of the stars.
18223 #+vindex: org-speed-commands-user
18224 #+findex: org-speed-command-help
18225 Org comes with a pre-defined list of Speed Keys. To add or modify
18226 Speed Keys, customize the variable, ~org-speed-commands-user~. For
18227 more details, see the variable's docstring. With Speed Keys
18228 activated, {{{kbd(M-x org-speed-command-help)}}}, or {{{kbd(?)}}} when
18229 cursor is at the beginning of an Org headline, shows currently active
18230 Speed Keys, including the user-defined ones.
18232 ** Code Evaluation and Security Issues
18234 :DESCRIPTION: Org files evaluate in-line code.
18235 :ALT_TITLE: Code Evaluation Security
18238 Unlike plain text, running code comes with risk. Each =src= code
18239 block, in terms of risk, is equivalent to an executable file. Org
18240 therefore puts a few confirmation prompts by default. This is to
18241 alert the casual user from accidentally running untrusted code.
18243 For users who do not run code blocks or write code regularly, Org's
18244 default settings should suffice. However, some users may want to
18245 tweak the prompts for fewer interruptions. To weigh the risks of
18246 automatic execution of code blocks, here are some details about code
18249 Org evaluates code in the following circumstances:
18251 - /Source code blocks/ ::
18253 Org evaluates =src= code blocks in an Org file during export.
18254 Org also evaluates a =src= code block with the {{{kbd(C-c C-c)}}}
18255 key chord. Users exporting or running code blocks must load
18256 files only from trusted sources. Be wary of customizing
18257 variables that remove or alter default security measures.
18259 #+attr_texinfo: :options org-confirm-babel-evaluate
18261 When ~t~, Org prompts the user for confirmation before executing
18262 each code block. When ~nil~, Org executes code blocks without
18263 prompting the user for confirmation. When this option is set to
18264 a custom function, Org invokes the function with these two
18265 arguments: the source code language and the body of the code
18266 block. The custom function must return either a ~t~ or ~nil~,
18267 which determines if the user is prompted. Each source code
18268 language can be handled separately through this function
18272 For example, here is how to execute ditaa code blocks without
18275 #+begin_src emacs-lisp
18276 (defun my-org-confirm-babel-evaluate (lang body)
18277 (not (string= lang "ditaa"))) ;don't ask for ditaa
18278 (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
18281 - /Following =shell= and =elisp= links/ ::
18283 Org has two link types that can directly evaluate code (see
18284 [[*External Links]]). Because such code is not visible, these links
18285 have a potential risk. Org therefore prompts the user when it
18286 encounters such links. The customization variables are:
18288 #+attr_texinfo: :options org-confirm-shell-link-function
18290 Function that prompts the user before executing a shell link.
18293 #+attr_texinfo: :options org-confirm-elisp-link-function
18295 Function that prompts the user before executing an Emacs Lisp link.
18298 - /Formulas in tables/ ::
18300 Formulas in tables (see [[*The spreadsheet]]) are code that is
18301 evaluated either by the Calc interpreter, or by the Emacs Lisp
18306 :DESCRIPTION: Adapting Org to your taste.
18308 #+cindex: customization
18309 #+cindex: options, for customization
18310 #+cindex: variables, for customization
18312 Org has more than 500 variables for customization. They can be
18313 accessed through the usual {{{kbd(M-x org-customize)}}} command. Or
18314 through the Org menu: Org \rarr Customization \rarr Browse Org Group.
18316 Org also has per-file settings for some variables (see [[*Summary of
18317 In-Buffer Settings]]).
18319 ** Summary of In-Buffer Settings
18321 :DESCRIPTION: Overview of keywords.
18322 :ALT_TITLE: In-buffer Settings
18324 #+cindex: in-buffer settings
18325 #+cindex: special keywords
18327 In-buffer settings start with =#+=, followed by a keyword, a colon,
18328 and then a word for each setting. Org accepts multiple settings on
18329 the same line. Org also accepts multiple lines for a keyword. This
18330 manual describes these settings throughout. A summary follows here.
18332 #+cindex: refresh set-up
18333 {{{kbd(C-c C-c)}}} activates any changes to the in-buffer settings.
18334 Closing and reopening the Org file in Emacs also activates the
18337 #+attr_texinfo: :sep ,
18338 - =#+ARCHIVE: %s_done= ::
18340 #+cindex: @samp{ARCHIVE}, keyword
18341 #+vindex: org-archive-location
18342 Sets the archive location of the agenda file. The corresponding
18343 variable is ~org-archive-location~.
18347 #+cindex: @samp{CATEGORY}, keyword
18348 Sets the category of the agenda file, which applies to the entire
18351 - =#+COLUMNS: %25ITEM ...= ::
18353 #+cindex: @samp{COLUMNS}, property
18354 Set the default format for columns view. This format applies
18355 when columns view is invoked in locations where no =COLUMNS=
18358 - =#+CONSTANTS: name1=value1 ...= ::
18360 #+cindex: @samp{CONSTANTS}, keyword
18361 #+vindex: org-table-formula-constants
18362 #+vindex: org-table-formula
18363 Set file-local values for constants that table formulas can use.
18364 This line sets the local variable
18365 ~org-table-formula-constants-local~. The global version of this
18366 variable is ~org-table-formula-constants~.
18368 - =#+FILETAGS: :tag1:tag2:tag3:= ::
18370 #+cindex: @samp{FILETAGS}, keyword
18371 Set tags that all entries in the file inherit from, including the
18374 - =#+LINK: linkword replace= ::
18376 #+cindex: @samp{LINK}, keyword
18377 #+vindex: org-link-abbrev-alist
18378 Each line specifies one abbreviation for one link. Use multiple
18379 =LINK= keywords for more, see [[*Link Abbreviations]]. The
18380 corresponding variable is ~org-link-abbrev-alist~.
18382 - =#+PRIORITIES: highest lowest default= ::
18384 #+cindex: @samp{PRIORITIES}, keyword
18385 #+vindex: org-highest-priority
18386 #+vindex: org-lowest-priority
18387 #+vindex: org-default-priority
18388 This line sets the limits and the default for the priorities.
18389 All three must be either letters A--Z or numbers 0--9. The
18390 highest priority must have a lower ASCII number than the lowest
18393 - =#+PROPERTY: Property_Name Value= ::
18395 #+cindex: @samp{PROPERTY}, keyword
18396 This line sets a default inheritance value for entries in the
18397 current buffer, most useful for specifying the allowed values of
18400 - =#+SETUPFILE: file= ::
18402 #+cindex: @samp{SETUPFILE}, keyword
18403 The setup file or a URL pointing to such file is for additional
18404 in-buffer settings. Org loads this file and parses it for any
18405 settings in it only when Org opens the main file. If URL is
18406 specified, the contents are downloaded and stored in a temporary
18407 file cache. {{{kbd(C-c C-c)}}} on the settings line parses and
18408 loads the file, and also resets the temporary file cache. Org
18409 also parses and loads the document during normal exporting
18410 process. Org parses the contents of this document as if it was
18411 included in the buffer. It can be another Org file. To visit
18412 the file---not a URL---use {{{kbd(C-c ')}}} while the cursor is
18413 on the line with the file name.
18417 #+cindex: @samp{STARTUP}, keyword
18418 Startup options Org uses when first visiting a file.
18420 #+vindex: org-startup-folded
18421 The first set of options deals with the initial visibility of the
18422 outline tree. The corresponding variable for global default
18423 settings is ~org-startup-folded~ with a default value of ~t~,
18424 which is the same as ~overview~.
18428 Top-level headlines only.
18436 No folding on any entry.
18438 - =showeverything= ::
18440 Show even drawer contents.
18442 #+vindex: org-startup-indented
18443 Dynamic virtual indentation is controlled by the variable
18444 ~org-startup-indented~.[fn:134]
18448 Start with ~org-indent-mode~ turned on.
18452 Start with ~org-indent-mode~ turned off.
18454 #+vindex: org-startup-align-all-tables
18455 Aligns tables consistently upon visiting a file. The corresponding
18456 variable is ~org-startup-align-all-tables~ with ~nil~ as default
18465 Do not align tables on startup.
18467 #+vindex: org-startup-shrink-all-tables
18468 Shrink table columns with a width cookie. The corresponding
18469 variable is ~org-startup-shrink-all-tables~ with ~nil~ as default
18472 #+vindex: org-startup-with-inline-images
18473 When visiting a file, inline images can be automatically displayed.
18474 The corresponding variable is ~org-startup-with-inline-images~,
18475 with a default value ~nil~ to avoid delays when visiting a file.
18477 - =inlineimages= ::
18479 Show inline images.
18481 - =noinlineimages= ::
18483 Do not show inline images on startup.
18485 #+vindex: org-log-done
18486 #+vindex: org-log-note-clock-out
18487 #+vindex: org-log-repeat
18488 Logging the closing and reopening of TODO items and clock
18489 intervals can be configured using these options (see variables
18490 ~org-log-done~, ~org-log-note-clock-out~, and ~org-log-repeat~).
18494 Record a timestamp when an item is marked DONE.
18498 Record timestamp and a note when DONE.
18502 Do not record when items are marked DONE.
18506 Record a time when reinstating a repeating item.
18508 - =lognoterepeat= ::
18510 Record a note when reinstating a repeating item.
18514 Do not record when reinstating repeating item.
18516 - =lognoteclock-out= ::
18518 Record a note when clocking out.
18520 - =nolognoteclock-out= ::
18522 Do not record a note when clocking out.
18524 - =logreschedule= ::
18526 Record a timestamp when scheduling time changes.
18528 - =lognotereschedule= ::
18530 Record a note when scheduling time changes.
18532 - =nologreschedule= ::
18534 Do not record when a scheduling date changes.
18536 - =logredeadline= ::
18538 Record a timestamp when deadline changes.
18540 - =lognoteredeadline= ::
18542 Record a note when deadline changes.
18544 - =nologredeadline= ::
18546 Do not record when a deadline date changes.
18550 Record a timestamp when refiling.
18552 - =lognoterefile= ::
18554 Record a note when refiling.
18558 Do not record when refiling.
18560 #+vindex: org-hide-leading-stars
18561 #+vindex: org-odd-levels-only
18562 Here are the options for hiding leading stars in outline headings,
18563 and for indenting outlines. The corresponding variables are
18564 ~org-hide-leading-stars~ and ~org-odd-levels-only~, both with
18565 a default setting ~nil~ (meaning =showstars= and =oddeven=).
18569 Make all but one of the stars starting a headline invisible.
18573 Show all stars starting a headline.
18577 Virtual indentation according to outline level.
18581 No virtual indentation according to outline level.
18585 Allow only odd outline levels (1, 3, ...).
18589 Allow all outline levels.
18591 #+vindex: org-put-time-stamp-overlays
18592 #+vindex: org-time-stamp-overlay-formats
18593 To turn on custom format overlays over timestamps (variables
18594 ~org-put-time-stamp-overlays~ and ~org-time-stamp-overlay-formats~),
18599 Overlay custom time format.
18601 #+vindex: constants-unit-system
18602 The following options influence the table spreadsheet (variable
18603 ~constants-unit-system~).
18607 =constants.el= should use the c-g-s unit system.
18611 =constants.el= should use the SI unit system.
18613 #+vindex: org-footnote-define-inline
18614 #+vindex: org-footnote-auto-label
18615 #+vindex: org-footnote-auto-adjust
18616 To influence footnote settings, use the following keywords. The
18617 corresponding variables are ~org-footnote-define-inline~,
18618 ~org-footnote-auto-label~, and ~org-footnote-auto-adjust~.
18622 Define footnotes inline.
18626 Define footnotes in separate section.
18630 Define footnotes near first reference, but not inline.
18634 Prompt for footnote labels.
18638 Create =[fn:1]=-like labels automatically (default).
18642 Offer automatic label for editing or confirmation.
18646 Automatically renumber and sort footnotes.
18650 Do not renumber and sort automatically.
18652 #+vindex: org-hide-block-startup
18653 To hide blocks on startup, use these keywords. The corresponding
18654 variable is ~org-hide-block-startup~.
18658 Hide all begin/end blocks on startup.
18660 - =nohideblocks= ::
18662 Do not hide blocks on startup.
18664 #+vindex: org-pretty-entities
18665 The display of entities as UTF-8 characters is governed by the
18666 variable ~org-pretty-entities~ and the keywords
18668 - =entitiespretty= ::
18670 Show entities as UTF-8 characters where possible.
18672 - =entitiesplain= ::
18674 Leave entities plain.
18676 - =#+TAGS: TAG1(c1) TAG2(c2)= ::
18678 #+cindex: @samp{TAGS}, keyword
18679 #+vindex: org-tag-alist
18680 These lines (several such lines are allowed) specify the valid
18681 tags in this file, and (potentially) the corresponding /fast tag
18682 selection/ keys. The corresponding variable is ~org-tag-alist~.
18684 - =#+TODO:=, =#+SEQ_TODO:=, =#+TYP_TODO:= ::
18686 #+cindex: @samp{SEQ_TODO}, keyword
18687 #+cindex: @samp{TODO}, keyword
18688 #+cindex: @samp{TYP_TODO}, keyword
18689 #+vindex: org-todo-keywords
18690 These lines set the TODO keywords and their interpretation in the
18691 current file. The corresponding variable is ~org-todo-keywords~.
18693 ** The Very Busy {{{kbd(C-c C-c)}}} Key
18695 :DESCRIPTION: When in doubt, press @kbd{C-c C-c}.
18698 #+cindex: @kbd{C-c C-c}, overview
18700 The {{{kbd(C-c C-c)}}} key in Org serves many purposes depending on
18701 the context. It is probably the most over-worked, multi-purpose key
18702 combination in Org. Its uses are well documented throughout this
18703 manual, but here is a consolidated list for easy reference.
18705 - If any highlights shown in the buffer from the creation of a sparse
18706 tree, or from clock display, remove such highlights.
18708 - If the cursor is in one of the special =KEYWORD= lines, scan the
18709 buffer for these lines and update the information. Also reset the
18710 Org file cache used to temporary store the contents of URLs used as
18711 values for keywords like =SETUPFILE=.
18713 - If the cursor is inside a table, realign the table. The table
18714 realigns even if automatic table editor is turned off.
18716 - If the cursor is on a =TBLFM= keyword, re-apply the formulas to the
18719 - If the current buffer is a capture buffer, close the note and file
18720 it. With a prefix argument, also jump to the target location after
18723 - If the cursor is on a =<<<target>>>=, update radio targets and
18724 corresponding links in this buffer.
18726 - If the cursor is on a property line or at the start or end of
18727 a property drawer, offer property commands.
18729 - If the cursor is at a footnote reference, go to the corresponding
18730 definition, and /vice versa/.
18732 - If the cursor is on a statistics cookie, update it.
18734 - If the cursor is in a plain list item with a checkbox, toggle the
18735 status of the checkbox.
18737 - If the cursor is on a numbered item in a plain list, renumber the
18740 - If the cursor is on the =#+BEGIN= line of a dynamic block, the block
18743 - If the cursor is at a timestamp, fix the day name in the timestamp.
18745 ** A Cleaner Outline View
18747 :DESCRIPTION: Getting rid of leading stars in the outline.
18748 :ALT_TITLE: Clean View
18750 #+cindex: hiding leading stars
18751 #+cindex: dynamic indentation
18752 #+cindex: odd-levels-only outlines
18753 #+cindex: clean outline view
18755 Org's default outline with stars and no indents can become too
18756 cluttered for short documents. For /book-like/ long documents, the
18757 effect is not as noticeable. Org provides an alternate stars and
18758 indentation scheme, as shown on the right in the following table. It
18759 uses only one star and indents text to line with the heading:
18762 ,* Top level headline | * Top level headline
18763 ,** Second level | * Second level
18764 ,*** Third level | * Third level
18765 some text | some text
18766 ,*** Third level | * Third level
18767 more text | more text
18768 ,* Another top level headline | * Another top level headline
18771 #+texinfo: @noindent
18772 #+cindex: Indent mode
18773 #+findex: org-indent-mode
18774 To turn this mode on, use the minor mode, ~org-indent-mode~. Text
18775 lines that are not headlines are prefixed with spaces to vertically
18776 align with the headline text[fn:135].
18778 #+vindex: org-indent-indentation-per-level
18779 To make more horizontal space, the headlines are shifted by two stars.
18780 This can be configured by the ~org-indent-indentation-per-level~
18781 variable. Only one star on each headline is visible, the rest are
18782 masked with the same font color as the background.
18784 Note that turning on ~org-indent-mode~ sets ~org-hide-leading-stars~
18785 to ~t~ and ~org-adapt-indentation~ to ~nil~.
18787 #+vindex: org-startup-indented
18788 To globally turn on ~org-indent-mode~ for all files, customize the
18789 variable ~org-startup-indented~.
18791 To turn on indenting for individual files, use =STARTUP= keyword as
18794 : #+STARTUP: indent
18796 Indent on startup makes Org use hard spaces to align text with
18797 headings as shown in examples below.
18799 - /Indentation of text below headlines/ ::
18801 Indent text to align with the headline.
18805 more text, now indented
18808 #+vindex: org-adapt-indentation
18809 Org supports this with paragraph filling, line wrapping, and
18810 structure editing, preserving or adapting the indentation as
18811 appropriate[fn:136].
18813 - /Hiding leading stars/ ::
18815 #+vindex: org-hide-leading-stars
18816 Org can make leading stars invisible. For global preference,
18817 configure the variable ~org-hide-leading-stars~. For per-file
18818 preference, use these file =STARTUP= options:
18821 ,#+STARTUP: hidestars
18822 ,#+STARTUP: showstars
18825 With stars hidden, the tree is shown as:
18828 ,* Top level headline
18834 #+texinfo: @noindent
18835 #+vindex: org-hide, face
18836 Because Org makes the font color the same as the background color
18837 to hide to stars, sometimes ~org-hide~ face may need tweaking to
18838 get the effect right. For some black and white combinations,
18839 ~grey90~ on a white background might mask the stars better.
18843 #+vindex: org-odd-levels-only
18844 Using stars for only odd levels, 1, 3, 5, ..., can also clean up
18845 the clutter. This removes two stars from each level[fn:137].
18846 For Org to properly handle this cleaner structure during edits
18847 and exports, configure the variable ~org-odd-levels-only~. To
18848 set this per-file, use either one of the following lines:
18852 ,#+STARTUP: oddeven
18855 To switch between single and double stars layouts, use {{{kbd(M-x
18856 org-convert-to-odd-levels)}}} and {{{kbd(M-x
18857 org-convert-to-oddeven-levels)}}}.
18859 ** Using Org on a TTY
18861 :DESCRIPTION: Using Org on a tty.
18862 :ALT_TITLE: TTY Keys
18864 #+cindex: tty key bindings
18866 Org provides alternative key bindings for TTY and modern mobile
18867 devices that cannot handle cursor keys and complex modifier key
18868 chords. Some of these workarounds may be more cumbersome than
18869 necessary. Users should look into customizing these further based on
18870 their usage needs. For example, the normal {{{kbd(S-cursor)}}} for
18871 editing timestamp might be better with {{{kbd(C-c .)}}} chord.
18873 #+attr_texinfo: :columns 0.2 0.25 0.1 0.25
18874 | Default | Alternative 1 | Speed key | Alternative 2 |
18875 |----------------------+--------------------------+--------------+----------------------|
18876 | {{{kbd(S-TAB)}}} | {{{kbd(C-u TAB)}}} | {{{kbd(C)}}} | |
18877 | {{{kbd(M-LEFT)}}} | {{{kbd(C-c C-x l)}}} | {{{kbd(l)}}} | {{{kbd(Esc LEFT)}}} |
18878 | {{{kbd(M-S-LEFT)}}} | {{{kbd(C-c C-x L)}}} | {{{kbd(L)}}} | |
18879 | {{{kbd(M-RIGHT)}}} | {{{kbd(C-c C-x r)}}} | {{{kbd(r)}}} | {{{kbd(Esc RIGHT)}}} |
18880 | {{{kbd(M-S-RIGHT)}}} | {{{kbd(C-c C-x R)}}} | {{{kbd(R)}}} | |
18881 | {{{kbd(M-UP)}}} | {{{kbd(C-c C-x u)}}} | | {{{kbd(Esc UP)}}} |
18882 | {{{kbd(M-S-UP)}}} | {{{kbd(C-c C-x U)}}} | {{{kbd(U)}}} | |
18883 | {{{kbd(M-DOWN)}}} | {{{kbd(C-c C-x d)}}} | | {{{kbd(Esc DOWN)}}} |
18884 | {{{kbd(M-S-DOWN)}}} | {{{kbd(C-c C-x D)}}} | {{{kbd(D)}}} | |
18885 | {{{kbd(S-RET)}}} | {{{kbd(C-c C-x c)}}} | | |
18886 | {{{kbd(M-RET)}}} | {{{kbd(C-c C-x m)}}} | | {{{kbd(Esc RET)}}} |
18887 | {{{kbd(M-S-RET)}}} | {{{kbd(C-c C-x M)}}} | | |
18888 | {{{kbd(S-LEFT)}}} | {{{kbd(C-c LEFT)}}} | | |
18889 | {{{kbd(S-RIGHT)}}} | {{{kbd(C-c RIGHT)}}} | | |
18890 | {{{kbd(S-UP)}}} | {{{kbd(C-c UP)}}} | | |
18891 | {{{kbd(S-DOWN)}}} | {{{kbd(C-c DOWN)}}} | | |
18892 | {{{kbd(C-S-LEFT)}}} | {{{kbd(C-c C-x LEFT)}}} | | |
18893 | {{{kbd(C-S-RIGHT)}}} | {{{kbd(C-c C-x RIGHT)}}} | | |
18895 ** Interaction with Other Packages
18897 :DESCRIPTION: With other Emacs packages.
18898 :ALT_TITLE: Interaction
18900 #+cindex: packages, interaction with other
18902 Org's compatibility and the level of interaction with other Emacs
18903 packages are documented here.
18905 *** Packages that Org cooperates with
18907 :DESCRIPTION: Packages Org cooperates with.
18908 :ALT_TITLE: Cooperation
18911 - =calc.el= by Dave Gillespie ::
18912 #+cindex: @file{calc.el}
18914 Org uses the Calc package for implementing spreadsheet
18915 functionality in its tables (see [[*The spreadsheet]]). Org also
18916 uses Calc for embedded calculations. See [[info:calc:Embedded%20Mode][GNU Emacs Calc Manual]].
18918 - =constants.el= by Carsten Dominik ::
18919 #+cindex: @file{constants.el}
18920 #+vindex: org-table-formula-constants
18922 Org can use names for constants in formulas in tables. Org can
18923 also use calculation suffixes for units, such as =M= for =Mega=.
18924 For a standard collection of such constants, install the
18925 =constants= package. Install version 2.0 of this package,
18926 available at [[http://www.astro.uva.nl/~dominik/Tools]]. Org checks
18927 if the function ~constants-get~ has been autoloaded.
18928 Installation instructions are in the file =constants.el=.
18930 - =cdlatex.el= by Carsten Dominik ::
18931 #+cindex: @file{cdlatex.el}
18933 Org mode can make use of the CDLaTeX package to efficiently enter
18934 LaTeX fragments into Org files. See [[*Using CDLaTeX to enter
18937 - =imenu.el= by Ake Stenhoff and Lars Lindberg ::
18938 #+cindex: @file{imenu.el}
18940 Imenu creates dynamic menus based on an index of items in a file.
18941 Org mode supports Imenu menus. Enable it with a mode hook as
18944 #+begin_src emacs-lisp
18945 (add-hook 'org-mode-hook
18946 (lambda () (imenu-add-to-menubar "Imenu")))
18949 #+vindex: org-imenu-depth
18950 By default the index is two levels deep---you can modify the
18951 depth using the option ~org-imenu-depth~.
18953 - =speedbar.el= by Eric M. Ludlam ::
18954 #+cindex: @file{speedbar.el}
18956 Speedbar package creates a special Emacs frame for displaying
18957 files and index items in files. Org mode supports Speedbar;
18958 users can drill into Org files directly from the Speedbar. The
18959 {{{kbd(<)}}} in the Speedbar frame tweaks the agenda commands to
18960 that file or to a subtree.
18962 - =table.el= by Takaaki Ota ::
18963 #+cindex: table editor, @file{table.el}
18964 #+cindex: @file{table.el}
18966 Complex ASCII tables with automatic line wrapping, column- and
18967 row-spanning, and alignment can be created using the Emacs table
18968 package by Takaaki Ota. Org mode recognizes such tables and
18969 exports them properly. {{{kbd(C-c ')}}} to edit these tables in
18970 a special buffer, much like Org's code blocks. Because of
18971 interference with other Org mode functionality, Takaaki Ota
18972 tables cannot be edited directly in the Org buffer.
18974 - {{{kbd(C-c ')}}} (~org-edit-special~) ::
18977 #+findex: org-edit-special
18978 Edit a =table.el= table. Works when the cursor is in
18979 a =table.el= table.
18981 - {{{kbd(C-c ~​)}}} (~org-table-create-with-table.el~) ::
18984 #+findex: org-table-create-with-table.el
18985 Insert a =table.el= table. If there is already a table at
18986 point, this command converts it between the =table.el=
18987 format and the Org mode format. See the documentation
18988 string of the command ~org-convert-table~ for the
18989 restrictions under which this is possible.
18991 *** Packages that conflict with Org mode
18993 :DESCRIPTION: Packages that lead to conflicts.
18994 :ALT_TITLE: Conflicts
18997 #+cindex: shift-selection-mode
18998 #+vindex: org-support-shift-select
18999 In Emacs, ~shift-selection-mode~ combines cursor motions with shift
19000 key to enlarge regions. Emacs sets this mode by default. This
19001 conflicts with Org's use of {{{kbd(S-<cursor>)}}} commands to change
19002 timestamps, TODO keywords, priorities, and item bullet types, etc.
19003 Since {{{kbd(S-<cursor>)}}} commands outside of specific contexts do
19004 not do anything, Org offers the variable ~org-support-shift-select~
19005 for customization. Org mode accommodates shift selection by (i)
19006 making it available outside of the special contexts where special
19007 commands apply, and (ii) extending an existing active region even if
19008 the cursor moves across a special context.
19010 - =cua.el= by Kim. F. Storm ::
19012 #+cindex: @file{cua.el}
19013 #+vindex: org-replace-disputed-keys
19014 Org key bindings conflict with {{{kbd(S-cursor)}}} keys used by
19015 CUA mode. For Org to relinquish these bindings to CUA mode,
19016 configure the variable ~org-replace-disputed-keys~. When set,
19017 Org moves the following key bindings in Org files, and in the
19018 agenda buffer---but not during date selection.
19020 #+attr_texinfo: :columns 0.4 0.4
19021 | {{{kbd(S-UP)}}} \rArr{} {{{kbd(M-p)}}} | {{{kbd(S-DOWN)}}} \rArr{} {{{kbd(M-n)}}} |
19022 | {{{kbd(S-LEFT)}}} \rArr{} {{{kbd(M--)}}} | {{{kbd(S-RIGHT)}}} \rArr{} {{{kbd(M-+)}}} |
19023 | {{{kbd(C-S-LEFT)}}} \rArr{} {{{kbd(M-S--)}}} | {{{kbd(C-S-RIGHT)}}} \rArr{} {{{kbd(M-S-+)}}} |
19025 #+vindex: org-disputed-keys
19026 Yes, these are unfortunately more difficult to remember. If you
19027 want to have other replacement keys, look at the variable
19028 ~org-disputed-keys~.
19030 - =ecomplete.el= by Lars Magne Ingebrigtsen ::
19032 #+cindex: @file{ecomplete.el}
19033 Ecomplete provides "electric" address completion in address
19034 header lines in message buffers. Sadly Orgtbl mode cuts
19035 Ecomplete's power supply: no completion happens when Orgtbl mode
19036 is enabled in message buffers while entering text in address
19037 header lines. If one wants to use ecomplete one should /not/
19038 follow the advice to automagically turn on Orgtbl mode in message
19039 buffers (see [[*The Orgtbl Minor Mode]]), but instead---after
19040 filling in the message headers---turn on Orgtbl mode manually
19041 when needed in the messages body.
19043 - =filladapt.el= by Kyle Jones ::
19045 #+cindex: @file{filladapt.el}
19046 Org mode tries to do the right thing when filling paragraphs,
19047 list items and other elements. Many users reported problems
19048 using both =filladapt.el= and Org mode, so a safe thing to do is
19049 to disable filladapt like this:
19051 #+begin_src emacs-lisp
19052 (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
19055 - =viper.el= by Michael Kifer ::
19056 #+cindex: @file{viper.el}
19059 Viper uses {{{kbd(C-c /)}}} and therefore makes this key not
19060 access the corresponding Org mode command ~org-sparse-tree~. You
19061 need to find another key for this command, or override the key in
19062 ~viper-vi-global-user-map~ with
19064 #+begin_src emacs-lisp
19065 (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
19068 - =windmove.el= by Hovav Shacham ::
19069 #+cindex: @file{windmove.el}
19071 This package also uses the {{{kbd(S-<cursor>)}}} keys, so
19072 everything written in the paragraph above about CUA mode also
19073 applies here. If you want to make the windmove function active
19074 in locations where Org mode does not have special functionality
19075 on {{{kbd(S-<cursor>)}}}, add this to your configuration:
19077 #+begin_src emacs-lisp
19078 ;; Make windmove work in Org mode:
19079 (add-hook 'org-shiftup-final-hook 'windmove-up)
19080 (add-hook 'org-shiftleft-final-hook 'windmove-left)
19081 (add-hook 'org-shiftdown-final-hook 'windmove-down)
19082 (add-hook 'org-shiftright-final-hook 'windmove-right)
19085 - =yasnippet.el= ::
19087 #+cindex: @file{yasnippet.el}
19088 The way Org mode binds the {{{kbd(TAB)}}} key (binding to ~[tab]~
19089 instead of ~"\t"~) overrules YASnippet's access to this key. The
19090 following code fixed this problem:
19092 #+begin_src emacs-lisp
19093 (add-hook 'org-mode-hook
19095 (setq-local yas/trigger-key [tab])
19096 (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
19099 The latest version of YASnippet does not play well with Org mode.
19100 If the above code does not fix the conflict, start by defining
19101 the following function:
19103 #+begin_src emacs-lisp
19104 (defun yas/org-very-safe-expand ()
19105 (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
19108 Then, tell Org mode to use that function:
19110 #+begin_src emacs-lisp
19111 (add-hook 'org-mode-hook
19113 (make-variable-buffer-local 'yas/trigger-key)
19114 (setq yas/trigger-key [tab])
19115 (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
19116 (define-key yas/keymap [tab] 'yas/next-field)))
19121 :DESCRIPTION: Encrypting Org files.
19124 Org Crypt encrypts the text of an entry, but not the headline, or
19125 properties. Behind the scene, it uses the Emacs EasyPG library to
19126 encrypt and decrypt files.
19128 #+vindex: org-crypt-tag-matcher
19129 Any text below a headline that has a =crypt= tag is automatically
19130 encrypted when the file is saved. To use a different tag, customize
19131 the ~org-crypt-tag-matcher~ setting.
19133 Here is a suggestion for Org Crypt settings in Emacs init file:
19135 #+begin_src emacs-lisp
19136 (require 'org-crypt)
19137 (org-crypt-use-before-save-magic)
19138 (setq org-tags-exclude-from-inheritance '("crypt"))
19140 (setq org-crypt-key nil)
19141 ;; GPG key to use for encryption
19142 ;; Either the Key ID or set to nil to use symmetric encryption.
19144 (setq auto-save-default nil)
19145 ;; Auto-saving does not cooperate with org-crypt.el: so you need to
19146 ;; turn it off if you plan to use org-crypt.el quite often. Otherwise,
19147 ;; you'll get an (annoying) message each time you start Org.
19149 ;; To turn it off only locally, you can insert this:
19151 ;; # -*- buffer-auto-save-file-name: nil; -*-
19154 Excluding the =crypt= tag from inheritance prevents already encrypted
19155 text from being encrypted again.
19159 :DESCRIPTION: How to hack your way around.
19160 :APPENDIX: Appendix
19164 This appendix describes some ways a user can extend the functionality
19169 :DESCRIPTION: How to reach into Org's internals.
19173 Org has a large number of hook variables for adding functionality.
19174 This appendix illustrates using a few. A complete list of hooks with
19175 documentation is maintained by the Worg project at
19176 https://orgmode.org/worg/doc.html#hooks.
19180 :DESCRIPTION: Available extensions.
19182 #+cindex: add-on packages
19184 Various authors wrote a large number of add-on packages for Org.
19186 These packages are not part of Emacs, but they are distributed as
19187 contributed packages with the separate release available at
19188 https://orgmode.org. See the =contrib/README= file in the source code
19189 directory for a list of contributed files. Worg page with more
19190 information is at: https://orgmode.org/worg/org-contrib/.
19192 ** Adding Hyperlink Types
19194 :DESCRIPTION: New custom link types.
19196 #+cindex: hyperlinks, adding new types
19198 Org has many built-in hyperlink types (see [[*Hyperlinks]]), and an
19199 interface for adding new link types. The following example shows the
19200 process of adding Org links to Unix man pages, which look like this
19202 : [[man:printf][The printf manual]]
19204 #+texinfo: @noindent
19205 The following =org-man.el= file implements it
19207 #+begin_src emacs-lisp
19208 ;;; org-man.el - Support for links to man pages in Org mode
19211 (org-link-set-parameters "man"
19212 :follow org-man-command
19213 :export #'org-man-export
19214 :store #'org-man-store-link)
19216 (defcustom org-man-command 'man
19217 "The Emacs command to be used to display a man page."
19219 :type '(choice (const man) (const woman)))
19221 (defun org-man-store-link ()
19222 "Store a link to a man page."
19223 (when (memq major-mode '(Man-mode woman-mode))
19224 ;; This is a man page, we do make this link.
19225 (let* ((page (org-man-get-page-name))
19226 (link (concat "man:" page))
19227 (description (format "Man page for %s" page)))
19228 (org-store-link-props
19231 :description description))))
19233 (defun org-man-get-page-name ()
19234 "Extract the page name from the buffer name."
19235 ;; This works for both `Man-mode' and `woman-mode'.
19236 (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
19237 (match-string 1 (buffer-name))
19238 (error "Cannot create link to this man page")))
19240 (defun org-man-export (link description format)
19241 "Export a man page link from Org files."
19242 (let ((path (format "http://man.he.net/?topic=%s§ion=all" link))
19243 (desc (or description link)))
19245 (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
19246 (`latex (format "\\href{%s}{%s}" path desc))
19247 (`texinfo (format "@uref{%s,%s}" path desc))
19248 (`ascii (format "%s (%s)" desc path))
19252 ;;; org-man.el ends here
19255 #+texinfo: @noindent
19256 To activate links to man pages in Org, enter this in the Emacs init
19259 #+begin_src emacs-lisp
19263 #+texinfo: @noindent
19264 A review of =org-man.el=:
19266 1. First, ~(require 'org)~ ensures =org.el= is loaded.
19270 #+findex: org-link-set-parameters
19271 #+vindex: org-link-parameters
19272 Then ~org-link-set-parameters~ defines a new link type with =man=
19273 prefix and associates functions for following, exporting and
19274 storing such links. See the variable ~org-link-parameters~ for
19275 a complete list of possible associations.
19277 3. The rest of the file implements necessary variables and functions.
19279 For example, ~org-man-store-link~ is responsible for storing a link
19280 when ~org-store-link~ (see [[*Handling Links]]) is called from a buffer
19281 displaying a man page. It first checks if the ~major-mode~ is
19282 appropriate. If check fails, the function returns ~nil~, which
19283 means it isn't responsible for creating a link to the current
19284 buffer. Otherwise the function makes a link string by combining
19285 the =man:= prefix with the man topic. It also provides a default
19286 description. The function ~org-insert-link~ can insert it back
19287 into an Org buffer later on.
19289 ** Adding Export Back-ends
19291 :DESCRIPTION: How to write new export back-ends.
19293 #+cindex: Export, writing back-ends
19295 Org's export engine makes it easy for writing new back-ends. The
19296 framework on which the engine was built makes it easy to derive new
19297 back-ends from existing ones.
19299 #+findex: org-export-define-backend
19300 #+findex: org-export-define-derived-backend
19301 The two main entry points to the export engine are:
19302 ~org-export-define-backend~ and ~org-export-define-derived-backend~.
19303 To grok these functions, see =ox-latex.el= for an example of defining
19304 a new back-end from scratch, and =ox-beamer.el= for an example of
19305 deriving from an existing engine.
19307 For creating a new back-end from scratch, first set its name as
19308 a symbol in an alist consisting of elements and export functions. To
19309 make the back-end visible to the export dispatcher, set ~:menu-entry~
19310 keyword. For export options specific to this back-end, set the
19313 For creating a new back-end from an existing one, set
19314 ~:translate-alist~ to an alist of export functions. This alist
19315 replaces the parent back-end functions.
19317 For complete documentation, see [[https://orgmode.org/worg/dev/org-export-reference.html][the Org Export Reference on Worg]].
19319 ** Tables in Arbitrary Syntax
19321 :DESCRIPTION: Orgtbl for LaTeX and other programs.
19323 #+cindex: tables, in other modes
19324 #+cindex: lists, in other modes
19325 #+cindex: Orgtbl mode
19327 Due to Org's success in handling tables with Orgtbl, a frequently
19328 requested feature is the use of Org's table functions in other modes,
19329 e.g., LaTeX. This would be hard to do in a general way without
19330 complicated customization nightmares. Moreover, that would take Org
19331 away from its simplicity roots that Orgtbl has proven. There is,
19332 however, an alternate approach to accomplishing the same.
19334 This approach involves implementing a custom /translate/ function that
19335 operates on a native Org /source table/ to produce a table in another
19336 format. This strategy would keep the excellently working Orgtbl
19337 simple and isolate complications, if any, confined to the translate
19338 function. To add more alien table formats, we just add more translate
19339 functions. Also the burden of developing custom translate functions
19340 for new table formats is in the hands of those who know those formats
19345 :DESCRIPTION: Sending and receiving radio tables.
19347 #+cindex: radio tables
19349 Radio tables are target locations for translated tables that are not near
19350 their source. Org finds the target location and inserts the translated
19353 The key to finding the target location is the magic words =BEGIN/END
19354 RECEIVE ORGTBL=. They have to appear as comments in the current mode.
19355 If the mode is C, then:
19358 /* BEGIN RECEIVE ORGTBL table_name */
19359 /* END RECEIVE ORGTBL table_name */
19362 #+texinfo: @noindent
19363 At the location of source, Org needs a special line to direct Orgtbl
19364 to translate and to find the target for inserting the translated
19365 table. For example:
19367 #+cindex: @samp{ORGTBL}, keyword
19368 : #+ORGTBL: SEND table_name translation_function arguments ...
19370 #+texinfo: @noindent
19371 =table_name= is the table's reference name, which is also used in the
19372 receiver lines, and the =translation_function= is the Lisp function
19373 that translates. This line, in addition, may also contain alternating
19374 key and value arguments at the end. The translation function gets
19375 these values as a property list. A few standard parameters are
19376 already recognized and acted upon before the translation function is
19381 Skip the first N lines of the table. Hlines do count; include
19382 them if they are to be skipped.
19384 - =:skipcols (n1 n2 ...)= ::
19386 List of columns to be skipped. First Org automatically discards
19387 columns with calculation marks and then sends the table to the
19388 translator function, which then skips columns as specified in
19391 #+texinfo: @noindent
19392 To keep the source table intact in the buffer without being disturbed
19393 when the source file is compiled or otherwise being worked on, use one
19394 of these strategies:
19396 - Place the table in a block comment. For example, in C mode you
19397 could wrap the table between =/*= and =*/= lines.
19399 - Put the table after an "end" statement. For example ~\bye~ in TeX
19400 and ~\end{document}~ in LaTeX.
19402 - Comment and un-comment each line of the table during edits. The
19403 {{{kbd(M-x orgtbl-toggle-comment)}}} command makes toggling easy.
19405 *** A LaTeX example of radio tables
19407 :DESCRIPTION: Step by step, almost a tutorial.
19408 :ALT_TITLE: A LaTeX example
19410 #+cindex: @LaTeX{}, and Orgtbl mode
19412 To wrap a source table in LaTeX, use the =comment= environment
19413 provided by =comment.sty=[fn:138]. To activate it, put
19414 ~\usepackage{comment}~ in the document header. Orgtbl mode inserts
19415 a radio table skeleton[fn:137] with the command {{{kbd(M-x
19416 orgtbl-insert-radio-table)}}}, which prompts for a table name. For
19417 example, if =salesfigures= is the name, the template inserts:
19420 % BEGIN RECEIVE ORGTBL salesfigures
19421 % END RECEIVE ORGTBL salesfigures
19423 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
19428 #+vindex: LaTeX-verbatim-environments
19429 #+texinfo: @noindent
19430 The line =#+ORGTBL: SEND= tells Orgtbl mode to use the function
19431 ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert
19432 the table at the target (receive) location named =salesfigures=. Now
19433 the table is ready for data entry. It can even use spreadsheet
19437 % BEGIN RECEIVE ORGTBL salesfigures
19438 % END RECEIVE ORGTBL salesfigures
19440 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
19441 | Month | Days | Nr sold | per day |
19442 |-------+------+---------+---------|
19443 | Jan | 23 | 55 | 2.4 |
19444 | Feb | 21 | 16 | 0.8 |
19445 | March | 22 | 278 | 12.6 |
19446 ,#+TBLFM: $4=$3/$2;%.1f
19447 % $ (optional extra dollar to keep Font Lock happy, see footnote)
19451 #+texinfo: @noindent
19452 After editing, {{{kbd(C-c C-c)}}} inserts the translated table at the
19453 target location, between the two marker lines.
19455 For hand-made custom tables, note that the translator needs to skip
19456 the first two lines of the source table. Also the command has to
19457 /splice/ out the target table without the header and footer.
19460 \begin{tabular}{lrrr}
19461 Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\
19462 % BEGIN RECEIVE ORGTBL salesfigures
19463 % END RECEIVE ORGTBL salesfigures
19467 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
19468 | Month | Days | Nr sold | per day |
19469 |-------+------+---------+---------|
19470 | Jan | 23 | 55 | 2.4 |
19471 | Feb | 21 | 16 | 0.8 |
19472 | March | 22 | 278 | 12.6 |
19473 ,#+TBLFM: $4=$3/$2;%.1f
19477 The LaTeX translator function ~orgtbl-to-latex~ is already part of
19478 Orgtbl mode and uses a =tabular= environment to typeset the table and
19479 marks horizontal lines with ~\hline~. For additional parameters to
19480 control output, see [[*Translator functions]]:
19482 - ~:splice nil/t~ ::
19484 When non-~nil~, return only table body lines; not wrapped in
19485 tabular environment. Default is ~nil~.
19489 Format to warp each field. It should contain =%s= for the
19490 original field value. For example, to wrap each field value in
19491 dollar symbol, you could use =:fmt "$%s$"=. Format can also wrap
19492 a property list with column numbers and formats, for example
19493 =:fmt (2 "$%s$" 4 "%s\\%%")=. In place of a string, a function
19494 of one argument can be used; the function must return a formatted
19499 Format numbers as exponentials. The spec should have =%s= twice
19500 for inserting mantissa and exponent, for example
19501 ="%s\\times10^{%s}"=. This may also be a property list with
19502 column numbers and formats, for example =:efmt (2
19503 "$%s\\times10^{%s}$" 4 "$%s\\cdot10^{%s}$")=. After
19504 {{{var(EFMT)}}} has been applied to a value, {{{var(FMT)}}}---see
19505 above---is also be applied. Functions with two arguments can be
19506 supplied instead of strings. By default, no special formatting
19509 *** Translator functions
19511 :DESCRIPTION: Copy and modify.
19513 #+cindex: HTML, and Orgtbl mode
19514 #+cindex: translator function
19516 #+findex: orgtbl-to-csv
19517 #+findex: orgtbl-to-tsv
19518 #+findex: orgtbl-to-latex
19519 #+findex: orgtbl-to-html
19520 #+findex: orgtbl-to-texinfo
19521 #+findex: orgtbl-to-unicode
19522 #+findex: orgtbl-to-orgtbl
19523 #+findex: orgtbl-to-generic
19524 Orgtbl mode has built-in translator functions: ~orgtbl-to-csv~
19525 (comma-separated values), ~orgtbl-to-tsv~ (TAB-separated values),
19526 ~orgtbl-to-latex~, ~orgtbl-to-html~, ~orgtbl-to-texinfo~,
19527 ~orgtbl-to-unicode~ and ~orgtbl-to-orgtbl~. They use the generic
19528 translator, ~orgtbl-to-generic~, which delegates translations to
19529 various export back-ends.
19531 Properties passed to the function through the =ORGTBL SEND= line take
19532 precedence over properties defined inside the function. For example,
19533 this overrides the default LaTeX line endings, ~\\~, with ~\\[2mm]~:
19535 : #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
19537 For a new language translator, define a converter function. It can be
19538 a generic function, such as shown in this example. It marks
19539 a beginning and ending of a table with =!BTBL!= and =!ETBL!=;
19540 a beginning and ending of lines with =!BL!= and =!EL!=; and uses a TAB
19541 for a field separator:
19543 #+begin_src emacs-lisp
19544 (defun orgtbl-to-language (table params)
19545 "Convert the orgtbl-mode TABLE to language."
19548 (org-combine-plists
19549 '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
19553 #+texinfo: @noindent
19554 The documentation for the ~orgtbl-to-generic~ function shows
19555 a complete list of parameters, each of which can be passed through to
19556 ~orgtbl-to-latex~, ~orgtbl-to-texinfo~, and any other function using
19557 that generic function.
19559 For complicated translations the generic translator function could be
19560 replaced by a custom translator function. Such a custom function must
19561 take two arguments and return a single string containing the formatted
19562 table. The first argument is the table whose lines are a list of
19563 fields or the symbol ~hline~. The second argument is the property
19564 list consisting of parameters specified in the =#+ORGTBL: SEND= line.
19565 Please share your translator functions by posting them to the Org
19566 users mailing list, at mailto:emacs-orgmode@gnu.org.
19570 :DESCRIPTION: Automatically filled blocks.
19572 #+cindex: dynamic blocks
19574 Org supports /dynamic blocks/ in Org documents. They are inserted
19575 with begin and end markers like any other code block, but the contents
19576 are updated automatically by a user function. For example, {{{kbd(C-c
19577 C-x C-r)}}} inserts a dynamic table that updates the work time (see
19578 [[*Clocking Work Time]]).
19580 Dynamic blocks can have names and function parameters. The syntax is
19581 similar to source code block specifications:
19584 ,#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
19589 These commands update dynamic blocks:
19591 - {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
19593 #+kindex: C-c C-x C-u
19594 #+findex: org-dblock-update
19595 Update dynamic block at point.
19597 - {{{kbd(C-u C-c C-x C-u)}}} ::
19599 #+kindex: C-u C-c C-x C-u
19600 Update all dynamic blocks in the current file.
19602 Before updating a dynamic block, Org removes content between the
19603 =BEGIN= and =END= markers. Org then reads the parameters on the
19604 =BEGIN= line for passing to the writer function. If the function
19605 expects to access the removed content, then Org expects an extra
19606 parameter, =:content=, on the =BEGIN= line.
19608 The syntax for naming a writer function with a dynamic block labelled
19609 =myblock= is: ~org-dblock-write:myblock~. Parameters come from the
19612 The following is an example of a dynamic block and a block writer function
19613 that updates the time when the function was last run:
19616 ,#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
19621 #+texinfo: @noindent
19622 The dynamic block's writer function:
19624 #+begin_src emacs-lisp
19625 (defun org-dblock-write:block-update-time (params)
19626 (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
19627 (insert "Last block update at: "
19628 (format-time-string fmt))))
19631 To keep dynamic blocks up-to-date in an Org file, use the function,
19632 ~org-update-all-dblocks~ in hook, such as ~before-save-hook~. The
19633 ~org-update-all-dblocks~ function does not run if the file is not in
19636 #+findex: org-narrow-to-block
19637 Dynamic blocks, like any other block, can be narrowed with
19638 ~org-narrow-to-block~.
19640 ** Special Agenda Views
19642 :DESCRIPTION: Customized views.
19644 #+cindex: agenda views, user-defined
19646 #+vindex: org-agenda-skip-function
19647 #+vindex: org-agenda-skip-function-global
19648 Org provides a special hook to further limit items in agenda views:
19649 ~agenda~, ~agenda*~[fn:140], ~todo~, ~alltodo~, ~tags~, ~tags-todo~,
19650 ~tags-tree~. Specify a custom function that tests inclusion of every
19651 matched item in the view. This function can also skip as much as is
19654 For a global condition applicable to agenda views, use the
19655 ~org-agenda-skip-function-global~ variable. Org uses a global
19656 condition with ~org-agenda-skip-function~ for custom searching.
19658 This example defines a function for a custom view showing TODO items
19659 with =waiting= status. Manually this is a multi-step search process,
19660 but with a custom view, this can be automated as follows:
19662 The custom function searches the subtree for the =waiting= tag and
19663 returns ~nil~ on match. Otherwise it gives the location from where
19664 the search continues.
19666 #+begin_src emacs-lisp
19667 (defun my-skip-unless-waiting ()
19668 "Skip trees that are not waiting"
19669 (let ((subtree-end (save-excursion (org-end-of-subtree t))))
19670 (if (re-search-forward ":waiting:" subtree-end t)
19671 nil ; tag found, do not skip
19672 subtree-end))) ; tag not found, continue after end of subtree
19675 To use this custom function in a custom agenda command:
19677 #+begin_src emacs-lisp
19678 (org-add-agenda-custom-command
19679 '("b" todo "PROJECT"
19680 ((org-agenda-skip-function 'my-skip-unless-waiting)
19681 (org-agenda-overriding-header "Projects waiting for something: "))))
19684 #+vindex: org-agenda-overriding-header
19685 Note that this also binds ~org-agenda-overriding-header~ to a more
19686 meaningful string suitable for the agenda view.
19688 #+vindex: org-odd-levels-only
19689 #+vindex: org-agenda-skip-function
19690 Search for entries with a limit set on levels for the custom search.
19691 This is a general approach to creating custom searches in Org. To
19692 include all levels, use =LEVEL>0=[fn:141]. Then to selectively pick
19693 the matched entries, use ~org-agenda-skip-function~, which also
19694 accepts Lisp forms, such as ~org-agenda-skip-entry-if~ and
19695 ~org-agenda-skip-subtree-if~. For example:
19697 - ~(org-agenda-skip-entry-if 'scheduled)~ ::
19699 Skip current entry if it has been scheduled.
19701 - ~(org-agenda-skip-entry-if 'notscheduled)~ ::
19703 Skip current entry if it has not been scheduled.
19705 - ~(org-agenda-skip-entry-if 'deadline)~ ::
19707 Skip current entry if it has a deadline.
19709 - ~(org-agenda-skip-entry-if 'scheduled 'deadline)~ ::
19711 Skip current entry if it has a deadline, or if it is scheduled.
19713 - ~(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))~ ::
19715 Skip current entry if the TODO keyword is TODO or WAITING.
19717 - ~(org-agenda-skip-entry-if 'todo 'done)~ ::
19719 Skip current entry if the TODO keyword marks a DONE state.
19721 - ~(org-agenda-skip-entry-if 'timestamp)~ ::
19723 Skip current entry if it has any timestamp, may also be deadline
19726 - ~(org-agenda-skip-entry-if 'regexp "regular expression")~ ::
19728 Skip current entry if the regular expression matches in the
19731 - ~(org-agenda-skip-entry-if 'notregexp "regular expression")~ ::
19733 Skip current entry unless the regular expression matches.
19735 - ~(org-agenda-skip-subtree-if 'regexp "regular expression")~ ::
19737 Same as above, but check and skip the entire subtree.
19739 The following is an example of a search for =waiting= without the
19742 #+begin_src emacs-lisp
19743 (org-add-agenda-custom-command
19744 '("b" todo "PROJECT"
19745 ((org-agenda-skip-function '(org-agenda-skip-subtree-if
19746 'regexp ":waiting:"))
19747 (org-agenda-overriding-header "Projects waiting for something: "))))
19750 ** Speeding Up Your Agendas
19752 :DESCRIPTION: Tips on how to speed up your agendas.
19754 #+cindex: agenda views, optimization
19756 Some agenda commands slow down when the Org files grow in size or
19757 number. Here are tips to speed up:
19759 - Reduce the number of Org agenda files to avoid slowdowns due to hard drive
19762 - Reduce the number of DONE and archived headlines so agenda
19763 operations that skip over these can finish faster.
19765 - Do not dim blocked tasks:
19766 #+vindex: org-agenda-dim-blocked-tasks
19768 #+begin_src emacs-lisp
19769 (setq org-agenda-dim-blocked-tasks nil)
19772 - Stop preparing agenda buffers on startup:
19773 #+vindex: org-startup-folded
19774 #+vindex: org-agenda-inhibit-startup
19776 #+begin_src emacs-lisp
19777 (setq org-agenda-inhibit-startup nil)
19780 - Disable tag inheritance for agendas:
19781 #+vindex: org-agenda-show-inherited-tags
19782 #+vindex: org-agenda-use-tag-inheritance
19784 #+begin_src emacs-lisp
19785 (setq org-agenda-use-tag-inheritance nil)
19788 These options can be applied to selected agenda views. For more
19789 details about generation of agenda views, see the docstrings for the
19790 relevant variables, and this [[https://orgmode.org/worg/agenda-optimization.html][dedicated Worg page]] for agenda
19793 ** Extracting Agenda Information
19795 :DESCRIPTION: Post-processing agenda information.
19797 #+cindex: agenda, pipe
19798 #+cindex: scripts, for agenda processing
19800 Org provides commands to access agendas through Emacs batch mode.
19801 Through this command-line interface, agendas are automated for further
19802 processing or printing.
19804 #+vindex: org-agenda-custom-commands
19805 #+findex: org-batch-agenda
19806 ~org-batch-agenda~ creates an agenda view in ASCII and outputs to
19807 standard output. This command takes one string parameter. When
19808 string consists of a single character, Org uses it as a key to
19809 ~org-agenda-custom-commands~. These are the same ones available
19810 through the agenda dispatcher (see [[*The Agenda Dispatcher]]).
19812 This example command line directly prints the TODO list to the printer:
19814 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
19816 When the string parameter length is two or more characters, Org
19817 matches it with tags/TODO strings. For example, this example command
19818 line prints items tagged with =shop=, but excludes items tagged with
19822 emacs -batch -l ~/.emacs \
19823 -eval '(org-batch-agenda "+shop-NewYork")' | lpr
19826 #+texinfo: @noindent
19827 An example showing on-the-fly parameter modifications:
19830 emacs -batch -l ~/.emacs \
19831 -eval '(org-batch-agenda "a" \
19832 org-agenda-span (quote month) \
19833 org-agenda-include-diary nil \
19834 org-agenda-files (quote ("~/org/project.org")))' \
19838 #+texinfo: @noindent
19839 which produces an agenda for the next 30 days from just the
19840 =~/org/projects.org= file.
19842 #+findex: org-batch-agenda-csv
19843 For structured processing of agenda output, use ~org-batch-agenda-csv~
19844 with the following fields:
19846 - category :: The category of the item
19847 - head :: The headline, without TODO keyword, TAGS and PRIORITY
19848 - type :: The type of the agenda entry, can be
19850 | ~todo~ | selected in TODO match |
19851 | ~tagsmatch~ | selected in tags match |
19852 | ~diary~ | imported from diary |
19853 | ~deadline~ | a deadline |
19854 | ~scheduled~ | scheduled |
19855 | ~timestamp~ | appointment, selected by timestamp |
19856 | ~closed~ | entry was closed on date |
19857 | ~upcoming-deadline~ | warning about nearing deadline |
19858 | ~past-scheduled~ | forwarded scheduled item |
19859 | ~block~ | entry has date block including date |
19861 - todo :: The TODO keyword, if any
19862 - tags :: All tags including inherited ones, separated by colons
19863 - date :: The relevant date, like =2007-2-14=
19864 - time :: The time, like =15:00-16:50=
19865 - extra :: String with extra planning info
19866 - priority-l :: The priority letter if any was given
19867 - priority-n :: The computed numerical priority
19869 #+texinfo: @noindent
19870 If the selection of the agenda item was based on a timestamp,
19871 including those items with =DEADLINE= and =SCHEDULED= keywords, then
19872 Org includes date and time in the output.
19874 If the selection of the agenda item was based on a timestamp (or
19875 deadline/scheduled), then Org includes date and time in the output.
19877 Here is an example of a post-processing script in Perl. It takes the
19878 CSV output from Emacs and prints with a checkbox:
19883 # define the Emacs command to run
19884 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
19886 # run it and capture the output
19887 $agenda = qx{$cmd 2>/dev/null};
19889 # loop over all lines
19890 foreach $line (split(/\n/,$agenda)) {
19891 # get the individual values
19892 ($category,$head,$type,$todo,$tags,$date,$time,$extra,
19893 $priority_l,$priority_n) = split(/,/,$line);
19894 # process and print
19895 print "[ ] $head\n";
19899 ** Using the Property API
19901 :DESCRIPTION: Writing programs that use entry properties.
19903 #+cindex: API, for properties
19904 #+cindex: properties, API
19906 Here is a description of the functions that can be used to work with
19909 #+attr_texinfo: :options org-entry-properties &optional pom which
19911 Get all properties of the entry at point-or-marker {{{var(POM)}}}.
19912 This includes the TODO keyword, the tags, time strings for deadline,
19913 scheduled, and clocking, and any additional properties defined in the
19914 entry. The return value is an alist. Keys may occur multiple times
19915 if the property key was used several times. {{{var(POM)}}} may also
19916 be ~nil~, in which case the current entry is used. If
19917 {{{var(WHICH)}}} is ~nil~ or ~all~, get all properties. If
19918 {{{var(WHICH)}}} is ~special~ or ~standard~, only get that subclass.
19921 #+vindex: org-use-property-inheritance
19922 #+findex: org-insert-property-drawer
19923 #+attr_texinfo: :options org-entry-get pom property &optional inherit
19925 Get value of {{{var(PROPERTY)}}} for entry at point-or-marker
19926 {{{var(POM)}}}. By default, this only looks at properties defined
19927 locally in the entry. If {{{var(INHERIT)}}} is non-~nil~ and the
19928 entry does not have the property, then also check higher levels of the
19929 hierarchy. If {{{var(INHERIT)}}} is the symbol ~selective~, use
19930 inheritance if and only if the setting of
19931 ~org-use-property-inheritance~ selects {{{var(PROPERTY)}}} for
19935 #+attr_texinfo: :options org-entry-delete pom property
19937 Delete the property {{{var(PROPERTY)}}} from entry at point-or-marker
19941 #+attr_texinfo: :options org-entry-put pom property value
19943 Set {{{var(PROPERTY)}}} to {{{var(VALUES)}}} for entry at
19944 point-or-marker POM.
19947 #+attr_texinfo: :options org-buffer-property-keys &optional include-specials
19949 Get all property keys in the current buffer.
19952 #+attr_texinfo: :options org-insert-property-drawer
19954 Insert a property drawer for the current entry. Also
19957 #+attr_texinfo: :options org-entry-put-multivalued-property pom property &rest values
19959 Set {{{var(PROPERTY)}}} at point-or-marker {{{var(POM)}}} to
19960 {{{var(VALUES)}}}. {{{var(VALUES)}}} should be a list of strings.
19961 They are concatenated, with spaces as separators.
19964 #+attr_texinfo: :options org-entry-get-multivalued-property pom property
19966 Treat the value of the property {{{var(PROPERTY)}}} as
19967 a whitespace-separated list of values and return the values as a list
19971 #+attr_texinfo: :options org-entry-add-to-multivalued-property pom property value
19973 Treat the value of the property {{{var(PROPERTY)}}} as
19974 a whitespace-separated list of values and make sure that
19975 {{{var(VALUE)}}} is in this list.
19978 #+attr_texinfo: :options org-entry-remove-from-multivalued-property pom property value
19980 Treat the value of the property {{{var(PROPERTY)}}} as
19981 a whitespace-separated list of values and make sure that
19982 {{{var(VALUE)}}} is /not/ in this list.
19985 #+attr_texinfo: :options org-entry-member-in-multivalued-property pom property value
19987 Treat the value of the property {{{var(PROPERTY)}}} as
19988 a whitespace-separated list of values and check if {{{var(VALUE)}}} is
19992 #+attr_texinfo: :options org-property-allowed-value-functions
19994 Hook for functions supplying allowed values for a specific property.
19995 The functions must take a single argument, the name of the property,
19996 and return a flat list of allowed values. If =:ETC= is one of the
19997 values, use the values as completion help, but allow also other values
19998 to be entered. The functions must return ~nil~ if they are not
19999 responsible for this property.
20002 ** Using the Mapping API
20004 :DESCRIPTION: Mapping over all or selected entries.
20006 #+cindex: API, for mapping
20007 #+cindex: mapping entries, API
20009 Org has sophisticated mapping capabilities to find all entries
20010 satisfying certain criteria. Internally, this functionality is used
20011 to produce agenda views, but there is also an API that can be used to
20012 execute arbitrary functions for each or selected entries. The main
20013 entry point for this API is:
20015 #+attr_texinfo: :options org-map-entries func &optional match scope &rest skip
20017 Call {{{(var(FUNC))}}} at each headline selected by {{{var(MATCH)}}}
20018 in {{{var(SCOPE)}}}.
20020 {{{var(FUNC)}}} is a function or a Lisp form. With the cursor
20021 positioned at the beginning of the headline, call the function without
20022 arguments. Org returns an alist of return values of calls to the
20025 To avoid preserving point, Org wraps the call to {{{var(FUNC)}}} in
20026 save-excursion form. After evaluation, Org moves the cursor to the
20027 end of the line that was just processed. Search continues from that
20028 point forward. This may not always work as expected under some
20029 conditions, such as if the current sub-tree was removed by a previous
20030 archiving operation. In such rare circumstances, Org skips the next
20031 entry entirely when it should not. To stop Org from such skips, make
20032 {{{var(FUNC)}}} set the variable ~org-map-continue-from~ to a specific
20035 {{{var(MATCH)}}} is a tags/property/TODO match. Org iterates only
20036 matched headlines. Org iterates over all headlines when
20037 {{{var(MATCH)}}} is ~nil~ or ~t~.
20039 {{{var(SCOPE)}}} determines the scope of this command. It can be any
20044 The current buffer, respecting the restriction, if any.
20048 The subtree started with the entry at point.
20052 The entries within the active region, if any.
20056 The current buffer, without restriction.
20058 - ~file-with-archives~ ::
20060 The current buffer, and any archives associated with it.
20066 - ~agenda-with-archives~ ::
20068 All agenda files with any archive files associated with them.
20070 - ~(file1 file2 ...)~ ::
20072 If this is a list, all files in the list are scanned.
20074 #+texinfo: @noindent
20075 The remaining arguments are treated as settings for the scanner's
20076 skipping facilities. Valid arguments are:
20080 Skip trees with the archive tag.
20084 Skip trees with the COMMENT keyword.
20086 - function or Lisp form ::
20088 #+vindex: org-agenda-skip-function
20089 Used as value for ~org-agenda-skip-function~, so whenever the
20090 function returns ~t~, {{{var(FUNC)}}} is called for that entry
20091 and search continues from the point where the function leaves it.
20094 The mapping routine can call any arbitrary function, even functions
20095 that change meta data or query the property API (see [[*Using the
20096 Property API]]). Here are some handy functions:
20098 #+attr_texinfo: :options org-todo &optional arg
20100 Change the TODO state of the entry. See the docstring of the
20101 functions for the many possible values for the argument
20105 #+attr_texinfo: :options org-priority &optional action
20107 Change the priority of the entry. See the docstring of this function
20108 for the possible values for {{{var(ACTION)}}}.
20111 #+attr_texinfo: :options org-toggle-tag tag &optional onoff
20113 Toggle the tag {{{var(TAG)}}} in the current entry. Setting
20114 {{{var(ONOFF)}}} to either ~on~ or ~off~ does not toggle tag, but
20115 ensure that it is either on or off.
20118 #+attr_texinfo: :options org-promote
20120 Promote the current entry.
20123 #+attr_texinfo: :options org-demote
20125 Demote the current entry.
20128 This example turns all entries tagged with =TOMORROW= into TODO
20129 entries with keyword =UPCOMING=. Org ignores entries in comment trees
20132 #+begin_src emacs-lisp
20133 (org-map-entries '(org-todo "UPCOMING")
20134 "+TOMORROW" 'file 'archive 'comment)
20137 The following example counts the number of entries with TODO keyword
20138 =WAITING=, in all agenda files.
20140 #+begin_src emacs-lisp
20141 (length (org-map-entries t "/+WAITING" 'agenda))
20146 :DESCRIPTION: Viewing and capture on a mobile device.
20147 :APPENDIX: Appendix
20150 #+cindex: smartphone
20152 #+cindex: MobileOrg
20154 MobileOrg is a companion mobile app that runs on iOS and Android
20155 devices. MobileOrg enables offline-views and capture support for an
20156 Org mode system that is rooted on a "real" computer. MobileOrg can
20157 record changes to existing entries.
20159 The [[https://github.com/MobileOrg/][iOS implementation]] for the /iPhone/iPod Touch/iPad/ series of
20160 devices, was started by Richard Moreland and is now in the hands of
20161 Sean Escriva. Android users should check out [[http://wiki.github.com/matburt/mobileorg-android/][MobileOrg Android]] by
20162 Matt Jones. Though the two implementations are not identical, they
20163 offer similar features.
20165 This appendix describes Org's support for agenda view formats
20166 compatible with MobileOrg. It also describes synchronizing changes,
20167 such as to notes, between MobileOrg and the computer.
20169 To change tags and TODO states in MobileOrg, first customize the
20170 variables ~org-todo-keywords~ and ~org-tag-alist~. These should cover
20171 all the important tags and TODO keywords, even if Org files use only
20172 some of them. Though MobileOrg has in-buffer settings, it understands
20173 TODO states /sets/ (see [[*Setting up keywords for individual files]]) and
20174 /mutually exclusive/ tags (see [[*Setting Tags]]) only for those set in
20177 ** Setting Up the Staging Area
20179 :DESCRIPTION: For the mobile device.
20182 MobileOrg needs access to a file directory on a server to interact
20183 with Emacs. With a public server, consider encrypting the files.
20184 MobileOrg version 1.5 supports encryption for the iPhone. Org also
20185 requires =openssl= installed on the local computer. To turn on
20186 encryption, set the same password in MobileOrg and in Emacs. Set the
20187 password in the variable ~org-mobile-use-encryption~[fn:142]. Note
20188 that even after MobileOrg encrypts the file contents, the file name
20189 remains visible on the file systems of the local computer, the server,
20190 and the mobile device.
20192 For a server to host files, consider options like [[http://dropbox.com][Dropbox.com]]
20193 account[fn:143]. On first connection, MobileOrg creates a directory
20194 =MobileOrg= on Dropbox. Pass its location to Emacs through an
20195 initialisation file variable as follows:
20197 #+begin_src emacs-lisp
20198 (setq org-mobile-directory "~/Dropbox/MobileOrg")
20201 Org copies files to the above directory for MobileOrg. Org also uses
20202 the same directory for sharing notes between Org and MobileOrg.
20204 ** Pushing to MobileOrg
20206 :DESCRIPTION: Uploading Org files and agendas.
20209 #+vindex: org-mobile-files
20210 #+vindex: org-directory
20211 Org pushes files listed in ~org-mobile-files~ to
20212 ~org-mobile-directory~. Files include agenda files (as listed in
20213 ~org-agenda-files~). Customize ~org-mobile-files~ to add other files.
20214 File names are staged with paths relative to ~org-directory~, so all
20215 files should be inside this directory[fn:144].
20217 Push creates a special Org file =agendas.org= with custom agenda views
20218 defined by the user[fn:145].
20220 Finally, Org writes the file =index.org=, containing links to other
20221 files. MobileOrg reads this file first from the server to determine
20222 what other files to download for agendas. For faster downloads,
20223 MobileOrg only reads files whose checksums[fn:146] have changed.
20225 ** Pulling from MobileOrg
20227 :DESCRIPTION: Integrating captured and flagged items.
20230 When MobileOrg synchronizes with the server, it pulls the Org files
20231 for viewing. It then appends to the file =mobileorg.org= on the
20232 server the captured entries, pointers to flagged and changed entries.
20233 Org integrates its data in an inbox file format.
20236 #+vindex: org-mobile-inbox-for-pull
20237 Org moves all entries found in =mobileorg.org=[fn:147] and appends
20238 them to the file pointed to by the variable
20239 ~org-mobile-inbox-for-pull~. Each captured entry and each editing
20240 event is a top-level entry in the inbox file.
20242 2. After moving the entries, Org attempts changes to MobileOrg. Some
20243 changes are applied directly and without user interaction.
20244 Examples include changes to tags, TODO state, headline and body
20245 text. Entries for further action are tagged as =FLAGGED=. Org
20246 marks entries with problems with an error message in the inbox.
20247 They have to be resolved manually.
20249 3. Org generates an agenda view for flagged entries for user
20250 intervention to clean up. For notes stored in flagged entries,
20251 MobileOrg displays them in the echo area when the cursor is on the
20252 corresponding agenda item.
20257 Pressing {{{kbd(?)}}} displays the entire flagged note in
20258 another window. Org also pushes it to the kill ring. To
20259 store flagged note as a normal note, use {{{kbd(? z C-y C-c
20260 C-c)}}}. Pressing{{{kbd(?)}}} twice does these things: first
20261 it removes the =FLAGGED= tag; second, it removes the flagged
20262 note from the property drawer; third, it signals that manual
20263 editing of the flagged entry is now finished.
20265 #+kindex: ? @r{(Agenda dispatcher)}
20266 From the agenda dispatcher, {{{kbd(?)}}} returns to the view to finish
20267 processing flagged entries. Note that these entries may not be the
20268 most recent since MobileOrg searches files that were last pulled. To
20269 get an updated agenda view with changes since the last pull, pull
20272 * History and Acknowledgments
20274 :DESCRIPTION: How Org came into being.
20283 Org was born in 2003, out of frustration over the user interface of
20284 the Emacs Outline mode. I was trying to organize my notes and
20285 projects, and using Emacs seemed to be the natural way to go.
20286 However, having to remember eleven different commands with two or
20287 three keys per command, only to hide and show parts of the outline
20288 tree, that seemed entirely unacceptable to me. Also, when using
20289 outlines to take notes, I constantly wanted to restructure the tree,
20290 organizing it parallel to my thoughts and plans. /Visibility cycling/
20291 and /structure editing/ were originally implemented in the package
20292 =outline-magic.el=, but quickly moved to the more general =org.el=.
20293 As this environment became comfortable for project planning, the next
20294 step was adding /TODO entries/, basic /timestamps/, and /table
20295 support/. These areas highlighted the two main goals that Org still
20296 has today: to be a new, outline-based, plain text mode with innovative
20297 and intuitive editing features, and to incorporate project planning
20298 functionality directly into a notes file.
20300 Since the first release, literally thousands of emails to me or to the
20301 [[mailto:emacs-orgmode@gnu.org][mailing list]] have provided a constant stream of bug reports, feedback,
20302 new ideas, and sometimes patches and add-on code. Many thanks to
20303 everyone who has helped to improve this package. I am trying to keep
20304 here a list of the people who had significant influence in shaping one
20305 or more aspects of Org. The list may not be complete, if I have
20306 forgotten someone, please accept my apologies and let me know.
20308 Before I get to this list, a few special mentions are in order:
20310 - Bastien Guerry ::
20312 Bastien has written a large number of extensions to Org (most of
20313 them integrated into the core by now), including the LaTeX
20314 exporter and the plain list parser. His support during the early
20315 days was central to the success of this project. Bastien also
20316 invented Worg, helped establishing the Web presence of Org, and
20317 sponsored hosting costs for the orgmode.org website. Bastien
20318 stepped in as maintainer of Org between 2011 and 2013, at a time
20319 when I desperately needed a break.
20321 - Eric Schulte and Dan Davison ::
20323 Eric and Dan are jointly responsible for the Org Babel system,
20324 which turns Org into a multi-language environment for evaluating
20325 code and doing literate programming and reproducible research.
20326 This has become one of Org's killer features that define what Org
20331 John has contributed a number of great ideas and patches directly
20332 to Org, including the attachment system (=org-attach.el=),
20333 integration with Apple Mail (=org-mac-message.el=), hierarchical
20334 dependencies of TODO items, habit tracking (=org-habits.el=), and
20335 encryption (=org-crypt.el=). Also, the capture system is really
20336 an extended copy of his great =remember.el=.
20338 - Sebastian Rose ::
20340 Without Sebastian, the HTML/XHTML publishing of Org would be the
20341 pitiful work of an ignorant amateur. Sebastian has pushed this
20342 part of Org onto a much higher level. He also wrote
20343 =org-info.js=, a Java script for displaying webpages derived from
20344 Org using an Info-like or a folding interface with single-key
20347 #+texinfo: @noindent
20348 See below for the full list of contributions! Again, please let me
20349 know what I am missing here!
20356 I (Bastien) have been maintaining Org between 2011 and 2013. This
20357 appendix would not be complete without adding a few more
20358 acknowledgments and thanks.
20360 I am first grateful to Carsten for his trust while handing me over the
20361 maintainership of Org. His unremitting support is what really helped
20362 me getting more confident over time, with both the community and the
20365 When I took over maintainership, I knew I would have to make Org more
20366 collaborative than ever, as I would have to rely on people that are
20367 more knowledgeable than I am on many parts of the code. Here is
20368 a list of the persons I could rely on, they should really be
20369 considered co-maintainers, either of the code or the community:
20373 Eric is maintaining the Babel parts of Org. His reactivity here
20374 kept me away from worrying about possible bugs here and let me
20375 focus on other parts.
20377 - Nicolas Goaziou ::
20379 Nicolas is maintaining the consistency of the deepest parts of
20380 Org. His work on =org-element.el= and =ox.el= has been
20381 outstanding, and it opened the doors for many new ideas and
20382 features. He rewrote many of the old exporters to use the new
20383 export engine, and helped with documenting this major change.
20384 More importantly (if that's possible), he has been more than
20385 reliable during all the work done for Org 8.0, and always very
20386 reactive on the mailing list.
20390 Achim rewrote the building process of Org, turning some /ad hoc/
20391 tools into a flexible and conceptually clean process. He
20392 patiently coped with the many hiccups that such a change can
20397 The Org mode mailing list would not be such a nice place without
20398 Nick, who patiently helped users so many times. It is impossible
20399 to overestimate such a great help, and the list would not be so
20400 active without him.
20402 I received support from so many users that it is clearly impossible to
20403 be fair when shortlisting a few of them, but Org's history would not
20404 be complete if the ones above were not mentioned in this manual.
20406 ** List of Contributions
20411 - Russel Adams came up with the idea for drawers.
20413 - Thomas Baumann wrote =org-bbdb.el= and =org-mhe.el=.
20415 - Christophe Bataillon created the great unicorn logo that we use on
20416 the Org mode website.
20418 - Alex Bochannek provided a patch for rounding timestamps.
20420 - Jan Böcker wrote =org-docview.el=.
20422 - Brad Bozarth showed how to pull RSS feed data into Org files.
20424 - Tom Breton wrote =org-choose.el=.
20426 - Charles Cave's suggestion sparked the implementation of templates
20427 for Remember, which are now templates for capture.
20429 - Pavel Chalmoviansky influenced the agenda treatment of items with
20432 - Gregory Chernov patched support for Lisp forms into table
20433 calculations and improved XEmacs compatibility, in particular by
20434 porting =nouline.el= to XEmacs.
20436 - Sacha Chua suggested copying some linking code from Planner.
20438 - Baoqiu Cui contributed the DocBook exporter.
20440 - Eddward DeVilla proposed and tested checkbox statistics. He also
20441 came up with the idea of properties, and that there should be an API
20444 - Nick Dokos tracked down several nasty bugs.
20446 - Kees Dullemond used to edit projects lists directly in HTML and so
20447 inspired some of the early development, including HTML export. He
20448 also asked for a way to narrow wide table columns.
20450 - Thomas S. Dye contributed documentation on Worg and helped
20451 integrating the Org Babel documentation into the manual.
20453 - Christian Egli converted the documentation into Texinfo format,
20454 inspired the agenda, patched CSS formatting into the HTML exporter,
20455 and wrote =org-taskjuggler.el=.
20457 - David Emery provided a patch for custom CSS support in exported HTML
20460 - Nic Ferrier contributed mailcap and XOXO support.
20462 - Miguel A. Figueroa-Villanueva implemented hierarchical checkboxes.
20464 - John Foerch figured out how to make incremental search show context
20465 around a match in a hidden outline tree.
20467 - Raimar Finken wrote =org-git-line.el=.
20469 - Mikael Fornius works as a mailing list moderator.
20471 - Austin Frank works as a mailing list moderator.
20473 - Eric Fraga drove the development of Beamer export with ideas and
20476 - Barry Gidden did proofreading the manual in preparation for the book
20477 publication through Network Theory Ltd.
20479 - Niels Giesen had the idea to automatically archive DONE trees.
20481 - Nicolas Goaziou rewrote much of the plain list code.
20483 - Kai Grossjohann pointed out key-binding conflicts with other
20486 - Brian Gough of Network Theory Ltd publishes the Org mode manual as
20489 - Bernt Hansen has driven much of the support for auto-repeating
20490 tasks, task state change logging, and the clocktable. His clear
20491 explanations have been critical when we started to adopt the Git
20492 version control system.
20494 - Manuel Hermenegildo has contributed various ideas, small fixes and
20497 - Phil Jackson wrote =org-irc.el=.
20499 - Scott Jaderholm proposed footnotes, control over whitespace between
20500 folded entries, and column view for properties.
20502 - Matt Jones wrote MobileOrg Android.
20504 - Tokuya Kameshima wrote =org-wl.el= and =org-mew.el=.
20506 - Shidai Liu ("Leo") asked for embedded LaTeX and tested it. He also
20507 provided frequent feedback and some patches.
20509 - Matt Lundin has proposed last-row references for table formulas and
20510 named invisible anchors. He has also worked a lot on the FAQ.
20512 - David Maus wrote =org-atom.el=, maintains the issues file for Org,
20513 and is a prolific contributor on the mailing list with competent
20514 replies, small fixes and patches.
20516 - Jason F. McBrayer suggested agenda export to CSV format.
20518 - Max Mikhanosha came up with the idea of refiling.
20520 - Dmitri Minaev sent a patch to set priority limits on a per-file
20523 - Stefan Monnier provided a patch to keep the Emacs Lisp compiler
20526 - Richard Moreland wrote MobileOrg for the iPhone.
20528 - Rick Moynihan proposed allowing multiple TODO sequences in a file
20529 and being able to quickly restrict the agenda to a subtree.
20531 - Todd Neal provided patches for links to Info files and Elisp forms.
20533 - Greg Newman refreshed the unicorn logo into its current form.
20535 - Tim O'Callaghan suggested in-file links, search options for general
20536 file links, and tags.
20538 - Osamu Okano wrote =orgcard2ref.pl=, a Perl program to create a text
20539 version of the reference card.
20541 - Takeshi Okano translated the manual and David O'Toole's tutorial
20544 - Oliver Oppitz suggested multi-state TODO items.
20546 - Scott Otterson sparked the introduction of descriptive text for
20547 links, among other things.
20549 - Pete Phillips helped during the development of the TAGS feature,
20550 and provided frequent feedback.
20552 - Martin Pohlack provided the code snippet to bundle character
20553 insertion into bundles of 20 for undo.
20555 - T.V. Raman reported bugs and suggested improvements.
20557 - Matthias Rempe (Oelde) provided ideas, Windows support, and quality
20560 - Paul Rivier provided the basic implementation of named footnotes.
20561 He also acted as mailing list moderator for some time.
20563 - Kevin Rogers contributed code to access VM files on remote hosts.
20565 - Frank Ruell solved the mystery of the =keymapp nil= bug, a conflict
20568 - Jason Riedy generalized the send-receive mechanism for Orgtbl
20569 tables with extensive patches.
20571 - Philip Rooke created the Org reference card, provided lots of
20572 feedback, developed and applied standards to the Org documentation.
20574 - Christian Schlauer proposed angular brackets around links, among
20577 - Paul Sexton wrote =org-ctags.el=.
20579 - Tom Shannon's =organizer-mode.el= inspired linking to VM/BBDB/Gnus.
20581 - Ilya Shlyakhter proposed the Archive Sibling, line numbering in
20582 literal examples, and remote highlighting for referenced code lines.
20584 - Stathis Sideris wrote the =ditaa.jar= ASCII to PNG converter that is
20585 now packaged into Org's =contrib/= directory.
20587 - Daniel Sinder came up with the idea of internal archiving by locking
20590 - Dale Smith proposed link abbreviations.
20592 - James TD Smith has contributed a large number of patches for
20593 useful tweaks and features.
20595 - Adam Spiers asked for global linking commands, inspired the link
20596 extension system, added support for Mairix, and proposed the mapping
20599 - Ulf Stegemann created the table to translate special symbols to
20600 HTML, LaTeX, UTF-8, Latin-1 and ASCII.
20602 - Andy Stewart contributed code to =org-w3m.el=, to copy
20603 HTML content with links transformation to Org syntax.
20605 - David O'Toole wrote =org-publish.el= and drafted the
20606 manual chapter about publishing.
20608 - Jambunathan K. contributed the ODT exporter.
20610 - Sebastien Vauban reported many issues with LaTeX and Beamer export
20611 and enabled source code highlighting in Gnus.
20613 - Stefan Vollmar organized a video-recorded talk at the
20614 Max-Planck-Institute for Neurology. He also inspired the creation
20615 of a concept index for HTML export.
20617 - Jürgen Vollmer contributed code generating the table of contents in
20620 - Samuel Wales has provided important feedback and bug reports.
20622 - Chris Wallace provided a patch implementing the =QUOTE= block.
20624 - David Wainberg suggested archiving, and improvements to the
20627 - Carsten Wimmer suggested some changes and helped fix a bug in
20630 - Roland Winkler requested additional key bindings to make Org work on
20633 - Piotr Zielinski wrote =org-mouse.el=, proposed agenda
20634 blocks and contributed various ideas and code snippets.
20636 * GNU Free Documentation License
20639 :DESCRIPTION: The license for this documentation.
20642 #+texinfo: @include ../doc/doclicense.texi
20647 :DESCRIPTION: An index of Org's concepts and features.
20652 :DESCRIPTION: Key bindings and where they are described.
20656 * Command and Function Index
20658 :DESCRIPTION: Command names and some internal functions.
20664 :DESCRIPTION: Variables mentioned in the manual.
20668 This is not a complete index of variables and faces, only the ones
20669 that are mentioned in the manual. For a more complete list, use
20670 {{{kbd(M-x org-customize)}}} and then click yourself through the tree.
20677 This manual is for Org version {{{version}}}.
20679 Copyright \copy 2004--2018 Free Software Foundation, Inc.
20682 Permission is granted to copy, distribute and/or modify this document
20683 under the terms of the GNU Free Documentation License, Version 1.3 or
20684 any later version published by the Free Software Foundation; with no
20685 Invariant Sections, with the Front-Cover texts being "A GNU Manual",
20686 and with the Back-Cover Texts as in (a) below. A copy of the license
20687 is included in the section entitled "GNU Free Documentation License".
20689 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
20690 modify this GNU manual."
20693 * Export Setup :noexport:
20695 #+subtitle: Release {{{version}}}
20696 #+author: by Carsten Dominik
20697 #+subauthor: with contributions by Bastien Guerry, Nicolas Goaziou, Eric Schulte, Jambunathan K, Dan Davison, Thomas Dye, David O'Toole, and Philip Rooke.
20698 #+date: {{{modification-time}}}
20699 #+email: tsd@tsdye.com
20702 # XXX: We cannot use TODO keyword as a node starts with "TODO".
20703 #+todo: REVIEW FIXME | DONE
20704 #+property: header-args :eval no
20705 #+startup: overview nologdone
20707 #+export_file_name: org.texi
20709 #+texinfo_dir_category: Emacs editing modes
20710 #+texinfo_dir_title: Org Mode: (org)
20711 #+texinfo_dir_desc: Outline-based notes management and organizer
20713 # Use proper quote and backtick for code sections in PDF output
20714 # Cf. Texinfo manual 14.2
20715 #+texinfo_header: @set txicodequoteundirected
20716 #+texinfo_header: @set txicodequotebacktick
20719 #+texinfo_header: @set MAINTAINERSITE @uref{https://orgmode.org,maintainers webpage}
20720 #+texinfo_header: @set MAINTAINER Carsten Dominik
20721 #+texinfo_header: @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
20722 #+texinfo_header: @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
20724 #+options: H:4 num:t toc:t author:t \n:nil ::t |:t ^:nil -:t f:t *:t <:t e:t ':t
20725 #+options: d:nil todo:nil pri:nil tags:not-in-toc stat:nil broken-links:mark
20726 #+select_tags: export
20727 #+exclude_tags: noexport
20729 #+macro: cite @@texinfo:@cite{@@$1@@texinfo:}@@
20730 #+macro: var @@texinfo:@var{@@$1@@texinfo:}@@
20732 # The "version" macro returns major.minor version number. This is
20733 # sufficient since bugfix releases are not expected to add features
20734 # and therefore imply manual modifications.
20735 #+macro: version (eval (mapconcat #'identity (cl-subseq (split-string (org-version) "\\.") 0 -1) "."))
20737 # The "kbd" macro turns KBD into @kbd{KBD}. Additionnally, it
20738 # encloses case-sensitive special keys (SPC, RET...) within @key{...}.
20739 #+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))))
20743 [fn:1] If you do not use Font Lock globally turn it on in Org buffer
20744 with ~(add-hook 'org-mode-hook 'turn-on-font-lock)~.
20746 [fn:2] Please consider subscribing to the mailing list in order to
20747 minimize the work the mailing list moderators have to do.
20749 [fn:3] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
20750 and ~org-ctrl-k-protect-subtree~ to configure special behavior of
20751 {{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines. Note
20752 also that clocking only works with headings indented less than 30
20755 [fn:4] See, however, the option ~org-cycle-emulate-tab~.
20757 [fn:5] The indirect buffer contains the entire buffer, but is narrowed
20758 to the current tree. Editing the indirect buffer also changes the
20759 original buffer, but without affecting visibility in that buffer. For
20760 more information about indirect buffers, see [[info:emacs:Indirect%20Buffers][GNU Emacs Manual]].
20762 [fn:6] When ~org-agenda-inhibit-startup~ is non-~nil~, Org does not
20763 honor the default visibility state when first opening a file for the
20764 agenda (see [[*Speeding Up Your Agendas]]).
20766 [fn:7] See also the variable ~org-show-context-detail~ to decide how
20767 much context is shown around each match.
20769 [fn:8] This depends on the option ~org-remove-highlights-with-change~.
20771 [fn:9] When using =*= as a bullet, lines must be indented so that they
20772 are not interpreted as headlines. Also, when you are hiding leading
20773 stars to get a clean outline view, plain list items starting with
20774 a star may be hard to distinguish from true headlines. In short: even
20775 though =*= is supported, it may be better to not use it for plain list
20778 [fn:10] You can filter out any of them by configuring
20779 ~org-plain-list-ordered-item-terminator~.
20781 [fn:11] You can also get =a.=, =A.=, =a)= and =A)= by configuring
20782 ~org-list-allow-alphabetical~. To minimize confusion with normal
20783 text, those are limited to one character only. Beyond that limit,
20784 bullets automatically become numbers.
20786 [fn:12] If there's a checkbox in the item, the cookie must be put
20787 /before/ the checkbox. If you have activated alphabetical lists, you
20788 can also use counters like =[@b]=.
20790 [fn:13] If you do not want the item to be split, customize the
20791 variable ~org-M-RET-may-split-line~.
20793 [fn:14] If you want to cycle around items that way, you may customize
20794 ~org-list-use-circular-motion~.
20796 [fn:15] See ~org-list-use-circular-motion~ for a cyclic behavior.
20798 [fn:16] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows.
20799 Use {{{kbd(C-M-i)}}} or {{{kbd(ESC TAB)}}} instead.
20801 [fn:17] The corresponding in-buffer setting is: =#+STARTUP: fninline=
20802 or =#+STARTUP: nofninline=.
20804 [fn:18] The corresponding in-buffer options are =#+STARTUP: fnadjust=
20805 and =#+STARTUP: nofnadjust=.
20807 [fn:19] To insert a vertical bar into a table field, use =\vert= or,
20808 inside a word =abc\vert{}def=.
20810 [fn:20] Org understands references typed by the user as =B4=, but it
20811 does not use this syntax when offering a formula for editing. You can
20812 customize this behavior using the variable
20813 ~org-table-use-standard-references~.
20815 [fn:21] The computation time scales as O(N^2) because table
20816 {{{var(FOO)}}} is parsed for each field to be copied.
20818 [fn:22] The file =constants.el= can supply the values of constants in
20819 two different unit systems, =SI= and =cgs=. Which one is used depends
20820 on the value of the variable ~constants-unit-system~. You can use the
20821 =STARTUP= options =constSI= and =constcgs= to set this value for the
20824 [fn:23] The printf reformatting is limited in precision because the
20825 value passed to it is converted into an "integer" or "double". The
20826 "integer" is limited in size by truncating the signed value to 32
20827 bits. The "double" is limited in precision to 64 bits overall which
20828 leaves approximately 16 significant decimal digits.
20830 [fn:24] Such names must start with an alphabetic character and use
20831 only alphanumeric/underscore characters.
20833 [fn:25] To insert a link targeting a headline, in-buffer completion
20834 can be used. Just type a star followed by a few optional letters into
20835 the buffer and press {{{kbd(M-TAB)}}}. All headlines in the current
20836 buffer are offered as completions.
20838 [fn:26] When targeting a =NAME= keyword, =CAPTION= keyword is
20839 mandatory in order to get proper numbering (see [[*Images and Tables]]).
20841 [fn:27] The actual behavior of the search depends on the value of the
20842 variable ~org-link-search-must-match-exact-headline~. If its value is
20843 ~nil~, then a fuzzy text search is done. If it is ~t~, then only the
20844 exact headline is matched, ignoring spaces and statistic cookies. If
20845 the value is ~query-to-create~, then an exact headline is searched; if
20846 it is not found, then the user is queried to create it.
20848 [fn:28] If the headline contains a timestamp, it is removed from the
20849 link, which results in a wrong link---you should avoid putting
20850 a timestamp in the headline.
20852 [fn:29] The Org Id library must first be loaded, either through
20853 ~org-customize~, by enabling ~id~ in ~org-modules~, or by adding
20854 ~(require 'org-id)~ in your Emacs init file.
20856 [fn:30] Note that you do not have to use this command to insert
20857 a link. Links in Org are plain text, and you can type or paste them
20858 straight into the buffer. By using this command, the links are
20859 automatically enclosed in double brackets, and you will be asked for
20860 the optional descriptive text.
20862 [fn:31] After insertion of a stored link, the link will be removed
20863 from the list of stored links. To keep it in the list later use, use
20864 a triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
20865 configure the option ~org-keep-stored-link-after-insertion~.
20867 [fn:32] This works if a function has been defined in the ~:complete~
20868 property of a link in ~org-link-parameters~.
20870 [fn:33] See the variable ~org-display-internal-link-with-indirect-buffer~.
20872 [fn:34] The variable ~org-startup-with-inline-images~ can be set
20873 within a buffer with the =STARTUP= options =inlineimages= and
20876 [fn:35] For backward compatibility, line numbers can also follow a
20879 [fn:36] Of course, you can make a document that contains only long
20880 lists of TODO items, but this is not required.
20882 [fn:37] Changing the variable ~org-todo-keywords~ only becomes
20883 effective after restarting Org mode in a buffer.
20885 [fn:38] This is also true for the {{{kbd(t)}}} command in the timeline
20886 and agenda buffers.
20888 [fn:39] All characters are allowed except =@=, =^= and =!=, which have
20889 a special meaning here.
20891 [fn:40] Check also the variable ~org-fast-tag-selection-include-todo~,
20892 it allows you to change the TODO state through the tags interface
20893 ([[*Setting Tags]]), in case you like to mingle the two concepts. Note
20894 that this means you need to come up with unique keys across both sets
20897 [fn:41] Org mode parses these lines only when Org mode is activated
20898 after visiting a file. {{{kbd(C-c C-c)}}} with the cursor in a line
20899 starting with =#+= is simply restarting Org mode for the current
20902 [fn:42] The corresponding in-buffer setting is: =#+STARTUP: logdone=.
20904 [fn:43] The corresponding in-buffer setting is: =#+STARTUP:
20907 [fn:44] See the variable ~org-log-states-order-reversed~.
20909 [fn:45] Note that the =LOGBOOK= drawer is unfolded when pressing
20910 {{{kbd(SPC)}}} in the agenda to show an entry---use {{{kbd(C-u
20911 SPC)}}} to keep it folded here.
20913 [fn:46] It is possible that Org mode records two timestamps when you
20914 are using both ~org-log-done~ and state change logging. However, it
20915 never prompts for two notes: if you have configured both, the state
20916 change recording note takes precedence and cancel the closing note.
20918 [fn:47] See also the option ~org-priority-start-cycle-with-default~.
20920 [fn:48] To keep subtasks out of the global TODO list, see the
20921 ~org-agenda-todo-list-sublevels~.
20923 [fn:49] With the exception of description lists. But you can allow it
20924 by modifying ~org-list-automatic-rules~ accordingly.
20926 [fn:50] Set the variable ~org-hierarchical-checkbox-statistics~ if you
20927 want such cookies to count all checkboxes below the cookie, not just
20928 those belonging to direct children.
20930 [fn:51] {{{kbd(C-u C-c C-c)}}} on the /first/ item of a list with no
20931 checkbox adds checkboxes to the rest of the list.
20933 [fn:52] As with all these in-buffer settings, pressing {{{kbd(C-c
20934 C-c)}}} activates any changes in the line.
20936 [fn:53] This is only true if the search does not involve more complex
20937 tests including properties (see [[*Property Searches]]).
20939 [fn:54] Keys are automatically assigned to tags that have no
20942 [fn:55] If more than one summary type applies to the same property,
20943 the parent values are computed according to the first of them.
20945 [fn:56] An age is defined as a duration, using effort modifiers
20946 defined in ~org-effort-durations~, e.g., =3d 1h=. If any value in the
20947 column is as such, the summary is also an effort duration.
20949 [fn:57] Please note that the =COLUMNS= definition must be on a single
20950 line; it is wrapped here only because of formatting constraints.
20952 [fn:58] Contributed packages are not part of Emacs, but are
20953 distributed with the main distribution of Org---visit
20954 [[https://orgmode.org]].
20956 [fn:59] The Org date format is inspired by the standard ISO 8601
20957 date/time format. To use an alternative format, see [[*Custom time
20958 format]]. The day name is optional when you type the date yourself.
20959 However, any date inserted or modified by Org adds that day name, for
20960 reading convenience.
20962 [fn:60] When working with the standard diary sexp functions, you need
20963 to be very careful with the order of the arguments. That order
20964 depends evilly on the variable ~calendar-date-style~. For example, to
20965 specify a date December 12, 2005, the call might look like
20966 =(diary-date 12 1 2005)= or =(diary-date 1 12 2005)= or =(diary-date
20967 2005 12 1)=, depending on the settings. This has been the source of
20968 much confusion. Org mode users can resort to special versions of
20969 these functions like ~org-date~ or ~org-anniversary~. These work just
20970 like the corresponding ~diary-~ functions, but with stable ISO order
20971 of arguments (year, month, day) wherever applicable, independent of
20972 the value of ~calendar-date-style~.
20974 [fn:61] See the variable ~org-read-date-prefer-future~. You may set
20975 that variable to the symbol ~time~ to even make a time before now
20976 shift the date to tomorrow.
20978 [fn:62] If you do not need/want the calendar, configure the variable
20979 ~org-popup-calendar-for-date-prompt~.
20981 [fn:63] If you find this distracting, turn off the display with
20982 ~org-read-date-display-live~.
20984 [fn:64] It will still be listed on that date after it has been marked
20985 DONE. If you do not like this, set the variable
20986 ~org-agenda-skip-scheduled-if-done~.
20988 [fn:65] The =SCHEDULED= and =DEADLINE= dates are inserted on the line
20989 right below the headline. Do not put any text between this line and
20992 [fn:66] Note the corresponding =STARTUP= options =logredeadline=,
20993 =lognoteredeadline=, and =nologredeadline=.
20995 [fn:67] Note the corresponding =STARTUP= options =logreschedule=,
20996 =lognotereschedule=, and =nologreschedule=.
20998 [fn:68] In fact, the target state is taken from, in this sequence, the
20999 =REPEAT_TO_STATE= property, the variable ~org-todo-repeat-to-state~ if
21000 it is a string, the previous TODO state if ~org-todo-repeat-to-state~
21001 is ~t~, or the first state of the TODO state sequence.
21003 [fn:69] You can change this using the option ~org-log-repeat~, or the
21004 =STARTUP= options =logrepeat=, =lognoterepeat=, and =nologrepeat=.
21005 With =lognoterepeat=, you will also be prompted for a note.
21007 [fn:70] Clocking only works if all headings are indented with less
21008 than 30 stars. This is a hard-coded limitation of ~lmax~ in
21011 [fn:71] To resume the clock under the assumption that you have worked
21012 on this task while outside Emacs, use ~(setq org-clock-persist t)~.
21014 [fn:72] To add an effort estimate "on the fly", hook a function doing
21015 this to ~org-clock-in-prepare-hook~.
21017 [fn:73] The last reset of the task is recorded by the =LAST_REPEAT=
21020 [fn:74] See also the variable ~org-clock-modeline-total~.
21022 [fn:75] The corresponding in-buffer setting is: =#+STARTUP:
21025 [fn:76] Language terms can be set through the variable
21026 ~org-clock-clocktable-language-setup~.
21028 [fn:77] Note that all parameters must be specified in a single
21029 line---the line is broken here only to fit it into the manual.
21031 [fn:78] On computers using macOS, idleness is based on actual user
21032 idleness, not just Emacs' idle time. For X11, you can install
21033 a utility program =x11idle.c=, available in the =contrib/scripts/=
21034 directory of the Org Git distribution, or install the xprintidle
21035 package and set it to the variable ~org-clock-x11idle-program-name~ if
21036 you are running Debian, to get the same general treatment of idleness.
21037 On other systems, idle time refers to Emacs idle time only.
21039 [fn:79] Please note the pitfalls of summing hierarchical data in
21040 a flat list ([[*Using Column View in the Agenda]]).
21042 [fn:80] Org used to offer four different targets for date/week tree
21043 capture. Now, Org automatically translates these to use
21044 ~file+olp+datetree~, applying the ~:time-prompt~ and ~:tree-type~
21045 properties. Please rewrite your date/week-tree targets using
21046 ~file+olp+datetree~ since the older targets are now deprecated.
21048 [fn:81] A date tree is an outline structure with years on the highest
21049 level, months or ISO weeks as sublevels and then dates on the lowest
21050 level. Tags are allowed in the tree structure.
21052 [fn:82] If you need one of these sequences literally, escape the =%=
21055 [fn:83] If you define your own link types (see [[*Adding Hyperlink
21056 Types]]), any property you store with ~org-store-link-props~ can be
21057 accessed in capture templates in a similar way.
21059 [fn:84] This is always the other, not the user. See the variable
21060 ~org-from-is-user-regexp~.
21062 [fn:85] If you move entries or Org files from one directory to
21063 another, you may want to configure ~org-attach-directory~ to contain
21066 [fn:86] Note the corresponding =STARTUP= options =logrefile=,
21067 =lognoterefile=, and =nologrefile=.
21069 [fn:87] If the value of that variable is not a list, but a single file
21070 name, then the list of agenda files in maintained in that external
21073 [fn:88] When using the dispatcher, pressing {{{kbd(<)}}} before
21074 selecting a command actually limits the command to the current file,
21075 and ignores ~org-agenda-files~ until the next dispatcher command.
21077 [fn:89] For backward compatibility, you can also press {{{kbd(1)}}} to
21078 restrict to the current buffer.
21080 [fn:90] For backward compatibility, you can also press {{{kbd(0)}}} to
21081 restrict to the current region/subtree.
21083 [fn:91] For backward compatibility, the universal prefix argument
21084 {{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
21085 This feature is deprecated, use the dedicated TODO list, or a block
21086 agenda instead (see [[*Block agenda]]).
21088 [fn:92] The variable ~org-anniversary~ used in the example is just
21089 like ~diary-anniversary~, but the argument order is always according
21090 to ISO and therefore independent of the value of
21091 ~calendar-date-style~.
21093 [fn:93] Custom commands can preset a filter by binding the variable
21094 ~org-agenda-tag-filter-preset~ as an option. This filter is then
21095 applied to the view and persists as a basic filter through refreshes
21096 and more secondary filtering. The filter is a global property of the
21097 entire agenda view---in a block agenda, you should only set this in
21098 the global options section, not in the section of an individual block.
21100 [fn:94] Only tags filtering is respected here, effort filtering is
21103 [fn:95] You can also create persistent custom functions through
21104 ~org-agenda-bulk-custom-functions~.
21106 [fn:96] This file is parsed for the agenda when
21107 ~org-agenda-include-diary~ is set.
21109 [fn:97] You can provide a description for a prefix key by inserting
21110 a cons cell with the prefix and the description.
21112 [fn:98] /Planned/ means here that these entries have some planning
21113 information attached to them, like a time-stamp, a scheduled or
21114 a deadline string. See ~org-agenda-entry-types~ on how to set what
21115 planning information is taken into account.
21117 [fn:99] For HTML you need to install Hrvoje Niksic's =htmlize.el=
21118 from [[https://github.com/hniksic/emacs-htmlize][Hrvoje Niksic's repository]].
21120 [fn:100] To create PDF output, the Ghostscript ps2pdf utility must be
21121 installed on the system. Selecting a PDF file also creates the
21124 [fn:101] If you want to store standard views like the weekly agenda or
21125 the global TODO list as well, you need to define custom commands for
21126 them in order to be able to specify file names.
21128 [fn:102] Quoting depends on the system you use, please check the FAQ
21131 [fn:103] This works automatically for the HTML backend (it requires
21132 version 1.34 of the =htmlize.el= package, which you need to install).
21133 Fontified code chunks in LaTeX can be achieved using either the
21134 listings package or the [[https://github.com/gpoore/minted][minted]] package. Refer to
21135 ~org-export-latex-listings~ for details.
21137 [fn:104] Source code in code blocks may also be evaluated either
21138 interactively or on export. See [[*Working with Source Code]] for more
21139 information on evaluating code blocks.
21141 [fn:105] Adding =-k= to =-n -r= /keeps/ the labels in the source code
21142 while using line numbers for the links, which might be useful to
21143 explain those in an Org mode example code.
21145 [fn:106] Upon exit, lines starting with =*=, =,*=, =#+= and =,#+= get
21146 a comma prepended, to keep them from being interpreted by Org as
21147 outline nodes or special syntax. These commas are stripped when
21148 editing with {{{kbd(C-c ')}}}, and also before export.
21150 [fn:107] You may select a different-mode with the variable
21151 ~org-edit-fixed-width-region-mode~.
21153 [fn:108] You can turn this on by default by setting the variable
21154 ~org-pretty-entities~, or on a per-file base with the =STARTUP= option
21157 [fn:109] This behaviour can be disabled with =-= export setting (see
21158 [[*Export Settings]]).
21160 [fn:110] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
21161 system. Many of the features described here as "LaTeX" are really
21162 from TeX, but for simplicity I am blurring this distinction.
21164 [fn:111] When MathJax is used, only the environments recognized by
21165 MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is
21166 used to create images, any LaTeX environment is handled.
21168 [fn:112] These are respectively available at
21169 [[http://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]]
21170 and from the ImageMagick suite. Choose the converter by setting the
21171 variable ~org-preview-latex-default-process~ accordingly.
21173 [fn:113] Org mode has a method to test if the cursor is inside such
21174 a fragment, see the documentation of the function
21175 ~org-inside-LaTeX-fragment-p~.
21177 [fn:114] The variable ~org-export-date-timestamp-format~ defines how
21178 this timestamp are exported.
21180 [fn:115] At the moment, some export back-ends do not obey this
21181 specification. For example, LaTeX export excludes every unnumbered
21182 headline from the table of contents.
21184 [fn:116] Since commas separate the arguments, commas within arguments
21185 have to be escaped with the backslash character. So only those
21186 backslash characters before a comma need escaping with another
21187 backslash character.
21189 [fn:117] For a less drastic behavior, consider using a select tag (see
21190 [[*Export Settings]]) instead.
21192 [fn:118] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
21193 to make it visible. The tag serves as a visual aid and has no
21194 semantic relevance.
21196 [fn:119] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by
21197 [[http://www.mathjax.org][MathJax]].
21199 [fn:120] 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
21202 [fn:121] If the classes on TODO keywords and tags lead to conflicts,
21203 use the variables ~org-html-todo-kwd-class-prefix~ and
21204 ~org-html-tag-class-prefix~ to make them unique.
21206 [fn:122] This does not allow setting different bibliography compilers
21207 for different files. However, "smart" LaTeX compilation systems, such
21208 as latexmk, can select the correct bibliography compiler.
21210 [fn:123] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications
21211 (OpenDocument) Version 1.2]].
21213 [fn:124] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].
21215 [fn:125] See [[http://dlmf.nist.gov/LaTeXML/]].
21217 [fn:126] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]]
21219 [fn:127] See the =<table:table-template>= element of the
21220 OpenDocument-v1.2 specification.
21222 [fn:128] See the attributes =table:template-name=,
21223 =table:use-first-row-styles=, =table:use-last-row-styles=,
21224 =table:use-first-column-styles=, =table:use-last-column-styles=,
21225 =table:use-banding-rows-styles=, and =table:use-banding-column-styles=
21226 of the =<table:table>= element in the OpenDocument-v1.2 specification.
21228 [fn:129] If the publishing directory is the same as the source
21229 directory, =file.org= is exported as =file.org.org=, so you probably
21230 do not want to do this.
21232 [fn:130] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used
21233 to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding.
21235 [fn:131] Actually, the constructs =call_<name>()= and =src_<lang>{}=
21236 are not evaluated when they appear in a keyword line---i.e. lines
21237 starting with =#+KEYWORD:=, see [[*Summary of In-Buffer Settings]].
21239 [fn:132] For Noweb literate programming details, see
21240 http://www.cs.tufts.edu/~nr/noweb/.
21242 [fn:133] For more information, please refer to the commentary section
21245 [fn:134] Note that ~org-indent-mode~ also sets the ~wrap-prefix~
21246 property, such that ~visual-line-mode~ (or purely setting ~word-wrap~)
21247 wraps long lines (including headlines) correctly indented.
21249 [fn:135] The ~org-indent-mode~ also sets the ~wrap-prefix~ correctly
21250 for indenting and wrapping long lines of headlines or text. This
21251 minor mode handles ~visual-line-mode~ and directly applied settings
21252 through ~word-wrap~.
21254 [fn:136] Also see the variable ~org-adapt-indentation~.
21256 [fn:137] Because =LEVEL=2= has 3 stars, =LEVEL=3= has 4 stars, and so
21259 [fn:138] https://ctan.org/tex-archive/macros/latex/contrib/comment?lang=en
21261 [fn:139] If the =TBLFM= keyword contains an odd number of dollar
21262 characters, this may cause problems with Font Lock in LaTeX mode. As
21263 shown in the example you can fix this by adding an extra line inside
21264 the =comment= environment that is used to balance the dollar
21265 expressions. If you are using AUCTeX with the font-latex library,
21266 a much better solution is to add the =comment= environment to the
21267 variable ~LaTeX-verbatim-environments~.
21269 [fn:140] The ~agenda*~ view is the same as ~agenda~ except that it
21270 only considers /appointments/, i.e., scheduled and deadline items that
21271 have a time specification =[h]h:mm= in their time-stamps.
21273 [fn:141] Note that, for ~org-odd-levels-only~, a level number
21274 corresponds to order in the hierarchy, not to the number of stars.
21276 [fn:142] If Emacs is configured for safe storing of passwords, then
21277 configure the variable, ~org-mobile-encryption-password~; please read
21278 the docstring of that variable.
21280 [fn:143] An alternative is to use a WebDAV server. MobileOrg
21281 documentation has details of WebDAV server configuration. Additional
21282 help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
21284 [fn:144] Symbolic links in ~org-directory~ need to have the same name
21287 [fn:145] While creating the agendas, Org mode forces ID properties on
21288 all referenced entries, so that these entries can be uniquely
21289 identified if MobileOrg flags them for further action. To avoid
21290 setting properties configure the variable
21291 ~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode then relies
21292 on outline paths, assuming they are unique.
21294 [fn:146] Checksums are stored automatically in the file
21297 [fn:147] The file will be empty after this operation.