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 markup language. It
19 also is an authoring system with unique support for literate
20 programming and 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 make 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 included in all recent distributions of GNU Emacs, so you
77 probably do not need to install it. Most users will simply activate
78 Org and begin exploring its many features.
80 If, for one reason or another, you want to install Org on top of this
81 pre-packaged version, there are three ways to do it:
83 - by using the Emacs package system;
84 - by downloading Org as an archive; or
85 - by using Org's git repository.
87 We *strongly recommend* sticking to a single installation method.
89 *** Using Emacs packaging system
94 Recent Emacs distributions include a packaging system which lets you
95 install Elisp libraries. You can install Org with {{{kbd(M-x
96 package-install RET org)}}}.
99 *Important*: you need to do this in a session where no =.org= file has
100 been visited, i.e., where no Org built-in function have been loaded.
101 Otherwise autoload Org functions will mess up the installation.
103 Then, to make sure your Org configuration is taken into account,
104 initialize the package system with ~(package-initialize)~ in your
105 Emacs init file before setting any Org option. If you want to use
106 Org's package repository, check out the [[https://orgmode.org/elpa.html][Org ELPA page]].
108 *** Downloading Org as an archive
113 You can download Org latest release from [[https://orgmode.org/][Org's website]]. In this case,
114 make sure you set the load-path correctly in your Emacs init file:
116 #+begin_src emacs-lisp
117 (add-to-list 'load-path "~/path/to/orgdir/lisp")
120 The downloaded archive contains contributed libraries that are not
121 included in Emacs. If you want to use them, add the =contrib/=
122 directory to your load-path:
124 #+begin_src emacs-lisp
125 (add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t)
128 Optionally, you can compile the files and/or install them in your
129 system. Run =make help= to list compilation and installation options.
131 *** Using Org's git repository
136 You can clone Org's repository and install Org like this:
140 $ git clone git@code.orgmode.org:bzg/org-mode.git
145 Note that in this case, ~make autoloads~ is mandatory: it defines
146 Org's version in =org-version.el= and Org's autoloads in
149 Remember to add the correct load-path as described in the method
152 You can also compile with =make=, generate the documentation with
153 =make doc=, create a local configuration with =make config= and
154 install Org with =make install=. Please run =make help= to get the
155 list of compilation/installation options.
157 For more detailed explanations on Org's build system, please check the
158 Org Build System page on [[https://orgmode.org/worg/dev/org-build-system.html][Worg]].
162 :DESCRIPTION: How to activate Org for certain buffers.
167 #+cindex: global key bindings
168 #+cindex: key bindings, global
170 Org mode buffers need Font Lock to be turned on: this is the default
173 There are compatibility issues between Org mode and some other Elisp
174 packages (see [[*Packages that conflict with Org mode]]). Please take the
175 time to check the list.
178 #+findex: org-capture
179 #+findex: org-store-link
180 For a better experience, the three Org commands ~org-store-link~,
181 ~org-capture~ and ~org-agenda~ ought to be accessible anywhere in
182 Emacs, not just in Org buffers. To that effect, you need to bind them
183 to globally available keys, like the ones reserved for users (see
184 [[info:elisp::Key%20Binding%20Conventions]]). Here are suggested
185 bindings, please modify the keys to your own liking.
187 #+begin_src emacs-lisp
188 (global-set-key (kbd "C-c l") 'org-store-link)
189 (global-set-key (kbd "C-c a") 'org-agenda)
190 (global-set-key (kbd "C-c c") 'org-capture)
193 #+cindex: Org mode, turning on
194 Files with the =.org= extension use Org mode by default. To turn on
195 Org mode in a file that does not have the extension =.org=, make the
196 first line of a file look like this:
198 : MY PROJECTS -*- mode: org; -*-
200 #+vindex: org-insert-mode-line-in-empty-file
202 which selects Org mode for this buffer no matter what the file's name
203 is. See also the variable ~org-insert-mode-line-in-empty-file~.
205 Many commands in Org work on the region if the region is /active/. To
206 make use of this, you need to have ~transient-mark-mode~ turned on,
207 which is the default. If you do not like ~transient-mark-mode~, you
208 can create an active region by using the mouse to select a region, or
209 pressing {{{kbd(C-SPC)}}} twice before moving point.
213 :DESCRIPTION: Bug reports, ideas, patches, etc.
216 #+cindex: bug reports
217 #+cindex: reporting a bug
221 If you find problems with Org, or if you have questions, remarks, or
222 ideas about it, please send an email to the Org mailing list
223 [[mailto:emacs-orgmode@gnu.org]]. You can subscribe to the list [[https://lists.gnu.org/mailman/listinfo/emacs-orgmode][from this
224 web page]]. If you are not a member of the mailing list, your mail will
225 be passed to the list after a moderator has approved it[fn:2].
227 #+findex: org-version
228 #+findex: org-submit-bug-report
229 For bug reports, please first try to reproduce the bug with the latest
230 version of Org available---if you are running an outdated version, it
231 is quite possible that the bug has been fixed already. If the bug
232 persists, prepare a report and provide as much information as
233 possible, including the version information of Emacs ({{{kbd(M-x
234 emacs-version)}}}) and Org ({{{kbd(M-x org-version)}}}), as well as
235 the Org related setup in the Emacs init file. The easiest way to do
236 this is to use the command
238 : M-x org-submit-bug-report <RET>
241 which puts all this information into an Emacs mail buffer so that you
242 only need to add your description. If you are not sending the Email
243 from within Emacs, please copy and paste the content into your Email
246 Sometimes you might face a problem due to an error in your Emacs or
247 Org mode setup. Before reporting a bug, it is very helpful to start
248 Emacs with minimal customizations and reproduce the problem. Doing so
249 often helps you determine if the problem is with your customization or
250 with Org mode itself. You can start a typical minimal session with
251 a command like the example below.
253 : $ emacs -Q -l /path/to/minimal-org.el
255 However if you are using Org mode as distributed with Emacs, a minimal
256 setup is not necessary. In that case it is sufficient to start Emacs
257 as =emacs -Q=. The =minimal-org.el= setup file can have contents as
260 #+begin_src emacs-lisp
261 ;;; Minimal setup to load latest `org-mode'.
263 ;; Activate debugging.
264 (setq debug-on-error t
268 ;; Add latest Org mode to load path.
269 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
270 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp" t))
273 If an error occurs, a "backtrace" can be very useful---see below on
274 how to create one. Often a small example file helps, along with clear
277 1. What exactly did you do?
278 2. What did you expect to happen?
279 3. What happened instead?
282 Thank you for helping to improve this program.
284 *** How to create a useful backtrace
289 #+cindex: backtrace of an error
290 If working with Org produces an error with a message you do not
291 understand, you may have hit a bug. The best way to report this is by
292 providing, in addition to what was mentioned above, a backtrace. This
293 is information from the built-in debugger about where and how the
294 error occurred. Here is how to produce a useful backtrace:
296 1. Reload uncompiled versions of all Org mode Lisp files. The
297 backtrace contains much more information if it is produced with
298 uncompiled code. To do this, use
300 : C-u M-x org-reload <RET>
303 or, from the menu: Org \rarr Refresh/Reload \rarr Reload Org uncompiled.
305 2. Then, activate the debugger:
307 : M-x toggle-debug-or-error <RET>
310 or, from the menu: Options \rarr Enter Debugger on Error.
312 3. Do whatever you have to do to hit the error. Do not forget to
313 document the steps you take.
315 4. When you hit the error, a =*Backtrace*= buffer appears on the
316 screen. Save this buffer to a file---for example using {{{kbd(C-x
317 C-w)}}}---and attach it to your bug report.
319 ** Typesetting Conventions Used in this Manual
321 :DESCRIPTION: Typesetting conventions used in this manual.
322 :ALT_TITLE: Conventions
325 *** TODO keywords, tags, properties, etc.
330 Org uses various syntactical elements: TODO keywords, tags, property
331 names, keywords, blocks, etc. In this manual we use the following
334 #+attr_texinfo: :sep ,
335 - =TODO=, =WAITING= ::
337 TODO keywords are written with all capitals, even if they are
340 - =boss=, =ARCHIVE= ::
342 User-defined tags are written in lowercase; built-in tags with
343 special meaning are written with all capitals.
345 - =Release=, =PRIORITY= ::
347 User-defined properties are capitalized; built-in properties with
348 special meaning are written with all capitals.
350 - =TITLE=, =BEGIN= ... =END= ::
352 Keywords and blocks are written in uppercase to enhance their
353 readability, but you can use lowercase in your Org files.
355 *** Key bindings and commands
360 The manual lists both the keys and the corresponding commands for
361 accessing a functionality. Org mode often uses the same key for
362 different functions, depending on context. The command that is bound
363 to such keys has a generic name, like ~org-metaright~. In the manual
364 we will, wherever possible, give the function that is internally
365 called by the generic command. For example, in the chapter on
366 document structure, {{{kbd(M-RIGHT)}}} will be listed to call
367 ~org-do-demote~, while in the chapter on tables, it will be listed to
368 call ~org-table-move-column-right~.
372 :DESCRIPTION: A tree works like your brain.
374 #+cindex: document structure
375 #+cindex: structure of document
377 Org is based on Outline mode and provides flexible commands to
378 edit the structure of the document.
382 :DESCRIPTION: Org is based on Outline mode.
385 #+cindex: Outline mode
387 Org is implemented on top of Outline mode. Outlines allow a document
388 to be organized in a hierarchical structure, which, least for me, is
389 the best representation of notes and thoughts. An overview of this
390 structure is achieved by folding, i.e., hiding large parts of the
391 document to show only the general document structure and the parts
392 currently being worked on. Org greatly simplifies the use of outlines
393 by compressing the entire show and hide functionalities into a single
394 command, ~org-cycle~, which is bound to the {{{kbd(TAB)}}} key.
398 :DESCRIPTION: How to typeset Org tree headlines.
401 #+cindex: outline tree
402 #+vindex: org-special-ctrl-a/e
403 #+vindex: org-special-ctrl-k
404 #+vindex: org-ctrl-k-protect-subtree
406 Headlines define the structure of an outline tree. The headlines in
407 Org start with one or more stars, on the left margin[fn:3]. For
411 ,* Top level headline
417 ,* Another top level headline
420 #+vindex: org-footnote-section
422 Note that the name defined in ~org-footnote-section~ is reserved. Do
423 not use it as a title for your own headings.
425 Some people find the many stars too noisy and would prefer an outline
426 that has whitespace followed by a single star as headline starters.
427 See [[*A Cleaner Outline View]].
429 #+vindex: org-cycle-separator-lines
430 An empty line after the end of a subtree is considered part of it and
431 is hidden when the subtree is folded. However, if you leave at least
432 two empty lines, one empty line remains visible after folding the
433 subtree, in order to structure the collapsed view. See the variable
434 ~org-cycle-separator-lines~ to modify this behavior.
436 ** Visibility Cycling
438 :DESCRIPTION: Show and hide, much simplified.
440 #+cindex: cycling, visibility
441 #+cindex: visibility cycling
442 #+cindex: trees, visibility
443 #+cindex: show hidden text
446 *** Global and local cycling
448 :DESCRIPTION: Cycling through various visibility states.
450 #+cindex: subtree visibility states
451 #+cindex: subtree cycling
452 #+cindex: folded, subtree visibility state
453 #+cindex: children, subtree visibility state
454 #+cindex: subtree, subtree visibility state
456 Outlines make it possible to hide parts of the text in the buffer.
457 Org uses just two commands, bound to {{{kbd(TAB)}}} and
458 {{{kbd(S-TAB)}}} to change the visibility in the buffer.
460 #+attr_texinfo: :sep ,
461 - {{{kbd(TAB)}}} (~org-cycle~) ::
465 /Subtree cycling/: Rotate current subtree among the states
468 ,-> FOLDED -> CHILDREN -> SUBTREE --.
469 '-----------------------------------'
472 #+vindex: org-cycle-emulate-tab
473 Point must be on a headline for this to work[fn:4].
475 - {{{kbd(S-TAB)}}} (~org-global-cycle~), {{{kbd(C-u TAB)}}} ::
477 #+cindex: global visibility states
478 #+cindex: global cycling
479 #+cindex: overview, global visibility state
480 #+cindex: contents, global visibility state
481 #+cindex: show all, global visibility state
484 #+findex: org-global-cycle
485 /Global cycling/: Rotate the entire buffer among the states
488 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
489 '--------------------------------------'
492 When {{{kbd(S-TAB)}}} is called with a numeric prefix argument N,
493 the CONTENTS view up to headlines of level N are shown. Note
494 that inside tables (see [[*Tables]]), {{{kbd(S-TAB)}}} jumps to the
495 previous field instead.
497 #+vindex: org-cycle-global-at-bob
498 You can run global cycling using {{{kbd(TAB)}}} only if point is
499 at the very beginning of the buffer, but not on a headline, and
500 ~org-cycle-global-at-bob~ is set to a non-~nil~ value.
502 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) ::
504 #+cindex: startup visibility
505 #+kindex: C-u C-u TAB
506 #+findex: org-set-startup-visibility
507 Switch back to the startup visibility of the buffer (see [[*Initial
510 - {{{kbd(C-u C-u C-u TAB)}}} (~outline-show-all~) ::
512 #+cindex: show all, command
513 #+kindex: C-u C-u C-u TAB
514 #+findex: outline-show-all
515 Show all, including drawers.
517 - {{{kbd(C-c C-r)}}} (~org-reveal~) ::
519 #+cindex: revealing context
522 Reveal context around point, showing the current entry, the
523 following heading and the hierarchy above. Useful for working
524 near a location that has been exposed by a sparse tree command
525 (see [[*Sparse Trees]]) or an agenda command (see [[*Commands in the
526 Agenda Buffer]]). With a prefix argument show, on each level, all
527 sibling headings. With a double prefix argument, also show the
528 entire subtree of the parent.
530 - {{{kbd(C-c C-k)}}} (~outline-show-branches~) ::
532 #+cindex: show branches, command
534 #+findex: outline-show-branches
535 Expose all the headings of the subtree, CONTENTS view for just
538 - {{{kbd(C-c TAB)}}} (~outline-show-children~) ::
540 #+cindex: show children, command
542 #+findex: outline-show-children
543 Expose all direct children of the subtree. With a numeric prefix
544 argument N, expose all children down to level N.
546 - {{{kbd(C-c C-x b)}}} (~org-tree-to-indirect-buffer~) ::
549 #+findex: org-tree-to-indirect-buffer
550 Show the current subtree in an indirect buffer[fn:5]. With
551 a numeric prefix argument, N, go up to level N and then take that
552 tree. If N is negative then go up that many levels. With
553 a {{{kbd(C-u)}}} prefix, do not remove the previously used
556 - {{{kbd(C-c C-x v)}}} (~org-copy-visible~) ::
559 #+findex: org-copy-visible
560 Copy the /visible/ text in the region into the kill ring.
562 *** Initial visibility
564 :DESCRIPTION: Setting the initial visibility state.
567 #+vindex: org-startup-folded
568 When Emacs first visits an Org file, the global state is set to
569 OVERVIEW, i.e., only the top level headlines are visible[fn:6]. This
570 can be configured through the variable ~org-startup-folded~, or on
571 a per-file basis by adding one of the following lines anywhere in the
574 #+cindex: @samp{STARTUP}, keyword
579 ,#+STARTUP: showeverything
582 #+cindex: @samp{VISIBILITY}, property
584 Furthermore, any entries with a =VISIBILITY= property (see [[*Properties
585 and Columns]]) get their visibility adapted accordingly. Allowed values
586 for this property are =folded=, =children=, =content=, and ~all~.
588 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) ::
590 #+kindex: C-u C-u TAB
591 #+findex: org-set-startup-visibility
592 Switch back to the startup visibility of the buffer, i.e.,
593 whatever is requested by startup options and =VISIBILITY=
594 properties in individual entries.
596 *** Catching invisible edits
598 :DESCRIPTION: Preventing mistakes when editing invisible parts.
600 #+cindex: edits, catching invisible
602 #+vindex: org-catch-invisible-edits
603 Sometimes you may inadvertently edit an invisible part of the buffer
604 and be confused on what has been edited and how to undo the mistake.
605 Setting ~org-catch-invisible-edits~ to non-~nil~ helps preventing
606 this. See the docstring of this option on how Org should catch
607 invisible edits and process them.
611 :DESCRIPTION: Jumping to other headlines.
613 #+cindex: motion, between headlines
614 #+cindex: jumping, to headlines
615 #+cindex: headline navigation
617 The following commands jump to other headlines in the buffer.
619 - {{{kbd(C-c C-n)}}} (~outline-next-visible-heading~) ::
622 #+findex: outline-next-visible-heading
625 - {{{kbd(C-c C-p)}}} (~outline-previous-visible-heading~) ::
628 #+findex: outline-previous-visible-heading
631 - {{{kbd(C-c C-f)}}} (~org-forward-same-level~) ::
634 #+findex: org-forward-same-level
635 Next heading same level.
637 - {{{kbd(C-c C-b)}}} (~org-backward-same-level~) ::
640 #+findex: org-backward-same-level
641 Previous heading same level.
643 - {{{kbd(C-c C-u)}}} (~outline-up-heading~) ::
646 #+findex: outline-up-heading
647 Backward to higher level heading.
649 - {{{kbd(C-c C-j)}}} (~org-goto~) ::
653 #+vindex: org-goto-auto-isearch
654 Jump to a different place without changing the current outline
655 visibility. Shows the document structure in a temporary buffer,
656 where you can use the following keys to find your destination:
658 #+attr_texinfo: :columns 0.3 0.7
659 | {{{kbd(TAB)}}} | Cycle visibility. |
660 | {{{kbd(DOWN)}}} / {{{kbd(UP)}}} | Next/previous visible headline. |
661 | {{{kbd(RET)}}} | Select this location. |
662 | {{{kbd(/)}}} | Do a Sparse-tree search |
665 The following keys work if you turn off ~org-goto-auto-isearch~
667 #+attr_texinfo: :columns 0.3 0.7
668 | {{{kbd(n)}}} / {{{kbd(p)}}} | Next/previous visible headline. |
669 | {{{kbd(f)}}} / {{{kbd(b)}}} | Next/previous headline same level. |
670 | {{{kbd(u)}}} | One level up. |
671 | {{{kbd(0)}}} ... {{{kbd(9)}}} | Digit argument. |
672 | {{{kbd(q)}}} | Quit. |
674 #+vindex: org-goto-interface
676 See also the variable ~org-goto-interface~.
680 :DESCRIPTION: Changing sequence and level of headlines.
682 #+cindex: structure editing
683 #+cindex: headline, promotion and demotion
684 #+cindex: promotion, of subtrees
685 #+cindex: demotion, of subtrees
686 #+cindex: subtree, cut and paste
687 #+cindex: pasting, of subtrees
688 #+cindex: cutting, of subtrees
689 #+cindex: copying, of subtrees
690 #+cindex: sorting, of subtrees
691 #+cindex: subtrees, cut and paste
693 - {{{kbd(M-RET)}}} (~org-meta-return~) ::
696 #+findex: org-meta-return
697 #+vindex: org-M-RET-may-split-line
698 Insert a new heading, item or row.
700 If the command is used at the /beginning/ of a line, and if there
701 is a heading or a plain list item (see [[*Plain Lists]]) at point,
702 the new heading/item is created /before/ the current line. When
703 used at the beginning of a regular line of text, turn that line
706 When this command is used in the middle of a line, the line is
707 split and the rest of the line becomes the new item or headline.
708 If you do not want the line to be split, customize
709 ~org-M-RET-may-split-line~.
711 Calling the command with a {{{kbd(C-u)}}} prefix unconditionally
712 inserts a new heading at the end of the current subtree, thus
713 preserving its contents. With a double {{{kbd(C-u C-u)}}}
714 prefix, the new heading is created at the end of the parent
717 - {{{kbd(C-RET)}}} (~org-insert-heading-respect-content~) ::
720 #+findex: org-insert-heading-respect-content
721 Insert a new heading at the end of the current subtree.
723 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
726 #+findex: org-insert-todo-heading
727 #+vindex: org-treat-insert-todo-heading-as-state-change
728 Insert new TODO entry with same level as current heading. See
730 ~org-treat-insert-todo-heading-as-state-change~.
732 - {{{kbd(C-S-RET)}}} (~org-insert-todo-heading-respect-content~) ::
735 #+findex: org-insert-todo-heading-respect-content
736 Insert new TODO entry with same level as current heading. Like
737 {{{kbd(C-RET)}}}, the new headline is inserted after the current
740 - {{{kbd(TAB)}}} (~org-cycle~) ::
744 In a new entry with no text yet, the first {{{kbd(TAB)}}} demotes
745 the entry to become a child of the previous one. The next
746 {{{kbd(TAB)}}} makes it a parent, and so on, all the way to top
747 level. Yet another {{{kbd(TAB)}}}, and you are back to the
750 - {{{kbd(M-LEFT)}}} (~org-do-promote~) ::
753 #+findex: org-do-promote
754 Promote current heading by one level.
756 - {{{kbd(M-RIGHT)}}} (~org-do-demote~) ::
759 #+findex: org-do-demote
760 Demote current heading by one level.
762 - {{{kbd(M-S-LEFT)}}} (~org-promote-subtree~) ::
765 #+findex: org-promote-subtree
766 Promote the current subtree by one level.
768 - {{{kbd(M-S-RIGHT)}}} (~org-demote-subtree~) ::
771 #+findex: org-demote-subtree
772 Demote the current subtree by one level.
774 - {{{kbd(M-UP)}}} (~org-move-subtree-up~) ::
777 #+findex: org-move-subtree-up
778 Move subtree up, i.e., swap with previous subtree of same level.
780 - {{{kbd(M-DOWN)}}} (~org-move-subtree-down~) ::
783 #+findex: org-move-subtree-down
784 Move subtree down, i.e., swap with next subtree of same level.
786 - {{{kbd(C-c @)}}} (~org-mark-subtree~) ::
789 #+findex: org-mark-subtree
790 Mark the subtree at point. Hitting repeatedly marks subsequent
791 subtrees of the same level as the marked subtree.
793 - {{{kbd(C-c C-x C-w)}}} (~org-cut-subtree~) ::
795 #+kindex: C-c C-x C-w
796 #+findex: org-cut-subtree
797 Kill subtree, i.e., remove it from buffer but save in kill ring.
798 With a numeric prefix argument N, kill N sequential subtrees.
800 - {{{kbd(C-c C-x M-w)}}} (~org-copy-subtree~) ::
802 #+kindex: C-c C-x M-w
803 #+findex: org-copy-subtree
804 Copy subtree to kill ring. With a numeric prefix argument N,
805 copy the N sequential subtrees.
807 - {{{kbd(C-c C-x C-y)}}} (~org-paste-subtree~) ::
809 #+kindex: C-c C-x C-y
810 #+findex: org-paste-subtree
811 Yank subtree from kill ring. This does modify the level of the
812 subtree to make sure the tree fits in nicely at the yank
813 position. The yank level can also be specified with a numeric
814 prefix argument, or by yanking after a headline marker like
817 - {{{kbd(C-y)}}} (~org-yank~) ::
821 #+vindex: org-yank-adjusted-subtrees
822 #+vindex: org-yank-folded-subtrees
823 Depending on the variables ~org-yank-adjusted-subtrees~ and
824 ~org-yank-folded-subtrees~, Org's internal ~yank~ command pastes
825 subtrees folded and in a clever way, using the same command as
826 {{{kbd(C-c C-x C-y)}}}. With the default settings, no level
827 adjustment takes place, but the yanked tree is folded unless
828 doing so would swallow text previously visible. Any prefix
829 argument to this command forces a normal ~yank~ to be executed,
830 with the prefix passed along. A good way to force a normal yank
831 is {{{kbd(C-u C-y)}}}. If you use ~yank-pop~ after a yank, it
832 yanks previous kill items plainly, without adjustment and
835 - {{{kbd(C-c C-x c)}}} (~org-clone-subtree-with-time-shift~) ::
838 #+findex: org-clone-subtree-with-time-shift
839 Clone a subtree by making a number of sibling copies of it. You
840 are prompted for the number of copies to make, and you can also
841 specify if any timestamps in the entry should be shifted. This
842 can be useful, for example, to create a number of tasks related
843 to a series of lectures to prepare. For more details, see the
844 docstring of the command ~org-clone-subtree-with-time-shift~.
846 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
850 Refile entry or region to a different location. See [[*Refile and
853 - {{{kbd(C-c ^)}}} (~org-sort~) ::
857 Sort same-level entries. When there is an active region, all
858 entries in the region are sorted. Otherwise the children of the
859 current headline are sorted. The command prompts for the sorting
860 method, which can be alphabetically, numerically, by time---first
861 timestamp with active preferred, creation time, scheduled time,
862 deadline time---by priority, by TODO keyword---in the sequence
863 the keywords have been defined in the setup---or by the value of
864 a property. Reverse sorting is possible as well. You can also
865 supply your own function to extract the sorting key. With
866 a {{{kbd(C-u)}}} prefix, sorting is case-sensitive.
868 - {{{kbd(C-x n s)}}} (~org-narrow-to-subtree~) ::
871 #+findex: org-narrow-to-subtree
872 Narrow buffer to current subtree.
874 - {{{kbd(C-x n b)}}} (~org-narrow-to-block~) ::
877 #+findex: org-narrow-to-block
878 Narrow buffer to current block.
880 - {{{kbd(C-x n w)}}} (~widen~) ::
884 Widen buffer to remove narrowing.
886 - {{{kbd(C-c *)}}} (~org-toggle-heading~) ::
889 #+findex: org-toggle-heading
890 Turn a normal line or plain list item into a headline---so that
891 it becomes a subheading at its location. Also turn a headline
892 into a normal line by removing the stars. If there is an active
893 region, turn all lines in the region into headlines. If the
894 first line in the region was an item, turn only the item lines
895 into headlines. Finally, if the first line is a headline, remove
896 the stars from all headlines in the region.
898 #+cindex: region, active
899 #+cindex: active region
900 #+cindex: transient mark mode
901 When there is an active region---i.e., when Transient Mark mode is
902 active---promotion and demotion work on all headlines in the region.
903 To select a region of headlines, it is best to place both point and
904 mark at the beginning of a line, mark at the beginning of the first
905 headline, and point at the line just after the last headline to
906 change. Note that when point is inside a table (see [[*Tables]]), the
907 Meta-Cursor keys have different functionality.
911 :DESCRIPTION: Matches embedded in context.
913 #+cindex: sparse trees
914 #+cindex: trees, sparse
915 #+cindex: folding, sparse trees
916 #+cindex: occur, command
918 #+vindex: org-show-context-detail
919 An important feature of Org mode is the ability to construct /sparse
920 trees/ for selected information in an outline tree, so that the entire
921 document is folded as much as possible, but the selected information
922 is made visible along with the headline structure above it[fn:7].
923 Just try it out and you will see immediately how it works.
925 Org mode contains several commands creating such trees, all these
926 commands can be accessed through a dispatcher:
928 - {{{kbd(C-c /)}}} (~org-sparse-tree~) ::
931 #+findex: org-sparse-tree
932 This prompts for an extra key to select a sparse-tree creating
935 - {{{kbd(C-c / r)}}} or {{{kbd(C-c / /)}}} (~org-occur~) ::
940 #+vindex: org-remove-highlights-with-change
941 Prompts for a regexp and shows a sparse tree with all matches.
942 If the match is in a headline, the headline is made visible. If
943 the match is in the body of an entry, headline and body are made
944 visible. In order to provide minimal context, also the full
945 hierarchy of headlines above the match is shown, as well as the
946 headline following the match. Each match is also highlighted;
947 the highlights disappear when the buffer is changed by an editing
948 command, or by pressing {{{kbd(C-c C-c)}}}[fn:8]. When called
949 with a {{{kbd(C-u)}}} prefix argument, previous highlights are
950 kept, so several calls to this command can be stacked.
952 - {{{kbd(M-g n)}}} or {{{kbd(M-g M-n)}}} (~next-error~) ::
957 Jump to the next sparse tree match in this buffer.
959 - {{{kbd(M-g p)}}} or {{{kbd(M-g M-p)}}} (~previous-error~) ::
963 #+findex: previous-error
964 Jump to the previous sparse tree match in this buffer.
966 #+vindex: org-agenda-custom-commands
968 For frequently used sparse trees of specific search strings, you can
969 use the variable ~org-agenda-custom-commands~ to define fast keyboard
970 access to specific sparse trees. These commands will then be
971 accessible through the agenda dispatcher (see [[*The Agenda Dispatcher]]).
974 #+begin_src emacs-lisp
975 (setq org-agenda-custom-commands
976 '(("f" occur-tree "FIXME")))
980 defines the key {{{kbd(f)}}} as a shortcut for creating a sparse tree
981 matching the string =FIXME=.
983 The other sparse tree commands select headings based on TODO keywords,
984 tags, or properties and are discussed later in this manual.
987 #+cindex: printing sparse trees
988 #+cindex: visible text, printing
989 To print a sparse tree, you can use the Emacs command
990 ~ps-print-buffer-with-faces~ which does not print invisible parts of
991 the document. Or you can use the command {{{kbd(C-c C-e v)}}} to
992 export only the visible part of the document and print the resulting
997 :DESCRIPTION: Additional structure within an entry.
999 #+cindex: plain lists
1000 #+cindex: lists, plain
1001 #+cindex: lists, ordered
1002 #+cindex: ordered lists
1004 Within an entry of the outline tree, hand-formatted lists can provide
1005 additional structure. They also provide a way to create lists of
1006 checkboxes (see [[*Checkboxes]]). Org supports editing such lists, and
1007 every exporter (see [[*Exporting]]) can parse and format them.
1009 Org knows ordered lists, unordered lists, and description lists.
1011 #+attr_texinfo: :indic @bullet
1012 - /Unordered/ list items start with =-=, =+=, or =*=[fn:9] as bullets.
1015 #+vindex: org-plain-list-ordered-item-terminator
1016 #+vindex: org-alphabetical-lists
1017 /Ordered/ list items start with a numeral followed by either
1018 a period or a right parenthesis[fn:10], such as =1.= or =1)=[fn:11]
1019 If you want a list to start with a different value---e.g.,
1020 20---start the text of the item with =[@20]=[fn:12]. Those
1021 constructs can be used in any item of the list in order to enforce
1022 a particular numbering.
1024 - /Description/ list items are unordered list items, and contain the
1025 separator =::= to distinguish the description /term/ from the
1028 Items belonging to the same list must have the same indentation on the
1029 first line. In particular, if an ordered list reaches number =10.=,
1030 then the 2-digit numbers must be written left-aligned with the other
1031 numbers in the list. An item ends before the next line that is less
1032 or equally indented than its bullet/number.
1034 A list ends whenever every item has ended, which means before any line
1035 less or equally indented than items at top level. It also ends before
1036 two blank lines. In that case, all items are closed. Here is an
1040 ,* Lord of the Rings
1041 My favorite scenes are (in this order)
1042 1. The attack of the Rohirrim
1043 2. Eowyn's fight with the witch king
1044 + this was already my favorite scene in the book
1045 + I really like Miranda Otto.
1046 3. Peter Jackson being shot by Legolas
1048 He makes a really funny face when it happens.
1049 But in the end, no individual scenes matter but the film as a whole.
1050 Important actors in this film are:
1051 - Elijah Wood :: He plays Frodo
1052 - Sean Astin :: He plays Sam, Frodo's friend. I still remember him
1053 very well from his role as Mikey Walsh in /The Goonies/.
1056 Org supports these lists by tuning filling and wrapping commands to
1057 deal with them correctly, and by exporting them properly (see
1058 [[*Exporting]]). Since indentation is what governs the structure of these
1059 lists, many structural constructs like =#+BEGIN_= blocks can be
1060 indented to signal that they belong to a particular item.
1062 #+vindex: org-list-demote-modify-bullet
1063 #+vindex: org-list-indent-offset
1064 If you find that using a different bullet for a sub-list---than that
1065 used for the current list-level---improves readability, customize the
1066 variable ~org-list-demote-modify-bullet~. To get a greater difference
1067 of indentation between items and theirs sub-items, customize
1068 ~org-list-indent-offset~.
1070 #+vindex: org-list-automatic-rules
1071 The following commands act on items when point is in the first line of
1072 an item---the line with the bullet or number. Some of them imply the
1073 application of automatic rules to keep list structure intact. If some
1074 of these actions get in your way, configure ~org-list-automatic-rules~
1075 to disable them individually.
1077 #+attr_texinfo: :sep ,
1078 - {{{kbd(TAB)}}} (~org-cycle~) ::
1080 #+cindex: cycling, in plain lists
1083 #+vindex: org-cycle-include-plain-lists
1084 Items can be folded just like headline levels. Normally this
1085 works only if point is on a plain list item. For more details,
1086 see the variable ~org-cycle-include-plain-lists~. If this
1087 variable is set to ~integrate~, plain list items are treated like
1088 low-level headlines. The level of an item is then given by the
1089 indentation of the bullet/number. Items are always subordinate
1090 to real headlines, however; the hierarchies remain completely
1091 separated. In a new item with no text yet, the first
1092 {{{kbd(TAB)}}} demotes the item to become a child of the previous
1093 one. Subsequent {{{kbd(TAB)}}}s move the item to meaningful
1094 levels in the list and eventually get it back to its initial
1097 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
1100 #+findex: org-insert-heading
1101 #+vindex: org-M-RET-may-split-line
1102 Insert new item at current level. With a prefix argument, force
1103 a new heading (see [[*Structure Editing]]). If this command is used
1104 in the middle of an item, that item is /split/ in two, and the
1105 second part becomes the new item[fn:13]. If this command is
1106 executed /before item's body/, the new item is created /before/
1109 - {{{kbd(M-S-RET)}}} ::
1112 Insert a new item with a checkbox (see [[*Checkboxes]]).
1114 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}} ::
1118 #+cindex: shift-selection-mode
1119 #+vindex: org-support-shift-select
1120 #+vindex: org-list-use-circular-motion
1121 Jump to the previous/next item in the current list, but only if
1122 ~org-support-shift-select~ is off[fn:14]. If not, you can
1123 still use paragraph jumping commands like {{{kbd(C-UP)}}}
1124 and {{{kbd(C-DOWN)}}} to quite similar effect.
1126 - {{{kbd(M-UP)}}}, {{{kbd(M-DOWN)}}} ::
1130 Move the item including subitems up/down[fn:15], i.e., swap with
1131 previous/next item of same indentation. If the list is ordered,
1132 renumbering is automatic.
1134 - {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} ::
1138 Decrease/increase the indentation of an item, leaving children
1141 - {{{kbd(M-S-LEFT)}}}, {{{kbd(M-S-RIGHT)}}} ::
1145 Decrease/increase the indentation of the item, including
1146 subitems. Initially, the item tree is selected based on current
1147 indentation. When these commands are executed several times in
1148 direct succession, the initially selected region is used, even if
1149 the new indentation would imply a different hierarchy. To use
1150 the new hierarchy, break the command chain by moving point.
1152 As a special case, using this command on the very first item of
1153 a list moves the whole list. This behavior can be disabled by
1154 configuring ~org-list-automatic-rules~. The global indentation
1155 of a list has no influence on the text /after/ the list.
1157 - {{{kbd(C-c C-c)}}} ::
1160 If there is a checkbox (see [[*Checkboxes]]) in the item line, toggle
1161 the state of the checkbox. In any case, verify bullets and
1162 indentation consistency in the whole list.
1164 - {{{kbd(C-c -)}}} ::
1167 #+vindex: org-plain-list-ordered-item-terminator
1168 Cycle the entire list level through the different
1169 itemize/enumerate bullets (=-=, =+=, =*=, =1.=, =1)=) or a subset
1170 of them, depending on ~org-plain-list-ordered-item-terminator~,
1171 the type of list, and its indentation. With a numeric prefix
1172 argument N, select the Nth bullet from this list. If there is an
1173 active region when calling this, selected text is changed into an
1174 item. With a prefix argument, all lines are converted to list
1175 items. If the first line already was a list item, any item
1176 marker is removed from the list. Finally, even without an active
1177 region, a normal line is converted into a list item.
1179 - {{{kbd(C-c *)}}} ::
1182 Turn a plain list item into a headline---so that it becomes
1183 a subheading at its location. See [[*Structure Editing]], for
1184 a detailed explanation.
1186 - {{{kbd(C-c C-*)}}} ::
1189 Turn the whole plain list into a subtree of the current heading.
1190 Checkboxes (see [[*Checkboxes]]) become TODO, respectively DONE,
1191 keywords when unchecked, respectively checked.
1193 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
1195 #+vindex: org-support-shift-select
1198 This command also cycles bullet styles when point is in on the
1199 bullet or anywhere in an item line, details depending on
1200 ~org-support-shift-select~.
1202 - {{{kbd(C-c ^)}}} ::
1205 #+cindex: sorting, of plain list
1206 Sort the plain list. Prompt for the sorting method: numerically,
1207 alphabetically, by time, or by custom function.
1211 :DESCRIPTION: Tucking stuff away.
1214 #+cindex: visibility cycling, drawers
1216 Sometimes you want to keep information associated with an entry, but
1217 you normally do not want to see it. For this, Org mode has /drawers/.
1218 They can contain anything but a headline and another drawer. Drawers
1222 ,** This is a headline
1223 Still outside the drawer
1225 This is inside the drawer.
1231 #+findex: org-insert-drawer
1232 You can interactively insert a drawer at point by calling
1233 ~org-insert-drawer~, which is bound to {{{kbd(C-c C-x d)}}}. With an
1234 active region, this command puts the region inside the drawer. With
1235 a prefix argument, this command calls ~org-insert-property-drawer~,
1236 which creates a =PROPERTIES= drawer right below the current headline.
1237 Org mode uses this special drawer for storing properties (see
1238 [[*Properties and Columns]]). You cannot use it for anything else.
1240 Completion over drawer keywords is also possible using
1241 {{{kbd(M-TAB)}}}[fn:16].
1243 Visibility cycling (see [[*Visibility Cycling]]) on the headline hides and
1244 shows the entry, but keep the drawer collapsed to a single line. In
1245 order to look inside the drawer, you need to move point to the drawer
1246 line and press {{{kbd(TAB)}}} there.
1248 You can also arrange for state change notes (see [[Tracking TODO state
1249 changes]]) and clock times (see [[*Clocking Work Time]]) to be stored in
1250 a =LOGBOOK= drawer. If you want to store a quick note there, in
1251 a similar way to state changes, use
1253 - {{{kbd(C-c C-z)}}} ::
1256 Add a time-stamped note to the =LOGBOOK= drawer.
1260 :DESCRIPTION: Folding blocks.
1262 #+vindex: org-hide-block-startup
1263 #+cindex: blocks, folding
1265 Org mode uses =#+BEGIN= ... =#+END= blocks for various purposes from
1266 including source code examples (see [[*Literal Examples]]) to capturing
1267 time logging information (see [[*Clocking Work Time]]). These blocks can
1268 be folded and unfolded by pressing {{{kbd(TAB)}}} in the =#+BEGIN=
1269 line. You can also get all blocks folded at startup by configuring
1270 the variable ~org-hide-block-startup~ or on a per-file basis by using
1272 #+cindex: STARTUP, keyword
1274 ,#+STARTUP: hideblocks
1275 ,#+STARTUP: nohideblocks
1278 ** Creating Footnotes
1280 :DESCRIPTION: How footnotes are defined in Org's syntax.
1284 Org mode supports the creation of footnotes.
1286 A footnote is started by a footnote marker in square brackets in
1287 column 0, no indentation allowed. It ends at the next footnote
1288 definition, headline, or after two consecutive empty lines. The
1289 footnote reference is simply the marker in square brackets, inside
1290 text. Markers always start with =fn:=. For example:
1293 The Org homepage[fn:1] now looks a lot better than it used to.
1295 [fn:1] The link is: https://orgmode.org
1298 Org mode extends the number-based syntax to /named/ footnotes and
1299 optional inline definition. Here are the valid references:
1303 A named footnote reference, where {{{var(NAME)}}} is a unique
1304 label word, or, for simplicity of automatic creation, a number.
1306 - =[fn:: This is the inline definition of this footnote]= ::
1308 A LaTeX-like anonymous footnote where the definition is given
1309 directly at the reference point.
1311 - =[fn:NAME: a definition]= ::
1313 An inline definition of a footnote, which also specifies a name
1314 for the note. Since Org allows multiple references to the same
1315 note, you can then use =[fn:NAME]= to create additional
1318 #+vindex: org-footnote-auto-label
1319 Footnote labels can be created automatically, or you can create names
1320 yourself. This is handled by the variable ~org-footnote-auto-label~
1321 and its corresponding =STARTUP= keywords. See the docstring of that
1322 variable for details.
1324 #+texinfo: @noindent
1325 The following command handles footnotes:
1327 - {{{kbd(C-c C-x f)}}} ::
1329 The footnote action command.
1332 When point is on a footnote reference, jump to the
1333 definition. When it is at a definition, jump to
1334 the---first---reference.
1336 #+vindex: org-footnote-define-inline
1337 #+vindex: org-footnote-section
1338 Otherwise, create a new footnote. Depending on the variable
1339 ~org-footnote-define-inline~[fn:17], the definition is placed
1340 right into the text as part of the reference, or separately into
1341 the location determined by the variable ~org-footnote-section~.
1343 When this command is called with a prefix argument, a menu of
1344 additional options is offered:
1346 #+attr_texinfo: :columns 0.1 0.9
1347 | {{{kbd(s)}}} | Sort the footnote definitions by reference sequence. |
1348 | {{{kbd(r)}}} | Renumber the simple =fn:N= footnotes. |
1349 | {{{kbd(S)}}} | Short for first {{{kbd(r)}}}, then {{{kbd(s)}}} action. |
1350 | {{{kbd(n)}}} | Rename all footnotes into a =fn:1= ... =fn:n= sequence. |
1351 | {{{kbd(d)}}} | Delete the footnote at point, including definition and references. |
1353 #+vindex: org-footnote-auto-adjust
1354 Depending on the variable ~org-footnote-auto-adjust~[fn:18],
1355 renumbering and sorting footnotes can be automatic after each
1356 insertion or deletion.
1358 - {{{kbd(C-c C-c)}}} ::
1361 If point is on a footnote reference, jump to the definition.
1362 If it is at the definition, jump back to the reference. When
1363 called at a footnote location with a prefix argument, offer the
1364 same menu as {{{kbd(C-c C-x f)}}}.
1366 - {{{kbd(C-c C-o)}}} or {{{kbd(mouse-1/2)}}} ::
1371 Footnote labels are also links to the corresponding definition or
1372 reference, and you can use the usual commands to follow these
1377 :DESCRIPTION: Pure magic for quick formatting.
1380 #+cindex: editing tables
1382 Org comes with a fast and intuitive table editor. Spreadsheet-like
1383 calculations are supported using the Emacs Calc package (see [[info:calc][GNU Emacs
1384 Calculator Manual]]).
1386 ** Built-in Table Editor
1388 :DESCRIPTION: Simple tables.
1390 #+cindex: table editor, built-in
1392 #+cindex: header lines, in tables
1393 #+cindex: horizontal rule, in tables
1394 #+cindex: row separator, in tables
1395 #+cindex: table syntax
1396 Org makes it easy to format tables in plain ASCII. Any line with =|=
1397 as the first non-whitespace character is considered part of a table.
1398 =|= is also the column separator[fn:19]. Moreover, a line starting
1399 with =|-= is a horizontal rule. It separates rows explicitely. Rows
1400 before the first horizontal rule are header lines. A table might look
1404 | Name | Phone | Age |
1405 |-------+-------+-----|
1406 | Peter | 1234 | 17 |
1407 | Anna | 4321 | 25 |
1410 A table is re-aligned automatically each time you press
1411 {{{kbd(TAB)}}}, {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} inside the table.
1412 {{{kbd(TAB)}}} also moves to the next field---{{{kbd(RET)}}} to the
1413 next row---and creates new table rows at the end of the table or
1414 before horizontal lines. The indentation of the table is set by the
1415 first line. Horizontal rules are automatically expanded on every
1416 re-align to span the whole table width. So, to create the above
1417 table, you would only type
1424 #+texinfo: @noindent
1425 and then press {{{kbd(TAB)}}} to align the table and start filling in
1426 fields. Even faster would be to type =|Name|Phone|Age= followed by
1429 When typing text into a field, Org treats {{{kbd(DEL)}}},
1430 {{{kbd(Backspace)}}}, and all character keys in a special way, so that
1431 inserting and deleting avoids shifting other fields. Also, when
1432 typing /immediately/ after point was moved into a new field with
1433 {{{kbd(TAB)}}}, {{{kbd(S-TAB)}}} or {{{kbd(RET)}}}, the field is
1434 automatically made blank. If this behavior is too unpredictable for
1435 you, configure the option ~org-table-auto-blank-field~.
1437 *** Creation and conversion
1442 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
1445 #+findex: org-table-create-or-convert-from-region
1446 Convert the active region to table. If every line contains at
1447 least one {{{kbd(TAB)}}} character, the function assumes that the
1448 material is tab separated. If every line contains a comma,
1449 comma-separated values (CSV) are assumed. If not, lines are
1450 split at whitespace into fields. You can use a prefix argument
1451 to force a specific separator: {{{kbd(C-u)}}} forces CSV,
1452 {{{kbd(C-u C-u)}}} forces {{{kbd(TAB)}}}, {{{kbd(C-u C-u C-u)}}}
1453 prompts for a regular expression to match the separator, and
1454 a numeric argument N indicates that at least N consecutive
1455 spaces, or alternatively a {{{kbd(TAB)}}} will be the separator.
1457 If there is no active region, this command creates an empty Org
1458 table. But it is easier just to start typing, like {{{kbd(|
1459 N a m e | P h o n e | A g e RET | - TAB)}}}.
1461 *** Re-aligning and field motion
1466 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
1469 #+findex: org-table-align
1470 Re-align the table without moving point.
1472 - {{{kbd(TAB)}}} (~org-table-next-field~) ::
1475 #+findex: org-table-next-field
1476 Re-align the table, move to the next field. Creates a new row if
1479 - {{{kbd(C-c SPC)}}} (~org-table-blank-field~) ::
1482 #+findex: org-table-blank-field
1483 Blank the field at point.
1485 - {{{kbd(S-TAB)}}} (~org-table-previous-field~) ::
1488 #+findex: org-table-previous-field
1489 Re-align, move to previous field.
1491 - {{{kbd(RET)}}} (~org-table-next-row~) ::
1494 #+findex: org-table-next-row
1495 Re-align the table and move down to next row. Creates a new row
1496 if necessary. At the beginning or end of a line, {{{kbd(RET)}}}
1497 still inserts a new line, so it can be used to split a table.
1499 - {{{kbd(M-a)}}} (~org-table-beginning-of-field~) ::
1502 #+findex: org-table-beginning-of-field
1503 Move to beginning of the current table field, or on to the
1506 - {{{kbd(M-e)}}} (~org-table-end-of-field~) ::
1509 #+findex: org-table-end-of-field
1510 Move to end of the current table field, or on to the next field.
1512 *** Column and row editing
1517 - {{{kbd(M-LEFT)}}} (~org-table-move-column-left~) ::
1520 #+findex: org-table-move-column-left
1521 Move the current column left.
1523 - {{{kbd(M-RIGHT)}}} (~org-table-move-column-right~) ::
1526 #+findex: org-table-move-column-right
1527 Move the current column right.
1529 - {{{kbd(M-S-LEFT)}}} (~org-table-delete-column~) ::
1532 #+findex: org-table-delete-column
1533 Kill the current column.
1535 - {{{kbd(M-S-RIGHT)}}} (~org-table-insert-column~) ::
1538 #+findex: org-table-insert-column
1539 Insert a new column to the left of point position.
1541 - {{{kbd(M-UP)}}} (~org-table-move-row-up~) ::
1544 #+findex: org-table-move-row-up
1545 Move the current row up.
1547 - {{{kbd(M-DOWN)}}} (~org-table-move-row-down~) ::
1550 #+findex: org-table-move-row-down
1551 Move the current row down.
1553 - {{{kbd(M-S-UP)}}} (~org-table-kill-row~) ::
1556 #+findex: org-table-kill-row
1557 Kill the current row or horizontal line.
1559 - {{{kbd(M-S-DOWN)}}} (~org-table-insert-row~) ::
1562 #+findex: org-table-insert-row
1563 Insert a new row above the current row. With a prefix argument,
1564 the line is created below the current one.
1566 - {{{kbd(C-c -)}}} (~org-table-insert-hline~) ::
1569 #+findex: org-table-insert-hline
1570 Insert a horizontal line below current row. With a prefix
1571 argument, the line is created above the current line.
1573 - {{{kbd(C-c RET)}}} (~org-table-hline-and-move~) ::
1576 #+findex: org-table-hline-and-move
1577 Insert a horizontal line below current row, and move point
1578 into the row below that line.
1580 - {{{kbd(C-c ^)}}} (~org-table-sort-lines~) ::
1583 #+findex: org-table-sort-lines
1584 Sort the table lines in the region. The position of point
1585 indicates the column to be used for sorting, and the range of
1586 lines is the range between the nearest horizontal separator
1587 lines, or the entire table. If point is before the first column,
1588 you are prompted for the sorting column. If there is an active
1589 region, the mark specifies the first line and the sorting column,
1590 while point should be in the last line to be included into the
1591 sorting. The command prompts for the sorting type,
1592 alphabetically, numerically, or by time. You can sort in normal
1593 or reverse order. You can also supply your own key extraction
1594 and comparison functions. When called with a prefix argument,
1595 alphabetic sorting is case-sensitive.
1602 - {{{kbd(C-c C-x M-w)}}} (~org-table-copy-region~) ::
1604 #+kindex: C-c C-x M-w
1605 #+findex: org-table-copy-region
1606 Copy a rectangular region from a table to a special clipboard.
1607 Point and mark determine edge fields of the rectangle. If there
1608 is no active region, copy just the current field. The process
1609 ignores horizontal separator lines.
1611 - {{{kbd(C-c C-x C-w)}}} (~org-table-cut-region~) ::
1613 #+kindex: C-c C-x C-w
1614 #+findex: org-table-cut-region
1615 Copy a rectangular region from a table to a special clipboard,
1616 and blank all fields in the rectangle. So this is the "cut"
1619 - {{{kbd(C-c C-x C-y)}}} (~org-table-paste-rectangle~) ::
1621 #+kindex: C-c C-x C-y
1622 #+findex: org-table-paste-rectangle
1623 Paste a rectangular region into a table. The upper left corner
1624 ends up in the current field. All involved fields are
1625 overwritten. If the rectangle does not fit into the present
1626 table, the table is enlarged as needed. The process ignores
1627 horizontal separator lines.
1629 - {{{kbd(M-RET)}}} (~org-table-wrap-region~) ::
1632 #+findex: org-table-wrap-region
1633 Split the current field at point position and move the rest
1634 to the line below. If there is an active region, and both point
1635 and mark are in the same column, the text in the column is
1636 wrapped to minimum width for the given number of lines.
1637 A numeric prefix argument may be used to change the number of
1638 desired lines. If there is no region, but you specify a prefix
1639 argument, the current field is made blank, and the content is
1640 appended to the field above.
1647 #+cindex: formula, in tables
1648 #+cindex: calculations, in tables
1650 - {{{kbd(C-c +)}}} (~org-table-sum~) ::
1653 #+findex: org-table-sum
1654 Sum the numbers in the current column, or in the rectangle
1655 defined by the active region. The result is shown in the echo
1656 area and can be inserted with {{{kbd(C-y)}}}.
1658 - {{{kbd(S-RET)}}} (~org-table-copy-down~) ::
1661 #+findex: org-table-copy-down
1662 #+vindex: org-table-copy-increment
1663 When current field is empty, copy from first non-empty field
1664 above. When not empty, copy current field down to next row and
1665 move point along with it. Depending on the variable
1666 ~org-table-copy-increment~, integer field values can be
1667 incremented during copy. Integers that are too large are not
1668 incremented, however. Also, a ~0~ prefix argument temporarily
1669 disables the increment. This key is also used by shift-selection
1670 and related modes (see [[*Packages that conflict with Org mode]]).
1677 - {{{kbd(C-c `)}}} (~org-table-edit-field~) ::
1680 #+findex: org-table-edit-field
1681 Edit the current field in a separate window. This is useful for
1682 fields that are not fully visible (see [[*Column Width and
1683 Alignment]]). When called with a {{{kbd(C-u)}}} prefix, just make
1684 the full field visible, so that it can be edited in place. When
1685 called with two {{{kbd(C-u)}}} prefixes, make the editor window
1686 follow point through the table and always show the current field.
1687 The follow mode exits automatically when point leaves the table,
1688 or when you repeat this command with {{{kbd(C-u C-u C-c `)}}}.
1690 - {{{kbd(M-x org-table-import)}}} ::
1692 #+findex: org-table-import
1693 Import a file as a table. The table should be TAB or whitespace
1694 separated. Use, for example, to import a spreadsheet table or
1695 data from a database, because these programs generally can write
1696 TAB-separated text files. This command works by inserting the
1697 file into the buffer and then converting the region to a table.
1698 Any prefix argument is passed on to the converter, which uses it
1699 to determine the separator.
1701 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) ::
1704 #+findex: org-table-create-or-convert-from-region
1705 Tables can also be imported by pasting tabular text into the Org
1706 buffer, selecting the pasted text with {{{kbd(C-x C-x)}}} and
1707 then using the {{{kbd(C-c |)}}} command (see [[*Creation and
1710 - {{{kbd(M-x org-table-export)}}} ::
1712 #+findex: org-table-export
1713 #+vindex: org-table-export-default-format
1714 Export the table, by default as a TAB-separated file. Use for
1715 data exchange with, for example, spreadsheet or database
1716 programs. The format used to export the file can be configured
1717 in the variable ~org-table-export-default-format~. You may also
1718 use properties =TABLE_EXPORT_FILE= and =TABLE_EXPORT_FORMAT= to
1719 specify the file name and the format for table export in
1720 a subtree. Org supports quite general formats for exported
1721 tables. The exporter format is the same as the format used by
1722 Orgtbl radio tables, see [[*Translator functions]], for a detailed
1725 ** Column Width and Alignment
1727 :DESCRIPTION: Overrule the automatic settings.
1729 #+cindex: narrow columns in tables
1730 #+cindex: alignment in tables
1732 The width of columns is automatically determined by the table editor.
1733 The alignment of a column is determined automatically from the
1734 fraction of number-like versus non-number fields in the column.
1736 #+vindex: org-table-automatic-realign
1737 Editing a field may modify alignment of the table. Moving
1738 a contiguous row or column---i.e., using {{{kbd(TAB)}}} or
1739 {{{kbd(RET)}}}---automatically re-aligns it. If you want to disable
1740 this behavior, set ~org-table-automatic-realign~ to ~nil~. In any
1741 case, you can always align manually a table:
1743 - {{{kbd(C-c C-c)}}} (~org-table-align~) ::
1746 #+findex: org-table-align
1747 Align the current table.
1749 #+texinfo: @noindent
1750 #+vindex: org-startup-align-all-tables
1751 Setting the option ~org-startup-align-all-tables~ re-aligns all tables
1752 in a file upon visiting it. You can also set this option on
1753 a per-file basis with:
1760 Sometimes a single field or a few fields need to carry more text,
1761 leading to inconveniently wide columns. Maybe you want to hide away
1762 several columns or display them with a fixed width, regardless of
1763 content, as shown in the following example.
1766 |---+---------------------+--------| |---+-------…|…|
1767 | | <6> | | | | <6> …|…|
1768 | 1 | one | some | ----\ | 1 | one …|…|
1769 | 2 | two | boring | ----/ | 2 | two …|…|
1770 | 3 | This is a long text | column | | 3 | This i…|…|
1771 |---+---------------------+--------| |---+-------…|…|
1774 To set the width of a column, one field anywhere in the column may
1775 contain just the string =<N>= where {{{var(N)}}} specifies the width
1776 as a number of characters. You control displayed width of columns
1777 with the following tools:
1779 - {{{kbd(C-c TAB)}}} (~org-table-toggle-column-width~) ::
1782 #+findex: org-table-toggle-column-width
1783 Shrink or expand current column.
1785 If a width cookie specifies a width W for the column, shrinking
1786 it displays the first W visible characters only. Otherwise, the
1787 column is shrunk to a single character.
1789 When called before the first column or after the last one, ask
1790 for a list of column ranges to operate on.
1792 - {{{kbd(C-u C-c TAB)}}} (~org-table-shrink~) ::
1794 #+kindex: C-u C-c TAB
1795 #+findex: org-table-shrink
1796 Shrink all columns with a column width. Expand the others.
1798 - {{{kbd(C-u C-u C-c TAB)}}} (~org-table-expand~) ::
1800 #+kindex: C-u C-u C-c TAB
1801 #+findex: org-table-expand
1804 To see the full text of a shrunk field, hold the mouse over it:
1805 a tool-tip window then shows the full contents of the field.
1806 Alternatively, {{{kbd(C-h .)}}} (~display-local-help~) reveals them,
1807 too. For convenience, any change near the shrunk part of a column
1810 #+vindex: org-startup-shrink-all-tables
1811 Setting the option ~org-startup-shrink-all-tables~ shrinks all columns
1812 containing a width cookie in a file the moment it is visited. You can
1813 also set this option on a per-file basis with:
1817 If you would like to overrule the automatic alignment of number-rich
1818 columns to the right and of string-rich columns to the left, you can
1819 use =<r>=, =<c>= or =<l>= in a similar fashion. You may also combine
1820 alignment and field width like this: =<r10>=.
1822 Lines which only contain these formatting cookies are removed
1823 automatically upon exporting the document.
1827 :DESCRIPTION: Grouping to trigger vertical lines.
1829 #+cindex: grouping columns in tables
1831 When Org exports tables, it does so by default without vertical lines
1832 because that is visually more satisfying in general. Occasionally
1833 however, vertical lines can be useful to structure a table into groups
1834 of columns, much like horizontal lines can do for groups of rows. In
1835 order to specify column groups, you can use a special row where the
1836 first field contains only =/=. The further fields can either contain
1837 =<= to indicate that this column should start a group, =>= to indicate
1838 the end of a column, or =<>= (no space between =<= and =>=) to make
1839 a column a group of its own. Upon export, boundaries between column
1840 groups are marked with vertical lines. Here is an example:
1843 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1844 |---+-----+-----+-----+---------+------------|
1845 | / | < | | > | < | > |
1846 | 1 | 1 | 1 | 1 | 1 | 1 |
1847 | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
1848 | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
1849 |---+-----+-----+-----+---------+------------|
1850 ,#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
1853 It is also sufficient to just insert the column group starters after
1854 every vertical line you would like to have:
1857 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1858 |---+-----+-----+-----+---------+------------|
1862 ** The Orgtbl Minor Mode
1864 :DESCRIPTION: The table editor as minor mode.
1865 :ALT_TITLE: Orgtbl Mode
1867 #+cindex: Orgtbl mode
1868 #+cindex: minor mode for tables
1870 #+findex: orgtbl-mode
1871 If you like the intuitive way the Org table editor works, you might
1872 also want to use it in other modes like Text mode or Mail mode. The
1873 minor mode Orgtbl mode makes this possible. You can always toggle the
1874 mode with {{{kbd(M-x orgtbl-mode)}}}. To turn it on by default, for
1875 example in Message mode, use
1877 #+begin_src emacs-lisp
1878 (add-hook 'message-mode-hook 'turn-on-orgtbl)
1881 Furthermore, with some special setup, it is possible to maintain
1882 tables in arbitrary syntax with Orgtbl mode. For example, it is
1883 possible to construct LaTeX tables with the underlying ease and power
1884 of Orgtbl mode, including spreadsheet capabilities. For details, see
1885 [[*Tables in Arbitrary Syntax]].
1889 :DESCRIPTION: The table editor has spreadsheet capabilities.
1891 #+cindex: calculations, in tables
1892 #+cindex: spreadsheet capabilities
1893 #+cindex: Calc package
1895 The table editor makes use of the Emacs Calc package to implement
1896 spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms
1897 to derive fields from other fields. While fully featured, Org's
1898 implementation is not identical to other spreadsheets. For example,
1899 Org knows the concept of a /column formula/ that will be applied to
1900 all non-header fields in a column without having to copy the formula
1901 to each relevant field. There is also a formula debugger, and a
1902 formula editor with features for highlighting fields in the table
1903 corresponding to the references at point in the formula, moving these
1904 references by arrow keys.
1908 :DESCRIPTION: How to refer to another field or range.
1910 #+cindex: references
1912 To compute fields in the table from other fields, formulas must
1913 reference other fields or ranges. In Org, fields can be referenced by
1914 name, by absolute coordinates, and by relative coordinates. To find
1915 out what the coordinates of a field are, press {{{kbd(C-c ?)}}} in
1916 that field, or press {{{kbd(C-c })}}} to toggle the display of a grid.
1918 **** Field references
1923 #+cindex: field references
1924 #+cindex: references, to fields
1925 Formulas can reference the value of another field in two ways. Like
1926 in any other spreadsheet, you may reference fields with
1927 a letter/number combination like =B3=, meaning the second field in the
1928 third row. However, Org prefers to use another, more general
1929 representation that looks like this:[fn:20]
1933 Column specifications can be absolute like =$1=, =$2=, ..., =$N=, or
1934 relative to the current column, i.e., the column of the field which is
1935 being computed, like =$+1= or =$-2=. =$<= and =$>= are immutable
1936 references to the first and last column, respectively, and you can use
1937 =$>>>= to indicate the third column from the right.
1939 The row specification only counts data lines and ignores horizontal
1940 separator lines, or "hlines". Like with columns, you can use absolute
1941 row numbers =@1=, =@2=, ..., =@N=, and row numbers relative to the
1942 current row like =@+3= or =@-1=. =@<= and =@>= are immutable
1943 references the first and last row in the table, respectively. You may
1944 also specify the row relative to one of the hlines: =@I= refers to the
1945 first hline, =@II= to the second, etc. =@-I= refers to the first such
1946 line above the current line, =@+I= to the first such line below the
1947 current line. You can also write =@III+2= which is the second data
1948 line after the third hline in the table.
1950 =@0= and =$0= refer to the current row and column, respectively, i.e.,
1951 to the row/column for the field being computed. Also, if you omit
1952 either the column or the row part of the reference, the current
1953 row/column is implied.
1955 Org's references with /unsigned/ numbers are fixed references in the
1956 sense that if you use the same reference in the formula for two
1957 different fields, the same field is referenced each time. Org's
1958 references with /signed/ numbers are floating references because the
1959 same reference operator can reference different fields depending on
1960 the field being calculated by the formula.
1962 Here are a few examples:
1964 #+attr_texinfo: :columns 0.2 0.8
1965 | =@2$3= | 2nd row, 3rd column (same as =C2=) |
1966 | =$5= | column 5 in the current row (same as =E&=) |
1967 | =@2= | current column, row 2 |
1968 | =@-1$-3= | field one row up, three columns to the left |
1969 | =@-I$2= | field just under hline above current row, column 2 |
1970 | =@>$5= | field in the last row, in column 5 |
1972 **** Range references
1977 #+cindex: range references
1978 #+cindex: references, to ranges
1979 You may reference a rectangular range of fields by specifying two
1980 field references connected by two dots =..=. If both fields are in
1981 the current row, you may simply use =$2..$7=, but if at least one
1982 field is in a different row, you need to use the general =@ROW$COLUMN=
1983 format at least for the first field, i.e., the reference must start
1984 with =@= in order to be interpreted correctly. Examples:
1986 #+attr_texinfo: :columns 0.2 0.8
1987 | =$1..$3= | first three fields in the current row |
1988 | =$P..$Q= | range, using column names (see [[*Advanced features]]) |
1989 | =$<<<..$>>= | start in third column, continue to the last but one |
1990 | =@2$1..@4$3= | six fields between these two fields (same as =A2..C4=) |
1991 | =@-1$-2..@-1= | 3 fields in the row above, starting from 2 columns on the left |
1992 | =@I..II= | between first and second hline, short for =@I..@II= |
1994 #+texinfo: @noindent
1995 Range references return a vector of values that can be fed into Calc
1996 vector functions. Empty fields in ranges are normally suppressed, so
1997 that the vector contains only the non-empty fields. For other options
1998 with the mode switches =E=, =N= and examples, see [[*Formula syntax for
2001 **** Field coordinates in formulas
2006 #+cindex: field coordinates
2007 #+cindex: coordinates, of field
2008 #+cindex: row, of field coordinates
2009 #+cindex: column, of field coordinates
2010 #+vindex: org-table-current-column
2011 #+vindex: org-table-current-dline
2012 One of the very first actions during evaluation of Calc formulas and
2013 Lisp formulas is to substitute =@#= and =$#= in the formula with the
2014 row or column number of the field where the current result will go to.
2015 The traditional Lisp formula equivalents are ~org-table-current-dline~
2016 and ~org-table-current-column~. Examples:
2018 - =if(@# % 2, $#, string(""))= ::
2020 Insert column number on odd rows, set field to empty on even
2023 - =$2 = '(identity remote(FOO, @@#$1))= ::
2025 Copy text or values of each row of column 1 of the table named
2026 {{{var(FOO)}}} into column 2 of the current table.
2028 - =@3 = 2 * remote(FOO, @@1$$#)= ::
2030 Insert the doubled value of each column of row 1 of the table
2031 named {{{var(FOO)}}} into row 3 of the current table.
2033 #+texinfo: @noindent
2034 For the second and third examples, table {{{var(FOO)}}} must have at
2035 least as many rows or columns as the current table. Note that this is
2036 inefficient[fn:21] for large number of rows.
2038 **** Named references
2042 #+cindex: named references
2043 #+cindex: references, named
2044 #+cindex: name, of column or field
2045 #+cindex: constants, in calculations
2046 #+cindex: @samp{CONSTANTS}, keyword
2047 #+vindex: org-table-formula-constants
2049 =$name= is interpreted as the name of a column, parameter or constant.
2050 Constants are defined globally through the variable
2051 ~org-table-formula-constants~, and locally---for the file---through
2052 a line like this example:
2054 : #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
2056 #+texinfo: @noindent
2057 #+vindex: constants-unit-system
2058 #+pindex: constants.el
2059 Also, properties (see [[*Properties and Columns]]) can be used as
2060 constants in table formulas: for a property =Xyz= use the name
2061 =$PROP_Xyz=, and the property will be searched in the current outline
2062 entry and in the hierarchy above it. If you have the =constants.el=
2063 package, it will also be used to resolve constants, including natural
2064 constants like =$h= for Planck's constant, and units like =$km= for
2065 kilometers[fn:22]. Column names and parameters can be specified in
2066 special table lines. These are described below, see [[*Advanced
2067 features]]. All names must start with a letter, and further consist
2068 of letters and numbers.
2070 **** Remote references
2075 #+cindex: remote references
2076 #+cindex: references, remote
2077 #+cindex: references, to a different table
2078 #+cindex: name, of column or field
2079 #+cindex: @samp{NAME}, keyword
2080 You may also reference constants, fields and ranges from a different
2081 table, either in the current file or even in a different file. The
2086 #+texinfo: @noindent
2087 where {{{var(NAME)}}} can be the name of a table in the current file
2088 as set by a =#+NAME:= line before the table. It can also be the ID of
2089 an entry, even in a different file, and the reference then refers to
2090 the first table in that entry. {{{var(REF)}}} is an absolute field or
2091 range reference as described above for example =@3$3= or =$somename=,
2092 valid in the referenced table.
2094 #+cindex: table indirection
2095 When {{{var(NAME)}}} has the format =@ROW$COLUMN=, it is substituted
2096 with the name or ID found in this field of the current table. For
2097 example =remote($1, @@>$2)= \Rightarrow =remote(year_2013, @@>$1)=. The format
2098 =B3= is not supported because it can not be distinguished from a plain
2101 *** Formula syntax for Calc
2103 :DESCRIPTION: Using Calc to compute stuff.
2105 #+cindex: formula syntax, Calc
2106 #+cindex: syntax, of formulas
2108 A formula can be any algebraic expression understood by the Emacs Calc
2109 package. Note that Calc has the non-standard convention that =/= has
2110 lower precedence than =*=, so that =a/b*c= is interpreted as
2111 =(a/(b*c))=. Before evaluation by ~calc-eval~ (see [[info:calc#Calling Calc from Your Programs][Calling Calc from
2112 Your Lisp Programs]]), variable substitution takes place according to
2113 the rules described above.
2115 #+cindex: vectors, in table calculations
2116 The range vectors can be directly fed into the Calc vector functions
2117 like ~vmean~ and ~vsum~.
2119 #+cindex: format specifier, in spreadsheet
2120 #+cindex: mode, for Calc
2121 #+vindex: org-calc-default-modes
2122 A formula can contain an optional mode string after a semicolon. This
2123 string consists of flags to influence Calc and other modes during
2124 execution. By default, Org uses the standard Calc modes (precision
2125 12, angular units degrees, fraction and symbolic modes off). The
2126 display format, however, has been changed to ~(float 8)~ to keep
2127 tables compact. The default settings can be configured using the
2128 variable ~org-calc-default-modes~.
2132 Set the internal Calc calculation precision to 20 digits.
2134 - =n3=, =s3=, =e2=, =f4= ::
2136 Normal, scientific, engineering or fixed format of the result of
2137 Calc passed back to Org. Calc formatting is unlimited in
2138 precision as long as the Calc calculation precision is greater.
2142 Degree and radian angle modes of Calc.
2146 Fraction and symbolic modes of Calc.
2150 Duration computations in Calc or Lisp, [[*Durations and time
2155 If and how to consider empty fields. Without =E= empty fields in
2156 range references are suppressed so that the Calc vector or Lisp
2157 list contains only the non-empty fields. With =E= the empty
2158 fields are kept. For empty fields in ranges or empty field
2159 references the value =nan= (not a number) is used in Calc
2160 formulas and the empty string is used for Lisp formulas. Add =N=
2161 to use 0 instead for both formula types. For the value of
2162 a field the mode =N= has higher precedence than =E=.
2166 Interpret all fields as numbers, use 0 for non-numbers. See the
2167 next section to see how this is essential for computations with
2168 Lisp formulas. In Calc formulas it is used only occasionally
2169 because there number strings are already interpreted as numbers
2174 Literal, for Lisp formulas only. See the next section.
2176 #+texinfo: @noindent
2177 Unless you use large integer numbers or high-precision calculation and
2178 display for floating point numbers you may alternatively provide
2179 a ~printf~ format specifier to reformat the Calc result after it has
2180 been passed back to Org instead of letting Calc already do the
2181 formatting[fn:23]. A few examples:
2183 | =$1+$2= | Sum of first and second field |
2184 | =$1+$2;%.2f= | Same, format result to two decimals |
2185 | =exp($2)+exp($1)= | Math functions can be used |
2186 | =$0;%.1f= | Reformat current cell to 1 decimal |
2187 | =($3-32)*5/9= | Degrees F \to C conversion |
2188 | =$c/$1/$cm= | Hz \to cm conversion, using =constants.el= |
2189 | =tan($1);Dp3s1= | Compute in degrees, precision 3, display SCI 1 |
2190 | =sin($1);Dp3%.1e= | Same, but use ~printf~ specifier for display |
2191 | =vmean($2..$7)= | Compute column range mean, using vector function |
2192 | =vmean($2..$7);EN= | Same, but treat empty fields as 0 |
2193 | =taylor($3,x=7,2)= | Taylor series of $3, at x=7, second degree |
2195 Calc also contains a complete set of logical operations (see [[info:calc#Logical%20Operations][Logical
2196 Operations]]). For example
2198 - =if($1 < 20, teen, string(""))= ::
2200 ="teen"= if age =$1= is less than 20, else the Org table result
2201 field is set to empty with the empty string.
2203 - =if("$1" =​= "nan" || "$2" =​= "nan", string(""), $1 + $2); E f-1= ::
2205 Sum of the first two columns. When at least one of the input
2206 fields is empty the Org table result field is set to empty. =E=
2207 is required to not convert empty fields to 0. =f-1= is an
2208 optional Calc format string similar to =%.1f= but leaves empty
2211 - =if(typeof(vmean($1..$7)) =​= 12, string(""), vmean($1..$7); E= ::
2213 Mean value of a range unless there is any empty field. Every
2214 field in the range that is empty is replaced by =nan= which lets
2215 =vmean= result in =nan=. Then =typeof == 12= detects the =nan=
2216 from ~vmean~ and the Org table result field is set to empty. Use
2217 this when the sample set is expected to never have missing
2220 - =if("$1..$7" =​= "[]", string(""), vmean($1..$7))= ::
2222 Mean value of a range with empty fields skipped. Every field in
2223 the range that is empty is skipped. When all fields in the range
2224 are empty the mean value is not defined and the Org table result
2225 field is set to empty. Use this when the sample set can have
2228 - =vmean($1..$7); EN= ::
2230 To complete the example before: Mean value of a range with empty
2231 fields counting as samples with value 0. Use this only when
2232 incomplete sample sets should be padded with 0 to the full size.
2234 You can add your own Calc functions defined in Emacs Lisp with
2235 ~defmath~ and use them in formula syntax for Calc.
2237 *** Emacs Lisp forms as formulas
2239 :DESCRIPTION: Writing formulas in Emacs Lisp.
2240 :ALT_TITLE: Formula syntax for Lisp
2242 #+cindex: Lisp forms, as table formulas
2244 It is also possible to write a formula in Emacs Lisp. This can be
2245 useful for string manipulation and control structures, if Calc's
2246 functionality is not enough.
2248 If a formula starts with a single-quote followed by an opening
2249 parenthesis, then it is evaluated as a Lisp form. The evaluation
2250 should return either a string or a number. Just as with Calc
2251 formulas, you can specify modes and a ~printf~ format after
2254 With Emacs Lisp forms, you need to be conscious about the way field
2255 references are interpolated into the form. By default, a reference is
2256 interpolated as a Lisp string (in double-quotes) containing the field.
2257 If you provide the =N= mode switch, all referenced elements are
2258 numbers---non-number fields will be zero---and interpolated as Lisp
2259 numbers, without quotes. If you provide the =L= flag, all fields are
2260 interpolated literally, without quotes. For example, if you want a
2261 reference to be interpreted as a string by the Lisp form, enclose the
2262 reference operator itself in double-quotes, like ="$3"=. Ranges are
2263 inserted as space-separated fields, so you can embed them in list or
2266 Here are a few examples---note how the =N= mode is used when we do
2267 computations in Lisp:
2269 - ='(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))= ::
2271 Swap the first two characters of the content of column 1.
2275 Add columns 1 and 2, equivalent to Calc's =$1+$2=.
2277 - ='(apply '+ '($1..$4));N= ::
2279 Compute the sum of columns 1 to 4, like Calc's =vsum($1..$4)=.
2281 *** Durations and time values
2283 :DESCRIPTION: How to compute durations and time values.
2285 #+cindex: duration, computing
2286 #+cindex: time, computing
2287 #+vindex: org-table-duration-custom-format
2289 If you want to compute time values use the =T=, =t=, or =U= flag,
2290 either in Calc formulas or Elisp formulas:
2293 | Task 1 | Task 2 | Total |
2294 |---------+----------+----------|
2295 | 2:12 | 1:47 | 03:59:00 |
2296 | 2:12 | 1:47 | 03:59 |
2297 | 3:02:20 | -2:07:00 | 0.92 |
2298 ,#+TBLFM: @2$3=$1+$2;T::@3$3=$1+$2;U::@4$3=$1+$2;t
2301 Input duration values must be of the form =HH:MM[:SS]=, where seconds
2302 are optional. With the =T= flag, computed durations are displayed as
2303 =HH:MM:SS= (see the first formula above). With the =U= flag, seconds
2304 are omitted so that the result is only =HH:MM= (see second formula
2305 above). Zero-padding of the hours field depends upon the value of the
2306 variable ~org-table-duration-hour-zero-padding~.
2308 With the =t= flag, computed durations are displayed according to the
2309 value of the option ~org-table-duration-custom-format~, which defaults
2310 to ~hours~ and displays the result as a fraction of hours (see the
2311 third formula in the example above).
2313 Negative duration values can be manipulated as well, and integers are
2314 considered as seconds in addition and subtraction.
2316 *** Field and range formulas
2318 :DESCRIPTION: Formula for specific (ranges of) fields.
2320 #+cindex: field formula
2321 #+cindex: range formula
2322 #+cindex: formula, for individual table field
2323 #+cindex: formula, for range of fields
2325 To assign a formula to a particular field, type it directly into the
2326 field, preceded by =:==, for example =vsum(@II..III)=. When you press
2327 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with point
2328 still in the field, the formula is stored as the formula for this
2329 field, evaluated, and the current field is replaced with the result.
2331 #+cindex: @samp{TBLFM}, keyword
2332 Formulas are stored in a special =TBLFM= keyword located directly
2333 below the table. If you type the equation in the fourth field of the
2334 third data line in the table, the formula looks like =@3$4=$1+$2=.
2335 When inserting/deleting/swapping column and rows with the appropriate
2336 commands, /absolute references/ (but not relative ones) in stored
2337 formulas are modified in order to still reference the same field. To
2338 avoid this from happening, in particular in range references, anchor
2339 ranges at the table borders (using =@<=, =@>=, =$<=, =$>=), or at
2340 hlines using the =@I= notation. Automatic adaptation of field
2341 references does not happen if you edit the table structure with normal
2342 editing commands---you must fix the formulas yourself.
2344 Instead of typing an equation into the field, you may also use the
2347 - {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
2350 #+findex: org-table-eval-formula
2351 Install a new formula for the current field. The command prompts
2352 for a formula with default taken from the =TBLFM= keyword,
2353 applies it to the current field, and stores it.
2355 The left-hand side of a formula can also be a special expression in
2356 order to assign the formula to a number of different fields. There is
2357 no keyboard shortcut to enter such range formulas. To add them, use
2358 the formula editor (see [[*Editing and debugging formulas]]) or edit the
2359 =TBLFM= keyword directly.
2363 Column formula, valid for the entire column. This is so common
2364 that Org treats these formulas in a special way, see [[*Column
2369 Row formula, applies to all fields in the specified row. =@>==
2374 Range formula, applies to all fields in the given rectangular
2375 range. This can also be used to assign a formula to some but not
2376 all fields in a row.
2380 Named field, see [[*Advanced features]].
2384 :DESCRIPTION: Formulas valid for an entire column.
2386 #+cindex: column formula
2387 #+cindex: formula, for table column
2389 When you assign a formula to a simple column reference like =$3==, the
2390 same formula is used in all fields of that column, with the following
2391 very convenient exceptions: (i) If the table contains horizontal
2392 separator hlines with rows above and below, everything before the
2393 first such hline is considered part of the table /header/ and is not
2394 modified by column formulas. Therefore a header is mandatory when you
2395 use column formulas and want to add hlines to group rows, like for
2396 example to separate a total row at the bottom from the summand rows
2397 above. (ii) Fields that already get a value from a field/range
2398 formula are left alone by column formulas. These conditions make
2399 column formulas very easy to use.
2401 To assign a formula to a column, type it directly into any field in
2402 the column, preceded by an equal sign, like ==$1+$2=. When you press
2403 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with point
2404 still in the field, the formula is stored as the formula for the
2405 current column, evaluated and the current field replaced with the
2406 result. If the field contains only ===, the previously stored formula
2407 for this column is used. For each column, Org only remembers the most
2408 recently used formula. In the =TBLFM= keyword, column formulas look
2409 like =$4=$1+$2=. The left-hand side of a column formula can not be
2410 the name of column, it must be the numeric column reference or =$>=.
2412 Instead of typing an equation into the field, you may also use the
2415 - {{{kbd(C-c =)}}} (~org-table-eval-formula~) ::
2418 #+findex: org-table-eval-formula
2419 Install a new formula for the current column and replace current
2420 field with the result of the formula. The command prompts for
2421 a formula, with default taken from the =TBLFM= keyword, applies
2422 it to the current field and stores it. With a numeric prefix
2423 argument, e.g., {{{kbd(C-5 C-c =)}}}, the command applies it to
2424 that many consecutive fields in the current column.
2426 *** Lookup functions
2428 :DESCRIPTION: Lookup functions for searching tables.
2430 #+cindex: lookup functions in tables
2431 #+cindex: table lookup functions
2433 Org has three predefined Emacs Lisp functions for lookups in tables.
2435 - ~(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)~ ::
2437 #+findex: org-lookup-first
2438 Searches for the first element {{{var(S)}}} in list
2439 {{{var(S-LIST)}}} for which
2440 #+begin_src emacs-lisp
2443 is non-~nil~; returns the value from the corresponding position
2444 in list {{{var(R-LIST)}}}. The default {{{var(PREDICATE)}}} is
2445 ~equal~. Note that the parameters {{{var(VAL)}}} and
2446 {{{var(S)}}} are passed to {{{var(PREDICATE)}}} in the same order
2447 as the corresponding parameters are in the call to
2448 ~org-lookup-first~, where {{{var(VAL)}}} precedes
2449 {{{var(S-LIST)}}}. If {{{var(R-LIST)}}} is ~nil~, the matching
2450 element {{{var(S)}}} of {{{var(S-LIST)}}} is returned.
2452 - ~(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)~ ::
2454 #+findex: org-lookup-last
2455 Similar to ~org-lookup-first~ above, but searches for the /last/
2456 element for which {{{var(PREDICATE)}}} is non-~nil~.
2458 - ~(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)~ ::
2460 #+findex: org-lookup-all
2461 Similar to ~org-lookup-first~, but searches for /all/ elements
2462 for which {{{var(PREDICATE)}}} is non-~nil~, and returns /all/
2463 corresponding values. This function can not be used by itself in
2464 a formula, because it returns a list of values. However,
2465 powerful lookups can be built when this function is combined with
2466 other Emacs Lisp functions.
2468 If the ranges used in these functions contain empty fields, the =E=
2469 mode for the formula should usually be specified: otherwise empty
2470 fields are not included in {{{var(S-LIST)}}} and/or {{{var(R-LIST)}}}
2471 which can, for example, result in an incorrect mapping from an element
2472 of {{{var(S-LIST)}}} to the corresponding element of
2475 These three functions can be used to implement associative arrays,
2476 count matching cells, rank results, group data, etc. For practical
2477 examples see [[https://orgmode.org/worg/org-tutorials/org-lookups.html][this tutorial on Worg]].
2479 *** Editing and debugging formulas
2481 :DESCRIPTION: Fixing formulas.
2483 #+cindex: formula editing
2484 #+cindex: editing, of table formulas
2486 #+vindex: org-table-use-standard-references
2487 You can edit individual formulas in the minibuffer or directly in the
2488 field. Org can also prepare a special buffer with all active formulas
2489 of a table. When offering a formula for editing, Org converts
2490 references to the standard format (like =B3= or =D&=) if possible. If
2491 you prefer to only work with the internal format (like =@3$2= or
2492 =$4=), configure the variable ~org-table-use-standard-references~.
2494 - {{{kbd(C-c =)}}} or {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) ::
2498 #+findex: org-table-eval-formula
2499 Edit the formula associated with the current column/field in the
2500 minibuffer. See [[*Column formulas]], and [[*Field and range formulas]].
2502 - {{{kbd(C-u C-u C-c =)}}} (~org-table-eval-formula~) ::
2504 #+kindex: C-u C-u C-c =
2505 #+findex: org-table-eval-formula
2506 Re-insert the active formula (either a field formula, or a column
2507 formula) into the current field, so that you can edit it directly
2508 in the field. The advantage over editing in the minibuffer is
2509 that you can use the command {{{kbd(C-c ?)}}}.
2511 - {{{kbd(C-c ?)}}} (~org-table-field-info~) ::
2514 #+findex: org-table-field-info
2515 While editing a formula in a table field, highlight the field(s)
2516 referenced by the reference at point position in the formula.
2518 - {{{kbd(C-c })}}} (~org-table-toggle-coordinate-overlays~) ::
2521 #+findex: org-table-toggle-coordinate-overlays
2522 Toggle the display of row and column numbers for a table, using
2523 overlays. These are updated each time the table is aligned; you
2524 can force it with {{{kbd(C-c C-c)}}}.
2526 - {{{kbd(C-c {)}}} (~org-table-toggle-formula-debugger~) ::
2529 #+findex: org-table-toggle-formula-debugger
2530 Toggle the formula debugger on and off. See below.
2532 - {{{kbd(C-c ')}}} (~org-table-edit-formulas~) ::
2535 #+findex: org-table-edit-formulas
2536 Edit all formulas for the current table in a special buffer,
2537 where the formulas are displayed one per line. If the current
2538 field has an active formula, point in the formula editor marks
2539 it. While inside the special buffer, Org automatically
2540 highlights any field or range reference at point position. You
2541 may edit, remove and add formulas, and use the following
2544 - {{{kbd(C-c C-c)}}} or {{{kbd(C-x C-s)}}} (~org-table-fedit-finish~) ::
2548 #+findex: org-table-fedit-finish
2549 Exit the formula editor and store the modified formulas. With
2550 {{{kbd(C-u)}}} prefix, also apply the new formulas to the
2553 - {{{kbd(C-c C-q)}}} (~org-table-fedit-abort~) ::
2556 #+findex: org-table-fedit-abort
2557 Exit the formula editor without installing changes.
2559 - {{{kbd(C-c C-r)}}} (~org-table-fedit-toggle-ref-type~) ::
2562 #+findex: org-table-fedit-toggle-ref-type
2563 Toggle all references in the formula editor between standard
2564 (like =B3=) and internal (like =@3$2=).
2566 - {{{kbd(TAB)}}} (~org-table-fedit-lisp-indent~) ::
2569 #+findex: org-table-fedit-lisp-indent
2570 Pretty-print or indent Lisp formula at point. When in a line
2571 containing a Lisp formula, format the formula according to
2572 Emacs Lisp rules. Another {{{kbd(TAB)}}} collapses the formula
2573 back again. In the open formula, {{{kbd(TAB)}}} re-indents
2574 just like in Emacs Lisp mode.
2576 - {{{kbd(M-TAB)}}} (~lisp-complete-symbol~) ::
2579 #+findex: lisp-complete-symbol
2580 Complete Lisp symbols, just like in Emacs Lisp mode.
2582 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}}, {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
2588 #+findex: org-table-fedit-ref-up
2589 #+findex: org-table-fedit-ref-down
2590 #+findex: org-table-fedit-ref-left
2591 #+findex: org-table-fedit-ref-right
2592 Shift the reference at point. For example, if the reference
2593 is =B3= and you press {{{kbd(S-RIGHT)}}}, it becomes =C3=.
2594 This also works for relative references and for hline
2597 - {{{kbd(M-S-UP)}}} (~org-table-fedit-line-up~) ::
2600 #+findex: org-table-fedit-line-up
2601 Move the test line for column formulas up in the Org buffer.
2603 - {{{kbd(M-S-DOWN)}}} (~org-table-fedit-line-down~) ::
2606 #+findex: org-table-fedit-line-down
2607 Move the test line for column formulas down in the Org buffer.
2609 - {{{kbd(M-UP)}}} (~org-table-fedit-scroll-up~) ::
2612 #+findex: org-table-fedit-scroll-up
2613 Scroll up the window displaying the table.
2615 - {{{kbd(M-DOWN)}}} (~org-table-fedit-scroll-down~) ::
2618 #+findex: org-table-fedit-scroll-down
2619 Scroll down the window displaying the table.
2621 - {{{kbd(C-c })}}} ::
2624 #+findex: org-table-toggle-coordinate-overlays
2625 Turn the coordinate grid in the table on and off.
2627 Making a table field blank does not remove the formula associated with
2628 the field, because that is stored in a different line---the =TBLFM=
2629 keyword line. During the next recalculation, the field will be filled
2630 again. To remove a formula from a field, you have to give an empty
2631 reply when prompted for the formula, or to edit the =TBLFM= keyword.
2634 You may edit the =TBLFM= keyword directly and re-apply the changed
2635 equations with {{{kbd(C-c C-c)}}} in that line or with the normal
2636 recalculation commands in the table.
2638 **** Using multiple =TBLFM= lines
2642 #+cindex: multiple formula lines
2643 #+cindex: @samp{TBLFM} keywords, multiple
2644 #+cindex: @samp{TBLFM}, switching
2647 You may apply the formula temporarily. This is useful when you want
2648 to switch the formula applied to the table. Place multiple =TBLFM=
2649 keywords right after the table, and then press {{{kbd(C-c C-c)}}} on
2650 the formula to apply. Here is an example:
2661 #+texinfo: @noindent
2662 Pressing {{{kbd(C-c C-c)}}} in the line of =#+TBLFM: $2=$1*2= yields:
2673 #+texinfo: @noindent
2674 Note: If you recalculate this table, with {{{kbd(C-u C-c *)}}}, for
2675 example, you get the following result from applying only the first
2687 **** Debugging formulas
2691 #+cindex: formula debugging
2692 #+cindex: debugging, of table formulas
2694 When the evaluation of a formula leads to an error, the field content
2695 becomes the string =#ERROR=. If you would like to see what is going
2696 on during variable substitution and calculation in order to find
2697 a bug, turn on formula debugging in the Tbl menu and repeat the
2698 calculation, for example by pressing {{{kbd(C-u C-u C-c = RET)}}} in
2699 a field. Detailed information are displayed.
2701 *** Updating the table
2703 :DESCRIPTION: Recomputing all dependent fields.
2705 #+cindex: recomputing table fields
2706 #+cindex: updating, table
2708 Recalculation of a table is normally not automatic, but needs to be
2709 triggered by a command. To make recalculation at least
2710 semi-automatic, see [[*Advanced features]].
2712 In order to recalculate a line of a table or the entire table, use the
2715 - {{{kbd(C-c *)}}} (~org-table-recalculate~) ::
2718 #+findex: org-table-recalculate
2719 Recalculate the current row by first applying the stored column
2720 formulas from left to right, and all field/range formulas in the
2723 - {{{kbd(C-u C-c *)}}} or {{{kbd(C-u C-c C-c)}}} ::
2726 #+kindex: C-u C-c C-c
2727 Recompute the entire table, line by line. Any lines before the
2728 first hline are left alone, assuming that these are part of the
2731 - {{{kbd(C-u C-u C-c *)}}} or {{{kbd(C-u C-u C-c C-c)}}} (~org-table-iterate~) ::
2733 #+kindex: C-u C-u C-c *
2734 #+kindex: C-u C-u C-c C-c
2735 #+findex: org-table-iterate
2736 Iterate the table by recomputing it until no further changes
2737 occur. This may be necessary if some computed fields use the
2738 value of other fields that are computed /later/ in the
2739 calculation sequence.
2741 - {{{kbd(M-x org-table-recalculate-buffer-tables)}}} ::
2743 #+findex: org-table-recalculate-buffer-tables
2744 Recompute all tables in the current buffer.
2746 - {{{kbd(M-x org-table-iterate-buffer-tables)}}} ::
2748 #+findex: org-table-iterate-buffer-tables
2749 Iterate all tables in the current buffer, in order to converge
2750 table-to-table dependencies.
2752 *** Advanced features
2754 :DESCRIPTION: Field and column names, automatic recalculation...
2757 If you want the recalculation of fields to happen automatically, or if
2758 you want to be able to assign /names/[fn:24] to fields and columns,
2759 you need to reserve the first column of the table for special marking
2762 - {{{kbd(C-#)}}} (~org-table-rotate-recalc-marks~) ::
2765 #+findex: org-table-rotate-recalc-marks
2766 Rotate the calculation mark in first column through the states
2767 =#=, =*=, =!=, =$=. When there is an active region, change all
2768 marks in the region.
2770 Here is an example of a table that collects exam results of students
2771 and makes use of these features:
2774 |---+---------+--------+--------+--------+-------+------|
2775 | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2776 |---+---------+--------+--------+--------+-------+------|
2777 | ! | | P1 | P2 | P3 | Tot | |
2778 | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
2779 | ^ | | m1 | m2 | m3 | mt | |
2780 |---+---------+--------+--------+--------+-------+------|
2781 | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
2782 | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
2783 |---+---------+--------+--------+--------+-------+------|
2784 | | Average | | | | 25.0 | |
2785 | ^ | | | | | at | |
2786 | $ | max=50 | | | | | |
2787 |---+---------+--------+--------+--------+-------+------|
2788 ,#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f
2791 #+texinfo: @noindent
2792 *Important*: please note that for these special tables, recalculating
2793 the table with {{{kbd(C-u C-c *)}}} only affects rows that are marked
2794 =#= or =*=, and fields that have a formula assigned to the field
2795 itself. The column formulas are not applied in rows with empty first
2798 #+cindex: marking characters, tables
2799 The marking characters have the following meaning:
2803 The fields in this line define names for the columns, so that you
2804 may refer to a column as =$Tot= instead of =$6=.
2808 This row defines names for the fields /above/ the row. With such
2809 a definition, any formula in the table may use =$m1= to refer to
2810 the value =10=. Also, if you assign a formula to a names field,
2811 it is stored as =$name = ...=.
2815 Similar to =^=, but defines names for the fields in the row
2820 Fields in this row can define /parameters/ for formulas. For
2821 example, if a field in a =$= row contains =max=50=, then formulas
2822 in this table can refer to the value 50 using =$max=. Parameters
2823 work exactly like constants, only that they can be defined on
2828 Fields in this row are automatically recalculated when pressing
2829 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(S-TAB)}}} in this row.
2830 Also, this row is selected for a global recalculation with
2831 {{{kbd(C-u C-c *)}}}. Unmarked lines are left alone by this
2836 Selects this line for global recalculation with {{{kbd(C-u C-c
2837 *)}}}, but not for automatic recalculation. Use this when
2838 automatic recalculation slows down editing too much.
2842 Do not export this line. Useful for lines that contain the
2843 narrowing =<N>= markers or column group markers.
2845 Finally, just to whet your appetite for what can be done with the
2846 fantastic Calc package, here is a table that computes the Taylor
2847 series of degree n at location x for a couple of functions.
2850 |---+-------------+---+-----+--------------------------------------|
2851 | | Func | n | x | Result |
2852 |---+-------------+---+-----+--------------------------------------|
2853 | # | exp(x) | 1 | x | 1 + x |
2854 | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
2855 | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
2856 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2857 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
2858 | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
2859 |---+-------------+---+-----+--------------------------------------|
2860 ,#+TBLFM: $5=taylor($2,$4,$3);n3
2865 :DESCRIPTION: Plotting from Org tables.
2867 #+cindex: graph, in tables
2868 #+cindex: plot tables using Gnuplot
2870 Org Plot can produce graphs of information stored in Org tables,
2871 either graphically or in ASCII art.
2873 *** Graphical plots using Gnuplot
2878 #+cindex: @samp{PLOT}, keyword
2879 Org Plot can produce 2D and 3D graphs of information stored in Org
2880 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
2881 that you have both Gnuplot and Gnuplot mode installed on your system,
2882 then call {{{kbd(C-c \quot g)}}} or {{{kbd(M-x org-plot/gnuplot)}}} on the
2886 ,#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
2887 | Sede | Max cites | H-index |
2888 |-----------+-----------+---------|
2889 | Chile | 257.72 | 21.39 |
2890 | Leeds | 165.77 | 19.68 |
2891 | Sao Paolo | 71.00 | 11.50 |
2892 | Stockholm | 134.19 | 14.33 |
2893 | Morelia | 257.56 | 17.67 |
2896 Notice that Org Plot is smart enough to apply the table's headers as
2897 labels. Further control over the labels, type, content, and
2898 appearance of plots can be exercised through the =PLOT= keyword
2899 preceding a table. See below for a complete list of Org Plot options.
2900 For more information and examples see the [[https://orgmode.org/worg/org-tutorials/org-plot.html][Org Plot tutorial]].
2909 Specify any Gnuplot option to be set when graphing.
2913 Specify the title of the plot.
2917 Specify which column of the table to use as the =x= axis.
2921 Specify the columns to graph as a Lisp style list, surrounded by
2922 parentheses and separated by spaces for example =dep:(3 4)= to
2923 graph the third and fourth columns. Defaults to graphing all
2924 other columns aside from the =ind= column.
2928 Specify whether the plot is =2d=, =3d=, or =grid=.
2932 Specify a =with= option to be inserted for every column being
2933 plotted, e.g., =lines=, =points=, =boxes=, =impulses=. Defaults
2938 If you want to plot to a file, specify
2939 ="path/to/desired/output-file"=.
2943 List of labels to be used for the =deps=. Defaults to the column
2944 headers if they exist.
2948 Specify an entire line to be inserted in the Gnuplot script.
2952 When plotting =3d= or =grid= types, set this to =t= to graph
2953 a flat mapping rather than a =3d= slope.
2957 Specify format of Org mode timestamps as they will be parsed by
2958 Gnuplot. Defaults to =%Y-%m-%d-%H:%M:%S=.
2962 If you want total control, you can specify a script file---place
2963 the file name between double-quotes---which will be used to plot.
2964 Before plotting, every instance of =$datafile= in the specified
2965 script will be replaced with the path to the generated data file.
2966 Note: even if you set this option, you may still want to specify
2967 the plot type, as that can impact the content of the data file.
2974 While point is on a column, typing {{{kbd(C-c " a)}}} or {{{kbd(M-x
2975 orgtbl-ascii-plot)}}} create a new column containing an ASCII-art bars
2976 plot. The plot is implemented through a regular column formula. When
2977 the source column changes, the bar plot may be updated by refreshing
2978 the table, for example typing {{{kbd(C-u C-c *)}}}.
2981 | Sede | Max cites | |
2982 |---------------+-----------+--------------|
2983 | Chile | 257.72 | WWWWWWWWWWWW |
2984 | Leeds | 165.77 | WWWWWWWh |
2985 | Sao Paolo | 71.00 | WWW; |
2986 | Stockholm | 134.19 | WWWWWW: |
2987 | Morelia | 257.56 | WWWWWWWWWWWH |
2988 | Rochefourchat | 0.00 | |
2989 ,#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
2992 The formula is an Elisp call.
2994 #+attr_texinfo: :options orgtbl-ascii-draw value min max &optional width
2996 Draw an ASCII bar in a table.
2998 {{{var(VALUE)}}} is the value to plot.
3000 {{{var(MIN)}}} is the value displayed as an empty bar. {{{var(MAX)}}}
3001 is the value filling all the {{{var(WIDTH)}}}. Sources values outside
3002 this range are displayed as =too small= or =too large=.
3004 {{{var(WIDTH)}}} is the number of characters of the bar plot. It
3010 :DESCRIPTION: Notes in context.
3012 #+cindex: hyperlinks
3014 Like HTML, Org provides support for links inside a file, external
3015 links to other files, Usenet articles, emails, and much more.
3019 :DESCRIPTION: How links in Org are formatted.
3021 #+cindex: link format
3022 #+cindex: format, of links
3024 Org recognizes plain URL-like links and activate them as clickable
3025 links. The general link format, however, looks like this:
3027 : [[LINK][DESCRIPTION]]
3029 #+texinfo: @noindent
3034 #+texinfo: @noindent
3035 Once a link in the buffer is complete (all brackets present), Org
3036 changes the display so that =DESCRIPTION= is displayed instead of
3037 =[[LINK][DESCRIPTION]]= and =LINK= is displayed instead of =[[LINK]]=. Links are be
3038 highlighted in the face ~org-link~, which by default is an underlined
3039 face. You can directly edit the visible part of a link. Note that
3040 this can be either the LINK part, if there is no description, or the
3041 {{{var(DESCRIPTION)}}} part. To edit also the invisible
3042 {{{var(LINK)}}} part, use {{{kbd(C-c C-l)}}} with point on the link.
3044 If you place point at the beginning or just behind the end of the
3045 displayed text and press {{{kbd(BS)}}}, you remove
3046 the---invisible---bracket at that location[fn:25]. This makes the link
3047 incomplete and the internals are again displayed as plain text.
3048 Inserting the missing bracket hides the link internals again. To show
3049 the internal structure of all links, use the menu: Org \rarr Hyperlinks \rarr
3054 :DESCRIPTION: Links to other places in the current file.
3056 #+cindex: internal links
3057 #+cindex: links, internal
3058 #+cindex: targets, for links
3060 #+cindex: @samp{CUSTOM_ID}, property
3061 If the link does not look like a URL, it is considered to be internal
3062 in the current file. The most important case is a link like
3063 =[[#my-custom-id]]= which links to the entry with the =CUSTOM_ID= property
3064 =my-custom-id=. You are responsible yourself to make sure these
3065 custom IDs are unique in a file.
3067 Links such as =[[My Target]]= or =[[My Target][Find my target]]= lead to a text search in
3070 The link can be followed with {{{kbd(C-c C-o)}}} when point is on
3071 the link, or with a mouse click (see [[*Handling Links]]). Links to
3072 custom IDs point to the corresponding headline. The preferred match
3073 for a text link is a /dedicated target/: the same string in double
3074 angular brackets, like =<<My Target>>=.
3076 #+cindex: @samp{NAME}, keyword
3077 If no dedicated target exists, the link tries to match the exact name
3078 of an element within the buffer. Naming is done with the =NAME=
3079 keyword, which has to be put in the line before the element it refers
3080 to, as in the following example
3089 If none of the above succeeds, Org searches for a headline that is
3090 exactly the link text but may also include a TODO keyword and
3093 During export, internal links are used to mark objects and assign them
3094 a number. Marked objects are then referenced by links pointing to
3095 them. In particular, links without a description appear as the number
3096 assigned to the marked object[fn:27]. In the following excerpt from
3101 2. <<target>>another item
3102 Here we refer to item [[target]].
3105 #+texinfo: @noindent
3106 The last sentence will appear as =Here we refer to item 2= when
3109 In non-Org files, the search looks for the words in the link text. In
3110 the above example the search would be for =target=.
3112 Following a link pushes a mark onto Org's own mark ring. You can
3113 return to the previous position with {{{kbd(C-c &)}}}. Using this
3114 command several times in direct succession goes back to positions
3119 :DESCRIPTION: Make targets trigger links in plain text.
3121 #+cindex: radio targets
3122 #+cindex: targets, radio
3123 #+cindex: links, radio targets
3125 Org can automatically turn any occurrences of certain target names in
3126 normal text into a link. So without explicitly creating a link, the
3127 text connects to the target radioing its position. Radio targets are
3128 enclosed by triple angular brackets. For example, a target =<<<My
3129 Target>>>= causes each occurrence of =my target= in normal text to
3130 become activated as a link. The Org file is scanned automatically for
3131 radio targets only when the file is first loaded into Emacs. To
3132 update the target list during editing, press {{{kbd(C-c C-c)}}} with
3133 point on or at a target.
3137 :DESCRIPTION: URL-like links to the world.
3139 #+cindex: links, external
3140 #+cindex: external links
3141 #+cindex: Gnus links
3142 #+cindex: BBDB links
3145 #+cindex: file links
3146 #+cindex: Rmail links
3147 #+cindex: MH-E links
3148 #+cindex: Usenet links
3149 #+cindex: shell links
3150 #+cindex: Info links
3151 #+cindex: Elisp links
3153 Org supports links to files, websites, Usenet and email messages, BBDB
3154 database entries and links to both IRC conversations and their logs.
3155 External links are URL-like locators. They start with a short
3156 identifying string followed by a colon. There can be no space after
3157 the colon. The following list shows examples for each link type.
3159 | =http://www.astro.uva.nl/=dominik= | on the web |
3160 | =doi:10.1000/182= | DOI for an electronic resource |
3161 | =file:/home/dominik/images/jupiter.jpg= | file, absolute path |
3162 | =/home/dominik/images/jupiter.jpg= | same as above |
3163 | =file:papers/last.pdf= | file, relative path |
3164 | =./papers/last.pdf= | same as above |
3165 | =file:/ssh:me@some.where:papers/last.pdf= | file, path on remote machine |
3166 | =/ssh:me@some.where:papers/last.pdf= | same as above |
3167 | =file:sometextfile::NNN= | file, jump to line number |
3168 | =file:projects.org= | another Org file |
3169 | =file:projects.org::some words= | text search in Org file[fn:28] |
3170 | =file:projects.org::*task title= | heading search in Org file |
3171 | =file+sys:/path/to/file= | open via OS, like double-click |
3172 | =file+emacs:/path/to/file= | force opening by Emacs |
3173 | =docview:papers/last.pdf::NNN= | open in doc-view mode at page |
3174 | =id:B7423F4D-2E8A-471B-8810-C40F074717E9= | link to heading by ID |
3175 | =news:comp.emacs= | Usenet link |
3176 | =mailto:adent@galaxy.net= | mail link |
3177 | =mhe:folder= | MH-E folder link |
3178 | =mhe:folder#id= | MH-E message link |
3179 | =rmail:folder= | Rmail folder link |
3180 | =rmail:folder#id= | Rmail message link |
3181 | =gnus:group= | Gnus group link |
3182 | =gnus:group#id= | Gnus article link |
3183 | =bbdb:R.*Stallman= | BBDB link (with regexp) |
3184 | =irc:/irc.com/#emacs/bob= | IRC link |
3185 | =info:org#External links= | Info node link |
3186 | =shell:ls *.org= | shell command |
3187 | =elisp:org-agenda= | interactive Elisp command |
3188 | =elisp:(find-file "Elisp.org")= | Elisp form to evaluate |
3191 #+cindex: Wanderlust links
3192 On top of these built-in link types, additional ones are available
3193 through the =contrib/= directory (see [[*Installation]]). For example,
3194 these links to VM or Wanderlust messages are available when you load
3195 the corresponding libraries from the =contrib/= directory:
3197 | =vm:folder= | VM folder link |
3198 | =vm:folder#id= | VM message link |
3199 | =vm://myself@some.where.org/folder#id= | VM on remote machine |
3200 | =vm-imap:account:folder= | VM IMAP folder link |
3201 | =vm-imap:account:folder#id= | VM IMAP message link |
3202 | =wl:folder= | Wanderlust folder link |
3203 | =wl:folder#id= | Wanderlust message link |
3205 For information on customizing Org to add new link types, see [[*Adding
3208 A link should be enclosed in double brackets and may contain
3209 descriptive text to be displayed instead of the URL (see [[*Link
3210 Format]]), for example:
3212 : [[http://www.gnu.org/software/emacs/][GNU Emacs]]
3214 #+texinfo: @noindent
3215 If the description is a file name or URL that points to an image, HTML
3216 export (see [[*HTML Export]]) inlines the image as a clickable button. If
3217 there is no description at all and the link points to an image, that
3218 image is inlined into the exported HTML file.
3220 #+cindex: square brackets, around links
3221 #+cindex: angular brackets, around links
3222 #+cindex: plain text external links
3223 Org also finds external links in the normal text and activates them as
3224 links. If spaces must be part of the link (for example in
3225 =bbdb:Richard Stallman=), or if you need to remove ambiguities about
3226 the end of the link, enclose the link in square or angular brackets.
3230 :DESCRIPTION: Creating, inserting and following.
3232 #+cindex: links, handling
3234 Org provides methods to create a link in the correct syntax, to insert
3235 it into an Org file, and to follow the link.
3237 #+findex: org-store-link
3238 #+cindex: storing links
3239 The main function is ~org-store-link~, called with {{{kbd(M-x
3240 org-store-link)}}}. Because of its importance, we suggest to bind it
3241 to a widely available key (see [[*Activation]]). It stores a link to the
3242 current location. The link is stored for later insertion into an Org
3243 buffer---see below. The kind of link that is created depends on the
3246 - /Org mode buffers/ ::
3248 For Org files, if there is a =<<target>>= at point, the link
3249 points to the target. Otherwise it points to the current
3250 headline, which is also the description[fn:29].
3252 #+vindex: org-link-to-org-use-id
3253 #+cindex: @samp{CUSTOM_ID}, property
3254 #+cindex: @samp{ID}, property
3255 If the headline has a =CUSTOM_ID= property, store a link to this
3256 custom ID. In addition or alternatively, depending on the value
3257 of ~org-link-to-org-use-id~, create and/or use a globally unique
3258 ID property for the link[fn:30]. So using this command in Org
3259 buffers potentially creates two links: a human-readable link from
3260 the custom ID, and one that is globally unique and works even if
3261 the entry is moved from file to file. Later, when inserting the
3262 link, you need to decide which one to use.
3264 - /Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus/ ::
3266 Pretty much all Emacs mail clients are supported. The link
3267 points to the current article, or, in some Gnus buffers, to the
3268 group. The description is constructed from the author and the
3271 - /Web browsers: W3, W3M and EWW/ ::
3273 Here the link is the current URL, with the page title as the
3276 - /Contacts: BBDB/ ::
3278 Links created in a BBDB buffer point to the current entry.
3282 #+vindex: org-irc-links-to-logs
3283 For IRC links, if the variable ~org-irc-link-to-logs~ is
3284 non-~nil~, create a =file= style link to the relevant point in
3285 the logs for the current conversation. Otherwise store an =irc=
3286 style link to the user/channel/server under the point.
3290 For any other file, the link points to the file, with a search
3291 string (see [[*Search Options in File Links]]) pointing to the
3292 contents of the current line. If there is an active region, the
3293 selected words form the basis of the search string. You can write
3294 custom Lisp functions to select the search string and perform the
3295 search for particular file types (see [[*Custom Searches]]).
3297 You can also define dedicated links to other files. See [[*Adding
3302 When point is in an agenda view, the created link points to
3303 the entry referenced by the current line.
3305 From an Org buffer, the following commands create, navigate or, more
3306 generally, act on links.
3308 #+attr_texinfo: :sep ,
3309 - {{{kbd(C-c C-l)}}} (~org-insert-link~) ::
3312 #+findex: org-insert-link
3313 #+cindex: link completion
3314 #+cindex: completion, of links
3315 #+cindex: inserting links
3316 #+vindex: org-keep-stored-link-after-insertion
3317 Insert a link[fn:31]. This prompts for a link to be inserted
3318 into the buffer. You can just type a link, using text for an
3319 internal link, or one of the link type prefixes mentioned in the
3320 examples above. The link is inserted into the buffer, along with
3321 a descriptive text[fn:32]. If some text was selected at this
3322 time, it becomes the default description.
3324 - /Inserting stored links/ ::
3326 All links stored during the current session are part of the
3327 history for this prompt, so you can access them with
3328 {{{kbd(UP)}}} and {{{kbd(DOWN)}}} (or {{{kbd(M-p)}}},
3331 - /Completion support/ ::
3333 Completion with {{{kbd(TAB)}}} helps you to insert valid link
3334 prefixes like =http= or =ftp=, including the prefixes defined
3335 through link abbreviations (see [[*Link Abbreviations]]). If you
3336 press {{{kbd(RET)}}} after inserting only the prefix, Org
3337 offers specific completion support for some link types[fn:33].
3338 For example, if you type {{{kbd(f i l e RET)}}}---alternative
3339 access: {{{kbd(C-u C-c C-l)}}}, see below---Org offers file
3340 name completion, and after {{{kbd(b b d b RET)}}} you can
3341 complete contact names.
3343 - {{{kbd(C-u C-c C-l)}}} ::
3345 #+cindex: file name completion
3346 #+cindex: completion, of file names
3347 #+kindex: C-u C-c C-l
3348 When {{{kbd(C-c C-l)}}} is called with a {{{kbd(C-u)}}} prefix
3349 argument, insert a link to a file. You may use file name
3350 completion to select the name of the file. The path to the file
3351 is inserted relative to the directory of the current Org file, if
3352 the linked file is in the current directory or in a sub-directory
3353 of it, or if the path is written relative to the current
3354 directory using =../=. Otherwise an absolute path is used, if
3355 possible with =~/= for your home directory. You can force an
3356 absolute path with two {{{kbd(C-u)}}} prefixes.
3358 - {{{kbd(C-c C-l)}}} (with point on existing link) ::
3360 #+cindex: following links
3361 When point is on an existing link, {{{kbd(C-c C-l)}}} allows
3362 you to edit the link and description parts of the link.
3364 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
3367 #+findex: org-open-at-point
3368 #+vindex: org-file-apps
3369 Open link at point. This launches a web browser for URL (using
3370 ~browse-url-at-point~), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
3371 for the corresponding links, and execute the command in a shell
3372 link. When point is on an internal link, this command runs the
3373 corresponding search. When point is on the tags part of a
3374 headline, it creates the corresponding tags view (see [[*Matching
3375 tags and properties]]). If point is on a timestamp, it compiles
3376 the agenda for that date. Furthermore, it visits text and remote
3377 files in =file= links with Emacs and select a suitable
3378 application for local non-text files. Classification of files is
3379 based on file extension only. See option ~org-file-apps~. If
3380 you want to override the default application and visit the file
3381 with Emacs, use a {{{kbd(C-u)}}} prefix. If you want to avoid
3382 opening in Emacs, use a {{{kbd(C-u C-u)}}} prefix.
3384 #+vindex: org-link-frame-setup
3385 If point is on a headline, but not on a link, offer all links in
3386 the headline and entry text. If you want to setup the frame
3387 configuration for following links, customize
3388 ~org-link-frame-setup~.
3392 #+vindex: org-return-follows-link
3394 When ~org-return-follows-link~ is set, {{{kbd(RET)}}} also
3395 follows the link at point.
3397 - {{{kbd(mouse-2)}}} or {{{kbd(mouse-1)}}} ::
3401 On links, {{{kbd(mouse-1)}}} and {{{kbd(mouse-2)}}} opens the
3402 link just as {{{kbd(C-c C-o)}}} does.
3404 - {{{kbd(mouse-3)}}} ::
3406 #+vindex: org-display-internal-link-with-indirect-buffer
3408 Like {{{kbd(mouse-2)}}}, but force file links to be opened with
3409 Emacs, and internal links to be displayed in another
3412 - {{{kbd(C-c %)}}} (~org-mark-ring-push~) ::
3415 #+findex: org-mark-ring-push
3417 Push the current position onto the Org mark ring, to be able to
3418 return easily. Commands following an internal link do this
3421 - {{{kbd(C-c &)}}} (~org-mark-ring-goto~) ::
3424 #+findex: org-mark-ring-goto
3425 #+cindex: links, returning to
3426 Jump back to a recorded position. A position is recorded by the
3427 commands following internal links, and by {{{kbd(C-c %)}}}.
3428 Using this command several times in direct succession moves
3429 through a ring of previously recorded positions.
3431 - {{{kbd(C-c C-x C-n)}}} (~org-next-link~), {{{kbd(C-c C-x C-p)}}} (~org-previous-link~) ::
3433 #+kindex: C-c C-x C-p
3434 #+findex: org-previous-link
3435 #+kindex: C-c C-x C-n
3436 #+findex: org-next-link
3437 #+cindex: links, finding next/previous
3438 Move forward/backward to the next link in the buffer. At the
3439 limit of the buffer, the search fails once, and then wraps
3440 around. The key bindings for this are really too long; you might
3441 want to bind this also to {{{kbd(M-n)}}} and {{{kbd(M-p)}}}.
3443 #+begin_src emacs-lisp
3444 (add-hook 'org-load-hook
3446 (define-key org-mode-map "\M-n" 'org-next-link)
3447 (define-key org-mode-map "\M-p" 'org-previous-link)))
3450 ** Using Links Outside Org
3452 :DESCRIPTION: Linking from my C source code?
3455 #+findex: org-insert-link-global
3456 #+findex: org-open-at-point-global
3457 You can insert and follow links that have Org syntax not only in Org,
3458 but in any Emacs buffer. For this, Org provides two functions:
3459 ~org-insert-link-global~ and ~org-open-at-point-global~.
3461 You might want to bind them to globally available keys. See
3462 [[*Activation]] for some advice.
3464 ** Link Abbreviations
3466 :DESCRIPTION: Shortcuts for writing complex links.
3468 #+cindex: link abbreviations
3469 #+cindex: abbreviation, links
3471 Long URL can be cumbersome to type, and often many similar links are
3472 needed in a document. For this you can use link abbreviations. An
3473 abbreviated link looks like this
3475 : [[linkword:tag][description]]
3477 #+texinfo: @noindent
3478 #+vindex: org-link-abbrev-alist
3479 where the tag is optional. The /linkword/ must be a word, starting
3480 with a letter, followed by letters, numbers, =-=, and =_=.
3481 Abbreviations are resolved according to the information in the
3482 variable ~org-link-abbrev-alist~ that relates the linkwords to
3483 replacement text. Here is an example:
3485 #+begin_src emacs-lisp
3486 (setq org-link-abbrev-alist
3487 '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
3488 ("url-to-ja" . "http://translate.google.fr/translate?sl=en&tl=ja&u=%h")
3489 ("google" . "http://www.google.com/search?q=")
3490 ("gmap" . "http://maps.google.com/maps?q=%s")
3491 ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
3492 ("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")))
3495 If the replacement text contains the string =%s=, it is replaced with
3496 the tag. Using =%h= instead of =%s= percent-encodes the tag (see the
3497 example above, where we need to encode the URL parameter). Using
3498 =%(my-function)= passes the tag to a custom Lisp function, and replace
3499 it by the resulting string.
3501 If the replacement text do not contain any specifier, it is simply
3502 appended to the string in order to create the link.
3504 Instead of a string, you may also specify a Lisp function to create
3505 the link. Such a function will be called with the tag as the only
3508 With the above setting, you could link to a specific bug with
3509 =[[bugzilla:129]]=, search the web for =OrgMode= with =[[google:OrgMode]]=,
3510 show the map location of the Free Software Foundation =[[gmap:51
3511 Franklin Street, Boston]]= or of Carsten office =[[omap:Science Park 904,
3512 Amsterdam, The Netherlands]]= and find out what the Org author is doing
3513 besides Emacs hacking with =[[ads:Dominik,C]]=.
3515 If you need special abbreviations just for a single Org buffer, you
3516 can define them in the file with
3518 #+cindex: @samp{LINK}, keyword
3520 ,#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
3521 ,#+LINK: google http://www.google.com/search?q=%s
3524 #+texinfo: @noindent
3525 In-buffer completion (see [[*Completion]]) can be used after =[= to
3526 complete link abbreviations. You may also define a Lisp function that
3527 implements special (e.g., completion) support for inserting such a
3528 link with {{{kbd(C-c C-l)}}}. Such a function should not accept any
3529 arguments, and should return the full link with a prefix. You can set
3530 the link completion function like this:
3532 #+begin_src emacs-lisp
3533 (org-link-set-parameter "type" :complete #'some-completion-function)
3536 ** Search Options in File Links
3538 :DESCRIPTION: Linking to a specific location.
3539 :ALT_TITLE: Search Options
3541 #+cindex: search option in file links
3542 #+cindex: file links, searching
3544 File links can contain additional information to make Emacs jump to
3545 a particular location in the file when following a link. This can be
3546 a line number or a search option after a double colon[fn:35]. For
3547 example, when the command ~org-store-link~ creates a link (see
3548 [[*Handling Links]]) to a file, it encodes the words in the current line
3549 as a search string that can be used to find this line back later when
3550 following the link with {{{kbd(C-c C-o)}}}.
3552 Here is the syntax of the different ways to attach a search to a file
3553 link, together with explanations for each:
3556 [[file:~/code/main.c::255]]
3557 [[file:~/xx.org::My Target]]
3558 [[file:~/xx.org::*My Target]]
3559 [[file:~/xx.org::#my-custom-id]]
3560 [[file:~/xx.org::/regexp/]]
3569 Search for a link target =<<My Target>>=, or do a text search for
3570 =my target=, similar to the search in internal links, see
3571 [[*Internal Links]]. In HTML export (see [[*HTML Export]]), such a file
3572 link becomes a HTML reference to the corresponding named anchor
3577 In an Org file, restrict search to headlines.
3579 - =#my-custom-id= ::
3581 Link to a heading with a =CUSTOM_ID= property
3585 Do a regular expression search for {{{var(REGEXP)}}}. This uses
3586 the Emacs command ~occur~ to list all matches in a separate
3587 window. If the target file is in Org mode, ~org-occur~ is used
3588 to create a sparse tree with the matches.
3590 As a degenerate case, a file link with an empty file name can be used
3591 to search the current file. For example, =[[file:::find me]]= does
3592 a search for =find me= in the current file, just as =[[find me]]= would.
3596 :DESCRIPTION: When the default search is not enough.
3598 #+cindex: custom search strings
3599 #+cindex: search strings, custom
3601 The default mechanism for creating search strings and for doing the
3602 actual search related to a file link may not work correctly in all
3603 cases. For example, BibTeX database files have many entries like
3604 ~year="1993"~ which would not result in good search strings, because
3605 the only unique identification for a BibTeX entry is the citation key.
3607 #+vindex: org-create-file-search-functions
3608 #+vindex: org-execute-file-search-functions
3609 If you come across such a problem, you can write custom functions to
3610 set the right search string for a particular file type, and to do the
3611 search for the string in the file. Using ~add-hook~, these functions
3612 need to be added to the hook variables
3613 ~org-create-file-search-functions~ and
3614 ~org-execute-file-search-functions~. See the docstring for these
3615 variables for more information. Org actually uses this mechanism for
3616 BibTeX database files, and you can use the corresponding code as an
3617 implementation example. See the file =org-bibtex.el=.
3621 :DESCRIPTION: Every tree branch can be a TODO item.
3623 #+cindex: TODO items
3625 Org mode does not maintain TODO lists as separate documents[fn:36].
3626 Instead, TODO items are an integral part of the notes file, because
3627 TODO items usually come up while taking notes! With Org mode, simply
3628 mark any entry in a tree as being a TODO item. In this way,
3629 information is not duplicated, and the entire context from which the
3630 TODO item emerged is always present.
3632 Of course, this technique for managing TODO items scatters them
3633 throughout your notes file. Org mode compensates for this by
3634 providing methods to give you an overview of all the things that you
3637 ** Basic TODO Functionality
3639 :DESCRIPTION: Marking and displaying TODO entries.
3640 :ALT_TITLE: TODO Basics
3643 Any headline becomes a TODO item when it starts with the word =TODO=,
3646 : *** TODO Write letter to Sam Fortune
3648 #+texinfo: @noindent
3649 The most important commands to work with TODO entries are:
3651 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
3654 #+cindex: cycling, of TODO states
3655 Rotate the TODO state of the current item among
3658 ,-> (unmarked) -> TODO -> DONE --.
3659 '--------------------------------'
3662 If TODO keywords have fast access keys (see [[*Fast access to
3663 TODO states]]), prompt for a TODO keyword through the fast
3664 selection interface; this is the default behavior when
3665 ~org-use-fast-todo-selection~ is non-~nil~.
3667 The same rotation can also be done "remotely" from the agenda
3668 buffer with the {{{kbd(t)}}} command key (see [[*Commands in the
3671 - {{{kbd(C-u C-c C-t)}}} ::
3673 #+kindex: C-u C-c C-t
3674 When TODO keywords have no selection keys, select a specific
3675 keyword using completion; otherwise force cycling through TODO
3676 states with no prompt. When ~org-use-fast-todo-selection~ is set
3677 to ~prefix~, use the fast selection interface.
3679 - {{{kbd(S-RIGHT)}}} {{{kbd(S-LEFT)}}} ::
3683 #+vindex: org-treat-S-cursor-todo-selection-as-state-change
3684 Select the following/preceding TODO state, similar to cycling.
3685 Useful mostly if more than two TODO states are possible (see
3686 [[*Extended Use of TODO Keywords]]). See also [[*Packages that
3687 conflict with Org mode]], for a discussion of the interaction with
3688 ~shift-selection-mode~. See also the variable
3689 ~org-treat-S-cursor-todo-selection-as-state-change~.
3691 - {{{kbd(C-c / t)}}} (~org-show-todo-tree~) ::
3694 #+cindex: sparse tree, for TODO
3695 #+vindex: org-todo-keywords
3696 #+findex: org-show-todo-tree
3697 View TODO items in a /sparse tree/ (see [[*Sparse Trees]]). Folds
3698 the entire buffer, but shows all TODO items---with not-DONE
3699 state---and the headings hierarchy above them. With a prefix
3700 argument, or by using {{{kbd(C-c / T)}}}, search for a specific
3701 TODO. You are prompted for the keyword, and you can also give
3702 a list of keywords like =KWD1|KWD2|...= to list entries that
3703 match any one of these keywords. With a numeric prefix argument
3704 N, show the tree for the Nth keyword in the variable
3705 ~org-todo-keywords~. With two prefix arguments, find all TODO
3706 states, both un-done and done.
3708 - {{{kbd(M-x org-agenda t)}}} (~org-todo-list~) ::
3710 #+kindex: t @r{(Agenda dispatcher)}
3711 Show the global TODO list. Collects the TODO items (with
3712 not-DONE states) from all agenda files (see [[*Agenda Views]]) into
3713 a single buffer. The new buffer is in Org Agenda mode, which
3714 provides commands to examine and manipulate the TODO entries from
3715 the new buffer (see [[*Commands in the Agenda Buffer]]). See [[*The
3716 global TODO list]], for more information.
3718 - {{{kbd(S-M-RET)}}} (~org-insert-todo-heading~) ::
3721 #+findex: org-insert-todo-heading
3722 Insert a new TODO entry below the current one.
3724 #+vindex: org-todo-state-tags-triggers
3725 #+texinfo: @noindent
3726 Changing a TODO state can also trigger tag changes. See the docstring
3727 of the option ~org-todo-state-tags-triggers~ for details.
3729 ** Extended Use of TODO Keywords
3731 :DESCRIPTION: Workflow and assignments.
3732 :ALT_TITLE: TODO Extensions
3734 #+cindex: extended TODO keywords
3736 #+vindex: org-todo-keywords
3737 By default, marked TODO entries have one of only two states: TODO and
3738 DONE. Org mode allows you to classify TODO items in more complex ways
3739 with /TODO keywords/ (stored in ~org-todo-keywords~). With special
3740 setup, the TODO keyword system can work differently in different
3743 Note that /tags/ are another way to classify headlines in general and
3744 TODO items in particular (see [[*Tags]]).
3746 *** TODO keywords as workflow states
3748 :DESCRIPTION: From TODO to DONE in steps.
3749 :ALT_TITLE: Workflow states
3751 #+cindex: TODO workflow
3752 #+cindex: workflow states as TODO keywords
3754 You can use TODO keywords to indicate different /sequential/ states in
3755 the process of working on an item, for example[fn:37]:
3757 #+begin_src emacs-lisp
3758 (setq org-todo-keywords
3759 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
3762 The vertical bar separates the TODO keywords (states that /need
3763 action/) from the DONE states (which need /no further action/). If
3764 you do not provide the separator bar, the last state is used as the
3767 #+cindex: completion, of TODO keywords
3768 With this setup, the command {{{kbd(C-c C-t)}}} cycles an entry from
3769 =TODO= to =FEEDBACK=, then to =VERIFY=, and finally to =DONE= and
3770 =DELEGATED=. You may also use a numeric prefix argument to quickly
3771 select a specific state. For example {{{kbd(C-3 C-c C-t)}}} changes
3772 the state immediately to =VERIFY=. Or you can use {{{kbd(S-LEFT)}}}
3773 to go backward through the sequence. If you define many keywords, you
3774 can use in-buffer completion (see [[*Completion]]) or even a special
3775 one-key selection scheme (see [[*Fast access to TODO states]]) to insert
3776 these words into the buffer. Changing a TODO state can be logged with
3777 a timestamp, see [[*Tracking TODO state changes]], for more information.
3779 *** TODO keywords as types
3781 :DESCRIPTION: I do this, Fred does the rest.
3782 :ALT_TITLE: TODO types
3784 #+cindex: TODO types
3785 #+cindex: names as TODO keywords
3786 #+cindex: types as TODO keywords
3788 The second possibility is to use TODO keywords to indicate different
3789 /types/ of action items. For example, you might want to indicate that
3790 items are for "work" or "home". Or, when you work with several people
3791 on a single project, you might want to assign action items directly to
3792 persons, by using their names as TODO keywords. This would be set up
3795 #+begin_src emacs-lisp
3796 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
3799 In this case, different keywords do not indicate a sequence, but
3800 rather different types. So the normal work flow would be to assign
3801 a task to a person, and later to mark it DONE. Org mode supports this
3802 style by adapting the workings of the command {{{kbd(C-c
3803 C-t)}}}[fn:38]. When used several times in succession, it still
3804 cycles through all names, in order to first select the right type for
3805 a task. But when you return to the item after some time and execute
3806 {{{kbd(C-c C-t)}}} again, it will switch from any name directly to
3807 =DONE=. Use prefix arguments or completion to quickly select
3808 a specific name. You can also review the items of a specific TODO
3809 type in a sparse tree by using a numeric prefix to {{{kbd(C-c / t)}}}.
3810 For example, to see all things Lucy has to do, you would use
3811 {{{kbd(C-3 C-c / t)}}}. To collect Lucy's items from all agenda files
3812 into a single buffer, you would use the numeric prefix argument as
3813 well when creating the global TODO list: {{{kbd(C-3 M-x org-agenda
3816 *** Multiple keyword sets in one file
3818 :DESCRIPTION: Mixing it all, still finding your way.
3819 :ALT_TITLE: Multiple sets in one file
3821 #+cindex: TODO keyword sets
3823 Sometimes you may want to use different sets of TODO keywords in
3824 parallel. For example, you may want to have the basic TODO/DONE, but
3825 also a workflow for bug fixing, and a separate state indicating that
3826 an item has been canceled---so it is not DONE, but also does not
3827 require action. Your setup would then look like this:
3829 #+begin_src emacs-lisp
3830 (setq org-todo-keywords
3831 '((sequence "TODO" "|" "DONE")
3832 (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
3833 (sequence "|" "CANCELED")))
3836 The keywords should all be different, this helps Org mode keep track
3837 of which subsequence should be used for a given entry. In this setup,
3838 {{{kbd(C-c C-t)}}} only operates within a sub-sequence, so it switches
3839 from =DONE= to (nothing) to =TODO=, and from =FIXED= to (nothing) to
3840 =REPORT=. Therefore you need a mechanism to initially select the
3841 correct sequence. In addition to typing a keyword or using completion
3842 (see [[*Completion]]), you may also apply the following commands:
3844 #+attr_texinfo: :sep ,
3845 - {{{kbd(C-u C-u C-c C-t)}}}, {{{kbd(C-S-RIGHT)}}}, {{{kbd(C-S-LEFT)}}} ::
3849 #+kindex: C-u C-u C-c C-t
3850 These keys jump from one TODO sub-sequence to the next. In the
3851 above example, {{{kbd(C-u C-u C-c C-t)}}} or {{{kbd(C-S-RIGHT)}}}
3852 would jump from =TODO= or =DONE= to =REPORT=, and any of the
3853 words in the second row to =CANCELED=. Note that the
3854 {{{kbd(C-S-)}}} key binding conflict with ~shift-selection-mode~
3855 (see [[*Packages that conflict with Org mode]]).
3857 - {{{kbd(S-RIGHT)}}}, {{{kbd(S-LEFT)}}} ::
3861 {{{kbd(S-LEFT)}}} and {{{kbd(S-RIGHT)}}} walk through /all/
3862 keywords from all sub-sequences, so for example
3863 {{{kbd(S-RIGHT)}}} would switch from =DONE= to =REPORT= in the
3864 example above. For a discussion of the interaction with
3865 ~shift-selection-mode~, see [[*Packages that conflict with Org
3868 *** Fast access to TODO states
3870 :DESCRIPTION: Single letter selection of state.
3873 If you would like to quickly change an entry to an arbitrary TODO
3874 state instead of cycling through the states, you can set up keys for
3875 single-letter access to the states. This is done by adding the
3876 selection character after each keyword, in parentheses[fn:39]. For
3879 #+begin_src emacs-lisp
3880 (setq org-todo-keywords
3881 '((sequence "TODO(t)" "|" "DONE(d)")
3882 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
3883 (sequence "|" "CANCELED(c)")))
3886 #+vindex: org-fast-tag-selection-include-todo
3887 If you then press {{{kbd(C-c C-t)}}} followed by the selection key,
3888 the entry is switched to this state. {{{kbd(SPC)}}} can be used to
3889 remove any TODO keyword from an entry[fn:40].
3891 *** Setting up keywords for individual files
3893 :DESCRIPTION: Different files, different requirements.
3894 :ALT_TITLE: Per-file keywords
3896 #+cindex: keyword options
3897 #+cindex: per-file keywords
3898 #+cindex: @samp{TODO}, keyword
3899 #+cindex: @samp{TYP_TODO}, keyword
3900 #+cindex: @samp{SEQ_TODO}, keyword
3902 It can be very useful to use different aspects of the TODO mechanism
3903 in different files. For file-local settings, you need to add special
3904 lines to the file which set the keywords and interpretation for that
3905 file only. For example, to set one of the two examples discussed
3906 above, you need one of the following lines, starting in column zero
3907 anywhere in the file:
3909 : #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
3911 #+texinfo: @noindent
3912 You may also write =#+SEQ_TODO= to be explicit about the
3913 interpretation, but it means the same as =#+TODO=, or
3915 : #+TYP_TODO: Fred Sara Lucy Mike | DONE
3917 A setup for using several sets in parallel would be:
3920 ,#+TODO: TODO | DONE
3921 ,#+TODO: REPORT BUG KNOWNCAUSE | FIXED
3925 #+cindex: completion, of option keywords
3927 #+texinfo: @noindent
3928 To make sure you are using the correct keyword, type =#+= into the
3929 buffer and then use {{{kbd(M-TAB)}}} to complete it (see [[*Completion]]).
3931 #+cindex: DONE, final TODO keyword
3932 Remember that the keywords after the vertical bar---or the last
3933 keyword if no bar is there---must always mean that the item is DONE,
3934 although you may use a different word. After changing one of these
3935 lines, use {{{kbd(C-c C-c)}}} with point still in the line to make the
3936 changes known to Org mode[fn:41].
3938 *** Faces for TODO keywords
3940 :DESCRIPTION: Highlighting states.
3942 #+cindex: faces, for TODO keywords
3944 #+vindex: org-todo, face
3945 #+vindex: org-done, face
3946 #+vindex: org-todo-keyword-faces
3947 Org mode highlights TODO keywords with special faces: ~org-todo~ for
3948 keywords indicating that an item still has to be acted upon, and
3949 ~org-done~ for keywords indicating that an item is finished. If you
3950 are using more than two different states, you might want to use
3951 special faces for some of them. This can be done using the variable
3952 ~org-todo-keyword-faces~. For example:
3954 #+begin_src emacs-lisp
3955 (setq org-todo-keyword-faces
3956 '(("TODO" . org-warning) ("STARTED" . "yellow")
3957 ("CANCELED" . (:foreground "blue" :weight bold))))
3960 #+vindex: org-faces-easy-properties
3961 While using a list with face properties as shown for =CANCELED=
3962 /should/ work, this does not always seem to be the case. If
3963 necessary, define a special face and use that. A string is
3964 interpreted as a color. The variable ~org-faces-easy-properties~
3965 determines if that color is interpreted as a foreground or
3968 *** TODO dependencies
3970 :DESCRIPTION: When one task needs to wait for others.
3972 #+cindex: TODO dependencies
3973 #+cindex: dependencies, of TODO states
3975 #+vindex: org-enforce-todo-dependencies
3976 #+cindex: @samp{ORDERED}, property
3977 The structure of Org files---hierarchy and lists---makes it easy to
3978 define TODO dependencies. Usually, a parent TODO task should not be
3979 marked DONE until all TODO subtasks, or children tasks, are marked as
3980 DONE. Sometimes there is a logical sequence to (sub)tasks, so that
3981 one subtask cannot be acted upon before all siblings above it have
3982 been marked DONE. If you customize the variable
3983 ~org-enforce-todo-dependencies~, Org blocks entries from changing
3984 state to DONE while they have TODO children that are not DONE.
3985 Furthermore, if an entry has a property =ORDERED=, each of its TODO
3986 children is blocked until all earlier siblings are marked DONE. Here
3990 ,* TODO Blocked until (two) is done
3999 ,** TODO b, needs to wait for (a)
4000 ,** TODO c, needs to wait for (a) and (b)
4003 #+cindex: TODO dependencies, @samp{NOBLOCKING}
4004 #+cindex: @samp{NOBLOCKING}, property
4005 You can ensure an entry is never blocked by using the =NOBLOCKING=
4006 property (see [[*Properties and Columns]]):
4009 ,* This entry is never blocked
4015 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
4018 #+findex: org-toggle-ordered-property
4019 #+vindex: org-track-ordered-property-with-tag
4020 Toggle the =ORDERED= property of the current entry. A property
4021 is used for this behavior because this should be local to the
4022 current entry, not inherited from entries above like a tag (see
4023 [[*Tags]]). However, if you would like to /track/ the value of this
4024 property with a tag for better visibility, customize the variable
4025 ~org-track-ordered-property-with-tag~.
4027 - {{{kbd(C-u C-u C-u C-c C-t)}}} ::
4029 #+kindex: C-u C-u C-u C-c C-t
4030 Change TODO state, regardless of any state blocking.
4032 #+vindex: org-agenda-dim-blocked-tasks
4033 If you set the variable ~org-agenda-dim-blocked-tasks~, TODO entries
4034 that cannot be marked DONE because of unmarked children are shown in a
4035 dimmed font or even made invisible in agenda views (see [[*Agenda
4038 #+cindex: checkboxes and TODO dependencies
4039 #+vindex: org-enforce-todo-dependencies
4040 You can also block changes of TODO states by using checkboxes (see
4041 [[*Checkboxes]]). If you set the variable
4042 ~org-enforce-todo-checkbox-dependencies~, an entry that has unchecked
4043 checkboxes is blocked from switching to DONE.
4045 If you need more complex dependency structures, for example
4046 dependencies between entries in different trees or files, check out
4047 the contributed module =org-depend.el=.
4051 :DESCRIPTION: Dates and notes for progress.
4053 #+cindex: progress logging
4054 #+cindex: logging, of progress
4056 Org mode can automatically record a timestamp and optionally a note
4057 when you mark a TODO item as DONE, or even each time you change the
4058 state of a TODO item. This system is highly configurable, settings
4059 can be on a per-keyword basis and can be localized to a file or even a
4060 subtree. For information on how to clock working time for a task, see
4061 [[*Clocking Work Time]].
4065 :DESCRIPTION: When was this entry marked DONE?
4068 The most basic logging is to keep track of /when/ a certain TODO item
4069 was marked DONE. This can be achieved with[fn:42]
4071 #+begin_src emacs-lisp
4072 (setq org-log-done 'time)
4075 #+vindex: org-closed-keep-when-no-todo
4076 #+texinfo: @noindent
4077 Then each time you turn an entry from a TODO (not-done) state into any
4078 of the DONE states, a line =CLOSED: [timestamp]= is inserted just
4079 after the headline. If you turn the entry back into a TODO item
4080 through further state cycling, that line is removed again. If you
4081 turn the entry back to a non-TODO state (by pressing {{{kbd(C-c C-t
4082 SPC)}}} for example), that line is also removed, unless you set
4083 ~org-closed-keep-when-no-todo~ to non-~nil~. If you want to record
4084 a note along with the timestamp, use[fn:43]
4086 #+begin_src emacs-lisp
4087 (setq org-log-done 'note)
4090 #+texinfo: @noindent
4091 You are then be prompted for a note, and that note is stored below the
4092 entry with a =Closing Note= heading.
4094 *** Tracking TODO state changes
4096 :DESCRIPTION: When did the status change?
4098 #+cindex: drawer, for state change recording
4100 #+vindex: org-log-states-order-reversed
4101 #+vindex: org-log-into-drawer
4102 #+cindex: @samp{LOG_INTO_DRAWER}, property
4103 When TODO keywords are used as workflow states (see [[*TODO keywords as workflow states][*Workflow states]]),
4104 you might want to keep track of when a state change occurred and maybe
4105 take a note about this change. You can either record just a
4106 timestamp, or a time-stamped note. These records are inserted after
4107 the headline as an itemized list, newest first[fn:44]. When taking a
4108 lot of notes, you might want to get the notes out of the way into a
4109 drawer (see [[*Drawers]]). Customize the variable ~org-log-into-drawer~
4110 to get this behavior---the recommended drawer for this is called
4111 =LOGBOOK=[fn:45]. You can also overrule the setting of this variable
4112 for a subtree by setting a =LOG_INTO_DRAWER= property.
4114 Since it is normally too much to record a note for every state, Org
4115 mode expects configuration on a per-keyword basis for this. This is
4116 achieved by adding special markers =!= (for a timestamp) or =@= (for
4117 a note with timestamp) in parentheses after each keyword. For
4118 example, with the setting
4120 #+begin_src emacs-lisp
4121 (setq org-todo-keywords
4122 '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)")))
4125 #+texinfo: @noindent
4126 to record a timestamp without a note for TODO keywords configured with
4127 =@=, just type {{{kbd(C-c C-c)}}} to enter a blank note when prompted.
4129 #+vindex: org-log-done
4130 #+texinfo: @noindent
4131 You not only define global TODO keywords and fast access keys, but
4132 also request that a time is recorded when the entry is set to =DONE=,
4133 and that a note is recorded when switching to =WAIT= or
4134 =CANCELED=[fn:46]. The setting for =WAIT= is even more special: the
4135 =!= after the slash means that in addition to the note taken when
4136 entering the state, a timestamp should be recorded when /leaving/ the
4137 =WAIT= state, if and only if the /target/ state does not configure
4138 logging for entering it. So it has no effect when switching from
4139 =WAIT= to =DONE=, because =DONE= is configured to record a timestamp
4140 only. But when switching from =WAIT= back to =TODO=, the =/!= in the
4141 =WAIT= setting now triggers a timestamp even though =TODO= has no
4144 You can use the exact same syntax for setting logging preferences local
4147 : #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)
4149 #+cindex: @samp{LOGGING}, property
4150 In order to define logging settings that are local to a subtree or
4151 a single item, define a =LOGGING= property in this entry. Any
4152 non-empty =LOGGING= property resets all logging settings to ~nil~.
4153 You may then turn on logging for this specific tree using =STARTUP=
4154 keywords like =lognotedone= or =logrepeat=, as well as adding state
4155 specific settings like =TODO(!)=. For example:
4158 ,* TODO Log each state with only a time
4160 :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
4162 ,* TODO Only log when switching to WAIT, and when repeating
4164 :LOGGING: WAIT(@) logrepeat
4166 ,* TODO No logging at all
4172 *** Tracking your habits
4174 :DESCRIPTION: How consistent have you been?
4177 #+cindex: @samp{STYLE}, property
4179 Org has the ability to track the consistency of a special category of
4180 TODO, called "habits." To use habits, you have to enable the ~habits~
4181 module by customizing the variable ~org-modules~.
4183 A habit has the following properties:
4185 1. The habit is a TODO item, with a TODO keyword representing an open
4188 2. The property =STYLE= is set to the value =habit= (see [[*Properties
4191 3. The TODO has a scheduled date, usually with a =.+= style repeat
4192 interval. A =++= style may be appropriate for habits with time
4193 constraints, e.g., must be done on weekends, or a =+= style for an
4194 unusual habit that can have a backlog, e.g., weekly reports.
4196 4. The TODO may also have minimum and maximum ranges specified by
4197 using the syntax =.+2d/3d=, which says that you want to do the task
4198 at least every three days, but at most every two days.
4200 5. State logging for the DONE state is enabled (see [[*Tracking TODO
4201 state changes]]), in order for historical data to be represented in
4202 the consistency graph. If it is not enabled it is not an error,
4203 but the consistency graphs are largely meaningless.
4205 To give you an idea of what the above rules look like in action, here's an
4206 actual habit with some history:
4210 SCHEDULED: <2009-10-17 Sat .+2d/4d>
4213 :LAST_REPEAT: [2009-10-19 Mon 00:36]
4215 - State "DONE" from "TODO" [2009-10-15 Thu]
4216 - State "DONE" from "TODO" [2009-10-12 Mon]
4217 - State "DONE" from "TODO" [2009-10-10 Sat]
4218 - State "DONE" from "TODO" [2009-10-04 Sun]
4219 - State "DONE" from "TODO" [2009-10-02 Fri]
4220 - State "DONE" from "TODO" [2009-09-29 Tue]
4221 - State "DONE" from "TODO" [2009-09-25 Fri]
4222 - State "DONE" from "TODO" [2009-09-19 Sat]
4223 - State "DONE" from "TODO" [2009-09-16 Wed]
4224 - State "DONE" from "TODO" [2009-09-12 Sat]
4227 What this habit says is: I want to shave at most every 2 days---given
4228 by the =SCHEDULED= date and repeat interval---and at least every
4229 4 days. If today is the 15th, then the habit first appears in the
4230 agenda (see [[*Agenda Views]]) on Oct 17, after the minimum of 2 days has
4231 elapsed, and will appear overdue on Oct 19, after four days have
4234 What's really useful about habits is that they are displayed along
4235 with a consistency graph, to show how consistent you've been at
4236 getting that task done in the past. This graph shows every day that
4237 the task was done over the past three weeks, with colors for each day.
4238 The colors used are:
4240 - Blue :: If the task was not to be done yet on that day.
4241 - Green :: If the task could have been done on that day.
4242 - Yellow :: If the task was going to be overdue the next day.
4243 - Red :: If the task was overdue on that day.
4245 In addition to coloring each day, the day is also marked with an
4246 asterisk if the task was actually done that day, and an exclamation
4247 mark to show where the current day falls in the graph.
4249 There are several configuration variables that can be used to change
4250 the way habits are displayed in the agenda.
4252 - ~org-habit-graph-column~ ::
4254 #+vindex: org-habit-graph-column
4255 The buffer column at which the consistency graph should be drawn.
4256 This overwrites any text in that column, so it is a good idea to
4257 keep your habits' titles brief and to the point.
4259 - ~org-habit-preceding-days~ ::
4261 #+vindex: org-habit-preceding-days
4262 The amount of history, in days before today, to appear in
4265 - ~org-habit-following-days~ ::
4267 #+vindex: org-habit-following-days
4268 The number of days after today that appear in consistency graphs.
4270 - ~org-habit-show-habits-only-for-today~ ::
4272 #+vindex: org-habit-show-habits-only-for-today
4273 If non-~nil~, only show habits in today's agenda view. The
4274 default value is ~t~.
4276 Lastly, pressing {{{kbd(K)}}} in the agenda buffer causes habits to
4277 temporarily be disabled and do not appear at all. Press {{{kbd(K)}}}
4278 again to bring them back. They are also subject to tag filtering, if
4279 you have habits which should only be done in certain contexts, for
4284 :DESCRIPTION: Some things are more important than others.
4286 #+cindex: priorities
4287 #+cindex: priority cookie
4289 If you use Org mode extensively, you may end up with enough TODO items
4290 that it starts to make sense to prioritize them. Prioritizing can be
4291 done by placing a /priority cookie/ into the headline of a TODO item,
4294 : *** TODO [#A] Write letter to Sam Fortune
4296 #+vindex: org-priority-faces
4297 #+texinfo: @noindent
4298 By default, Org mode supports three priorities: =A=, =B=, and =C=.
4299 =A= is the highest priority. An entry without a cookie is treated as
4300 equivalent if it had priority =B=. Priorities make a difference only
4301 for sorting in the agenda (see [[*Weekly/daily agenda]]); outside the
4302 agenda, they have no inherent meaning to Org mode. The cookies are
4303 displayed with the face defined by the variable ~org-priority-faces~,
4304 which can be customized.
4306 Priorities can be attached to any outline node; they do not need to be
4309 #+attr_texinfo: :sep ;
4310 - {{{kbd(C-c \,)}}} (~org-priority~) ::
4313 #+findex: org-priority
4314 Set the priority of the current headline. The command prompts
4315 for a priority character =A=, =B= or =C=. When you press
4316 {{{kbd(SPC)}}} instead, the priority cookie, if one is set, is
4317 removed from the headline. The priorities can also be changed
4318 "remotely" from the agenda buffer with the {{{kbd(\,)}}} command
4319 (see [[*Commands in the Agenda Buffer]]).
4321 - {{{kbd(S-UP)}}} (~org-priority-up~); {{{kbd(S-DOWN)}}} (~org-priority-down~) ::
4325 #+findex: org-priority-up
4326 #+findex: org-priority-down
4327 #+vindex: org-priority-start-cycle-with-default
4328 Increase/decrease the priority of the current headline[fn:47].
4329 Note that these keys are also used to modify timestamps (see
4330 [[*Creating Timestamps]]). See also [[*Packages that conflict with Org
4331 mode]], for a discussion of the interaction with
4332 ~shift-selection-mode~.
4334 #+vindex: org-highest-priority
4335 #+vindex: org-lowest-priority
4336 #+vindex: org-default-priority
4337 You can change the range of allowed priorities by setting the
4338 variables ~org-highest-priority~, ~org-lowest-priority~, and
4339 ~org-default-priority~. For an individual buffer, you may set these
4340 values (highest, lowest, default) like this (please make sure that the
4341 highest priority is earlier in the alphabet than the lowest priority):
4343 #+cindex: @samp{PRIORITIES}, keyword
4344 : #+PRIORITIES: A C B
4346 ** Breaking Down Tasks into Subtasks
4348 :DESCRIPTION: Splitting a task into manageable pieces.
4349 :ALT_TITLE: Breaking Down Tasks
4351 #+cindex: tasks, breaking down
4352 #+cindex: statistics, for TODO items
4354 #+vindex: org-agenda-todo-list-sublevels
4355 It is often advisable to break down large tasks into smaller,
4356 manageable subtasks. You can do this by creating an outline tree
4357 below a TODO item, with detailed subtasks on the tree[fn:48]. To keep
4358 an overview of the fraction of subtasks that have already been marked
4359 DONE, insert either =[/]= or =[%]= anywhere in the headline. These
4360 cookies are updated each time the TODO status of a child changes, or
4361 when pressing {{{kbd(C-c C-c)}}} on the cookie. For example:
4364 ,* Organize Party [33%]
4365 ,** TODO Call people [1/2]
4369 ,** DONE Talk to neighbor
4372 #+cindex: @samp{COOKIE_DATA}, property
4373 If a heading has both checkboxes and TODO children below it, the
4374 meaning of the statistics cookie become ambiguous. Set the property
4375 =COOKIE_DATA= to either =checkbox= or =todo= to resolve this issue.
4377 #+vindex: org-hierarchical-todo-statistics
4378 If you would like to have the statistics cookie count any TODO entries
4379 in the subtree (not just direct children), configure the variable
4380 ~org-hierarchical-todo-statistics~. To do this for a single subtree,
4381 include the word =recursive= into the value of the =COOKIE_DATA=
4385 ,* Parent capturing statistics [2/20]
4387 :COOKIE_DATA: todo recursive
4391 If you would like a TODO entry to automatically change to DONE when
4392 all children are done, you can use the following setup:
4394 #+begin_src emacs-lisp
4395 (defun org-summary-todo (n-done n-not-done)
4396 "Switch entry to DONE when all subentries are done, to TODO otherwise."
4397 (let (org-log-done org-log-states) ; turn off logging
4398 (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
4400 (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
4403 Another possibility is the use of checkboxes to identify (a hierarchy
4404 of) a large number of subtasks (see [[*Checkboxes]]).
4408 :DESCRIPTION: Tick-off lists.
4410 #+cindex: checkboxes
4412 #+vindex: org-list-automatic-rules
4413 Every item in a plain list[fn:49] (see [[*Plain Lists]]) can be made into
4414 a checkbox by starting it with the string =[ ]=. This feature is
4415 similar to TODO items (see [[*TODO Items]]), but is more lightweight.
4416 Checkboxes are not included into the global TODO list, so they are
4417 often great to split a task into a number of simple steps. Or you can
4418 use them in a shopping list. To toggle a checkbox, use {{{kbd(C-c
4419 C-c)}}}, or use the mouse (thanks to Piotr Zielinski's
4422 Here is an example of a checkbox list.
4425 ,* TODO Organize party [2/4]
4426 - [-] call people [1/3]
4431 - [ ] think about what music to play
4432 - [X] talk to the neighbors
4435 Checkboxes work hierarchically, so if a checkbox item has children
4436 that are checkboxes, toggling one of the children checkboxes makes the
4437 parent checkbox reflect if none, some, or all of the children are
4440 #+cindex: statistics, for checkboxes
4441 #+cindex: checkbox statistics
4442 #+cindex: @samp{COOKIE_DATA}, property
4443 #+vindex: org-hierarchical-checkbox-statistics
4444 The =[2/4]= and =[1/3]= in the first and second line are cookies
4445 indicating how many checkboxes present in this entry have been checked
4446 off, and the total number of checkboxes present. This can give you an
4447 idea on how many checkboxes remain, even without opening a folded
4448 entry. The cookies can be placed into a headline or into (the first
4449 line of) a plain list item. Each cookie covers checkboxes of direct
4450 children structurally below the headline/item on which the cookie
4451 appears[fn:50]. You have to insert the cookie yourself by typing
4452 either =[/]= or =[%]=. With =[/]= you get an =n out of m= result, as
4453 in the examples above. With =[%]= you get information about the
4454 percentage of checkboxes checked (in the above example, this would be
4455 =[50%]= and =[33%]=, respectively). In a headline, a cookie can count
4456 either checkboxes below the heading or TODO states of children, and it
4457 displays whatever was changed last. Set the property =COOKIE_DATA= to
4458 either =checkbox= or =todo= to resolve this issue.
4460 #+cindex: blocking, of checkboxes
4461 #+cindex: checkbox blocking
4462 #+cindex: @samp{ORDERED}, property
4463 If the current outline node has an =ORDERED= property, checkboxes must
4464 be checked off in sequence, and an error is thrown if you try to check
4465 off a box while there are unchecked boxes above it.
4467 #+texinfo: @noindent
4468 The following commands work with checkboxes:
4470 - {{{kbd(C-c C-c)}}} (~org-toggle-checkbox~) ::
4473 #+findex: org-toggle-checkbox
4474 Toggle checkbox status or---with prefix argument---checkbox
4475 presence at point. With a single prefix argument, add an empty
4476 checkbox or remove the current one[fn:51]. With a double prefix
4477 argument, set it to =[-]=, which is considered to be an
4480 - {{{kbd(C-c C-x C-b)}}} (~org-toggle-checkbox~) ::
4482 #+kindex: C-c C-x C-b
4483 Toggle checkbox status or---with prefix argument---checkbox
4484 presence at point. With double prefix argument, set it to =[-]=,
4485 which is considered to be an intermediate state.
4487 - If there is an active region, toggle the first checkbox in the
4488 region and set all remaining boxes to the same status as the
4489 first. With a prefix argument, add or remove the checkbox for
4490 all items in the region.
4492 - If point is in a headline, toggle checkboxes in the region
4493 between this headline and the next---so /not/ the entire
4496 - If there is no active region, just toggle the checkbox at
4499 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) ::
4502 #+findex: org-insert-todo-heading
4503 Insert a new item with a checkbox. This works only if point
4504 is already in a plain list item (see [[*Plain Lists]]).
4506 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) ::
4509 #+findex: org-toggle-ordered-property
4510 #+vindex: org-track-ordered-property-with-tag
4511 Toggle the =ORDERED= property of the entry, to toggle if
4512 checkboxes must be checked off in sequence. A property is used
4513 for this behavior because this should be local to the current
4514 entry, not inherited like a tag. However, if you would like to
4515 /track/ the value of this property with a tag for better
4516 visibility, customize ~org-track-ordered-property-with-tag~.
4518 - {{{kbd(C-c #)}}} (~org-update-statistics-cookies~) ::
4521 #+findex: org-update-statistics-cookies
4522 Update the statistics cookie in the current outline entry. When
4523 called with a {{{kbd(C-u)}}} prefix, update the entire file.
4524 Checkbox statistic cookies are updated automatically if you
4525 toggle checkboxes with {{{kbd(C-c C-c)}}} and make new ones with
4526 {{{kbd(M-S-RET)}}}. TODO statistics cookies update when changing
4527 TODO states. If you delete boxes/entries or add/change them by
4528 hand, use this command to get things back into sync.
4532 :DESCRIPTION: Tagging headlines and matching sets of tags.
4535 #+cindex: headline tagging
4536 #+cindex: matching, tags
4537 #+cindex: sparse tree, tag based
4539 An excellent way to implement labels and contexts for
4540 cross-correlating information is to assign /tags/ to headlines. Org
4541 mode has extensive support for tags.
4543 #+vindex: org-tag-faces
4544 Every headline can contain a list of tags; they occur at the end of
4545 the headline. Tags are normal words containing letters, numbers, =_=,
4546 and =@=. Tags must be preceded and followed by a single colon, e.g.,
4547 =:work:=. Several tags can be specified, as in =:work:urgent:=. Tags
4548 by default are in bold face with the same color as the headline. You
4549 may specify special faces for specific tags using the variable
4550 ~org-tag-faces~, in much the same way as you can for TODO keywords
4551 (see [[*Faces for TODO keywords]]).
4555 :DESCRIPTION: Tags use the tree structure of an outline.
4557 #+cindex: tag inheritance
4558 #+cindex: inheritance, of tags
4559 #+cindex: sublevels, inclusion into tags match
4561 /Tags/ make use of the hierarchical structure of outline trees. If
4562 a heading has a certain tag, all subheadings inherit the tag as well.
4563 For example, in the list
4566 ,* Meeting with the French group :work:
4567 ,** Summary by Frank :boss:notes:
4568 ,*** TODO Prepare slides for him :action:
4571 #+texinfo: @noindent
4572 the final heading has the tags =work=, =boss=, =notes=, and =action=
4573 even though the final heading is not explicitly marked with those
4574 tags. You can also set tags that all entries in a file should inherit
4575 just as if these tags were defined in a hypothetical level zero that
4576 surrounds the entire file. Use a line like this[fn:52]
4578 #+cindex: @samp{FILETAGS}, keyword
4579 : #+FILETAGS: :Peter:Boss:Secret:
4581 #+vindex: org-use-tag-inheritance
4582 #+vindex: org-tags-exclude-from-inheritance
4583 #+texinfo: @noindent
4584 To limit tag inheritance to specific tags, or to turn it off entirely,
4585 use the variables ~org-use-tag-inheritance~ and
4586 ~org-tags-exclude-from-inheritance~.
4588 #+vindex: org-tags-match-list-sublevels
4589 When a headline matches during a tags search while tag inheritance is
4590 turned on, all the sublevels in the same tree---for a simple match
4591 form---match as well[fn:53]. The list of matches may then become
4592 very long. If you only want to see the first tags match in a subtree,
4593 configure the variable ~org-tags-match-list-sublevels~ (not
4596 #+vindex: org-agenda-use-tag-inheritance
4597 Tag inheritance is relevant when the agenda search tries to match
4598 a tag, either in the ~tags~ or ~tags-todo~ agenda types. In other
4599 agenda types, ~org-use-tag-inheritance~ has no effect. Still, you may
4600 want to have your tags correctly set in the agenda, so that tag
4601 filtering works fine, with inherited tags. Set
4602 ~org-agenda-use-tag-inheritance~ to control this: the default value
4603 includes all agenda types, but setting this to ~nil~ can really speed
4604 up agenda generation.
4608 :DESCRIPTION: How to assign tags to a headline.
4610 #+cindex: setting tags
4611 #+cindex: tags, setting
4614 Tags can simply be typed into the buffer at the end of a headline.
4615 After a colon, {{{kbd(M-TAB)}}} offers completion on tags. There is
4616 also a special command for inserting tags:
4618 - {{{kbd(C-c C-q)}}} (~org-set-tags-command~) ::
4621 #+findex: org-set-tags-command
4622 #+cindex: completion, of tags
4623 #+vindex: org-tags-column
4624 Enter new tags for the current headline. Org mode either offers
4625 completion or a special single-key interface for setting tags,
4626 see below. After pressing {{{kbd(RET)}}}, the tags are inserted
4627 and aligned to ~org-tags-column~. When called with
4628 a {{{kbd(C-u)}}} prefix, all tags in the current buffer are
4629 aligned to that column, just to make things look nice. Tags are
4630 automatically realigned after promotion, demotion, and TODO state
4631 changes (see [[*Basic TODO Functionality]]).
4633 - {{{kbd(C-c C-c)}}} (~org-set-tags-command~) ::
4636 When point is in a headline, this does the same as {{{kbd(C-c
4639 #+vindex: org-complete-tags-always-offer-all-agenda-tags
4640 #+vindex: org-tag-alist
4641 #+cindex: @samp{TAGS}, keyword
4642 Org supports tag insertion based on a /list of tags/. By default this
4643 list is constructed dynamically, containing all tags currently used in
4644 the buffer[fn:54]. You may also globally specify a hard list of tags
4645 with the variable ~org-tag-alist~. Finally you can set the default
4646 tags for a given file using the =TAGS= keyword, like
4649 ,#+TAGS: @work @home @tennisclub
4650 ,#+TAGS: laptop car pc sailboat
4653 If you have globally defined your preferred set of tags using the
4654 variable ~org-tag-alist~, but would like to use a dynamic tag list in
4655 a specific file, add an empty =TAGS= keyword to that file:
4659 #+vindex: org-tag-persistent-alist
4660 If you have a preferred set of tags that you would like to use in
4661 every file, in addition to those defined on a per-file basis by =TAGS=
4662 keyword, then you may specify a list of tags with the variable
4663 ~org-tag-persistent-alist~. You may turn this off on a per-file basis
4664 by adding a =STARTUP= keyword to that file:
4668 By default Org mode uses the standard minibuffer completion facilities
4669 for entering tags. However, it also implements another, quicker, tag
4670 selection method called /fast tag selection/. This allows you to
4671 select and deselect tags with just a single key press. For this to
4672 work well you should assign unique letters to most of your commonly
4673 used tags. You can do this globally by configuring the variable
4674 ~org-tag-alist~ in your Emacs init file. For example, you may find
4675 the need to tag many items in different files with =@home=. In this
4676 case you can set something like:
4678 #+begin_src emacs-lisp
4679 (setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l)))
4682 #+texinfo: @noindent
4683 If the tag is only relevant to the file you are working on, then you
4684 can instead set the =TAGS= keyword as:
4686 : #+TAGS: @work(w) @home(h) @tennisclub(t) laptop(l) pc(p)
4688 #+texinfo: @noindent
4689 The tags interface shows the available tags in a splash window. If
4690 you want to start a new line after a specific tag, insert =\n= into
4693 : #+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p)
4695 #+texinfo: @noindent
4696 or write them in two lines:
4699 ,#+TAGS: @work(w) @home(h) @tennisclub(t)
4700 ,#+TAGS: laptop(l) pc(p)
4703 #+texinfo: @noindent
4704 You can also group together tags that are mutually exclusive by using
4707 : #+TAGS: { @work(w) @home(h) @tennisclub(t) } laptop(l) pc(p)
4709 #+texinfo: @noindent
4710 you indicate that at most one of =@work=, =@home=, and =@tennisclub=
4711 should be selected. Multiple such groups are allowed.
4713 #+texinfo: @noindent
4714 Do not forget to press {{{kbd(C-c C-c)}}} with point in one of these
4715 lines to activate any changes.
4717 #+texinfo: @noindent
4718 To set these mutually exclusive groups in the variable
4719 ~org-tags-alist~, you must use the dummy tags ~:startgroup~ and
4720 ~:endgroup~ instead of the braces. Similarly, you can use ~:newline~
4721 to indicate a line break. The previous example would be set globally
4722 by the following configuration:
4724 #+begin_src emacs-lisp
4725 (setq org-tag-alist '((:startgroup . nil)
4726 ("@work" . ?w) ("@home" . ?h)
4727 ("@tennisclub" . ?t)
4729 ("laptop" . ?l) ("pc" . ?p)))
4732 If at least one tag has a selection key then pressing {{{kbd(C-c
4733 C-c)}}} automatically presents you with a special interface, listing
4734 inherited tags, the tags of the current headline, and a list of all
4735 valid tags with corresponding keys[fn:55].
4737 Pressing keys assigned to tags adds or removes them from the list of
4738 tags in the current line. Selecting a tag in a group of mutually
4739 exclusive tags turns off any other tag from that group.
4741 In this interface, you can also use the following special keys:
4746 Enter a tag in the minibuffer, even if the tag is not in the
4747 predefined list. You can complete on all tags present in the
4748 buffer. You can also add several tags: just separate them with
4754 Clear all tags for this line.
4759 Accept the modified set.
4764 Abort without installing changes.
4769 If {{{kbd(q)}}} is not assigned to a tag, it aborts like
4775 Turn off groups of mutually exclusive tags. Use this to (as an
4776 exception) assign several tags from such a group.
4781 Toggle auto-exit after the next change (see below). If you are
4782 using expert mode, the first {{{kbd(C-c)}}} displays the
4785 #+texinfo: @noindent
4786 This method lets you assign tags to a headline with very few keys.
4787 With the above setup, you could clear the current tags and set
4788 =@home=, =laptop= and =pc= tags with just the following keys:
4789 {{{kbd(C-c C-c SPC h l p RET)}}}. Switching from =@home= to =@work=
4790 would be done with {{{kbd(C-c C-c w RET)}}} or alternatively with
4791 {{{kbd(C-c C-c C-c w)}}}. Adding the non-predefined tag =Sarah= could
4792 be done with {{{kbd(C-c C-c TAB S a r a h RET)}}}.
4794 #+vindex: org-fast-tag-selection-single-key
4795 If you find that most of the time you need only a single key press to
4796 modify your list of tags, set the variable
4797 ~org-fast-tag-selection-single-key~. Then you no longer have to press
4798 {{{kbd(RET)}}} to exit fast tag selection---it exits after the first
4799 change. If you then occasionally need more keys, press {{{kbd(C-c)}}}
4800 to turn off auto-exit for the current tag selection process (in
4801 effect: start selection with {{{kbd(C-c C-c C-c)}}} instead of
4802 {{{kbd(C-c C-c)}}}). If you set the variable to the value ~expert~,
4803 the special window is not even shown for single-key tag selection, it
4804 comes up only when you press an extra {{{kbd(C-c)}}}.
4808 :DESCRIPTION: Create a hierarchy of tags.
4810 #+cindex: group tags
4811 #+cindex: tags, groups
4812 #+cindex: tags hierarchy
4814 Tags can be defined in hierarchies. A tag can be defined as a /group
4815 tag/ for a set of other tags. The group tag can be seen as the
4816 "broader term" for its set of tags. Defining multiple group tags and
4817 nesting them creates a tag hierarchy.
4819 One use-case is to create a taxonomy of terms (tags) that can be used
4820 to classify nodes in a document or set of documents.
4822 When you search for a group tag, it return matches for all members in
4823 the group and its subgroups. In an agenda view, filtering by a group
4824 tag displays or hide headlines tagged with at least one of the members
4825 of the group or any of its subgroups. This makes tag searches and
4826 filters even more flexible.
4828 You can set group tags by using brackets and inserting a colon between
4829 the group tag and its related tags---beware that all whitespaces are
4830 mandatory so that Org can parse this line correctly:
4832 : #+TAGS: [ GTD : Control Persp ]
4834 In this example, =GTD= is the group tag and it is related to two other
4835 tags: =Control=, =Persp=. Defining =Control= and =Persp= as group
4836 tags creates a hierarchy of tags:
4839 ,#+TAGS: [ Control : Context Task ]
4840 ,#+TAGS: [ Persp : Vision Goal AOF Project ]
4843 That can conceptually be seen as a hierarchy of tags:
4855 You can use the ~:startgrouptag~, ~:grouptags~ and ~:endgrouptag~
4856 keyword directly when setting ~org-tag-alist~ directly:
4858 #+begin_src emacs-lisp
4859 (setq org-tag-alist '((:startgrouptag)
4873 The tags in a group can be mutually exclusive if using the same group
4874 syntax as is used for grouping mutually exclusive tags together; using
4877 : #+TAGS: { Context : @Home @Work @Call }
4879 When setting ~org-tag-alist~ you can use ~:startgroup~ and ~:endgroup~
4880 instead of ~:startgrouptag~ and ~:endgrouptag~ to make the tags
4883 Furthermore, the members of a group tag can also be regular
4884 expressions, creating the possibility of a more dynamic and rule-based
4885 tag structure. The regular expressions in the group must be specified
4886 within curly brackets. Here is an expanded example:
4889 ,#+TAGS: [ Vision : {V@.+} ]
4890 ,#+TAGS: [ Goal : {G@.+} ]
4891 ,#+TAGS: [ AOF : {AOF@.+} ]
4892 ,#+TAGS: [ Project : {P@.+} ]
4895 Searching for the tag =Project= now lists all tags also including
4896 regular expression matches for =P@.+=, and similarly for tag searches
4897 on =Vision=, =Goal= and =AOF=. For example, this would work well for
4898 a project tagged with a common project-identifier, e.g.,
4902 #+findex: org-toggle-tags-groups
4903 #+vindex: org-group-tags
4904 If you want to ignore group tags temporarily, toggle group tags
4905 support with ~org-toggle-tags-groups~, bound to {{{kbd(C-c C-x q)}}}.
4906 If you want to disable tag groups completely, set ~org-group-tags~ to
4911 :DESCRIPTION: Searching for combinations of tags.
4913 #+cindex: tag searches
4914 #+cindex: searching for tags
4916 Once a system of tags has been set up, it can be used to collect
4917 related information into special lists.
4919 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
4923 #+findex: org-match-sparse-tree
4924 Create a sparse tree with all headlines matching a tags search.
4925 With a {{{kbd(C-u)}}} prefix argument, ignore headlines that are
4928 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) ::
4930 #+kindex: m @r{(Agenda dispatcher)}
4931 #+findex: org-tags-view
4932 Create a global list of tag matches from all agenda files. See
4933 [[*Matching tags and properties]].
4935 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
4937 #+kindex: M @r{(Agenda dispatcher)}
4938 #+vindex: org-tags-match-list-sublevels
4939 Create a global list of tag matches from all agenda files, but
4940 check only TODO items and force checking subitems (see the option
4941 ~org-tags-match-list-sublevels~).
4943 These commands all prompt for a match string which allows basic
4944 Boolean logic like =+boss+urgent-project1=, to find entries with tags
4945 =boss= and =urgent=, but not =project1=, or =Kathy|Sally= to find
4946 entries which are tagged, like =Kathy= or =Sally=. The full syntax of
4947 the search string is rich and allows also matching against TODO
4948 keywords, entry levels and properties. For a complete description
4949 with many examples, see [[*Matching tags and properties]].
4951 * Properties and Columns
4953 :DESCRIPTION: Storing information about an entry.
4955 #+cindex: properties
4957 A property is a key-value pair associated with an entry. Properties
4958 can be set so they are associated with a single entry, with every
4959 entry in a tree, or with every entry in an Org file.
4961 There are two main applications for properties in Org mode. First,
4962 properties are like tags, but with a value. Imagine maintaining
4963 a file where you document bugs and plan releases for a piece of
4964 software. Instead of using tags like =release_1=, =release_2=, you
4965 can use a property, say =Release=, that in different subtrees has
4966 different values, such as =1.0= or =2.0=. Second, you can use
4967 properties to implement (very basic) database capabilities in an Org
4968 buffer. Imagine keeping track of your music CDs, where properties
4969 could be things such as the album, artist, date of release, number of
4972 Properties can be conveniently edited and viewed in column view (see
4977 :DESCRIPTION: How properties are spelled out.
4979 #+cindex: property syntax
4980 #+cindex: drawer, for properties
4982 Properties are key--value pairs. When they are associated with
4983 a single entry or with a tree they need to be inserted into a special
4984 drawer (see [[*Drawers]]) with the name =PROPERTIES=, which has to be
4985 located right below a headline, and its planning line (see [[*Deadlines
4986 and Scheduling]]) when applicable. Each property is specified on
4987 a single line, with the key---surrounded by colons---first, and the
4988 value after it. Keys are case-insensitive. Here is an example:
4993 ,*** Goldberg Variations
4995 :Title: Goldberg Variations
4996 :Composer: J.S. Bach
4997 :Artist: Glenn Gould
4998 :Publisher: Deutsche Grammophon
5003 Depending on the value of ~org-use-property-inheritance~, a property
5004 set this way is associated either with a single entry, or with the
5005 sub-tree defined by the entry, see [[*Property Inheritance]].
5007 You may define the allowed values for a particular property =Xyz= by
5008 setting a property =Xyz_ALL=. This special property is /inherited/,
5009 so if you set it in a level 1 entry, it applies to the entire tree.
5010 When allowed values are defined, setting the corresponding property
5011 becomes easier and is less prone to typing errors. For the example
5012 with the CD collection, we can pre-define publishers and the number of
5013 disks in a box like this:
5018 :NDisks_ALL: 1 2 3 4
5019 :Publisher_ALL: "Deutsche Grammophon" Philips EMI
5023 If you want to set properties that can be inherited by any entry in
5024 a file, use a line like:
5026 #+cindex: @samp{_ALL} suffix, in properties
5027 #+cindex: @samp{PROPERTY}, keyword
5028 : #+PROPERTY: NDisks_ALL 1 2 3 4
5030 #+cindex: @samp{+} suffix, in properties
5031 If you want to add to the value of an existing property, append a =+=
5032 to the property name. The following results in the property =var=
5033 having the value =foo=1 bar=2=.
5036 ,#+PROPERTY: var foo=1
5037 ,#+PROPERTY: var+ bar=2
5040 It is also possible to add to the values of inherited properties. The
5041 following results in the =Genres= property having the value =Classic
5042 Baroque= under the =Goldberg Variations= subtree.
5050 ,*** Goldberg Variations
5052 :Title: Goldberg Variations
5053 :Composer: J.S. Bach
5054 :Artist: Glenn Gould
5055 :Publisher: Deutsche Grammophon
5061 Note that a property can only have one entry per drawer.
5063 #+vindex: org-global-properties
5064 Property values set with the global variable ~org-global-properties~
5065 can be inherited by all entries in all Org files.
5067 #+texinfo: @noindent
5068 The following commands help to work with properties:
5070 #+attr_texinfo: :sep ,
5071 - {{{kbd(M-TAB)}}} (~pcomplete~) ::
5075 After an initial colon in a line, complete property keys. All
5076 keys used in the current file are offered as possible
5079 - {{{kbd(C-c C-x p)}}} (~org-set-property~) ::
5082 #+findex: org-set-property
5083 Set a property. This prompts for a property name and a value.
5084 If necessary, the property drawer is created as well.
5086 - {{{kbd(C-u M-x org-insert-drawer)}}} ::
5088 #+findex: org-insert-drawer
5089 Insert a property drawer into the current entry. The drawer is
5090 inserted early in the entry, but after the lines with planning
5091 information like deadlines.
5093 - {{{kbd(C-c C-c)}}} (~org-property-action~) ::
5096 #+findex: org-property-action
5097 With point in a property drawer, this executes property commands.
5099 - {{{kbd(C-c C-c s)}}} (~org-set-property~) ::
5102 #+findex: org-set-property
5103 Set a property in the current entry. Both the property and the value
5104 can be inserted using completion.
5106 - {{{kbd(S-RIGHT)}}} (~org-property-next-allowed-values~), {{{kbd(S-LEFT)}}} (~org-property-previous-allowed-value~) ::
5110 Switch property at point to the next/previous allowed value.
5112 - {{{kbd(C-c C-c d)}}} (~org-delete-property~) ::
5115 #+findex: org-delete-property
5116 Remove a property from the current entry.
5118 - {{{kbd(C-c C-c D)}}} (~org-delete-property-globally~) ::
5121 #+findex: org-delete-property-globally
5122 Globally remove a property, from all entries in the current file.
5124 - {{{kbd(C-c C-c c)}}} (~org-compute-property-at-point~) ::
5127 #+findex: org-compute-property-at-point
5128 Compute the property at point, using the operator and scope from
5129 the nearest column format definition.
5131 ** Special Properties
5133 :DESCRIPTION: Access to other Org mode features.
5135 #+cindex: properties, special
5137 Special properties provide an alternative access method to Org mode
5138 features, like the TODO state or the priority of an entry, discussed
5139 in the previous chapters. This interface exists so that you can
5140 include these states in a column view (see [[*Column View]]), or to use
5141 them in queries. The following property names are special and should
5142 not be used as keys in the properties drawer:
5144 #+cindex: @samp{ALLTAGS}, special property
5145 #+cindex: @samp{BLOCKED}, special property
5146 #+cindex: @samp{CLOCKSUM}, special property
5147 #+cindex: @samp{CLOCKSUM_T}, special property
5148 #+cindex: @samp{CLOSED}, special property
5149 #+cindex: @samp{DEADLINE}, special property
5150 #+cindex: @samp{FILE}, special property
5151 #+cindex: @samp{ITEM}, special property
5152 #+cindex: @samp{PRIORITY}, special property
5153 #+cindex: @samp{SCHEDULED}, special property
5154 #+cindex: @samp{TAGS}, special property
5155 #+cindex: @samp{TIMESTAMP}, special property
5156 #+cindex: @samp{TIMESTAMP_IA}, special property
5157 #+cindex: @samp{TODO}, special property
5158 | =ALLTAGS= | All tags, including inherited ones. |
5159 | =BLOCKED= | ~t~ if task is currently blocked by children or siblings. |
5160 | =CATEGORY= | The category of an entry. |
5161 | =CLOCKSUM= | The sum of CLOCK intervals in the subtree. ~org-clock-sum~ |
5162 | | must be run first to compute the values in the current buffer. |
5163 | =CLOCKSUM_T= | The sum of CLOCK intervals in the subtree for today. |
5164 | | ~org-clock-sum-today~ must be run first to compute the |
5165 | | values in the current buffer. |
5166 | =CLOSED= | When was this entry closed? |
5167 | =DEADLINE= | The deadline time string, without the angular brackets. |
5168 | =FILE= | The filename the entry is located in. |
5169 | =ITEM= | The headline of the entry. |
5170 | =PRIORITY= | The priority of the entry, a string with a single letter. |
5171 | =SCHEDULED= | The scheduling timestamp, without the angular brackets. |
5172 | =TAGS= | The tags defined directly in the headline. |
5173 | =TIMESTAMP= | The first keyword-less timestamp in the entry. |
5174 | =TIMESTAMP_IA= | The first inactive timestamp in the entry. |
5175 | =TODO= | The TODO keyword of the entry. |
5177 ** Property Searches
5179 :DESCRIPTION: Matching property values.
5181 #+cindex: properties, searching
5182 #+cindex: searching, of properties
5184 To create sparse trees and special lists with selection based on
5185 properties, the same commands are used as for tag searches (see [[*Tag
5188 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) ::
5192 #+findex: org-match-sparse-tree
5193 Create a sparse tree with all matching entries. With
5194 a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not
5197 - {{{kbd(M-x org-agenda m)}}}, ~org-tags-view~ ::
5199 #+kindex: m @r{(Agenda dispatcher)}
5200 #+findex: org-tags-view
5201 Create a global list of tag/property matches from all agenda
5204 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
5206 #+kindex: M @r{(Agenda dispatcher)}
5207 #+vindex: org-tags-match-list-sublevels
5208 Create a global list of tag matches from all agenda files, but
5209 check only TODO items and force checking of subitems (see the
5210 option ~org-tags-match-list-sublevels~).
5212 The syntax for the search string is described in [[*Matching tags and
5215 There is also a special command for creating sparse trees based on a
5218 - {{{kbd(C-c / p)}}} ::
5221 Create a sparse tree based on the value of a property. This
5222 first prompts for the name of a property, and then for a value.
5223 A sparse tree is created with all entries that define this
5224 property with the given value. If you enclose the value in curly
5225 braces, it is interpreted as a regular expression and matched
5226 against the property values.
5228 ** Property Inheritance
5230 :DESCRIPTION: Passing values down a tree.
5232 #+cindex: properties, inheritance
5233 #+cindex: inheritance, of properties
5235 #+vindex: org-use-property-inheritance
5236 The outline structure of Org documents lends itself to an inheritance
5237 model of properties: if the parent in a tree has a certain property,
5238 the children can inherit this property. Org mode does not turn this
5239 on by default, because it can slow down property searches
5240 significantly and is often not needed. However, if you find
5241 inheritance useful, you can turn it on by setting the variable
5242 ~org-use-property-inheritance~. It may be set to ~t~ to make all
5243 properties inherited from the parent, to a list of properties that
5244 should be inherited, or to a regular expression that matches inherited
5245 properties. If a property has the value ~nil~, this is interpreted as
5246 an explicit un-define of the property, so that inheritance search
5247 stops at this value and returns ~nil~.
5249 Org mode has a few properties for which inheritance is hard-coded, at
5250 least for the special applications for which they are used:
5254 #+cindex: @samp{COLUMNS}, property
5255 The =COLUMNS= property defines the format of column view (see
5256 [[*Column View]]). It is inherited in the sense that the level where
5257 a =COLUMNS= property is defined is used as the starting point for
5258 a column view table, independently of the location in the subtree
5259 from where columns view is turned on.
5263 #+cindex: @samp{CATEGORY}, property
5264 For agenda view, a category set through a =CATEGORY= property
5265 applies to the entire subtree.
5269 #+cindex: @samp{ARCHIVE}, property
5270 For archiving, the =ARCHIVE= property may define the archive
5271 location for the entire subtree (see [[*Moving a tree to an archive
5276 #+cindex: @samp{LOGGING}, property
5277 The =LOGGING= property may define logging settings for an entry
5278 or a subtree (see [[*Tracking TODO state changes]]).
5282 :DESCRIPTION: Tabular viewing and editing.
5285 A great way to view and edit properties in an outline tree is /column
5286 view/. In column view, each outline node is turned into a table row.
5287 Columns in this table provide access to properties of the entries.
5288 Org mode implements columns by overlaying a tabular structure over the
5289 headline of each item. While the headlines have been turned into
5290 a table row, you can still change the visibility of the outline tree.
5291 For example, you get a compact table by switching to "contents"
5292 view---{{{kbd(S-TAB)}}} {{{kbd(S-TAB)}}}, or simply {{{kbd(c)}}}
5293 while column view is active---but you can still open, read, and edit
5294 the entry below each headline. Or, you can switch to column view
5295 after executing a sparse tree command and in this way get a table only
5296 for the selected items. Column view also works in agenda buffers (see
5297 [[*Agenda Views]]) where queries have collected selected items, possibly
5298 from a number of files.
5300 *** Defining columns
5302 :DESCRIPTION: The COLUMNS format property.
5304 #+cindex: column view, for properties
5305 #+cindex: properties, column view
5307 Setting up a column view first requires defining the columns. This is
5308 done by defining a column format line.
5310 **** Scope of column definitions
5312 :DESCRIPTION: Where defined, where valid?
5315 To define a column format for an entire file, use a line like:
5317 #+cindex: @samp{COLUMNS}, keyword
5318 : #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
5320 To specify a format that only applies to a specific tree, add
5321 a =COLUMNS= property to the top node of that tree, for example:
5324 ,** Top node for columns view
5326 :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
5330 If a =COLUMNS= property is present in an entry, it defines columns for
5331 the entry itself, and for the entire subtree below it. Since the
5332 column definition is part of the hierarchical structure of the
5333 document, you can define columns on level 1 that are general enough
5334 for all sublevels, and more specific columns further down, when you
5335 edit a deeper part of the tree.
5337 **** Column attributes
5339 :DESCRIPTION: Appearance and content of a column.
5342 A column definition sets the attributes of a column. The general
5343 definition looks like this:
5345 : %[WIDTH]PROPERTY[(TITLE)][{SUMMARY-TYPE}]
5347 #+texinfo: @noindent
5348 Except for the percent sign and the property name, all items are
5349 optional. The individual parts have the following meaning:
5351 - {{{var(WIDTH)}}} ::
5353 An integer specifying the width of the column in characters. If
5354 omitted, the width is determined automatically.
5356 - {{{var(PROPERTY)}}} ::
5358 The property that should be edited in this column. Special
5359 properties representing meta data are allowed here as well (see
5360 [[*Special Properties]]).
5362 - {{{var(TITLE)}}} ::
5364 The header text for the column. If omitted, the property name is
5367 - {{{var(SUMMARY-TYPE)}}} ::
5369 The summary type. If specified, the column values for parent
5370 nodes are computed from the children[fn:56].
5372 Supported summary types are:
5374 | =+= | Sum numbers in this column. |
5375 | =+;%.1f= | Like =+=, but format result with =%.1f=. |
5376 | =$= | Currency, short for =+;%.2f=. |
5377 | =min= | Smallest number in column. |
5378 | =max= | Largest number. |
5379 | =mean= | Arithmetic mean of numbers. |
5380 | =X= | Checkbox status, =[X]= if all children are =[X]=. |
5381 | =X/= | Checkbox status, =[n/m]=. |
5382 | =X%= | Checkbox status, =[n%]=. |
5383 | =:= | Sum times, HH:MM, plain numbers are hours. |
5384 | =:min= | Smallest time value in column. |
5385 | =:max= | Largest time value. |
5386 | =:mean= | Arithmetic mean of time values. |
5387 | =@min= | Minimum age[fn:57] (in days/hours/mins/seconds). |
5388 | =@max= | Maximum age (in days/hours/mins/seconds). |
5389 | =@mean= | Arithmetic mean of ages (in days/hours/mins/seconds). |
5390 | =est+= | Add low-high estimates. |
5392 #+texinfo: @noindent
5393 #+vindex: org-columns-summary-types
5394 You can also define custom summary types by setting
5395 ~org-columns-summary-types~.
5397 The =est+= summary type requires further explanation. It is used for
5398 combining estimates, expressed as low-high ranges. For example,
5399 instead of estimating a particular task will take 5 days, you might
5400 estimate it as 5--6 days if you're fairly confident you know how much
5401 work is required, or 1--10 days if you do not really know what needs
5402 to be done. Both ranges average at 5.5 days, but the first represents
5403 a more predictable delivery.
5405 When combining a set of such estimates, simply adding the lows and
5406 highs produces an unrealistically wide result. Instead, =est+= adds
5407 the statistical mean and variance of the subtasks, generating a final
5408 estimate from the sum. For example, suppose you had ten tasks, each
5409 of which was estimated at 0.5 to 2 days of work. Straight addition
5410 produces an estimate of 5 to 20 days, representing what to expect if
5411 everything goes either extremely well or extremely poorly. In
5412 contrast, =est+= estimates the full job more realistically, at 10--15
5415 Here is an example for a complete columns definition, along with
5416 allowed values[fn:58].
5419 :COLUMNS: %25ITEM %9Approved(Approved?){X} %Owner %11Status \
5420 %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T
5421 :Owner_ALL: Tammy Mark Karl Lisa Don
5422 :Status_ALL: "In progress" "Not started yet" "Finished" ""
5423 :Approved_ALL: "[ ]" "[X]"
5426 #+texinfo: @noindent
5427 The first column, =%25ITEM=, means the first 25 characters of the item
5428 itself, i.e., of the headline. You probably always should start the
5429 column definition with the =ITEM= specifier. The other specifiers
5430 create columns =Owner= with a list of names as allowed values, for
5431 =Status= with four different possible values, and for a checkbox field
5432 =Approved=. When no width is given after the =%= character, the
5433 column is exactly as wide as it needs to be in order to fully display
5434 all values. The =Approved= column does have a modified title
5435 (=Approved?=, with a question mark). Summaries are created for the
5436 =Time_Estimate= column by adding time duration expressions like HH:MM,
5437 and for the =Approved= column, by providing an =[X]= status if all
5438 children have been checked. The =CLOCKSUM= and =CLOCKSUM_T= columns
5439 are special, they lists the sums of CLOCK intervals in the subtree,
5440 either for all clocks or just for today.
5442 *** Using column view
5444 :DESCRIPTION: How to create and use column view.
5447 **** Turning column view on or off
5452 - {{{kbd(C-c C-x C-c)}}} (~org-columns~) ::
5454 #+kindex: C-c C-x C-c
5455 #+vindex: org-columns
5456 #+vindex: org-columns-default-format
5457 Turn on column view. If point is before the first headline in
5458 the file, column view is turned on for the entire file, using the
5459 =#+COLUMNS= definition. If point is somewhere inside the
5460 outline, this command searches the hierarchy, up from point, for
5461 a =COLUMNS= property that defines a format. When one is found,
5462 the column view table is established for the tree starting at the
5463 entry that contains the =COLUMNS= property. If no such property
5464 is found, the format is taken from the =#+COLUMNS= line or from
5465 the variable ~org-columns-default-format~, and column view is
5466 established for the current entry and its subtree.
5468 - {{{kbd(r)}}} or {{{kbd(g)}}} (~org-columns-redo~) ::
5472 #+findex: org-columns-redo
5473 Recreate the column view, to include recent changes made in the
5476 - {{{kbd(q)}}} (~org-columns-quit~) ::
5479 #+findex: org-columns-quit
5487 #+attr_texinfo: :sep and
5488 - {{{kbd(LEFT)}}}, {{{kbd(RIGHT)}}}, {{{kbd(UP)}}}, {{{kbd(DOWN)}}} ::
5490 Move through the column view from field to field.
5492 - {{{kbd(1..9\,0)}}} ::
5495 Directly select the Nth allowed value, {{{kbd(0)}}} selects the
5498 - {{{kbd(n)}}} or {{{kbd(S-RIGHT)}}} (~org-columns-next-allowed-value~) and {{{kbd(p)}}} or {{{kbd(S-LEFT)}}} (~org-columns-previous-allowed-value~) ::
5504 #+findex: org-columns-next-allowed-value
5505 #+findex: org-columns-previous-allowed-value
5506 Switch to the next/previous allowed value of the field. For
5507 this, you have to have specified allowed values for a property.
5509 - {{{kbd(e)}}} (~org-columns-edit-value~) ::
5512 #+findex: org-columns-edit-value
5513 Edit the property at point. For the special properties, this
5514 invokes the same interface that you normally use to change that
5515 property. For example, the tag completion or fast selection
5516 interface pops up when editing a =TAGS= property.
5518 - {{{kbd(C-c C-c)}}} (~org-columns-set-tags-or-toggle~) ::
5521 #+findex: org-columns-set-tags-or-toggle
5522 When there is a checkbox at point, toggle it.
5524 - {{{kbd(v)}}} (~org-columns-show-value~) ::
5527 #+findex: org-columns-show-value
5528 View the full value of this property. This is useful if the
5529 width of the column is smaller than that of the value.
5531 - {{{kbd(a)}}} (~org-columns-edit-allowed~) ::
5534 #+findex: org-columns-edit-allowed
5535 Edit the list of allowed values for this property. If the list
5536 is found in the hierarchy, the modified values is stored there.
5537 If no list is found, the new value is stored in the first entry
5538 that is part of the current column view.
5540 **** Modifying column view on-the-fly
5545 #+attr_texinfo: :sep and
5546 - {{{kbd(<)}}} (~org-columns-narrow~) and {{{kbd(>)}}} (~org-columns-widen~) ::
5550 #+findex: org-columns-narrow
5551 #+findex: org-columns-widen
5552 Make the column narrower/wider by one character.
5554 - {{{kbd(S-M-RIGHT)}}} (~org-columns-new~) ::
5557 #+findex: org-columns-new
5558 Insert a new column, to the left of the current column.
5560 - {{{kbd(S-M-LEFT)}}} (~org-columns-delete~) ::
5563 #+findex: org-columns-delete
5564 Delete the current column.
5566 *** Capturing column view
5568 :DESCRIPTION: A dynamic block for column view.
5571 Since column view is just an overlay over a buffer, it cannot be
5572 exported or printed directly. If you want to capture a column view,
5573 use a =columnview= dynamic block (see [[*Dynamic Blocks]]). The frame of
5574 this block looks like this:
5576 #+cindex: @samp{BEGIN columnview}
5579 ,#+BEGIN: columnview :hlines 1 :id "label"
5584 #+texinfo: @noindent
5585 This dynamic block has the following parameters:
5589 This is the most important parameter. Column view is a feature
5590 that is often localized to a certain (sub)tree, and the capture
5591 block might be at a different location in the file. To identify
5592 the tree whose view to capture, you can use four values:
5596 Use the tree in which the capture block is located.
5600 Make a global view, including all headings in the file.
5602 - =file:FILENAME= ::
5604 Run column view at the top of the {{{var(FILENAME)}}} file.
5608 #+cindex: @samp{ID}, property
5609 Call column view in the tree that has an =ID= property with
5610 the value {{{var(LABEL)}}}. You can use {{{kbd(M-x
5611 org-id-copy)}}} to create a globally unique ID for the
5612 current entry and copy it to the kill-ring.
5616 When ~t~, insert an hline after every line. When a number N,
5617 insert an hline before each headline with level ~<= N~.
5621 When non-~nil~, force column groups to get vertical lines.
5625 When set to a number, do not capture entries below this level.
5627 - =:skip-empty-rows= ::
5629 When non-~nil~, skip rows where the only non-empty specifier of
5630 the column view is =ITEM=.
5634 When non-~nil~, indent each =ITEM= field according to its level.
5636 #+texinfo: @noindent
5637 The following commands insert or update the dynamic block:
5639 - {{{kbd(C-c C-x i)}}} (~org-insert-columns-dblock~) ::
5642 #+findex: org-insert-columns-dblock
5643 Insert a dynamic block capturing a column view. Prompt for the
5644 scope or ID of the view.
5646 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
5649 #+kindex: C-c C-x C-u
5650 #+findex: org-dblock-update
5651 Update dynamic block at point. point needs to be in the
5652 =#+BEGIN= line of the dynamic block.
5654 - {{{kbd(C-u C-c C-x C-u)}}} (~org-update-all-dblocks~) ::
5656 #+kindex: C-u C-c C-x C-u
5657 Update all dynamic blocks (see [[*Dynamic Blocks]]). This is useful
5658 if you have several clock table blocks, column-capturing blocks
5659 or other dynamic blocks in a buffer.
5661 You can add formulas to the column view table and you may add plotting
5662 instructions in front of the table---these survive an update of the
5663 block. If there is a =TBLFM= keyword after the table, the table is
5664 recalculated automatically after an update.
5666 An alternative way to capture and process property values into a table
5667 is provided by Eric Schulte's =org-collector.el=, which is
5668 a contributed package[fn:59]. It provides a general API to collect
5669 properties from entries in a certain scope, and arbitrary Lisp
5670 expressions to process these values before inserting them into a table
5675 :DESCRIPTION: Making items useful for planning.
5680 #+cindex: date stamp
5682 To assist project planning, TODO items can be labeled with a date
5683 and/or a time. The specially formatted string carrying the date and
5684 time information is called a /timestamp/ in Org mode. This may be
5685 a little confusing because timestamp is often used as indicating when
5686 something was created or last changed. However, in Org mode this term
5687 is used in a much wider sense.
5689 ** Timestamps, Deadlines and Scheduling
5691 :DESCRIPTION: Assigning a time to a tree entry.
5692 :ALT_TITLE: Timestamps
5694 #+cindex: timestamps
5695 #+cindex: ranges, time
5696 #+cindex: date stamps
5698 #+cindex: scheduling
5700 A timestamp is a specification of a date (possibly with a time or
5701 a range of times) in a special format, either =<2003-09-16 Tue>= or
5702 =<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=[fn:60].
5703 A timestamp can appear anywhere in the headline or body of an Org tree
5704 entry. Its presence causes entries to be shown on specific dates in
5705 the agenda (see [[*Weekly/daily agenda]]). We distinguish:
5707 - Plain timestamp; Event; Appointment ::
5710 #+cindex: appointment
5711 A simple timestamp just assigns a date/time to an item. This is
5712 just like writing down an appointment or event in a paper agenda.
5713 In the agenda display, the headline of an entry associated with
5714 a plain timestamp is shown exactly on that date.
5717 ,* Meet Peter at the movies
5718 <2006-11-01 Wed 19:15>
5719 ,* Discussion on climate change
5720 <2006-11-02 Thu 20:00-22:00>
5723 - Timestamp with repeater interval ::
5725 #+cindex: timestamp, with repeater interval
5726 A timestamp may contain a /repeater interval/, indicating that it
5727 applies not only on the given date, but again and again after
5728 a certain interval of N days (d), weeks (w), months (m), or years
5729 (y). The following shows up in the agenda every Wednesday:
5732 ,* Pick up Sam at school
5733 <2007-05-16 Wed 12:30 +1w>
5736 - Diary-style sexp entries ::
5738 #+cindex: diary style timestamps
5739 #+cindex: sexp timestamps
5740 For more complex date specifications, Org mode supports using the
5741 special sexp diary entries implemented in the Emacs
5742 calendar/diary package[fn:61]. For example, with optional time:
5745 ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
5746 <%%(diary-float t 4 2)>
5749 - Time/Date range ::
5752 #+cindex: date range
5753 Two timestamps connected by =--= denote a range. The headline is
5754 shown on the first and last day of the range, and on any dates
5755 that are displayed and fall in the range. Here is an example:
5758 ,** Meeting in Amsterdam
5759 <2004-08-23 Mon>--<2004-08-26 Thu>
5762 - Inactive timestamp ::
5764 #+cindex: timestamp, inactive
5765 #+cindex: inactive timestamp
5766 Just like a plain timestamp, but with square brackets instead of
5767 angular ones. These timestamps are inactive in the sense that
5768 they do /not/ trigger an entry to show up in the agenda.
5771 ,* Gillian comes late for the fifth time
5775 ** Creating Timestamps
5777 :DESCRIPTION: Commands to insert timestamps.
5780 For Org mode to recognize timestamps, they need to be in the specific
5781 format. All commands listed below produce timestamps in the correct
5784 #+attr_texinfo: :sep ,
5785 - {{{kbd(C-c .)}}} (~org-time-stamp~) ::
5788 #+findex: org-time-stamp
5789 Prompt for a date and insert a corresponding timestamp. When
5790 point is at an existing timestamp in the buffer, the command is
5791 used to modify this timestamp instead of inserting a new one.
5792 When this command is used twice in succession, a time range is
5796 #+vindex: org-time-stamp-rounding-minutes
5797 When called with a prefix argument, use the alternative format
5798 which contains date and time. The default time can be rounded to
5799 multiples of 5 minutes. See the option
5800 ~org-time-stamp-rounding-minutes~.
5802 #+kindex: C-u C-u C-c .
5803 With two prefix arguments, insert an active timestamp with the
5804 current time without prompting.
5806 - {{{kbd(C-c !)}}} (~org-time-stamp-inactive~) ::
5810 #+kindex: C-u C-u C-c !
5811 #+findex: org-time-stamp-inactive
5812 Like {{{kbd(C-c .)}}}, but insert an inactive timestamp that does
5813 not cause an agenda entry.
5815 - {{{kbd(C-c C-c)}}} ::
5818 Normalize timestamp, insert or fix day name if missing or wrong.
5820 - {{{kbd(C-c <)}}} (~org-date-from-calendar~) ::
5823 #+findex: org-date-from-calendar
5824 Insert a timestamp corresponding to point date in the calendar.
5826 - {{{kbd(C-c >)}}} (~org-goto-calendar~) ::
5829 #+findex: org-goto-calendar
5830 Access the Emacs calendar for the current date. If there is
5831 a timestamp in the current line, go to the corresponding date
5834 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) ::
5837 #+findex: org-open-at-point
5838 Access the agenda for the date given by the timestamp or -range
5839 at point (see [[*Weekly/daily agenda]]).
5841 - {{{kbd(S-LEFT)}}} (~org-timestamp-down-day~), {{{kbd(S-RIGHT)}}} (~org-timestamp-up-day~) ::
5845 #+findex: org-timestamp-down-day
5846 #+findex: org-timestamp-up-day
5847 Change date at point by one day. These key bindings conflict
5848 with shift-selection and related modes (see [[*Packages that
5849 conflict with Org mode]]).
5851 - {{{kbd(S-UP)}}} (~org-timestamp-up~), {{{kbd(S-DOWN)}}} (~org-timestamp-down~) ::
5855 On the beginning or enclosing bracket of a timestamp, change its
5856 type. Within a timestamp, change the item under point. Point
5857 can be on a year, month, day, hour or minute. When the timestamp
5858 contains a time range like =15:30-16:30=, modifying the first
5859 time also shifts the second, shifting the time block with
5860 constant length. To change the length, modify the second time.
5861 Note that if point is in a headline and not at a timestamp, these
5862 same keys modify the priority of an item (see [[*Priorities]]). The
5863 key bindings also conflict with shift-selection and related modes
5864 (see [[*Packages that conflict with Org mode]]).
5866 - {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
5869 #+findex: org-evaluate-time-range
5870 #+cindex: evaluate time range
5871 Evaluate a time range by computing the difference between start
5872 and end. With a prefix argument, insert result after the time
5873 range (in a table: into the following column).
5875 *** The date/time prompt
5877 :DESCRIPTION: How Org mode helps you enter dates and times.
5879 #+cindex: date, reading in minibuffer
5880 #+cindex: time, reading in minibuffer
5882 #+vindex: org-read-date-prefer-future
5883 When Org mode prompts for a date/time, the default is shown in default
5884 date/time format, and the prompt therefore seems to ask for a specific
5885 format. But it in fact accepts date/time information in a variety of
5886 formats. Generally, the information should start at the beginning of
5887 the string. Org mode finds whatever information is in there and
5888 derives anything you have not specified from the /default date and
5889 time/. The default is usually the current date and time, but when
5890 modifying an existing timestamp, or when entering the second stamp of
5891 a range, it is taken from the stamp in the buffer. When filling in
5892 information, Org mode assumes that most of the time you want to enter
5893 a date in the future: if you omit the month/year and the given
5894 day/month is /before/ today, it assumes that you mean a future
5895 date[fn:62]. If the date has been automatically shifted into the
5896 future, the time prompt shows this with =(=>F)=.
5898 For example, let's assume that today is *June 13, 2006*. Here is how
5899 various inputs are interpreted, the items filled in by Org mode are in
5902 | =3-2-5= | \rArr{} 2003-02-05 |
5903 | =2/5/3= | \rArr{} 2003-02-05 |
5904 | =14= | \rArr{} *2006*-*06*-14 |
5905 | =12= | \rArr{} *2006*-*07*-12 |
5906 | =2/5= | \rArr{} *2007*-02-05 |
5907 | =Fri= | \rArr{} nearest Friday (default date or later) |
5908 | =sep 15= | \rArr{} *2006*-09-15 |
5909 | =feb 15= | \rArr{} *2007*-02-15 |
5910 | =sep 12 9= | \rArr{} 2009-09-12 |
5911 | =12:45= | \rArr{} *2006*-*06*-*13* 12:45 |
5912 | =22 sept 0:34= | \rArr{} *2006*-09-22 0:34 |
5913 | =w4= | \rArr{} ISO week for of the current year *2006* |
5914 | =2012 w4 fri= | \rArr{} Friday of ISO week 4 in 2012 |
5915 | =2012-w04-5= | \rArr{} Same as above |
5917 Furthermore you can specify a relative date by giving, as the /first/
5918 thing in the input: a plus/minus sign, a number and a letter---=d=,
5919 =w=, =m= or =y=---to indicate change in days, weeks, months, or
5920 years. With a single plus or minus, the date is always relative to
5921 today. With a double plus or minus, it is relative to the default
5922 date. If instead of a single letter, you use the abbreviation of day
5923 name, the date is the Nth such day, e.g.:
5925 | =+0= | \rArr{} today |
5926 | =.= | \rArr{} today |
5927 | =+4d= | \rArr{} four days from today |
5928 | =+4= | \rArr{} same as +4d |
5929 | =+2w= | \rArr{} two weeks from today |
5930 | =++5= | \rArr{} five days from default date |
5931 | =+2tue= | \rArr{} second Tuesday from now |
5933 #+vindex: parse-time-months
5934 #+vindex: parse-time-weekdays
5935 The function understands English month and weekday abbreviations. If
5936 you want to use un-abbreviated names and/or other languages, configure
5937 the variables ~parse-time-months~ and ~parse-time-weekdays~.
5939 #+vindex: org-read-date-force-compatible-dates
5940 Not all dates can be represented in a given Emacs implementation. By
5941 default Org mode forces dates into the compatibility range 1970--2037
5942 which works on all Emacs implementations. If you want to use dates
5943 outside of this range, read the docstring of the variable
5944 ~org-read-date-force-compatible-dates~.
5946 You can specify a time range by giving start and end times or by
5947 giving a start time and a duration (in HH:MM format). Use one or two
5948 dash(es) as the separator in the former case and use =+= as the
5949 separator in the latter case, e.g.:
5951 | =11am-1:15pm= | \rArr{} 11:00-13:15 |
5952 | =11am--1:15pm= | \rArr{} same as above |
5953 | =11am+2:15= | \rArr{} same as above |
5955 #+cindex: calendar, for selecting date
5956 #+vindex: org-popup-calendar-for-date-prompt
5957 Parallel to the minibuffer prompt, a calendar is popped up[fn:63].
5958 When you exit the date prompt, either by clicking on a date in the
5959 calendar, or by pressing {{{kbd(RET)}}}, the date selected in the
5960 calendar is combined with the information entered at the prompt. You
5961 can control the calendar fully from the minibuffer:
5975 #+attr_texinfo: :columns 0.25 0.55
5976 | {{{kbd(RET)}}} | Choose date at point in calendar. |
5977 | {{{kbd(mouse-1)}}} | Select date by clicking on it. |
5978 | {{{kbd(S-RIGHT)}}} | One day forward. |
5979 | {{{kbd(S-LEFT)}}} | One day backward. |
5980 | {{{kbd(S-DOWN)}}} | One week forward. |
5981 | {{{kbd(S-UP)}}} | One week backward. |
5982 | {{{kbd(M-S-RIGHT)}}} | One month forward. |
5983 | {{{kbd(M-S-LEFT)}}} | One month backward. |
5984 | {{{kbd(>)}}} | Scroll calendar forward by one month. |
5985 | {{{kbd(<)}}} | Scroll calendar backward by one month. |
5986 | {{{kbd(M-v)}}} | Scroll calendar forward by 3 months. |
5987 | {{{kbd(C-v)}}} | Scroll calendar backward by 3 months. |
5989 #+vindex: org-read-date-display-live
5990 The actions of the date/time prompt may seem complex, but I assure you
5991 they will grow on you, and you will start getting annoyed by pretty
5992 much any other way of entering a date/time out there. To help you
5993 understand what is going on, the current interpretation of your input
5994 is displayed live in the minibuffer[fn:64].
5996 *** Custom time format
5998 :DESCRIPTION: Making dates look different.
6000 #+cindex: custom date/time format
6001 #+cindex: time format, custom
6002 #+cindex: date format, custom
6004 #+vindex: org-display-custom-times
6005 #+vindex: org-time-stamp-custom-formats
6006 Org mode uses the standard ISO notation for dates and times as it is
6007 defined in ISO 8601. If you cannot get used to this and require
6008 another representation of date and time to keep you happy, you can get
6009 it by customizing the variables ~org-display-custom-times~ and
6010 ~org-time-stamp-custom-formats~.
6012 - {{{kbd(C-c C-x C-t)}}} (~org-toggle-time-stamp-overlays~) ::
6014 #+kindex: C-c C-x C-t
6015 #+findex: org-toggle-time-stamp-overlays
6016 Toggle the display of custom formats for dates and times.
6018 #+texinfo: @noindent
6019 Org mode needs the default format for scanning, so the custom
6020 date/time format does not /replace/ the default format. Instead, it
6021 is put /over/ the default format using text properties. This has the
6022 following consequences:
6024 - You cannot place point onto a timestamp anymore, only before or
6027 - The {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} keys can no longer be used
6028 to adjust each component of a timestamp. If point is at the
6029 beginning of the stamp, {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} change
6030 the stamp by one day, just like {{{kbd(S-LEFT)}}}
6031 {{{kbd(S-RIGHT)}}}. At the end of the stamp, change the time by one
6034 - If the timestamp contains a range of clock times or a repeater,
6035 these are not overlaid, but remain in the buffer as they were.
6037 - When you delete a timestamp character-by-character, it only
6038 disappears from the buffer after /all/ (invisible) characters
6039 belonging to the ISO timestamp have been removed.
6041 - If the custom timestamp format is longer than the default and you
6042 are using dates in tables, table alignment will be messed up. If
6043 the custom format is shorter, things do work as expected.
6045 ** Deadlines and Scheduling
6047 :DESCRIPTION: Planning your work.
6050 A timestamp may be preceded by special keywords to facilitate
6051 planning. Both the timestamp and the keyword have to be positioned
6052 immediately after the task they refer to.
6056 #+cindex: @samp{DEADLINE} marker
6057 Meaning: the task (most likely a TODO item, though not
6058 necessarily) is supposed to be finished on that date.
6060 #+vindex: org-deadline-warning-days
6061 On the deadline date, the task is listed in the agenda. In
6062 addition, the agenda for /today/ carries a warning about the
6063 approaching or missed deadline, starting
6064 ~org-deadline-warning-days~ before the due date, and continuing
6065 until the entry is marked DONE. An example:
6068 ,*** TODO write article about the Earth for the Guide
6069 DEADLINE: <2004-02-29 Sun>
6070 The editor in charge is [[bbdb:Ford Prefect]]
6073 #+vindex: org-agenda-skip-deadline-prewarning-if-scheduled
6074 You can specify a different lead time for warnings for a specific
6075 deadlines using the following syntax. Here is an example with
6076 a warning period of 5 days =DEADLINE: <2004-02-29 Sun -5d>=.
6077 This warning is deactivated if the task gets scheduled and you
6078 set ~org-agenda-skip-deadline-prewarning-if-scheduled~ to ~t~.
6082 #+cindex: @samp{SCHEDULED} marker
6083 Meaning: you are planning to start working on that task on the
6086 #+vindex: org-agenda-skip-scheduled-if-done
6087 The headline is listed under the given date[fn:65]. In addition,
6088 a reminder that the scheduled date has passed is present in the
6089 compilation for /today/, until the entry is marked DONE, i.e.,
6090 the task is automatically forwarded until completed.
6093 ,*** TODO Call Trillian for a date on New Years Eve.
6094 SCHEDULED: <2004-12-25 Sat>
6097 #+vindex: org-scheduled-delay-days
6098 #+vindex: org-agenda-skip-scheduled-delay-if-deadline
6099 If you want to /delay/ the display of this task in the agenda,
6100 use =SCHEDULED: <2004-12-25 Sat -2d>=: the task is still
6101 scheduled on the 25th but will appear two days later. In case
6102 the task contains a repeater, the delay is considered to affect
6103 all occurrences; if you want the delay to only affect the first
6104 scheduled occurrence of the task, use =--2d= instead. See
6105 ~org-scheduled-delay-days~ and
6106 ~org-agenda-skip-scheduled-delay-if-deadline~ for details on how
6107 to control this globally or per agenda.
6109 #+texinfo: @noindent
6110 *Important:* Scheduling an item in Org mode should /not/ be
6111 understood in the same way that we understand /scheduling
6112 a meeting/. Setting a date for a meeting is just a simple
6113 appointment, you should mark this entry with a simple plain
6114 timestamp, to get this item shown on the date where it applies.
6115 This is a frequent misunderstanding by Org users. In Org mode,
6116 /scheduling/ means setting a date when you want to start working
6119 You may use timestamps with repeaters in scheduling and deadline
6120 entries. Org mode issues early and late warnings based on the
6121 assumption that the timestamp represents the /nearest instance/ of the
6122 repeater. However, the use of diary S-exp entries like
6124 : <%%(diary-float t 42)>
6126 #+texinfo: @noindent
6127 in scheduling and deadline timestamps is limited. Org mode does not
6128 know enough about the internals of each S-exp function to issue early
6129 and late warnings. However, it shows the item on each day where the
6130 S-exp entry matches.
6132 *** Inserting deadlines or schedules
6134 :DESCRIPTION: Planning items.
6135 :ALT_TITLE: Inserting deadline/schedule
6138 The following commands allow you to quickly insert a deadline or to
6139 schedule an item:[fn:66]
6141 - {{{kbd(C-c C-d)}}} (~org-deadline~) ::
6144 #+findex: org-deadline
6145 #+vindex: org-log-redeadline
6146 Insert =DEADLINE= keyword along with a stamp. The insertion
6147 happens in the line directly following the headline. Remove any
6148 =CLOSED= timestamp . When called with a prefix argument, also
6149 remove any existing deadline from the entry. Depending on the
6150 variable ~org-log-redeadline~, take a note when changing an
6151 existing deadline[fn:67].
6153 - {{{kbd(C-c C-s)}}} (~org-schedule~) ::
6156 #+findex: org-schedule
6157 #+vindex: org-log-reschedule
6158 Insert =SCHEDULED= keyword along with a stamp. The insertion
6159 happens in the line directly following the headline. Remove any
6160 =CLOSED= timestamp. When called with a prefix argument, also
6161 remove the scheduling date from the entry. Depending on the
6162 variable ~org-log-reschedule~, take a note when changing an
6163 existing scheduling time[fn:68].
6165 - {{{kbd(C-c C-x C-k)}}} (~org-mark-entry-for-agenda-action~) ::
6167 #+kindex: C-c C-x C-k
6170 #+findex: org-mark-entry-for-agenda-action
6171 Mark the current entry for agenda action. After you have marked
6172 the entry like this, you can open the agenda or the calendar to
6173 find an appropriate date. With point on the selected date, press
6174 {{{kbd(k s)}}} or {{{kbd(k d)}}} to schedule the marked item.
6176 - {{{kbd(C-c / d)}}} (~org-check-deadlines~) ::
6179 #+findex: org-check-deadlines
6180 #+cindex: sparse tree, for deadlines
6181 #+vindex: org-deadline-warning-days
6182 Create a sparse tree with all deadlines that are either past-due,
6183 or which will become due within ~org-deadline-warning-days~.
6184 With {{{kbd(C-u)}}} prefix, show all deadlines in the file. With
6185 a numeric prefix, check that many days. For example, {{{kbd(C-1
6186 C-c / d)}}} shows all deadlines due tomorrow.
6188 - {{{kbd(C-c / b)}}} (~org-check-before-date~) ::
6191 #+findex: org-check-before-date
6192 Sparse tree for deadlines and scheduled items before a given
6195 - {{{kbd(C-c / a)}}} (~org-check-after-date~) ::
6198 #+findex: org-check-after-date
6199 Sparse tree for deadlines and scheduled items after a given date.
6201 Note that ~org-schedule~ and ~org-deadline~ supports setting the date
6202 by indicating a relative time e.g., =+1d= sets the date to the next
6203 day after today, and =--1w= sets the date to the previous week before
6204 any current timestamp.
6208 :DESCRIPTION: Items that show up again and again.
6210 #+cindex: tasks, repeated
6211 #+cindex: repeated tasks
6213 Some tasks need to be repeated again and again. Org mode helps to
6214 organize such tasks using a so-called repeater in a =DEADLINE=,
6215 =SCHEDULED=, or plain timestamp. In the following example:
6218 ,** TODO Pay the rent
6219 DEADLINE: <2005-10-01 Sat +1m>
6222 #+texinfo: @noindent
6223 the =+1m= is a repeater; the intended interpretation is that the task
6224 has a deadline on =<2005-10-01>= and repeats itself every (one) month
6225 starting from that time. You can use yearly, monthly, weekly, daily
6226 and hourly repeat cookies by using the ~y/w/m/d/h~ letters. If you
6227 need both a repeater and a special warning period in a deadline entry,
6228 the repeater should come first and the warning period last: =DEADLINE:
6229 <2005-10-01 Sat +1m -3d>=.
6231 #+vindex: org-todo-repeat-to-state
6232 Deadlines and scheduled items produce entries in the agenda when they
6233 are over-due, so it is important to be able to mark such an entry as
6234 DONE once you have done so. When you mark a =DEADLINE= or a
6235 =SCHEDULED= with the TODO keyword =DONE=, it no longer produces
6236 entries in the agenda. The problem with this is, however, is that
6237 then also the /next/ instance of the repeated entry will not be
6238 active. Org mode deals with this in the following way: when you try
6239 to mark such an entry DONE, using {{{kbd(C-c C-t)}}}, it shifts the
6240 base date of the repeating timestamp by the repeater interval, and
6241 immediately sets the entry state back to TODO[fn:69]. In the example
6242 above, setting the state to DONE would actually switch the date like
6246 ,** TODO Pay the rent
6247 DEADLINE: <2005-11-01 Tue +1m>
6250 To mark a task with a repeater as DONE, use {{{kbd(C-- 1 C-c C-t)}}},
6251 i.e., ~org-todo~ with a numeric prefix argument of =-1=.
6253 #+vindex: org-log-repeat
6254 A timestamp[fn:70] is added under the deadline, to keep a record that
6255 you actually acted on the previous instance of this deadline.
6257 As a consequence of shifting the base date, this entry is no longer
6258 visible in the agenda when checking past dates, but all future
6259 instances will be visible.
6261 With the =+1m= cookie, the date shift is always exactly one month. So
6262 if you have not paid the rent for three months, marking this entry
6263 DONE still keeps it as an overdue deadline. Depending on the task,
6264 this may not be the best way to handle it. For example, if you forgot
6265 to call your father for 3 weeks, it does not make sense to call him
6266 3 times in a single day to make up for it. Finally, there are tasks
6267 like changing batteries which should always repeat a certain time
6268 /after/ the last time you did it. For these tasks, Org mode has
6269 special repeaters =++= and =.+=. For example:
6272 ,** TODO Call Father
6273 DEADLINE: <2008-02-10 Sun ++1w>
6274 Marking this DONE shifts the date by at least one week, but also
6275 by as many weeks as it takes to get this date into the future.
6276 However, it stays on a Sunday, even if you called and marked it
6279 ,** TODO Empty kitchen trash
6280 DEADLINE: <2008-02-08 Fri 20:00 ++1d>
6281 Marking this DONE shifts the date by at least one day, and also
6282 by as many days as it takes to get the timestamp into the future.
6283 Since there is a time in the timestamp, the next deadline in the
6284 future will be on today's date if you complete the task before
6287 ,** TODO Check the batteries in the smoke detectors
6288 DEADLINE: <2005-11-01 Tue .+1m>
6289 Marking this DONE will shift the date to one month after today.
6292 #+vindex: org-agenda-skip-scheduled-if-deadline-is-shown
6293 You may have both scheduling and deadline information for a specific
6294 task. If the repeater is set for the scheduling information only, you
6295 probably want the repeater to be ignored after the deadline. If so,
6296 set the variable ~org-agenda-skip-scheduled-if-deadline-is-shown~ to
6297 ~repeated-after-deadline~. However, any scheduling information
6298 without a repeater is no longer relevant once the task is done, and
6299 thus, removed upon repeating the task. If you want both scheduling
6300 and deadline information to repeat after the same interval, set the
6301 same repeater for both timestamps.
6303 An alternative to using a repeater is to create a number of copies of
6304 a task subtree, with dates shifted in each copy. The command
6305 {{{kbd(C-c C-x c)}}} was created for this purpose; it is described in
6306 [[*Structure Editing]].
6308 ** Clocking Work Time
6310 :DESCRIPTION: Tracking how long you spend on a task.
6312 #+cindex: clocking time
6313 #+cindex: time clocking
6315 Org mode allows you to clock the time you spend on specific tasks in
6316 a project. When you start working on an item, you can start the
6317 clock. When you stop working on that task, or when you mark the task
6318 done, the clock is stopped and the corresponding time interval is
6319 recorded. It also computes the total time spent on each
6320 subtree[fn:71] of a project. And it remembers a history or tasks
6321 recently clocked, to that you can jump quickly between a number of
6322 tasks absorbing your time.
6324 To save the clock history across Emacs sessions, use:
6326 #+begin_src emacs-lisp
6327 (setq org-clock-persist 'history)
6328 (org-clock-persistence-insinuate)
6331 #+vindex: org-clock-persist
6332 When you clock into a new task after resuming Emacs, the incomplete
6333 clock[fn:72] is retrieved (see [[*Resolving idle time]]) and you are
6334 prompted about what to do with it.
6336 *** Clocking commands
6338 :DESCRIPTION: Starting and stopping a clock.
6341 #+attr_texinfo: :sep ,
6342 - {{{kbd(C-c C-x C-i)}}} (~org-clock-in~) ::
6344 #+kindex: C-c C-x C-i
6345 #+findex: org-clock-in
6346 #+vindex: org-clock-into-drawer
6347 #+vindex: org-clock-continuously
6348 #+cindex: @samp{LOG_INTO_DRAWER}, property
6349 Start the clock on the current item (clock-in). This inserts the
6350 CLOCK keyword together with a timestamp. If this is not the
6351 first clocking of this item, the multiple CLOCK lines are wrapped
6352 into a =LOGBOOK= drawer (see also the variable
6353 ~org-clock-into-drawer~). You can also overrule the setting of
6354 this variable for a subtree by setting a =CLOCK_INTO_DRAWER= or
6355 =LOG_INTO_DRAWER= property. When called with a {{{kbd(C-u)}}}
6356 prefix argument, select the task from a list of recently clocked
6357 tasks. With two {{{kbd(C-u C-u)}}} prefixes, clock into the task
6358 at point and mark it as the default task; the default task is
6359 always be available with letter {{{kbd(d)}}} when selecting
6360 a clocking task. With three {{{kbd(C-u C-u C-u)}}} prefixes,
6361 force continuous clocking by starting the clock when the last
6364 #+cindex: @samp{CLOCK_MODELINE_TOTAL}, property
6365 #+cindex: @samp{LAST_REPEAT}, property
6366 #+vindex: org-clock-mode-line-total
6367 #+vindex: org-clock-in-prepare-hook
6368 While the clock is running, Org shows the current clocking time
6369 in the mode line, along with the title of the task. The clock
6370 time shown is all time ever clocked for this task and its
6371 children. If the task has an effort estimate (see [[*Effort
6372 Estimates]]), the mode line displays the current clocking time
6373 against it[fn:73]. If the task is a repeating one (see [[*Repeated
6374 tasks]]), show only the time since the last reset of the
6375 task[fn:74]. You can exercise more control over show time with
6376 the =CLOCK_MODELINE_TOTAL= property. It may have the values
6377 =current= to show only the current clocking instance, =today= to
6378 show all time clocked on this tasks today---see also the
6379 variable ~org-extend-today-until~, ~all~ to include all time, or
6380 ~auto~ which is the default[fn:75]. Clicking with
6381 {{{kbd(mouse-1)}}} onto the mode line entry pops up a menu with
6384 - {{{kbd(C-c C-x C-o)}}} (~org-clock-out~) ::
6386 #+kindex: C-c C-x C-o
6387 #+findex: org-clock-out
6388 #+vindex: org-log-note-clock-out
6389 Stop the clock (clock-out). This inserts another timestamp at
6390 the same location where the clock was last started. It also
6391 directly computes the resulting time in inserts it after the time
6392 range as ==>HH:MM=. See the variable ~org-log-note-clock-out~
6393 for the possibility to record an additional note together with
6394 the clock-out timestamp[fn:76].
6396 - {{{kbd(C-c C-x C-x)}}} (~org-clock-in-last~) ::
6398 #+kindex: C-c C-x C-x
6399 #+findex: org-clock-in-last
6400 #+vindex: org-clock-continuously
6401 Re-clock the last clocked task. With one {{{kbd(C-u)}}} prefix
6402 argument, select the task from the clock history. With two
6403 {{{kbd(C-u)}}} prefixes, force continuous clocking by starting
6404 the clock when the last clock stopped.
6406 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
6408 #+kindex: C-c C-x C-e
6409 #+findex: org-clock-modify-effort-estimate
6410 Update the effort estimate for the current clock task.
6412 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) ::
6416 #+findex: org-evaluate-time-range
6417 Recompute the time interval after changing one of the timestamps.
6418 This is only necessary if you edit the timestamps directly. If
6419 you change them with {{{kbd(S-<cursor>)}}} keys, the update is
6422 - {{{kbd(C-S-UP)}}} (~org-clock-timestamps-up~), {{{kbd(C-S-DOWN)}}} (~org-clock-timestamps-down~) ::
6425 #+findex: org-clock-timestamps-up
6427 #+findex: org-clock-timestamps-down
6428 On CLOCK log lines, increase/decrease both timestamps so that the
6429 clock duration keeps the same value.
6431 - {{{kbd(S-M-UP)}}} (~org-timestamp-up~), {{{kbd(S-M-DOWN)}}} (~org-timestamp-down~) ::
6434 #+findex: org-clock-timestamp-up
6436 #+findex: org-clock-timestamp-down
6437 On =CLOCK= log lines, increase/decrease the timestamp at point
6438 and the one of the previous, or the next, clock timestamp by the
6439 same duration. For example, if you hit {{{kbd(S-M-UP)}}} to
6440 increase a clocked-out timestamp by five minutes, then the
6441 clocked-in timestamp of the next clock is increased by five
6444 - {{{kbd(C-c C-t)}}} (~org-todo~) ::
6448 Changing the TODO state of an item to DONE automatically stops
6449 the clock if it is running in this same item.
6451 - {{{kbd(C-c C-x C-q)}}} (~org-clock-cancel~) ::
6453 #+kindex: C-c C-x C-q
6454 #+findex: org-clock-cancel
6455 Cancel the current clock. This is useful if a clock was started
6456 by mistake, or if you ended up working on something else.
6458 - {{{kbd(C-c C-x C-j)}}} (~org-clock-goto~) ::
6460 #+kindex: C-c C-x C-j
6461 #+findex: or-clock-goto
6462 Jump to the headline of the currently clocked in task. With
6463 a {{{kbd(C-u)}}} prefix argument, select the target task from
6464 a list of recently clocked tasks.
6466 - {{{kbd(C-c C-x C-d)}}} (~org-clock-display~) ::
6468 #+kindex: C-c C-x C-d
6469 #+findex: org-clock-display
6470 #+vindex: org-remove-highlights-with-change
6471 Display time summaries for each subtree in the current buffer.
6472 This puts overlays at the end of each headline, showing the total
6473 time recorded under that heading, including the time of any
6474 subheadings. You can use visibility cycling to study the tree,
6475 but the overlays disappear when you change the buffer (see
6476 variable ~org-remove-highlights-with-change~) or press {{{kbd(C-c
6479 The {{{kbd(l)}}} key may be used in the agenda (see [[*Weekly/daily
6480 agenda]]) to show which tasks have been worked on or closed during
6483 *Important:* note that both ~org-clock-out~ and ~org-clock-in-last~
6484 can have a global keybinding and do not modify the window disposition.
6488 :DESCRIPTION: Detailed reports.
6490 #+cindex: clocktable, dynamic block
6491 #+cindex: report, of clocked time
6493 Org mode can produce quite complex reports based on the time clocking
6494 information. Such a report is called a /clock table/, because it is
6495 formatted as one or several Org tables.
6497 #+attr_texinfo: :sep ,
6498 - {{{kbd(C-c C-x C-r)}}} (~org-clock-report~) ::
6500 #+kindex: C-c C-x C-r
6501 #+findex: org-clock-report
6502 Insert a dynamic block (see [[*Dynamic Blocks]]) containing a clock
6503 report as an Org mode table into the current file. When point is
6504 at an existing clock table, just update it. When called with a
6505 prefix argument, jump to the first clock report in the current
6506 document and update it. The clock table includes archived trees.
6508 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
6511 #+kindex: C-c C-x C-u
6512 #+findex: org-dblock-update
6513 Update dynamic block at point. Point needs to be in the =BEGIN=
6514 line of the dynamic block.
6516 - {{{kbd(C-u C-c C-x C-u)}}} ::
6518 #+kindex: C-u C-c C-x C-u
6519 Update all dynamic blocks (see [[*Dynamic Blocks]]). This is useful
6520 if you have several clock table blocks in a buffer.
6522 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} (~org-clocktable-try-shift~) ::
6526 #+findex: org-clocktable-try-shift
6527 Shift the current =:block= interval and update the table. Point
6528 needs to be in the =#+BEGIN: clocktable= line for this command.
6529 If =:block= is =today=, it is shifted to =today-1=, etc.
6531 Here is an example of the frame for a clock table as it is inserted
6532 into the buffer with the {{{kbd(C-c C-x C-r)}}} command:
6534 #+cindex: @samp{BEGIN clocktable}
6536 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
6540 #+texinfo: @noindent
6541 #+vindex: org-clocktable-defaults
6542 The =#+BEGIN= line and specify a number of options to define the
6543 scope, structure, and formatting of the report. Defaults for all
6544 these options can be configured in the variable
6545 ~org-clocktable-defaults~.
6547 #+texinfo: @noindent
6548 First there are options that determine which clock entries are to
6553 Maximum level depth to which times are listed in the table.
6554 Clocks at deeper levels are summed into the upper level.
6558 The scope to consider. This can be any of the following:
6560 | ~nil~ | the current buffer or narrowed region |
6561 | ~file~ | the full current buffer |
6562 | ~subtree~ | the subtree where the clocktable is located |
6563 | ~treeN~ | the surrounding level N tree, for example =tree3= |
6564 | ~tree~ | the surrounding level 1 tree |
6565 | ~agenda~ | all agenda files |
6566 | =("file" ...)= | scan these files |
6567 | =FUNCTION= | scan files returned by calling {{{var(FUNCTION)}}} with no argument |
6568 | ~file-with-archives~ | current file and its archives |
6569 | ~agenda-with-archives~ | all agenda files, including archives |
6573 The time block to consider. This block is specified either
6574 absolutely, or relative to the current time and may be any of
6577 | =2007-12-31= | New year eve 2007 |
6578 | =2007-12= | December 2007 |
6579 | =2007-W50= | ISO-week 50 in 2007 |
6580 | =2007-Q2= | 2nd quarter in 2007 |
6581 | =2007= | the year 2007 |
6582 | ~today~, ~yesterday~, ~today-N~ | a relative day |
6583 | ~thisweek~, ~lastweek~, ~thisweek-N~ | a relative week |
6584 | ~thismonth~, ~lastmonth~, ~thismonth-N~ | a relative month |
6585 | ~thisyear~, ~lastyear~, ~thisyear-N~ | a relative year |
6586 | ~untilnow~ | all clocked time ever |
6588 #+vindex: org-clock-display-default-range
6589 When this option is not set, Org falls back to the value in
6590 ~org-clock-display-default-range~, which defaults to the current
6593 Use {{{kbd(S-LEFT)}}} or {{{kbd(S-RIGHT)}}} to shift the time
6598 A time string specifying when to start considering times.
6599 Relative times like ="<-2w>"= can also be used. See [[*Matching
6600 tags and properties]] for relative time syntax.
6604 A time string specifying when to stop considering times.
6605 Relative times like ="<now>"= can also be used. See [[*Matching
6606 tags and properties]] for relative time syntax.
6610 The starting day of the week. The default is 1 for Monday.
6614 The starting day of the month. The default is 1 for the first.
6618 Set to ~week~ or ~day~ to split the table into chunks. To use
6619 this, ~:block~ or ~:tstart~, ~:tend~ are needed.
6623 Do not show steps that have zero time.
6627 Do not show table sections from files which did not contribute.
6631 A tags match to select entries that should contribute. See
6632 [[*Matching tags and properties]] for the match syntax.
6634 #+findex: org-clocktable-write-default
6635 Then there are options that determine the formatting of the table.
6636 There options are interpreted by the function
6637 ~org-clocktable-write-default~, but you can specify your own function
6638 using the =:formatter= parameter.
6642 When ~t~, emphasize level one and level two items.
6646 Language[fn:77] to use for descriptive cells like "Task".
6650 Link the item headlines in the table to their origins.
6654 An integer to limit the width of the headline column in the Org
6655 table. If you write it like =50!=, then the headline is also
6656 shortened in export.
6660 Indent each headline field according to its level.
6664 Number of columns to be used for times. If this is smaller than
6665 =:maxlevel=, lower levels are lumped into one column.
6669 Should a level number column be included?
6673 A cons cell containing the column to sort and a sorting type.
6674 E.g., =:sort (1 . ?a)= sorts the first column alphabetically.
6678 Abbreviation for =:level nil :indent t :narrow 40! :tcolumns 1=.
6679 All are overwritten except if there is an explicit =:narrow=.
6683 A timestamp for the entry, when available. Look for =SCHEDULED=,
6684 =DEADLINE=, =TIMESTAMP= and =TIMESTAMP_IA= special properties
6685 (see [[*Special Properties]]), in this order.
6689 When this flag is non-~nil~, show the headline's tags.
6693 List of properties shown in the table. Each property gets its
6696 - =:inherit-props= ::
6698 When this flag is non-~nil~, the values for =:properties= are
6703 Content of a =TBLFM= keyword to be added and evaluated. As
6704 a special case, =:formula %= adds a column with % time. If you
6705 do not specify a formula here, any existing formula below the
6706 clock table survives updates and is evaluated.
6710 A function to format clock data and insert it into the buffer.
6712 To get a clock summary of the current level 1 tree, for the current
6713 day, you could write:
6716 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
6720 #+texinfo: @noindent
6721 To use a specific time range you could write[fn:78]
6724 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
6725 :tend "<2006-08-10 Thu 12:00>"
6729 #+texinfo: @noindent
6730 A range starting a week ago and ending right now could be written as
6733 ,#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
6737 #+texinfo: @noindent
6738 A summary of the current subtree with % times would be
6741 ,#+BEGIN: clocktable :scope subtree :link t :formula %
6745 #+texinfo: @noindent
6746 A horizontally compact representation of everything clocked during
6750 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
6754 *** Resolving idle time and continuous clocking
6756 :DESCRIPTION: Resolving time when you've been idle.
6757 :ALT_TITLE: Resolving idle time
6760 **** Resolving idle time
6765 #+cindex: resolve idle time
6766 #+cindex: idle, resolve, dangling
6768 If you clock in on a work item, and then walk away from your
6769 computer---perhaps to take a phone call---you often need to
6770 "resolve" the time you were away by either subtracting it from the
6771 current clock, or applying it to another one.
6773 #+vindex: org-clock-idle-time
6774 #+vindex: org-clock-x11idle-program-name
6775 By customizing the variable ~org-clock-idle-time~ to some integer,
6776 such as 10 or 15, Emacs can alert you when you get back to your
6777 computer after being idle for that many minutes[fn:79], and ask what
6778 you want to do with the idle time. There will be a question waiting
6779 for you when you get back, indicating how much idle time has passed
6780 constantly updated with the current amount, as well as a set of
6781 choices to correct the discrepancy:
6786 To keep some or all of the minutes and stay clocked in, press
6787 {{{kbd(k)}}}. Org asks how many of the minutes to keep. Press
6788 {{{kbd(RET)}}} to keep them all, effectively changing nothing, or
6789 enter a number to keep that many minutes.
6794 If you use the shift key and press {{{kbd(K)}}}, it keeps however
6795 many minutes you request and then immediately clock out of that
6796 task. If you keep all of the minutes, this is the same as just
6797 clocking out of the current task.
6802 To keep none of the minutes, use {{{kbd(s)}}} to subtract all the
6803 away time from the clock, and then check back in from the moment
6809 To keep none of the minutes and just clock out at the start of
6810 the away time, use the shift key and press {{{kbd(S)}}}.
6811 Remember that using shift always leave you clocked out, no matter
6812 which option you choose.
6817 To cancel the clock altogether, use {{{kbd(C)}}}. Note that if
6818 instead of canceling you subtract the away time, and the
6819 resulting clock amount is less than a minute, the clock is still
6820 canceled rather than cluttering up the log with an empty entry.
6822 What if you subtracted those away minutes from the current clock, and
6823 now want to apply them to a new clock? Simply clock in to any task
6824 immediately after the subtraction. Org will notice that you have
6825 subtracted time "on the books", so to speak, and will ask if you want
6826 to apply those minutes to the next task you clock in on.
6828 There is one other instance when this clock resolution magic occurs.
6829 Say you were clocked in and hacking away, and suddenly your cat chased
6830 a mouse who scared a hamster that crashed into your UPS's power
6831 button! You suddenly lose all your buffers, but thanks to auto-save
6832 you still have your recent Org mode changes, including your last clock
6835 If you restart Emacs and clock into any task, Org will notice that you
6836 have a dangling clock which was never clocked out from your last
6837 session. Using that clock's starting time as the beginning of the
6838 unaccounted-for period, Org will ask how you want to resolve that
6839 time. The logic and behavior is identical to dealing with away time
6840 due to idleness; it is just happening due to a recovery event rather
6841 than a set amount of idle time.
6843 You can also check all the files visited by your Org agenda for
6844 dangling clocks at any time using {{{kbd(M-x org-resolve-clocks
6845 RET)}}} (or {{{kbd(C-c C-x C-z)}}}).
6847 **** Continuous clocking
6851 #+cindex: continuous clocking
6853 #+vindex: org-clock-continuously
6854 You may want to start clocking from the time when you clocked out the
6855 previous task. To enable this systematically, set
6856 ~org-clock-continuously~ to non-~nil~. Each time you clock in, Org
6857 retrieves the clock-out time of the last clocked entry for this
6858 session, and start the new clock from there.
6860 If you only want this from time to time, use three universal prefix
6861 arguments with ~org-clock-in~ and two {{{kbd(C-u C-u)}}} with
6862 ~org-clock-in-last~.
6866 :DESCRIPTION: Planning work effort in advance.
6868 #+cindex: effort estimates
6869 #+cindex: @samp{EFFORT}, property
6870 #+vindex: org-effort-property
6872 If you want to plan your work in a very detailed way, or if you need
6873 to produce offers with quotations of the estimated work effort, you
6874 may want to assign effort estimates to entries. If you are also
6875 clocking your work, you may later want to compare the planned effort
6876 with the actual working time, a great way to improve planning
6877 estimates. Effort estimates are stored in a special property
6878 =EFFORT=. You can set the effort for an entry with the following
6881 - {{{kbd(C-c C-x e)}}} (~org-set-effort~) ::
6884 #+findex: org-set-effort
6885 Set the effort estimate for the current entry. With a prefix
6886 argument, set it to the next allowed value---see below. This
6887 command is also accessible from the agenda with the {{{kbd(e)}}}
6890 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) ::
6892 #+kindex: C-c C-x C-e
6893 #+findex: org-clock-modify-effort-estimate
6894 Modify the effort estimate of the item currently being clocked.
6896 Clearly the best way to work with effort estimates is through column
6897 view (see [[*Column View]]). You should start by setting up discrete
6898 values for effort estimates, and a =COLUMNS= format that displays
6899 these values together with clock sums---if you want to clock your
6900 time. For a specific buffer you can use:
6903 ,#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
6904 ,#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM
6907 #+texinfo: @noindent
6908 #+vindex: org-global-properties
6909 #+vindex: org-columns-default-format
6910 or, even better, you can set up these values globally by customizing
6911 the variables ~org-global-properties~ and
6912 ~org-columns-default-format~. In particular if you want to use this
6913 setup also in the agenda, a global setup may be advised.
6915 The way to assign estimates to individual items is then to switch to
6916 column mode, and to use {{{kbd(S-RIGHT)}}} and {{{kbd(S-LEFT)}}} to
6917 change the value. The values you enter are immediately summed up in
6918 the hierarchy. In the column next to it, any clocked time is
6921 #+vindex: org-agenda-columns-add-appointments-to-effort-sum
6922 If you switch to column view in the daily/weekly agenda, the effort
6923 column summarizes the estimated work effort for each day[fn:80], and
6924 you can use this to find space in your schedule. To get an overview
6925 of the entire part of the day that is committed, you can set the
6926 option ~org-agenda-columns-add-appointments-to-effort-sum~. The
6927 appointments on a day that take place over a specified time interval
6928 are then also added to the load estimate of the day.
6930 Effort estimates can be used in secondary agenda filtering that is
6931 triggered with the {{{kbd(/)}}} key in the agenda (see [[*Commands in
6932 the Agenda Buffer]]). If you have these estimates defined consistently,
6933 two or three key presses narrow down the list to stuff that fits into
6934 an available time slot.
6936 ** Taking Notes with a Relative Timer
6938 :DESCRIPTION: Notes with a running timer.
6941 #+cindex: relative timer
6942 #+cindex: countdown timer
6944 Org provides two types of timers. There is a relative timer that
6945 counts up, which can be useful when taking notes during, for example,
6946 a meeting or a video viewing. There is also a countdown timer.
6948 The relative and countdown are started with separate commands.
6950 - {{{kbd(C-c C-x 0)}}} (~org-timer-start~) ::
6953 #+findex: org-timer-start
6954 Start or reset the relative timer. By default, the timer is set
6955 to 0. When called with a {{{kbd(C-u)}}} prefix, prompt the user
6956 for a starting offset. If there is a timer string at point, this
6957 is taken as the default, providing a convenient way to restart
6958 taking notes after a break in the process. When called with
6959 a double prefix argument {{{kbd(C-u C-u)}}}, change all timer
6960 strings in the active region by a certain amount. This can be
6961 used to fix timer strings if the timer was not started at exactly
6964 - {{{kbd(C-c C-x ;)}}} (~org-timer-set-timer~) ::
6967 #+findex: org-timer-set-timer
6968 #+vindex: org-timer-default-timer
6969 Start a countdown timer. The user is prompted for a duration.
6970 ~org-timer-default-timer~ sets the default countdown value.
6971 Giving a numeric prefix argument overrides this default value.
6972 This command is available as {{{kbd(;)}}} in agenda buffers.
6974 Once started, relative and countdown timers are controlled with the
6977 - {{{kbd(C-c C-x .)}}} (~org-timer~) ::
6981 Insert a relative time into the buffer. The first time you use
6982 this, the timer starts. Using a prefix argument restarts it.
6984 - {{{kbd(C-c C-x -)}}} (~org-timer-item~) ::
6987 #+findex: org-timer-item
6988 Insert a description list item with the current relative time.
6989 With a prefix argument, first reset the timer to 0.
6991 - {{{kbd(M-RET)}}} (~org-insert-heading~) ::
6994 #+findex: org-insert-heading
6995 Once the timer list is started, you can also use
6996 {{{kbd(M-RET)}}} to insert new timer items.
6998 - {{{kbd(C-c C-x \,)}}} (~org-timer-pause-or-continue~) ::
7001 #+findex: org-timer-pause-or-continue
7002 Pause the timer, or continue it if it is already paused.
7004 - {{{kbd(C-c C-x _)}}} (~org-timer-stop~) ::
7007 #+findex: org-timer-stop
7008 Stop the timer. After this, you can only start a new timer, not
7009 continue the old one. This command also removes the timer from
7012 * Capture, Refile, Archive
7014 :DESCRIPTION: The ins and outs for projects.
7018 An important part of any organization system is the ability to quickly
7019 capture new ideas and tasks, and to associate reference material with
7020 them. Org does this using a process called /capture/. It also can
7021 store files related to a task (/attachments/) in a special directory.
7022 Once in the system, tasks and projects need to be moved around.
7023 Moving completed project trees to an archive file keeps the system
7028 :DESCRIPTION: Capturing new stuff.
7032 Capture lets you quickly store notes with little interruption of your
7033 work flow. Org's method for capturing new items is heavily inspired
7034 by John Wiegley's excellent Remember package.
7036 *** Setting up capture
7038 :DESCRIPTION: Where notes will be stored.
7041 The following customization sets a default target file for notes.
7043 #+vindex: org-default-notes-file
7044 #+begin_src emacs-lisp
7045 (setq org-default-notes-file (concat org-directory "/notes.org"))
7048 You may also define a global key for capturing new material (see
7053 :DESCRIPTION: Commands to invoke and terminate capture.
7056 - {{{kbd(M-x org-capture)}}} (~org-capture~) ::
7058 #+findex: org-capture
7060 Display the capture templates menu. If you have templates
7061 defined (see [[*Capture templates]]), it offers these templates for
7062 selection or use a new Org outline node as the default template.
7063 It inserts the template into the target file and switch to an
7064 indirect buffer narrowed to this new node. You may then insert
7065 the information you want.
7067 - {{{kbd(C-c C-c)}}} (~org-capture-finalize~) ::
7069 #+kindex: C-c C-c @r{(Capture buffer)}
7070 #+findex: org-capture-finalize
7071 Once you have finished entering information into the capture
7072 buffer, {{{kbd(C-c C-c)}}} returns you to the window
7073 configuration before the capture process, so that you can resume
7074 your work without further distraction. When called with a prefix
7075 argument, finalize and then jump to the captured item.
7077 - {{{kbd(C-c C-w)}}} (~org-capture-refile~) ::
7079 #+kindex: C-c C-w @r{(Capture buffer)}
7080 #+findex: org-capture-refile
7081 Finalize the capture process by refiling the note to a different
7082 place (see [[*Refile and Copy]]). Please realize that this is a
7083 normal refiling command that will be executed---so point position
7084 at the moment you run this command is important. If you have
7085 inserted a tree with a parent and children, first move point back
7086 to the parent. Any prefix argument given to this command is
7087 passed on to the ~org-refile~ command.
7089 - {{{kbd(C-c C-k)}}} (~org-capture-kill~) ::
7091 #+kindex: C-c C-k @r{(Capture buffer)}
7092 #+findex: org-capture-kill
7093 Abort the capture process and return to the previous state.
7095 #+kindex: k c @r{(Agenda)}
7096 You can also call ~org-capture~ in a special way from the agenda,
7097 using the {{{kbd(k c)}}} key combination. With this access, any
7098 timestamps inserted by the selected capture template defaults to the
7099 date at point in the agenda, rather than to the current date.
7101 To find the locations of the last stored capture, use ~org-capture~
7102 with prefix commands:
7104 - {{{kbd(C-u M-x org-capture)}}} ::
7106 Visit the target location of a capture template. You get to
7107 select the template in the usual way.
7109 - {{{kbd(C-u C-u M-x org-capture)}}} ::
7111 Visit the last stored capture item in its buffer.
7113 #+vindex: org-capture-bookmark
7114 #+vindex: org-capture-last-stored
7115 You can also jump to the bookmark ~org-capture-last-stored~, which is
7116 automatically created unless you set ~org-capture-bookmark~ to ~nil~.
7118 To insert the capture at point in an Org buffer, call ~org-capture~
7119 with a ~C-0~ prefix argument.
7121 *** Capture templates
7123 :DESCRIPTION: Define the outline of different note types.
7125 #+cindex: templates, for Capture
7127 You can use templates for different types of capture items, and for
7128 different target locations. The easiest way to create such templates
7129 is through the customize interface.
7133 #+kindex: C @r{(Capture menu}
7134 #+vindex: org-capture-templates
7135 Customize the variable ~org-capture-templates~.
7137 Before we give the formal description of template definitions, let's
7138 look at an example. Say you would like to use one template to create
7139 general TODO entries, and you want to put these entries under the
7140 heading =Tasks= in your file =~/org/gtd.org=. Also, a date tree in
7141 the file =journal.org= should capture journal entries. A possible
7142 configuration would look like:
7144 #+begin_src emacs-lisp
7145 (setq org-capture-templates
7146 '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
7147 "* TODO %?\n %i\n %a")
7148 ("j" "Journal" entry (file+datetree "~/org/journal.org")
7149 "* %?\nEntered on %U\n %i\n %a")))
7152 #+texinfo: @noindent
7153 If you then press {{{kbd(t)}}} from the capture menu, Org will prepare
7154 the template for you like this:
7158 [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
7161 #+texinfo: @noindent
7162 During expansion of the template, ~%a~ has been replaced by a link to
7163 the location from where you called the capture command. This can be
7164 extremely useful for deriving tasks from emails, for example. You
7165 fill in the task definition, press {{{kbd(C-c C-c)}}} and Org returns
7166 you to the same place where you started the capture process.
7168 To define special keys to capture to a particular template without
7169 going through the interactive template selection, you can create your
7170 key binding like this:
7172 #+begin_src emacs-lisp
7173 (define-key global-map "\C-cx"
7174 (lambda () (interactive) (org-capture nil "x")))
7177 **** Template elements
7179 :DESCRIPTION: What is needed for a complete template entry.
7182 Now lets look at the elements of a template definition. Each entry in
7183 ~org-capture-templates~ is a list with the following items:
7187 The keys that selects the template, as a string, characters only,
7188 for example ="a"=, for a template to be selected with a single
7189 key, or ="bt"= for selection with two keys. When using several
7190 keys, keys using the same prefix key must be sequential in the
7191 list and preceded by a 2-element entry explaining the prefix key,
7194 #+begin_src emacs-lisp
7195 ("b" "Templates for marking stuff to buy")
7198 #+texinfo: @noindent
7199 If you do not define a template for the {{{kbd(C)}}} key, this
7200 key opens the Customize buffer for this complex variable.
7204 A short string describing the template, shown during selection.
7208 The type of entry, a symbol. Valid values are:
7212 An Org mode node, with a headline. Will be filed as the child
7213 of the target entry or as a top-level entry. The target file
7214 should be an Org file.
7218 A plain list item, placed in the first plain list at the
7219 target location. Again the target file should be an Org
7224 A checkbox item. This only differs from the plain list item
7225 by the default template.
7229 A new line in the first table at the target location. Where
7230 exactly the line will be inserted depends on the properties
7231 ~:prepend~ and ~:table-line-pos~ (see below).
7235 Text to be inserted as it is.
7239 #+vindex: org-default-notes-file
7240 #+vindex: org-directory
7241 Specification of where the captured item should be placed. In
7242 Org files, targets usually define a node. Entries will become
7243 children of this node. Other types will be added to the table or
7244 list in the body of this node. Most target specifications
7245 contain a file name. If that file name is the empty string, it
7246 defaults to ~org-default-notes-file~. A file can also be given
7247 as a variable or as a function called with no argument. When an
7248 absolute path is not specified for a target, it is taken as
7249 relative to ~org-directory~.
7253 - =(file "path/to/file")= ::
7255 Text will be placed at the beginning or end of that file.
7257 - =(id "id of existing org entry")= ::
7259 Filing as child of this entry, or in the body of the entry.
7261 - =(file+headline "filename" "node headline")= ::
7263 Fast configuration if the target heading is unique in the file.
7265 - =(file+olp "filename" "Level 1 heading" "Level 2" ...)= ::
7267 For non-unique headings, the full path is safer.
7269 - =(file+regexp "filename" "regexp to find location")= ::
7271 Use a regular expression to position point.
7273 - =(file+olp+datetree "filename" [ "Level 1 heading" ...])= ::
7275 This target[fn:81] creates a heading in a date tree[fn:82] for
7276 today's date. If the optional outline path is given, the tree
7277 will be built under the node it is pointing to, instead of at
7278 top level. Check out the ~:time-prompt~ and ~:tree-type~
7279 properties below for additional options.
7281 - ~(file+function "filename" function-finding-location)~ ::
7283 A function to find the right location in the file.
7287 File to the entry that is currently being clocked.
7289 - ~(function function-finding-location)~ ::
7291 Most general way: write your own function which both visits the
7292 file and moves point to the right location.
7296 The template for creating the capture item. If you leave this
7297 empty, an appropriate default template will be used. Otherwise
7298 this is a string with escape codes, which will be replaced
7299 depending on time and context of the capture call. The string
7300 with escapes may be loaded from a template file, using the
7301 special syntax =(file "template filename")=. See below for more
7306 The rest of the entry is a property list of additional options.
7307 Recognized properties are:
7311 Normally new captured information will be appended at the
7312 target location (last child, last table line, last list item,
7313 ...). Setting this property changes that.
7315 - ~:immediate-finish~ ::
7317 When set, do not offer to edit the information, just file it
7318 away immediately. This makes sense if the template only needs
7319 information that can be added automatically.
7323 Set this to the number of lines to insert before and after the
7324 new item. Default 0, and the only other common value is 1.
7328 Start the clock in this item.
7332 Keep the clock running when filing the captured entry.
7334 - ~:clock-resume~ ::
7336 If starting the capture interrupted a clock, restart that clock
7337 when finished with the capture. Note that ~:clock-keep~ has
7338 precedence over ~:clock-resume~. When setting both to
7339 non-~nil~, the current clock will run and the previous one will
7344 Prompt for a date/time to be used for date/week trees and when
7345 filling the template. Without this property, capture uses the
7346 current date and time. Even if this property has not been set,
7347 you can force the same behavior by calling ~org-capture~ with
7348 a {{{kbd(C-1)}}} prefix argument.
7352 When ~week~, make a week tree instead of the month tree, i.e.,
7353 place the headings for each day under a heading with the
7358 Do not narrow the target buffer, simply show the full buffer. Default
7359 is to narrow it so that you only see the new material.
7361 - ~:table-line-pos~ ::
7363 Specification of the location in the table where the new line
7364 should be inserted. It should be a string like =II-3= meaning
7365 that the new line should become the third line before the
7366 second horizontal separator line.
7370 If the target file was not yet visited when capture was invoked, kill
7371 the buffer again after capture is completed.
7373 **** Template expansion
7375 :DESCRIPTION: Filling in information about time and context.
7378 In the template itself, special "%-escapes"[fn:83] allow dynamic
7379 insertion of content. The templates are expanded in the order given
7384 Insert the contents of the file given by {{{var(FILE)}}}.
7388 Evaluate Elisp SEXP and replace with the result. The
7389 {{{var(SEXP)}}} must return a string.
7393 The result of format-time-string on the {{{var(FORMAT)}}}
7398 Timestamp, date only.
7402 Timestamp, with date and time.
7406 Like ~%t~, ~%T~ above, but inactive timestamps.
7410 Initial content, the region when capture is called while the
7411 region is active. The entire text will be indented like ~%i~
7416 Annotation, normally the link created with ~org-store-link~.
7420 Like ~%a~, but prompt for the description part.
7424 Like ~%a~, but only insert the literal link.
7428 Current kill ring head.
7432 Content of the X clipboard.
7436 Title of the currently clocked task.
7440 Link to the currently clocked task.
7444 User name (taken from ~user-full-name~).
7448 File visited by current buffer when org-capture was called.
7452 Full path of the file or directory visited by current buffer.
7456 Specific information for certain link types, see below.
7460 Prompt for tags, with completion on tags in target file.
7464 Prompt for tags, with completion all tags in all agenda files.
7468 Like ~%t~, but prompt for date. Similarly ~%^T~, ~%^u~, ~%^U~. You may
7469 define a prompt like ~%^{Birthday}t~.
7473 Interactive selection of which kill or clip to use.
7477 Like ~%^C~, but insert as link.
7481 Prompt the user for a value for property PROP.
7485 Prompt the user for a string and replace this sequence with it.
7486 You may specify a default value and a completion table with
7487 ~%^{prompt|default|completion2|completion3...}~. The arrow keys
7488 access a prompt-specific history.
7492 Insert the text entered at the Nth ~%^{PROMPT}~, where N is
7493 a number, starting from 1.
7497 After completing the template, position point here.
7499 #+texinfo: @noindent
7500 #+vindex: org-store-link-props
7501 For specific link types, the following keywords are defined[fn:84]:
7503 #+vindex: org-from-is-user-regexp
7504 | Link type | Available keywords |
7505 |--------------+----------------------------------------------------------|
7506 | bbdb | ~%:name~, ~%:company~ |
7507 | irc | ~%:server~, ~%:port~, ~%:nick~ |
7508 | mh, rmail | ~%:type~, ~%:subject~, ~%:message-id~ |
7509 | | ~%:from~, ~%:fromname~, ~%:fromaddress~ |
7510 | | ~%:to~, ~%:toname~, ~%:toaddress~ |
7511 | | ~%:date~ (message date header field) |
7512 | | ~%:date-timestamp~ (date as active timestamp) |
7513 | | ~%:date-timestamp-inactive~ (date as inactive timestamp) |
7514 | | ~%:fromto~ (either "to NAME" or "from NAME")[fn:85] |
7515 | gnus | ~%:group~, for messages also all email fields |
7516 | w3, w3m | ~%:url~ |
7517 | info | ~%:file~, ~%:node~ |
7518 | calendar | ~%:date~ |
7519 | org-protocol | ~%:link~, ~%:description~, ~%:annotation~ |
7521 **** Templates in contexts
7523 :DESCRIPTION: Only show a template in a specific context.
7526 #+vindex: org-capture-templates-contexts
7527 To control whether a capture template should be accessible from
7528 a specific context, you can customize
7529 ~org-capture-templates-contexts~. Let's say, for example, that you
7530 have a capture template "p" for storing Gnus emails containing
7531 patches. Then you would configure this option like this:
7533 #+begin_src emacs-lisp
7534 (setq org-capture-templates-contexts
7535 '(("p" (in-mode . "message-mode"))))
7538 You can also tell that the command key {{{kbd(p)}}} should refer to
7539 another template. In that case, add this command key like this:
7541 #+begin_src emacs-lisp
7542 (setq org-capture-templates-contexts
7543 '(("p" "q" (in-mode . "message-mode"))))
7546 See the docstring of the variable for more information.
7550 :DESCRIPTION: Add files to tasks.
7552 #+cindex: attachments
7553 #+vindex: org-attach-directory
7555 It is often useful to associate reference material with an outline
7556 node/task. Small chunks of plain text can simply be stored in the
7557 subtree of a project. Hyperlinks (see [[*Hyperlinks]]) can establish
7558 associations with files that live elsewhere on your computer or in the
7559 cloud, like emails or source code files belonging to a project.
7560 Another method is /attachments/, which are files located in
7561 a directory belonging to an outline node. Org uses directories named
7562 by the unique ID of each entry. These directories are located in the
7563 ~data~ directory which lives in the same directory where your Org file
7564 lives[fn:86]. If you initialize this directory with =git init=, Org
7565 automatically commits changes when it sees them. The attachment
7566 system has been contributed to Org by John Wiegley.
7568 In cases where it seems better to do so, you can attach a directory of
7569 your choice to an entry. You can also make children inherit the
7570 attachment directory from a parent, so that an entire subtree uses the
7571 same attached directory.
7573 #+texinfo: @noindent
7574 The following commands deal with attachments:
7576 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
7579 #+findex: org-attach
7580 The dispatcher for commands related to the attachment system.
7581 After these keys, a list of commands is displayed and you must
7582 press an additional key to select a command:
7584 - {{{kbd(a)}}} (~org-attach-attach~) ::
7587 #+findex: org-attach-attach
7588 #+vindex: org-attach-method
7589 Select a file and move it into the task's attachment
7590 directory. The file is copied, moved, or linked, depending
7591 on ~org-attach-method~. Note that hard links are not
7592 supported on all systems.
7594 - {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} ::
7599 Attach a file using the copy/move/link method. Note that
7600 hard links are not supported on all systems.
7602 - {{{kbd(n)}}} (~org-attach-new~) ::
7605 #+findex: org-attach-new
7606 Create a new attachment as an Emacs buffer.
7608 - {{{kbd(z)}}} (~org-attach-sync~) ::
7611 #+findex: org-attach-sync
7612 Synchronize the current task with its attachment directory, in case
7613 you added attachments yourself.
7615 - {{{kbd(o)}}} (~org-attach-open~) ::
7618 #+findex: org-attach-open
7619 #+vindex: org-file-apps
7620 Open current task's attachment. If there is more than one,
7621 prompt for a file name first. Opening follows the rules set
7622 by ~org-file-apps~. For more details, see the information
7623 on following hyperlinks (see [[*Handling Links]]).
7625 - {{{kbd(O)}}} (~org-attach-open-in-emacs~) ::
7628 #+findex: org-attach-open-in-emacs
7629 Also open the attachment, but force opening the file in
7632 - {{{kbd(f)}}} (~org-attach-reveal~) ::
7635 #+findex: org-attach-reveal
7636 Open the current task's attachment directory.
7638 - {{{kbd(F)}}} (~org-attach-reveal-in-emacs~) ::
7641 #+findex: org-attach-reveal-in-emacs
7642 Also open the directory, but force using Dired in Emacs.
7644 - {{{kbd(d)}}} (~org-attach-delete-one~) ::
7647 Select and delete a single attachment.
7649 - {{{kbd(D)}}} (~org-attach-delete-all~) ::
7652 Delete all of a task's attachments. A safer way is to open
7653 the directory in Dired and delete from there.
7655 - {{{kbd(s)}}} (~org-attach-set-directory~) ::
7658 #+cindex: @samp{ATTACH_DIR}, property
7659 Set a specific directory as the entry's attachment
7660 directory. This works by putting the directory path into
7661 the =ATTACH_DIR= property.
7663 - {{{kbd(i)}}} (~org-attach-set-inherit~) ::
7666 #+cindex: @samp{ATTACH_DIR_INHERIT}, property
7667 Set the =ATTACH_DIR_INHERIT= property, so that children use
7668 the same directory for attachments as the parent does.
7670 #+cindex: attach from Dired
7671 #+findex: org-attach-dired-to-subtree
7672 It is possible to attach files to a subtree from a Dired buffer. To
7673 use this feature, have one window in Dired mode containing the file(s)
7674 to be attached and another window with point in the subtree that shall
7675 get the attachments. In the Dired window, with point on a file,
7676 {{{kbd(M-x org-attach-dired-to-subtree)}}} attaches the file to the
7677 subtree using the attachment method set by variable
7678 ~org-attach-method~. When files are marked in the Dired window then
7679 all marked files get attached.
7681 Add the following lines to the Emacs init file to have {{{kbd(C-c C-x
7682 a)}}} attach files in Dired buffers.
7684 #+begin_src emacs-lisp
7685 (add-hook 'dired-mode-hook
7687 (define-key dired-mode-map
7689 #'org-attach-dired-to-subtree))))
7692 The following code shows how to bind the previous command with
7693 a specific attachment method.
7695 #+begin_src emacs-lisp
7696 (add-hook 'dired-mode-hook
7698 (define-key dired-mode-map (kbd "C-c C-x c")
7701 (let ((org-attach-method 'cp))
7702 (call-interactively #'org-attach-dired-to-subtree))))))
7707 :DESCRIPTION: Getting input from RSS feeds.
7710 #+cindex: Atom feeds
7712 Org can add and change entries based on information found in RSS feeds
7713 and Atom feeds. You could use this to make a task out of each new
7714 podcast in a podcast feed. Or you could use a phone-based
7715 note-creating service on the web to import tasks into Org. To access
7716 feeds, configure the variable ~org-feed-alist~. The docstring of this
7717 variable has detailed information. With the following
7719 #+begin_src emacs-lisp
7720 (setq org-feed-alist
7722 "http://rss.slashdot.org/Slashdot/slashdot"
7723 "~/txt/org/feeds.org" "Slashdot Entries")))
7726 #+texinfo: @noindent
7727 new items from the feed provided by =rss.slashdot.org= result in new
7728 entries in the file =~/org/feeds.org= under the heading =Slashdot
7729 Entries=, whenever the following command is used:
7731 - {{{kbd(C-c C-x g)}}} (~org-feed-update-all~) ::
7734 Collect items from the feeds configured in ~org-feed-alist~ and
7737 - {{{kbd(C-c C-x G)}}} (~org-feed-goto-inbox~) ::
7740 Prompt for a feed name and go to the inbox configured for this feed.
7742 Under the same headline, Org creates a drawer =FEEDSTATUS= in which it
7743 stores information about the status of items in the feed, to avoid
7744 adding the same item several times.
7746 For more information, including how to read atom feeds, see
7747 =org-feed.el= and the docstring of ~org-feed-alist~.
7749 ** Protocols for External Access
7751 :DESCRIPTION: External access to Emacs and Org.
7752 :ALT_TITLE: Protocols
7754 #+cindex: protocols, for external access
7756 Org protocol is a means to trigger custom actions in Emacs from
7757 external applications. Any application that supports calling external
7758 programs with an URL as argument may be used with this functionality.
7759 For example, you can configure bookmarks in your web browser to send
7760 a link to the current page to Org and create a note from it using
7761 capture (see [[*Capture]]). You can also create a bookmark that tells
7762 Emacs to open the local source file of a remote website you are
7765 #+cindex: Org protocol, set-up
7766 #+cindex: Installing Org protocol
7767 In order to use Org protocol from an application, you need to register
7768 =org-protocol://= as a valid scheme-handler. External calls are
7769 passed to Emacs through the =emacsclient= command, so you also need to
7770 ensure an Emacs server is running. More precisely, when the
7773 : emacsclient org-protocol://PROTOCOL?key1=val1&key2=val2
7775 #+texinfo: @noindent
7776 Emacs calls the handler associated to {{{var(PROTOCOL)}}} with
7777 argument =(:key1 val1 :key2 val2)=.
7779 #+cindex: protocol, new protocol
7780 #+cindex: defining new protocols
7781 Org protocol comes with three predefined protocols, detailed in the
7782 following sections. Configure ~org-protocol-protocol-alist~ to define
7785 *** ~store-link~ protocol
7787 :DESCRIPTION: Store a link, push URL to kill-ring.
7789 #+cindex: store-link protocol
7790 #+cindex: protocol, store-link
7792 Using ~store-link~ handler, you can copy links, insertable through
7793 {{{kbd(M-x org-insert-link)}}} or yanking thereafter. More precisely,
7796 : emacsclient org-protocol://store-link?url=URL&title=TITLE
7798 #+texinfo: @noindent
7799 stores the following link:
7803 In addition, {{{var(URL)}}} is pushed on the kill-ring for yanking.
7804 You need to encode {{{var(URL)}}} and {{{var(TITLE)}}} if they contain
7805 slashes, and probably quote those for the shell.
7807 To use this feature from a browser, add a bookmark with an arbitrary
7808 name, e.g., =Org: store-link= and enter this as /Location/:
7811 javascript:location.href='org-protocol://store-link?url='+
7812 encodeURIComponent(location.href);
7815 *** ~capture~ protocol
7817 :DESCRIPTION: Fill a buffer with external information.
7819 #+cindex: capture protocol
7820 #+cindex: protocol, capture
7822 Activating "capture" handler pops up a =Capture= buffer and fills the
7823 capture template associated to the =X= key with them.
7825 : emacsclient org-protocol://capture?template=X?url=URL?title=TITLE?body=BODY
7827 To use this feature, add a bookmark with an arbitrary name, e.g.,
7828 =Org: capture=, and enter this as =Location=:
7831 javascript:location.href='org-protocol://capture?template=x'+
7832 '&url='+encodeURIComponent(window.location.href)+
7833 '&title='+encodeURIComponent(document.title)+
7834 '&body='+encodeURIComponent(window.getSelection());
7837 #+vindex: org-protocol-default-template-key
7838 The result depends on the capture template used, which is set in the
7839 bookmark itself, as in the example above, or in
7840 ~org-protocol-default-template-key~.
7842 The following template placeholders are available:
7846 %:description The webpage title
7847 %:annotation Equivalent to [[%:link][%:description]]
7848 %i The selected text
7851 *** ~open-source~ protocol
7853 :DESCRIPTION: Edit published contents.
7855 #+cindex: open-source protocol
7856 #+cindex: protocol, open-source
7858 The ~open-source~ handler is designed to help with editing local
7859 sources when reading a document. To that effect, you can use
7860 a bookmark with the following location:
7863 javascript:location.href='org-protocol://open-source?&url='+
7864 encodeURIComponent(location.href)
7867 #+vindex: org-protocol-project-alist
7868 The variable ~org-protocol-project-alist~ maps URLs to local file
7869 names, by stripping URL parameters from the end and replacing the
7870 ~:base-url~ with ~:working-directory~ and ~:online-suffix~ with
7871 ~:working-suffix~. For example, assuming you own a local copy of
7872 =https://orgmode.org/worg/= contents at =/home/user/worg=, you can set
7873 ~org-protocol-project-alist~ to the following
7875 #+begin_src emacs-lisp
7876 (setq org-protocol-project-alist
7878 :base-url "https://orgmode.org/worg/"
7879 :working-directory "/home/user/worg/"
7880 :online-suffix ".html"
7881 :working-suffix ".org")))
7884 #+texinfo: @noindent
7885 If you are now browsing
7886 =https://orgmode.org/worg/org-contrib/org-protocol.html= and find
7887 a typo or have an idea about how to enhance the documentation, simply
7888 click the bookmark and start editing.
7890 #+cindex: rewritten URL in open-source protocol
7891 #+cindex: protocol, open-source rewritten URL
7892 However, such mapping may not yield the desired results. Suppose you
7893 maintain an online store located at =http://example.com/=. The local
7894 sources reside in =/home/user/example/=. It is common practice to
7895 serve all products in such a store through one file and rewrite URLs
7896 that do not match an existing file on the server. That way, a request
7897 to =http://example.com/print/posters.html= might be rewritten on the
7898 server to something like
7899 =http://example.com/shop/products.php/posters.html.php=. The
7900 ~open-source~ handler probably cannot find a file named
7901 =/home/user/example/print/posters.html.php= and fails.
7903 Such an entry in ~org-protocol-project-alist~ may hold an additional
7904 property ~:rewrites~. This property is a list of cons cells, each of
7905 which maps a regular expression to a path relative to the
7906 ~:working-directory~.
7908 Now map the URL to the path =/home/user/example/products.php= by
7909 adding ~:rewrites~ rules like this:
7911 #+begin_src emacs-lisp
7912 (setq org-protocol-project-alist
7914 :base-url "http://example.com/"
7915 :working-directory "/home/user/example/"
7916 :online-suffix ".php"
7917 :working-suffix ".php"
7918 :rewrites (("example.com/print/" . "products.php")
7919 ("example.com/$" . "index.php")))))
7922 #+texinfo: @noindent
7923 Since =example.com/$= is used as a regular expression, it maps
7924 =http://example.com/=, =https://example.com=,
7925 =http://www.example.com/= and similar to
7926 =/home/user/example/index.php=.
7928 The ~:rewrites~ rules are searched as a last resort if and only if no
7929 existing file name is matched.
7931 #+cindex: protocol, open-source, set-up mapping
7932 #+cindex: mappings in open-source protocol
7933 #+findex: org-protocol-create
7934 #+findex: org-protocol-create-for-org
7935 Two functions can help you filling ~org-protocol-project-alist~ with
7936 valid contents: ~org-protocol-create~ and
7937 ~org-protocol-create-for-org~. The latter is of use if you're editing
7938 an Org file that is part of a publishing project.
7942 :DESCRIPTION: Moving/copying a tree from one place to another.
7944 #+cindex: refiling notes
7945 #+cindex: copying notes
7947 When reviewing the captured data, you may want to refile or to copy
7948 some of the entries into a different list, for example into a project.
7949 Cutting, finding the right location, and then pasting the note is
7950 cumbersome. To simplify this process, you can use the following
7953 - {{{kbd(C-c M-w)}}} (~org-copy~) ::
7957 Copying works like refiling, except that the original note is not
7960 - {{{kbd(C-c C-w)}}} (~org-refile~) ::
7963 #+findex: org-refile
7964 #+vindex: org-reverse-note-order
7965 #+vindex: org-refile-targets
7966 #+vindex: org-refile-use-outline-path
7967 #+vindex: org-outline-path-complete-in-steps
7968 #+vindex: org-refile-allow-creating-parent-nodes
7969 #+vindex: org-log-refile
7970 Refile the entry or region at point. This command offers
7971 possible locations for refiling the entry and lets you select one
7972 with completion. The item (or all items in the region) is filed
7973 below the target heading as a subitem. Depending on
7974 ~org-reverse-note-order~, it is either the first or last subitem.
7976 By default, all level 1 headlines in the current buffer are
7977 considered to be targets, but you can have more complex
7978 definitions across a number of files. See the variable
7979 ~org-refile-targets~ for details. If you would like to select
7980 a location via a file-path-like completion along the outline
7981 path, see the variables ~org-refile-use-outline-path~ and
7982 ~org-outline-path-complete-in-steps~. If you would like to be
7983 able to create new nodes as new parents for refiling on the fly,
7984 check the variable ~org-refile-allow-creating-parent-nodes~.
7985 When the variable ~org-log-refile~[fn:87] is set, a timestamp or
7986 a note is recorded whenever an entry is refiled.
7988 - {{{kbd(C-u C-c C-w)}}} ::
7990 #+kindex: C-u C-c C-w
7991 Use the refile interface to jump to a heading.
7993 - {{{kbd(C-u C-u C-c C-w)}}} (~org-refile-goto-last-stored~) ::
7995 #+kindex: C-u C-u C-c C-w
7996 #+findex: org-refile-goto-last-stored
7997 Jump to the location where ~org-refile~ last moved a tree to.
7999 - {{{kbd(C-2 C-c C-w)}}} ::
8001 #+kindex: C-2 C-c C-w
8002 Refile as the child of the item currently being clocked.
8004 - {{{kbd(C-3 C-c C-w)}}} ::
8006 #+kindex: C-3 C-c C-w
8007 #+vindex: org-refile-keep
8008 Refile and keep the entry in place. Also see ~org-refile-keep~
8009 to make this the default behavior, and beware that this may
8010 result in duplicated ~ID~ properties.
8012 - {{{kbd(C-0 C-c C-w)}}} or {{{kbd(C-u C-u C-u C-c C-w)}}} (~org-refile-cache-clear~) ::
8014 #+kindex: C-u C-u C-u C-c C-w
8015 #+kindex: C-0 C-c C-w
8016 #+findex: org-refile-cache-clear
8017 #+vindex: org-refile-use-cache
8018 Clear the target cache. Caching of refile targets can be turned
8019 on by setting ~org-refile-use-cache~. To make the command see
8020 new possible targets, you have to clear the cache with this
8025 :DESCRIPTION: What to do with finished products.
8029 When a project represented by a (sub)tree is finished, you may want to
8030 move the tree out of the way and to stop it from contributing to the
8031 agenda. Archiving is important to keep your working files compact and
8032 global searches like the construction of agenda views fast.
8034 - {{{kbd(C-c C-x C-a)}}} (~org-archive-subtree-default~) ::
8036 #+kindex: C-c C-x C-a
8037 #+findex: org-archive-subtree-default
8038 #+vindex: org-archive-default-command
8039 Archive the current entry using the command specified in the
8040 variable ~org-archive-default-command~.
8042 *** Moving a tree to an archive file
8044 :DESCRIPTION: Moving a tree to an archive file.
8045 :ALT_TITLE: Moving subtrees
8047 #+cindex: external archiving
8049 The most common archiving action is to move a project tree to another
8050 file, the archive file.
8052 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd(C-c $)}}} (~org-archive-subtree~) ::
8054 #+kindex: C-c C-x C-s
8056 #+findex: org-archive-subtree
8057 #+vindex: org-archive-location
8058 Archive the subtree starting at point position to the location
8059 given by ~org-archive-location~.
8061 - {{{kbd(C-u C-c C-x C-s)}}} ::
8063 #+kindex: C-u C-c C-x C-s
8064 Check if any direct children of the current headline could be
8065 moved to the archive. To do this, check each subtree for open
8066 TODO entries. If none is found, the command offers to move it to
8067 the archive location. If point is /not/ on a headline when this
8068 command is invoked, check level 1 trees.
8070 - {{{kbd(C-u C-u C-c C-x C-s)}}} ::
8072 #+kindex: C-u C-u C-c C-x C-s
8073 As above, but check subtree for timestamps instead of TODO
8074 entries. The command offers to archive the subtree if it /does/
8075 contain a timestamp, and that timestamp is in the past.
8077 #+cindex: archive locations
8078 The default archive location is a file in the same directory as the
8079 current file, with the name derived by appending =_archive= to the
8080 current file name. You can also choose what heading to file archived
8081 items under, with the possibility to add them to a datetree in a file.
8082 For information and examples on how to specify the file and the
8083 heading, see the documentation string of the variable
8084 ~org-archive-location~.
8086 There is also an in-buffer option for setting this variable, for
8089 #+cindex: @samp{ARCHIVE}, keyword
8090 : #+ARCHIVE: %s_done::
8092 #+texinfo: @noindent
8093 #+cindex: ARCHIVE, property
8094 If you would like to have a special archive location for a single
8095 entry or a (sub)tree, give the entry an =ARCHIVE= property with the
8096 location as the value (see [[*Properties and Columns]]).
8098 #+vindex: org-archive-save-context-info
8099 When a subtree is moved, it receives a number of special properties
8100 that record context information like the file from where the entry
8101 came, its outline path the archiving time etc. Configure the variable
8102 ~org-archive-save-context-info~ to adjust the amount of information
8105 *** Internal archiving
8107 :DESCRIPTION: Switch off a tree but keep it in the file.
8110 #+cindex: @samp{ARCHIVE}, tag
8111 If you want to just switch off---for agenda views---certain subtrees
8112 without moving them to a different file, you can use the =ARCHIVE=
8115 A headline that is marked with the =ARCHIVE= tag (see [[*Tags]]) stays at
8116 its location in the outline tree, but behaves in the following way:
8119 #+vindex: org-cycle-open-archived-trees
8120 It does not open when you attempt to do so with a visibility cycling
8121 command (see [[*Visibility Cycling]]). You can force cycling archived
8122 subtrees with {{{kbd(C-TAB)}}}, or by setting the option
8123 ~org-cycle-open-archived-trees~. Also normal outline commands, like
8124 ~outline-show-all~, open archived subtrees.
8127 #+vindex: org-sparse-tree-open-archived-trees
8128 During sparse tree construction (see [[*Sparse Trees]]), matches in
8129 archived subtrees are not exposed, unless you configure the option
8130 ~org-sparse-tree-open-archived-trees~.
8133 #+vindex: org-agenda-skip-archived-trees
8134 During agenda view construction (see [[*Agenda Views]]), the content of
8135 archived trees is ignored unless you configure the option
8136 ~org-agenda-skip-archived-trees~, in which case these trees are
8137 always included. In the agenda you can press {{{kbd(v a)}}} to get
8138 archives temporarily included.
8141 #+vindex: org-export-with-archived-trees
8142 Archived trees are not exported (see [[*Exporting]]), only the headline
8143 is. Configure the details using the variable
8144 ~org-export-with-archived-trees~.
8147 #+vindex: org-columns-skip-archived-trees
8148 Archived trees are excluded from column view unless the variable
8149 ~org-columns-skip-archived-trees~ is configured to ~nil~.
8151 The following commands help manage the =ARCHIVE= tag:
8153 - {{{kbd(C-c C-x a)}}} (~org-toggle-archive-tag~) ::
8156 #+findex: org-toggle-archive-tag
8157 Toggle the archive tag for the current headline. When the tag is
8158 set, the headline changes to a shadowed face, and the subtree
8161 - {{{kbd(C-u C-c C-x a)}}} ::
8163 #+kindex: C-u C-c C-x a
8164 Check if any direct children of the current headline should be
8165 archived. To do this, check each subtree for open TODO entries.
8166 If none is found, the command offers to set the =ARCHIVE= tag for
8167 the child. If point is /not/ on a headline when this command is
8168 invoked, check the level 1 trees.
8170 - {{{kbd(C-TAB)}}} (~org-force-cycle-archived~) ::
8173 Cycle a tree even if it is tagged with =ARCHIVE=.
8175 - {{{kbd(C-c C-x A)}}} (~org-archive-to-archive-sibling~) ::
8178 #+findex: org-archive-to-archive-sibling
8179 Move the current entry to the /Archive Sibling/. This is
8180 a sibling of the entry with the heading =Archive= and the archive
8181 tag. The entry becomes a child of that sibling and in this way
8182 retains a lot of its original context, including inherited tags
8183 and approximate position in the outline.
8187 :DESCRIPTION: Collecting information into views.
8189 #+cindex: agenda views
8191 Due to the way Org works, TODO items, time-stamped items, and tagged
8192 headlines can be scattered throughout a file or even a number of
8193 files. To get an overview of open action items, or of events that are
8194 important for a particular date, this information must be collected,
8195 sorted and displayed in an organized way.
8197 Org can select items based on various criteria and display them in
8198 a separate buffer. Seven different view types are provided:
8200 - an /agenda/ that is like a calendar and shows information for
8203 - a /TODO list/ that covers all unfinished action items,
8205 - a /match view/, showings headlines based on the tags, properties,
8206 and TODO state associated with them,
8208 - a /text search view/ that shows all entries from multiple files that
8209 contain specified keywords,
8211 - a /stuck projects view/ showing projects that currently do not move
8214 - /custom views/ that are special searches and combinations of
8217 #+texinfo: @noindent
8218 The extracted information is displayed in a special /agenda buffer/.
8219 This buffer is read-only, but provides commands to visit the
8220 corresponding locations in the original Org files, and even to edit
8221 these files remotely.
8223 #+vindex: org-agenda-skip-comment-trees
8224 #+vindex: org-agenda-skip-archived-trees
8225 #+cindex: commented entries, in agenda views
8226 #+cindex: archived entries, in agenda views
8227 By default, the report ignores commented (see [[*Comment Lines]]) and
8228 archived (see [[*Internal archiving]]) entries. You can override this by
8229 setting ~org-agenda-skip-comment-trees~ and
8230 ~org-agenda-skip-archived-trees~ to ~nil~.
8232 #+vindex: org-agenda-window-setup
8233 #+vindex: org-agenda-restore-windows-after-quit
8234 Two variables control how the agenda buffer is displayed and whether
8235 the window configuration is restored when the agenda exits:
8236 ~org-agenda-window-setup~ and ~org-agenda-restore-windows-after-quit~.
8240 :DESCRIPTION: Files being searched for agenda information.
8242 #+cindex: agenda files
8243 #+cindex: files for agenda
8245 #+vindex: org-agenda-files
8246 The information to be shown is normally collected from all /agenda
8247 files/, the files listed in the variable ~org-agenda-files~[fn:88].
8248 If a directory is part of this list, all files with the extension
8249 =.org= in this directory are part of the list.
8251 Thus, even if you only work with a single Org file, that file should
8252 be put into the list[fn:89]. You can customize ~org-agenda-files~,
8253 but the easiest way to maintain it is through the following commands
8255 #+attr_texinfo: :sep and
8256 - {{{kbd(C-c [)}}} (~org-agenda-file-to-front~) ::
8259 #+findex: org-agenda-file-to-front
8260 #+cindex: files, adding to agenda list
8261 Add current file to the list of agenda files. The file is added
8262 to the front of the list. If it was already in the list, it is
8263 moved to the front. With a prefix argument, file is added/moved
8266 - {{{kbd(C-c ])}}} (~org-remove-file~) ::
8269 #+findex: org-remove-file
8270 Remove current file from the list of agenda files.
8272 - {{{kbd(C-')}}} and {{{kbd(C-\,)}}} (~org-cycle-agenda-files~) ::
8276 #+findex: org-cycle-agenda-files
8277 #+cindex: cycling, of agenda files
8278 Cycle through agenda file list, visiting one file after the other.
8280 - {{{kbd(M-x org-switchb)}}} ::
8282 #+findex: org-switchb
8283 Command to use an iswitchb-like interface to switch to and
8284 between Org buffers.
8286 #+texinfo: @noindent
8287 The Org menu contains the current list of files and can be used to
8290 If you would like to focus the agenda temporarily on a file not in
8291 this list, or on just one file in the list, or even on only a subtree
8292 in a file, then this can be done in different ways. For a single
8293 agenda command, you may press {{{kbd(<)}}} once or several times in
8294 the dispatcher (see [[*The Agenda Dispatcher]]). To restrict the agenda
8295 scope for an extended period, use the following commands:
8297 - {{{kbd(C-c C-x <)}}} (~org-agenda-set-restriction-lock~) ::
8300 #+findex: org-agenda-set-restriction-lock
8301 Restrict the agenda to the current subtree. If there already is
8302 a restriction at point, remove it. When called with a universal
8303 prefix argument or with point before the first headline in
8304 a file, set the agenda scope to the entire file. This
8305 restriction remains in effect until removed with {{{kbd(C-c C-x
8306 >)}}}, or by typing either {{{kbd(<)}}} or {{{kbd(>)}}} in the
8307 agenda dispatcher. If there is a window displaying an agenda
8308 view, the new restriction takes effect immediately.
8310 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
8313 #+findex: org-agenda-remove-restriction-lock
8314 Remove the restriction created by {{{kbd(C-c C-x <)}}}.
8316 #+texinfo: @noindent
8317 When working with =speedbar.el=, you can use the following commands in
8320 - {{{kbd(<)}}} (~org-speedbar-set-agenda-restriction~) ::
8322 #+findex: org-speedbar-set-agenda-restriction
8323 Restrict the agenda to the item---either an Org file or a subtree
8324 in such a file---at point in the Speedbar frame. If agenda is
8325 already restricted there, remove the restriction. If there is
8326 a window displaying an agenda view, the new restriction takes
8329 - {{{kbd(>)}}} (~org-agenda-remove-restriction-lock~) ::
8331 #+findex: org-agenda-remove-restriction-lock
8332 Remove the restriction.
8334 ** The Agenda Dispatcher
8336 :DESCRIPTION: Keyboard access to agenda views.
8337 :ALT_TITLE: Agenda Dispatcher
8339 #+cindex: agenda dispatcher
8340 #+cindex: dispatching agenda commands
8342 The views are created through a dispatcher, accessible with {{{kbd(M-x
8343 org-agenda)}}}, or, better, bound to a global key (see [[*Activation]]).
8344 It displays a menu from which an additional letter is required to
8345 execute a command. The dispatcher offers the following default
8350 Create the calendar-like agenda (see [[*Weekly/daily agenda]]).
8352 - {{{kbd(t)}}} or {{{kbd(T)}}} ::
8354 Create a list of all TODO items (see [[*The global TODO list]]).
8356 - {{{kbd(m)}}} or {{{kbd(M)}}} ::
8358 Create a list of headlines matching a given expression (see
8359 [[*Matching tags and properties]]).
8363 #+kindex: s @r{(Agenda dispatcher)}
8364 Create a list of entries selected by a boolean expression of
8365 keywords and/or regular expressions that must or must not occur
8370 #+kindex: / @r{(Agenda dispatcher)}
8371 #+vindex: org-agenda-text-search-extra-files
8372 Search for a regular expression in all agenda files and
8373 additionally in the files listed in
8374 ~org-agenda-text-search-extra-files~. This uses the Emacs
8375 command ~multi-occur~. A prefix argument can be used to specify
8376 the number of context lines for each match, default is
8379 - {{{kbd(#)}}} or {{{kbd(!)}}} ::
8381 Create a list of stuck projects (see [[*Stuck projects]]).
8385 #+kindex: < @r{(Agenda dispatcher)}
8386 Restrict an agenda command to the current buffer[fn:90]. After
8387 pressing {{{kbd(<)}}}, you still need to press the character
8388 selecting the command.
8392 #+kindex: < < @r{(Agenda dispatcher)}
8393 If there is an active region, restrict the following agenda
8394 command to the region. Otherwise, restrict it to the current
8395 subtree[fn:91]. After pressing {{{kbd(< <)}}}, you still need to
8396 press the character selecting the command.
8400 #+kindex: * @r{(Agenda dispatcher)}
8401 #+vindex: org-agenda-sticky
8402 #+findex: org-toggle-sticky-agenda
8403 Toggle sticky agenda views. By default, Org maintains only
8404 a single agenda buffer and rebuilds it each time you change the
8405 view, to make sure everything is always up to date. If you
8406 switch between views often and the build time bothers you, you
8407 can turn on sticky agenda buffers (make this the default by
8408 customizing the variable ~org-agenda-sticky~). With sticky
8409 agendas, the dispatcher only switches to the selected view, you
8410 need to update it by hand with {{{kbd(r)}}} or {{{kbd(g)}}}. You
8411 can toggle sticky agenda view any time with
8412 ~org-toggle-sticky-agenda~.
8414 You can also define custom commands that are accessible through the
8415 dispatcher, just like the default commands. This includes the
8416 possibility to create extended agenda buffers that contain several
8417 blocks together, for example the weekly agenda, the global TODO list
8418 and a number of special tags matches. See [[*Custom Agenda Views]].
8420 ** The Built-in Agenda Views
8422 :DESCRIPTION: What is available out of the box?
8423 :ALT_TITLE: Built-in Agenda Views
8426 In this section we describe the built-in views.
8428 *** Weekly/daily agenda
8430 :DESCRIPTION: The calendar page with current tasks.
8433 #+cindex: weekly agenda
8434 #+cindex: daily agenda
8436 The purpose of the weekly/daily /agenda/ is to act like a page of
8437 a paper agenda, showing all the tasks for the current week or day.
8439 - {{{kbd(M-x org-agenda a)}}} (~org-agenda-list~) ::
8441 #+kindex: a @r{(Agenda dispatcher)}
8442 #+findex: org-agenda-list
8443 #+cindex: org-agenda, command
8444 Compile an agenda for the current week from a list of Org files.
8445 The agenda shows the entries for each day. With a numeric prefix
8446 argument[fn:92]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you
8447 may set the number of days to be displayed.
8449 #+vindex: org-agenda-span
8450 #+vindex: org-agenda-start-day
8451 #+vindex: org-agenda-start-on-weekday
8452 The default number of days displayed in the agenda is set by the
8453 variable ~org-agenda-span~. This variable can be set to any number of
8454 days you want to see by default in the agenda, or to a span name, such
8455 a ~day~, ~week~, ~month~ or ~year~. For weekly agendas, the default
8456 is to start on the previous Monday (see
8457 ~org-agenda-start-on-weekday~). You can also set the start date using
8458 a date shift: ~(setq org-agenda-start-day "+10d")~ starts the agenda
8459 ten days from today in the future.
8461 Remote editing from the agenda buffer means, for example, that you can
8462 change the dates of deadlines and appointments from the agenda buffer.
8463 The commands available in the Agenda buffer are listed in [[*Commands in
8464 the Agenda Buffer]].
8466 **** Calendar/Diary integration
8470 #+cindex: calendar integration
8471 #+cindex: diary integration
8473 Emacs contains the calendar and diary by Edward\nbsp{}M.\nbsp{}Reingold. The
8474 calendar displays a three-month calendar with holidays from different
8475 countries and cultures. The diary allows you to keep track of
8476 anniversaries, lunar phases, sunrise/set, recurrent appointments
8477 (weekly, monthly) and more. In this way, it is quite complementary to
8478 Org. It can be very useful to combine output from Org with the diary.
8480 In order to include entries from the Emacs diary into Org mode's
8481 agenda, you only need to customize the variable
8483 #+begin_src emacs-lisp
8484 (setq org-agenda-include-diary t)
8487 #+texinfo: @noindent
8488 After that, everything happens automatically. All diary entries
8489 including holidays, anniversaries, etc., are included in the agenda
8490 buffer created by Org mode. {{{kbd(SPC)}}}, {{{kbd(TAB)}}}, and
8491 {{{kbd(RET)}}} can be used from the agenda buffer to jump to the diary
8492 file in order to edit existing diary entries. The {{{kbd(i)}}}
8493 command to insert new entries for the current date works in the agenda
8494 buffer, as well as the commands {{{kbd(S)}}}, {{{kbd(M)}}}, and
8495 {{{kbd(C)}}} to display Sunrise/Sunset times, show lunar phases and to
8496 convert to other calendars, respectively. {{{kbd(c)}}} can be used to
8497 switch back and forth between calendar and agenda.
8499 If you are using the diary only for S-exp entries and holidays, it is
8500 faster to not use the above setting, but instead to copy or even move
8501 the entries into an Org file. Org mode evaluates diary-style sexp
8502 entries, and does it faster because there is no overhead for first
8503 creating the diary display. Note that the sexp entries must start at
8504 the left margin, no whitespace is allowed before them, as seen in the
8505 following segment of an Org file:[fn:93]
8512 %%(org-calendar-holiday) ; special function for holiday names
8518 %%(org-anniversary 1956 5 14) Arthur Dent is %d years old
8519 %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old
8522 **** Anniversaries from BBDB
8526 #+cindex: BBDB, anniversaries
8527 #+cindex: anniversaries, from BBDB
8529 #+findex: org-bbdb-anniversaries
8530 If you are using the Insidious Big Brother Database to store your
8531 contacts, you very likely prefer to store anniversaries in BBDB rather
8532 than in a separate Org or diary file. Org supports this and can show
8533 BBDB anniversaries as part of the agenda. All you need to do is to
8534 add the following to one of your agenda files:
8541 %%(org-bbdb-anniversaries)
8544 You can then go ahead and define anniversaries for a BBDB record.
8545 Basically, you need a field named =anniversary= for the BBDB record
8546 which contains the date in the format =YYYY-MM-DD= or =MM-DD=,
8547 followed by a space and the class of the anniversary (=birthday=,
8548 =wedding=, or a format string). If you omit the class, it defaults to
8549 =birthday=. Here are a few examples, the header for the file
8550 =org-bbdb.el= contains more detailed information.
8556 2008-04-14 %s released version 6.01 of Org mode, %d years ago
8559 After a change to BBDB, or for the first agenda display during an
8560 Emacs session, the agenda display suffers a short delay as Org updates
8561 its hash with anniversaries. However, from then on things will be
8562 very fast, much faster in fact than a long list of
8563 =%%(diary-anniversary)= entries in an Org or Diary file.
8565 #+findex: org-bbdb-anniversaries-future
8566 If you would like to see upcoming anniversaries with a bit of
8567 forewarning, you can use the following instead:
8574 %%(org-bbdb-anniversaries-future 3)
8577 That will give you three days' warning: on the anniversary date itself
8578 and the two days prior. The argument is optional: if omitted, it
8581 **** Appointment reminders
8585 #+cindex: @file{appt.el}
8586 #+cindex: appointment reminders
8587 #+cindex: appointment
8590 #+cindex: APPT_WARNTIME, keyword
8591 Org can interact with Emacs appointments notification facility. To
8592 add the appointments of your agenda files, use the command
8593 ~org-agenda-to-appt~. This command lets you filter through the list
8594 of your appointments and add only those belonging to a specific
8595 category or matching a regular expression. It also reads
8596 a =APPT_WARNTIME= property which overrides the value of
8597 ~appt-message-warning-time~ for this appointment. See the docstring
8600 *** The global TODO list
8602 :DESCRIPTION: All unfinished action items.
8603 :ALT_TITLE: Global TODO list
8605 #+cindex: global TODO list
8606 #+cindex: TODO list, global
8608 The global TODO list contains all unfinished TODO items formatted and
8609 collected into a single place.
8611 - {{{kbd(M-x org-agenda t)}}} (~org-todo-list~) ::
8613 #+kindex: t @r{(Agenda dispatcher)}
8614 #+findex: org-todo-list
8615 Show the global TODO list. This collects the TODO items from all
8616 agenda files (see [[*Agenda Views]]) into a single buffer. By
8617 default, this lists items with a state the is not a DONE state.
8618 The buffer is in ~agenda-mode~, so there are commands to examine
8619 and manipulate the TODO entries directly from that buffer (see
8620 [[*Commands in the Agenda Buffer]]).
8622 - {{{kbd(M-x org-agenda T)}}} (~org-todo-list~) ::
8624 #+kindex: T @r{(Agenda dispatcher)}
8625 #+findex: org-todo-list
8626 #+cindex: TODO keyword matching
8627 #+vindex: org-todo-keywords
8628 Like the above, but allows selection of a specific TODO keyword.
8629 You can also do this by specifying a prefix argument to
8630 {{{kbd(t)}}}. You are prompted for a keyword, and you may also
8631 specify several keywords by separating them with =|= as the
8632 boolean OR operator. With a numeric prefix, the Nth keyword in
8633 ~org-todo-keywords~ is selected.
8636 The {{{kbd(r)}}} key in the agenda buffer regenerates it, and you
8637 can give a prefix argument to this command to change the selected
8638 TODO keyword, for example {{{kbd(3 r)}}}. If you often need
8639 a search for a specific keyword, define a custom command for it
8640 (see [[*The Agenda Dispatcher]]).
8642 Matching specific TODO keywords can also be done as part of
8643 a tags search (see [[*Tag Searches]]).
8645 Remote editing of TODO items means that you can change the state of
8646 a TODO entry with a single key press. The commands available in the
8647 TODO list are described in [[*Commands in the Agenda Buffer]].
8649 #+cindex: sublevels, inclusion into TODO list
8650 Normally the global TODO list simply shows all headlines with TODO
8651 keywords. This list can become very long. There are two ways to keep
8655 #+vindex: org-agenda-todo-ignore-scheduled
8656 #+vindex: org-agenda-todo-ignore-deadlines
8657 #+vindex: org-agenda-todo-ignore-timestamp
8658 #+vindex: org-agenda-todo-ignore-with-date
8659 Some people view a TODO item that has been /scheduled/ for execution
8660 or have a /deadline/ (see [[*Timestamps, Deadlines and Scheduling]]) as
8661 no longer /open/. Configure the variables
8662 ~org-agenda-todo-ignore-scheduled~,
8663 ~org-agenda-todo-ignore-deadlines~,
8664 ~org-agenda-todo-ignore-timestamp~ and/or
8665 ~org-agenda-todo-ignore-with-date~ to exclude such items from the
8669 #+vindex: org-agenda-todo-list-sublevels
8670 TODO items may have sublevels to break up the task into subtasks.
8671 In such cases it may be enough to list only the highest level TODO
8672 headline and omit the sublevels from the global list. Configure the
8673 variable ~org-agenda-todo-list-sublevels~ to get this behavior.
8675 *** Matching tags and properties
8677 :DESCRIPTION: Structured information with fine-tuned search.
8679 #+cindex: matching, of tags
8680 #+cindex: matching, of properties
8682 #+cindex: match view
8684 If headlines in the agenda files are marked with /tags/ (see [[*Tags]]),
8685 or have properties (see [[*Properties and Columns]]), you can select
8686 headlines based on this metadata and collect them into an agenda
8687 buffer. The match syntax described here also applies when creating
8688 sparse trees with {{{kbd(C-c / m)}}}.
8690 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) ::
8692 #+kindex: m @r{(Agenda dispatcher)}
8693 #+findex: org-tags-view
8694 Produce a list of all headlines that match a given set of tags.
8695 The command prompts for a selection criterion, which is a boolean
8696 logic expression with tags, like =+work+urgent-withboss= or
8697 =work|home= (see [[*Tags]]). If you often need a specific search,
8698 define a custom command for it (see [[*The Agenda Dispatcher]]).
8700 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) ::
8702 #+kindex: M @r{(Agenda dispatcher)}
8703 #+findex: org-tags-view
8704 #+vindex: org-tags-match-list-sublevels
8705 #+vindex: org-agenda-tags-todo-honor-ignore-options
8706 Like {{{kbd(m)}}}, but only select headlines that are also TODO
8707 items and force checking subitems (see the variable
8708 ~org-tags-match-list-sublevels~). To exclude scheduled/deadline
8709 items, see the variable
8710 ~org-agenda-tags-todo-honor-ignore-options~. Matching specific
8711 TODO keywords together with a tags match is also possible, see
8714 The commands available in the tags list are described in [[*Commands in
8715 the Agenda Buffer]].
8717 #+cindex: boolean logic, for agenda searches
8718 A search string can use Boolean operators =&= for AND and =|= for OR.
8719 =&= binds more strongly than =|=. Parentheses are currently not
8720 implemented. Each element in the search is either a tag, a regular
8721 expression matching tags, or an expression like =PROPERTY OPERATOR
8722 VALUE= with a comparison operator, accessing a property value. Each
8723 element may be preceded by =-= to select against it, and =+= is
8724 syntactic sugar for positive selection. The AND operator =&= is
8725 optional when =+= or =-= is present. Here are some examples, using
8730 Select headlines tagged =work=, but discard those also tagged
8735 Selects lines tagged =work= or =laptop=.
8737 - ~work|laptop+night~ ::
8739 Like before, but require the =laptop= lines to be tagged
8742 #+cindex: regular expressions, with tags search
8743 Instead of a tag, you may also specify a regular expression enclosed
8744 in curly braces. For example, =work+{^boss.*}= matches headlines that
8745 contain the tag =:work:= and any tag /starting/ with =boss=.
8747 #+cindex: group tags, as regular expressions
8748 Group tags (see [[*Tag Hierarchy]]) are expanded as regular expressions.
8749 E.g., if =work= is a group tag for the group =:work:lab:conf:=, then
8750 searching for =work= also searches for ={\(?:work\|lab\|conf\)}= and
8751 searching for =-work= searches for all headlines but those with one of
8752 the tags in the group (i.e., =-{\(?:work\|lab\|conf\)}=).
8754 #+cindex: TODO keyword matching, with tags search
8755 #+cindex: level, for tags/property match
8756 #+cindex: category, for tags/property match
8757 #+vindex: org-odd-levels-only
8758 You may also test for properties (see [[*Properties and Columns]]) at the
8759 same time as matching tags. The properties may be real properties, or
8760 special properties that represent other metadata (see [[*Special
8761 Properties]]). For example, the property =TODO= represents the TODO
8762 keyword of the entry. Or, the property =LEVEL= represents the level
8763 of an entry. So searching =+LEVEL=3+boss-TODO​="DONE"= lists all level
8764 three headlines that have the tag =boss= and are /not/ marked with the
8765 TODO keyword =DONE=. In buffers with ~org-odd-levels-only~ set,
8766 =LEVEL= does not count the number of stars, but =LEVEL=2= corresponds
8769 Here are more examples:
8771 - =work+TODO​="WAITING"= ::
8773 Select =work=-tagged TODO lines with the specific TODO keyword
8776 - =work+TODO​="WAITING"|home+TODO​="WAITING"= ::
8778 Waiting tasks both at work and at home.
8780 When matching properties, a number of different operators can be used
8781 to test the value of a property. Here is a complex example:
8784 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2
8785 +With={Sarah|Denny}+SCHEDULED>="<2008-10-11>"
8788 #+texinfo: @noindent
8789 The type of comparison depends on how the comparison value is written:
8791 - If the comparison value is a plain number, a numerical comparison is
8792 done, and the allowed operators are =<=, ===, =>=, =<==, =>==, and
8795 - If the comparison value is enclosed in double-quotes, a string
8796 comparison is done, and the same operators are allowed.
8798 - If the comparison value is enclosed in double-quotes /and/ angular
8799 brackets (like =DEADLINE<​="<2008-12-24 18:30>"=), both values are
8800 assumed to be date/time specifications in the standard Org way, and
8801 the comparison is done accordingly. Valid values also include
8802 ="<now>"= for now (including time), ="<today>"=, and ="<tomorrow>"=
8803 for these days at 0:00 hours, i.e., without a time specification.
8804 You can also use strings like ="<+5d>"= or ="<-2m>"= with units =d=,
8805 =w=, =m=, and =y= for day, week, month, and year, respectively.
8807 - If the comparison value is enclosed in curly braces, a regexp match
8808 is performed, with === meaning that the regexp matches the property
8809 value, and =<>= meaning that it does not match.
8811 So the search string in the example finds entries tagged =work= but
8812 not =boss=, which also have a priority value =A=, a =Coffee= property
8813 with the value =unlimited=, an =EFFORT= property that is numerically
8814 smaller than 2, a =With= property that is matched by the regular
8815 expression =Sarah|Denny=, and that are scheduled on or after October
8818 You can configure Org mode to use property inheritance during
8819 a search, but beware that this can slow down searches considerably.
8820 See [[*Property Inheritance]], for details.
8822 For backward compatibility, and also for typing speed, there is also
8823 a different way to test TODO states in a search. For this, terminate
8824 the tags/property part of the search string (which may include several
8825 terms connected with =|=) with a =/= and then specify a Boolean
8826 expression just for TODO keywords. The syntax is then similar to that
8827 for tags, but should be applied with care: for example, a positive
8828 selection on several TODO keywords cannot meaningfully be combined
8829 with boolean AND. However, /negative selection/ combined with AND can
8830 be meaningful. To make sure that only lines are checked that actually
8831 have any TODO keyword (resulting in a speed-up), use {{{kbd(M-x
8832 org-agenda M)}}}, or equivalently start the TODO part after the slash
8833 with =!=. Using {{{kbd(M-x org-agenda M)}}} or =/!= does not match
8834 TODO keywords in a DONE state. Examples:
8838 Same as =work+TODO​="WAITING"=.
8840 - =work/!-WAITING-NEXT= ::
8842 Select =work=-tagged TODO lines that are neither =WAITING= nor
8845 - =work/!+WAITING|+NEXT= ::
8847 Select =work=-tagged TODO lines that are either =WAITING= or
8852 :DESCRIPTION: Find entries by searching for text.
8854 #+cindex: search view
8855 #+cindex: text search
8856 #+cindex: searching, for text
8858 This agenda view is a general text search facility for Org mode
8859 entries. It is particularly useful to find notes.
8861 - {{{kbd(M-x org-agenda s)}}} (~org-search-view~) ::
8863 #+kindex: s @r{(Agenda dispatcher)}
8864 #+findex: org-search-view
8865 This is a special search that lets you select entries by matching
8866 a substring or specific words using a boolean logic.
8868 For example, the search string =computer equipment= matches entries
8869 that contain =computer equipment= as a substring, even if the two
8870 words are separated by more space or a line break.
8872 Search view can also search for specific keywords in the entry, using
8873 Boolean logic. The search string =+computer
8874 +wifi -ethernet -{8\.11[bg]}= matches note entries that contain the
8875 keywords =computer= and =wifi=, but not the keyword =ethernet=, and
8876 which are also not matched by the regular expression =8\.11[bg]=,
8877 meaning to exclude both =8.11b= and =8.11g=. The first =+= is
8878 necessary to turn on boolean search, other =+= characters are
8879 optional. For more details, see the docstring of the command
8882 You can incrementally adjust a boolean search with the following keys
8884 #+attr_texinfo: :columns 0.1 0.6
8885 | {{{kbd([)}}} | Add a positive search word |
8886 | {{{kbd(])}}} | Add a negative search word |
8887 | {{{kbd({)}}} | Add a positive regular expression |
8888 | {{{kbd(})}}} | Add a negative regular expression |
8890 #+vindex: org-agenda-text-search-extra-files
8891 Note that in addition to the agenda files, this command also searches
8892 the files listed in ~org-agenda-text-search-extra-files~.
8896 :DESCRIPTION: Find projects you need to review.
8898 #+pindex: GTD, Getting Things Done
8900 If you are following a system like David Allen's GTD to organize your
8901 work, one of the "duties" you have is a regular review to make sure
8902 that all projects move along. A /stuck/ project is a project that has
8903 no defined next actions, so it never shows up in the TODO lists Org
8904 mode produces. During the review, you need to identify such projects
8905 and define next actions for them.
8907 - {{{kbd(M-x org-agenda #)}}} (~org-agenda-list-stuck-projects~) ::
8909 #+kindex: # @r{(Agenda dispatcher)}
8910 #+findex: org-agenda-list-stuck-projects
8911 List projects that are stuck.
8913 - {{{kbd(M-x org-agenda !)}}} ::
8915 #+kindex: ! @r{(Agenda dispatcher)}
8916 #+vindex: org-stuck-projects
8917 Customize the variable ~org-stuck-projects~ to define what
8918 a stuck project is and how to find it.
8920 You almost certainly need to configure this view before it works for
8921 you. The built-in default assumes that all your projects are level-2
8922 headlines, and that a project is not stuck if it has at least one
8923 entry marked with a TODO keyword =TODO= or =NEXT= or =NEXTACTION=.
8925 Let's assume that you, in your own way of using Org mode, identify
8926 projects with a tag =:PROJECT:=, and that you use a TODO keyword
8927 =MAYBE= to indicate a project that should not be considered yet.
8928 Let's further assume that the TODO keyword =DONE= marks finished
8929 projects, and that =NEXT= and =TODO= indicate next actions. The tag
8930 =:@shop:= indicates shopping and is a next action even without the
8931 NEXT tag. Finally, if the project contains the special word =IGNORE=
8932 anywhere, it should not be listed either. In this case you would
8933 start by identifying eligible projects with a tags/TODO match (see
8934 [[*Tag Searches]]) =+PROJECT/-MAYBE-DONE=, and then check for =TODO=,
8935 =NEXT=, =@shop=, and =IGNORE= in the subtree to identify projects that
8936 are not stuck. The correct customization for this is:
8938 #+begin_src emacs-lisp
8939 (setq org-stuck-projects
8940 '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@shop")
8944 Note that if a project is identified as non-stuck, the subtree of this
8945 entry is searched for stuck projects.
8947 ** Presentation and Sorting
8949 :DESCRIPTION: How agenda items are prepared for display.
8951 #+cindex: presentation, of agenda items
8953 #+vindex: org-agenda-prefix-format
8954 #+vindex: org-agenda-tags-column
8955 Before displaying items in an agenda view, Org mode visually prepares
8956 the items and sorts them. Each item occupies a single line. The line
8957 starts with a /prefix/ that contains the /category/ (see [[*Categories]])
8958 of the item and other important information. You can customize in
8959 which column tags are displayed through ~org-agenda-tags-column~. You
8960 can also customize the prefix using the option
8961 ~org-agenda-prefix-format~. This prefix is followed by a cleaned-up
8962 version of the outline headline associated with the item.
8966 :DESCRIPTION: Not all tasks are equal.
8969 #+cindex: @samp{CATEGORY}, keyword
8971 The category is a broad label assigned to each agenda item. By
8972 default, the category is simply derived from the file name, but you
8973 can also specify it with a special line in the buffer, like
8976 : #+CATEGORY: Thesis
8978 #+texinfo: @noindent
8979 #+cindex: @samp{CATEGORY}, property
8980 If you would like to have a special category for a single entry or
8981 a (sub)tree, give the entry a =CATEGORY= property with the special
8982 category you want to apply as the value.
8984 #+texinfo: @noindent
8985 The display in the agenda buffer looks best if the category is not
8986 longer than 10 characters.
8988 #+texinfo: @noindent
8989 #+vindex: org-agenda-category-icon-alist
8990 You can set up icons for category by customizing the
8991 ~org-agenda-category-icon-alist~ variable.
8993 *** Time-of-day specifications
8995 :DESCRIPTION: How the agenda knows the time.
8997 #+cindex: time-of-day specification
8999 Org mode checks each agenda item for a time-of-day specification. The
9000 time can be part of the timestamp that triggered inclusion into the
9003 : <2005-05-10 Tue 19:00>
9005 #+texinfo: @noindent
9006 Time ranges can be specified with two timestamps:
9008 : <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
9010 #+vindex: org-agenda-search-headline-for-time
9011 In the headline of the entry itself, a time(range)---like =12:45= or
9012 a =8:30-1pm=---may also appear as plain text[fn:94].
9014 If the agenda integrates the Emacs diary (see [[*Weekly/daily agenda]]),
9015 time specifications in diary entries are recognized as well.
9017 For agenda display, Org mode extracts the time and displays it in
9018 a standard 24 hour format as part of the prefix. The example times in
9019 the previous paragraphs would end up in the agenda like this:
9022 8:30-13:00 Arthur Dent lies in front of the bulldozer
9023 12:45...... Ford Prefect arrives and takes Arthur to the pub
9024 19:00...... The Vogon reads his poem
9025 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
9029 If the agenda is in single-day mode, or for the display of today, the
9030 timed entries are embedded in a time grid, like
9033 8:00...... ------------------
9034 8:30-13:00 Arthur Dent lies in front of the bulldozer
9035 10:00...... ------------------
9036 12:00...... ------------------
9037 12:45...... Ford Prefect arrives and takes Arthur to the pub
9038 14:00...... ------------------
9039 16:00...... ------------------
9040 18:00...... ------------------
9041 19:00...... The Vogon reads his poem
9042 20:00...... ------------------
9043 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
9046 #+vindex: org-agenda-use-time-grid
9047 #+vindex: org-agenda-time-grid
9048 The time grid can be turned on and off with the variable
9049 ~org-agenda-use-time-grid~, and can be configured with
9050 ~org-agenda-time-grid~.
9052 *** Sorting of agenda items
9054 :DESCRIPTION: The order of things.
9056 #+cindex: sorting, of agenda items
9057 #+cindex: priorities, of agenda items
9059 Before being inserted into a view, the items are sorted. How this is
9060 done depends on the type of view.
9063 #+vindex: org-agenda-files
9064 For the daily/weekly agenda, the items for each day are sorted. The
9065 default order is to first collect all items containing an explicit
9066 time-of-day specification. These entries are shown at the beginning
9067 of the list, as a /schedule/ for the day. After that, items remain
9068 grouped in categories, in the sequence given by ~org-agenda-files~.
9069 Within each category, items are sorted by priority (see
9070 [[*Priorities]]), which is composed of the base priority (2000 for
9071 priority =A=, 1000 for =B=, and 0 for =C=), plus additional
9072 increments for overdue scheduled or deadline items.
9074 - For the TODO list, items remain in the order of categories, but
9075 within each category, sorting takes place according to priority (see
9076 [[*Priorities]]). The priority used for sorting derives from the
9077 priority cookie, with additions depending on how close an item is to
9078 its due or scheduled date.
9080 - For tags matches, items are not sorted at all, but just appear in
9081 the sequence in which they are found in the agenda files.
9083 #+vindex: org-agenda-sorting-strategy
9084 Sorting can be customized using the variable
9085 ~org-agenda-sorting-strategy~, and may also include criteria based on
9086 the estimated effort of an entry (see [[*Effort Estimates]]).
9088 *** Filtering/limiting agenda times
9090 :DESCRIPTION: Dynamically narrow the agenda.
9093 Agenda built-in or customized commands are statically defined. Agenda
9094 filters and limits provide two ways of dynamically narrowing down the
9095 list of agenda entries: /filters/ and /limits/. Filters only act on
9096 the display of the items, while limits take effect before the list of
9097 agenda entries is built. Filters are more often used interactively,
9098 while limits are mostly useful when defined as local variables within
9099 custom agenda commands.
9101 **** Filtering in the agenda
9105 #+cindex: agenda filtering
9106 #+cindex: filtering entries, in agenda
9107 #+cindex: tag filtering, in agenda
9108 #+cindex: category filtering, in agenda
9109 #+cindex: top headline filtering, in agenda
9110 #+cindex: effort filtering, in agenda
9111 #+cindex: query editing, in agenda
9113 - {{{kbd(/)}}} (~org-agenda-filter-by-tag~) ::
9115 #+findex: org-agenda-filter-by-tag
9116 #+vindex: org-agenda-tag-filter-preset
9117 Filter the agenda view with respect to a tag and/or effort
9118 estimates. The difference between this and a custom agenda
9119 command is that filtering is very fast, so that you can switch
9120 quickly between different filters without having to recreate the
9123 You are prompted for a tag selection letter; {{{kbd(SPC)}}} means
9124 any tag at all. Pressing {{{kbd(TAB)}}} at that prompt offers
9125 completion to select a tag, including any tags that do not have
9126 a selection character. The command then hides all entries that
9127 do not contain or inherit this tag. When called with prefix
9128 argument, remove the entries that /do/ have the tag. A second
9129 {{{kbd(/)}}} at the prompt turns off the filter and shows any
9130 hidden entries. Pressing {{{kbd(+)}}} or {{{kbd(-)}}} switches
9131 between filtering and excluding the next tag.
9133 #+vindex: org-agenda-auto-exclude-function
9134 Org also supports automatic, context-aware tag filtering. If the
9135 variable ~org-agenda-auto-exclude-function~ is set to
9136 a user-defined function, that function can decide which tags
9137 should be excluded from the agenda automatically. Once this is
9138 set, the {{{kbd(/)}}} command then accepts {{{kbd(RET)}}} as
9139 a sub-option key and runs the auto exclusion logic. For example,
9140 let's say you use a =Net= tag to identify tasks which need
9141 network access, an =Errand= tag for errands in town, and a =Call=
9142 tag for making phone calls. You could auto-exclude these tags
9143 based on the availability of the Internet, and outside of
9144 business hours, with something like this:
9146 #+begin_src emacs-lisp
9147 (defun org-my-auto-exclude-function (tag)
9149 ((string= tag "Net")
9150 (/= 0 (call-process "/sbin/ping" nil nil nil
9151 "-c1" "-q" "-t1" "mail.gnu.org")))
9152 ((or (string= tag "Errand") (string= tag "Call"))
9153 (let ((hour (nth 2 (decode-time))))
9154 (or (< hour 8) (> hour 21)))))
9157 (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
9160 - {{{kbd(<)}}} (~org-agenda-filter-by-category~) ::
9162 #+findex: org-agenda-filter-by-category
9163 Filter the current agenda view with respect to the category of
9164 the item at point. Pressing {{{kbd(<)}}} another time removes
9165 this filter. When called with a prefix argument exclude the
9166 category of the item at point from the agenda.
9168 #+vindex: org-agenda-category-filter-preset
9169 You can add a filter preset in custom agenda commands through the
9170 option ~org-agenda-category-filter-preset~. See [[*Setting options
9171 for custom commands]].
9173 - {{{kbd(^)}}} (~org-agenda-filter-by-top-headline~) ::
9175 #+findex: org-agenda-filter-by-top-headline
9176 Filter the current agenda view and only display the siblings and
9177 the parent headline of the one at point.
9179 - {{{kbd(=)}}} (~org-agenda-filter-by-regexp~) ::
9181 #+findex: org-agenda-filter-by-regexp
9182 Filter the agenda view by a regular expression: only show agenda
9183 entries matching the regular expression the user entered. When
9184 called with a prefix argument, it filters /out/ entries matching
9185 the regexp. Called in a regexp-filtered agenda view, remove the
9186 filter, unless there are two universal prefix arguments, in which
9187 case filters are cumulated.
9189 #+vindex: org-agenda-regexp-filter-preset
9190 You can add a filter preset in custom agenda commands through the
9191 option ~org-agenda-regexp-filter-preset~. See [[*Setting options
9192 for custom commands]].
9194 - {{{kbd(_)}}} (~org-agenda-filter-by-effort~) ::
9196 #+findex: org-agenda-filter-by-effort
9197 Filter the agenda view with respect to effort estimates. You
9198 first need to set up allowed efforts globally, for example
9200 #+begin_src emacs-lisp
9201 (setq org-global-properties
9202 '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
9205 #+vindex: org-sort-agenda-noeffort-is-high
9206 You can then filter for an effort by first typing an operator,
9207 one of {{{kbd(<)}}}, {{{kbd(>)}}} and {{{kbd(=)}}}, and then the
9208 one-digit index of an effort estimate in your array of allowed
9209 values, where {{{kbd(0)}}} means the 10th value. The filter then
9210 restricts to entries with effort smaller-or-equal, equal, or
9211 larger-or-equal than the selected value. For application of the
9212 operator, entries without a defined effort are treated according
9213 to the value of ~org-sort-agenda-noeffort-is-high~.
9215 When called with a prefix argument, it removes entries matching
9216 the condition. With two universal prefix arguments, it clears
9217 effort filters, which can be accumulated.
9219 #+vindex: org-agenda-effort-filter-preset
9220 You can add a filter preset in custom agenda commands through the
9221 option ~org-agenda-effort-filter-preset~. See [[*Setting options
9222 for custom commands]].
9224 - {{{kbd(|)}}} (~org-agenda-filter-remove-all~) ::
9226 Remove all filters in the current agenda view.
9228 **** Setting limits for the agenda
9232 #+cindex: limits, in agenda
9234 Here is a list of options that you can set, either globally, or
9235 locally in your custom agenda views (see [[*Custom Agenda Views]]).
9237 - ~org-agenda-max-entries~ ::
9239 #+vindex: org-agenda-max-entries
9240 Limit the number of entries.
9242 - ~org-agenda-max-effort~ ::
9244 #+vindex: org-agenda-max-effort
9245 Limit the duration of accumulated efforts (as minutes).
9247 - ~org-agenda-max-todos~ ::
9249 #+vindex: org-agenda-max-todos
9250 Limit the number of entries with TODO keywords.
9252 - ~org-agenda-max-tags~ ::
9254 #+vindex: org-agenda-max-tags
9255 Limit the number of tagged entries.
9257 When set to a positive integer, each option excludes entries from
9258 other categories: for example, ~(setq org-agenda-max-effort 100)~
9259 limits the agenda to 100 minutes of effort and exclude any entry that
9260 has no effort property. If you want to include entries with no effort
9261 property, use a negative value for ~org-agenda-max-effort~. One
9262 useful setup is to use ~org-agenda-max-entries~ locally in a custom
9263 command. For example, this custom command displays the next five
9264 entries with a =NEXT= TODO keyword.
9266 #+begin_src emacs-lisp
9267 (setq org-agenda-custom-commands
9269 ((org-agenda-max-entries 5)))))
9272 Once you mark one of these five entry as DONE, rebuilding the agenda
9273 will again the next five entries again, including the first entry that
9274 was excluded so far.
9276 You can also dynamically set temporary limits, which are lost when
9277 rebuilding the agenda:
9279 - {{{kbd(~ )}}} (~org-agenda-limit-interactively~) ::
9281 #+findex: org-agenda-limit-interactively
9282 This prompts for the type of limit to apply and its value.
9284 ** Commands in the Agenda Buffer
9286 :DESCRIPTION: Remote editing of Org trees.
9287 :ALT_TITLE: Agenda Commands
9289 #+cindex: commands, in agenda buffer
9291 Entries in the agenda buffer are linked back to the Org file or diary
9292 file where they originate. You are not allowed to edit the agenda
9293 buffer itself, but commands are provided to show and jump to the
9294 original entry location, and to edit the Org files "remotely" from the
9295 agenda buffer. In this way, all information is stored only once,
9296 removing the risk that your agenda and note files may diverge.
9298 Some commands can be executed with mouse clicks on agenda lines. For
9299 the other commands, point needs to be in the desired line.
9305 #+cindex: motion commands in agenda
9307 - {{{kbd(n)}}} (~org-agenda-next-line~) ::
9310 #+findex: org-agenda-next-line
9311 Next line (same as {{{kbd(DOWN)}}} and {{{kbd(C-n)}}}).
9313 - {{{kbd(p)}}} (~org-agenda-previous-line~) ::
9316 #+findex: org-agenda-previous-line
9317 Previous line (same as {{{kbd(UP)}}} and {{{kbd(C-p)}}}).
9319 *** View/Go to Org file
9323 #+cindex: view file commands in agenda
9325 - {{{kbd(SPC)}}} or {{{kbd(mouse-3)}}} (~org-agenda-show-and-scroll-up~) ::
9329 #+findex: org-agenda-show-and-scroll-up
9330 Display the original location of the item in another window.
9331 With a prefix argument, make sure that drawers stay folded.
9333 - {{{kbd(L)}}} (~org-agenda-recenter~) ::
9335 #+findex: org-agenda-recenter
9336 Display original location and recenter that window.
9338 - {{{kbd(TAB)}}} or {{{kbd(mouse-2)}}} (~org-agenda-goto~) ::
9342 #+findex: org-agenda-goto
9343 Go to the original location of the item in another window.
9345 - {{{kbd(RET)}}} (~org-agenda-switch-to~) ::
9348 #+findex: org-agenda-switch-to
9349 Go to the original location of the item and delete other windows.
9351 - {{{kbd(F)}}} (~org-agenda-follow-mode~) ::
9354 #+findex: org-agenda-follow-mode
9355 #+vindex: org-agenda-start-with-follow-mode
9356 Toggle Follow mode. In Follow mode, as you move point through
9357 the agenda buffer, the other window always shows the
9358 corresponding location in the Org file. The initial setting for
9359 this mode in new agenda buffers can be set with the variable
9360 ~org-agenda-start-with-follow-mode~.
9362 - {{{kbd(C-c C-x b)}}} (~org-agenda-tree-to-indirect-buffer~) ::
9365 #+findex: org-agenda-tree-to-indirect-buffer
9366 Display the entire subtree of the current item in an indirect
9367 buffer. With a numeric prefix argument N, go up to level N and
9368 then take that tree. If N is negative, go up that many levels.
9369 With a {{{kbd(C-u)}}} prefix, do not remove the previously used
9372 - {{{kbd(C-c C-o)}}} (~org-agenda-open-link~) ::
9375 #+findex: org-agenda-open-link
9376 Follow a link in the entry. This offers a selection of any links
9377 in the text belonging to the referenced Org node. If there is
9378 only one link, follow it without a selection prompt.
9384 #+cindex: change agenda display
9385 #+cindex: display changing, in agenda
9387 #+attr_texinfo: :sep ,
9391 Interactively select another agenda view and append it to the
9397 Delete other windows.
9399 - {{{kbd(v d)}}} or short {{{kbd(d)}}} (~org-agenda-day-view~) ::
9403 #+findex: org-agenda-day-view
9404 Switch to day view. When switching to day view, this setting
9405 becomes the default for subsequent agenda refreshes. A numeric
9406 prefix argument may be used to jump directly to a specific day of
9407 the year. For example, {{{kbd(32 d)}}} jumps to February 1st.
9408 When setting day view, a year may be encoded in the prefix
9409 argument as well. For example, {{{kbd(200712 d)}}} jumps to
9410 January 12, 2007. If such a year specification has only one or
9411 two digits, it is expanded into one of the 30 next years or the
9414 - {{{kbd(v w)}}} or short {{{kbd(w)}}} (~org-agenda-week-view~) ::
9418 #+findex: org-agenda-week-view
9419 Switch to week view. When switching week view, this setting
9420 becomes the default for subsequent agenda refreshes. A numeric
9421 prefix argument may be used to jump directly to a specific day of
9422 the ISO week. For example {{{kbd(9 w)}}} to ISO week number 9.
9423 When setting week view, a year may be encoded in the prefix
9424 argument as well. For example, {{{kbd(200712 w)}}} jumps to week
9425 12 in 2007. If such a year specification has only one or two
9426 digits, it is expanded into one of the 30 next years or the last
9429 - {{{kbd(v m)}}} (~org-agenda-month-view~) ::
9432 #+findex: org-agenda-month-view
9433 Switch to month view. Because month views are slow to create,
9434 they do not become the default for subsequent agenda refreshes.
9435 A numeric prefix argument may be used to jump directly to
9436 a specific day of the month. When setting month view, a year may
9437 be encoded in the prefix argument as well. For example,
9438 {{{kbd(200712 m)}}} jumps to December, 2007. If such a year
9439 specification has only one or two digits, it is expanded into one
9440 of the 30 next years or the last 69 years.
9442 - {{{kbd(v y)}}} (~org-agenda-year-view~) ::
9445 #+findex: org-agenda-year-view
9446 Switch to year view. Because year views are slow to create, they
9447 do not become the default for subsequent agenda refreshes.
9448 A numeric prefix argument may be used to jump directly to
9449 a specific day of the year.
9451 - {{{kbd(v SPC)}}} (~org-agenda-reset-view~) ::
9454 #+findex: org-agenda-reset-view
9455 #+vindex: org-agenda-span
9456 Reset the current view to ~org-agenda-span~.
9458 - {{{kbd(f)}}} (~org-agenda-later~) ::
9461 #+findex: org-agenda-later
9462 Go forward in time to display the span following the current one.
9463 For example, if the display covers a week, switch to the
9464 following week. With a prefix argument, repeat that many times.
9466 - {{{kbd(b)}}} (~org-agenda-earlier~) ::
9469 #+findex: org-agenda-earlier
9470 Go backward in time to display earlier dates.
9472 - {{{kbd(.)}}} (~org-agenda-goto-today~) ::
9475 #+findex: org-agenda-goto-today
9478 - {{{kbd(j)}}} (~org-agenda-goto-date~) ::
9481 #+findex: org-agenda-goto-date
9482 Prompt for a date and go there.
9484 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
9487 #+findex: org-agenda-clock-goto
9488 Go to the currently clocked-in task /in the agenda buffer/.
9490 - {{{kbd(D)}}} (~org-agenda-toggle-diary~) ::
9493 #+findex: org-agenda-toggle-diary
9494 Toggle the inclusion of diary entries. See [[*Weekly/daily agenda]].
9496 - {{{kbd(v l)}}} or {{{kbd(v L)}}} or short {{{kbd(l)}}} (~org-agenda-log-mode~) ::
9501 #+findex: org-agenda-log-mode
9502 #+vindex: org-log-done
9503 #+vindex: org-agenda-log-mode-items
9504 Toggle Logbook mode. In Logbook mode, entries that were marked
9505 DONE while logging was on (see the variable ~org-log-done~) are
9506 shown in the agenda, as are entries that have been clocked on
9507 that day. You can configure the entry types that should be
9508 included in log mode using the variable
9509 ~org-agenda-log-mode-items~. When called with a {{{kbd(C-u)}}}
9510 prefix, show all possible logbook entries, including state
9511 changes. When called with two prefix arguments {{{kbd(C-u
9512 C-u)}}}, show only logging information, nothing else. {{{kbd(v
9513 L)}}} is equivalent to {{{kbd(C-u v l)}}}.
9515 - {{{kbd(v [)}}} or short {{{kbd([)}}} (~org-agenda-manipulate-query-add~) ::
9519 #+findex: org-agenda-manipulate-query-add
9520 Include inactive timestamps into the current view. Only for
9521 weekly/daily agenda.
9523 - {{{kbd(v a)}}} (~org-agenda-archives-mode~) ::
9526 #+findex: org-agenda-archives-mode
9527 Toggle Archives mode. In Archives mode, trees that are archived
9528 (see [[*Internal archiving]]) are also scanned when producing the
9529 agenda. To exit archives mode, press {{{kbd(v a)}}} again.
9534 Toggle Archives mode. Include all archive files as well.
9536 - {{{kbd(v R)}}} or short {{{kbd(R)}}} (~org-agenda-clockreport-mode~) ::
9540 #+findex: org-agenda-clockreport-mode
9541 #+vindex: org-agenda-start-with-clockreport-mode
9542 #+vindex: org-clock-report-include-clocking-task
9543 Toggle Clockreport mode. In Clockreport mode, the daily/weekly
9544 agenda always shows a table with the clocked times for the time
9545 span and file scope covered by the current agenda view. The
9546 initial setting for this mode in new agenda buffers can be set
9547 with the variable ~org-agenda-start-with-clockreport-mode~. By
9548 using a prefix argument when toggling this mode (i.e., {{{kbd(C-u
9549 R)}}}), the clock table does not show contributions from entries
9550 that are hidden by agenda filtering[fn:96]. See also the
9551 variable ~org-clock-report-include-clocking-task~.
9556 #+vindex: org-agenda-clock-consistency-checks
9557 Show overlapping clock entries, clocking gaps, and other clocking
9558 problems in the current agenda range. You can then visit
9559 clocking lines and fix them manually. See the variable
9560 ~org-agenda-clock-consistency-checks~ for information on how to
9561 customize the definition of what constituted a clocking problem.
9562 To return to normal agenda display, press {{{kbd(l)}}} to exit
9565 - {{{kbd(v E)}}} or short {{{kbd(E)}}} (~org-agenda-entry-text-mode~) ::
9569 #+findex: org-agenda-entry-text-mode
9570 #+vindex: org-agenda-start-with-entry-text-mode
9571 #+vindex: org-agenda-entry-text-maxlines
9572 Toggle entry text mode. In entry text mode, a number of lines
9573 from the Org outline node referenced by an agenda line are
9574 displayed below the line. The maximum number of lines is given
9575 by the variable ~org-agenda-entry-text-maxlines~. Calling this
9576 command with a numeric prefix argument temporarily modifies that
9577 number to the prefix value.
9579 - {{{kbd(G)}}} (~org-agenda-toggle-time-grid~) ::
9582 #+vindex: org-agenda-use-time-grid
9583 #+vindex: org-agenda-time-grid
9584 Toggle the time grid on and off. See also the variables
9585 ~org-agenda-use-time-grid~ and ~org-agenda-time-grid~.
9587 - {{{kbd(r)}}} (~org-agenda-redo~), {{{kbd(g)}}} ::
9591 #+findex: org-agenda-redo
9592 Recreate the agenda buffer, for example to reflect the changes
9593 after modification of the timestamps of items with
9594 {{{kbd(S-LEFT)}}} and {{{kbd(S-RIGHT)}}}. When the
9595 buffer is the global TODO list, a prefix argument is interpreted
9596 to create a selective list for a specific TODO keyword.
9598 - {{{kbd(C-x C-s)}}} or short {{{kbd(s)}}} (~org-save-all-org-buffers~) ::
9601 #+findex: org-save-all-org-buffers
9603 Save all Org buffers in the current Emacs session, and also the
9606 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
9608 #+kindex: C-c C-x C-c
9609 #+findex: org-agenda-columns
9610 #+vindex: org-columns-default-format
9611 Invoke column view (see [[*Column View]]) in the agenda buffer. The
9612 column view format is taken from the entry at point, or, if there
9613 is no entry at point, from the first entry in the agenda view.
9614 So whatever the format for that entry would be in the original
9615 buffer (taken from a property, from a =COLUMNS= keyword, or from
9616 the default variable ~org-columns-default-format~) is used in the
9619 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) ::
9622 #+findex: org-agenda-remove-restriction-lock
9623 Remove the restriction lock on the agenda, if it is currently
9624 restricted to a file or subtree (see [[*Agenda Files]]).
9626 - {{{kbd(M-UP)}}} (~org-agenda-drag-line-backward~) ::
9629 #+findex: org-agenda-drag-line-backward
9630 Drag the line at point backward one line. With a numeric prefix
9631 argument, drag backward by that many lines.
9633 Moving agenda lines does not persist after an agenda refresh and
9634 does not modify the contributing Org files.
9636 - {{{kbd(M-DOWN)}}} (~org-agenda-drag-line-forward~) ::
9639 #+findex: org-agenda-drag-line-forward
9640 Drag the line at point forward one line. With a numeric prefix
9641 argument, drag forward by that many lines.
9647 #+cindex: remote editing, from agenda
9649 - {{{kbd(0--9)}}} ::
9653 - {{{kbd(C-_)}}} (~org-agenda-undo~) ::
9656 #+findex: org-agenda-undo
9657 #+cindex: undoing remote-editing events
9658 #+cindex: remote editing, undo
9659 Undo a change due to a remote editing command. The change is
9660 undone both in the agenda buffer and in the remote buffer.
9662 - {{{kbd(t)}}} (~org-agenda-todo~) ::
9665 #+findex: org-agenda-todo
9666 Change the TODO state of the item, both in the agenda and in the
9669 - {{{kbd(C-S-RIGHT)}}} (~org-agenda-todo-nextset~) ::
9672 #+findex: org-agenda-todo-nextset
9673 Switch to the next set of TODO keywords.
9675 - {{{kbd(C-S-LEFT)}}}, ~org-agenda-todo-previousset~ ::
9678 Switch to the previous set of TODO keywords.
9680 - {{{kbd(C-k)}}} (~org-agenda-kill~) ::
9683 #+findex: org-agenda-kill
9684 #+vindex: org-agenda-confirm-kill
9685 Delete the current agenda item along with the entire subtree
9686 belonging to it in the original Org file. If the text to be
9687 deleted remotely is longer than one line, the kill needs to be
9688 confirmed by the user. See variable ~org-agenda-confirm-kill~.
9690 - {{{kbd(C-c C-w)}}} (~org-agenda-refile~) ::
9693 #+findex: org-agenda-refile
9694 Refile the entry at point.
9696 - {{{kbd(C-c C-x C-a)}}} or short {{{kbd(a)}}} (~org-agenda-archive-default-with-confirmation~) ::
9698 #+kindex: C-c C-x C-a
9700 #+findex: org-agenda-archive-default-with-confirmation
9701 #+vindex: org-archive-default-command
9702 Archive the subtree corresponding to the entry at point using the
9703 default archiving command set in ~org-archive-default-command~.
9704 When using the {{{kbd(a)}}} key, confirmation is required.
9706 - {{{kbd(C-c C-x a)}}} (~org-agenda-toggle-archive-tag~) ::
9709 #+findex: org-agenda-toggle-archive-tag
9710 Toggle the archive tag (see [[*Internal archiving]]) for the current
9713 - {{{kbd(C-c C-x A)}}} (~org-agenda-archive-to-archive-sibling~) ::
9716 #+findex: org-agenda-archive-to-archive-sibling
9717 Move the subtree corresponding to the current entry to its
9720 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd($)}}} (~org-agenda-archive~) ::
9722 #+kindex: C-c C-x C-s
9724 #+findex: org-agenda-archive
9725 Archive the subtree corresponding to the current headline. This
9726 means the entry is moved to the configured archive location, most
9727 likely a different file.
9729 - {{{kbd(T)}}} (~org-agenda-show-tags~) ::
9732 #+findex: org-agenda-show-tags
9733 #+vindex: org-agenda-show-inherited-tags
9734 Show all tags associated with the current item. This is useful
9735 if you have turned off ~org-agenda-show-inherited-tags~, but
9736 still want to see all tags of a headline occasionally.
9738 - {{{kbd(:)}}} (~org-agenda-set-tags~) ::
9741 #+findex: org-agenda-set-tags
9742 Set tags for the current headline. If there is an active region
9743 in the agenda, change a tag for all headings in the region.
9745 - {{{kbd(\,)}}} (~org-agenda-priority~) ::
9748 #+findex: org-agenda-priority
9749 Set the priority for the current item. Org mode prompts for the
9750 priority character. If you reply with {{{kbd(SPC)}}}, the
9751 priority cookie is removed from the entry.
9753 - {{{kbd(P)}}} (~org-agenda-show-priority~) ::
9756 #+findex: org-agenda-show-priority
9757 Display weighted priority of current item.
9759 - {{{kbd(+)}}} or {{{kbd(S-UP)}}} (~org-agenda-priority-up~) ::
9763 #+findex: org-agenda-priority-up
9764 Increase the priority of the current item. The priority is
9765 changed in the original buffer, but the agenda is not resorted.
9766 Use the {{{kbd(r)}}} key for this.
9768 - {{{kbd(-)}}} or {{{kbd(S-DOWN)}}} (~org-agenda-priority-down~) ::
9772 #+findex: org-agenda-priority-down
9773 Decrease the priority of the current item.
9775 - {{{kbd(C-c C-z)}}} or short {{{kbd(z)}}} (~org-agenda-add-note~) ::
9779 #+findex: org-agenda-add-note
9780 #+vindex: org-log-into-drawer
9781 Add a note to the entry. This note is recorded, and then filed
9782 to the same location where state change notes are put. Depending
9783 on ~org-log-into-drawer~, this may be inside a drawer.
9785 - {{{kbd(C-c C-a)}}} (~org-attach~) ::
9788 #+findex: org-attach
9789 Dispatcher for all command related to attachments.
9791 - {{{kbd(C-c C-s)}}} (~org-agenda-schedule~) ::
9794 #+findex: org-agenda-schedule
9795 Schedule this item. With a prefix argument, remove the
9796 scheduling timestamp
9798 - {{{kbd(C-c C-d)}}} (~org-agenda-deadline~) ::
9801 #+findex: org-agenda-deadline
9802 Set a deadline for this item. With a prefix argument, remove the
9805 - {{{kbd(S-RIGHT)}}} (~org-agenda-do-date-later~) ::
9808 #+findex: org-agenda-do-date-later
9809 Change the timestamp associated with the current line by one day
9810 into the future. If the date is in the past, the first call to
9811 this command moves it to today. With a numeric prefix argument,
9812 change it by that many days. For example, {{{kbd(3
9813 6 5 S-RIGHT)}}} changes it by a year. With a {{{kbd(C-u)}}}
9814 prefix, change the time by one hour. If you immediately repeat
9815 the command, it will continue to change hours even without the
9816 prefix argument. With a double {{{kbd(C-u C-u)}}} prefix, do the
9817 same for changing minutes. The stamp is changed in the original
9818 Org file, but the change is not directly reflected in the agenda
9819 buffer. Use {{{kbd(r)}}} or {{{kbd(g)}}} to update the buffer.
9821 - {{{kbd(S-LEFT)}}} (~org-agenda-do-date-earlier~) ::
9824 #+findex: org-agenda-do-date-earlier
9825 Change the timestamp associated with the current line by one day
9828 - {{{kbd(>)}}} (~org-agenda-date-prompt~) ::
9831 #+findex: org-agenda-date-prompt
9832 Change the timestamp associated with the current line. The key
9833 {{{kbd(>)}}} has been chosen, because it is the same as
9834 {{{kbd(S-.)}}} on my keyboard.
9836 - {{{kbd(I)}}} (~org-agenda-clock-in~) ::
9839 #+findex: org-agenda-clock-in
9840 Start the clock on the current item. If a clock is running
9841 already, it is stopped first.
9843 - {{{kbd(O)}}} (~org-agenda-clock-out~) ::
9846 #+findex: org-agenda-clock-out
9847 Stop the previously started clock.
9849 - {{{kbd(X)}}} (~org-agenda-clock-cancel~) ::
9852 #+findex: org-agenda-clock-cancel
9853 Cancel the currently running clock.
9855 - {{{kbd(J)}}} (~org-agenda-clock-goto~) ::
9858 #+findex: org-agenda-clock-goto
9859 Jump to the running clock in another window.
9861 - {{{kbd(k)}}} (~org-agenda-capture~) ::
9864 #+findex: org-agenda-capture
9865 #+cindex: capturing, from agenda
9866 #+vindex: org-capture-use-agenda-date
9867 Like ~org-capture~, but use the date at point as the default date
9868 for the capture template. See ~org-capture-use-agenda-date~ to
9869 make this the default behavior of ~org-capture~.
9871 *** Bulk remote editing selected entries
9875 #+cindex: remote editing, bulk, from agenda
9876 #+vindex: org-agenda-bulk-custom-functions
9878 - {{{kbd(m)}}} (~org-agenda-bulk-mark~) ::
9880 #+findex: org-agenda-bulk-mark
9882 Mark the entry at point for bulk action. If there is an active
9883 region in the agenda, mark the entries in the region. With
9884 numeric prefix argument, mark that many successive entries.
9886 - {{{kbd(*)}}} (~org-agenda-bulk-mark-all~) ::
9888 #+findex: org-agenda-bulk-mark-all
9890 Mark all visible agenda entries for bulk action.
9892 - {{{kbd(u)}}} (~org-agenda-bulk-unmark~) ::
9894 #+findex: org-agenda-bulk-unmark
9896 Unmark entry for bulk action.
9898 - {{{kbd(U)}}} (~org-agenda-bulk-remove-all-marks~) ::
9900 #+findex: org-agenda-bulk-remove-all-marks
9902 Unmark all marked entries for bulk action.
9904 - {{{kbd(M-m)}}} (~org-agenda-bulk-toggle~) ::
9906 #+findex: org-agenda-bulk-toggle
9908 Toggle mark of the entry at point for bulk action.
9910 - {{{kbd(M-*)}}} (~org-agenda-bulk-toggle-all~) ::
9912 #+findex: org-agenda-bulk-toggle-all
9914 Mark entries matching a regular expression for bulk action.
9916 - {{{kbd(%)}}} (~org-agenda-bulk-mark-regexp~) ::
9918 #+findex: org-agenda-bulk-mark-regexp
9920 Mark entries matching a regular expression for bulk action.
9922 - {{{kbd(B)}}} (~org-agenda-bulk-action~) ::
9924 #+findex: org-agenda-bulk-action
9925 #+vindex: org-agenda-bulk-persistent-marks
9927 Bulk action: act on all marked entries in the agenda. This
9928 prompts for another key to select the action to be applied. The
9929 prefix argument to {{{kbd(B)}}} is passed through to the
9930 {{{kbd(s)}}} and {{{kbd(d)}}} commands, to bulk-remove these
9931 special timestamps. By default, marks are removed after the
9932 bulk. If you want them to persist, set
9933 ~org-agenda-bulk-persistent-marks~ to ~t~ or hit {{{kbd(p)}}} at
9938 Toggle persistent marks.
9942 Archive all selected entries.
9946 Archive entries by moving them to their respective archive
9951 Change TODO state. This prompts for a single TODO keyword and
9952 changes the state of all selected entries, bypassing blocking
9953 and suppressing logging notes---but not timestamps.
9957 Add a tag to all selected entries.
9961 Remove a tag from all selected entries.
9965 Schedule all items to a new date. To shift existing schedule
9966 dates by a fixed number of days, use something starting with
9967 double plus at the prompt, for example =++8d= or =++2w=.
9971 Set deadline to a specific date.
9975 Prompt for a single refile target and move all entries. The
9976 entries are no longer in the agenda; refresh ({{{kbd(g)}}}) to
9981 Reschedule randomly into the coming N days. N is prompted for.
9982 With a prefix argument ({{{kbd(C-u B S)}}}), scatter only
9987 #+vindex: org-agenda-bulk-custom-functions
9988 Apply a function[fn:97] to marked entries. For example, the
9989 function below sets the =CATEGORY= property of the entries to
9992 #+begin_src emacs-lisp
9993 (defun set-category ()
9995 (let ((marker (or (org-get-at-bol 'org-hd-marker)
9996 (org-agenda-error))))
9997 (org-with-point-at marker
9998 (org-back-to-heading t)
9999 (org-set-property "CATEGORY" "web"))))
10002 *** Calendar commands
10006 #+cindex: calendar commands, from agenda
10008 - {{{kbd(c)}}} (~org-agenda-goto-calendar~) ::
10011 #+findex: org-agenda-goto-calendar
10012 Open the Emacs calendar and go to the date at point in the
10015 - {{{kbd(c)}}} (~org-calendar-goto-agenda~) ::
10018 #+findex: org-calendar-goto-agenda
10019 When in the calendar, compute and show the Org agenda for the
10022 - {{{kbd(i)}}} (~org-agenda-diary-entry~) ::
10024 #+findex: org-agenda-diary-entry
10026 #+cindex: diary entries, creating from agenda
10027 Insert a new entry into the diary, using the date at point and
10028 (for block entries) the date at the mark. This adds to the Emacs
10029 diary file[fn:98], in a way similar to the {{{kbd(i)}}} command
10030 in the calendar. The diary file pops up in another window, where
10031 you can add the entry.
10033 #+vindex: org-agenda-diary-file
10034 If you configure ~org-agenda-diary-file~ to point to an Org file,
10035 Org creates entries in that file instead. Most entries are
10036 stored in a date-based outline tree that will later make it easy
10037 to archive appointments from previous months/years. The tree is
10038 built under an entry with a =DATE_TREE= property, or else with
10039 years as top-level entries. Emacs prompts you for the entry
10040 text---if you specify it, the entry is created in
10041 ~org-agenda-diary-file~ without further interaction. If you
10042 directly press {{{kbd(RET)}}} at the prompt without typing text,
10043 the target file is shown in another window for you to finish the
10044 entry there. See also the {{{kbd(k r)}}} command.
10046 - {{{kbd(M)}}} (~org-agenda-phases-of-moon~) ::
10049 #+findex: org-agenda-phases-of-moon
10050 Show the phases of the moon for the three months around current
10053 - {{{kbd(S)}}} (~org-agenda-sunrise-sunset~) ::
10056 #+findex: org-agenda-sunrise-sunset
10057 Show sunrise and sunset times. The geographical location must be
10058 set with calendar variables, see the documentation for the Emacs
10061 - {{{kbd(C)}}} (~org-agenda-convert-date~) ::
10064 #+findex: org-agenda-convert-date
10065 Convert the date at point into many other cultural and historic
10068 - {{{kbd(H)}}} (~org-agenda-holidays~) ::
10071 #+findex: org-agenda-holidays
10072 Show holidays for three months around point date.
10079 - {{{kbd(q)}}} (~org-agenda-quit~) ::
10081 #+findex: org-agenda-quit
10083 Quit agenda, remove the agenda buffer.
10085 - {{{kbd(x)}}} (~org-agenda-exit~) ::
10087 #+findex: org-agenda-exit
10089 #+cindex: agenda files, removing buffers
10090 Exit agenda, remove the agenda buffer and all buffers loaded by
10091 Emacs for the compilation of the agenda. Buffers created by the
10092 user to visit Org files are not removed.
10094 ** Custom Agenda Views
10096 :DESCRIPTION: Defining special searches and views.
10098 #+cindex: custom agenda views
10099 #+cindex: agenda views, custom
10101 Custom agenda commands serve two purposes: to store and quickly access
10102 frequently used TODO and tags searches, and to create special
10103 composite agenda buffers. Custom agenda commands are accessible
10104 through the dispatcher (see [[*The Agenda Dispatcher]]), just like the
10107 *** Storing searches
10109 :DESCRIPTION: Type once, use often.
10112 The first application of custom searches is the definition of keyboard
10113 shortcuts for frequently used searches, either creating an agenda
10114 buffer, or a sparse tree (the latter covering of course only the
10117 #+kindex: C @r{(Agenda dispatcher)}
10118 #+vindex: org-agenda-custom-commands
10119 #+cindex: agenda views, main example
10120 #+cindex: agenda, as an agenda views
10121 #+cindex: agenda*, as an agenda views
10122 #+cindex: tags, as an agenda view
10123 #+cindex: todo, as an agenda view
10124 #+cindex: tags-todo
10125 #+cindex: todo-tree
10126 #+cindex: occur-tree
10127 #+cindex: tags-tree
10128 Custom commands are configured in the variable
10129 ~org-agenda-custom-commands~. You can customize this variable, for
10130 example by pressing {{{kbd(C)}}} from the agenda dispatcher (see [[*The
10131 Agenda Dispatcher]]). You can also directly set it with Emacs Lisp in
10132 the Emacs init file. The following example contains all valid agenda
10135 #+begin_src emacs-lisp
10136 (setq org-agenda-custom-commands
10139 ("w" todo "WAITING")
10140 ("W" todo-tree "WAITING")
10141 ("u" tags "+boss-urgent")
10142 ("v" tags-todo "+boss-urgent")
10143 ("U" tags-tree "+boss-urgent")
10144 ("f" occur-tree "\\<FIXME\\>")
10145 ("h" . "HOME+Name tags searches") ;description for "h" prefix
10146 ("hl" tags "+home+Lisa")
10147 ("hp" tags "+home+Peter")
10148 ("hk" tags "+home+Kim")))
10151 #+texinfo: @noindent
10152 The initial string in each entry defines the keys you have to press
10153 after the dispatcher command in order to access the command. Usually
10154 this will be just a single character, but if you have many similar
10155 commands, you can also define two-letter combinations where the first
10156 character is the same in several combinations and serves as a prefix
10157 key[fn:99]. The second parameter is the search type, followed by the
10158 string or regular expression to be used for the matching. The example
10159 above will therefore define:
10163 as a global search for agenda entries planned[fn:100] this
10168 as the same search, but only for entries with an hour
10169 specification like =[h]h:mm=---think of them as appointments.
10173 as a global search for TODO entries with =WAITING= as the TODO
10178 as the same search, but only in the current buffer and displaying
10179 the results as a sparse tree.
10183 as a global tags search for headlines tagged =boss= but not
10188 The same search, but limiting it to headlines that are also TODO
10193 as the same search, but only in the current buffer and displaying
10194 the result as a sparse tree.
10198 to create a sparse tree (again, current buffer only) with all
10199 entries containing the word =FIXME=.
10203 as a prefix command for a =HOME= tags search where you have to
10204 press an additional key ({{{kbd(l)}}}, {{{kbd(p)}}} or
10205 {{{kbd(k)}}}) to select a name (Lisa, Peter, or Kim) as
10206 additional tag to match.
10208 Note that ~*-tree~ agenda views need to be called from an Org buffer
10209 as they operate on the current buffer only.
10213 :DESCRIPTION: All the stuff you need in a single buffer.
10215 #+cindex: block agenda
10216 #+cindex: agenda, with block views
10218 Another possibility is the construction of agenda views that comprise
10219 the results of /several/ commands, each of which creates a block in
10220 the agenda buffer. The available commands include ~agenda~ for the
10221 daily or weekly agenda (as created with {{{kbd(a)}}}) , ~alltodo~ for
10222 the global TODO list (as constructed with {{{kbd(t)}}}), and the
10223 matching commands discussed above: ~todo~, ~tags~, and ~tags-todo~.
10224 Here are two examples:
10226 #+begin_src emacs-lisp
10227 (setq org-agenda-custom-commands
10228 '(("h" "Agenda and Home-related tasks"
10232 ("o" "Agenda and Office-related tasks"
10235 (tags "office")))))
10238 #+texinfo: @noindent
10239 This defines {{{kbd(h)}}} to create a multi-block view for stuff you
10240 need to attend to at home. The resulting agenda buffer contains your
10241 agenda for the current week, all TODO items that carry the tag =home=,
10242 and also all lines tagged with =garden=. Finally the command
10243 {{{kbd(o)}}} provides a similar view for office tasks.
10245 *** Setting options for custom commands
10247 :DESCRIPTION: Changing the rules.
10248 :ALT_TITLE: Setting options
10250 #+cindex: options, for custom agenda views
10252 #+vindex: org-agenda-custom-commands
10253 Org mode contains a number of variables regulating agenda construction
10254 and display. The global variables define the behavior for all agenda
10255 commands, including the custom commands. However, if you want to
10256 change some settings just for a single custom view, you can do so.
10257 Setting options requires inserting a list of variable names and values
10258 at the right spot in ~org-agenda-custom-commands~. For example:
10260 #+begin_src emacs-lisp
10261 (setq org-agenda-custom-commands
10262 '(("w" todo "WAITING"
10263 ((org-agenda-sorting-strategy '(priority-down))
10264 (org-agenda-prefix-format " Mixed: ")))
10265 ("U" tags-tree "+boss-urgent"
10266 ((org-show-context-detail 'minimal)))
10268 ((org-agenda-files '("~org/notes.org"))
10269 (org-agenda-text-search-extra-files nil)))))
10272 #+texinfo: @noindent
10273 Now the {{{kbd(w)}}} command sorts the collected entries only by
10274 priority, and the prefix format is modified to just say =Mixed:=
10275 instead of giving the category of the entry. The sparse tags tree of
10276 {{{kbd(U)}}} now turns out ultra-compact, because neither the headline
10277 hierarchy above the match, nor the headline following the match are
10278 shown. The command {{{kbd(N)}}} does a text search limited to only
10281 For command sets creating a block agenda, ~org-agenda-custom-commands~
10282 has two separate spots for setting options. You can add options that
10283 should be valid for just a single command in the set, and options that
10284 should be valid for all commands in the set. The former are just
10285 added to the command entry; the latter must come after the list of
10286 command entries. Going back to the block agenda example (see [[*Block
10287 agenda]]), let's change the sorting strategy for the {{{kbd(h)}}}
10288 commands to ~priority-down~, but let's sort the results for =garden=
10289 tags query in the opposite order, ~priority-up~. This would look like
10292 #+begin_src emacs-lisp
10293 (setq org-agenda-custom-commands
10294 '(("h" "Agenda and Home-related tasks"
10298 ((org-agenda-sorting-strategy '(priority-up)))))
10299 ((org-agenda-sorting-strategy '(priority-down))))
10300 ("o" "Agenda and Office-related tasks"
10303 (tags "office")))))
10306 As you see, the values and parentheses setting is a little complex.
10307 When in doubt, use the customize interface to set this variable---it
10308 fully supports its structure. Just one caveat: when setting options
10309 in this interface, the /values/ are just Lisp expressions. So if the
10310 value is a string, you need to add the double-quotes around the value
10313 #+vindex: org-agenda-custom-commands-contexts
10314 To control whether an agenda command should be accessible from
10315 a specific context, you can customize
10316 ~org-agenda-custom-commands-contexts~. Let's say for example that you
10317 have an agenda command {{{kbd(o)}}} displaying a view that you only
10318 need when reading emails. Then you would configure this option like
10321 #+begin_src emacs-lisp
10322 (setq org-agenda-custom-commands-contexts
10323 '(("o" (in-mode . "message-mode"))))
10326 You can also tell that the command key {{{kbd(o)}}} should refer to
10327 another command key {{{kbd(r)}}}. In that case, add this command key
10330 #+begin_src emacs-lisp
10331 (setq org-agenda-custom-commands-contexts
10332 '(("o" "r" (in-mode . "message-mode"))))
10335 See the docstring of the variable for more information.
10337 ** Exporting Agenda Views
10339 :DESCRIPTION: Writing a view to a file.
10341 #+cindex: agenda views, exporting
10343 If you are away from your computer, it can be very useful to have
10344 a printed version of some agenda views to carry around. Org mode can
10345 export custom agenda views as plain text, HTML[fn:101], Postscript,
10346 PDF[fn:102], and iCalendar files. If you want to do this only
10347 occasionally, use the following command:
10349 - {{{kbd(C-x C-w)}}} (~org-agenda-write~) ::
10351 #+findex: org-agenda-write
10352 #+cindex: exporting agenda views
10353 #+cindex: agenda views, exporting
10355 #+vindex: org-agenda-exporter-settings
10356 Write the agenda view to a file.
10358 If you need to export certain agenda views frequently, you can
10359 associate any custom agenda command with a list of output file
10360 names[fn:103]. Here is an example that first defines custom commands
10361 for the agenda and the global TODO list, together with a number of
10362 files to which to export them. Then we define two block agenda
10363 commands and specify file names for them as well. File names can be
10364 relative to the current working directory, or absolute.
10366 #+begin_src emacs-lisp
10367 (setq org-agenda-custom-commands
10368 '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
10369 ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
10370 ("h" "Agenda and Home-related tasks"
10375 ("~/views/home.html"))
10376 ("o" "Agenda and Office-related tasks"
10381 ("~/views/office.ps" "~/calendars/office.ics"))))
10384 The extension of the file name determines the type of export. If it
10385 is =.html=, Org mode uses the htmlize package to convert the buffer to
10386 HTML and save it to this file name. If the extension is =.ps=,
10387 ~ps-print-buffer-with-faces~ is used to produce Postscript output. If
10388 the extension is =.ics=, iCalendar export is run export over all files
10389 that were used to construct the agenda, and limit the export to
10390 entries listed in the agenda. Any other extension produces a plain
10393 The export files are /not/ created when you use one of those
10394 commands interactively because this might use too much overhead.
10395 Instead, there is a special command to produce /all/ specified
10398 - {{{kbd(e)}}} (~org-store-agenda-views~) ::
10400 #+kindex: e @r{(Agenda dispatcher)}
10401 #+findex: org-store-agenda-views
10402 Export all agenda views that have export file names associated
10405 You can use the options section of the custom agenda commands to also
10406 set options for the export commands. For example:
10408 #+begin_src emacs-lisp
10409 (setq org-agenda-custom-commands
10411 ((ps-number-of-columns 2)
10412 (ps-landscape-mode t)
10413 (org-agenda-prefix-format " [ ] ")
10414 (org-agenda-with-colors nil)
10415 (org-agenda-remove-tags t))
10416 ("theagenda.ps"))))
10419 #+texinfo: @noindent
10420 #+vindex: org-agenda-exporter-settings
10421 This command sets two options for the Postscript exporter, to make it
10422 print in two columns in landscape format---the resulting page can be
10423 cut in two and then used in a paper agenda. The remaining settings
10424 modify the agenda prefix to omit category and scheduling information,
10425 and instead include a checkbox to check off items. We also remove the
10426 tags to make the lines compact, and we do not want to use colors for
10427 the black-and-white printer. Settings specified in
10428 ~org-agenda-exporter-settings~ also apply, e.g.,
10430 #+begin_src emacs-lisp
10431 (setq org-agenda-exporter-settings
10432 '((ps-number-of-columns 2)
10433 (ps-landscape-mode t)
10434 (org-agenda-add-entry-text-maxlines 5)
10435 (htmlize-output-type 'css)))
10438 #+texinfo: @noindent
10439 but the settings in ~org-agenda-custom-commands~ take precedence.
10441 #+texinfo: @noindent
10442 From the command line you may also use:
10445 emacs -eval (org-batch-store-agenda-views) -kill
10448 #+texinfo: @noindent
10449 or, if you need to modify some parameters[fn:104]
10452 emacs -eval '(org-batch-store-agenda-views \
10453 org-agenda-span (quote month) \
10454 org-agenda-start-day "2007-11-01" \
10455 org-agenda-include-diary nil \
10456 org-agenda-files (quote ("~/org/project.org")))' \
10460 #+texinfo: @noindent
10461 which creates the agenda views restricted to the file
10462 =~/org/project.org=, without diary entries and with a 30-day extent.
10464 You can also extract agenda information in a way that allows further
10465 processing by other programs. See [[*Extracting Agenda Information]], for
10468 ** Using Column View in the Agenda
10470 :DESCRIPTION: Using column view for collected entries.
10471 :ALT_TITLE: Agenda Column View
10473 #+cindex: column view, in agenda
10474 #+cindex: agenda, column view
10476 Column view (see [[*Column View]]) is normally used to view and edit
10477 properties embedded in the hierarchical structure of an Org file. It
10478 can be quite useful to use column view also from the agenda, where
10479 entries are collected by certain criteria.
10481 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) ::
10482 #+kindex: C-c C-x C-c
10483 #+findex: org-agenda-columns
10485 Turn on column view in the agenda.
10487 To understand how to use this properly, it is important to realize
10488 that the entries in the agenda are no longer in their proper outline
10489 environment. This causes the following issues:
10492 #+vindex: org-columns-default-format
10493 #+vindex: org-overriding-columns-format
10494 Org needs to make a decision which columns format to use. Since
10495 the entries in the agenda are collected from different files, and
10496 different files may have different columns formats, this is
10497 a non-trivial problem. Org first checks if the variable
10498 ~org-agenda-overriding-columns-format~ is currently set, and if so,
10499 takes the format from there. Otherwise it takes the format
10500 associated with the first item in the agenda, or, if that item does
10501 not have a specific format (defined in a property, or in its file),
10502 it uses ~org-columns-default-format~.
10505 #+cindex: @samp{CLOCKSUM}, special property
10506 If any of the columns has a summary type defined (see [[*Column
10507 attributes]]), turning on column view in the agenda visits all
10508 relevant agenda files and make sure that the computations of this
10509 property are up to date. This is also true for the special
10510 =CLOCKSUM= property. Org then sums the values displayed in the
10511 agenda. In the daily/weekly agenda, the sums cover a single day;
10512 in all other views they cover the entire block.
10514 It is important to realize that the agenda may show the same entry
10515 /twice/---for example as scheduled and as a deadline---and it may
10516 show two entries from the same hierarchy (for example a /parent/
10517 and its /child/). In these cases, the summation in the agenda
10518 leads to incorrect results because some values count double.
10520 3. When the column view in the agenda shows the =CLOCKSUM= property,
10521 that is always the entire clocked time for this item. So even in
10522 the daily/weekly agenda, the clocksum listed in column view may
10523 originate from times outside the current view. This has the
10524 advantage that you can compare these values with a column listing
10525 the planned total effort for a task---one of the major
10526 applications for column view in the agenda. If you want
10527 information about clocked time in the displayed period use clock
10528 table mode (press {{{kbd(R)}}} in the agenda).
10531 #+cindex: @samp{CLOCKSUM_T}, special property
10532 When the column view in the agenda shows the =CLOCKSUM_T= property,
10533 that is always today's clocked time for this item. So even in the
10534 weekly agenda, the clocksum listed in column view only originates
10535 from today. This lets you compare the time you spent on a task for
10536 today, with the time already spent---via =CLOCKSUM=---and with
10537 the planned total effort for it.
10539 * Markup for Rich Contents
10541 :DESCRIPTION: Compose beautiful documents.
10544 Org is primarily about organizing and searching through your
10545 plain-text notes. However, it also provides a lightweight yet robust
10546 markup language for rich text formatting and more. For instance, you
10547 may want to center or emphasize text. Or you may need to insert
10548 a formula or image in your writing. Org offers syntax for all of this
10549 and more. Used in conjunction with the export framework (see
10550 [[*Exporting]]), you can author beautiful documents in Org---like the fine
10551 manual you are currently reading.
10555 :DESCRIPTION: The basic unit of text.
10558 #+cindex: paragraphs, markup rules
10559 Paragraphs are separated by at least one empty line. If you need to
10560 enforce a line break within a paragraph, use =\\= at the end of
10563 #+cindex: line breaks, markup rules
10564 To preserve the line breaks, indentation and blank lines in a region,
10565 but otherwise use normal formatting, you can use this construct, which
10566 can also be used to format poetry.
10568 #+cindex: @samp{BEGIN_VERSE}
10569 #+cindex: verse blocks
10572 Great clouds overhead
10573 Tiny black birds rise and fall
10580 When quoting a passage from another document, it is customary to
10581 format this as a paragraph that is indented on both the left and the
10582 right margin. You can include quotations in Org documents like this:
10584 #+cindex: @samp{BEGIN_QUOTE}
10585 #+cindex: quote blocks
10588 Everything should be made as simple as possible,
10589 but not any simpler ---Albert Einstein
10593 If you would like to center some text, do it like this:
10595 #+cindex: @samp{BEGIN_CENTER}
10596 #+cindex: center blocks
10599 Everything should be made as simple as possible, \\
10600 but not any simpler
10604 ** Emphasis and Monospace
10606 :DESCRIPTION: Bold, italic, etc.
10608 #+cindex: underlined text, markup rules
10609 #+cindex: bold text, markup rules
10610 #+cindex: italic text, markup rules
10611 #+cindex: verbatim text, markup rules
10612 #+cindex: code text, markup rules
10613 #+cindex: strike-through text, markup rules
10615 You can make words =*bold*=, =/italic/=, =_underlined_=, ==verbatim==
10616 and =~code~=, and, if you must, =+strike-through+=. Text in the code
10617 and verbatim string is not processed for Org mode specific syntax; it
10618 is exported verbatim.
10620 #+vindex: org-fontify-emphasized-text
10621 To turn off fontification for marked up text, you can set
10622 ~org-fontify-emphasized-text~ to ~nil~. To narrow down the list of
10623 available markup syntax, you can customize ~org-emphasis-alist~.
10625 ** Subscripts and Superscripts
10627 :DESCRIPTION: Simple syntax for raising/lowering text.
10629 #+cindex: subscript
10630 #+cindex: superscript
10632 =^= and =_= are used to indicate super- and subscripts. To increase
10633 the readability of ASCII text, it is not necessary, but OK, to
10634 surround multi-character sub- and superscripts with curly braces. For
10638 The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand,
10639 the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}.
10642 #+vindex: org-use-sub-superscripts
10643 If you write a text where the underscore is often used in a different
10644 context, Org's convention to always interpret these as subscripts can
10645 get in your way. Configure the variable ~org-use-sub-superscripts~ to
10646 change this convention. For example, when setting this variable to
10647 ~{}~, =a_b= is not interpreted as a subscript, but =a_{b}= is.
10649 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
10651 #+kindex: C-c C-x \
10652 #+findex: org-toggle-pretty-entities
10653 This command formats sub- and superscripts in a WYSIWYM way.
10657 :DESCRIPTION: Greek letters and other symbols.
10659 #+cindex: math symbols
10660 #+cindex: special symbols
10663 You can use LaTeX-like syntax to insert special symbols---named
10664 entities---like =\alpha= to indicate the Greek letter, or =\to= to indicate
10665 an arrow. Completion for these symbols is available, just type =\=
10666 and maybe a few letters, and press {{{kbd(M-TAB)}}} to see possible
10667 completions. If you need such a symbol inside a word, terminate it
10668 with a pair of curly brackets. For example
10671 Pro tip: Given a circle \Gamma of diameter d, the length of its
10672 circumference is \pi{}d.
10675 #+findex: org-entities-help
10676 #+vindex: org-entities-user
10677 A large number of entities is provided, with names taken from both
10678 HTML and LaTeX; you can comfortably browse the complete list from
10679 a dedicated buffer using the command ~org-entities-help~. It is also
10680 possible to provide your own special symbols in the variable
10681 ~org-entities-user~.
10683 During export, these symbols are transformed into the native format of
10684 the exporter back-end. Strings like =\alpha= are exported as =α= in
10685 the HTML output, and as =\(\alpha\)= in the LaTeX output. Similarly, =\nbsp=
10686 becomes = = in HTML and =~= in LaTeX.
10688 #+cindex: special symbols, in-buffer display
10689 If you would like to see entities displayed as UTF-8 characters, use
10690 the following command[fn:105]:
10692 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) ::
10693 #+kindex: C-c C-x \
10694 #+findex: org-toggle-pretty-entities
10696 Toggle display of entities as UTF-8 characters. This does not
10697 change the buffer content which remains plain ASCII, but it
10698 overlays the UTF-8 character for display purposes only.
10700 #+cindex: shy hyphen, special symbol
10701 #+cindex: dash, special symbol
10702 #+cindex: ellipsis, special symbol
10703 In addition to regular entities defined above, Org exports in
10704 a special way[fn:106] the following commonly used character
10705 combinations: =\-= is treated as a shy hyphen, =--= and =---= are
10706 converted into dashes, and =...= becomes a compact set of dots.
10710 :DESCRIPTION: LaTeX can be freely used inside Org documents.
10712 #+cindex: @TeX{} interpretation
10713 #+cindex: @LaTeX{} interpretation
10715 Plain ASCII is normally sufficient for almost all note taking.
10716 Exceptions include scientific notes, which often require mathematical
10717 symbols and the occasional formula. LaTeX[fn:107] is widely used to
10718 typeset scientific documents. Org mode supports embedding LaTeX code
10719 into its files, because many academics are used to writing and reading
10720 LaTeX source code, and because it can be readily processed to produce
10721 pretty output for a number of export back-ends.
10723 *** LaTeX fragments
10725 :DESCRIPTION: Complex formulas made easy.
10727 #+cindex: @LaTeX{} fragments
10729 #+vindex: org-format-latex-header
10730 Org mode can contain LaTeX math fragments, and it supports ways to
10731 process these for several export back-ends. When exporting to LaTeX,
10732 the code is left as it is. When exporting to HTML, Org can use either
10733 [[http://www.mathjax.org][MathJax]] (see [[*Math formatting in HTML export]]) or transcode the math
10734 into images (see [[*Previewing LaTeX fragments]]).
10736 LaTeX fragments do not need any special marking at all. The following
10737 snippets are identified as LaTeX source code:
10739 - Environments of any kind[fn:108]. The only requirement is that the
10740 =\begin= statement appears on a new line, preceded by only
10743 - Text within the usual LaTeX math delimiters. To avoid conflicts
10744 with currency specifications, single =$= characters are only
10745 recognized as math delimiters if the enclosed text contains at most
10746 two line breaks, is directly attached to the =$= characters with no
10747 whitespace in between, and if the closing =$= is followed by
10748 whitespace, punctuation or a dash. For the other delimiters, there
10749 is no such restriction, so when in doubt, use =\(...\)= as inline
10752 #+texinfo: @noindent
10756 \begin{equation} % arbitrary environments,
10757 x=\sqrt{b} % even tables, figures
10758 \end{equation} % etc
10760 If $a^2=b$ and \( b=2 \), then the solution must be
10761 either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
10764 #+vindex: org-export-with-latex
10765 LaTeX processing can be configured with the variable
10766 ~org-export-with-latex~. The default setting is ~t~ which means
10767 MathJax for HTML, and no processing for ASCII and LaTeX back-ends.
10768 You can also set this variable on a per-file basis using one of these
10771 | =#+OPTIONS: tex:t= | Do the right thing automatically (MathJax) |
10772 | =#+OPTIONS: tex:nil= | Do not process LaTeX fragments at all |
10773 | =#+OPTIONS: tex:verbatim= | Verbatim export, for jsMath or so |
10775 *** Previewing LaTeX fragments
10777 :DESCRIPTION: What will this snippet look like?
10779 #+cindex: @LaTeX{} fragments, preview
10781 #+vindex: org-preview-latex-default-process
10782 If you have a working LaTeX installation and =dvipng=, =dvisvgm= or
10783 =convert= installed[fn:109], LaTeX fragments can be processed to
10784 produce images of the typeset expressions to be used for inclusion
10785 while exporting to HTML (see [[*LaTeX fragments]]), or for inline
10786 previewing within Org mode.
10788 #+vindex: org-format-latex-options
10789 #+vindex: org-format-latex-header
10790 You can customize the variables ~org-format-latex-options~ and
10791 ~org-format-latex-header~ to influence some aspects of the preview.
10792 In particular, the ~:scale~ (and for HTML export, ~:html-scale~)
10793 property of the former can be used to adjust the size of the preview
10796 - {{{kbd(C-c C-x C-l)}}} (~org-toggle-latex-fragment~) ::
10797 #+kindex: C-c C-x C-l
10798 #+findex: org-toggle-latex-fragment
10800 Produce a preview image of the LaTeX fragment at point and
10801 overlay it over the source code. If there is no fragment at
10802 point, process all fragments in the current entry (between two
10803 headlines). When called with a prefix argument, process the
10804 entire subtree. When called with two prefix arguments, or when
10805 point is before the first headline, process the entire buffer.
10807 #+vindex: org-startup-with-latex-preview
10808 You can turn on the previewing of all LaTeX fragments in a file with
10810 : #+STARTUP: latexpreview
10812 To disable it, simply use
10814 : #+STARTUP: nolatexpreview
10816 *** Using CDLaTeX to enter math
10818 :DESCRIPTION: Speed up entering of formulas.
10819 :ALT_TITLE: CDLaTeX mode
10821 #+cindex: CD@LaTeX{}
10823 CDLaTeX mode is a minor mode that is normally used in combination with
10824 a major LaTeX mode like AUCTeX in order to speed-up insertion of
10825 environments and math templates. Inside Org mode, you can make use of
10826 some of the features of CDLaTeX mode. You need to install
10827 =cdlatex.el= and =texmathp.el= (the latter comes also with AUCTeX)
10828 from [[http://www.astro.uva.nl/~dominik/Tools/cdlatex]]. Do not use
10829 CDLaTeX mode itself under Org mode, but use the light version
10830 ~org-cdlatex-mode~ that comes as part of Org mode. Turn it on for the
10831 current buffer with {{{kbd(M-x org-cdlatex-mode)}}}, or for all Org
10834 #+begin_src emacs-lisp
10835 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
10838 When this mode is enabled, the following features are present (for
10839 more details see the documentation of CDLaTeX mode):
10841 #+attr_texinfo: :sep ,
10842 - {{{kbd(C-c {)}}} ::
10845 Insert an environment template.
10847 - {{{kbd(TAB)}}} ::
10850 The {{{kbd(TAB)}}} key expands the template if point is inside
10851 a LaTeX fragment[fn:110]. For example, {{{kbd(TAB)}}} expands
10852 =fr= to =\frac{}{}= and position point correctly inside the first
10853 brace. Another {{{kbd(TAB)}}} gets you into the second brace.
10855 Even outside fragments, {{{kbd(TAB)}}} expands environment
10856 abbreviations at the beginning of a line. For example, if you
10857 write =equ= at the beginning of a line and press {{{kbd(TAB)}}},
10858 this abbreviation is expanded to an =equation= environment. To
10859 get a list of all abbreviations, type {{{kbd(M-x
10860 cdlatex-command-help)}}}.
10862 - {{{kbd(^)}}}, {{{kbd(_)}}} ::
10865 #+vindex: cdlatex-simplify-sub-super-scripts
10867 Pressing {{{kbd(_)}}} and {{{kbd(^)}}} inside a LaTeX fragment
10868 inserts these characters together with a pair of braces. If you
10869 use {{{kbd(TAB)}}} to move out of the braces, and if the braces
10870 surround only a single character or macro, they are removed again
10871 (depending on the variable ~cdlatex-simplify-sub-super-scripts~).
10876 Pressing the backquote followed by a character inserts math
10877 macros, also outside LaTeX fragments. If you wait more than 1.5
10878 seconds after the backquote, a help window pops up.
10883 Pressing the single-quote followed by another character modifies
10884 the symbol before point with an accent or a font. If you wait
10885 more than 1.5 seconds after the single-quote, a help window pops
10886 up. Character modification works only inside LaTeX fragments;
10887 outside the quote is normal.
10889 ** Literal Examples
10891 :DESCRIPTION: Source code examples with special formatting.
10893 #+cindex: literal examples, markup rules
10894 #+cindex: code line references, markup rules
10896 You can include literal examples that should not be subjected to
10897 markup. Such examples are typeset in monospace, so this is well
10898 suited for source code and similar examples.
10900 #+cindex: @samp{BEGIN_EXAMPLE}
10901 #+cindex: example block
10904 Some example from a text file.
10908 Note that such blocks may be /indented/ in order to align nicely with
10909 indented text and in particular with plain list structure (see
10910 [[*Plain Lists]]). For simplicity when using small examples, you can
10911 also start the example lines with a colon followed by a space. There
10912 may also be additional whitespace before the colon:
10916 : Some example from a text file.
10919 #+cindex: formatting source code, markup rules
10920 #+vindex: org-latex-listings
10921 If the example is source code from a programming language, or any
10922 other text that can be marked up by Font Lock in Emacs, you can ask
10923 for the example to look like the fontified Emacs buffer[fn:111]. This
10924 is done with the code block, where you also need to specify the name
10925 of the major mode that should be used to fontify the example[fn:112],
10926 see [[*Structure Templates]] for shortcuts to easily insert code blocks.
10928 #+cindex: @samp{BEGIN_SRC}
10929 #+cindex: source block
10931 ,#+BEGIN_SRC emacs-lisp
10932 (defun org-xor (a b)
10938 Both in =example= and in =src= snippets, you can add a =-n= switch to
10939 the end of the =#+BEGIN= line, to get the lines of the example
10940 numbered. The =-n= takes an optional numeric argument specifying the
10941 starting line number of the block. If you use a =+n= switch, the
10942 numbering from the previous numbered snippet is continued in the
10943 current one. The =+n= switch can also take a numeric argument. This
10944 adds the value of the argument to the last line of the previous block
10945 to determine the starting line number.
10948 ,#+BEGIN_SRC emacs-lisp -n 20
10949 ;; This exports with line number 20.
10950 (message "This is line 21")
10953 ,#+BEGIN_SRC emacs-lisp +n 10
10954 ;; This is listed as line 31.
10955 (message "This is line 32")
10959 In literal examples, Org interprets strings like =(ref:name)= as
10960 labels, and use them as targets for special hyperlinks like
10961 =[[(name)]]=---i.e., the reference name enclosed in single parenthesis.
10962 In HTML, hovering the mouse over such a link remote-highlights the
10963 corresponding code line, which is kind of cool.
10965 You can also add a =-r= switch which /removes/ the labels from the
10966 source code[fn:113]. With the =-n= switch, links to these references
10967 are labeled by the line numbers from the code listing. Otherwise
10968 links use the labels with no parentheses. Here is an example:
10970 #+begin_example -l "(dumb-reference:%s)"
10971 ,#+BEGIN_SRC emacs-lisp -n -r
10972 (save-excursion (ref:sc)
10973 (goto-char (point-min)) (ref:jump)
10975 In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
10976 jumps to point-min.
10979 #+cindex: indentation, in source blocks
10980 Finally, you can use =-i= to preserve the indentation of a specific
10981 code block (see [[*Editing Source Code]]).
10983 #+vindex: org-coderef-label-format
10984 If the syntax for the label format conflicts with the language syntax,
10985 use a =-l= switch to change the format, for example
10987 : #+BEGIN_SRC pascal -n -r -l "((%s))"
10989 #+texinfo: @noindent
10990 See also the variable ~org-coderef-label-format~.
10992 HTML export also allows examples to be published as text areas (see
10993 [[*Text areas in HTML export]]).
10995 Because the =#+BEGIN= ... =#+END= patterns need to be added so often,
10996 a shortcut is provided (see [[*Structure Templates]]).
10998 - {{{kbd(C-c ')}}} (~org-edit-special~) ::
11001 #+findex: org-edit-special
11002 Edit the source code example at point in its native mode. This
11003 works by switching to a temporary buffer with the source code.
11004 You need to exit by pressing {{{kbd(C-c ')}}} again[fn:114]. The
11005 edited version then replaces the old version in the Org buffer.
11006 Fixed-width regions---where each line starts with a colon
11007 followed by a space---are edited using ~artist-mode~[fn:115] to
11008 allow creating ASCII drawings easily. Using this command in an
11009 empty line creates a new fixed-width region.
11011 #+cindex: storing link, in a source code buffer
11012 Calling ~org-store-link~ (see [[*Handling Links]]) while editing a source
11013 code example in a temporary buffer created with {{{kbd(C-c ')}}}
11014 prompts for a label. Make sure that it is unique in the current
11015 buffer, and insert it with the proper formatting like =(ref:label)= at
11016 the end of the current line. Then the label is stored as a link
11017 =(label)=, for retrieval with {{{kbd(C-c C-l)}}}.
11021 :DESCRIPTION: Display an image.
11024 #+cindex: inlining images
11025 #+cindex: images, markup rules
11026 An image is a link to an image file[fn:116] that does not have
11027 a description part, for example
11031 If you wish to define a caption for the image (see [[*Captions]]) and
11032 maybe a label for internal cross references (see [[*Internal Links]]),
11033 make sure that the link is on a line by itself and precede it with
11034 =CAPTION= and =NAME= keywords as follows:
11037 ,#+CAPTION: This is the caption for the next figure link (or table)
11038 ,#+NAME: fig:SED-HR4049
11042 #+texinfo: @noindent
11043 Such images can be displayed within the buffer with the following
11046 - {{{kbd(C-c C-x C-v)}}} (~org-toggle-inline-images~) ::
11048 #+kindex: C-c C-x C-v
11049 #+findex: org-toggle-inline-images
11050 #+vindex: org-startup-with-inline-images
11051 Toggle the inline display of linked images. When called with
11052 a prefix argument, also display images that do have a link
11053 description. You can ask for inline images to be displayed at
11054 startup by configuring the variable
11055 ~org-startup-with-inline-images~[fn:117].
11059 :DESCRIPTION: Describe tables, images...
11061 #+cindex: captions, markup rules
11062 #+cindex: @samp{CAPTION}, keyword
11064 You can assign a caption to a specific part of a document by inserting
11065 a =CAPTION= keyword immediately before it:
11068 ,#+CAPTION: This is the caption for the next table (or link)
11073 Optionally, the caption can take the form:
11075 : #+CAPTION[Short caption]: Longer caption.
11077 Even though images and tables are prominent examples of captioned
11078 structures, the same caption mechanism can apply to many
11079 others---e.g., LaTeX equations, source code blocks. Depending on the
11080 export back-end, those may or may not be handled.
11082 ** Horizontal Rules
11084 :DESCRIPTION: Make a line.
11087 #+cindex: horizontal rules, markup rules
11088 A line consisting of only dashes, and at least 5 of them, is exported
11089 as a horizontal line.
11093 :DESCRIPTION: Sharing and publishing notes.
11095 #+cindex: exporting
11097 At some point you might want to print your notes, publish them on the
11098 web, or share them with people not using Org. Org can convert and
11099 export documents to a variety of other formats while retaining as much
11100 structure (see [[*Document Structure]]) and markup (see [[*Markup for Rich
11101 Contents]]) as possible.
11103 #+cindex: export back-end
11104 The libraries responsible for translating Org files to other formats
11105 are called /back-ends/. Org ships with support for the following
11108 - /ascii/ (ASCII format)
11109 - /beamer/ (LaTeX Beamer format)
11110 - /html/ (HTML format)
11111 - /icalendar/ (iCalendar format)
11112 - /latex/ (LaTeX format)
11113 - /md/ (Markdown format)
11114 - /odt/ (OpenDocument Text format)
11115 - /org/ (Org format)
11116 - /texinfo/ (Texinfo format)
11117 - /man/ (Man page format)
11119 #+texinfo: @noindent
11120 Users can install libraries for additional formats from the Emacs
11121 packaging system. For easy discovery, these packages have a common
11122 naming scheme: ~ox-NAME~, where {{{var(NAME)}}} is a format. For
11123 example, ~ox-koma-letter~ for /koma-letter/ back-end. More libraries
11124 can be found in the =contrib/= directory (see [[*Installation]]).
11126 #+vindex: org-export-backends
11127 Org only loads back-ends for the following formats by default: ASCII,
11128 HTML, iCalendar, LaTeX, and ODT. Additional back-ends can be loaded
11129 in either of two ways: by configuring the ~org-export-backends~
11130 variable, or by requiring libraries in the Emacs init file. For
11131 example, to load the markdown back-end, add this to your Emacs config:
11133 #+begin_src emacs-lisp
11137 ** The Export Dispatcher
11139 :DESCRIPTION: The main interface.
11141 #+cindex: dispatcher, for export commands
11142 #+cindex: export, dispatcher
11144 The export dispatcher is the main interface for Org's exports.
11145 A hierarchical menu presents the currently configured export formats.
11146 Options are shown as easy toggle switches on the same screen.
11148 #+vindex: org-export-dispatch-use-expert-ui
11149 Org also has a minimal prompt interface for the export dispatcher.
11150 When the variable ~org-export-dispatch-use-expert-ui~ is set to
11151 a non-~nil~ value, Org prompts in the minibuffer. To switch back to
11152 the hierarchical menu, press {{{kbd(?)}}}.
11154 - {{{kbd(C-c C-e)}}} (~org-export~) ::
11156 #+findex: org-export
11158 Invokes the export dispatcher interface. The options show
11159 default settings. The {{{kbd(C-u)}}} prefix argument preserves
11160 options from the previous export, including any sub-tree
11163 Org exports the entire buffer by default. If the Org buffer has an
11164 active region, then Org exports just that region.
11166 Within the dispatcher interface, the following key combinations can
11167 further alter what is exported, and how.
11169 - {{{kbd(C-a)}}} ::
11170 #+kindex: C-c C-e C-a
11172 Toggle asynchronous export. Asynchronous export uses an external
11173 Emacs process with a specially configured initialization file to
11174 complete the exporting process in the background, without tying-up
11175 Emacs. This is particularly useful when exporting long documents.
11177 Output from an asynchronous export is saved on the /export
11178 stack/. To view this stack, call the export dispatcher with
11179 a double {{{kbd(C-u)}}} prefix argument. If already in the
11180 export dispatcher menu, {{{kbd(&)}}} displays the stack.
11182 #+vindex: org-export-in-background
11183 You can make asynchronous export the default by setting
11184 ~org-export-in-background~.
11186 #+vindex: org-export-async-init-file
11187 You can set the initialization file used by the background process
11188 by setting ~org-export-async-init-file~.
11190 - {{{kbd(C-b)}}} ::
11191 #+kindex: C-c C-e C-b
11193 Toggle body-only export. Useful for excluding headers and
11194 footers in the export. Affects only those back-end formats that
11195 have sections like =<head>...</head>= in HTML.
11197 - {{{kbd(C-s)}}} ::
11198 #+kindex: C-c C-e C-s
11200 Toggle sub-tree export. When turned on, Org exports only the
11201 sub-tree starting from point position at the time the export
11202 dispatcher was invoked. Org uses the top heading of this
11203 sub-tree as the document's title. If point is not on a heading,
11204 Org uses the nearest enclosing header. If point is in the
11205 document preamble, Org signals an error and aborts export.
11207 #+vindex: org-export-initial-scope
11208 To make sub-tree export the default, customize the variable
11209 ~org-export-initial-scope~.
11211 - {{{kbd(C-v)}}} ::
11212 #+kindex: C-c C-e C-v
11214 Toggle visible-only export. This is useful for exporting only certain
11215 parts of an Org document by adjusting the visibility
11216 of particular headings.
11220 :DESCRIPTION: Common export settings.
11222 #+cindex: options, for export
11223 #+cindex: Export, settings
11225 #+cindex: @samp{OPTIONS}, keyword
11226 Export options can be set: globally with variables; for an individual
11227 file by making variables buffer-local with in-buffer settings (see
11228 [[*Summary of In-Buffer Settings]]); by setting individual keywords or
11229 specifying them in compact form with the =OPTIONS= keyword; or for
11230 a tree by setting properties (see [[*Properties and Columns]]). Options
11231 set at a specific level override options set at a more general level.
11233 #+cindex: @samp{SETUPFILE}, keyword
11234 In-buffer settings may appear anywhere in the file, either directly or
11235 indirectly through a file included using =#+SETUPFILE: filename or
11236 URL= syntax. Option keyword sets tailored to a particular back-end
11237 can be inserted from the export dispatcher (see [[*The Export
11238 Dispatcher]]) using the =Insert template= command by pressing
11239 {{{kbd(#)}}}. To insert keywords individually, a good way to make
11240 sure the keyword is correct is to type =#+= and then to use
11241 {{{kbd(M-TAB)}}}[fn:16] for completion.
11243 The export keywords available for every back-end, and their equivalent
11244 global variables, include:
11248 #+cindex: @samp{AUTHOR}, keyword
11249 #+vindex: user-full-name
11250 The document author (~user-full-name~).
11254 #+cindex: @samp{CREATOR}, keyword
11255 #+vindex: org-expot-creator-string
11256 Entity responsible for output generation
11257 (~org-export-creator-string~).
11261 #+cindex: @samp{DATE}, keyword
11262 #+vindex: org-export-date-timestamp-format
11263 A date or a time-stamp[fn:118].
11267 #+cindex: @samp{EMAIL}, keyword
11268 #+vindex: user-mail-address
11269 The email address (~user-mail-address~).
11273 #+cindex: @samp{LANGUAGE}, keyword
11274 #+vindex: org-export-default-language
11275 Language to use for translating certain strings
11276 (~org-export-default-language~). With =#+LANGUAGE: fr=, for
11277 example, Org translates =Table of contents= to the French =Table
11282 #+cindex: @samp{SELECT_TAGS}, keyword
11283 #+vindex: org-export-select-tags
11284 The default value is ~("export")~. When a tree is tagged with
11285 =export= (~org-export-select-tags~), Org selects that tree and
11286 its sub-trees for export. Org excludes trees with =noexport=
11287 tags, see below. When selectively exporting files with =export=
11288 tags set, Org does not export any text that appears before the
11291 - =EXCLUDE_TAGS= ::
11293 #+cindex: @samp{EXCLUDE_TAGS}, keyword
11294 #+vindex: org-export-exclude-tags
11295 The default value is ~("noexport")~. When a tree is tagged with
11296 =noexport= (~org-export-exclude-tags~), Org excludes that tree
11297 and its sub-trees from export. Entries tagged with =noexport=
11298 are unconditionally excluded from the export, even if they have
11299 an =export= tag. Even if a sub-tree is not exported, Org
11300 executes any code blocks contained there.
11304 #+cindex: @samp{TITLE}, keyword
11305 #+cindex: document title
11306 Org displays this title. For long titles, use multiple =#+TITLE=
11309 - =EXPORT_FILE_NAME= ::
11311 #+cindex: @samp{EXPORT_FILE_NAME}, keyword
11312 The name of the output file to be generated. Otherwise, Org
11313 generates the file name based on the buffer name and the
11314 extension based on the back-end format.
11316 The =OPTIONS= keyword is a compact form. To configure multiple
11317 options, use several =OPTIONS= lines. =OPTIONS= recognizes the
11318 following arguments.
11322 #+vindex: org-export-with-smart-quotes
11323 Toggle smart quotes (~org-export-with-smart-quotes~). Depending
11324 on the language used, when activated, Org treats pairs of double
11325 quotes as primary quotes, pairs of single quotes as secondary
11326 quotes, and single quote marks as apostrophes.
11330 #+vindex: org-export-with-emphasize
11331 Toggle emphasized text (~org-export-with-emphasize~).
11335 #+vindex: org-export-with-special-strings
11336 Toggle conversion of special strings
11337 (~org-export-with-special-strings~).
11341 #+vindex: org-export-with-fixed-width
11342 Toggle fixed-width sections (~org-export-with-fixed-width~).
11346 #+vindex: org-export-with-timestamps
11347 Toggle inclusion of time/date active/inactive stamps
11348 (~org-export-with-timestamps~).
11352 #+vindex: org-export-preserve-breaks
11353 Toggles whether to preserve line breaks
11354 (~org-export-preserve-breaks~).
11358 #+vindex: org-export-with-sub-superscripts
11359 Toggle TeX-like syntax for sub- and superscripts. If you write
11360 =^:{}=, =a_{b}= is interpreted, but the simple =a_b= is left as
11361 it is (~org-export-with-sub-superscripts~).
11365 #+vindex: org-export-with-archived-trees
11366 Configure how archived trees are exported. When set to
11367 ~headline~, the export process skips the contents and processes
11368 only the headlines (~org-export-with-archived-trees~).
11372 #+vindex: org-export-with-author
11373 Toggle inclusion of author name into exported file
11374 (~org-export-with-author~).
11376 - ~broken-links~ ::
11378 #+vindex: org-export-with-broken-links
11379 Toggles if Org should continue exporting upon finding a broken
11380 internal link. When set to ~mark~, Org clearly marks the problem
11381 link in the output (~org-export-with-broken-links~).
11385 #+vindex: org-export-with-clocks
11386 Toggle inclusion of CLOCK keywords (~org-export-with-clocks~).
11390 #+vindex: org-export-with-creator
11391 Toggle inclusion of creator information in the exported file
11392 (~org-export-with-creator~).
11396 #+vindex: org-export-with-drawers
11397 Toggles inclusion of drawers, or list of drawers to include, or
11398 list of drawers to exclude (~org-export-with-drawers~).
11402 #+vindex: org-export-with-date
11403 Toggle inclusion of a date into exported file
11404 (~org-export-with-date~).
11408 #+vindex: org-export-with-entities
11409 Toggle inclusion of entities (~org-export-with-entities~).
11413 #+vindex: org-export-with-email
11414 Toggle inclusion of the author's e-mail into exported file
11415 (~org-export-with-email~).
11419 #+vindex: org-export-with-footnotes
11420 Toggle the inclusion of footnotes (~org-export-with-footnotes~).
11424 #+vindex: org-export-headline-levels
11425 Set the number of headline levels for export
11426 (~org-export-headline-levels~). Below that level, headlines are
11427 treated differently. In most back-ends, they become list items.
11431 #+vindex: org-export-with-inlinetasks
11432 Toggle inclusion of inlinetasks (~org-export-with-inlinetasks~).
11436 #+vindex: org-export-with-section-numbers
11437 #+cindex: @samp{UNNUMBERED}, property
11438 Toggle section-numbers (~org-export-with-section-numbers~). When
11439 set to number N, Org numbers only those headlines at level N or
11440 above. Set =UNNUMBERED= property to non-~nil~ to disable
11441 numbering of heading and subheadings entirely. Moreover, when
11442 the value is =notoc= the headline, and all its children, do not
11443 appear in the table of contents either (see [[*Table of Contents]]).
11447 #+vindex: org-export-with-planning
11448 Toggle export of planning information
11449 (~org-export-with-planning~). "Planning information" comes from
11450 lines located right after the headline and contain any
11451 combination of these cookies: =SCHEDULED=, =DEADLINE=, or
11456 #+vindex: org-export-with-priority
11457 Toggle inclusion of priority cookies
11458 (~org-export-with-priority~).
11462 #+vindex: org-export-with-properties
11463 Toggle inclusion of property drawers, or list the properties to
11464 include (~org-export-with-properties~).
11468 #+vindex: org-export-with-statistics-cookies
11469 Toggle inclusion of statistics cookies
11470 (~org-export-with-statistics-cookies~).
11474 #+vindex: org-export-with-tags
11475 Toggle inclusion of tags, may also be ~not-in-toc~
11476 (~org-export-with-tags~).
11480 #+vindex: org-export-with-tasks
11481 Toggle inclusion of tasks (TODO items); or ~nil~ to remove all
11482 tasks; or ~todo~ to remove DONE tasks; or list the keywords to
11483 keep (~org-export-with-tasks~).
11487 #+vindex: org-export-with-latex
11488 ~nil~ does not export; ~t~ exports; ~verbatim~ keeps everything
11489 in verbatim (~org-export-with-latex~).
11493 #+vindex: org-export-time-stamp-file
11494 Toggle inclusion of the creation time in the exported file
11495 (~org-export-time-stamp-file~).
11499 #+vindex: org-export-with-title
11500 Toggle inclusion of title (~org-export-with-title~).
11504 #+vindex: org-export-with-toc
11505 Toggle inclusion of the table of contents, or set the level limit
11506 (~org-export-with-toc~).
11510 #+vindex: org-export-with-todo-keywords
11511 Toggle inclusion of TODO keywords into exported text
11512 (~org-export-with-todo-keywords~).
11516 #+vindex: org-export-with-tables
11517 Toggle inclusion of tables (~org-export-with-tables~).
11519 When exporting sub-trees, special node properties can override the
11520 above keywords. These properties have an =EXPORT_= prefix. For
11521 example, =DATE= becomes, =EXPORT_DATE= when used for a specific
11522 sub-tree. Except for =SETUPFILE=, all other keywords listed above
11523 have an =EXPORT_= equivalent.
11525 #+cindex: @samp{BIND}, keyword
11526 #+vindex: org-export-allow-bind-keywords
11527 If ~org-export-allow-bind-keywords~ is non-~nil~, Emacs variables can
11528 become buffer-local during export by using the =BIND= keyword. Its
11529 syntax is =#+BIND: variable value=. This is particularly useful for
11530 in-buffer settings that cannot be changed using keywords.
11532 ** Table of Contents
11534 :DESCRIPTION: The if and where of the table of contents.
11536 #+cindex: table of contents
11537 #+cindex: list of tables
11538 #+cindex: list of listings
11540 #+cindex: @samp{toc}, in @samp{OPTIONS} keyword
11541 #+vindex: org-export-with-toc
11542 The table of contents includes all headlines in the document. Its
11543 depth is therefore the same as the headline levels in the file. If
11544 you need to use a different depth, or turn it off entirely, set the
11545 ~org-export-with-toc~ variable accordingly. You can achieve the same
11546 on a per file basis, using the following =toc= item in =OPTIONS=
11550 ,#+OPTIONS: toc:2 (only include two levels in TOC)
11551 ,#+OPTIONS: toc:nil (no default TOC at all)
11554 #+cindex: excluding entries from table of contents
11555 #+cindex: table of contents, exclude entries
11556 Org includes both numbered and unnumbered headlines in the table of
11557 contents[fn:119]. If you need to exclude an unnumbered headline,
11558 along with all its children, set the =UNNUMBERED= property to =notoc=
11562 ,* Subtree not numbered, not in table of contents either
11568 #+cindex: @samp{TOC}, keyword
11569 Org normally inserts the table of contents directly before the first
11570 headline of the file. To move the table of contents to a different
11571 location, first turn off the default with ~org-export-with-toc~
11572 variable or with =#+OPTIONS: toc:nil=. Then insert =#+TOC: headlines
11573 N= at the desired location(s).
11576 ,#+OPTIONS: toc:nil
11578 ,#+TOC: headlines 2
11581 To adjust the table of contents depth for a specific section of the
11582 Org document, append an additional =local= parameter. This parameter
11583 becomes a relative depth for the current level. The following example
11584 inserts a local table of contents, with direct children only.
11588 ,#+TOC: headlines 1 local
11591 Note that for this feature to work properly in LaTeX export, the Org
11592 file requires the inclusion of the titletoc package. Because of
11593 compatibility issues, titletoc has to be loaded /before/ hyperref.
11594 Customize the ~org-latex-default-packages-alist~ variable.
11596 Use the =TOC= keyword to generate list of tables---respectively, all
11597 listings---with captions.
11604 #+cindex: @samp{ALT_TITLE}, property
11605 Normally Org uses the headline for its entry in the table of contents.
11606 But with =ALT_TITLE= property, a different entry can be specified for
11607 the table of contents.
11611 :DESCRIPTION: Include additional files into a document.
11613 #+cindex: include files, during export
11614 #+cindex: export, include files
11615 #+cindex: @samp{INCLUDE}, keyword
11617 During export, you can include the content of another file. For
11618 example, to include your =.emacs= file, you could use:
11620 : #+INCLUDE: "~/.emacs" src emacs-lisp
11622 #+texinfo: @noindent
11623 The first parameter is the file name to include. The optional second
11624 parameter specifies the block type: =example=, =export= or =src=. The
11625 optional third parameter specifies the source code language to use for
11626 formatting the contents. This is relevant to both =export= and =src=
11629 If an included file is specified as having a markup language, Org
11630 neither checks for valid syntax nor changes the contents in any way.
11631 For example and source blocks, Org code-escapes the contents before
11634 #+cindex: @samp{minlevel}, include
11635 If an included file is not specified as having any markup language,
11636 Org assumes it be in Org format and proceeds as usual with a few
11637 exceptions. Org makes the footnote labels (see [[*Creating Footnotes]])
11638 in the included file local to that file. The contents of the included
11639 file belong to the same structure---headline, item---containing the
11640 =INCLUDE= keyword. In particular, headlines within the file become
11641 children of the current section. That behavior can be changed by
11642 providing an additional keyword parameter, =:minlevel=. It shifts the
11643 headlines in the included file to become the lowest level. For
11644 example, this syntax makes the included file a sibling of the current
11645 top-level headline:
11647 : #+INCLUDE: "~/my-book/chapter2.org" :minlevel 1
11649 #+cindex: @samp{lines}, include
11650 Inclusion of only portions of files are specified using ranges
11651 parameter with =:lines= keyword. The line at the upper end of the
11652 range will not be included. The start and/or the end of the range may
11653 be omitted to use the obvious defaults.
11655 | =#+INCLUDE: "~/.emacs" :lines "5-10"= | Include lines 5 to 10, 10 excluded |
11656 | =#+INCLUDE: "~/.emacs" :lines "-10"= | Include lines 1 to 10, 10 excluded |
11657 | =#+INCLUDE: "~/.emacs" :lines "10-"= | Include lines from 10 to EOF |
11659 Inclusions may specify a file-link to extract an object matched by
11660 ~org-link-search~[fn:120] (see [[*Search Options in File Links]]). The
11661 ranges for =:lines= keyword are relative to the requested element.
11664 : #+INCLUDE: "./paper.org::*conclusion" :lines 1-20
11666 #+texinfo: @noindent
11667 includes the first 20 lines of the headline named =conclusion=.
11669 #+cindex: @samp{only-contents}, include
11670 To extract only the contents of the matched object, set
11671 =:only-contents= property to non-~nil~. This omits any planning lines
11672 or property drawers. For example, to include the body of the heading
11673 with the custom ID =theory=, you can use
11675 : #+INCLUDE: "./paper.org::#theory" :only-contents t
11677 The following command allows navigating back and forth to the included
11680 - {{{kbd(C-c ')}}} (~org-edit~special~) ::
11682 #+findex: org-edit-special
11684 Visit the included file at point.
11686 ** Macro Replacement
11688 :DESCRIPTION: Use macros to create templates.
11690 #+cindex: macro replacement, during export
11691 #+cindex: @samp{MACRO}, keyword
11693 #+vindex: org-export-global-macros
11694 Macros replace text snippets during export. Macros are defined
11695 globally in ~org-export-global-macros~, or document-wise with the
11698 : #+MACRO: name replacement text; $1, $2 are arguments
11700 #+texinfo: @noindent
11701 which can be referenced using ={{{name(arg1, arg2)}}}=[fn:121]. For
11705 ,#+MACRO: poem The rose is $1, The violet's $2. Life's ordered: Org assists you.
11706 {{{poem(red,blue)}}}
11709 #+texinfo: @noindent
11712 : The rose is red, The violet's blue. Life's ordered: Org assists you.
11714 As a special case, Org parses any replacement text starting with
11715 =(eval= as an Emacs Lisp expression and evaluates it accordingly.
11716 Within such templates, arguments become strings. Thus, the following
11719 : #+MACRO: gnucheck (eval (concat "GNU/" (capitalize $1)))
11721 #+texinfo: @noindent
11722 turns ={{{gnucheck(linux)}}}= into =GNU/Linux= during export.
11724 Org recognizes macro references in following Org markup areas:
11725 paragraphs, headlines, verse blocks, tables cells and lists. Org also
11726 recognizes macro references in keywords, such as =CAPTION=, =TITLE=,
11727 =AUTHOR=, =DATE=, and for some back-end specific export options.
11729 Org comes with following pre-defined macros:
11731 #+attr_texinfo: :sep ;
11732 - ={{{keyword(NAME)}}}=; ={{{title}}}=; ={{{author}}}=; ={{{email}}}= ::
11734 #+cindex: @samp{keyword}, macro
11735 #+cindex: @samp{title}, macro
11736 #+cindex: @samp{author}, macro
11737 #+cindex: @samp{email}, macro
11738 The =keyword= macro collects all values from {{{var(NAME)}}}
11739 keywords throughout the buffer, separated with white space.
11740 =title=, =author= and =email= macros are shortcuts for,
11741 respectively, ={{{keyword(TITLE)}}}=, ={{{keyword(AUTHOR)}}}= and
11742 ={{{keyword(EMAIL)}}}=.
11744 - ={{{date}}}=; ={{{date(FORMAT)}}}= ::
11746 #+cindex: @samp{date}, macro
11747 This macro refers to the =DATE= keyword. {{{var(FORMAT)}}} is an
11748 optional argument to the =date= macro that is used only if =DATE=
11749 is a single timestamp. {{{var(FORMAT)}}} should be a format
11750 string understood by ~format-time-string~.
11752 - ={{{time(FORMAT)}}}=; ={{{modification-time(FORMAT, VC)}}}= ::
11754 #+cindex: @samp{time}, macro
11755 #+cindex: @samp{modification-time}, macro
11756 These macros refer to the document's date and time of export and
11757 date and time of modification. {{{var(FORMAT)}}} is a string
11758 understood by ~format-time-string~. If the second argument to
11759 the ~modification-time~ macro is non-~nil~, Org uses =vc.el= to
11760 retrieve the document's modification time from the version
11761 control system. Otherwise Org reads the file attributes.
11763 - ={{{input-file}}}= ::
11765 #+cindex: @samp{input-file}, macro
11766 This macro refers to the filename of the exported file.
11768 - ={{{property(PROPERTY-NAME)}}}=; ={{{property(PROPERTY-NAME, SEARCH OPTION)}}}= ::
11770 #+cindex: @samp{property}, macro
11771 This macro returns the value of property {{{var(PROPERTY-NAME)}}}
11772 in the current entry. If {{{var(SEARCH-OPTION)}}} (see [[*Search
11773 Options in File Links]]) refers to a remote entry, use it instead.
11775 - ={{{n}}}=; ={{{n(NAME)}}}=; ={{{n(NAME, ACTION)}}}= ::
11777 #+cindex: @samp{n}, macro
11778 #+cindex: counter, macro
11779 This macro implements custom counters by returning the number of
11780 times the macro has been expanded so far while exporting the
11781 buffer. You can create more than one counter using different
11782 {{{var(NAME)}}} values. If {{{var(ACTION)}}} is =-=, previous
11783 value of the counter is held, i.e., the specified counter is not
11784 incremented. If the value is a number, the specified counter is
11785 set to that value. If it is any other non-empty string, the
11786 specified counter is reset to 1. You may leave {{{var(NAME)}}}
11787 empty to reset the default counter.
11789 #+cindex: @samp{results}, macro
11790 Moreover, inline source blocks (see [[*Structure of Code Blocks]]) use the
11791 special =results= macro to mark their output. As such, you are
11792 advised against re-defining it, unless you know what you are doing.
11794 #+vindex: org-hide-macro-markers
11795 The surrounding brackets can be made invisible by setting
11796 ~org-hide-macro-markers~ to a non-~nil~ value.
11798 Org expands macros at the very beginning of the export process.
11802 :DESCRIPTION: What will not be exported.
11804 #+cindex: exporting, not
11806 #+cindex: comment lines
11807 Lines starting with zero or more whitespace characters followed by one
11808 =#= and a whitespace are treated as comments and, as such, are not
11811 #+cindex: @samp{BEGIN_COMMENT}
11812 #+cindex: comment block
11813 Likewise, regions surrounded by =#+BEGIN_COMMENT= ... =#+END_COMMENT=
11816 #+cindex: comment trees
11817 Finally, a =COMMENT= keyword at the beginning of an entry, but after
11818 any other keyword or priority cookie, comments out the entire subtree.
11819 In this case, the subtree is not exported and no code block within it
11820 is executed either[fn:122]. The command below helps changing the
11821 comment status of a headline.
11823 - {{{kbd(C-c ;)}}} (~org-toggle-comment~) ::
11825 #+findex: org-toggle-comment
11827 Toggle the =COMMENT= keyword at the beginning of an entry.
11829 ** ASCII/Latin-1/UTF-8 export
11831 :DESCRIPTION: Exporting to flat files with encoding.
11833 #+cindex: ASCII export
11834 #+cindex: Latin-1 export
11835 #+cindex: UTF-8 export
11837 ASCII export produces an output file containing only plain ASCII
11838 characters. This is the simplest and most direct text output. It
11839 does not contain any Org markup. Latin-1 and UTF-8 export use
11840 additional characters and symbols available in these encoding
11841 standards. All three of these export formats offer the most basic of
11842 text output for maximum portability.
11844 #+vindex: org-ascii-text-width
11845 On export, Org fills and justifies text according to the text width
11846 set in ~org-ascii-text-width~.
11848 #+vindex: org-ascii-links-to-notes
11849 Org exports links using a footnote-like style where the descriptive
11850 part is in the text and the link is in a note before the next heading.
11851 See the variable ~org-ascii-links-to-notes~ for details.
11853 *** ASCII export commands
11858 #+attr_texinfo: :sep ,
11859 - {{{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)}}} ::
11860 #+kindex: C-c C-e t a
11861 #+kindex: C-c C-e t l
11862 #+kindex: C-c C-e t u
11863 #+findex: org-ascii-export-to-ascii
11865 Export as an ASCII file with a =.txt= extension. For
11866 =myfile.org=, Org exports to =myfile.txt=, overwriting without
11867 warning. For =myfile.txt=, Org exports to =myfile.txt.txt= in
11868 order to prevent data loss.
11870 #+attr_texinfo: :sep ,
11871 - {{{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)}}} ::
11872 #+kindex: C-c C-e t A
11873 #+kindex: C-c C-e t L
11874 #+kindex: C-c C-e t U
11875 #+findex: org-ascii-export-to-ascii
11877 Export to a temporary buffer. Does not create a file.
11879 *** ASCII specific export settings
11884 The ASCII export back-end has one extra keyword for customizing ASCII
11885 output. Setting this keyword works similar to the general options
11886 (see [[*Export Settings]]).
11890 #+cindex: @samp{SUBTITLE}, keyword
11891 The document subtitle. For long subtitles, use multiple
11892 =#+SUBTITLE= lines in the Org file. Org prints them on one
11893 continuous line, wrapping into multiple lines if necessary.
11895 *** Header and sectioning structure
11900 Org converts the first three outline levels into headlines for ASCII
11901 export. The remaining levels are turned into lists. To change this
11902 cut-off point where levels become lists, see [[*Export Settings]].
11904 *** Quoting ASCII text
11909 To insert text within the Org file by the ASCII back-end, use one the
11910 following constructs, inline, keyword, or export block:
11912 #+cindex: @samp{ASCII}, keyword
11913 #+cindex: @samp{BEGIN_EXPORT ascii}
11915 Inline text @@ascii:and additional text@@ within a paragraph.
11917 ,#+ASCII: Some text
11919 ,#+BEGIN_EXPORT ascii
11920 Org exports text in this block only when using ASCII back-end.
11924 *** ASCII specific attributes
11928 #+cindex: @samp{ATTR_ASCII}, keyword
11929 #+cindex: horizontal rules, in ASCII export
11931 ASCII back-end recognizes only one attribute, =:width=, which
11932 specifies the width of a horizontal rule in number of characters. The
11933 keyword and syntax for specifying widths is:
11936 ,#+ATTR_ASCII: :width 10
11940 *** ASCII special blocks
11944 #+cindex: special blocks, in ASCII export
11945 #+cindex: @samp{BEGIN_JUSTIFYLEFT}
11946 #+cindex: @samp{BEGIN_JUSTIFYRIGHT}
11948 Besides =#+BEGIN_CENTER= blocks (see [[*Paragraphs]]), ASCII back-end has
11949 these two left and right justification blocks:
11952 ,#+BEGIN_JUSTIFYLEFT
11953 It's just a jump to the left...
11956 ,#+BEGIN_JUSTIFYRIGHT
11957 ...and then a step to the right.
11958 ,#+END_JUSTIFYRIGHT
11962 #+cindex: Beamer export
11964 Org uses Beamer export to convert an Org file tree structure into
11965 high-quality interactive slides for presentations. Beamer is a LaTeX
11966 document class for creating presentations in PDF, HTML, and other
11967 popular display formats.
11969 *** Beamer export commands
11971 :DESCRIPTION: For creating Beamer documents.
11974 - {{{kbd(C-c C-e l b)}}} (~org-beamer-export-to-latex~) ::
11975 #+kindex: C-c C-e l b
11976 #+findex: org-beamer-export-to-latex
11978 Export as LaTeX file with a =.tex= extension. For =myfile.org=,
11979 Org exports to =myfile.tex=, overwriting without warning.
11981 - {{{kbd(C-c C-e l B)}}} (~org-beamer-export-as-latex~) ::
11982 #+kindex: C-c C-e l B
11983 #+findex: org-beamer-export-as-latex
11985 Export to a temporary buffer. Does not create a file.
11987 - {{{kbd(C-c C-e l P)}}} (~org-beamer-export-to-pdf~) ::
11988 #+kindex: C-c C-e l P
11989 #+findex: org-beamer-export-to-pdf
11991 Export as LaTeX file and then convert it to PDF format.
11993 - {{{kbd(C-c C-e l O)}}} ::
11994 #+kindex: C-c C-e l O
11996 Export as LaTeX file, convert it to PDF format, and then open the
11999 *** Beamer specific export settings
12001 :DESCRIPTION: For customizing Beamer export.
12004 Beamer export back-end has several additional keywords for customizing
12005 Beamer output. These keywords work similar to the general options
12006 settings (see [[*Export Settings]]).
12008 - =BEAMER_THEME= ::
12010 #+cindex: @samp{BEAMER_THEME}, keyword
12011 #+vindex: org-beamer-theme
12012 The Beamer layout theme (~org-beamer-theme~). Use square
12013 brackets for options. For example:
12015 : #+BEAMER_THEME: Rochester [height=20pt]
12017 - =BEAMER_FONT_THEME= ::
12019 #+cindex: @samp{BEAMER_FONT_THEME}, keyword
12020 The Beamer font theme.
12022 - =BEAMER_INNER_THEME= ::
12024 #+cindex: @samp{BEAMER_INNER_THEME}, keyword
12025 The Beamer inner theme.
12027 - =BEAMER_OUTER_THEME= ::
12029 #+cindex: @samp{BEAMER_OUTER_THEME}, keyword
12030 The Beamer outer theme.
12032 - =BEAMER_HEADER= ::
12034 #+cindex: @samp{BEAMER_HEADER}, keyword
12035 Arbitrary lines inserted in the preamble, just before the
12036 =hyperref= settings.
12040 #+cindex: @samp{DESCRIPTION}, keyword
12041 The document description. For long descriptions, use multiple
12042 =DESCRIPTION= keywords. By default, =hyperref= inserts
12043 =DESCRIPTION= as metadata. Use ~org-latex-hyperref-template~ to
12044 configure document metadata. Use ~org-latex-title-command~ to
12045 configure typesetting of description as part of front matter.
12049 #+cindex: @samp{KEYWORDS}, keyword
12050 The keywords for defining the contents of the document. Use
12051 multiple =KEYWORDS= lines if necessary. By default, =hyperref=
12052 inserts =KEYWORDS= as metadata. Use
12053 ~org-latex-hyperref-template~ to configure document metadata.
12054 Use ~org-latex-title-command~ to configure typesetting of
12055 keywords as part of front matter.
12059 #+cindex: @samp{SUBTITLE}, keyword
12060 Document's subtitle. For typesetting, use
12061 ~org-beamer-subtitle-format~ string. Use
12062 ~org-latex-hyperref-template~ to configure document metadata.
12063 Use ~org-latex-title-command~ to configure typesetting of
12064 subtitle as part of front matter.
12066 *** Frames and Blocks in Beamer
12068 :DESCRIPTION: For composing Beamer slides.
12071 Org transforms heading levels into Beamer's sectioning elements,
12072 frames and blocks. Any Org tree with a not-too-deep-level nesting
12073 should in principle be exportable as a Beamer presentation.
12076 #+vindex: org-beamer-frame-level
12077 Org headlines become Beamer frames when the heading level in Org is
12078 equal to ~org-beamer-frame-level~ or =H= value in a =OPTIONS= line
12079 (see [[*Export Settings]]).
12081 #+cindex: @samp{BEAMER_ENV}, property
12082 Org overrides headlines to frames conversion for the current tree of
12083 an Org file if it encounters the =BEAMER_ENV= property set to
12084 =frame= or =fullframe=. Org ignores whatever
12085 ~org-beamer-frame-level~ happens to be for that headline level in
12086 the Org tree. In Beamer terminology, a full frame is a frame
12089 - Org exports a Beamer frame's objects as block environments. Org can
12090 enforce wrapping in special block types when =BEAMER_ENV= property
12091 is set[fn:123]. For valid values see
12092 ~org-beamer-environments-default~. To add more values, see
12093 ~org-beamer-environments-extra~.
12094 #+vindex: org-beamer-environments-default
12095 #+vindex: org-beamer-environments-extra
12098 #+cindex: @samp{BEAMER_REF}, property
12099 If =BEAMER_ENV= is set to =appendix=, Org exports the entry as an
12100 appendix. When set to =note=, Org exports the entry as a note
12101 within the frame or between frames, depending on the entry's heading
12102 level. When set to =noteNH=, Org exports the entry as a note
12103 without its title. When set to =againframe=, Org exports the entry
12104 with =\againframe= command, which makes setting the =BEAMER_REF=
12105 property mandatory because =\againframe= needs frame to resume.
12107 When =ignoreheading= is set, Org export ignores the entry's headline
12108 but not its content. This is useful for inserting content between
12109 frames. It is also useful for properly closing a =column=
12110 environment. @end itemize
12112 #+cindex: @samp{BEAMER_ACT}, property
12113 #+cindex: @samp{BEAMER_OPT}, property
12114 When =BEAMER_ACT= is set for a headline, Org export translates that
12115 headline as an overlay or action specification. When enclosed in
12116 square brackets, Org export makes the overlay specification
12117 a default. Use =BEAMER_OPT= to set any options applicable to the
12118 current Beamer frame or block. The Beamer export back-end wraps
12119 with appropriate angular or square brackets. It also adds the
12120 =fragile= option for any code that may require a verbatim block.
12122 #+cindex: @samp{BEAMER_COL}, property
12123 To create a column on the Beamer slide, use the =BEAMER_COL=
12124 property for its headline in the Org file. Set the value of
12125 =BEAMER_COL= to a decimal number representing the fraction of the
12126 total text width. Beamer export uses this value to set the column's
12127 width and fills the column with the contents of the Org entry. If
12128 the Org entry has no specific environment defined, Beamer export
12129 ignores the heading. If the Org entry has a defined environment,
12130 Beamer export uses the heading as title. Behind the scenes, Beamer
12131 export automatically handles LaTeX column separations for contiguous
12132 headlines. To manually adjust them for any unique configurations
12133 needs, use the =BEAMER_ENV= property.
12135 *** Beamer specific syntax
12137 :DESCRIPTION: For using in Org documents.
12140 Since Org's Beamer export back-end is an extension of the LaTeX
12141 back-end, it recognizes other LaTeX specific syntax---for example,
12142 =#+LATEX:= or =#+ATTR_LATEX:=. See [[*LaTeX Export]], for details.
12144 Beamer export wraps the table of contents generated with =toc:t=
12145 =OPTION= keyword in a =frame= environment. Beamer export does not
12146 wrap the table of contents generated with =TOC= keyword (see [[*Table of
12147 Contents]]). Use square brackets for specifying options.
12149 : #+TOC: headlines [currentsection]
12151 Insert Beamer-specific code using the following constructs:
12153 #+cindex: @samp{BEAMER}, keyword
12154 #+cindex: @samp{BEGIN_EXPORT beamer}
12158 ,#+BEGIN_EXPORT beamer
12159 Only Beamer export back-end exports this.
12162 Text @@beamer:some code@@ within a paragraph.
12165 Inline constructs, such as the last one above, are useful for adding
12166 overlay specifications to objects with ~bold~, ~item~, ~link~,
12167 ~radio-target~ and ~target~ types. Enclose the value in angular
12168 brackets and place the specification at the beginning of the object as
12169 shown in this example:
12171 : A *@@beamer:<2->@@useful* feature
12173 #+cindex: @samp{ATTR_BEAMER}, keyword
12174 Beamer export recognizes the =ATTR_BEAMER= keyword with the following
12175 attributes from Beamer configurations: =:environment= for changing
12176 local Beamer environment, =:overlay= for specifying Beamer overlays in
12177 angular or square brackets, and =:options= for inserting optional
12181 ,#+ATTR_BEAMER: :environment nonindentlist
12182 - item 1, not indented
12183 - item 2, not indented
12184 - item 3, not indented
12188 ,#+ATTR_BEAMER: :overlay <+->
12194 ,#+ATTR_BEAMER: :options [Lagrange]
12195 Let $G$ be a finite group, and let $H$ be
12196 a subgroup of $G$. Then the order of $H$ divides the order of $G$.
12199 *** Editing support
12201 :DESCRIPTION: Editing support.
12204 The ~org-beamer-mode~ is a special minor mode for faster editing of
12207 : #+STARTUP: beamer
12209 - {{{kbd(C-c C-b)}}} (~org-beamer-select-environment~) ::
12211 #+findex: org-beamer-select-environment
12213 The ~org-beamer-mode~ provides this key for quicker selections in
12214 Beamer normal environments, and for selecting the =BEAMER_COL=
12217 *** A Beamer example
12219 :DESCRIPTION: A complete presentation.
12222 Here is an example of an Org document ready for Beamer export.
12225 ;#+TITLE: Example Presentation
12226 ;#+AUTHOR: Carsten Dominik
12227 ;#+OPTIONS: H:2 toc:t num:t
12228 ;#+LATEX_CLASS: beamer
12229 ;#+LATEX_CLASS_OPTIONS: [presentation]
12230 ;#+BEAMER_THEME: Madrid
12231 ;#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) %8BEAMER_OPT(Opt)
12233 ,* This is the first structural section
12236 ,*** Thanks to Eric Fraga :B_block:
12241 for the first viable Beamer setup in Org
12242 ,*** Thanks to everyone else :B_block:
12248 for contributing to the discussion
12249 ,**** This will be formatted as a beamer note :B_note:
12253 ,** Frame 2 (where we will not use columns)
12255 Please test this stuff!
12260 :DESCRIPTION: Exporting to HTML.
12262 #+cindex: HTML export
12264 Org mode contains an HTML exporter with extensive HTML formatting
12265 compatible with XHTML 1.0 strict standard.
12267 *** HTML export commands
12269 :DESCRIPTION: Invoking HTML export.
12272 - {{{kbd(C-c C-e h h)}}} (~org-html-export-to-html~) ::
12273 #+kindex: C-c C-e h h
12274 #+kindex: C-c C-e h o
12275 #+findex: org-html-export-to-html
12277 Export as HTML file with a =.html= extension. For =myfile.org=,
12278 Org exports to =myfile.html=, overwriting without warning.
12279 {{{kbd{C-c C-e h o)}}} exports to HTML and opens it in a web
12282 - {{{kbd(C-c C-e h H)}}} (~org-html-export-as-html~) ::
12283 #+kindex: C-c C-e h H
12284 #+findex: org-html-export-as-html
12286 Exports to a temporary buffer. Does not create a file.
12288 *** HTML specific export settings
12290 :DESCRIPTION: Settings for HTML export.
12293 HTML export has a number of keywords, similar to the general options
12294 settings described in [[*Export Settings]].
12298 #+cindex: @samp{DESCRIPTION}, keyword
12299 This is the document's description, which the HTML exporter
12300 inserts it as a HTML meta tag in the HTML file. For long
12301 descriptions, use multiple =DESCRIPTION= lines. The exporter
12302 takes care of wrapping the lines properly.
12304 - =HTML_DOCTYPE= ::
12306 #+cindex: @samp{HTML_DOCTYPE}, keyword
12307 #+vindex: org-html-doctype
12308 Specify the document type, for example: HTML5
12309 (~org-html-doctype~).
12311 - =HTML_CONTAINER= ::
12313 #+cindex: @samp{HTML_CONTAINER}, keyword
12314 #+vindex: org-html-container-element
12315 Specify the HTML container, such as =div=, for wrapping sections
12316 and elements (~org-html-container-element~).
12318 - =HTML_LINK_HOME= ::
12320 #+cindex: @samp{HTML_LINK_HOME}, keyword
12321 #+vindex: org-html-link-home
12322 The URL for home link (~org-html-link-home~).
12324 - =HTML_LINK_UP= ::
12326 #+cindex: @samp{HTML_LINK_UP}, keyword
12327 #+vindex: org-html-link-up
12328 The URL for the up link of exported HTML pages
12329 (~org-html-link-up~).
12331 - =HTML_MATHJAX= ::
12333 #+cindex: @samp{HTML_MATHJAX}, keyword
12334 #+vindex: org-html-mathjax-options
12335 Options for MathJax (~org-html-mathjax-options~). MathJax is
12336 used to typeset LaTeX math in HTML documents. See [[*Math
12337 formatting in HTML export]], for an example.
12341 #+cindex: @samp{HTML_HEAD}, keyword
12342 #+vindex: org-html-head
12343 Arbitrary lines for appending to the HTML document's head
12346 - =HTML_HEAD_EXTRA= ::
12348 #+cindex: @samp{HTML_HEAD_EXTRA}, keyword
12349 #+vindex: org-html-head-extra
12350 More arbitrary lines for appending to the HTML document's head
12351 (~org-html-head-extra~).
12355 #+cindex: @samp{KEYWORDS}, keyword
12356 Keywords to describe the document's content. HTML exporter
12357 inserts these keywords as HTML meta tags. For long keywords, use
12358 multiple =KEYWORDS= lines.
12360 - =LATEX_HEADER= ::
12362 #+cindex: @samp{LATEX_HEADER}, keyword
12363 Arbitrary lines for appending to the preamble; HTML exporter
12364 appends when transcoding LaTeX fragments to images (see [[*Math
12365 formatting in HTML export]]).
12369 #+cindex: @samp{SUBTITLE}, keyword
12370 The document's subtitle. HTML exporter formats subtitle if
12371 document type is =HTML5= and the CSS has a =subtitle= class.
12373 Some of these keywords are explained in more detail in the following
12374 sections of the manual.
12378 :DESCRIPTION: Exporting various (X)HTML flavors.
12381 Org can export to various (X)HTML flavors.
12383 #+vindex: org-html-doctype
12384 #+vindex: org-html-doctype-alist
12385 Set the ~org-html-doctype~ variable for different (X)HTML variants.
12386 Depending on the variant, the HTML exporter adjusts the syntax of HTML
12387 conversion accordingly. Org includes the following ready-made
12391 - ~"html4-transitional"~
12392 - ~"html4-frameset"~
12394 - ~"xhtml-transitional"~
12395 - ~"xhtml-frameset"~
12400 #+texinfo: @noindent
12401 See the variable ~org-html-doctype-alist~ for details. The default is
12404 #+vindex: org-html-html5-fancy
12405 #+cindex: @samp{HTML5}, export new elements
12406 Org's HTML exporter does not by default enable new block elements
12407 introduced with the HTML5 standard. To enable them, set
12408 ~org-html-html5-fancy~ to non-~nil~. Or use an =OPTIONS= line in the
12409 file to set =html5-fancy=.
12411 HTML5 documents can now have arbitrary =#+BEGIN= ... =#+END= blocks.
12420 #+texinfo: @noindent
12429 #+texinfo: @noindent
12433 ,#+ATTR_HTML: :controls controls :width 350
12435 ,#+HTML: <source src="movie.mp4" type="video/mp4">
12436 ,#+HTML: <source src="movie.ogg" type="video/ogg">
12437 Your browser does not support the video tag.
12441 #+texinfo: @noindent
12445 <video controls="controls" width="350">
12446 <source src="movie.mp4" type="video/mp4">
12447 <source src="movie.ogg" type="video/ogg">
12448 <p>Your browser does not support the video tag.</p>
12452 #+vindex: org-html-html5-elements
12453 When special blocks do not have a corresponding HTML5 element, the
12454 HTML exporter reverts to standard translation (see
12455 ~org-html-html5-elements~). For example, =#+BEGIN_lederhosen= exports
12456 to ~<div class="lederhosen">~.
12458 Special blocks cannot have headlines. For the HTML exporter to wrap
12459 the headline and its contents in ~<section>~ or ~<article>~ tags, set
12460 the =HTML_CONTAINER= property for the headline.
12462 *** HTML preamble and postamble
12464 :DESCRIPTION: Inserting preamble and postamble.
12466 #+vindex: org-html-preamble
12467 #+vindex: org-html-postamble
12468 #+vindex: org-html-preamble-format
12469 #+vindex: org-html-postamble-format
12470 #+vindex: org-html-validation-link
12471 #+vindex: org-export-creator-string
12472 #+vindex: org-export-time-stamp-file
12474 The HTML exporter has delineations for preamble and postamble. The
12475 default value for ~org-html-preamble~ is ~t~, which makes the HTML
12476 exporter insert the preamble. See the variable
12477 ~org-html-preamble-format~ for the format string.
12479 Set ~org-html-preamble~ to a string to override the default format
12480 string. If the string is a function, the HTML exporter expects the
12481 function to return a string upon execution. The HTML exporter inserts
12482 this string in the preamble. The HTML exporter does not insert
12483 a preamble if ~org-html-preamble~ is set ~nil~.
12485 The default value for ~org-html-postamble~ is ~auto~, which makes the
12486 HTML exporter build a postamble from looking up author's name, email
12487 address, creator's name, and date. Set ~org-html-postamble~ to ~t~ to
12488 insert the postamble in the format specified in the
12489 ~org-html-postamble-format~ variable. The HTML exporter does not
12490 insert a postamble if ~org-html-postamble~ is set to ~nil~.
12492 *** Quoting HTML tags
12494 :DESCRIPTION: Using direct HTML in Org files.
12497 The HTML export back-end transforms =<= and =>= to =<= and =>=.
12499 To include raw HTML code in the Org file so the HTML export back-end
12500 can insert that HTML code in the output, use this inline syntax:
12501 =@@html:...@@=. For example:
12503 : @@html:<b>@@bold text@@html:</b>@@
12505 #+cindex: @samp{HTML}, keyword
12506 #+cindex: @samp{BEGIN_EXPORT html}
12507 For larger raw HTML code blocks, use these HTML export code blocks:
12510 ,#+HTML: Literal HTML code for export
12512 ,#+BEGIN_EXPORT html
12513 All lines between these markers are exported literally
12517 *** Links in HTML export
12519 :DESCRIPTION: Inserting and formatting links.
12521 #+cindex: links, in HTML export
12522 #+cindex: internal links, in HTML export
12523 #+cindex: external links, in HTML export
12525 The HTML export back-end transforms Org's internal links (see
12526 [[*Internal Links]]) to equivalent HTML links in the output. The back-end
12527 similarly handles Org's automatic links created by radio targets (see
12528 [[*Radio Targets]]) similarly. For Org links to external files, the
12529 back-end transforms the links to /relative/ paths.
12531 #+vindex: org-html-link-org-files-as-html
12532 For Org links to other =.org= files, the back-end automatically
12533 changes the file extension to =.html= and makes file paths relative.
12534 If the =.org= files have an equivalent =.html= version at the same
12535 location, then the converted links should work without any further
12536 manual intervention. However, to disable this automatic path
12537 translation, set ~org-html-link-org-files-as-html~ to ~nil~. When
12538 disabled, the HTML export back-end substitutes the ID-based links in
12539 the HTML output. For more about linking files when publishing to
12540 a directory, see [[*Publishing links]].
12542 Org files can also have special directives to the HTML export
12543 back-end. For example, by using =#+ATTR_HTML= lines to specify new
12544 format attributes to ~<a>~ or ~<img>~ tags. This example shows
12545 changing the link's title and style:
12547 #+cindex: @samp{ATTR_HTML}, keyword
12549 ,#+ATTR_HTML: :title The Org mode homepage :style color:red;
12550 [[https://orgmode.org]]
12553 *** Tables in HTML export
12555 :DESCRIPTION: How to modify the formatting of tables.
12557 #+cindex: tables, in HTML
12558 #+vindex: org-export-html-table-tag
12560 The HTML export back-end uses ~org-html-table-default-attributes~ when
12561 exporting Org tables to HTML. By default, the exporter does not draw
12562 frames and cell borders. To change for this for a table, use the
12563 following lines before the table in the Org file:
12565 #+cindex: @samp{CAPTION}, keyword
12566 #+cindex: @samp{ATTR_HTML}, keyword
12568 ,#+CAPTION: This is a table with lines around and between cells
12569 ,#+ATTR_HTML: border="2" rules="all" frame="border"
12572 The HTML export back-end preserves column groupings in Org tables (see
12573 [[*Column Groups]]) when exporting to HTML.
12575 Additional options for customizing tables for HTML export.
12577 - ~org-html-table-align-individual-fields~ ::
12579 #+vindex: org-html-table-align-individual-fields
12580 Non-~nil~ attaches style attributes for alignment to each table
12583 - ~org-html-table-caption-above~ ::
12585 #+vindex: org-html-table-caption-above
12586 Non-~nil~ places caption string at the beginning of the table.
12588 - ~org-html-table-data-tags~ ::
12590 #+vindex: org-html-table-data-tags
12591 Opening and ending tags for table data fields.
12593 - ~org-html-table-default-attributes~ ::
12595 #+vindex: org-html-table-default-attributes
12596 Default attributes and values for table tags.
12598 - ~org-html-table-header-tags~ ::
12600 #+vindex: org-html-table-header-tags
12601 Opening and ending tags for table's header fields.
12603 - ~org-html-table-row-tags~ ::
12605 #+vindex: org-html-table-row-tags
12606 Opening and ending tags for table rows.
12608 - ~org-html-table-use-header-tags-for-first-column~ ::
12610 #+vindex: org-html-table-use-header-tags-for-first-column
12611 Non-~nil~ formats column one in tables with header tags.
12613 *** Images in HTML export
12615 :DESCRIPTION: How to insert figures into HTML output.
12617 #+cindex: images, inline in HTML
12618 #+cindex: inlining images in HTML
12620 The HTML export back-end has features to convert Org image links to
12621 HTML inline images and HTML clickable image links.
12623 #+vindex: org-html-inline-images
12624 When the link in the Org file has no description, the HTML export
12625 back-end by default in-lines that image. For example:
12626 =[[file:myimg.jpg]]= is in-lined, while =[[file:myimg.jpg][the image]]= links to the text,
12627 =the image=. For more details, see the variable
12628 ~org-html-inline-images~.
12630 On the other hand, if the description part of the Org link is itself
12631 another link, such as =file:= or =http:= URL pointing to an image, the
12632 HTML export back-end in-lines this image and links to the main image.
12633 This Org syntax enables the back-end to link low-resolution thumbnail
12634 to the high-resolution version of the image, as shown in this example:
12636 : [[file:highres.jpg][file:thumb.jpg]]
12638 To change attributes of in-lined images, use =#+ATTR_HTML= lines in
12639 the Org file. This example shows realignment to right, and adds ~alt~
12640 and ~title~ attributes in support of text viewers and modern web
12641 accessibility standards.
12643 #+cindex: @samp{CAPTION}, keyword
12644 #+cindex: @samp{ATTR_HTML}, keyword
12646 ,#+CAPTION: A black cat stalking a spider
12647 ,#+ATTR_HTML: :alt cat/spider image :title Action! :align right
12651 #+texinfo: @noindent
12652 The HTML export back-end copies the =http= links from the Org file as
12655 *** Math formatting in HTML export
12657 :DESCRIPTION: Beautiful math also on the web.
12662 #+cindex: ImageMagick
12664 #+vindex: org-html-mathjax-options~
12665 LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two
12666 different ways on HTML pages. The default is to use the [[http://www.mathjax.org][MathJax]],
12667 which should work out of the box with Org[fn:124][fn:125]. Some MathJax
12668 display options can be configured via ~org-html-mathjax-options~, or
12669 in the buffer. For example, with the following settings,
12672 ,#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
12673 ,#+HTML_MATHJAX: cancel.js noErrors.js
12676 #+texinfo: @noindent
12677 equation labels are displayed on the left margin and equations are
12678 five em from the left margin. In addition, it loads the two MathJax
12679 extensions =cancel.js= and =noErrors.js=[fn:126].
12681 #+vindex: org-html-mathjax-template
12682 See the docstring of ~org-html-mathjax-options~ for all supported
12683 variables. The MathJax template can be configure via
12684 ~org-html-mathjax-template~.
12686 If you prefer, you can also request that LaTeX fragments are processed
12687 into small images that will be inserted into the browser page. Before
12688 the availability of MathJax, this was the default method for Org
12689 files. This method requires that the dvipng program, dvisvgm or
12690 ImageMagick suite is available on your system. You can still get this
12693 : #+OPTIONS: tex:dvipng
12695 : #+OPTIONS: tex:dvisvgm
12697 #+texinfo: @noindent
12700 : #+OPTIONS: tex:imagemagick
12702 *** Text areas in HTML export
12704 :DESCRIPTION: An alternate way to show an example.
12707 #+cindex: text areas, in HTML
12708 Before Org mode's Babel, one popular approach to publishing code in
12709 HTML was by using =:textarea=. The advantage of this approach was
12710 that copying and pasting was built into browsers with simple
12711 JavaScript commands. Even editing before pasting was made simple.
12713 The HTML export back-end can create such text areas. It requires an
12714 =#+ATTR_HTML= line as shown in the example below with the =:textarea=
12715 option. This must be followed by either an example or a source code
12716 block. Other Org block types do not honor the =:textarea= option.
12718 By default, the HTML export back-end creates a text area 80 characters
12719 wide and height just enough to fit the content. Override these
12720 defaults with =:width= and =:height= options on the =#+ATTR_HTML=
12724 ,#+ATTR_HTML: :textarea t :width 40
12726 (defun org-xor (a b)
12734 :DESCRIPTION: Changing the appearance of the output.
12736 #+cindex: CSS, for HTML export
12737 #+cindex: HTML export, CSS
12739 #+vindex: org-export-html-todo-kwd-class-prefix
12740 #+vindex: org-export-html-tag-class-prefix
12741 You can modify the CSS style definitions for the exported file. The
12742 HTML exporter assigns the following special CSS classes[fn:127] to
12743 appropriate parts of the document---your style specifications may
12744 change these, in addition to any of the standard classes like for
12745 headlines, tables, etc.
12747 | ~p.author~ | author information, including email |
12748 | ~p.date~ | publishing date |
12749 | ~p.creator~ | creator info, about org mode version |
12750 | ~.title~ | document title |
12751 | ~.subtitle~ | document subtitle |
12752 | ~.todo~ | TODO keywords, all not-done states |
12753 | ~.done~ | the DONE keywords, all states that count as done |
12754 | ~.WAITING~ | each TODO keyword also uses a class named after itself |
12755 | ~.timestamp~ | timestamp |
12756 | ~.timestamp-kwd~ | keyword associated with a timestamp, like =SCHEDULED= |
12757 | ~.timestamp-wrapper~ | span around keyword plus timestamp |
12758 | ~.tag~ | tag in a headline |
12759 | ~._HOME~ | each tag uses itself as a class, "@" replaced by "_" |
12760 | ~.target~ | target for links |
12761 | ~.linenr~ | the line number in a code example |
12762 | ~.code-highlighted~ | for highlighting referenced code lines |
12763 | ~div.outline-N~ | div for outline level N (headline plus text) |
12764 | ~div.outline-text-N~ | extra div for text at outline level N |
12765 | ~.section-number-N~ | section number in headlines, different for each level |
12766 | ~.figure-number~ | label like "Figure 1:" |
12767 | ~.table-number~ | label like "Table 1:" |
12768 | ~.listing-number~ | label like "Listing 1:" |
12769 | ~div.figure~ | how to format an in-lined image |
12770 | ~pre.src~ | formatted source code |
12771 | ~pre.example~ | normal example |
12772 | ~p.verse~ | verse paragraph |
12773 | ~div.footnotes~ | footnote section headline |
12774 | ~p.footnote~ | footnote definition paragraph, containing a footnote |
12775 | ~.footref~ | a footnote reference number (always a <sup>) |
12776 | ~.footnum~ | footnote number in footnote definition (always <sup>) |
12777 | ~.org-svg~ | default class for a linked =.svg= image |
12779 #+vindex: org-html-style-default
12780 #+vindex: org-html-head
12781 #+vindex: org-html-head-extra
12782 #+cindex: @samp{HTML_INCLUDE_STYLE}, keyword
12783 The HTML export back-end includes a compact default style in each
12784 exported HTML file. To override the default style with another style,
12785 use these keywords in the Org file. They will replace the global
12786 defaults the HTML exporter uses.
12788 #+cindex: @samp{HTML_HEAD}, keyword
12789 #+cindex: @samp{HTML_HEAD_EXTRA}, keyword
12791 ,#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
12792 ,#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
12795 #+vindex: org-html-head-include-default-style
12796 To just turn off the default style, customize
12797 ~org-html-head-include-default-style~ variable, or use this option
12798 line in the Org file.
12800 #+cindex: @samp{html-style}, @samp{OPTIONS} item
12801 : #+OPTIONS: html-style:nil
12803 For longer style definitions, either use several =HTML_HEAD= and
12804 =HTML_HEAD_EXTRA= keywords, or use ~<style> ... </style>~ blocks
12805 around them. Both of these approaches can avoid referring to an
12808 #+cindex: @samp{HTML_CONTAINER_CLASS}, property
12809 In order to add styles to a sub-tree, use the =HTML_CONTAINER_CLASS=
12810 property to assign a class to the tree. In order to specify CSS
12811 styles for a particular headline, you can use the ID specified in
12812 a =CUSTOM_ID= property.
12814 Never change the ~org-html-style-default~ constant. Instead use other
12815 simpler ways of customizing as described above.
12817 *** JavaScript supported display of web pages
12819 :DESCRIPTION: Info and folding in a web browser.
12820 :ALT_TITLE: JavaScript support
12823 Sebastian Rose has written a JavaScript program especially designed to
12824 enhance the web viewing experience of HTML files created with Org.
12825 This program enhances large files in two different ways of viewing.
12826 One is an /Info/-like mode where each section is displayed separately
12827 and navigation can be done with the {{{kbd(n)}}} and {{{kbd(p)}}}
12828 keys, and some other keys as well, press {{{kbd(?)}}} for an overview
12829 of the available keys. The second one has a /folding/ view, much like
12830 Org provides inside Emacs. The script is available at
12831 https://orgmode.org/org-info.js and the documentation at
12832 https://orgmode.org/worg/code/org-info-js/. The script is hosted on
12833 https://orgmode.org, but for reliability, prefer installing it on your
12836 To use this program, just add this line to the Org file:
12838 #+cindex: @samp{INFOJS_OPT}, keyword
12839 : #+INFOJS_OPT: view:info toc:nil
12841 #+texinfo: @noindent
12842 The HTML header now has the code needed to automatically invoke the
12843 script. For setting options, use the syntax from the above line for
12844 options described below:
12848 The path to the script. The default is to grab the script from
12849 [[https://orgmode.org/org-info.js]], but you might want to have
12850 a local copy and use a path like =../scripts/org-info.js=.
12854 Initial view when the website is first shown. Possible values are:
12856 | =info= | Info-like interface with one section per page |
12857 | =overview= | Folding interface, initially showing only top-level |
12858 | =content= | Folding interface, starting with all headlines visible |
12859 | =showall= | Folding interface, all headlines and text visible |
12863 Maximum headline level still considered as an independent section
12864 for info and folding modes. The default is taken from
12865 ~org-export-headline-levels~, i.e., the =H= switch in =OPTIONS=.
12866 If this is smaller than in ~org-export-headline-levels~, each
12867 info/folding section can still contain child headlines.
12871 Should the table of contents /initially/ be visible? Even when
12872 =nil=, you can always get to the "toc" with {{{kbd(i)}}}.
12876 The depth of the table of contents. The defaults are taken from
12877 the variables ~org-export-headline-levels~ and
12878 ~org-export-with-toc~.
12882 Does the CSS of the page specify a fixed position for the "toc"?
12883 If yes, the toc is displayed as a section.
12887 Should there be short contents (children) in each section? Make
12888 this =above= if the section should be above initial text.
12892 Headings are highlighted when the mouse is over them. Should be
12893 =underline= (default) or a background color like =#cccccc=.
12897 Should view-toggle buttons be everywhere? When =nil= (the
12898 default), only one such button is present.
12900 #+texinfo: @noindent
12901 #+vindex: org-infojs-options
12902 #+vindex: org-export-html-use-infojs
12903 You can choose default values for these options by customizing the
12904 variable ~org-infojs-options~. If you always want to apply the script
12905 to your pages, configure the variable ~org-export-html-use-infojs~.
12909 :DESCRIPTION: Exporting to @LaTeX{} and processing to PDF.
12911 #+cindex: @LaTeX{} export
12912 #+cindex: PDF export
12914 The LaTeX export back-end can handle complex documents, incorporate
12915 standard or custom LaTeX document classes, generate documents using
12916 alternate LaTeX engines, and produce fully linked PDF files with
12917 indexes, bibliographies, and tables of contents, destined for
12918 interactive online viewing or high-quality print publication.
12920 While the details are covered in-depth in this section, here are some
12921 quick references to variables for the impatient: for engines, see
12922 ~org-latex-compiler~; for build sequences, see
12923 ~org-latex-pdf-process~; for packages, see
12924 ~org-latex-default-packages-alist~ and ~org-latex-packages-alist~.
12926 An important note about the LaTeX export back-end: it is sensitive to
12927 blank lines in the Org document. That's because LaTeX itself depends
12928 on blank lines to tell apart syntactical elements, such as paragraphs.
12930 *** LaTeX/PDF export commands
12932 :DESCRIPTION: For producing @LaTeX{} and PDF documents.
12935 - {{{kbd(C-c C-e l l)}}} (~org-latex-export-to-latex~) ::
12937 #+kindex: C-c C-e l l
12938 #+findex: org-latex-export-to-latex~
12939 Export to a LaTeX file with a =.tex= extension. For
12940 =myfile.org=, Org exports to =myfile.tex=, overwriting without
12943 - {{{kbd(C-c C-e l L)}}} (~org-latex-export-as-latex~) ::
12945 #+kindex: C-c C-e l L
12946 #+findex: org-latex-export-as-latex
12947 Export to a temporary buffer. Do not create a file.
12949 - {{{kbd(C-c C-e l p)}}} (~org-latex-export-to-pdf~) ::
12951 #+kindex: C-c C-e l p
12952 #+findex: org-latex-export-to-pdf
12953 Export as LaTeX file and convert it to PDF file.
12955 - {{{kbd(C-c C-e l o)}}} ::
12957 #+kindex: C-c C-e l o
12958 Export as LaTeX file and convert it to PDF, then open the PDF
12959 using the default viewer.
12961 - {{{kbd(M-x org-export-region-as-latex)}}} ::
12963 Convert the region to LaTeX under the assumption that it was in Org
12964 mode syntax before. This is a global command that can be invoked in
12967 #+vindex: org-latex-compiler
12968 #+vindex: org-latex-bibtex-compiler
12969 #+vindex: org-latex-default-packages-alist
12973 #+cindex: @samp{LATEX_COMPILER}, keyword
12974 The LaTeX export back-end can use any of these LaTeX engines:
12975 =pdflatex=, =xelatex=, and =lualatex=. These engines compile LaTeX
12976 files with different compilers, packages, and output options. The
12977 LaTeX export back-end finds the compiler version to use from
12978 ~org-latex-compiler~ variable or the =#+LATEX_COMPILER= keyword in the
12979 Org file. See the docstring for the
12980 ~org-latex-default-packages-alist~ for loading packages with certain
12981 compilers. Also see ~org-latex-bibtex-compiler~ to set the
12982 bibliography compiler[fn:128].
12984 *** LaTeX specific export settings
12986 :DESCRIPTION: Unique to this @LaTeX{} back-end.
12989 The LaTeX export back-end has several additional keywords for
12990 customizing LaTeX output. Setting these keywords works similar to the
12991 general options (see [[*Export Settings]]).
12993 #+attr_texinfo: :sep ,
12995 #+cindex: @samp{DESCRIPTION}, keyword
12996 #+vindex: org-latex-hyperref-template
12997 #+vindex: org-latex-title-command
12998 The document's description. The description along with author
12999 name, keywords, and related file metadata are inserted in the
13000 output file by the hyperref package. See
13001 ~org-latex-hyperref-template~ for customizing metadata items.
13002 See ~org-latex-title-command~ for typesetting description into
13003 the document's front matter. Use multiple =DESCRIPTION= keywords
13004 for long descriptions.
13008 #+cindex: @samp{LATEX_CLASS}, keyword
13009 #+vindex: org-latex-default-class
13010 #+vindex: org-latex-classes
13011 This is LaTeX document class, such as /article/, /report/,
13012 /book/, and so on, which contain predefined preamble and headline
13013 level mapping that the LaTeX export back-end needs. The back-end
13014 reads the default class name from the ~org-latex-default-class~
13015 variable. Org has /article/ as the default class. A valid
13016 default class must be an element of ~org-latex-classes~.
13018 - =LATEX_CLASS_OPTIONS= ::
13020 #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword
13021 Options the LaTeX export back-end uses when calling the LaTeX
13024 - =LATEX_COMPILER= ::
13026 #+cindex: @samp{LATEX_COMPILER}, keyword
13027 #+vindex: org-latex-compiler
13028 The compiler, such as =pdflatex=, =xelatex=, =lualatex=, for
13029 producing the PDF. See ~org-latex-compiler~.
13031 - =LATEX_HEADER=, =LATEX_HEADER_EXTRA= ::
13033 #+cindex: @samp{LATEX_HEADER}, keyword
13034 #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword
13035 #+vindex: org-latex-classes
13036 Arbitrary lines to add to the document's preamble, before the
13037 hyperref settings. See ~org-latex-classes~ for adjusting the
13038 structure and order of the LaTeX headers.
13042 #+cindex: @samp{KEYWORDS}, keyword
13043 #+vindex: org-latex-hyperref-template
13044 #+vindex: org-latex-title-command
13045 The keywords for the document. The description along with author
13046 name, keywords, and related file metadata are inserted in the
13047 output file by the hyperref package. See
13048 ~org-latex-hyperref-template~ for customizing metadata items.
13049 See ~org-latex-title-command~ for typesetting description into
13050 the document's front matter. Use multiple =KEYWORDS= lines if
13055 #+cindex: @samp{SUBTITLE}, keyword
13056 #+vindex: org-latex-subtitle-separate
13057 #+vindex: org-latex-subtitle-format
13058 The document's subtitle. It is typeset as per
13059 ~org-latex-subtitle-format~. If ~org-latex-subtitle-separate~ is
13060 non-~nil~, it is typed as part of the ~\title~ macro. See
13061 ~org-latex-hyperref-template~ for customizing metadata items.
13062 See ~org-latex-title-command~ for typesetting description
13063 into the document's front matter.
13065 The following sections have further details.
13067 *** LaTeX header and sectioning structure
13069 :DESCRIPTION: Setting up the export file structure.
13070 :ALT_TITLE: LaTeX header and sectioning
13072 #+cindex: @LaTeX{} class
13073 #+cindex: @LaTeX{} sectioning structure
13074 #+cindex: @LaTeX{} header
13075 #+cindex: header, for @LaTeX{} files
13076 #+cindex: sectioning structure, for @LaTeX{} export
13078 The LaTeX export back-end converts the first three of Org's outline
13079 levels into LaTeX headlines. The remaining Org levels are exported as
13080 lists. To change this globally for the cut-off point between levels
13081 and lists, (see [[*Export Settings]]).
13083 By default, the LaTeX export back-end uses the /article/ class.
13085 #+vindex: org-latex-default-class
13086 #+vindex: org-latex-classes
13087 #+vindex: org-latex-default-packages-alist
13088 #+vindex: org-latex-packages-alist
13089 To change the default class globally, edit ~org-latex-default-class~.
13090 To change the default class locally in an Org file, add option lines
13091 =#+LATEX_CLASS: myclass=. To change the default class for just a part
13092 of the Org file, set a sub-tree property, =EXPORT_LATEX_CLASS=. The
13093 class name entered here must be valid member of ~org-latex-classes~.
13094 This variable defines a header template for each class into which the
13095 exporter splices the values of ~org-latex-default-packages-alist~ and
13096 ~org-latex-packages-alist~. Use the same three variables to define
13097 custom sectioning or custom classes.
13099 #+cindex: @samp{LATEX_CLASS}, keyword
13100 #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword
13101 #+cindex: @samp{EXPORT_LATEX_CLASS}, property
13102 #+cindex: @samp{EXPORT_LATEX_CLASS_OPTIONS}, property
13103 The LaTeX export back-end sends the =LATEX_CLASS_OPTIONS= keyword and
13104 =EXPORT_LATEX_CLASS_OPTIONS= property as options to the LaTeX
13105 ~\documentclass~ macro. The options and the syntax for specifying
13106 them, including enclosing them in square brackets, follow LaTeX
13109 : #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
13111 #+cindex: @samp{LATEX_HEADER}, keyword
13112 #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword
13113 The LaTeX export back-end appends values from =LATEX_HEADER= and
13114 =LATEX_HEADER_EXTRA= keywords to the LaTeX header. The docstring for
13115 ~org-latex-classes~ explains in more detail. Also note that LaTeX
13116 export back-end does not append =LATEX_HEADER_EXTRA= to the header
13117 when previewing LaTeX snippets (see [[*Previewing LaTeX fragments]]).
13119 A sample Org file with the above headers:
13122 ,#+LATEX_CLASS: article
13123 ,#+LATEX_CLASS_OPTIONS: [a4paper]
13124 ,#+LATEX_HEADER: \usepackage{xyz}
13132 *** Quoting LaTeX code
13134 :DESCRIPTION: Incorporating literal @LaTeX{} code.
13137 The LaTeX export back-end can insert any arbitrary LaTeX code, see
13138 [[*Embedded LaTeX]]. There are three ways to embed such code in the Org
13139 file and they all use different quoting syntax.
13141 #+cindex: inline, in @LaTeX{} export
13142 Inserting in-line quoted with @ symbols:
13144 : Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph.
13146 #+cindex: @samp{LATEX}, keyword
13147 Inserting as one or more keyword lines in the Org file:
13149 : #+LATEX: any arbitrary LaTeX code
13151 #+cindex: @samp{BEGIN_EXPORT latex}
13152 Inserting as an export block in the Org file, where the back-end
13153 exports any code between begin and end markers:
13156 ,#+BEGIN_EXPORT latex
13157 any arbitrary LaTeX code
13161 *** Tables in LaTeX export
13163 :DESCRIPTION: Options for exporting tables to @LaTeX{}.
13165 #+cindex: tables, in @LaTeX{} export
13167 The LaTeX export back-end can pass several LaTeX attributes for table
13168 contents and layout. Besides specifying a label (see [[*Internal Links]])
13169 and a caption (see [[*Captions]]), the other valid LaTeX attributes
13172 #+attr_texinfo: :sep ,
13175 #+vindex: org-latex-default-table-mode
13176 The LaTeX export back-end wraps the table differently depending
13177 on the mode for accurate rendering of math symbols. Mode is
13178 either =table=, =math=, =inline-math= or =verbatim=.
13180 For =math= or =inline-math= mode, LaTeX export back-end wraps the
13181 table in a math environment, but every cell in it is exported
13182 as-is. The LaTeX export back-end determines the default mode
13183 from ~org-latex-default-table-mode~. The LaTeX export back-end
13184 merges contiguous tables in the same mode into a single
13187 - =:environment= ::
13189 #+vindex: org-latex-default-table-environment
13190 Set the default LaTeX table environment for the LaTeX export
13191 back-end to use when exporting Org tables. Common LaTeX table
13192 environments are provided by these packages: tabularx, longtable,
13193 array, tabu, and bmatrix. For packages, such as tabularx and
13194 tabu, or any newer replacements, include them in the
13195 ~org-latex-packages-alist~ variable so the LaTeX export back-end
13196 can insert the appropriate load package headers in the converted
13197 LaTeX file. Look in the docstring for the
13198 ~org-latex-packages-alist~ variable for configuring these
13199 packages for LaTeX snippet previews, if any.
13203 Use =CAPTION= keyword to set a simple caption for a table (see
13204 [[*Captions]]). For custom captions, use =:caption= attribute, which
13205 accepts raw LaTeX code. =:caption= value overrides =CAPTION=
13208 - =:float=, =:placement= ::
13210 The table environments by default are not floats in LaTeX. To
13211 make them floating objects use =:float= with one of the following
13212 options: =sideways=, =multicolumn=, =t=, and =nil=.
13214 LaTeX floats can also have additional layout =:placement=
13215 attributes. These are the usual =[h t b p ! H]= permissions
13216 specified in square brackets. Note that for =:float sideways=
13217 tables, the LaTeX export back-end ignores =:placement=
13220 - =:align=, =:font=, =:width= ::
13222 The LaTeX export back-end uses these attributes for regular
13223 tables to set their alignments, fonts, and widths.
13227 When =:spread= is non-~nil~, the LaTeX export back-end spreads or
13228 shrinks the table by the =:width= for tabu and longtabu
13229 environments. =:spread= has no effect if =:width= is not set.
13231 - =:booktabs=, =:center=, =:rmlines= ::
13233 #+vindex: org-latex-tables-booktabs
13234 #+vindex: org-latex-tables-centered
13235 All three commands are toggles. =:booktabs= brings in modern
13236 typesetting enhancements to regular tables. The booktabs package
13237 has to be loaded through ~org-latex-packages-alist~. =:center=
13238 is for centering the table. =:rmlines= removes all but the very
13239 first horizontal line made of ASCII characters from "table.el"
13242 - =:math-prefix=, =:math-suffix=, =:math-arguments= ::
13244 The LaTeX export back-end inserts =:math-prefix= string value in
13245 a math environment before the table. The LaTeX export back-end
13246 inserts =:math-suffix= string value in a math environment after
13247 the table. The LaTeX export back-end inserts =:math-arguments=
13248 string value between the macro name and the table's contents.
13249 =:math-arguments= comes in use for matrix macros that require
13250 more than one argument, such as =qbordermatrix=.
13252 LaTeX table attributes help formatting tables for a wide range of
13253 situations, such as matrix product or spanning multiple pages:
13256 ,#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
13260 ,#+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
13263 ,#+ATTR_LATEX: :mode math :environment bmatrix
13268 Set the caption with the LaTeX command
13269 =\bicaption{HeadingA}{HeadingB}=:
13272 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
13277 *** Images in LaTeX export
13279 :DESCRIPTION: How to insert figures into @LaTeX{} output.
13281 #+cindex: images, inline in LaTeX
13282 #+cindex: inlining images in LaTeX
13283 #+cindex: @samp{ATTR_LATEX}, keyword
13285 The LaTeX export back-end processes image links in Org files that do
13286 not have descriptions, such as these links =[[file:img.jpg]]= or
13287 =[[./img.jpg]]=, as direct image insertions in the final PDF output. In
13288 the PDF, they are no longer links but actual images embedded on the
13289 page. The LaTeX export back-end uses =\includegraphics= macro to
13290 insert the image. But for TikZ (http://sourceforge.net/projects/pgf/)
13291 images, the back-end uses an ~\input~ macro wrapped within
13292 a ~tikzpicture~ environment.
13294 For specifying image =:width=, =:height=, and other =:options=, use
13298 ,#+ATTR_LATEX: :width 5cm :options angle=90
13299 [[./img/sed-hr4049.pdf]]
13302 For custom commands for captions, use the =:caption= attribute. It
13303 overrides the default =#+CAPTION= value:
13306 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
13307 [[./img/sed-hr4049.pdf]]
13310 When captions follow the method as described in [[*Captions]], the LaTeX
13311 export back-end wraps the picture in a floating =figure= environment.
13312 To float an image without specifying a caption, set the =:float=
13313 attribute to one of the following:
13317 For a standard =figure= environment; used by default whenever an
13318 image has a caption.
13322 To span the image across multiple columns of a page; the back-end
13323 wraps the image in a =figure*= environment.
13327 For text to flow around the image on the right; the figure
13328 occupies the left half of the page.
13332 For a new page with the image sideways, rotated ninety degrees,
13333 in a =sidewaysfigure= environment; overrides =:placement=
13338 To avoid a =:float= even if using a caption.
13340 #+texinfo: @noindent
13341 Use the =placement= attribute to modify a floating environment's
13345 ,#+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement {r}{0.4\textwidth}
13349 #+vindex: org-latex-images-centered
13350 #+cindex: center image in LaTeX export
13351 #+cindex: image, centering in LaTeX export
13352 The LaTeX export back-end centers all images by default. Setting
13353 =:center= to =nil= disables centering. To disable centering globally,
13354 set ~org-latex-images-centered~ to =t=.
13356 Set the =:comment-include= attribute to non-~nil~ value for the LaTeX
13357 export back-end to comment out the =\includegraphics= macro.
13359 *** Plain lists in LaTeX export
13361 :DESCRIPTION: Attributes specific to lists.
13364 #+cindex: plain lists, in @LaTeX{} export
13365 #+cindex: @samp{ATTR_LATEX}, keyword
13366 The LaTeX export back-end accepts the =environment= and =options=
13367 attributes for plain lists. Both attributes work together for
13368 customizing lists, as shown in the examples:
13371 ,#+LATEX_HEADER: \usepackage[inline]{enumitem}
13372 Some ways to say "Hello":
13373 ,#+ATTR_LATEX: :environment itemize*
13374 ,#+ATTR_LATEX: :options [label={}, itemjoin={,}, itemjoin*={, and}]
13380 Since LaTeX supports only four levels of nesting for lists, use an
13381 external package, such as =enumitem= in LaTeX, for levels deeper than
13385 ,#+LATEX_HEADER: \usepackage{enumitem}
13386 ,#+LATEX_HEADER: \renewlist{itemize}{itemize}{9}
13387 ,#+LATEX_HEADER: \setlist[itemize]{label=$\circ$}
13395 *** Source blocks in LaTeX export
13397 :DESCRIPTION: Attributes specific to source code blocks.
13399 #+cindex: source blocks, in @LaTeX{} export
13400 #+cindex: @samp{ATTR_LATEX}, keyword
13402 The LaTeX export back-end can make source code blocks into floating
13403 objects through the attributes =:float= and =:options=. For =:float=:
13407 Makes a source block float; by default floats any source block
13412 Spans the source block across multiple columns of a page.
13416 Avoids a =:float= even if using a caption; useful for source code
13417 blocks that may not fit on a page.
13420 ,#+ATTR_LATEX: :float nil
13421 ,#+BEGIN_SRC emacs-lisp
13422 Lisp code that may not fit in a single page.
13426 #+vindex: org-latex-listings-options
13427 #+vindex: org-latex-minted-options
13428 The LaTeX export back-end passes string values in =:options= to LaTeX
13429 packages for customization of that specific source block. In the
13430 example below, the =:options= are set for Minted. Minted is a source
13431 code highlighting LaTeX package with many configurable options.
13434 ,#+ATTR_LATEX: :options commentstyle=\bfseries
13435 ,#+BEGIN_SRC emacs-lisp
13437 (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
13441 To apply similar configuration options for all source blocks in
13442 a file, use the ~org-latex-listings-options~ and
13443 ~org-latex-minted-options~ variables.
13445 *** Example blocks in LaTeX export
13447 :DESCRIPTION: Attributes specific to example blocks.
13449 #+cindex: example blocks, in @LaTeX{} export
13450 #+cindex: verbatim blocks, in @LaTeX{} export
13451 #+cindex: @samp{ATTR_LATEX}, keyword
13453 The LaTeX export back-end wraps the contents of example blocks in
13454 a =verbatim= environment. To change this behavior to use another
13455 environment globally, specify an appropriate export filter (see
13456 [[*Advanced Export Configuration]]). To change this behavior to use
13457 another environment for each block, use the =:environment= parameter
13458 to specify a custom environment.
13461 ,#+ATTR_LATEX: :environment myverbatim
13463 This sentence is false.
13467 *** Special blocks in LaTeX export
13469 :DESCRIPTION: Attributes specific to special blocks.
13472 #+cindex: special blocks, in @LaTeX{} export
13473 #+cindex: abstract, in @LaTeX{} export
13474 #+cindex: proof, in @LaTeX{} export
13475 #+cindex: @samp{ATTR_LATEX}, keyword
13477 For other special blocks in the Org file, the LaTeX export back-end
13478 makes a special environment of the same name. The back-end also takes
13479 =:options=, if any, and appends as-is to that environment's opening
13480 string. For example:
13484 We demonstrate how to solve the Syracuse problem.
13487 ,#+ATTR_LATEX: :options [Proof of important theorem]
13490 Therefore, any even number greater than 2 is the sum of two primes.
13494 #+texinfo: @noindent
13499 We demonstrate how to solve the Syracuse problem.
13502 \begin{proof}[Proof of important theorem]
13504 Therefore, any even number greater than 2 is the sum of two primes.
13508 If you need to insert a specific caption command, use =:caption=
13509 attribute. It overrides standard =CAPTION= value, if any. For
13513 ,#+ATTR_LATEX: :caption \MyCaption{HeadingA}
13519 *** Horizontal rules in LaTeX export
13521 :DESCRIPTION: Attributes specific to horizontal rules.
13523 #+cindex: horizontal rules, in @LaTeX{} export
13524 #+cindex: @samp{ATTR_LATEX}, keyword
13526 The LaTeX export back-end converts horizontal rules by the specified
13527 =:width= and =:thickness= attributes. For example:
13530 ,#+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
13536 :DESCRIPTION: Exporting to Markdown.
13538 #+cindex: Markdown export
13540 The Markdown export back-end, "md", converts an Org file to Markdown
13541 format, as defined at http://daringfireball.net/projects/markdown/.
13543 Since it is built on top of the HTML back-end (see [[*HTML Export]]), it
13544 converts every Org construct not defined in Markdown syntax, such as
13547 *** Markdown export commands
13552 - {{{kbd(C-c C-e m m)}}} (~org-md-export-to-markdown~) ::
13554 #+kindex: C-c C-c m m
13555 #+findex: org-md-export-to-markdown
13556 Export to a text file with Markdown syntax. For =myfile.org=,
13557 Org exports to =myfile.md=, overwritten without warning.
13559 - {{{kbd(C-c C-e m M)}}} (~org-md-export-as-markdown~) ::
13561 #+kindex: C-c C-c m M
13562 #+findex: org-md-export-as-markdown
13563 Export to a temporary buffer. Does not create a file.
13565 - {{{kbd(C-c C-e m o)}}} ::
13567 #+kindex: C-c C-e m o
13568 Export as a text file with Markdown syntax, then open it.
13570 *** Header and sectioning structure
13575 #+vindex: org-md-headline-style
13576 Based on ~org-md-headline-style~, Markdown export can generate
13577 headlines of both /atx/ and /setext/ types. /atx/ limits headline
13578 levels to two whereas /setext/ limits headline levels to six. Beyond
13579 these limits, the export back-end converts headlines to lists. To set
13580 a limit to a level before the absolute limit (see [[*Export Settings]]).
13582 ** OpenDocument Text Export
13584 :DESCRIPTION: Exporting to OpenDocument Text.
13587 #+cindex: OpenDocument
13588 #+cindex: export, OpenDocument
13589 #+cindex: LibreOffice
13591 The ODT export back-end handles creating of OpenDocument Text (ODT)
13592 format. Documents created by this exporter use the
13593 {{{cite(OpenDocument-v1.2 specification)}}}[fn:129] and are compatible
13594 with LibreOffice 3.4.
13596 *** Pre-requisites for ODT export
13598 :DESCRIPTION: Required packages.
13602 The ODT export back-end relies on the zip program to create the final
13603 compressed ODT output. Check if =zip= is locally available and
13604 executable. Without it, export cannot finish.
13606 *** ODT export commands
13608 :DESCRIPTION: Invoking export.
13611 - {{{kbd(C-c C-e o o)}}} (~org-export-to-odt~) ::
13613 #+kindex: C-c C-e o o
13614 #+findex: org-export-to-odt
13615 Export as OpenDocument Text file.
13617 #+cindex: @samp{EXPORT_FILE_NAME}, property
13618 #+vindex: org-odt-preferred-output-format
13620 If ~org-odt-preferred-output-format~ is specified, the ODT export
13621 back-end automatically converts the exported file to that format.
13623 For =myfile.org=, Org exports to =myfile.odt=, overwriting
13624 without warning. The ODT export back-end exports a region only
13625 if a region was active.
13627 If the selected region is a single tree, the ODT export back-end
13628 makes the tree head the document title. Incidentally, {{{kbd(C-c
13629 @)}}} selects the current sub-tree. If the tree head entry has,
13630 or inherits, an =EXPORT_FILE_NAME= property, the ODT export
13631 back-end uses that for file name.
13633 - {{{kbd(C-c C-e o O)}}} ::
13635 #+kindex: C-c C-e o O
13636 Export as an OpenDocument Text file and open the resulting file.
13638 #+vindex: org-export-odt-preferred-output-format
13639 If ~org-export-odt-preferred-output-format~ is specified, open
13640 the converted file instead. See [[*Automatically exporting to
13643 *** ODT specific export settings
13645 :DESCRIPTION: Configuration options.
13648 The ODT export back-end has several additional keywords for
13649 customizing ODT output. Setting these keywords works similar to the
13650 general options (see [[*Export Settings]]).
13654 #+cindex: @samp{DESCRIPTION}, keyword
13655 This is the document's description, which the ODT export back-end
13656 inserts as document metadata. For long descriptions, use
13657 multiple lines, prefixed with =DESCRIPTION=.
13661 #+cindex: @samp{KEYWORDS}, keyword
13662 The keywords for the document. The ODT export back-end inserts
13663 the description along with author name, keywords, and related
13664 file metadata as metadata in the output file. Use multiple
13665 =KEYWORDS= if necessary.
13667 - =ODT_STYLES_FILE= ::
13669 #+cindex: @samp{ODT_STYLES_FILE}, keyword
13670 #+vindex: org-odt-styles-file
13671 The ODT export back-end uses the ~org-odt-styles-file~ by
13672 default. See [[*Applying custom styles]] for details.
13676 #+cindex: @samp{SUBTITLE}, keyword
13677 The document subtitle.
13679 *** Extending ODT export
13681 :DESCRIPTION: Producing DOC, PDF files.
13684 The ODT export back-end can produce documents in other formats besides
13685 ODT using a specialized ODT converter process. Its common interface
13686 works with popular converters to produce formats such as =doc=, or
13687 convert a document from one format, say =csv=, to another format, say
13690 #+cindex: @file{unoconv}
13691 #+vindex: org-odt-convert-process
13692 Customize ~org-odt-convert-process~ variable to point to =unoconv=,
13693 which is the ODT's preferred converter. Working installations of
13694 LibreOffice would already have =unoconv= installed. Alternatively,
13695 other converters may be substituted here. See [[*Configuring
13696 a document converter]].
13698 **** Automatically exporting to other formats
13703 #+vindex: org-odt-preferred-output-format
13704 If ODT format is just an intermediate step to get to other formats,
13705 such as =doc=, =docx=, =rtf=, or =pdf=, etc., then extend the ODT
13706 export back-end to directly produce that format. Specify the final
13707 format in the ~org-odt-preferred-output-format~ variable. This is one
13708 way to extend (see [[*ODT export commands]]).
13710 **** Converting between document formats
13715 The Org export back-end is made to be inter-operable with a wide range
13716 of text document format converters. Newer generation converters, such
13717 as LibreOffice and Pandoc, can handle hundreds of formats at once.
13718 Org provides a consistent interaction with whatever converter is
13719 installed. Here are some generic commands:
13721 - {{{kbd(M-x org-odt-convert)}}} ::
13723 #+findex: org-odt-convert
13724 Convert an existing document from one format to another. With
13725 a prefix argument, opens the newly produced file.
13727 *** Applying custom styles
13729 :DESCRIPTION: Styling the output.
13731 #+cindex: styles, custom
13732 #+cindex: template, custom
13734 The ODT export back-end comes with many OpenDocument styles (see
13735 [[*Working with OpenDocument style files]]). To expand or further
13736 customize these built-in style sheets, either edit the style sheets
13737 directly or generate them using an application such as LibreOffice.
13738 The example here shows creating a style using LibreOffice.
13740 **** Applying custom styles: the easy way
13745 1. Create a sample =example.org= file with settings as shown below,
13746 and export it to ODT format.
13748 : #+OPTIONS: H:10 num:t
13750 2. Open the above =example.odt= using LibreOffice. Use the /Stylist/
13751 to locate the target styles, which typically have the "Org" prefix.
13752 Open one, modify, and save as either OpenDocument Text (ODT) or
13753 OpenDocument Template (OTT) file.
13756 #+vindex: org-odt-styles-file
13757 Customize the variable ~org-odt-styles-file~ and point it to the
13758 newly created file. For additional configuration options, see
13759 [[x-overriding-factory-styles][Overriding factory styles]].
13761 #+cindex: @samp{ODT_STYLES_FILE}, keyword
13762 To apply an ODT style to a particular file, use the
13763 =ODT_STYLES_FILE= keyword as shown in the example below:
13765 : #+ODT_STYLES_FILE: "/path/to/example.ott"
13767 #+texinfo: @noindent
13770 : #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
13772 **** Using third-party styles and templates
13777 The ODT export back-end relies on many templates and style names.
13778 Using third-party styles and templates can lead to mismatches.
13779 Templates derived from built in ODT templates and styles seem to have
13782 *** Links in ODT export
13784 :DESCRIPTION: Handling and formatting links.
13786 #+cindex: links, in ODT export
13788 ODT exporter creates native cross-references for internal links. It
13789 creates Internet-style links for all other links.
13791 A link with no description and pointing to a regular, un-itemized,
13792 outline heading is replaced with a cross-reference and section number
13795 A =\ref{label}=-style reference to an image, table etc., is replaced
13796 with a cross-reference and sequence number of the labeled entity. See
13797 [[*Labels and captions in ODT export]].
13799 *** Tables in ODT export
13801 :DESCRIPTION: Org tables conversions.
13804 #+cindex: tables, in ODT export
13806 The ODT export back-end handles native Org mode tables (see [[*Tables]])
13807 and simple =table.el= tables. Complex =table.el= tables having column
13808 or row spans are not supported. Such tables are stripped from the
13811 By default, the ODT export back-end exports a table with top and
13812 bottom frames and with ruled lines separating row and column groups
13813 (see [[*Column Groups]]). All tables are typeset to occupy the same
13814 width. The ODT export back-end honors any table alignments and
13815 relative widths for columns (see [[*Column Width and Alignment]]).
13817 Note that the ODT export back-end interprets column widths as weighted
13818 ratios, the default weight being 1.
13820 #+cindex: @samp{ATTR_ODT}, keyword
13821 Specifying =:rel-width= property on an =ATTR_ODT= line controls the
13822 width of the table. For example:
13825 ,#+ATTR_ODT: :rel-width 50
13826 | Area/Month | Jan | Feb | Mar | Sum |
13827 |---------------+-------+-------+-------+-------|
13829 | <l13> | <r5> | <r5> | <r5> | <r6> |
13830 | North America | 1 | 21 | 926 | 948 |
13831 | Middle East | 6 | 75 | 844 | 925 |
13832 | Asia Pacific | 9 | 27 | 790 | 826 |
13833 |---------------+-------+-------+-------+-------|
13834 | Sum | 16 | 123 | 2560 | 2699 |
13837 On export, the above table takes 50% of text width area. The exporter
13838 sizes the columns in the ratio: 13:5:5:5:6. The first column is
13839 left-aligned and rest of the columns, right-aligned. Vertical rules
13840 separate the header and the last column. Horizontal rules separate
13841 the header and the last row.
13843 For even more customization, create custom table styles and associate
13844 them with a table using the =ATTR_ODT= keyword. See [[*Customizing
13845 tables in ODT export]].
13847 *** Images in ODT export
13849 :DESCRIPTION: Inserting images.
13851 #+cindex: images, embedding in ODT
13852 #+cindex: embedding images in ODT
13854 **** Embedding images
13859 The ODT export back-end processes image links in Org files that do not
13860 have descriptions, such as these links =[[file:img.jpg]]= or =[[./img.jpg]]=,
13861 as direct image insertions in the final output. Either of these
13868 **** Embedding clickable images
13873 For clickable images, provide a link whose description is another link
13874 to an image file. For example, to embed an image
13875 =org-mode-unicorn.png= which when clicked jumps to https://orgmode.org
13876 website, do the following
13878 : [[https://orgmode.org][./org-mode-unicorn.png]]
13880 **** Sizing and scaling of embedded images
13885 #+cindex: @samp{ATTR_ODT}, keyword
13887 Control the size and scale of the embedded images with the =ATTR_ODT=
13890 #+cindex: identify, ImageMagick
13891 #+vindex: org-odt-pixels-per-inch
13892 The ODT export back-end starts with establishing the size of the image
13893 in the final document. The dimensions of this size are measured in
13894 centimeters. The back-end then queries the image file for its
13895 dimensions measured in pixels. For this measurement, the back-end
13896 relies on ImageMagick's identify program or Emacs ~create-image~ and
13897 ~image-size~ API. ImageMagick is the preferred choice for large file
13898 sizes or frequent batch operations. The back-end then converts the
13899 pixel dimensions using ~org-odt-pixels-per-inch~ into the familiar 72
13900 dpi or 96 dpi. The default value for this is in
13901 ~display-pixels-per-inch~, which can be tweaked for better results
13902 based on the capabilities of the output device. Here are some common
13903 image scaling operations:
13905 - Explicitly size the image ::
13907 To embed =img.png= as a 10 cm x 10 cm image, do the following:
13910 ,#+ATTR_ODT: :width 10 :height 10
13914 - Scale the image ::
13916 To embed =img.png= at half its size, do the following:
13919 ,#+ATTR_ODT: :scale 0.5
13923 - Scale the image to a specific width ::
13925 To embed =img.png= with a width of 10 cm while retaining the
13926 original height:width ratio, do the following:
13929 ,#+ATTR_ODT: :width 10
13933 - Scale the image to a specific height ::
13935 To embed =img.png= with a height of 10 cm while retaining the
13936 original height:width ratio, do the following:
13939 ,#+ATTR_ODT: :height 10
13943 **** Anchoring of images
13948 #+cindex: @samp{ATTR_ODT}, keyword
13949 The ODT export back-end can anchor images to =as-char=, =paragraph=,
13950 or =page=. Set the preferred anchor using the =:anchor= property of
13951 the =ATTR_ODT= line.
13953 To create an image that is anchored to a page:
13956 ,#+ATTR_ODT: :anchor page
13960 *** Math formatting in ODT export
13962 :DESCRIPTION: Formatting @LaTeX{} fragments.
13965 The ODT exporter has special support for handling math.
13967 **** LaTeX math snippets
13969 :DESCRIPTION: Embedding in @LaTeX{} format.
13972 LaTeX math snippets (see [[*LaTeX fragments]]) can be embedded in the ODT
13973 document in one of the following ways:
13978 Add this line to the Org file. This option is activated on
13983 With this option, LaTeX fragments are first converted into MathML
13984 fragments using an external LaTeX-to-MathML converter program.
13985 The resulting MathML fragments are then embedded as an
13986 OpenDocument Formula in the exported document.
13988 #+vindex: org-latex-to-mathml-convert-command
13989 #+vindex: org-latex-to-mathml-jar-file
13990 You can specify the LaTeX-to-MathML converter by customizing the
13991 variables ~org-latex-to-mathml-convert-command~ and
13992 ~org-latex-to-mathml-jar-file~.
13994 If you prefer to use MathToWeb[fn:130] as your converter, you can
13995 configure the above variables as shown below.
13997 #+begin_src emacs-lisp
13998 (setq org-latex-to-mathml-convert-command
13999 "java -jar %j -unicode -force -df %o %I"
14000 org-latex-to-mathml-jar-file
14001 "/path/to/mathtoweb.jar")
14004 To use LaTeX​ML[fn:131] use
14006 #+begin_src emacs-lisp
14007 (setq org-latex-to-mathml-convert-command
14008 "latexmlmath \"%i\" --presentationmathml=%o")
14011 To quickly verify the reliability of the LaTeX-to-MathML
14012 converter, use the following commands:
14014 - {{{kbd(M-x org-export-as-odf)}}} ::
14016 Convert a LaTeX math snippet to an OpenDocument formula
14019 - {{{kbd(M-x org-export-as-odf-and-open)}}} ::
14021 Convert a LaTeX math snippet to an OpenDocument formula
14022 (=.odf=) file and open the formula file with the
14023 system-registered application.
14029 #+cindex: ImageMagick
14030 Add this line to the Org file. This option is activated on
14033 : #+OPTIONS: tex:dvipng
14035 : #+OPTIONS: tex:dvisvgm
14037 #+texinfo: @noindent
14040 : #+OPTIONS: tex:imagemagick
14042 Under this option, LaTeX fragments are processed into PNG or SVG
14043 images and the resulting images are embedded in the exported
14044 document. This method requires dvipng program, dvisvgm or
14045 ImageMagick programs.
14047 **** MathML and OpenDocument formula files
14049 :DESCRIPTION: Embedding in native format.
14052 When embedding LaTeX math snippets in ODT documents is not reliable,
14053 there is one more option to try. Embed an equation by linking to its
14054 MathML (=.mml=) source or its OpenDocument formula (=.odf=) file as
14057 : [[./equation.mml]]
14059 #+texinfo: @noindent
14062 : [[./equation.odf]]
14064 *** Labels and captions in ODT export
14066 :DESCRIPTION: Rendering objects.
14069 ODT format handles labeling and captioning of objects based on their
14070 types. Inline images, tables, LaTeX fragments, and Math formulas are
14071 numbered and captioned separately. Each object also gets a unique
14072 sequence number based on its order of first appearance in the Org
14073 file. Each category has its own sequence. A caption is just a label
14074 applied to these objects.
14077 ,#+CAPTION: Bell curve
14078 ,#+NAME: fig:SED-HR4049
14082 When rendered, it may show as follows in the exported document:
14084 : Figure 2: Bell curve
14086 #+vindex: org-odt-category-map-alist
14087 To modify the category component of the caption, customize the option
14088 ~org-odt-category-map-alist~. For example, to tag embedded images
14089 with the string "Illustration" instead of the default string "Figure",
14090 use the following setting:
14092 #+begin_src emacs-lisp
14093 (setq org-odt-category-map-alist
14094 '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
14097 With the above modification, the previous example changes to:
14099 : Illustration 2: Bell curve
14101 *** Literal examples in ODT export
14103 :DESCRIPTION: For source code and example blocks.
14106 The ODT export back-end supports literal examples (see [[*Literal
14107 Examples]]) with full fontification. Internally, the ODT export
14108 back-end relies on =htmlfontify.el= to generate the style definitions
14109 needed for fancy listings. The auto-generated styles get =OrgSrc=
14110 prefix and inherit colors from the faces used by Emacs Font Lock
14111 library for that source language.
14113 #+vindex: org-odt-fontify-srcblocks
14114 For custom fontification styles, customize the
14115 ~org-odt-create-custom-styles-for-srcblocks~ option.
14117 #+vindex: org-odt-create-custom-styles-for-srcblocks
14118 To turn off fontification of literal examples, customize the
14119 ~org-odt-fontify-srcblocks~ option.
14121 *** Advanced topics in ODT export
14123 :DESCRIPTION: For power users.
14126 The ODT export back-end has extensive features useful for power users
14127 and frequent uses of ODT formats.
14129 **** Configuring a document converter
14131 :DESCRIPTION: Registering a document converter.
14135 #+cindex: doc, docx, rtf
14136 #+cindex: converter
14138 The ODT export back-end works with popular converters with little or
14139 no extra configuration. See [[*Extending ODT export]]. The following is
14140 for unsupported converters or tweaking existing defaults.
14142 - Register the converter ::
14144 #+vindex: org-export-odt-convert-processes
14145 Add the name of the converter to the ~org-odt-convert-processes~
14146 variable. Note that it also requires how the converter is
14147 invoked on the command line. See the variable's docstring for
14150 - Configure its capabilities ::
14152 #+vindex: org-export-odt-convert-capabilities
14153 Specify which formats the converter can handle by customizing the
14154 variable ~org-odt-convert-capabilities~. Use the entry for the
14155 default values in this variable for configuring the new
14156 converter. Also see its docstring for details.
14158 - Choose the converter ::
14160 #+vindex: org-export-odt-convert-process
14161 Select the newly added converter as the preferred one by
14162 customizing the option ~org-odt-convert-process~.
14164 **** Working with OpenDocument style files
14166 :DESCRIPTION: Exploring internals.
14169 #+cindex: styles, custom
14170 #+cindex: template, custom
14172 This section explores the internals of the ODT exporter; the means by which
14173 it produces styled documents; the use of automatic and custom OpenDocument
14176 The ODT exporter relies on two files for generating its output. These
14177 files are bundled with the distribution under the directory pointed to
14178 by the variable ~org-odt-styles-dir~. The two files are:
14180 - =OrgOdtStyles.xml= <<x-orgodtstyles-xml>> ::
14182 This file contributes to the =styles.xml= file of the final ODT
14183 document. This file gets modified for the following purposes:
14185 1. To control outline numbering based on user settings;
14187 2. To add styles generated by =htmlfontify.el= for fontification of
14190 - =OrgOdtContentTemplate.xml= <<x-orgodtcontenttemplate-xml>> ::
14192 This file contributes to the =content.xml= file of the final ODT
14193 document. The contents of the Org outline are inserted between the
14194 =<office:text>= ... =</office:text>= elements of this file.
14196 Apart from serving as a template file for the final =content.xml=,
14197 the file serves the following purposes:
14199 1. It contains automatic styles for formatting of tables which are
14200 referenced by the exporter;
14202 2. It contains =<text:sequence-decl>= ... =</text:sequence-decl>=
14203 elements that control numbering of tables, images, equations, and
14206 <<x-overriding-factory-styles>> The following two variables control
14207 the location from where the ODT exporter picks up the custom styles
14208 and content template files. Customize these variables to override the
14209 factory styles used by the exporter.
14211 - ~org-odt-styles-file~ ::
14213 The ODT export back-end uses the file pointed to by this
14214 variable, such as =styles.xml=, for the final output. It can
14215 take one of the following values:
14219 Use this file instead of the default =styles.xml=
14221 - =FILE.odt= or =FILE.ott= ::
14223 Use the =styles.xml= contained in the specified OpenDocument
14224 Text or Template file
14226 - =FILE.odt= or =FILE.ott= and a subset of included files ::
14228 Use the =styles.xml= contained in the specified OpenDocument
14229 Text or Template file. Additionally extract the specified
14230 member files and embed those within the final ODT document.
14232 Use this option if the =styles.xml= file references additional
14233 files like header and footer images.
14237 Use the default =styles.xml=.
14239 - ~org-odt-content-template-file~ ::
14241 Use this variable to specify the blank =content.xml= used in the
14244 **** Creating one-off styles
14246 :DESCRIPTION: Customizing styles, highlighting...
14250 The ODT export back-end can read embedded raw OpenDocument XML from
14251 the Org file. Such direct formatting is useful for one-off instances.
14253 - Embedding ODT tags as part of regular text ::
14255 Enclose OpenDocument syntax in =@@odt:...@@= for inline markup.
14256 For example, to highlight a region of text do the following:
14259 @@odt:<text:span text:style-name="Highlight">This is highlighted
14260 text</text:span>@@. But this is regular text.
14263 *Hint:* To see the above example in action, edit the =styles.xml=
14264 (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom /Highlight/ style as shown
14268 <style:style style:name="Highlight" style:family="text">
14269 <style:text-properties fo:background-color="#ff0000"/>
14273 - Embedding a one-line OpenDocument XML ::
14275 #+cindex: @samp{ODT}, keyword
14276 The ODT export back-end can read one-liner options with =#+ODT:=
14277 in the Org file. For example, to force a page break:
14280 ,#+ODT: <text:p text:style-name="PageBreak"/>
14283 *Hint:* To see the above example in action, edit your
14284 =styles.xml= (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom =PageBreak=
14285 style as shown below.
14288 <style:style style:name="PageBreak" style:family="paragraph"
14289 style:parent-style-name="Text_20_body">
14290 <style:paragraph-properties fo:break-before="page"/>
14294 - Embedding a block of OpenDocument XML ::
14296 The ODT export back-end can also read ODT export blocks for
14297 OpenDocument XML. Such blocks use the =#+BEGIN_EXPORT odt=
14298 ... =#+END_EXPORT= constructs.
14300 For example, to create a one-off paragraph that uses bold text,
14304 ,#+BEGIN_EXPORT odt
14305 <text:p text:style-name="Text_20_body_20_bold">
14306 This paragraph is specially formatted and uses bold text.
14311 **** Customizing tables in ODT export
14313 :DESCRIPTION: Defining table templates.
14316 #+cindex: tables, in ODT export
14317 #+cindex: @samp{ATTR_ODT}, keyword
14319 Override the default table format by specifying a custom table style
14320 with the =#+ATTR_ODT= line. For a discussion on default formatting of
14321 tables, see [[*Tables in ODT export]].
14323 This feature closely mimics the way table templates are defined in the
14324 OpenDocument-v1.2 specification.[fn:132]
14326 #+vindex: org-odt-table-styles
14327 For quick preview of this feature, install the settings below and export the
14328 table that follows:
14330 #+begin_src emacs-lisp
14331 (setq org-export-odt-table-styles
14332 (append org-export-odt-table-styles
14333 '(("TableWithHeaderRowAndColumn" "Custom"
14334 ((use-first-row-styles . t)
14335 (use-first-column-styles . t)))
14336 ("TableWithFirstRowandLastRow" "Custom"
14337 ((use-first-row-styles . t)
14338 (use-last-row-styles . t))))))
14342 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
14343 | Name | Phone | Age |
14344 | Peter | 1234 | 17 |
14345 | Anna | 4321 | 25 |
14348 The example above used =Custom= template and installed two table
14349 styles =TableWithHeaderRowAndColumn= and
14350 =TableWithFirstRowandLastRow=. *Important:* The OpenDocument styles
14351 needed for producing the above template were pre-defined. They are
14352 available in the section marked =Custom Table Template= in
14353 =OrgOdtContentTemplate.xml= (see [[x-orgodtcontenttemplate-xml][Factory styles]]). For adding new
14354 templates, define new styles there.
14356 To use this feature proceed as follows:
14358 1. Create a table template[fn:133].
14360 A table template is set of =table-cell= and =paragraph= styles for
14361 each of the following table cell categories:
14373 The names for the above styles must be chosen based on the name of
14374 the table template using a well-defined convention.
14376 The naming convention is better illustrated with an example. For
14377 a table template with the name =Custom=, the needed style names are
14378 listed in the following table.
14380 | Cell type | Cell style | Paragraph style |
14381 |--------------+------------------------------+-----------------------------------|
14382 | Body | =CustomTableCell= | =CustomTableParagraph= |
14383 | First column | =CustomFirstColumnTableCell= | =CustomFirstColumnTableParagraph= |
14384 | Last column | =CustomLastColumnTableCell= | =CustomLastColumnTableParagraph= |
14385 | First row | =CustomFirstRowTableCell= | =CustomFirstRowTableParagraph= |
14386 | Last row | =CustomLastRowTableCell= | =CustomLastRowTableParagraph= |
14387 | Even row | =CustomEvenRowTableCell= | =CustomEvenRowTableParagraph= |
14388 | Odd row | =CustomOddRowTableCell= | =CustomOddRowTableParagraph= |
14389 | Even column | =CustomEvenColumnTableCell= | =CustomEvenColumnTableParagraph= |
14390 | Odd column | =CustomOddColumnTableCell= | =CustomOddColumnTableParagraph= |
14392 To create a table template with the name =Custom=, define the above
14393 styles in the =<office:automatic-styles>= ...
14394 =</office:automatic-styles>= element of the content template file
14395 (see [[x-orgodtcontenttemplate-xml][Factory styles]]).
14397 2. Define a table style[fn:134].
14399 #+vindex: org-odt-table-styles
14400 To define a table style, create an entry for the style in the
14401 variable ~org-odt-table-styles~ and specify the following:
14403 - the name of the table template created in step (1),
14404 - the set of cell styles in that template that are to be activated.
14406 For example, the entry below defines two different table styles
14407 =TableWithHeaderRowAndColumn= and =TableWithFirstRowandLastRow=
14408 based on the same template =Custom=. The styles achieve their
14409 intended effect by selectively activating the individual cell
14410 styles in that template.
14412 #+begin_src emacs-lisp
14413 (setq org-export-odt-table-styles
14414 (append org-export-odt-table-styles
14415 '(("TableWithHeaderRowAndColumn" "Custom"
14416 ((use-first-row-styles . t)
14417 (use-first-column-styles . t)))
14418 ("TableWithFirstRowandLastRow" "Custom"
14419 ((use-first-row-styles . t)
14420 (use-last-row-styles . t))))))
14423 3. Associate a table with the table style.
14425 To do this, specify the table style created in step (2) as part of
14426 the =ATTR_ODT= line as shown below.
14429 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn
14430 | Name | Phone | Age |
14431 | Peter | 1234 | 17 |
14432 | Anna | 4321 | 25 |
14435 **** Validating OpenDocument XML
14437 :DESCRIPTION: Debugging corrupted OpenDocument files.
14441 Sometimes ODT format files may not open due to =.odt= file corruption.
14442 To verify if such a file is corrupt, validate it against the
14443 OpenDocument Relax NG Compact (RNC) syntax schema. But first the
14444 =.odt= files have to be decompressed using =zip=. Note that =.odt=
14445 files are ZIP archives: [[info:emacs::File Archives]]. The contents of
14446 ODT files are in XML. For general help with validation---and
14447 schema-sensitive editing---of XML files:
14448 [[info:nxml-mode::Introduction]].
14450 #+vindex: org-export-odt-schema-dir
14451 Customize ~org-odt-schema-dir~ to point to a directory with
14452 OpenDocument RNC files and the needed schema-locating rules. The ODT
14453 export back-end takes care of updating the
14454 ~rng-schema-locating-files~.
14458 :DESCRIPTION: Exporting to Org.
14461 #+cindex: Org export
14462 /org/ export back-end creates a normalized version of the Org document
14463 in current buffer. The exporter evaluates Babel code (see [[*Evaluating
14464 Code Blocks]]) and removes content specific to other back-ends.
14466 *** Org export commands
14471 - {{{kbd(C-c C-e O o)}}} (~org-org-export-to-org~) ::
14473 #+kindex: C-c C-e O o
14474 #+findex: org-org-export-to-org
14475 Export as an Org file with a =.org= extension. For =myfile.org=,
14476 Org exports to =myfile.org.org=, overwriting without warning.
14478 - {{{kbd(C-c C-e O v)}}} (~~) ::
14480 #+kindex: C-c C-e O v
14481 Export to an Org file, then open it.
14485 :DESCRIPTION: Exporting to Texinfo.
14488 *** Texinfo export commands
14490 :DESCRIPTION: Invoking commands.
14493 - {{{kbd(C-c C-e i t)}}} (~org-texinfo-export-to-texinfo~) ::
14495 #+kindex: C-c C-e i t
14496 #+findex: org-texinfo-export-to-texinfo
14497 Export as a Texinfo file with =.texi= extension. For
14498 =myfile.org=, Org exports to =myfile.texi=, overwriting without
14501 - {{{kbd(C-c C-e i i)}}} (~org-texinfo-export-to-info~) ::
14503 #+kindex: C-c C-e i i
14504 #+findex: org-texinfo-export-to-info
14505 #+vindex: org-texinfo-info-process
14506 Export to Texinfo format first and then process it to make an
14507 Info file. To generate other formats, such as DocBook, customize
14508 the ~org-texinfo-info-process~ variable.
14510 *** Texinfo specific export settings
14512 :DESCRIPTION: Setting the environment.
14515 The Texinfo export back-end has several additional keywords for
14516 customizing Texinfo output. Setting these keywords works similar to
14517 the general options (see [[*Export Settings]]).
14521 #+cindex: @samp{SUBTITLE}, keyword
14522 The document subtitle.
14526 #+cindex: @samp{SUBAUTHOR}, keyword
14527 Additional authors for the document.
14529 - =TEXINFO_FILENAME= ::
14531 #+cindex: @samp{TEXINFO_FILENAME}, keyword
14532 The Texinfo filename.
14534 - =TEXINFO_CLASS= ::
14536 #+cindex: @samp{TEXINFO_CLASS}, keyword
14537 #+vindex: org-texinfo-default-class
14538 The default document class (~org-texinfo-default-class~), which
14539 must be a member of ~org-texinfo-classes~.
14541 - =TEXINFO_HEADER= ::
14543 #+cindex: @samp{TEXINFO_HEADER}, keyword
14544 Arbitrary lines inserted at the end of the header.
14546 - =TEXINFO_POST_HEADER= ::
14548 #+cindex: @samp{TEXINFO_POST_HEADER}, keyword
14549 Arbitrary lines inserted after the end of the header.
14551 - =TEXINFO_DIR_CATEGORY= ::
14553 #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword
14554 The directory category of the document.
14556 - =TEXINFO_DIR_TITLE= ::
14558 #+cindex: @samp{TEXINFO_DIR_TITLE}, keyword
14559 The directory title of the document.
14561 - =TEXINFO_DIR_DESC= ::
14563 #+cindex: @samp{TEXINFO_DIR_DESC}, keyword
14564 The directory description of the document.
14566 - =TEXINFO_PRINTED_TITLE= ::
14568 #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword
14569 The printed title of the document.
14571 *** Texinfo file header
14573 :DESCRIPTION: Generating the header.
14576 #+cindex: @samp{TEXINFO_FILENAME}, keyword
14577 After creating the header for a Texinfo file, the Texinfo back-end
14578 automatically generates a name and destination path for the Info file.
14579 To override this default with a more sensible path and name, specify
14580 the =TEXINFO_FILENAME= keyword.
14582 #+vindex: org-texinfo-coding-system
14583 #+cindex: @samp{TEXINFO_HEADER}, keyword
14584 Along with the output's file name, the Texinfo header also contains
14585 language details (see [[*Export Settings]]) and encoding system as set in
14586 the ~org-texinfo-coding-system~ variable. Insert =TEXINFO_HEADER=
14587 keywords for each additional command in the header, for example:
14589 : #+TEXINFO_HEADER: @synindex
14591 #+cindex: @samp{TEXINFO_CLASS}, keyword
14592 #+vindex: org-texinfo-classes
14593 Instead of repeatedly installing the same set of commands, define
14594 a class in ~org-texinfo-classes~ once, and then activate it in the
14595 document by setting the =TEXINFO_CLASS= keyword to that class.
14597 *** Texinfo title and copyright page
14599 :DESCRIPTION: Creating preamble pages.
14602 #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword
14603 The default template for hard copy output has a title page with
14604 =TITLE= and =AUTHOR= keywords (see [[*Export Settings]]). To replace the
14605 regular title with something different for the printed version, use
14606 the =TEXINFO_PRINTED_TITLE= and =SUBTITLE= keywords. Both expect raw
14607 Texinfo code for setting their values.
14609 #+cindex: @samp{SUBAUTHOR}, keyword
14610 If one =AUTHOR= line is not sufficient, add multiple =SUBAUTHOR=
14611 keywords. They have to be set in raw Texinfo code.
14614 ,#+AUTHOR: Jane Smith
14615 ,#+SUBAUTHOR: John Doe
14616 ,#+TEXINFO_PRINTED_TITLE: This Long Title@@inlinefmt{tex,@*} Is Broken in @TeX{}
14619 #+cindex: @samp{COPYING}, property
14620 Copying material is defined in a dedicated headline with a non-~nil~
14621 =COPYING= property. The back-end inserts the contents within
14622 a =@copying= command at the beginning of the document. The heading
14623 itself does not appear in the structure of the document.
14625 Copyright information is printed on the back of the title page.
14633 This is a short example of a complete Texinfo file, version 1.0.
14635 Copyright \copy 2016 Free Software Foundation, Inc.
14638 *** Info directory file
14640 :DESCRIPTION: Installing a manual in Info file hierarchy.
14643 #+cindex: @samp{dir} file, in Texinfo export
14644 #+cindex: Info directory file, in Texinfo export
14645 #+cindex: @code{install-info}, in Texinfo export
14647 #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword
14648 #+cindex: @samp{TEXINFO_DIR_TITLE}, keyword
14649 #+cindex: @samp{TEXINFO_DIR_DESC}, keyword
14650 The end result of the Texinfo export process is the creation of an
14651 Info file. This Info file's metadata has variables for category,
14652 title, and description: =TEXINFO_DIR_CATEGORY=, =TEXINFO_DIR_TITLE=,
14653 and =TEXINFO_DIR_DESC= keywords that establish where in the Info
14654 hierarchy the file fits.
14656 Here is an example that writes to the Info directory file:
14659 ,#+TEXINFO_DIR_CATEGORY: Emacs
14660 ,#+TEXINFO_DIR_TITLE: Org Mode: (org)
14661 ,#+TEXINFO_DIR_DESC: Outline-based notes management and organizer
14664 *** Headings and sectioning structure
14666 :DESCRIPTION: Building document structure.
14669 #+vindex: org-texinfo-classes
14670 #+vindex: org-texinfo-default-class
14671 #+cindex: @samp{TEXINFO_CLASS}, keyword
14672 The Texinfo export back-end uses a pre-defined scheme to convert Org
14673 headlines to equivalent Texinfo structuring commands. A scheme like
14674 this maps top-level headlines to numbered chapters tagged as
14675 ~@chapter~ and lower-level headlines to unnumbered chapters tagged as
14676 ~@unnumbered~. To override such mappings to introduce ~@part~ or
14677 other Texinfo structuring commands, define a new class in
14678 ~org-texinfo-classes~. Activate the new class with the
14679 =TEXINFO_CLASS= keyword. When no new class is defined and activated,
14680 the Texinfo export back-end defaults to the
14681 ~org-texinfo-default-class~.
14683 If an Org headline's level has no associated Texinfo structuring
14684 command, or is below a certain threshold (see [[*Export Settings]]), then
14685 the Texinfo export back-end makes it into a list item.
14687 #+cindex: @samp{APPENDIX}, property
14688 The Texinfo export back-end makes any headline with a non-~nil~
14689 =APPENDIX= property into an appendix. This happens independent of the
14690 Org headline level or the =TEXINFO_CLASS= keyword.
14692 #+cindex: @samp{ALT_TITLE}, property
14693 #+cindex: @samp{DESCRIPTION}, property
14694 The Texinfo export back-end creates a menu entry after the Org
14695 headline for each regular sectioning structure. To override this with
14696 a shorter menu entry, use the =ALT_TITLE= property (see [[*Table of
14697 Contents]]). Texinfo menu entries also have an option for a longer
14698 =DESCRIPTION= property. Here's an example that uses both to override
14699 the default menu entry:
14702 ,* Controlling Screen Display
14704 :ALT_TITLE: Display
14705 :DESCRIPTION: Controlling Screen Display
14709 #+cindex: Top node, in Texinfo export
14710 The text before the first headline belongs to the /Top/ node, i.e.,
14711 the node in which a reader enters an Info manual. As such, it is
14712 expected not to appear in printed output generated from the =.texi=
14713 file. See [[info:texinfo::The%20Top%20Node]], for more information.
14717 :DESCRIPTION: Creating indices.
14720 #+cindex: @samp{CINDEX}, keyword
14721 #+cindex: concept index, in Texinfo export
14722 #+cindex: @samp{FINDEX}, keyword
14723 #+cindex: function index, in Texinfo export
14724 #+cindex: @samp{KINDEX}, keyword
14725 #+cindex: keystroke index, in Texinfo export
14726 #+cindex: @samp{PINDEX}, keyword
14727 #+cindex: program index, in Texinfo export
14728 #+cindex: @samp{TINDEX}, keyword
14729 #+cindex: data type index, in Texinfo export
14730 #+cindex: @samp{VINDEX}, keyword
14731 #+cindex: variable index, in Texinfo export
14732 The Texinfo export back-end recognizes these indexing keywords if used
14733 in the Org file: =CINDEX=, =FINDEX=, =KINDEX=, =PINDEX=, =TINDEX= and
14734 =VINDEX=. Write their value as verbatim Texinfo code; in particular,
14735 ={=, =}= and =@= characters need to be escaped with =@= if they do not
14736 belong to a Texinfo command.
14738 : #+CINDEX: Defining indexing entries
14740 #+cindex: @samp{INDEX}, property
14741 For the back-end to generate an index entry for a headline, set the
14742 =INDEX= property to =cp= or =vr=. These abbreviations come from
14743 Texinfo that stand for concept index and variable index. The Texinfo
14744 manual has abbreviations for all other kinds of indexes. The back-end
14745 exports the headline as an unnumbered chapter or section command, and
14746 then inserts the index after its contents.
14755 *** Quoting Texinfo code
14757 :DESCRIPTION: Incorporating literal Texinfo code.
14760 Use any of the following three methods to insert or escape raw Texinfo
14763 #+cindex: @samp{TEXINFO}, keyword
14764 #+cindex: @samp{BEGIN_EXPORT texinfo}
14766 Richard @@texinfo:@sc{@@Stallman@@texinfo:}@@ commence' GNU.
14768 ,#+TEXINFO: @need800
14769 This paragraph is preceded by...
14771 ,#+BEGIN_EXPORT texinfo
14772 @auindex Johnson, Mark
14773 @auindex Lakoff, George
14777 *** Plain lists in Texinfo export
14779 :DESCRIPTION: List attributes.
14782 #+cindex: @samp{ATTR_TEXINFO}, keyword
14783 #+cindex: two-column tables, in Texinfo export
14785 #+cindex: table types, in Texinfo export
14786 The Texinfo export back-end by default converts description lists in
14787 the Org file using the default command =@table=, which results in
14788 a table with two columns. To change this behavior, specify
14789 =:table-type= with =ftable= or =vtable= attributes. For more
14790 information, see [[info:texinfo::Two-column Tables]].
14792 #+vindex: org-texinfo-table-default-markup
14793 The Texinfo export back-end by default also applies a text highlight
14794 based on the defaults stored in ~org-texinfo-table-default-markup~.
14795 To override the default highlight command, specify another one with
14796 the =:indic= attribute.
14798 #+cindex: multiple items in Texinfo lists
14799 Org syntax is limited to one entry per list item. Nevertheless, the
14800 Texinfo export back-end can split that entry according to any text
14801 provided through the =:sep= attribute. Each part then becomes a new
14802 entry in the first column of the table.
14804 The following example illustrates all the attributes above:
14807 ,#+ATTR_TEXINFO: :table-type vtable :sep , :indic asis
14808 - foo, bar :: This is the common text for variables foo and bar.
14811 #+texinfo: @noindent
14818 This is the common text for variables foo and bar.
14822 *** Tables in Texinfo export
14824 :DESCRIPTION: Table attributes.
14827 #+cindex: @samp{ATTR_TEXINFO}, keyword
14828 When exporting tables, the Texinfo export back-end uses the widest
14829 cell width in each column. To override this and instead specify as
14830 fractions of line length, use the =:columns= attribute. See example
14834 ,#+ATTR_TEXINFO: :columns .5 .5
14835 | a cell | another cell |
14838 *** Images in Texinfo export
14840 :DESCRIPTION: Image attributes.
14843 #+cindex: @samp{ATTR_TEXINFO}, keyword
14844 Insert a file link to the image in the Org file, and the Texinfo
14845 export back-end inserts the image. These links must have the usual
14846 supported image extensions and no descriptions. To scale the image,
14847 use =:width= and =:height= attributes. For alternate text, use =:alt=
14848 and specify the text using Texinfo code, as shown in the example:
14851 ,#+ATTR_TEXINFO: :width 1in :alt Alternate @i{text}
14855 *** Quotations in Texinfo export
14857 :DESCRIPTION: Quote block attributes.
14860 #+cindex: @samp{ATTR_TEXINFO}, keyword
14861 You can write the text of a quotation within a quote block (see
14862 [[*Paragraphs]]). You may also emphasize some text at the beginning of
14863 the quotation with the =:tag= attribute.
14866 ,#+ATTR_TEXINFO: :tag Warning
14868 Striking your thumb with a hammer may cause severe pain and discomfort.
14872 To specify the author of the quotation, use the =:author= attribute.
14875 ,#+ATTR_TEXINFO: :author King Arthur
14877 The Lady of the Lake, her arm clad in the purest shimmering samite,
14878 held aloft Excalibur from the bosom of the water, signifying by divine
14879 providence that I, Arthur, was to carry Excalibur. That is why I am
14884 *** Special blocks in Texinfo export
14886 :DESCRIPTION: Special block attributes.
14889 #+cindex: @samp{ATTR_TEXINFO}, keyword
14891 The Texinfo export back-end converts special blocks to commands with
14892 the same name. It also adds any =:options= attributes to the end of
14893 the command, as shown in this example:
14896 ,#+ATTR_TEXINFO: :options org-org-export-to-org ...
14898 A somewhat obsessive function name.
14902 #+texinfo: @noindent
14906 @defun org-org-export-to-org ...
14907 A somewhat obsessive function name.
14911 *** A Texinfo example
14913 :DESCRIPTION: Processing Org to Texinfo.
14916 Here is a more detailed example Org file. See
14917 [[info:texinfo::GNU%20Sample%20Texts]] for an equivalent example using
14921 ,#+TITLE: GNU Sample {{{version}}}
14922 ,#+SUBTITLE: for version {{{version}}}, {{{updated}}}
14923 ,#+AUTHOR: A.U. Thor
14924 ,#+EMAIL: bug-sample@gnu.org
14926 ,#+OPTIONS: ':t toc:t author:t email:t
14929 ,#+MACRO: version 2.0
14930 ,#+MACRO: updated last updated 4 March 2014
14932 ,#+TEXINFO_FILENAME: sample.info
14933 ,#+TEXINFO_HEADER: @syncodeindex pg cp
14935 ,#+TEXINFO_DIR_CATEGORY: Texinfo documentation system
14936 ,#+TEXINFO_DIR_TITLE: sample: (sample)
14937 ,#+TEXINFO_DIR_DESC: Invoking sample
14939 ,#+TEXINFO_PRINTED_TITLE: GNU Sample
14941 This manual is for GNU Sample (version {{{version}}},
14949 This manual is for GNU Sample (version {{{version}}},
14950 {{{updated}}}), which is an example in the Texinfo documentation.
14952 Copyright \copy 2016 Free Software Foundation, Inc.
14955 Permission is granted to copy, distribute and/or modify this
14956 document under the terms of the GNU Free Documentation License,
14957 Version 1.3 or any later version published by the Free Software
14958 Foundation; with no Invariant Sections, with no Front-Cover Texts,
14959 and with no Back-Cover Texts. A copy of the license is included in
14960 the section entitled "GNU Free Documentation License".
14966 ,#+CINDEX: invoking @command{sample}
14968 This is a sample manual. There is no sample program to invoke, but
14969 if there were, you could see its basic usage and command line
14972 ,* GNU Free Documentation License
14977 ,#+TEXINFO: @include fdl.texi
14985 ** iCalendar Export
14987 :DESCRIPTION: Exporting to iCalendar.
14989 #+cindex: iCalendar export
14991 A large part of Org mode's interoperability success is its ability to
14992 easily export to or import from external applications. The iCalendar
14993 export back-end takes calendar data from Org files and exports to the
14994 standard iCalendar format.
14996 #+vindex: org-icalendar-include-todo
14997 #+vindex: org-icalendar-use-deadline
14998 #+vindex: org-icalendar-use-scheduled
14999 The iCalendar export back-end can also incorporate TODO entries based
15000 on the configuration of the ~org-icalendar-include-todo~ variable.
15001 The back-end exports plain timestamps as =VEVENT=, TODO items as
15002 =VTODO=, and also create events from deadlines that are in non-TODO
15003 items. The back-end uses the deadlines and scheduling dates in Org
15004 TODO items for setting the start and due dates for the iCalendar TODO
15005 entry. Consult the ~org-icalendar-use-deadline~ and
15006 ~org-icalendar-use-scheduled~ variables for more details.
15008 #+vindex: org-icalendar-categories
15009 #+vindex: org-icalendar-alarm-time
15010 For tags on the headline, the iCalendar export back-end makes them
15011 into iCalendar categories. To tweak the inheritance of tags and TODO
15012 states, configure the variable ~org-icalendar-categories~. To assign
15013 clock alarms based on time, configure the ~org-icalendar-alarm-time~
15016 #+vindex: org-icalendar-store-UID
15017 #+cindex: @samp{ID}, property
15018 The iCalendar format standard requires globally unique identifier---or
15019 UID---for each entry. The iCalendar export back-end creates UIDs
15020 during export. To save a copy of the UID in the Org file set the
15021 variable ~org-icalendar-store-UID~. The back-end looks for the =ID=
15022 property of the entry for re-using the same UID for subsequent
15025 Since a single Org entry can result in multiple iCalendar
15026 entries---timestamp, deadline, scheduled item, or TODO item---Org adds
15027 prefixes to the UID, depending on which part of the Org entry
15028 triggered the creation of the iCalendar entry. Prefixing ensures UIDs
15029 remains unique, yet enable synchronization programs trace the
15032 - {{{kbd(C-c C-e c f)}}} (~org-icalendar-export-to-ics~) ::
15034 #+kindex: C-c C-e c f
15035 #+findex: org-icalendar-export-to-ics
15036 Create iCalendar entries from the current Org buffer and store
15037 them in the same directory, using a file extension =.ics=.
15039 - {{{kbd(C-c C-e c a)}}} (~org-icalendar-export-agenda-files~) ::
15041 #+kindex: C-c C-e c a
15042 #+findex: org-icalendar-export-agenda-files
15043 Create iCalendar entries from Org files in ~org-agenda-files~ and
15044 store in a separate iCalendar file for each Org file.
15046 - {{{kbd(C-c C-e c c)}}} (~org-icalendar-combine-agenda-files~) ::
15048 #+kindex: C-c C-e c c
15049 #+findex: org-icalendar-combine-agenda-files
15050 #+vindex: org-icalendar-combined-agenda-file
15051 Create a combined iCalendar file from Org files in
15052 ~org-agenda-files~ and write it to
15053 ~org-icalendar-combined-agenda-file~ file name.
15055 #+cindex: @samp{SUMMARY}, property
15056 #+cindex: @samp{DESCRIPTION}, property
15057 #+cindex: @samp{LOCATION}, property
15058 #+cindex: @samp{TIMEZONE}, property
15059 The iCalendar export back-end includes =SUMMARY=, =DESCRIPTION=,
15060 =LOCATION= and =TIMEZONE= properties from the Org entries when
15061 exporting. To force the back-end to inherit the =LOCATION= and
15062 =TIMEZONE= properties, configure the ~org-use-property-inheritance~
15065 #+vindex: org-icalendar-include-body
15066 When Org entries do not have =SUMMARY=, =DESCRIPTION= and =LOCATION=
15067 properties, the iCalendar export back-end derives the summary from the
15068 headline, and derives the description from the body of the Org item.
15069 The ~org-icalendar-include-body~ variable limits the maximum number of
15070 characters of the content are turned into its description.
15072 The =TIMEZONE= property can be used to specify a per-entry time zone,
15073 and is applied to any entry with timestamp information. Time zones
15074 should be specified as per the IANA time zone database format, e.g.,
15075 =Asia/Almaty=. Alternately, the property value can be =UTC=, to force
15076 UTC time for this entry only.
15078 Exporting to iCalendar format depends in large part on the
15079 capabilities of the destination application. Some are more lenient
15080 than others. Consult the Org mode FAQ for advice on specific
15083 ** Other Built-in Back-ends
15085 :DESCRIPTION: Exporting to a man page.
15088 Other export back-ends included with Org are:
15090 - =ox-man.el=: Export to a man page.
15092 To activate such back-ends, either customize ~org-export-backends~ or
15093 load directly with ~(require 'ox-man)~. On successful load, the
15094 back-end adds new keys in the export dispatcher (see [[*The Export
15097 Follow the comment section of such files, for example, =ox-man.el=,
15098 for usage and configuration details.
15100 ** Advanced Export Configuration
15102 :DESCRIPTION: Fine-tuning the export output.
15110 #+vindex: org-export-before-processing-hook
15111 #+vindex: org-export-before-parsing-hook
15112 The export process executes two hooks before the actual exporting
15113 begins. The first hook, ~org-export-before-processing-hook~, runs
15114 before any expansions of macros, Babel code, and include keywords in
15115 the buffer. The second hook, ~org-export-before-parsing-hook~, runs
15116 before the buffer is parsed.
15118 Functions added to these hooks are called with a single argument: the
15119 export back-end actually used, as a symbol. You may use them for
15120 heavy duty structural modifications of the document. For example, you
15121 can remove every headline in the buffer during export like this:
15123 #+begin_src emacs-lisp
15124 (defun my-headline-removal (backend)
15125 "Remove all headlines in the current buffer.
15126 BACKEND is the export back-end being used, as a symbol."
15128 (lambda () (delete-region (point) (line-beginning-position 2)))))
15130 (add-hook 'org-export-before-parsing-hook 'my-headline-removal)
15138 #+cindex: Filters, exporting
15139 Filters are lists of functions to be applied to certain parts for
15140 a given back-end. The output from the first function in the filter is
15141 passed on to the next function in the filter. The final output is the
15142 output from the final function in the filter.
15144 The Org export process has many filter sets applicable to different
15145 types of objects, plain text, parse trees, export options, and final
15146 output formats. The filters are named after the element type or
15147 object type: ~org-export-filter-TYPE-functions~, where {{{var(TYPE)}}}
15148 is the type targeted by the filter. Valid types are:
15150 #+attr_texinfo: :columns 0.33 0.33 0.33
15151 | body | bold | babel-call |
15152 | center-block | clock | code |
15153 | diary-sexp | drawer | dynamic-block |
15154 | entity | example-block | export-block |
15155 | export-snippet | final-output | fixed-width |
15156 | footnote-definition | footnote-reference | headline |
15157 | horizontal-rule | inline-babel-call | inline-src-block |
15158 | inlinetask | italic | item |
15159 | keyword | latex-environment | latex-fragment |
15160 | line-break | link | node-property |
15161 | options | paragraph | parse-tree |
15162 | plain-list | plain-text | planning |
15163 | property-drawer | quote-block | radio-target |
15164 | section | special-block | src-block |
15165 | statistics-cookie | strike-through | subscript |
15166 | superscript | table | table-cell |
15167 | table-row | target | timestamp |
15168 | underline | verbatim | verse-block |
15170 Here is an example filter that replaces non-breaking spaces ~Â ~ in the
15171 Org buffer with =~= for the LaTeX back-end.
15173 #+begin_src emacs-lisp
15174 (defun my-latex-filter-nobreaks (text backend info)
15175 "Ensure \"Â \" are properly handled in LaTeX export."
15176 (when (org-export-derived-backend-p backend 'latex)
15177 (replace-regexp-in-string "Â " "~" text)))
15179 (add-to-list 'org-export-filter-plain-text-functions
15180 'my-latex-filter-nobreaks)
15183 A filter requires three arguments: the code to be transformed, the
15184 name of the back-end, and some optional information about the export
15185 process. The third argument can be safely ignored. Note the use of
15186 ~org-export-derived-backend-p~ predicate that tests for /latex/
15187 back-end or any other back-end, such as /beamer/, derived from
15190 *** Defining filters for individual files
15195 The Org export can filter not just for back-ends, but also for
15196 specific files through the =BIND= keyword. Here is an example with
15197 two filters; one removes brackets from time stamps, and the other
15198 removes strike-through text. The filter functions are defined in
15199 a code block in the same Org file, which is a handy location for
15203 ,#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
15204 ,#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
15205 ,#+BEGIN_SRC emacs-lisp :exports results :results none
15206 (defun tmp-f-timestamp (s backend info)
15207 (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
15208 (defun tmp-f-strike-through (s backend info) "")
15212 *** Extending an existing back-end
15217 Some parts of the conversion process can be extended for certain
15218 elements so as to introduce a new or revised translation. That is how
15219 the HTML export back-end was extended to handle Markdown format. The
15220 extensions work seamlessly so any aspect of filtering not done by the
15221 extended back-end is handled by the original back-end. Of all the
15222 export customization in Org, extending is very powerful as it operates
15223 at the parser level.
15225 For this example, make the /ascii/ back-end display the language used
15226 in a source code block. Also make it display only when some attribute
15227 is non-~nil~, like the following:
15229 : #+ATTR_ASCII: :language t
15231 Then extend ASCII back-end with a custom "my-ascii" back-end.
15233 #+begin_src emacs-lisp
15234 (defun my-ascii-src-block (src-block contents info)
15235 "Transcode a SRC-BLOCK element from Org to ASCII.
15236 CONTENTS is nil. INFO is a plist used as a communication
15238 (if (not (org-export-read-attribute :attr_ascii src-block :language))
15239 (org-export-with-backend 'ascii src-block contents info)
15241 (format ",--[ %s ]--\n%s`----"
15242 (org-element-property :language src-block)
15243 (replace-regexp-in-string
15245 (org-element-normalize-string
15246 (org-export-format-code-default src-block info)))))))
15248 (org-export-define-derived-backend 'my-ascii 'ascii
15249 :translate-alist '((src-block . my-ascii-src-block)))
15252 The ~my-ascii-src-block~ function looks at the attribute above the
15253 current element. If not true, hands over to /ascii/ back-end. If
15254 true, which it is in this example, it creates a box around the code
15255 and leaves room for the inserting a string for language. The last
15256 form creates the new back-end that springs to action only when
15257 translating ~src-block~ type elements.
15259 To use the newly defined back-end, evaluate the following from an Org
15262 #+begin_src emacs-lisp
15263 (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
15266 Further steps to consider would be an interactive function,
15267 self-installing an item in the export dispatcher menu, and other
15268 user-friendly improvements.
15270 ** Export in Foreign Buffers
15272 :DESCRIPTION: Author tables and lists in Org syntax.
15275 The export back-ends in Org often include commands to convert selected
15276 regions. A convenient feature of this in-place conversion is that the
15277 exported output replaces the original source. Here are such
15280 - ~org-html-convert-region-to-html~ ::
15282 #+findex: org-html-convert-region-to-html
15283 Convert the selected region into HTML.
15285 - ~org-latex-convert-region-to-latex~ ::
15287 #+findex: org-latex-convert-region-to-latex
15288 Convert the selected region into LaTeX.
15290 - ~org-texinfo-convert-region-to-texinfo~ ::
15292 #+findex: org-texinfo-convert-region-to-texinfo
15293 Convert the selected region into Texinfo.
15295 - ~org-md-convert-region-to-md~ ::
15297 #+findex: org-md-convert-region-to-md
15298 Convert the selected region into Markdown.
15300 In-place conversions are particularly handy for quick conversion of
15301 tables and lists in foreign buffers. For example, in an HTML buffer,
15302 write a list in Org syntax, select it, and convert it to HTML with
15303 {{{kbd(M-x org-html-convert-region-to-html)}}}.
15307 :DESCRIPTION: Create a web site of linked Org files.
15309 #+cindex: publishing
15311 Org includes a publishing management system that allows you to
15312 configure automatic HTML conversion of /projects/ composed of
15313 interlinked Org files. You can also configure Org to automatically
15314 upload your exported HTML pages and related attachments, such as
15315 images and source code files, to a web server.
15317 You can also use Org to convert files into PDF, or even combine HTML
15318 and PDF conversion so that files are available in both formats on the
15321 Publishing has been contributed to Org by David O'Toole.
15325 :DESCRIPTION: Defining projects.
15327 Publishing needs significant configuration to specify files,
15328 destination and many other properties of a project.
15330 *** The variable ~org-publish-project-alist~
15332 :DESCRIPTION: The central configuration variable.
15333 :ALT_TITLE: Project alist
15335 #+cindex: projects, for publishing
15337 #+vindex: org-publish-project-alist
15338 Publishing is configured almost entirely through setting the value of
15339 one variable, called ~org-publish-project-alist~. Each element of the
15340 list configures one project, and may be in one of the two following
15343 #+begin_src emacs-lisp
15344 ("project-name" :property value :property value ...)
15347 #+texinfo: @noindent
15348 i.e., a well-formed property list with alternating keys and values,
15351 #+begin_src emacs-lisp
15352 ("project-name" :components ("project-name" "project-name" ...))
15355 In both cases, projects are configured by specifying property values.
15356 A project defines the set of files that are to be published, as well
15357 as the publishing configuration to use when publishing those files.
15358 When a project takes the second form listed above, the individual
15359 members of the ~:components~ property are taken to be sub-projects,
15360 which group together files requiring different publishing options.
15361 When you publish such a "meta-project", all the components are also
15362 published, in the sequence given.
15364 *** Sources and destinations for files
15366 :DESCRIPTION: From here to there.
15367 :ALT_TITLE: Sources and destinations
15369 #+cindex: directories, for publishing
15371 Most properties are optional, but some should always be set. In
15372 particular, Org needs to know where to look for source files, and
15373 where to put published files.
15375 - ~:base-directory~ ::
15377 Directory containing publishing source files.
15379 - ~:publishing-directory~ ::
15381 Directory where output files are published. You can directly
15382 publish to a webserver using a file name syntax appropriate for
15383 the Emacs tramp package. Or you can publish to a local directory
15384 and use external tools to upload your website (see [[*Uploading
15387 - ~:preparation-function~ ::
15389 Function or list of functions to be called before starting the
15390 publishing process, for example, to run =make= for updating files
15391 to be published. Each preparation function is called with
15392 a single argument, the project property list.
15394 - ~:completion-function~ ::
15396 Function or list of functions called after finishing the
15397 publishing process, for example, to change permissions of the
15398 resulting files. Each completion function is called with
15399 a single argument, the project property list.
15401 *** Selecting files
15403 :DESCRIPTION: What files are part of the project?
15405 #+cindex: files, selecting for publishing
15407 By default, all files with extension =.org= in the base directory are
15408 considered part of the project. This can be modified by setting the
15409 following properties
15411 - ~:base-extension~ ::
15413 Extension---without the dot---of source files. This actually
15414 is a regular expression. Set this to the symbol ~any~ if you
15415 want to get all files in ~:base-directory~, even without
15420 Regular expression to match file names that should not be published,
15421 even though they have been selected on the basis of their extension.
15425 List of files to be included regardless of ~:base-extension~ and
15430 Non-~nil~ means, check base-directory recursively for files to
15433 *** Publishing action
15435 :DESCRIPTION: Setting the function doing the publishing.
15437 #+cindex: action, for publishing
15439 Publishing means that a file is copied to the destination directory
15440 and possibly transformed in the process. The default transformation
15441 is to export Org files as HTML files, and this is done by the function
15442 ~org-publish-org-to-html~ which calls the HTML exporter (see [[*HTML
15443 Export]]). But you can also publish your content as PDF files using
15444 ~org-publish-org-to-pdf~, or as ASCII, Texinfo, etc., using the
15445 corresponding functions.
15447 If you want to publish the Org file as an =.org= file but with
15448 /archived/, /commented/, and /tag-excluded/ trees removed, use
15449 ~org-publish-org-to-org~. This produces =file.org= and put it in the
15450 publishing directory. If you want a htmlized version of this file,
15451 set the parameter ~:htmlized-source~ to ~t~. It produces
15452 =file.org.html= in the publishing directory[fn:135].
15454 Other files like images only need to be copied to the publishing
15455 destination; for this you can use ~org-publish-attachment~. For
15456 non-Org files, you always need to specify the publishing function:
15458 - ~:publishing-function~ ::
15460 Function executing the publication of a file. This may also be
15461 a list of functions, which are all called in turn.
15463 - ~:htmlized-source~ ::
15465 Non-~nil~ means, publish htmlized source.
15467 The function must accept three arguments: a property list containing
15468 at least a ~:publishing-directory~ property, the name of the file to
15469 be published, and the path to the publishing directory of the output
15470 file. It should take the specified file, make the necessary
15471 transformation, if any, and place the result into the destination
15474 *** Options for the exporters
15476 :DESCRIPTION: Tweaking HTML/@LaTeX{} export.
15477 :ALT_TITLE: Publishing options
15479 #+cindex: options, for publishing
15480 #+cindex: publishing options
15482 The property list can be used to set many export options for the HTML
15483 and LaTeX exporters. In most cases, these properties correspond to
15484 user variables in Org. The table below lists these properties along
15485 with the variable they belong to. See the documentation string for
15486 the respective variable for details.
15488 #+vindex: org-publish-project-alist
15489 When a property is given a value in ~org-publish-project-alist~, its
15490 setting overrides the value of the corresponding user variable, if
15491 any, during publishing. Options set within a file (see [[*Export
15492 Settings]]), however, override everything.
15494 **** Generic properties
15499 | ~:archived-trees~ | ~org-export-with-archived-trees~ |
15500 | ~:exclude-tags~ | ~org-export-exclude-tags~ |
15501 | ~:headline-levels~ | ~org-export-headline-levels~ |
15502 | ~:language~ | ~org-export-default-language~ |
15503 | ~:preserve-breaks~ | ~org-export-preserve-breaks~ |
15504 | ~:section-numbers~ | ~org-export-with-section-numbers~ |
15505 | ~:select-tags~ | ~org-export-select-tags~ |
15506 | ~:with-author~ | ~org-export-with-author~ |
15507 | ~:with-broken-links~ | ~org-export-with-broken-links~ |
15508 | ~:with-clocks~ | ~org-export-with-clocks~ |
15509 | ~:with-creator~ | ~org-export-with-creator~ |
15510 | ~:with-date~ | ~org-export-with-date~ |
15511 | ~:with-drawers~ | ~org-export-with-drawers~ |
15512 | ~:with-email~ | ~org-export-with-email~ |
15513 | ~:with-emphasize~ | ~org-export-with-emphasize~ |
15514 | ~:with-fixed-width~ | ~org-export-with-fixed-width~ |
15515 | ~:with-footnotes~ | ~org-export-with-footnotes~ |
15516 | ~:with-latex~ | ~org-export-with-latex~ |
15517 | ~:with-planning~ | ~org-export-with-planning~ |
15518 | ~:with-priority~ | ~org-export-with-priority~ |
15519 | ~:with-properties~ | ~org-export-with-properties~ |
15520 | ~:with-special-strings~ | ~org-export-with-special-strings~ |
15521 | ~:with-sub-superscript~ | ~org-export-with-sub-superscripts~ |
15522 | ~:with-tables~ | ~org-export-with-tables~ |
15523 | ~:with-tags~ | ~org-export-with-tags~ |
15524 | ~:with-tasks~ | ~org-export-with-tasks~ |
15525 | ~:with-timestamps~ | ~org-export-with-timestamps~ |
15526 | ~:with-title~ | ~org-export-with-title~ |
15527 | ~:with-toc~ | ~org-export-with-toc~ |
15528 | ~:with-todo-keywords~ | ~org-export-with-todo-keywords~ |
15530 **** ASCII specific properties
15535 | ~:ascii-bullets~ | ~org-ascii-bullets~ |
15536 | ~:ascii-caption-above~ | ~org-ascii-caption-above~ |
15537 | ~:ascii-charset~ | ~org-ascii-charset~ |
15538 | ~:ascii-global-margin~ | ~org-ascii-global-margin~ |
15539 | ~:ascii-format-drawer-function~ | ~org-ascii-format-drawer-function~ |
15540 | ~:ascii-format-inlinetask-function~ | ~org-ascii-format-inlinetask-function~ |
15541 | ~:ascii-headline-spacing~ | ~org-ascii-headline-spacing~ |
15542 | ~:ascii-indented-line-width~ | ~org-ascii-indented-line-width~ |
15543 | ~:ascii-inlinetask-width~ | ~org-ascii-inlinetask-width~ |
15544 | ~:ascii-inner-margin~ | ~org-ascii-inner-margin~ |
15545 | ~:ascii-links-to-notes~ | ~org-ascii-links-to-notes~ |
15546 | ~:ascii-list-margin~ | ~org-ascii-list-margin~ |
15547 | ~:ascii-paragraph-spacing~ | ~org-ascii-paragraph-spacing~ |
15548 | ~:ascii-quote-margin~ | ~org-ascii-quote-margin~ |
15549 | ~:ascii-table-keep-all-vertical-lines~ | ~org-ascii-table-keep-all-vertical-lines~ |
15550 | ~:ascii-table-use-ascii-art~ | ~org-ascii-table-use-ascii-art~ |
15551 | ~:ascii-table-widen-columns~ | ~org-ascii-table-widen-columns~ |
15552 | ~:ascii-text-width~ | ~org-ascii-text-width~ |
15553 | ~:ascii-underline~ | ~org-ascii-underline~ |
15554 | ~:ascii-verbatim-format~ | ~org-ascii-verbatim-format~ |
15556 **** Beamer specific properties
15561 | ~:beamer-theme~ | ~org-beamer-theme~ |
15562 | ~:beamer-column-view-format~ | ~org-beamer-column-view-format~ |
15563 | ~:beamer-environments-extra~ | ~org-beamer-environments-extra~ |
15564 | ~:beamer-frame-default-options~ | ~org-beamer-frame-default-options~ |
15565 | ~:beamer-outline-frame-options~ | ~org-beamer-outline-frame-options~ |
15566 | ~:beamer-outline-frame-title~ | ~org-beamer-outline-frame-title~ |
15567 | ~:beamer-subtitle-format~ | ~org-beamer-subtitle-format~ |
15569 **** HTML specific properties
15574 | ~:html-allow-name-attribute-in-anchors~ | ~org-html-allow-name-attribute-in-anchors~ |
15575 | ~:html-checkbox-type~ | ~org-html-checkbox-type~ |
15576 | ~:html-container~ | ~org-html-container-element~ |
15577 | ~:html-divs~ | ~org-html-divs~ |
15578 | ~:html-doctype~ | ~org-html-doctype~ |
15579 | ~:html-extension~ | ~org-html-extension~ |
15580 | ~:html-footnote-format~ | ~org-html-footnote-format~ |
15581 | ~:html-footnote-separator~ | ~org-html-footnote-separator~ |
15582 | ~:html-footnotes-section~ | ~org-html-footnotes-section~ |
15583 | ~:html-format-drawer-function~ | ~org-html-format-drawer-function~ |
15584 | ~:html-format-headline-function~ | ~org-html-format-headline-function~ |
15585 | ~:html-format-inlinetask-function~ | ~org-html-format-inlinetask-function~ |
15586 | ~:html-head-extra~ | ~org-html-head-extra~ |
15587 | ~:html-head-include-default-style~ | ~org-html-head-include-default-style~ |
15588 | ~:html-head-include-scripts~ | ~org-html-head-include-scripts~ |
15589 | ~:html-head~ | ~org-html-head~ |
15590 | ~:html-home/up-format~ | ~org-html-home/up-format~ |
15591 | ~:html-html5-fancy~ | ~org-html-html5-fancy~ |
15592 | ~:html-indent~ | ~org-html-indent~ |
15593 | ~:html-infojs-options~ | ~org-html-infojs-options~ |
15594 | ~:html-infojs-template~ | ~org-html-infojs-template~ |
15595 | ~:html-inline-image-rules~ | ~org-html-inline-image-rules~ |
15596 | ~:html-inline-images~ | ~org-html-inline-images~ |
15597 | ~:html-link-home~ | ~org-html-link-home~ |
15598 | ~:html-link-org-files-as-html~ | ~org-html-link-org-files-as-html~ |
15599 | ~:html-link-up~ | ~org-html-link-up~ |
15600 | ~:html-link-use-abs-url~ | ~org-html-link-use-abs-url~ |
15601 | ~:html-mathjax-options~ | ~org-html-mathjax-options~ |
15602 | ~:html-mathjax-template~ | ~org-html-mathjax-template~ |
15603 | ~:html-metadata-timestamp-format~ | ~org-html-metadata-timestamp-format~ |
15604 | ~:html-postamble-format~ | ~org-html-postamble-format~ |
15605 | ~:html-postamble~ | ~org-html-postamble~ |
15606 | ~:html-preamble-format~ | ~org-html-preamble-format~ |
15607 | ~:html-preamble~ | ~org-html-preamble~ |
15608 | ~:html-table-align-individual-field~ | ~de{org-html-table-align-individual-fields~ |
15609 | ~:html-table-attributes~ | ~org-html-table-default-attributes~ |
15610 | ~:html-table-caption-above~ | ~org-html-table-caption-above~ |
15611 | ~:html-table-data-tags~ | ~org-html-table-data-tags~ |
15612 | ~:html-table-header-tags~ | ~org-html-table-header-tags~ |
15613 | ~:html-table-row-tags~ | ~org-html-table-row-tags~ |
15614 | ~:html-table-use-header-tags-for-first-column~ | ~org-html-table-use-header-tags-for-first-column~ |
15615 | ~:html-tag-class-prefix~ | ~org-html-tag-class-prefix~ |
15616 | ~:html-text-markup-alist~ | ~org-html-text-markup-alist~ |
15617 | ~:html-todo-kwd-class-prefix~ | ~org-html-todo-kwd-class-prefix~ |
15618 | ~:html-toplevel-hlevel~ | ~org-html-toplevel-hlevel~ |
15619 | ~:html-use-infojs~ | ~org-html-use-infojs~ |
15620 | ~:html-validation-link~ | ~org-html-validation-link~ |
15621 | ~:html-viewport~ | ~org-html-viewport~ |
15622 | ~:html-xml-declaration~ | ~org-html-xml-declaration~ |
15624 **** LaTeX specific properties
15629 | ~:latex-active-timestamp-format~ | ~org-latex-active-timestamp-format~ |
15630 | ~:latex-caption-above~ | ~org-latex-caption-above~ |
15631 | ~:latex-classes~ | ~org-latex-classes~ |
15632 | ~:latex-class~ | ~org-latex-default-class~ |
15633 | ~:latex-compiler~ | ~org-latex-compiler~ |
15634 | ~:latex-default-figure-position~ | ~org-latex-default-figure-position~ |
15635 | ~:latex-default-table-environment~ | ~org-latex-default-table-environment~ |
15636 | ~:latex-default-table-mode~ | ~org-latex-default-table-mode~ |
15637 | ~:latex-diary-timestamp-format~ | ~org-latex-diary-timestamp-format~ |
15638 | ~:latex-footnote-defined-format~ | ~org-latex-footnote-defined-format~ |
15639 | ~:latex-footnote-separator~ | ~org-latex-footnote-separator~ |
15640 | ~:latex-format-drawer-function~ | ~org-latex-format-drawer-function~ |
15641 | ~:latex-format-headline-function~ | ~org-latex-format-headline-function~ |
15642 | ~:latex-format-inlinetask-function~ | ~org-latex-format-inlinetask-function~ |
15643 | ~:latex-hyperref-template~ | ~org-latex-hyperref-template~ |
15644 | ~:latex-image-default-height~ | ~org-latex-image-default-height~ |
15645 | ~:latex-image-default-option~ | ~org-latex-image-default-option~ |
15646 | ~:latex-image-default-width~ | ~org-latex-image-default-width~ |
15647 | ~:latex-images-centered~ | ~org-latex-images-centered~ |
15648 | ~:latex-inactive-timestamp-format~ | ~org-latex-inactive-timestamp-format~ |
15649 | ~:latex-inline-image-rules~ | ~org-latex-inline-image-rules~ |
15650 | ~:latex-link-with-unknown-path-format~ | ~org-latex-link-with-unknown-path-format~ |
15651 | ~:latex-listings-langs~ | ~org-latex-listings-langs~ |
15652 | ~:latex-listings-options~ | ~org-latex-listings-options~ |
15653 | ~:latex-listings~ | ~org-latex-listings~ |
15654 | ~:latex-minted-langs~ | ~org-latex-minted-langs~ |
15655 | ~:latex-minted-options~ | ~org-latex-minted-options~ |
15656 | ~:latex-prefer-user-labels~ | ~org-latex-prefer-user-labels~ |
15657 | ~:latex-subtitle-format~ | ~org-latex-subtitle-format~ |
15658 | ~:latex-subtitle-separate~ | ~org-latex-subtitle-separate~ |
15659 | ~:latex-table-scientific-notation~ | ~org-latex-table-scientific-notation~ |
15660 | ~:latex-tables-booktabs~ | ~org-latex-tables-booktabs~ |
15661 | ~:latex-tables-centered~ | ~org-latex-tables-centered~ |
15662 | ~:latex-text-markup-alist~ | ~org-latex-text-markup-alist~ |
15663 | ~:latex-title-command~ | ~org-latex-title-command~ |
15664 | ~:latex-toc-command~ | ~org-latex-toc-command~ |
15666 **** Markdown specific properties
15671 | ~:md-footnote-format~ | ~org-md-footnote-format~ |
15672 | ~:md-footnotes-section~ | ~org-md-footnotes-section~ |
15673 | ~:md-headline-style~ | ~org-md-headline-style~ |
15675 **** ODT specific properties
15680 | ~:odt-content-template-file~ | ~org-odt-content-template-file~ |
15681 | ~:odt-display-outline-level~ | ~org-odt-display-outline-level~ |
15682 | ~:odt-fontify-srcblocks~ | ~org-odt-fontify-srcblocks~ |
15683 | ~:odt-format-drawer-function~ | ~org-odt-format-drawer-function~ |
15684 | ~:odt-format-headline-function~ | ~org-odt-format-headline-function~ |
15685 | ~:odt-format-inlinetask-function~ | ~org-odt-format-inlinetask-function~ |
15686 | ~:odt-inline-formula-rules~ | ~org-odt-inline-formula-rules~ |
15687 | ~:odt-inline-image-rules~ | ~org-odt-inline-image-rules~ |
15688 | ~:odt-pixels-per-inch~ | ~org-odt-pixels-per-inch~ |
15689 | ~:odt-styles-file~ | ~org-odt-styles-file~ |
15690 | ~:odt-table-styles~ | ~org-odt-table-styles~ |
15691 | ~:odt-use-date-fields~ | ~org-odt-use-date-fields~ |
15693 **** Texinfo specific properties
15698 | ~:texinfo-active-timestamp-format~ | ~org-texinfo-active-timestamp-format~ |
15699 | ~:texinfo-classes~ | ~org-texinfo-classes~ |
15700 | ~:texinfo-class~ | ~org-texinfo-default-class~ |
15701 | ~:texinfo-table-default-markup~ | ~org-texinfo-table-default-markup~ |
15702 | ~:texinfo-diary-timestamp-format~ | ~org-texinfo-diary-timestamp-format~ |
15703 | ~:texinfo-filename~ | ~org-texinfo-filename~ |
15704 | ~:texinfo-format-drawer-function~ | ~org-texinfo-format-drawer-function~ |
15705 | ~:texinfo-format-headline-function~ | ~org-texinfo-format-headline-function~ |
15706 | ~:texinfo-format-inlinetask-function~ | ~org-texinfo-format-inlinetask-function~ |
15707 | ~:texinfo-inactive-timestamp-format~ | ~org-texinfo-inactive-timestamp-format~ |
15708 | ~:texinfo-link-with-unknown-path-format~ | ~org-texinfo-link-with-unknown-path-format~ |
15709 | ~:texinfo-node-description-column~ | ~org-texinfo-node-description-column~ |
15710 | ~:texinfo-table-scientific-notation~ | ~org-texinfo-table-scientific-notation~ |
15711 | ~:texinfo-tables-verbatim~ | ~org-texinfo-tables-verbatim~ |
15712 | ~:texinfo-text-markup-alist~ | ~org-texinfo-text-markup-alist~ |
15714 *** Publishing links
15716 :DESCRIPTION: Which links keep working after publishing?
15718 #+cindex: links, publishing
15720 To create a link from one Org file to another, you would use something
15721 like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see [[*External Links]]). When
15722 published, this link becomes a link to =foo.html=. You can thus
15723 interlink the pages of your "Org web" project and the links will work
15724 as expected when you publish them to HTML. If you also publish the
15725 Org source file and want to link to it, use an =http= link instead of
15726 a =file:= link, because =file= links are converted to link to the
15727 corresponding =.html= file.
15729 You may also link to related files, such as images. Provided you are
15730 careful with relative file names, and provided you have also
15731 configured Org to upload the related files, these links will work too.
15732 See [[*Example: complex publishing configuration]], for an example of this
15735 Eventually, links between published documents can contain some search
15736 options (see [[*Search Options in File Links]]), which will be resolved to
15737 the appropriate location in the linked file. For example, once
15738 published to HTML, the following links all point to a dedicated anchor
15742 [[file:foo.org::*heading]]
15743 [[file:foo.org::#custom-id]]
15744 [[file:foo.org::target]]
15747 *** Generating a sitemap
15749 :DESCRIPTION: Generating a list of all pages.
15750 :ALT_TITLE: Site map
15752 #+cindex: sitemap, of published pages
15754 The following properties may be used to control publishing of
15755 a map of files for a given project.
15757 - ~:auto-sitemap~ ::
15759 When non-~nil~, publish a sitemap during
15760 ~org-publish-current-project~ or ~org-publish-all~.
15762 - ~:sitemap-filename~ ::
15764 Filename for output of sitemap. Defaults to =sitemap.org=, which
15765 becomes =sitemap.html=.
15767 - ~:sitemap-title~ ::
15769 Title of sitemap page. Defaults to name of file.
15771 - ~:sitemap-format-entry~ ::
15773 #+findex: org-publish-find-date
15774 #+findex: org-publish-find-property
15775 #+findex: org-publish-find-title
15776 With this option one can tell how a site-map entry is formatted
15777 in the site-map. It is a function called with three arguments:
15778 the file or directory name relative to base directory of the
15779 project, the site-map style and the current project. It is
15780 expected to return a string. Default value turns file names into
15781 links and use document titles as descriptions. For specific
15782 formatting needs, one can use ~org-publish-find-date~,
15783 ~org-publish-find-title~ and ~org-publish-find-property~, to
15784 retrieve additional information about published documents.
15786 - ~:sitemap-function~ ::
15788 Plug-in function to use for generation of the sitemap. It is
15789 called with two arguments: the title of the site-map and
15790 a representation of the files and directories involved in the
15791 project as a nested list, which can further be transformed using
15792 ~org-list-to-generic~, ~org-list-to-subtree~ and alike. Default
15793 value generates a plain list of links to all files in the
15796 - ~:sitemap-sort-folders~ ::
15798 Where folders should appear in the sitemap. Set this to ~first~
15799 (default) or ~last~ to display folders first or last,
15800 respectively. When set to ~ignore~, folders are ignored
15801 altogether. Any other value mixes files and folders. This
15802 variable has no effect when site-map style is ~tree~.
15804 - ~:sitemap-sort-files~ ::
15806 How the files are sorted in the site map. Set this to
15807 ~alphabetically~ (default), ~chronologically~ or
15808 ~anti-chronologically~. ~chronologically~ sorts the files with
15809 older date first while ~anti-chronologically~ sorts the files
15810 with newer date first. ~alphabetically~ sorts the files
15811 alphabetically. The date of a file is retrieved with
15812 ~org-publish-find-date~.
15814 - ~:sitemap-ignore-case~ ::
15816 Should sorting be case-sensitive? Default ~nil~.
15818 - ~:sitemap-file-entry-format~ ::
15820 With this option one can tell how a sitemap's entry is formatted
15821 in the sitemap. This is a format string with some escape
15822 sequences: ~%t~ stands for the title of the file, ~%a~ stands for
15823 the author of the file and ~%d~ stands for the date of the file.
15824 The date is retrieved with the ~org-publish-find-date~ function
15825 and formatted with ~org-publish-sitemap-date-format~. Default
15828 - ~:sitemap-date-format~ ::
15830 Format string for the ~format-time-string~ function that tells
15831 how a sitemap entry's date is to be formatted. This property
15832 bypasses ~org-publish-sitemap-date-format~ which defaults to
15835 *** Generating an index
15837 :DESCRIPTION: An index that reaches across pages.
15839 #+cindex: index, in a publishing project
15841 Org mode can generate an index across the files of a publishing project.
15845 When non-~nil~, generate in index in the file =theindex.org= and
15846 publish it as =theindex.html=.
15848 The file is created when first publishing a project with the
15849 ~:makeindex~ set. The file only contains a statement =#+INCLUDE:
15850 "theindex.inc"=. You can then build around this include statement by
15851 adding a title, style information, etc.
15853 #+cindex: @samp{INDEX}, keyword
15854 Index entries are specified with =INDEX= keyword. An entry that
15855 contains an exclamation mark creates a sub item.
15858 ,*** Curriculum Vitae
15860 ,#+INDEX: Application!CV
15865 :DESCRIPTION: How to get files up on the server.
15870 For those people already utilizing third party sync tools such as
15871 Rsync or Unison, it might be preferable not to use the built-in remote
15872 publishing facilities of Org mode which rely heavily on Tramp. Tramp,
15873 while very useful and powerful, tends not to be so efficient for
15874 multiple file transfer and has been known to cause problems under
15877 Specialized synchronization utilities offer several advantages. In
15878 addition to timestamp comparison, they also do content and
15879 permissions/attribute checks. For this reason you might prefer to
15880 publish your web to a local directory---possibly even /in place/ with
15881 your Org files---and then use Unison or Rsync to do the
15882 synchronization with the remote host.
15884 Since Unison, for example, can be configured as to which files to
15885 transfer to a certain remote destination, it can greatly simplify the
15886 project publishing definition. Simply keep all files in the correct
15887 location, process your Org files with ~org-publish~ and let the
15888 synchronization tool do the rest. You do not need, in this scenario,
15889 to include attachments such as JPG, CSS or PNG files in the project
15890 definition since the third-party tool syncs them.
15892 Publishing to a local directory is also much faster than to a remote
15893 one, so that you can afford more easily to republish entire projects.
15894 If you set ~org-publish-use-timestamps-flag~ to ~nil~, you gain the
15895 main benefit of re-including any changed external files such as source
15896 example files you might include with =INCLUDE= keyword. The timestamp
15897 mechanism in Org is not smart enough to detect if included files have
15900 ** Sample Configuration
15902 :DESCRIPTION: Example projects.
15905 Below we provide two example configurations. The first one is
15906 a simple project publishing only a set of Org files. The second
15907 example is more complex, with a multi-component project.
15909 *** Example: simple publishing configuration
15911 :DESCRIPTION: One-component publishing.
15912 :ALT_TITLE: Simple example
15915 This example publishes a set of Org files to the =public_html=
15916 directory on the local machine.
15918 #+begin_src emacs-lisp
15919 (setq org-publish-project-alist
15921 :base-directory "~/org/"
15922 :publishing-directory "~/public_html"
15923 :section-numbers nil
15924 :table-of-contents nil
15925 :style "<link rel=\"stylesheet\"
15926 href=\"../other/mystyle.css\"
15927 type=\"text/css\"/>")))
15930 *** Example: complex publishing configuration
15932 :DESCRIPTION: A multi-component publishing example.
15933 :ALT_TITLE: Complex example
15936 This more complicated example publishes an entire website, including
15937 Org files converted to HTML, image files, Emacs Lisp source code, and
15938 style sheets. The publishing directory is remote and private files
15941 To ensure that links are preserved, care should be taken to replicate
15942 your directory structure on the web server, and to use relative file
15943 paths. For example, if your Org files are kept in =~/org/= and your
15944 publishable images in =~/images/=, you would link to an image with
15946 : file:../images/myimage.png
15948 On the web server, the relative path to the image should be the same.
15949 You can accomplish this by setting up an =images/= folder in the right
15950 place on the web server, and publishing images to it.
15952 #+begin_src emacs-lisp
15953 (setq org-publish-project-alist
15955 :base-directory "~/org/"
15956 :base-extension "org"
15957 :publishing-directory "/ssh:user@host:~/html/notebook/"
15958 :publishing-function org-html-publish-to-html
15959 :exclude "PrivatePage.org" ;; regexp
15961 :section-numbers nil
15963 :html-head "<link rel=\"stylesheet\"
15964 href=\"../other/mystyle.css\" type=\"text/css\"/>"
15968 :base-directory "~/images/"
15969 :base-extension "jpg\\|gif\\|png"
15970 :publishing-directory "/ssh:user@host:~/html/images/"
15971 :publishing-function org-publish-attachment)
15974 :base-directory "~/other/"
15975 :base-extension "css\\|el"
15976 :publishing-directory "/ssh:user@host:~/html/other/"
15977 :publishing-function org-publish-attachment)
15978 ("website" :components ("orgfiles" "images" "other"))))
15981 ** Triggering Publication
15983 :DESCRIPTION: Publication commands.
15986 Once properly configured, Org can publish with the following commands:
15988 - {{{kbd(C-c C-e X)}}} (~org-publish~) ::
15990 #+kindex: C-c C-e X
15991 #+findex: org-publish
15992 Prompt for a specific project and publish all files that belong
15995 - {{{kbd(C-c C-e P)}}} (~org-publish-current-project~) ::
15997 #+kindex: C-c C-e P
15998 #+findex: org-publish-current-project
15999 Publish the project containing the current file.
16001 - {{{kbd(C-c C-e F)}}} (~org-publish-current-file~) ::
16003 #+kindex: C-c C-e F
16004 #+findex: org-publish-current-file
16005 Publish only the current file.
16007 - {{{kbd(C-c C-e E)}}} (~org-publish-all~) ::
16009 #+kindex: C-c C-e E
16010 #+findex: org-publish-all
16011 Publish every project.
16013 #+vindex: org-publish-use-timestamps-flag
16014 Org uses timestamps to track when a file has changed. The above
16015 functions normally only publish changed files. You can override this
16016 and force publishing of all files by giving a prefix argument to any
16017 of the commands above, or by customizing the variable
16018 ~org-publish-use-timestamps-flag~. This may be necessary in
16019 particular if files include other files via =SETUPFILE= or =INCLUDE=
16022 * Working with Source Code
16024 :DESCRIPTION: Export, evaluate, and tangle code blocks.
16026 #+cindex: source code, working with
16028 Source code here refers to any plain text collection of computer
16029 instructions, possibly with comments, written using a human-readable
16030 programming language. Org can manage source code in an Org document
16031 when the source code is identified with begin and end markers.
16032 Working with source code begins with identifying source code blocks.
16033 A source code block can be placed almost anywhere in an Org document;
16034 it is not restricted to the preamble or the end of the document.
16035 However, Org cannot manage a source code block if it is placed inside
16036 an Org comment or within a fixed width section.
16038 Here is an example source code block in the Emacs Lisp language:
16041 ,#+BEGIN_SRC emacs-lisp
16042 (defun org-xor (a b)
16048 Org can manage the source code in the block delimited by =#+BEGIN_SRC=
16049 ... =#+END_SRC= in several ways that can simplify housekeeping tasks
16050 essential to modern source code maintenance. Org can edit, format,
16051 extract, export, and publish source code blocks. Org can also compile
16052 and execute a source code block, then capture the results. The Org
16053 mode literature sometimes refers to source code blocks as /live code/
16054 blocks because they can alter the content of the Org document or the
16055 material that it exports. Users can control how live they want each
16056 source code block by tweaking the header arguments (see [[*Using
16057 Header Arguments]]) for compiling, execution, extraction, and
16060 Source code blocks are one of many Org block types, which also include
16061 "center", "comment", "dynamic", "example", "export", "quote",
16062 "special", and "verse". This section pertains to blocks between
16063 =#+BEGIN_SRC= and =#+END_SRC=.
16065 For editing and formatting a source code block, Org uses an
16066 appropriate Emacs major mode that includes features specifically
16067 designed for source code in that language.
16069 Org can extract one or more source code blocks and write them to one
16070 or more source files---a process known as /tangling/ in literate
16071 programming terminology.
16073 For exporting and publishing, Org's back-ends can format a source code
16074 block appropriately, often with native syntax highlighting.
16076 For executing and compiling a source code block, the user can
16077 configure Org to select the appropriate compiler. Org provides
16078 facilities to collect the result of the execution or compiler output,
16079 insert it into the Org document, and/or export it. In addition to
16080 text results, Org can insert links to other data types, including
16081 audio, video, and graphics. Org can also link a compiler error
16082 message to the appropriate line in the source code block.
16084 An important feature of Org's management of source code blocks is the
16085 ability to pass variables, functions, and results to one another using
16086 a common syntax for source code blocks in any language. Although most
16087 literate programming facilities are restricted to one language or
16088 another, Org's language-agnostic approach lets the literate programmer
16089 match each programming task with the appropriate computer language and
16090 to mix them all together in a single Org document. This
16091 interoperability among languages explains why Org's source code
16092 management facility was named /Org Babel/ by its originators, Eric
16093 Schulte and Dan Davison.
16095 Org mode fulfills the promise of easy verification and maintenance of
16096 publishing reproducible research by keeping text, data, code,
16097 configuration settings of the execution environment, the results of
16098 the execution, and associated narratives, claims, references, and
16099 internal and external links in a single Org document.
16101 Details of Org's facilities for working with source code are described
16102 in the following sections.
16104 ** Structure of Code Blocks
16106 :DESCRIPTION: Code block syntax described.
16108 #+cindex: code block, structure
16109 #+cindex: source code, block structure
16110 #+cindex: @samp{NAME} keyword, in source blocks
16111 #+cindex: @samp{BEGIN_SRC}
16113 Org offers two ways to structure source code in Org documents: in
16114 a source code block, and directly inline. Both specifications are
16117 A source code block conforms to this structure:
16121 ,#+BEGIN_SRC <language> <switches> <header arguments>
16126 Do not be put-off by having to remember the source block syntax. Org
16127 mode offers a command for wrapping existing text in a block (see
16128 [[*Structure Templates]]). Org also works with other completion systems
16129 in Emacs, some of which predate Org and have custom domain-specific
16130 languages for defining templates. Regular use of templates reduces
16131 errors, increases accuracy, and maintains consistency.
16133 #+cindex: source code, inline
16134 An inline code block conforms to this structure:
16136 : src_<language>{<body>}
16138 #+texinfo: @noindent
16141 : src_<language>[<header arguments>]{<body>}
16143 - =#+NAME: <name>= ::
16145 Optional. Names the source block so it can be called, like
16146 a function, from other source blocks or inline code to evaluate
16147 or to capture the results. Code from other blocks, other files,
16148 and from table formulas (see [[*The Spreadsheet]]) can use the name
16149 to reference a source block. This naming serves the same purpose
16150 as naming Org tables. Org mode requires unique names. For
16151 duplicate names, Org mode's behavior is undefined.
16153 - =#+BEGIN_SRC= ... =#+END_SRC= ::
16155 Mandatory. They mark the start and end of a block that Org
16156 requires. The =#+BEGIN_SRC= line takes additional arguments, as
16161 #+cindex: language, in code blocks
16162 Mandatory. It is the identifier of the source code language in
16163 the block. See [[*Languages]], for identifiers of supported
16168 #+cindex: switches, in code blocks
16169 Optional. Switches provide finer control of the code execution,
16170 export, and format (see the discussion of switches in [[*Literal
16173 - =<header arguments>= ::
16175 #+cindex: header arguments, in code blocks
16176 Optional. Heading arguments control many aspects of evaluation,
16177 export and tangling of code blocks (see [[*Using Header Arguments]]).
16178 Using Org's properties feature, header arguments can be
16179 selectively applied to the entire buffer or specific sub-trees of
16184 Source code in the dialect of the specified language identifier.
16186 ** Using Header Arguments
16188 :DESCRIPTION: Different ways to set header arguments.
16191 Org comes with many header arguments common to all languages. New
16192 header arguments are added for specific languages as they become
16193 available for use in source code blocks. A header argument is
16194 specified with an initial colon followed by the argument's name in
16197 Since header arguments can be set in several ways, Org prioritizes
16198 them in case of overlaps or conflicts by giving local settings
16199 a higher priority. Header values in function calls, for example,
16200 override header values from global defaults.
16202 *** System-wide header arguments
16206 #+vindex: org-babel-default-header-args
16208 #+vindex: org-babel-default-header-args
16209 System-wide values of header arguments can be specified by customizing
16210 the ~org-babel-default-header-args~ variable, which defaults to the
16215 :results => "replace"
16221 The example below sets =:noweb= header arguments to =yes=, which makes
16222 Org expand =:noweb= references by default.
16224 #+begin_src emacs-lisp
16225 (setq org-babel-default-header-args
16226 (cons '(:noweb . "yes")
16227 (assq-delete-all :noweb org-babel-default-header-args)))
16230 #+cindex: language specific default header arguments
16231 #+cindex: default header arguments per language
16232 Each language can have separate default header arguments by
16233 customizing the variable ~org-babel-default-header-args:<LANG>~, where
16234 {{{var(<LANG>)}}} is the name of the language. For details, see the
16235 language-specific online documentation at
16236 https://orgmode.org/worg/org-contrib/babel/.
16238 *** Header arguments in Org mode properties
16243 For header arguments applicable to the buffer, use =PROPERTY= keyword
16244 anywhere in the Org file (see [[*Property Syntax]]).
16246 The following example makes all the R code blocks execute in the same
16247 session. Setting =:results= to =silent= ignores the results of
16248 executions for all blocks, not just R code blocks; no results inserted
16252 ,#+PROPERTY: header-args:R :session *R*
16253 ,#+PROPERTY: header-args :results silent
16256 #+vindex: org-use-property-inheritance
16257 Header arguments set through Org's property drawers (see [[*Property
16258 Syntax]]) apply at the sub-tree level on down. Since these property
16259 drawers can appear anywhere in the file hierarchy, Org uses outermost
16260 call or source block to resolve the values. Org ignores
16261 ~org-use-property-inheritance~ setting.
16263 In this example, =:cache= defaults to =yes= for all code blocks in the
16269 :header-args: :cache yes
16273 #+kindex: C-c C-x p
16274 #+findex: org-set-property
16275 Properties defined through ~org-set-property~ function, bound to
16276 {{{kbd(C-c C-x p)}}}, apply to all active languages. They override
16277 properties set in ~org-babel-default-header-args~.
16279 #+cindex: language specific header arguments properties
16280 #+cindex: header arguments per language
16281 Language-specific header arguments are also read from properties
16282 =header-args:<LANG>= where {{{var(<LANG>)}}} is the language
16283 identifier. For example,
16288 :header-args:clojure: :session *clojure-1*
16289 :header-args:R: :session *R*
16293 :header-args:clojure: :session *clojure-2*
16297 #+texinfo: @noindent
16298 would force separate sessions for Clojure blocks in =Heading= and
16299 =Subheading=, but use the same session for all R blocks. Blocks in
16300 =Subheading= inherit settings from =Heading=.
16302 *** Code block specific header arguments
16307 Header arguments are most commonly set at the source code block level,
16308 on the =#+BEGIN_SRC= line. Arguments set at this level take
16309 precedence over those set in the ~org-babel-default-header-args~
16310 variable, and also those set as header properties.
16312 In the following example, setting =:results= to =silent= makes it
16313 ignore results of the code execution. Setting =:exports= to =code=
16314 exports only the body of the code block to HTML or LaTeX.
16318 ,#+BEGIN_SRC haskell :results silent :exports code :var n=0
16320 fac n = n * fac (n-1)
16324 The same header arguments in an inline code block:
16326 : src_haskell[:exports both]{fac 5}
16328 #+cindex: @samp{HEADER}, keyword
16329 Code block header arguments can span multiple lines using =#+HEADER:=
16330 on each line. Note that Org currently accepts the plural spelling of
16331 =#+HEADER:= only as a convenience for backward-compatibility. It may
16332 be removed at some point.
16334 Multi-line header arguments on an unnamed code block:
16337 ,#+HEADER: :var data1=1
16338 ,#+BEGIN_SRC emacs-lisp :var data2=2
16339 (message "data1:%S, data2:%S" data1 data2)
16346 Multi-line header arguments on a named code block:
16349 ,#+NAME: named-block
16350 ,#+HEADER: :var data=2
16351 ,#+BEGIN_SRC emacs-lisp
16352 (message "data:%S" data)
16355 ,#+RESULTS: named-block
16359 *** Header arguments in function calls
16364 Header arguments in function calls are the most specific and override
16365 all other settings in case of an overlap. They get the highest
16366 priority. Two =#+CALL:= examples are shown below. For the complete
16367 syntax of =CALL= keyword, see [[*Evaluating Code Blocks]].
16369 In this example, =:exports results= header argument is applied to the
16370 evaluation of the =#+CALL:= line.
16372 : #+CALL: factorial(n=5) :exports results
16374 In this example, =:session special= header argument is applied to the
16375 evaluation of =factorial= code block.
16377 : #+CALL: factorial[:session special](n=5)
16379 ** Environment of a Code Block
16381 :DESCRIPTION: Arguments, sessions, working directory...
16384 *** Passing arguments
16389 #+cindex: passing arguments to code blocks
16390 #+cindex: arguments, in code blocks
16391 #+cindex: @samp{var}, header argument
16392 Use =var= for passing arguments to source code blocks. The specifics
16393 of variables in code blocks vary by the source language and are
16394 covered in the language-specific documentation. The syntax for =var=,
16395 however, is the same for all languages. This includes declaring
16396 a variable, and assigning a default value.
16398 The following syntax is used to pass arguments to code blocks using
16399 the =var= header argument.
16403 #+texinfo: @noindent
16404 {{{var(NAME)}}} is the name of the variable bound in the code block
16405 body. {{{var(ASSIGN)}}} is a literal value, such as a string,
16406 a number, a reference to a table, a list, a literal example, another
16407 code block---with or without arguments---or the results of evaluating
16410 Here are examples of passing values by reference:
16414 A table named with a =NAME= keyword.
16417 ,#+NAME: example-table
16423 ,#+NAME: table-length
16424 ,#+BEGIN_SRC emacs-lisp :var table=example-table
16428 ,#+RESULTS: table-length
16432 When passing a table, you can treat specially the row, or the
16433 column, containing labels for the columns, or the rows, in the
16436 #+cindex: @samp{colnames}, header argument
16437 The =colnames= header argument accepts =yes=, =no=, or =nil=
16438 values. The default value is =nil=: if an input table has column
16439 names---because the second row is a horizontal rule---then Org
16440 removes the column names, processes the table, puts back the
16441 column names, and then writes the table to the results block.
16442 Using =yes=, Org does the same to the first row, even if the
16443 initial table does not contain any horizontal rule. When set to
16444 =no=, Org does not pre-process column names at all.
16453 ,#+BEGIN_SRC python :var tab=less-cols :colnames nil
16454 return [[val + '*' for val in row] for row in tab]
16464 #+cindex: @samp{rownames}, header argument
16465 Similarly, the =rownames= header argument can take two values:
16466 =yes= or =no=. When set to =yes=, Org removes the first column,
16467 processes the table, puts back the first column, and then writes
16468 the table to the results block. The default is =no=, which means
16469 Org does not pre-process the first column. Note that Emacs Lisp
16470 code blocks ignore =rownames= header argument because of the ease
16471 of table-handling in Emacs.
16474 ,#+NAME: with-rownames
16475 | one | 1 | 2 | 3 | 4 | 5 |
16476 | two | 6 | 7 | 8 | 9 | 10 |
16478 ,#+BEGIN_SRC python :var tab=with-rownames :rownames yes
16479 return [[val + 10 for val in row] for row in tab]
16483 | one | 11 | 12 | 13 | 14 | 15 |
16484 | two | 16 | 17 | 18 | 19 | 20 |
16489 A simple named list.
16492 ,#+NAME: example-list
16498 ,#+BEGIN_SRC emacs-lisp :var x=example-list
16506 Note that only the top level list items are passed along. Nested
16507 list items are ignored.
16509 - code block without arguments ::
16511 A code block name, as assigned by =NAME= keyword from the example
16512 above, optionally followed by parentheses.
16515 ,#+BEGIN_SRC emacs-lisp :var length=table-length()
16523 - code block with arguments ::
16525 A code block name, as assigned by =NAME= keyword, followed by
16526 parentheses and optional arguments passed within the parentheses.
16530 ,#+BEGIN_SRC emacs-lisp :var input=8
16538 ,#+BEGIN_SRC emacs-lisp :var input=double(input=1)
16542 ,#+RESULTS: squared
16546 - literal example ::
16548 A literal example block named with a =NAME= keyword.
16551 ,#+NAME: literal-example
16557 ,#+NAME: read-literal-example
16558 ,#+BEGIN_SRC emacs-lisp :var x=literal-example
16559 (concatenate #'string x " for you.")
16562 ,#+RESULTS: read-literal-example
16563 : A literal example
16564 : on two lines for you.
16567 Indexing variable values enables referencing portions of a variable.
16568 Indexes are 0 based with negative values counting backwards from the
16569 end. If an index is separated by commas then each subsequent section
16570 indexes as the next dimension. Note that this indexing occurs
16571 /before/ other table-related header arguments are applied, such as
16572 =hlines=, =colnames= and =rownames=. The following example assigns
16573 the last cell of the first row the table =example-table= to the
16577 ,#+NAME: example-table
16583 ,#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
16591 Two integers separated by a colon reference a range of variable
16592 values. In that case the entire inclusive range is referenced. For
16593 example the following assigns the middle three rows of =example-table=
16597 ,#+NAME: example-table
16604 ,#+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
16614 To pick the entire range, use an empty index, or the single character
16615 =*=. =0:-1= does the same thing. Example below shows how to
16616 reference the first column only.
16619 ,#+NAME: example-table
16625 ,#+BEGIN_SRC emacs-lisp :var data=example-table[,0]
16633 Index referencing can be used for tables and code blocks. Index
16634 referencing can handle any number of dimensions. Commas delimit
16635 multiple dimensions, as shown below.
16639 ,#+BEGIN_SRC emacs-lisp
16640 '(((1 2 3) (4 5 6) (7 8 9))
16641 ((10 11 12) (13 14 15) (16 17 18))
16642 ((19 20 21) (22 23 24) (25 26 27)))
16645 ,#+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
16653 Note that row names and column names are not removed prior to variable
16654 indexing. You need to take them into account, even when =colnames= or
16655 =rownames= header arguments remove them.
16657 Emacs lisp code can also set the values for variables. To
16658 differentiate a value from Lisp code, Org interprets any value
16659 starting with =(=, =[=, ='= or =`= as Emacs Lisp code. The result of
16660 evaluating that code is then assigned to the value of that variable.
16661 The following example shows how to reliably query and pass the file
16662 name of the Org mode buffer to a code block using headers. We need
16663 reliability here because the file's name could change once the code in
16664 the block starts executing.
16667 ,#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
16672 Note that values read from tables and lists are not mistakenly
16673 evaluated as Emacs Lisp code, as illustrated in the following example.
16679 ,#+HEADER: :var data=table[0,0]
16693 #+cindex: using sessions in code blocks
16694 #+cindex: @samp{session}, header argument
16695 Two code blocks can share the same environment. The =session= header
16696 argument is for running multiple source code blocks under one session.
16697 Org runs code blocks with the same session name in the same
16698 interpreter process.
16702 Default. Each code block gets a new interpreter process to
16703 execute. The process terminates once the block is evaluated.
16705 - {{{var(STRING)}}} ::
16707 Any string besides =none= turns that string into the name of that
16708 session. For example, =:session STRING= names it =STRING=. If
16709 =session= has no value, then the session name is derived from the
16710 source language identifier. Subsequent blocks with the same
16711 source code language use the same session. Depending on the
16712 language, state variables, code from other blocks, and the
16713 overall interpreted environment may be shared. Some interpreted
16714 languages support concurrent sessions when subsequent source code
16715 language blocks change session names.
16717 Only languages that provide interactive evaluation can have session
16718 support. Not all languages provide this support, such as C and ditaa.
16719 Even languages, such as Python and Haskell, that do support
16720 interactive evaluation impose limitations on allowable language
16721 constructs that can run interactively. Org inherits those limitations
16722 for those code blocks running in a session.
16724 *** Choosing a working directory
16729 #+cindex: working directory, in a code block
16730 #+cindex: @samp{dir}, header argument
16731 The =dir= header argument specifies the default directory during code
16732 block execution. If it is absent, then the directory associated with
16733 the current buffer is used. In other words, supplying =:dir PATH=
16734 temporarily has the same effect as changing the current directory with
16735 {{{kbd(M-x cd PATH)}}}, and then not setting =dir=. Under the
16736 surface, =dir= simply sets the value of the Emacs variable
16737 ~default-directory~.
16739 For example, to save the plot file in the =Work/= folder of the home
16740 directory---notice tilde is expanded:
16743 ,#+BEGIN_SRC R :file myplot.png :dir ~/Work
16744 matplot(matrix(rnorm(100), 10), type="l")
16748 To evaluate the code block on a remote machine, supply a remote
16749 directory name using Tramp syntax. For example:
16752 ,#+BEGIN_SRC R :file plot.png :dir /scp:dand@yakuba.princeton.edu:
16753 plot(1:10, main=system("hostname", intern=TRUE))
16757 Org first captures the text results as usual for insertion in the Org
16758 file. Then Org also inserts a link to the remote file, thanks to
16759 Emacs Tramp. Org constructs the remote path to the file name from
16760 =dir= and ~default-directory~, as illustrated here:
16762 : [[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
16764 When =dir= is used with =session=, Org sets the starting directory for
16765 a new session. But Org does not alter the directory of an already
16768 Do not use =dir= with =:exports results= or with =:exports both= to
16769 avoid Org inserting incorrect links to remote files. That is because
16770 Org does not expand ~default directory~ to avoid some underlying
16771 portability issues.
16773 *** Inserting headers and footers
16778 #+cindex: headers, in code blocks
16779 #+cindex: footers, in code blocks
16780 #+cindex: @samp{prologue}, header argument
16781 The =prologue= header argument is for appending to the top of the code
16782 block for execution, like a reset instruction. For example, you may
16783 use =:prologue "reset"= in a Gnuplot code block or, for every such
16786 #+begin_src emacs-lisp
16787 (add-to-list 'org-babel-default-header-args:gnuplot
16788 '((:prologue . "reset")))
16792 #+cindex: @samp{epilogue}, header argument
16793 Likewise, the value of the =epilogue= header argument is for appending
16794 to the end of the code block for execution.
16796 ** Evaluating Code Blocks
16798 :DESCRIPTION: Place results of evaluation in the Org buffer.
16800 #+cindex: code block, evaluating
16801 #+cindex: source code, evaluating
16802 #+cindex: @samp{RESULTS}, keyword
16804 A note about security: With code evaluation comes the risk of harm.
16805 Org safeguards by prompting for user's permission before executing any
16806 code in the source block. To customize this safeguard, or disable it,
16807 see [[*Code Evaluation and Security Issues]].
16809 *** How to evaluate source code
16814 Org captures the results of the code block evaluation and inserts them
16815 in the Org file, right after the code block. The insertion point is
16816 after a newline and the =RESULTS= keyword. Org creates the =RESULTS=
16817 keyword if one is not already there.
16819 By default, Org enables only Emacs Lisp code blocks for execution.
16820 See [[*Languages]] to enable other languages.
16823 #+kindex: C-c C-v e
16824 #+findex: org-babel-execute-src-block
16825 Org provides many ways to execute code blocks. {{{kbd(C-c C-c)}}} or
16826 {{{kbd(C-c C-v e)}}} with the point on a code block[fn:136] calls the
16827 ~org-babel-execute-src-block~ function, which executes the code in the
16828 block, collects the results, and inserts them in the buffer.
16830 #+cindex: @samp{CALL}, keyword
16831 #+vindex: org-babel-inline-result-wrap
16832 By calling a named code block[fn:137] from an Org mode buffer or
16833 a table. Org can call the named code blocks from the current Org mode
16834 buffer or from the "Library of Babel" (see [[*Library of Babel]]).
16836 The syntax for =CALL= keyword is:
16839 ,#+CALL: <name>(<arguments>)
16840 ,#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
16843 The syntax for inline named code blocks is:
16846 ... call_<name>(<arguments>) ...
16847 ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
16850 When inline syntax is used, the result is wrapped based on the
16851 variable ~org-babel-inline-result-wrap~, which by default is set to
16852 ~"=%s="~ to produce verbatim text suitable for markup.
16856 This is the name of the code block (see [[*Structure of Code
16857 Blocks]]) to be evaluated in the current document. If the block is
16858 located in another file, start =<name>= with the file name
16859 followed by a colon. For example, in order to execute a block
16860 named =clear-data= in =file.org=, you can write the following:
16862 : #+CALL: file.org:clear-data()
16866 Org passes arguments to the code block using standard function
16867 call syntax. For example, a =#+CALL:= line that passes =4= to
16868 a code block named =double=, which declares the header argument
16869 =:var n=2=, would be written as:
16871 : #+CALL: double(n=4)
16873 #+texinfo: @noindent
16874 Note how this function call syntax is different from the header
16877 - =<inside header arguments>= ::
16879 Org passes inside header arguments to the named code block using
16880 the header argument syntax. Inside header arguments apply to
16881 code block evaluation. For example, =[:results output]= collects
16882 results printed to stdout during code execution of that block.
16883 Note how this header argument syntax is different from the
16884 function call syntax.
16886 - =<end header arguments>= ::
16888 End header arguments affect the results returned by the code
16889 block. For example, =:results html= wraps the results in
16890 a =#+BEGIN_EXPORT html= block before inserting the results in the
16893 *** Limit code block evaluation
16898 #+cindex: @samp{eval}, header argument
16899 #+cindex: control code block evaluation
16900 The =eval= header argument can limit evaluation of specific code
16901 blocks and =CALL= keyword. It is useful for protection against
16902 evaluating untrusted code blocks by prompting for a confirmation.
16904 - =never= or =no= ::
16906 Org never evaluates the source code.
16910 Org prompts the user for permission to evaluate the source code.
16912 - =never-export= or =no-export= ::
16914 Org does not evaluate the source code when exporting, yet the
16915 user can evaluate it interactively.
16917 - =query-export= ::
16919 Org prompts the user for permission to evaluate the source code
16922 If =eval= header argument is not set, then Org determines whether to
16923 evaluate the source code from the ~org-confirm-babel-evaluate~
16924 variable (see [[*Code Evaluation and Security Issues]]).
16926 *** Cache results of evaluation
16931 #+cindex: @samp{cache}, header argument
16932 #+cindex: cache results of code evaluation
16933 The =cache= header argument is for caching results of evaluating code
16934 blocks. Caching results can avoid re-evaluating a code block that
16935 have not changed since the previous run. To benefit from the cache
16936 and avoid redundant evaluations, the source block must have a result
16937 already present in the buffer, and neither the header
16938 arguments---including the value of =var= references---nor the text of
16939 the block itself has changed since the result was last computed. This
16940 feature greatly helps avoid long-running calculations. For some edge
16941 cases, however, the cached results may not be reliable.
16943 The caching feature is best for when code blocks are pure functions,
16944 that is functions that return the same value for the same input
16945 arguments (see [[*Environment of a Code Block]]), and that do not have
16946 side effects, and do not rely on external variables other than the
16947 input arguments. Functions that depend on a timer, file system
16948 objects, and random number generators are clearly unsuitable for
16951 A note of warning: when =cache= is used in a session, caching may
16952 cause unexpected results.
16954 When the caching mechanism tests for any source code changes, it does
16955 not expand Noweb style references (see [[*Noweb Reference Syntax]]). For
16956 reasons why, see http://thread.gmane.org/gmane.emacs.orgmode/79046.
16958 The =cache= header argument can have one of two values: =yes= or =no=.
16962 Default. No caching of results; code block evaluated every
16967 Whether to run the code or return the cached results is
16968 determined by comparing the SHA1 hash value of the combined code
16969 block and arguments passed to it. This hash value is packed on
16970 the =#+RESULTS:= line from previous evaluation. When hash values
16971 match, Org does not evaluate the code block. When hash values
16972 mismatch, Org evaluates the code block, inserts the results,
16973 recalculates the hash value, and updates =#+RESULTS:= line.
16975 In this example, both functions are cached. But =caller= runs only if
16976 the result from =random= has changed since the last run.
16980 ,#+BEGIN_SRC R :cache yes
16984 ,#+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
16988 ,#+BEGIN_SRC emacs-lisp :var x=random :cache yes
16992 ,#+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
16996 ** Results of Evaluation
16998 :DESCRIPTION: Choosing a results type, post-processing...
17000 #+cindex: code block, results of evaluation
17001 #+cindex: source code, results of evaluation
17003 #+cindex: @samp{results}, header argument
17004 How Org handles results of a code block execution depends on many
17005 header arguments working together. The primary determinant, however,
17006 is the =results= header argument. It accepts four classes of options.
17007 Each code block can take only one option per class:
17011 For how the results should be collected from the code block;
17015 For which type of result the code block will return; affects how
17016 Org processes and inserts results in the Org buffer;
17020 For the result; affects how Org processes and inserts results in
17025 For processing results after evaluation of the code block;
17032 Collection options specify the results. Choose one of the options;
17033 they are mutually exclusive.
17037 Default. Functional mode. Org gets the value by wrapping the
17038 code in a function definition in the language of the source
17039 block. That is why when using =:results value=, code should
17040 execute like a function and return a value. For languages like
17041 Python, an explicit ~return~ statement is mandatory when using
17042 =:results value=. Result is the value returned by the last
17043 statement in the code block.
17045 When evaluating the code block in a session (see [[*Environment of
17046 a Code Block]]), Org passes the code to an interpreter running as
17047 an interactive Emacs inferior process. Org gets the value from
17048 the source code interpreter's last statement output. Org has to
17049 use language-specific methods to obtain the value. For example,
17050 from the variable ~_~ in Python and Ruby, and the value of
17051 ~.Last.value~ in R.
17055 Scripting mode. Org passes the code to an external process
17056 running the interpreter. Org returns the contents of the
17057 standard output stream as text results.
17059 When using a session, Org passes the code to the interpreter
17060 running as an interactive Emacs inferior process. Org
17061 concatenates any text output from the interpreter and returns the
17062 collection as a result.
17064 Note that this collection is not the same as that would be
17065 collected from stdout of a non-interactive interpreter running as
17066 an external process. Compare for example these two blocks:
17069 ,#+BEGIN_SRC python :results output
17080 In the above non-session mode, the "2" is not printed; so it does
17081 not appear in results.
17084 ,#+BEGIN_SRC python :results output :session
17096 In the above session, the interactive interpreter receives and
17097 prints "2". Results show that.
17104 Type tells what result types to expect from the execution of the code
17105 block. Choose one of the options; they are mutually exclusive. The
17106 default behavior is to automatically determine the result type.
17108 #+attr_texinfo: :sep ,
17109 - =table=, =vector= ::
17111 Interpret the results as an Org table. If the result is a single
17112 value, create a table with one row and one column. Usage
17113 example: =:results value table=.
17115 #+cindex: @samp{hlines}, header argument
17116 In-between each table row or below the table headings, sometimes
17117 results have horizontal lines, which are also known as "hlines".
17118 The =hlines= argument with the default =no= value strips such
17119 lines from the input table. For most code, this is desirable, or
17120 else those =hline= symbols raise unbound variable errors.
17121 A =yes= accepts such lines, as demonstrated in the following
17133 ,#+BEGIN_SRC python :var tab=many-cols :hlines no
17137 ,#+RESULTS: no-hline
17143 ,#+BEGIN_SRC python :var tab=many-cols :hlines yes
17157 Interpret the results as an Org list. If the result is a single
17158 value, create a list of one element.
17160 - =scalar=, =verbatim= ::
17162 Interpret literally and insert as quoted text. Do not create
17163 a table. Usage example: =:results value verbatim=.
17167 Interpret as a filename. Save the results of execution of the
17168 code block to that file, then insert a link to it. You can
17169 control both the filename and the description associated to the
17172 #+cindex: @samp{file}, header argument
17173 #+cindex: @samp{output-dir}, header argument
17174 Org first tries to generate the filename from the value of the
17175 =file= header argument and the directory specified using the
17176 =output-dir= header arguments. If =output-dir= is not specified,
17177 Org assumes it is the current directory.
17180 ,#+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/
17186 #+cindex: @samp{file-ext}, header argument
17187 If =file= is missing, Org generates the base name of the output
17188 file from the name of the code block, and its extension from the
17189 =file-ext= header argument. In that case, both the name and the
17190 extension are mandatory[fn:138].
17194 ,#+BEGIN_SRC asymptote :results value file :file-ext pdf
17200 #+cindex: @samp{file-desc}, header argument
17201 The =file-desc= header argument defines the description (see
17202 [[*Link Format]]) for the link. If =file-desc= has no value, Org
17203 uses the generated file name for both the "link" and
17204 "description" parts of the link.
17206 #+cindex: @samp{sep}, header argument
17207 By default, Org assumes that a table written to a file has
17208 TAB-delimited output. You can choose a different separator with
17209 the =sep= header argument.
17216 Format pertains to the type of the result returned by the code block.
17217 Choose one of the options; they are mutually exclusive. The default
17218 follows from the type specified above.
17220 #+attr_texinfo: :sep ,
17223 Result enclosed in a code block. Useful for parsing. Usage
17224 example: =:results value code=.
17228 Result wrapped in a =RESULTS= drawer. Useful for containing
17229 =raw= or =org= results for later scripting and automated
17230 processing. Usage example: =:results value drawer=.
17234 Results enclosed in a =BEGIN_EXPORT html= block. Usage example:
17235 =:results value html=.
17239 Results enclosed in a =BEGIN_EXPORT latex= block. Usage example:
17240 =:results value latex=.
17242 - =link=, =graphics= ::
17244 Result is a link to the file specified in =:file= header
17245 argument. However, unlike plain =:file=, nothing is written to
17246 the disk. The block is used for its side-effects only, as in the
17250 ,#+begin_src shell :results link :file "download.tar.gz"
17251 wget -c "http://example.com/download.tar.gz"
17257 Results enclosed in a =BEGIN_SRC org= block. For comma-escape,
17258 either {{{kbd(TAB)}}} in the block, or export the file. Usage
17259 example: =:results value org=.
17263 Result converted to pretty-print source code. Enclosed in a code
17264 block. Languages supported: Emacs Lisp, Python, and Ruby. Usage
17265 example: =:results value pp=.
17269 Interpreted as raw Org mode. Inserted directly into the buffer.
17270 Aligned if it is a table. Usage example: =:results value raw=.
17272 #+cindex: @samp{wrap}, header argument
17273 The =wrap= header argument unconditionnally marks the results block by
17274 appending strings to =#+BEGIN_= and =#+END_=. If no string is
17275 specified, Org wraps the results in a =#+BEGIN_results=
17276 ... =#+END_results= block. It takes precedent over the =results=
17277 value listed above. E.g.,
17280 ,#+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown
17281 "<blink>Welcome back to the 90's</blink>"
17285 ,#+BEGIN_EXPORT markdown
17286 <blink>Welcome back to the 90's</blink>
17295 Handling options after collecting the results.
17299 Do not insert results in the Org mode buffer, but echo them in
17300 the minibuffer. Usage example: =:results output silent=.
17304 Default. Insert results in the Org buffer. Remove previous
17305 results. Usage example: =:results output replace=.
17309 Append results to the Org buffer. Latest results are at the
17310 bottom. Does not remove previous results. Usage example:
17311 =:results output append=.
17315 Prepend results to the Org buffer. Latest results are at the
17316 top. Does not remove previous results. Usage example: =:results
17319 *** Post-processing
17324 #+cindex: @samp{post}, header argument
17325 #+cindex: @samp{*this*}, in @samp{post} header argument
17326 The =post= header argument is for post-processing results from block
17327 evaluation. When =post= has any value, Org binds the results to
17328 ~*this*~ variable for easy passing to =var= header argument
17329 specifications (see [[*Environment of a Code Block]]). That makes results
17330 available to other code blocks, or even for direct Emacs Lisp code
17333 The following two examples illustrate =post= header argument in
17334 action. The first one shows how to attach an =ATTR_LATEX= keyword
17339 ,#+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
17340 echo "#+ATTR_LATEX: :width $width"
17344 ,#+HEADER: :file /tmp/it.png
17345 ,#+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer
17355 ,#+ATTR_LATEX :width 5cm
17356 [[file:/tmp/it.png]]
17360 The second example shows use of =colnames= header argument in =post=
17361 to pass data between code blocks.
17365 ,#+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f"
17366 (mapcar (lambda (row)
17367 (mapcar (lambda (cell)
17375 ,#+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*)
17377 data.frame(foo=rnorm(1))
17386 ** Exporting Code Blocks
17388 :DESCRIPTION: Export contents and/or results.
17390 #+cindex: code block, exporting
17391 #+cindex: source code, exporting
17393 It is possible to export the /code/ of code blocks, the /results/ of
17394 code block evaluation, /both/ the code and the results of code block
17395 evaluation, or /none/. Org defaults to exporting /code/ for most
17396 languages. For some languages, such as ditaa, Org defaults to
17397 /results/. To export just the body of code blocks, see [[*Literal
17398 Examples]]. To selectively export sub-trees of an Org document, see
17401 #+cindex: @samp{exports}, header argument
17402 The =exports= header argument is to specify if that part of the Org
17403 file is exported to, say, HTML or LaTeX formats.
17407 The default. The body of code is included into the exported
17408 file. Example: =:exports code=.
17412 The results of evaluation of the code is included in the exported
17413 file. Example: =:exports results=.
17417 Both the code and results of evaluation are included in the
17418 exported file. Example: =:exports both=.
17422 Neither the code nor the results of evaluation is included in the
17423 exported file. Whether the code is evaluated at all depends on
17424 other options. Example: =:exports none=.
17426 #+vindex: org-export-use-babel
17427 To stop Org from evaluating code blocks to speed exports, use the
17428 header argument =:eval never-export= (see [[*Evaluating Code Blocks]]).
17429 To stop Org from evaluating code blocks for greater security, set the
17430 ~org-export-use-babel~ variable to ~nil~, but understand that header
17431 arguments will have no effect.
17433 Turning off evaluation comes in handy when batch processing. For
17434 example, markup languages for wikis, which have a high risk of
17435 untrusted code. Stopping code block evaluation also stops evaluation
17436 of all header arguments of the code block. This may not be desirable
17437 in some circumstances. So during export, to allow evaluation of just
17438 the header arguments but not any code evaluation in the source block,
17439 set =:eval never-export= (see [[*Evaluating Code Blocks]]).
17441 Org never evaluates code blocks in commented sub-trees when exporting
17442 (see [[*Comment Lines]]). On the other hand, Org does evaluate code
17443 blocks in sub-trees excluded from export (see [[*Export Settings]]).
17445 ** Extracting Source Code
17447 :DESCRIPTION: Create pure source code files.
17450 #+cindex: source code, extracting
17451 #+cindex: code block, extracting source code
17453 Extracting source code from code blocks is a basic task in literate
17454 programming. Org has features to make this easy. In literate
17455 programming parlance, documents on creation are /woven/ with code and
17456 documentation, and on export, the code is tangled for execution by
17457 a computer. Org facilitates weaving and tangling for producing,
17458 maintaining, sharing, and exporting literate programming documents.
17459 Org provides extensive customization options for extracting source
17462 When Org tangles code blocks, it expands, merges, and transforms them.
17463 Then Org recomposes them into one or more separate files, as
17464 configured through the options. During this tangling process, Org
17465 expands variables in the source code, and resolves any Noweb style
17466 references (see [[*Noweb Reference Syntax]]).
17468 *** Header arguments
17473 #+cindex: @samp{tangle}, header argument
17474 The =tangle= header argument specifies if the code block is exported
17479 Export the code block to source file. The file name for the
17480 source file is derived from the name of the Org file, and the
17481 file extension is derived from the source code language
17482 identifier. Example: =:tangle yes=.
17486 The default. Do not extract the code in a source code file.
17487 Example: =:tangle no=.
17489 - {{{var(FILENAME)}}} ::
17491 Export the code block to source file whose file name is derived
17492 from any string passed to the =tangle= header argument. Org
17493 derives the file name as being relative to the directory of the
17494 Org file's location. Example: =:tangle FILENAME=.
17496 #+cindex: @samp{mkdirp}, header argument
17497 The =mkdirp= header argument creates parent directories for tangled
17498 files if the directory does not exist. =yes= enables directory
17499 creation and =no= inhibits directory creation.
17501 #+cindex: @samp{comments}, header argument
17502 The =comments= header argument controls inserting comments into
17503 tangled files. These are above and beyond whatever comments may
17504 already exist in the code block.
17508 The default. Do not insert any extra comments during tangling.
17512 Wrap the code block in comments. Include links pointing back to
17513 the place in the Org file from where the code was tangled.
17517 Kept for backward compatibility; same as =link=.
17521 Nearest headline text from Org file is inserted as comment. The
17522 exact text that is inserted is picked from the leading context of
17527 Includes both =link= and =org= options.
17531 Includes =link= option, expands Noweb references (see [[*Noweb
17532 Reference Syntax]]), and wraps them in link comments inside the
17533 body of the code block.
17535 #+cindex: @samp{padline}, header argument
17536 The =padline= header argument controls insertion of newlines to pad
17537 source code in the tangled file.
17541 Default. Insert a newline before and after each code block in
17546 Do not insert newlines to pad the tangled code blocks.
17548 #+cindex: @samp{shebang}, header argument
17549 The =shebang= header argument can turn results into executable script
17550 files. By setting it to a string value---for example, =:shebang
17551 "#!/bin/bash"=---Org inserts that string as the first line of the
17552 tangled file that the code block is extracted to. Org then turns on
17553 the tangled file's executable permission.
17555 #+cindex: @samp{tangle-mode}, header argument
17556 The =tangle-mode= header argument specifies what permissions to set
17557 for tangled files by ~set-file-modes~. For example, to make
17558 a read-only tangled file, use =:tangle-mode (identity #o444)=. To
17559 make it executable, use =:tangle-mode (identity #o755)=. It also
17560 overrides executable permission granted by =shebang=. When multiple
17561 source code blocks tangle to a single file with different and
17562 conflicting =tangle-mode= header arguments, Org's behavior is
17565 #+cindex: @samp{no-expand}, header argument
17566 By default Org expands code blocks during tangling. The =no-expand=
17567 header argument turns off such expansions. Note that one side-effect
17568 of expansion by ~org-babel-expand-src-block~ also assigns values (see
17569 [[*Environment of a Code Block]]) to variables. Expansions also replace
17570 Noweb references with their targets (see [[*Noweb Reference Syntax]]).
17571 Some of these expansions may cause premature assignment, hence this
17572 option. This option makes a difference only for tangling. It has no
17573 effect when exporting since code blocks for execution have to be
17581 - ~org-babel-tangle~ ::
17583 #+findex: org-babel-tangle
17584 #+kindex: C-c C-v t
17585 Tangle the current file. Bound to {{{kbd(C-c C-v t)}}}.
17587 With prefix argument only tangle the current code block.
17589 - ~org-babel-tangle-file~ ::
17591 #+findex: org-babel-tangle-file
17592 #+kindex: C-c C-v f
17593 Choose a file to tangle. Bound to {{{kbd(C-c C-v f)}}}.
17600 - ~org-babel-post-tangle-hook~ ::
17602 #+vindex: org-babel-post-tangle-hook
17603 This hook is run from within code files tangled by
17604 ~org-babel-tangle~, making it suitable for post-processing,
17605 compilation, and evaluation of code in the tangled files.
17607 *** Jumping between code and Org
17612 #+findex: org-babel-tangle-jump-to-org
17613 Debuggers normally link errors and messages back to the source code.
17614 But for tangled files, we want to link back to the Org file, not to
17615 the tangled source file. To make this extra jump, Org uses
17616 ~org-babel-tangle-jump-to-org~ function with two additional source
17617 code block header arguments:
17619 1. Set =padline= to true---this is the default setting.
17620 2. Set =comments= to =link=, which makes Org insert links to the Org
17625 :DESCRIPTION: List of supported code block languages.
17627 #+cindex: babel, languages
17628 #+cindex: source code, languages
17629 #+cindex: code block, languages
17631 Code blocks in the following languages are supported.
17633 #+attr_texinfo: :columns 0.20 0.35 0.20 0.20
17634 | Language | Identifier | Language | Identifier |
17635 |------------+---------------+---------------+--------------|
17636 | Asymptote | =asymptote= | Lua | =lua= |
17637 | Awk | =awk= | MATLAB | =matlab= |
17638 | C | =C= | Mscgen | =mscgen= |
17639 | C++ | =C++=[fn:139] | OCaml | =ocaml= |
17640 | Clojure | =clojure= | Octave | =octave= |
17641 | CSS | =css= | Org mode | =org= |
17642 | D | =D=[fn:140] | Oz | =oz= |
17643 | ditaa | =ditaa= | Perl | =perl= |
17644 | Emacs Calc | =calc= | Plantuml | =plantuml= |
17645 | Emacs Lisp | =emacs-lisp= | Processing.js | =processing= |
17646 | Fortran | =fortran= | Python | =python= |
17647 | Gnuplot | =gnuplot= | R | =R= |
17648 | GNU Screen | =screen= | Ruby | =ruby= |
17649 | Graphviz | =dot= | Sass | =sass= |
17650 | Haskell | =haskell= | Scheme | =scheme= |
17651 | Java | =java= | Sed | =sed= |
17652 | Javascript | =js= | shell | =sh= |
17653 | LaTeX | =latex= | SQL | =sql= |
17654 | Ledger | =ledger= | SQLite | =sqlite= |
17655 | Lilypond | =lilypond= | Vala | =vala= |
17656 | Lisp | =lisp= | | |
17658 Additional documentation for some languages is at
17659 https://orgmode.org/worg/org-contrib/babel/languages.html.
17661 #+vindex: org-babel-load-languages
17662 By default, only Emacs Lisp is enabled for evaluation. To enable or
17663 disable other languages, customize the ~org-babel-load-languages~
17664 variable either through the Emacs customization interface, or by
17665 adding code to the init file as shown next.
17667 In this example, evaluation is disabled for Emacs Lisp, and enabled
17670 #+begin_src emacs-lisp
17671 (org-babel-do-load-languages
17672 'org-babel-load-languages
17673 '((emacs-lisp . nil)
17677 Note that this is not the only way to enable a language. Org also
17678 enables languages when loaded with ~require~ statement. For example,
17679 the following enables execution of Clojure code blocks:
17681 #+begin_src emacs-lisp
17682 (require 'ob-clojure)
17685 ** Editing Source Code
17687 :DESCRIPTION: Language major-mode editing.
17689 #+cindex: code block, editing
17690 #+cindex: source code, editing
17693 Use {{{kbd(C-c ')}}} to edit the current code block. It opens a new
17694 major-mode edit buffer containing the body of the source code block,
17695 ready for any edits. Use {{{kbd(C-c ')}}} again to close the buffer
17696 and return to the Org buffer.
17699 #+vindex: org-edit-src-auto-save-idle-delay
17700 #+cindex: auto-save, in code block editing
17701 {{{kbd(C-x C-s)}}} saves the buffer and updates the contents of the
17702 Org buffer. Set ~org-edit-src-auto-save-idle-delay~ to save the base
17703 buffer after a certain idle delay time. Set
17704 ~org-edit-src-turn-on-auto-save~ to auto-save this buffer into
17705 a separate file using Auto-save mode.
17707 While editing the source code in the major mode, the Org Src minor
17708 mode remains active. It provides these customization variables as
17709 described below. For even more variables, look in the customization
17710 group ~org-edit-structure~.
17712 - ~org-src-lang-modes~ ::
17714 #+vindex: org-src-lang-modes
17715 If an Emacs major-mode named ~<LANG>-mode~ exists, where
17716 {{{var(<LANG>)}}} is the language identifier from code block's
17717 header line, then the edit buffer uses that major mode. Use this
17718 variable to arbitrarily map language identifiers to major modes.
17720 - ~org-src-window-setup~ ::
17722 #+vindex: org-src-window-setup
17723 For specifying Emacs window arrangement when the new edit buffer
17726 - ~org-src-preserve-indentation~ ::
17728 #+cindex: indentation, in code blocks
17729 #+vindex: org-src-preserve-indentation
17730 Default is ~nil~. Source code is indented. This indentation
17731 applies during export or tangling, and depending on the context,
17732 may alter leading spaces and tabs. When non-~nil~, source code
17733 is aligned with the leftmost column. No lines are modified
17734 during export or tangling, which is very useful for white-space
17735 sensitive languages, such as Python.
17737 - ~org-src-ask-before-returning-to-edit-buffer~ ::
17739 #+vindex: org-src-ask-before-returning-to-edit-buffer
17740 When ~nil~, Org returns to the edit buffer without further
17741 prompts. The default prompts for a confirmation.
17743 #+vindex: org-src-fontify-natively
17744 #+vindex: org-src-block-faces
17745 Set ~org-src-fontify-natively~ to non-~nil~ to turn on native code
17746 fontification in the /Org/ buffer. Fontification of code blocks can
17747 give visual separation of text and code on the display page. To
17748 further customize the appearance of ~org-block~ for specific
17749 languages, customize ~org-src-block-faces~. The following example
17750 shades the background of regular blocks, and colors source blocks only
17751 for Python and Emacs Lisp languages.
17753 #+begin_src emacs-lisp
17755 (set-face-attribute 'org-block nil :background
17757 (face-attribute 'default :background) 3))
17759 (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
17760 ("python" (:background "#E5FFB8"))))
17763 ** Noweb Reference Syntax
17765 :DESCRIPTION: Literate programming in Org mode.
17767 #+cindex: code block, Noweb reference
17768 #+cindex: syntax, Noweb
17769 #+cindex: source code, Noweb reference
17771 Org supports named blocks in Noweb[fn:141] style syntax:
17773 : <<CODE-BLOCK-ID>>
17775 Org can replace the construct with the source code, or the results of
17776 evaluation, of the code block identified as {{{var(CODE-BLOCK-ID)}}}.
17778 #+cindex: @samp{noweb}, header argument
17779 The =noweb= header argument controls expansion of Noweb syntax
17780 references. Expansions occur when source code blocks are evaluated,
17781 tangled, or exported.
17785 Default. No expansion of Noweb syntax references in the body of
17786 the code when evaluating, tangling, or exporting.
17790 Expansion of Noweb syntax references in the body of the code
17791 block when evaluating, tangling, or exporting.
17795 Expansion of Noweb syntax references in the body of the code
17796 block when tangling. No expansion when evaluating or exporting.
17800 Expansion of Noweb syntax references in the body of the code
17801 block when evaluating or tangling. No expansion when exporting.
17803 - =strip-export= ::
17805 Expansion of Noweb syntax references in the body of the code
17806 block when expanding prior to evaluating or tangling. Removes
17807 Noweb syntax references when exporting.
17811 Expansion of Noweb syntax references in the body of the code
17812 block only before evaluating.
17814 In the following example,
17817 ,#+NAME: initialization
17818 ,#+BEGIN_SRC emacs-lisp
17819 (setq sentence "Never a foot too far, even.")
17822 ,#+BEGIN_SRC emacs-lisp :noweb yes
17828 #+texinfo: @noindent
17829 the second code block is expanded as
17832 ,#+BEGIN_SRC emacs-lisp :noweb yes
17833 (setq sentence "Never a foot too far, even.")
17838 Noweb insertions honor prefix characters that appear before the Noweb
17839 syntax reference. This behavior is illustrated in the following
17840 example. Because the =<<example>>= Noweb reference appears behind the
17841 SQL comment syntax, each line of the expanded Noweb reference is
17848 multi-line body of example
17852 #+texinfo: @noindent
17856 ,#+BEGIN_SRC sql :noweb yes
17861 #+texinfo: @noindent
17865 ,#+BEGIN_SRC sql :noweb yes
17867 ---multi-line body of example
17871 Since this change does not affect Noweb replacement text without
17872 newlines in them, inline Noweb references are acceptable.
17874 This feature can also be used for management of indentation in
17875 exported code snippets. With:
17879 ,#+BEGIN_SRC python :exports none
17880 print('do things when true')
17884 ,#+begin_src python :exports none
17885 print('do things when false')
17889 #+texinfo: @noindent
17893 ,#+begin_src python :noweb yes :results output
17901 #+texinfo: @noindent
17906 print('do things when true')
17908 print('do things when false')
17911 #+cindex: @samp{noweb-ref}, header argument
17912 When expanding Noweb style references, Org concatenates code blocks by
17913 matching the reference name to either the code block name or, if none
17914 is found, to the =noweb-ref= header argument.
17916 For simple concatenation, set this =noweb-ref= header argument at the
17917 sub-tree or file level. In the example Org file shown next, the body
17918 of the source code in each block is extracted for concatenation to
17919 a pure code file when tangled.
17922 ,#+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
17925 ,* the mount point of the fullest disk
17927 :header-args: :noweb-ref fullest-disk
17930 ,** query all mounted disks
17935 ,** strip the header row
17940 ,** output mount point of fullest disk
17942 |awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}'
17946 #+cindex: @samp{noweb-sep}, header argument
17947 By default a newline separates each noweb reference concatenation. To
17948 change this newline separator, edit the =noweb-sep= header argument.
17950 Eventually, Org can include the results of a code block rather than
17951 its body. To that effect, append parentheses, possibly including
17952 arguments, to the code block name, as shown below.
17954 : <<code-block-name(optional arguments)>>
17956 Note that when using the above approach to a code block's results, the
17957 code block name set by =NAME= keyword is required; the reference set
17958 by =noweb-ref= does not work in that case.
17960 Here is an example that demonstrates how the exported content changes
17961 when Noweb style references are used with parentheses versus without.
17966 ,#+BEGIN_SRC python :var num=0 :results output :exports none
17971 #+texinfo: @noindent
17975 ,#+BEGIN_SRC text :noweb yes
17980 #+texinfo: @noindent
17985 Below, a similar Noweb style reference is used, but with parentheses,
17986 while setting a variable =num= to 10:
17989 ,#+BEGIN_SRC text :noweb yes
17990 <<some-code(num=10)>>
17994 #+texinfo: @noindent
17995 Note that now the expansion contains the results of the code block
17996 =some-code=, not the code block itself:
18000 ** Library of Babel
18002 :DESCRIPTION: Use and contribute to a library of useful code blocks.
18004 #+cindex: babel, library of
18005 #+cindex: source code, library
18006 #+cindex: code block, library
18008 The "Library of Babel" is a collection of code blocks. Like
18009 a function library, these code blocks can be called from other Org
18010 files. A collection of useful code blocks is available on [[https://orgmode.org/worg/library-of-babel.html][Worg]]. For
18011 remote code block evaluation syntax, see [[*Evaluating Code Blocks]].
18013 #+kindex: C-c C-v i
18014 #+findex: org-babel-lob-ingest
18015 For any user to add code to the library, first save the code in
18016 regular code blocks of an Org file, and then load the Org file with
18017 ~org-babel-lob-ingest~, which is bound to {{{kbd(C-c C-v i)}}}.
18019 ** Key bindings and Useful Functions
18021 :DESCRIPTION: Work quickly with code blocks.
18023 #+cindex: code block, key bindings
18025 Many common Org mode key sequences are re-bound depending on
18028 Active key bindings in code blocks:
18031 #+findex: org-babel-execute-src-block
18033 #+findex: org-babel-open-src-block-result
18035 #+findex: org-babel-load-in-session
18037 #+findex: org-babel-pop-to-session
18038 #+attr_texinfo: :columns 0.2 0.55
18039 | Key binding | Function |
18040 |--------------------+-----------------------------------|
18041 | {{{kbd(C-c C-c)}}} | ~org-babel-execute-src-block~ |
18042 | {{{kbd(C-c C-o)}}} | ~org-babel-open-src-block-result~ |
18043 | {{{kbd(M-UP)}}} | ~org-babel-load-in-session~ |
18044 | {{{kbd(M-DOWN)}}} | ~org-babel-pop-to-session~ |
18046 Active key bindings in Org mode buffer:
18048 #+kindex: C-c C-v p
18049 #+kindex: C-c C-v C-p
18050 #+kindex: C-c C-v n
18051 #+kindex: C-c C-v C-n
18052 #+kindex: C-c C-v e
18053 #+kindex: C-c C-v C-e
18054 #+kindex: C-c C-v o
18055 #+kindex: C-c C-v C-o
18056 #+kindex: C-c C-v v
18057 #+kindex: C-c C-v C-v
18058 #+kindex: C-c C-v u
18059 #+kindex: C-c C-v C-u
18060 #+kindex: C-c C-v g
18061 #+kindex: C-c C-v C-g
18062 #+kindex: C-c C-v r
18063 #+kindex: C-c C-v C-r
18064 #+kindex: C-c C-v b
18065 #+kindex: C-c C-v C-b
18066 #+kindex: C-c C-v s
18067 #+kindex: C-c C-v C-s
18068 #+kindex: C-c C-v d
18069 #+kindex: C-c C-v C-d
18070 #+kindex: C-c C-v t
18071 #+kindex: C-c C-v C-t
18072 #+kindex: C-c C-v f
18073 #+kindex: C-c C-v C-f
18074 #+kindex: C-c C-v c
18075 #+kindex: C-c C-v C-c
18076 #+kindex: C-c C-v j
18077 #+kindex: C-c C-v C-j
18078 #+kindex: C-c C-v l
18079 #+kindex: C-c C-v C-l
18080 #+kindex: C-c C-v i
18081 #+kindex: C-c C-v C-i
18082 #+kindex: C-c C-v I
18083 #+kindex: C-c C-v C-I
18084 #+kindex: C-c C-v z
18085 #+kindex: C-c C-v C-z
18086 #+kindex: C-c C-v a
18087 #+kindex: C-c C-v C-a
18088 #+kindex: C-c C-v h
18089 #+kindex: C-c C-v C-h
18090 #+kindex: C-c C-v x
18091 #+kindex: C-c C-v C-x
18092 #+findex: org-babel-previous-src-block
18093 #+findex: org-babel-next-src-block
18094 #+findex: org-babel-execute-maybe
18095 #+findex: org-babel-open-src-block-result
18096 #+findex: org-babel-expand-src-block
18097 #+findex: org-babel-goto-src-block-head
18098 #+findex: org-babel-goto-named-src-block
18099 #+findex: org-babel-goto-named-result
18100 #+findex: org-babel-execute-buffer
18101 #+findex: org-babel-execute-subtree
18102 #+findex: org-babel-demarcate-block
18103 #+findex: org-babel-tangle
18104 #+findex: org-babel-tangle-file
18105 #+findex: org-babel-check-src-block
18106 #+findex: org-babel-insert-header-arg
18107 #+findex: org-babel-load-in-session
18108 #+findex: org-babel-lob-ingest
18109 #+findex: org-babel-view-src-block-info
18110 #+findex: org-babel-switch-to-session-with-code
18111 #+findex: org-babel-sha1-hash
18112 #+findex: org-babel-describe-bindings
18113 #+findex: org-babel-do-key-sequence-in-edit-buffer
18114 #+attr_texinfo: :columns 0.45 0.55
18115 | Key binding | Function |
18116 |------------------------------------------------+--------------------------------------------|
18117 | {{{kbd(C-c C-v p)}}} or {{{kbd(C-c C-v C-p)}}} | ~org-babel-previous-src-block~ |
18118 | {{{kbd(C-c C-v n)}}} or {{{kbd(C-c C-v C-n)}}} | ~org-babel-next-src-block~ |
18119 | {{{kbd(C-c C-v e)}}} or {{{kbd(C-c C-v C-e)}}} | ~org-babel-execute-maybe~ |
18120 | {{{kbd(C-c C-v o)}}} or {{{kbd(C-c C-v C-o)}}} | ~org-babel-open-src-block-result~ |
18121 | {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} | ~org-babel-expand-src-block~ |
18122 | {{{kbd(C-c C-v u)}}} or {{{kbd(C-c C-v C-u)}}} | ~org-babel-goto-src-block-head~ |
18123 | {{{kbd(C-c C-v g)}}} or {{{kbd(C-c C-v C-g)}}} | ~org-babel-goto-named-src-block~ |
18124 | {{{kbd(C-c C-v r)}}} or {{{kbd(C-c C-v C-r)}}} | ~org-babel-goto-named-result~ |
18125 | {{{kbd(C-c C-v b)}}} or {{{kbd(C-c C-v C-b)}}} | ~org-babel-execute-buffer~ |
18126 | {{{kbd(C-c C-v s)}}} or {{{kbd(C-c C-v C-s)}}} | ~org-babel-execute-subtree~ |
18127 | {{{kbd(C-c C-v d)}}} or {{{kbd(C-c C-v C-d)}}} | ~org-babel-demarcate-block~ |
18128 | {{{kbd(C-c C-v t)}}} or {{{kbd(C-c C-v C-t)}}} | ~org-babel-tangle~ |
18129 | {{{kbd(C-c C-v f)}}} or {{{kbd(C-c C-v C-f)}}} | ~org-babel-tangle-file~ |
18130 | {{{kbd(C-c C-v c)}}} or {{{kbd(C-c C-v C-c)}}} | ~org-babel-check-src-block~ |
18131 | {{{kbd(C-c C-v j)}}} or {{{kbd(C-c C-v C-j)}}} | ~org-babel-insert-header-arg~ |
18132 | {{{kbd(C-c C-v l)}}} or {{{kbd(C-c C-v C-l)}}} | ~org-babel-load-in-session~ |
18133 | {{{kbd(C-c C-v i)}}} or {{{kbd(C-c C-v C-i)}}} | ~org-babel-lob-ingest~ |
18134 | {{{kbd(C-c C-v I)}}} or {{{kbd(C-c C-v C-I)}}} | ~org-babel-view-src-block-info~ |
18135 | {{{kbd(C-c C-v z)}}} or {{{kbd(C-c C-v C-z)}}} | ~org-babel-switch-to-session-with-code~ |
18136 | {{{kbd(C-c C-v a)}}} or {{{kbd(C-c C-v C-a)}}} | ~org-babel-sha1-hash~ |
18137 | {{{kbd(C-c C-v h)}}} or {{{kbd(C-c C-v C-h)}}} | ~org-babel-describe-bindings~ |
18138 | {{{kbd(C-c C-v x)}}} or {{{kbd(C-c C-v C-x)}}} | ~org-babel-do-key-sequence-in-edit-buffer~ |
18142 :DESCRIPTION: Call functions from the command line.
18144 #+cindex: code block, batch execution
18145 #+cindex: source code, batch execution
18147 Org mode features, including working with source code facilities can
18148 be invoked from the command line. This enables building shell scripts
18149 for batch processing, running automated system tasks, and expanding
18150 Org mode's usefulness.
18152 The sample script shows batch processing of multiple files using
18153 ~org-babel-tangle~.
18157 # Tangle files with Org mode
18159 emacs -Q --batch --eval "
18161 (require 'ob-tangle)
18162 (dolist (file command-line-args-left)
18163 (with-current-buffer (find-file-noselect file)
18164 (org-babel-tangle))))
18170 :DESCRIPTION: All the rest which did not fit elsewhere.
18175 :DESCRIPTION: M-@key{TAB} guesses completions.
18177 #+cindex: completion, of @TeX{} symbols
18178 #+cindex: completion, of TODO keywords
18179 #+cindex: completion, of dictionary words
18180 #+cindex: completion, of option keywords
18181 #+cindex: completion, of tags
18182 #+cindex: completion, of property keys
18183 #+cindex: completion, of link abbreviations
18184 #+cindex: @TeX{} symbol completion
18185 #+cindex: TODO keywords completion
18186 #+cindex: dictionary word completion
18187 #+cindex: option keyword completion
18188 #+cindex: tag completion
18189 #+cindex: link abbreviations, completion of
18191 Org has in-buffer completions. Unlike minibuffer completions, which
18192 are useful for quick command interactions, Org's in-buffer completions
18193 are more suitable for content creation in Org documents. Type one or
18194 more letters and invoke the hot key to complete the text in-place.
18195 Depending on the context and the keys, Org offers different types of
18196 completions. No minibuffer is involved. Such mode-specific hot keys
18197 have become an integral part of Emacs and Org provides several
18200 - {{{kbd(M-TAB)}}} ::
18203 Complete word at point.
18205 - At the beginning of a headline, complete TODO keywords.
18207 - After =\=, complete TeX symbols supported by the exporter.
18209 - After =*=, complete headlines in the current buffer so that
18210 they can be used in search links like:
18212 : [[*find this headline]]
18214 - After =:= in a headline, complete tags. Org deduces the list
18215 of tags from the =TAGS= in-buffer option (see [[*Setting Tags]]),
18216 the variable ~org-tag-alist~, or from all tags used in the
18219 - After =:= and not in a headline, complete property keys. The
18220 list of keys is constructed dynamically from all keys used in
18221 the current buffer.
18223 - After =[=, complete link abbreviations (see [[*Link
18226 - After =#+=, complete the special keywords like =TYP_TODO= or
18227 file-specific =OPTIONS=. After option keyword is complete,
18228 pressing {{{kbd(M-TAB)}}} again inserts example settings for
18231 - After =STARTUP= keyword, complete startup items.
18233 - When point is anywhere else, complete dictionary words using
18236 ** Structure Templates
18238 :DESCRIPTION: Quick insertion of structural elements.
18240 #+cindex: template insertion
18241 #+cindex: insertion, of templates
18243 With just a few keystrokes, it is possible to insert empty structural
18244 blocks, such as =#+BEGIN_SRC= ... =#+END_SRC=, or to wrap existing
18245 text in such a block.
18247 - {{{kbd(C-c C-\,)}}} (~org-insert-structure-template~) ::
18249 #+findex: org-insert-structure-template
18251 Prompt for a type of block structure, and insert the block at
18252 point. If the region is active, it is wrapped in the block.
18253 First prompts the user for keys, which are used to look up
18254 a structure type from the variable below. If the key is
18255 {{{kbd(TAB)}}}, {{{kbd(RET)}}}, or {{{kbd(SPC)}}}, the user is
18256 prompted to enter a block type.
18258 #+vindex: org-structure-template-alist
18259 Available structure types are defined in
18260 ~org-structure-template-alist~, see the docstring for adding or
18264 #+cindex: template expansion
18265 #+cindex: insertion, of templates
18266 #+vindex: org-tempo-keywords-alist
18267 Org Tempo expands snippets to structures defined in
18268 ~org-structure-template-alist~ and ~org-tempo-keywords-alist~. For
18269 example, {{{kbd(< s TAB)}}} creates a code block. Enable it by
18270 customizing ~org-modules~ or add ~(require 'org-tempo)~ to your Emacs
18273 #+attr_texinfo: :columns 0.1 0.9
18274 | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= |
18275 | {{{kbd(c)}}} | =#+BEGIN_CENTER= ... =#+END_CENTER= |
18276 | {{{kbd(C)}}} | =#+BEGIN_COMMENT= ... =#+END_COMMENT= |
18277 | {{{kbd(e)}}} | =#+BEGIN_EXAMPLE= ... =#+END_EXAMPLE= |
18278 | {{{kbd(E)}}} | =#+BEGIN_EXPORT= ... =#+END_EXPORT= |
18279 | {{{kbd(h)}}} | =#+BEGIN_EXPORT html= ... =#+END_EXPORT= |
18280 | {{{kbd(l)}}} | =#+BEGIN_EXPORT latex= ... =#+END_EXPORT= |
18281 | {{{kbd(q)}}} | =#+BEGIN_QUOTE= ... =#+END_QUOTE= |
18282 | {{{kbd(s)}}} | =#+BEGIN_SRC= ... =#+END_SRC= |
18283 | {{{kbd(v)}}} | =#+BEGIN_VERSE= ... =#+END_VERSE= |
18285 ** Escape Character
18287 #+cindex: escape character
18288 #+cindex: zero width space
18289 You may sometimes want to write text that looks like Org syntax, but
18290 should really read as plain text. Org may use a specific escape
18291 character in some situations, e.g., a backslash in macros (see [[*Macro
18292 Replacement]]). In the general case, however, we suggest to use the
18293 zero width space. You can get it with one of the following:
18295 : C-x 8 <RET> zero width space <RET>
18296 : C-x 8 <RET> 200B <RET>
18298 For example, in order to write =[[1,2]]= as-is in your document, you can
18299 write this, where =X= denotes the zero width space character:
18305 :DESCRIPTION: Electric commands at the beginning of a headline.
18307 #+cindex: speed keys
18309 Single keystrokes can execute custom commands in an Org file when
18310 point is on a headline. Without the extra burden of a meta or
18311 modifier key, Speed Keys can speed navigation or execute custom
18312 commands. Besides faster navigation, Speed Keys may come in handy on
18313 small mobile devices that do not have full keyboards. Speed Keys may
18314 also work on TTY devices known for their problems when entering Emacs
18317 #+vindex: org-use-speed-commands
18318 By default, Org has Speed Keys disabled. To activate Speed Keys, set
18319 the variable ~org-use-speed-commands~ to a non-~nil~ value. To
18320 trigger a Speed Key, point must be at the beginning of an Org
18321 headline, before any of the stars.
18323 #+vindex: org-speed-commands-user
18324 #+findex: org-speed-command-help
18325 Org comes with a pre-defined list of Speed Keys. To add or modify
18326 Speed Keys, customize the variable, ~org-speed-commands-user~. For
18327 more details, see the variable's docstring. With Speed Keys
18328 activated, {{{kbd(M-x org-speed-command-help)}}}, or {{{kbd(?)}}} when
18329 point is at the beginning of an Org headline, shows currently active
18330 Speed Keys, including the user-defined ones.
18332 ** Code Evaluation and Security Issues
18334 :DESCRIPTION: Org files evaluate in-line code.
18335 :ALT_TITLE: Code Evaluation Security
18338 Unlike plain text, running code comes with risk. Each source code
18339 block, in terms of risk, is equivalent to an executable file. Org
18340 therefore puts a few confirmation prompts by default. This is to
18341 alert the casual user from accidentally running untrusted code.
18343 For users who do not run code blocks or write code regularly, Org's
18344 default settings should suffice. However, some users may want to
18345 tweak the prompts for fewer interruptions. To weigh the risks of
18346 automatic execution of code blocks, here are some details about code
18349 Org evaluates code in the following circumstances:
18351 - /Source code blocks/ ::
18353 Org evaluates source code blocks in an Org file during export.
18354 Org also evaluates a source code block with the {{{kbd(C-c
18355 C-c)}}} key chord. Users exporting or running code blocks must
18356 load files only from trusted sources. Be wary of customizing
18357 variables that remove or alter default security measures.
18359 #+attr_texinfo: :options org-confirm-babel-evaluate
18361 When ~t~, Org prompts the user for confirmation before executing
18362 each code block. When ~nil~, Org executes code blocks without
18363 prompting the user for confirmation. When this option is set to
18364 a custom function, Org invokes the function with these two
18365 arguments: the source code language and the body of the code
18366 block. The custom function must return either a ~t~ or ~nil~,
18367 which determines if the user is prompted. Each source code
18368 language can be handled separately through this function
18372 For example, here is how to execute ditaa code blocks without
18375 #+begin_src emacs-lisp
18376 (defun my-org-confirm-babel-evaluate (lang body)
18377 (not (string= lang "ditaa"))) ;don't ask for ditaa
18378 (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
18381 - /Following =shell= and =elisp= links/ ::
18383 Org has two link types that can directly evaluate code (see
18384 [[*External Links]]). Because such code is not visible, these links
18385 have a potential risk. Org therefore prompts the user when it
18386 encounters such links. The customization variables are:
18388 #+attr_texinfo: :options org-confirm-shell-link-function
18390 Function that prompts the user before executing a shell link.
18393 #+attr_texinfo: :options org-confirm-elisp-link-function
18395 Function that prompts the user before executing an Emacs Lisp link.
18398 - /Formulas in tables/ ::
18400 Formulas in tables (see [[*The Spreadsheet]]) are code that is
18401 evaluated either by the Calc interpreter, or by the Emacs Lisp
18406 :DESCRIPTION: Adapting Org to your taste.
18408 #+cindex: customization
18409 #+cindex: options, for customization
18410 #+cindex: variables, for customization
18412 Org has more than 500 variables for customization. They can be
18413 accessed through the usual {{{kbd(M-x org-customize)}}} command. Or
18414 through the Org menu: Org \rarr Customization \rarr Browse Org Group.
18416 Org also has per-file settings for some variables (see [[*Summary of
18417 In-Buffer Settings]]).
18419 ** Summary of In-Buffer Settings
18421 :DESCRIPTION: Overview of keywords.
18422 :ALT_TITLE: In-buffer Settings
18424 #+cindex: in-buffer settings
18425 #+cindex: special keywords
18427 In-buffer settings start with =#+=, followed by a keyword, a colon,
18428 and then a word for each setting. Org accepts multiple settings on
18429 the same line. Org also accepts multiple lines for a keyword. This
18430 manual describes these settings throughout. A summary follows here.
18432 #+cindex: refresh set-up
18433 {{{kbd(C-c C-c)}}} activates any changes to the in-buffer settings.
18434 Closing and reopening the Org file in Emacs also activates the
18437 #+attr_texinfo: :sep ,
18438 - =#+ARCHIVE: %s_done= ::
18440 #+cindex: @samp{ARCHIVE}, keyword
18441 #+vindex: org-archive-location
18442 Sets the archive location of the agenda file. The corresponding
18443 variable is ~org-archive-location~.
18447 #+cindex: @samp{CATEGORY}, keyword
18448 Sets the category of the agenda file, which applies to the entire
18451 - =#+COLUMNS: %25ITEM ...= ::
18453 #+cindex: @samp{COLUMNS}, property
18454 Set the default format for columns view. This format applies
18455 when columns view is invoked in locations where no =COLUMNS=
18458 - =#+CONSTANTS: name1=value1 ...= ::
18460 #+cindex: @samp{CONSTANTS}, keyword
18461 #+vindex: org-table-formula-constants
18462 #+vindex: org-table-formula
18463 Set file-local values for constants that table formulas can use.
18464 This line sets the local variable
18465 ~org-table-formula-constants-local~. The global version of this
18466 variable is ~org-table-formula-constants~.
18468 - =#+FILETAGS: :tag1:tag2:tag3:= ::
18470 #+cindex: @samp{FILETAGS}, keyword
18471 Set tags that all entries in the file inherit from, including the
18474 - =#+LINK: linkword replace= ::
18476 #+cindex: @samp{LINK}, keyword
18477 #+vindex: org-link-abbrev-alist
18478 Each line specifies one abbreviation for one link. Use multiple
18479 =LINK= keywords for more, see [[*Link Abbreviations]]. The
18480 corresponding variable is ~org-link-abbrev-alist~.
18482 - =#+PRIORITIES: highest lowest default= ::
18484 #+cindex: @samp{PRIORITIES}, keyword
18485 #+vindex: org-highest-priority
18486 #+vindex: org-lowest-priority
18487 #+vindex: org-default-priority
18488 This line sets the limits and the default for the priorities.
18489 All three must be either letters A--Z or numbers 0--9. The
18490 highest priority must have a lower ASCII number than the lowest
18493 - =#+PROPERTY: Property_Name Value= ::
18495 #+cindex: @samp{PROPERTY}, keyword
18496 This line sets a default inheritance value for entries in the
18497 current buffer, most useful for specifying the allowed values of
18500 - =#+SETUPFILE: file= ::
18502 #+cindex: @samp{SETUPFILE}, keyword
18503 The setup file or a URL pointing to such file is for additional
18504 in-buffer settings. Org loads this file and parses it for any
18505 settings in it only when Org opens the main file. If URL is
18506 specified, the contents are downloaded and stored in a temporary
18507 file cache. {{{kbd(C-c C-c)}}} on the settings line parses and
18508 loads the file, and also resets the temporary file cache. Org
18509 also parses and loads the document during normal exporting
18510 process. Org parses the contents of this document as if it was
18511 included in the buffer. It can be another Org file. To visit
18512 the file---not a URL---use {{{kbd(C-c ')}}} while point is on the
18513 line with the file name.
18517 #+cindex: @samp{STARTUP}, keyword
18518 Startup options Org uses when first visiting a file.
18520 #+vindex: org-startup-folded
18521 The first set of options deals with the initial visibility of the
18522 outline tree. The corresponding variable for global default
18523 settings is ~org-startup-folded~ with a default value of ~t~,
18524 which is the same as ~overview~.
18528 Top-level headlines only.
18536 No folding on any entry.
18538 - =showeverything= ::
18540 Show even drawer contents.
18542 #+vindex: org-startup-indented
18543 Dynamic virtual indentation is controlled by the variable
18544 ~org-startup-indented~[fn:143].
18548 Start with ~org-indent-mode~ turned on.
18552 Start with ~org-indent-mode~ turned off.
18554 #+vindex: org-startup-align-all-tables
18555 Aligns tables consistently upon visiting a file. The corresponding
18556 variable is ~org-startup-align-all-tables~ with ~nil~ as default
18565 Do not align tables on startup.
18567 #+vindex: org-startup-shrink-all-tables
18568 Shrink table columns with a width cookie. The corresponding
18569 variable is ~org-startup-shrink-all-tables~ with ~nil~ as default
18572 #+vindex: org-startup-with-inline-images
18573 When visiting a file, inline images can be automatically displayed.
18574 The corresponding variable is ~org-startup-with-inline-images~,
18575 with a default value ~nil~ to avoid delays when visiting a file.
18577 - =inlineimages= ::
18579 Show inline images.
18581 - =noinlineimages= ::
18583 Do not show inline images on startup.
18585 #+vindex: org-log-done
18586 #+vindex: org-log-note-clock-out
18587 #+vindex: org-log-repeat
18588 Logging the closing and reopening of TODO items and clock
18589 intervals can be configured using these options (see variables
18590 ~org-log-done~, ~org-log-note-clock-out~, and ~org-log-repeat~).
18594 Record a timestamp when an item is marked DONE.
18598 Record timestamp and a note when DONE.
18602 Do not record when items are marked DONE.
18606 Record a time when reinstating a repeating item.
18608 - =lognoterepeat= ::
18610 Record a note when reinstating a repeating item.
18614 Do not record when reinstating repeating item.
18616 - =lognoteclock-out= ::
18618 Record a note when clocking out.
18620 - =nolognoteclock-out= ::
18622 Do not record a note when clocking out.
18624 - =logreschedule= ::
18626 Record a timestamp when scheduling time changes.
18628 - =lognotereschedule= ::
18630 Record a note when scheduling time changes.
18632 - =nologreschedule= ::
18634 Do not record when a scheduling date changes.
18636 - =logredeadline= ::
18638 Record a timestamp when deadline changes.
18640 - =lognoteredeadline= ::
18642 Record a note when deadline changes.
18644 - =nologredeadline= ::
18646 Do not record when a deadline date changes.
18650 Record a timestamp when refiling.
18652 - =lognoterefile= ::
18654 Record a note when refiling.
18658 Do not record when refiling.
18660 #+vindex: org-hide-leading-stars
18661 #+vindex: org-odd-levels-only
18662 Here are the options for hiding leading stars in outline headings,
18663 and for indenting outlines. The corresponding variables are
18664 ~org-hide-leading-stars~ and ~org-odd-levels-only~, both with
18665 a default setting ~nil~ (meaning =showstars= and =oddeven=).
18669 Make all but one of the stars starting a headline invisible.
18673 Show all stars starting a headline.
18677 Virtual indentation according to outline level.
18681 No virtual indentation according to outline level.
18685 Allow only odd outline levels (1, 3, ...).
18689 Allow all outline levels.
18691 #+vindex: org-put-time-stamp-overlays
18692 #+vindex: org-time-stamp-overlay-formats
18693 To turn on custom format overlays over timestamps (variables
18694 ~org-put-time-stamp-overlays~ and ~org-time-stamp-overlay-formats~),
18699 Overlay custom time format.
18701 #+vindex: constants-unit-system
18702 The following options influence the table spreadsheet (variable
18703 ~constants-unit-system~).
18707 =constants.el= should use the c-g-s unit system.
18711 =constants.el= should use the SI unit system.
18713 #+vindex: org-footnote-define-inline
18714 #+vindex: org-footnote-auto-label
18715 #+vindex: org-footnote-auto-adjust
18716 To influence footnote settings, use the following keywords. The
18717 corresponding variables are ~org-footnote-define-inline~,
18718 ~org-footnote-auto-label~, and ~org-footnote-auto-adjust~.
18722 Define footnotes inline.
18726 Define footnotes in separate section.
18730 Define footnotes near first reference, but not inline.
18734 Prompt for footnote labels.
18738 Create =[fn:1]=-like labels automatically (default).
18742 Offer automatic label for editing or confirmation.
18746 Automatically renumber and sort footnotes.
18750 Do not renumber and sort automatically.
18752 #+vindex: org-hide-block-startup
18753 To hide blocks on startup, use these keywords. The corresponding
18754 variable is ~org-hide-block-startup~.
18758 Hide all begin/end blocks on startup.
18760 - =nohideblocks= ::
18762 Do not hide blocks on startup.
18764 #+vindex: org-pretty-entities
18765 The display of entities as UTF-8 characters is governed by the
18766 variable ~org-pretty-entities~ and the keywords
18768 - =entitiespretty= ::
18770 Show entities as UTF-8 characters where possible.
18772 - =entitiesplain= ::
18774 Leave entities plain.
18776 - =#+TAGS: TAG1(c1) TAG2(c2)= ::
18778 #+cindex: @samp{TAGS}, keyword
18779 #+vindex: org-tag-alist
18780 These lines (several such lines are allowed) specify the valid
18781 tags in this file, and (potentially) the corresponding /fast tag
18782 selection/ keys. The corresponding variable is ~org-tag-alist~.
18784 - =#+TODO:=, =#+SEQ_TODO:=, =#+TYP_TODO:= ::
18786 #+cindex: @samp{SEQ_TODO}, keyword
18787 #+cindex: @samp{TODO}, keyword
18788 #+cindex: @samp{TYP_TODO}, keyword
18789 #+vindex: org-todo-keywords
18790 These lines set the TODO keywords and their interpretation in the
18791 current file. The corresponding variable is ~org-todo-keywords~.
18793 ** The Very Busy {{{kbd(C-c C-c)}}} Key
18795 :DESCRIPTION: When in doubt, press @kbd{C-c C-c}.
18798 #+cindex: @kbd{C-c C-c}, overview
18800 The {{{kbd(C-c C-c)}}} key in Org serves many purposes depending on
18801 the context. It is probably the most over-worked, multi-purpose key
18802 combination in Org. Its uses are well documented throughout this
18803 manual, but here is a consolidated list for easy reference.
18805 - If any highlights shown in the buffer from the creation of a sparse
18806 tree, or from clock display, remove such highlights.
18808 - If point is in one of the special =KEYWORD= lines, scan the buffer
18809 for these lines and update the information. Also reset the Org file
18810 cache used to temporary store the contents of URLs used as values
18811 for keywords like =SETUPFILE=.
18813 - If point is inside a table, realign the table. The table realigns
18814 even if automatic table editor is turned off.
18816 - If point is on a =TBLFM= keyword, re-apply the formulas to the
18819 - If the current buffer is a capture buffer, close the note and file
18820 it. With a prefix argument, also jump to the target location after
18823 - If point is on a =<<<target>>>=, update radio targets and
18824 corresponding links in this buffer.
18826 - If point is on a property line or at the start or end of a property
18827 drawer, offer property commands.
18829 - If point is at a footnote reference, go to the corresponding
18830 definition, and /vice versa/.
18832 - If point is on a statistics cookie, update it.
18834 - If point is in a plain list item with a checkbox, toggle the status
18837 - If point is on a numbered item in a plain list, renumber the ordered
18840 - If point is on the =#+BEGIN= line of a dynamic block, the block is
18843 - If point is at a timestamp, fix the day name in the timestamp.
18845 ** A Cleaner Outline View
18847 :DESCRIPTION: Getting rid of leading stars in the outline.
18848 :ALT_TITLE: Clean View
18850 #+cindex: hiding leading stars
18851 #+cindex: dynamic indentation
18852 #+cindex: odd-levels-only outlines
18853 #+cindex: clean outline view
18855 Org's default outline with stars and no indents can become too
18856 cluttered for short documents. For /book-like/ long documents, the
18857 effect is not as noticeable. Org provides an alternate stars and
18858 indentation scheme, as shown on the right in the following table. It
18859 uses only one star and indents text to line with the heading:
18862 ,* Top level headline | * Top level headline
18863 ,** Second level | * Second level
18864 ,*** Third level | * Third level
18865 some text | some text
18866 ,*** Third level | * Third level
18867 more text | more text
18868 ,* Another top level headline | * Another top level headline
18871 #+texinfo: @noindent
18872 #+cindex: Indent mode
18873 #+findex: org-indent-mode
18874 To turn this mode on, use the minor mode, ~org-indent-mode~. Text
18875 lines that are not headlines are prefixed with spaces to vertically
18876 align with the headline text[fn:144].
18878 #+vindex: org-indent-indentation-per-level
18879 To make more horizontal space, the headlines are shifted by two stars.
18880 This can be configured by the ~org-indent-indentation-per-level~
18881 variable. Only one star on each headline is visible, the rest are
18882 masked with the same font color as the background.
18884 Note that turning on ~org-indent-mode~ sets ~org-hide-leading-stars~
18885 to ~t~ and ~org-adapt-indentation~ to ~nil~.
18887 #+vindex: org-startup-indented
18888 To globally turn on ~org-indent-mode~ for all files, customize the
18889 variable ~org-startup-indented~.
18891 To turn on indenting for individual files, use =STARTUP= keyword as
18894 : #+STARTUP: indent
18896 Indent on startup makes Org use hard spaces to align text with
18897 headings as shown in examples below.
18899 - /Indentation of text below headlines/ ::
18901 Indent text to align with the headline.
18905 more text, now indented
18908 #+vindex: org-adapt-indentation
18909 Org supports this with paragraph filling, line wrapping, and
18910 structure editing, preserving or adapting the indentation as
18911 appropriate[fn:145].
18913 - /Hiding leading stars/ ::
18915 #+vindex: org-hide-leading-stars
18916 Org can make leading stars invisible. For global preference,
18917 configure the variable ~org-hide-leading-stars~. For per-file
18918 preference, use these file =STARTUP= options:
18921 ,#+STARTUP: hidestars
18922 ,#+STARTUP: showstars
18925 With stars hidden, the tree is shown as:
18928 ,* Top level headline
18934 #+texinfo: @noindent
18935 #+vindex: org-hide, face
18936 Because Org makes the font color the same as the background color
18937 to hide to stars, sometimes ~org-hide~ face may need tweaking to
18938 get the effect right. For some black and white combinations,
18939 ~grey90~ on a white background might mask the stars better.
18943 #+vindex: org-odd-levels-only
18944 Using stars for only odd levels, 1, 3, 5, ..., can also clean up
18945 the clutter. This removes two stars from each level[fn:146].
18946 For Org to properly handle this cleaner structure during edits
18947 and exports, configure the variable ~org-odd-levels-only~. To
18948 set this per-file, use either one of the following lines:
18952 ,#+STARTUP: oddeven
18955 To switch between single and double stars layouts, use {{{kbd(M-x
18956 org-convert-to-odd-levels)}}} and {{{kbd(M-x
18957 org-convert-to-oddeven-levels)}}}.
18959 ** Using Org on a TTY
18961 :DESCRIPTION: Using Org on a tty.
18962 :ALT_TITLE: TTY Keys
18964 #+cindex: tty key bindings
18966 Org provides alternative key bindings for TTY and modern mobile
18967 devices that cannot perform movement commands on point and key
18968 bindings with modifier keys. Some of these workarounds may be more
18969 cumbersome than necessary. Users should look into customizing these
18970 further based on their usage needs. For example, the normal
18971 {{{kbd(S-<cursor>)}}} for editing timestamp might be better with
18972 {{{kbd(C-c .)}}} chord.
18974 #+attr_texinfo: :columns 0.2 0.28 0.15 0.21
18975 | Default | Alternative 1 | Speed key | Alternative 2 |
18976 |----------------------+--------------------------+--------------+----------------------|
18977 | {{{kbd(S-TAB)}}} | {{{kbd(C-u TAB)}}} | {{{kbd(C)}}} | |
18978 | {{{kbd(M-LEFT)}}} | {{{kbd(C-c C-x l)}}} | {{{kbd(l)}}} | {{{kbd(Esc LEFT)}}} |
18979 | {{{kbd(M-S-LEFT)}}} | {{{kbd(C-c C-x L)}}} | {{{kbd(L)}}} | |
18980 | {{{kbd(M-RIGHT)}}} | {{{kbd(C-c C-x r)}}} | {{{kbd(r)}}} | {{{kbd(Esc RIGHT)}}} |
18981 | {{{kbd(M-S-RIGHT)}}} | {{{kbd(C-c C-x R)}}} | {{{kbd(R)}}} | |
18982 | {{{kbd(M-UP)}}} | {{{kbd(C-c C-x u)}}} | | {{{kbd(Esc UP)}}} |
18983 | {{{kbd(M-S-UP)}}} | {{{kbd(C-c C-x U)}}} | {{{kbd(U)}}} | |
18984 | {{{kbd(M-DOWN)}}} | {{{kbd(C-c C-x d)}}} | | {{{kbd(Esc DOWN)}}} |
18985 | {{{kbd(M-S-DOWN)}}} | {{{kbd(C-c C-x D)}}} | {{{kbd(D)}}} | |
18986 | {{{kbd(S-RET)}}} | {{{kbd(C-c C-x c)}}} | | |
18987 | {{{kbd(M-RET)}}} | {{{kbd(C-c C-x m)}}} | | {{{kbd(Esc RET)}}} |
18988 | {{{kbd(M-S-RET)}}} | {{{kbd(C-c C-x M)}}} | | |
18989 | {{{kbd(S-LEFT)}}} | {{{kbd(C-c LEFT)}}} | | |
18990 | {{{kbd(S-RIGHT)}}} | {{{kbd(C-c RIGHT)}}} | | |
18991 | {{{kbd(S-UP)}}} | {{{kbd(C-c UP)}}} | | |
18992 | {{{kbd(S-DOWN)}}} | {{{kbd(C-c DOWN)}}} | | |
18993 | {{{kbd(C-S-LEFT)}}} | {{{kbd(C-c C-x LEFT)}}} | | |
18994 | {{{kbd(C-S-RIGHT)}}} | {{{kbd(C-c C-x RIGHT)}}} | | |
18996 ** Context Dependent Documentation
18998 :DESCRIPTION: Jump to Documentation for Context.
18999 :ALT_TITLE: Documentation Access
19001 #+cindex: documentation
19003 #+findex: org-info-find-node
19005 {{{kbd(C-c C-x C-i)}}} in an Org file tries to open a suitable section
19006 of the Org info documentation depending on the Org element at point.
19007 For example on a headline the info documentation about the Org
19008 document structure appears.
19010 {{{kbd(q)}}} closes the info window.
19012 ** Interaction with Other Packages
19014 :DESCRIPTION: With other Emacs packages.
19015 :ALT_TITLE: Interaction
19017 #+cindex: packages, interaction with other
19019 Org's compatibility and the level of interaction with other Emacs
19020 packages are documented here.
19022 *** Packages that Org cooperates with
19024 :DESCRIPTION: Packages Org cooperates with.
19025 :ALT_TITLE: Cooperation
19028 - =calc.el= by Dave Gillespie ::
19029 #+cindex: @file{calc.el}
19031 Org uses the Calc package for implementing spreadsheet
19032 functionality in its tables (see [[*The Spreadsheet]]). Org also
19033 uses Calc for embedded calculations. See [[info:calc::Embedded%20Mode][GNU Emacs Calc Manual]].
19035 - =constants.el= by Carsten Dominik ::
19036 #+cindex: @file{constants.el}
19037 #+vindex: org-table-formula-constants
19039 Org can use names for constants in formulas in tables. Org can
19040 also use calculation suffixes for units, such as =M= for =Mega=.
19041 For a standard collection of such constants, install the
19042 =constants= package. Install version 2.0 of this package,
19043 available at [[http://www.astro.uva.nl/~dominik/Tools]]. Org checks
19044 if the function ~constants-get~ has been autoloaded.
19045 Installation instructions are in the file =constants.el=.
19047 - =cdlatex.el= by Carsten Dominik ::
19048 #+cindex: @file{cdlatex.el}
19050 Org mode can make use of the CDLaTeX package to efficiently enter
19051 LaTeX fragments into Org files. See [[*Using CDLaTeX to enter
19054 - =imenu.el= by Ake Stenhoff and Lars Lindberg ::
19055 #+cindex: @file{imenu.el}
19057 Imenu creates dynamic menus based on an index of items in a file.
19058 Org mode supports Imenu menus. Enable it with a mode hook as
19061 #+begin_src emacs-lisp
19062 (add-hook 'org-mode-hook
19063 (lambda () (imenu-add-to-menubar "Imenu")))
19066 #+vindex: org-imenu-depth
19067 By default the index is two levels deep---you can modify the
19068 depth using the option ~org-imenu-depth~.
19070 - =speedbar.el= by Eric\nbsp{}M.\nbsp{}Ludlam ::
19071 #+cindex: @file{speedbar.el}
19073 Speedbar package creates a special Emacs frame for displaying
19074 files and index items in files. Org mode supports Speedbar;
19075 users can drill into Org files directly from the Speedbar. The
19076 {{{kbd(<)}}} in the Speedbar frame tweaks the agenda commands to
19077 that file or to a subtree.
19079 - =table.el= by Takaaki Ota ::
19080 #+cindex: table editor, @file{table.el}
19081 #+cindex: @file{table.el}
19083 Complex ASCII tables with automatic line wrapping, column- and
19084 row-spanning, and alignment can be created using the Emacs table
19085 package by Takaaki Ota. Org mode recognizes such tables and
19086 exports them properly. {{{kbd(C-c ')}}} to edit these tables in
19087 a special buffer, much like Org's code blocks. Because of
19088 interference with other Org mode functionality, Takaaki Ota
19089 tables cannot be edited directly in the Org buffer.
19091 - {{{kbd(C-c ')}}} (~org-edit-special~) ::
19094 #+findex: org-edit-special
19095 Edit a =table.el= table. Works when point is in
19096 a =table.el= table.
19098 - {{{kbd(C-c ~​)}}} (~org-table-create-with-table.el~) ::
19101 #+findex: org-table-create-with-table.el
19102 Insert a =table.el= table. If there is already a table at
19103 point, this command converts it between the =table.el=
19104 format and the Org mode format. See the documentation
19105 string of the command ~org-convert-table~ for the
19106 restrictions under which this is possible.
19108 *** Packages that conflict with Org mode
19110 :DESCRIPTION: Packages that lead to conflicts.
19111 :ALT_TITLE: Conflicts
19114 #+cindex: shift-selection-mode
19115 #+vindex: org-support-shift-select
19116 In Emacs, ~shift-selection-mode~ combines motions of point with shift
19117 key to enlarge regions. Emacs sets this mode by default. This
19118 conflicts with Org's use of {{{kbd(S-<cursor>)}}} commands to change
19119 timestamps, TODO keywords, priorities, and item bullet types, etc.
19120 Since {{{kbd(S-<cursor>)}}} commands outside of specific contexts do
19121 not do anything, Org offers the variable ~org-support-shift-select~
19122 for customization. Org mode accommodates shift selection by (i)
19123 making it available outside of the special contexts where special
19124 commands apply, and (ii) extending an existing active region even if
19125 point moves across a special context.
19127 - =cua.el= by Kim\nbsp{}F.\nbsp{}Storm ::
19129 #+cindex: @file{cua.el}
19130 #+vindex: org-replace-disputed-keys
19131 Org key bindings conflict with {{{kbd(S-<cursor>)}}} keys used by
19132 CUA mode. For Org to relinquish these bindings to CUA mode,
19133 configure the variable ~org-replace-disputed-keys~. When set,
19134 Org moves the following key bindings in Org files, and in the
19135 agenda buffer---but not during date selection.
19137 #+attr_texinfo: :columns 0.4 0.4
19138 | {{{kbd(S-UP)}}} \rArr{} {{{kbd(M-p)}}} | {{{kbd(S-DOWN)}}} \rArr{} {{{kbd(M-n)}}} |
19139 | {{{kbd(S-LEFT)}}} \rArr{} {{{kbd(M--)}}} | {{{kbd(S-RIGHT)}}} \rArr{} {{{kbd(M-+)}}} |
19140 | {{{kbd(C-S-LEFT)}}} \rArr{} {{{kbd(M-S--)}}} | {{{kbd(C-S-RIGHT)}}} \rArr{} {{{kbd(M-S-+)}}} |
19142 #+vindex: org-disputed-keys
19143 Yes, these are unfortunately more difficult to remember. If you
19144 want to have other replacement keys, look at the variable
19145 ~org-disputed-keys~.
19147 - =ecomplete.el= by Lars Magne Ingebrigtsen ::
19149 #+cindex: @file{ecomplete.el}
19150 Ecomplete provides "electric" address completion in address
19151 header lines in message buffers. Sadly Orgtbl mode cuts
19152 Ecomplete's power supply: no completion happens when Orgtbl mode
19153 is enabled in message buffers while entering text in address
19154 header lines. If one wants to use ecomplete one should /not/
19155 follow the advice to automagically turn on Orgtbl mode in message
19156 buffers (see [[*The Orgtbl Minor Mode]]), but instead---after
19157 filling in the message headers---turn on Orgtbl mode manually
19158 when needed in the messages body.
19160 - =filladapt.el= by Kyle Jones ::
19162 #+cindex: @file{filladapt.el}
19163 Org mode tries to do the right thing when filling paragraphs,
19164 list items and other elements. Many users reported problems
19165 using both =filladapt.el= and Org mode, so a safe thing to do is
19166 to disable filladapt like this:
19168 #+begin_src emacs-lisp
19169 (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
19172 - =viper.el= by Michael Kifer ::
19173 #+cindex: @file{viper.el}
19176 Viper uses {{{kbd(C-c /)}}} and therefore makes this key not
19177 access the corresponding Org mode command ~org-sparse-tree~. You
19178 need to find another key for this command, or override the key in
19179 ~viper-vi-global-user-map~ with
19181 #+begin_src emacs-lisp
19182 (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
19185 - =windmove.el= by Hovav Shacham ::
19186 #+cindex: @file{windmove.el}
19188 This package also uses the {{{kbd(S-<cursor>)}}} keys, so
19189 everything written in the paragraph above about CUA mode also
19190 applies here. If you want to make the windmove function active
19191 in locations where Org mode does not have special functionality
19192 on {{{kbd(S-<cursor>)}}}, add this to your configuration:
19194 #+begin_src emacs-lisp
19195 ;; Make windmove work in Org mode:
19196 (add-hook 'org-shiftup-final-hook 'windmove-up)
19197 (add-hook 'org-shiftleft-final-hook 'windmove-left)
19198 (add-hook 'org-shiftdown-final-hook 'windmove-down)
19199 (add-hook 'org-shiftright-final-hook 'windmove-right)
19202 - =yasnippet.el= ::
19204 #+cindex: @file{yasnippet.el}
19205 The way Org mode binds the {{{kbd(TAB)}}} key (binding to ~[tab]~
19206 instead of ~"\t"~) overrules YASnippet's access to this key. The
19207 following code fixed this problem:
19209 #+begin_src emacs-lisp
19210 (add-hook 'org-mode-hook
19212 (setq-local yas/trigger-key [tab])
19213 (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
19216 The latest version of YASnippet does not play well with Org mode.
19217 If the above code does not fix the conflict, start by defining
19218 the following function:
19220 #+begin_src emacs-lisp
19221 (defun yas/org-very-safe-expand ()
19222 (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
19225 Then, tell Org mode to use that function:
19227 #+begin_src emacs-lisp
19228 (add-hook 'org-mode-hook
19230 (make-variable-buffer-local 'yas/trigger-key)
19231 (setq yas/trigger-key [tab])
19232 (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
19233 (define-key yas/keymap [tab] 'yas/next-field)))
19238 :DESCRIPTION: Encrypting Org files.
19241 Org Crypt encrypts the text of an entry, but not the headline, or
19242 properties. Behind the scene, it uses the Emacs EasyPG library to
19243 encrypt and decrypt files.
19245 #+vindex: org-crypt-tag-matcher
19246 Any text below a headline that has a =crypt= tag is automatically
19247 encrypted when the file is saved. To use a different tag, customize
19248 the ~org-crypt-tag-matcher~ setting.
19250 Here is a suggestion for Org Crypt settings in Emacs init file:
19252 #+begin_src emacs-lisp
19253 (require 'org-crypt)
19254 (org-crypt-use-before-save-magic)
19255 (setq org-tags-exclude-from-inheritance '("crypt"))
19257 (setq org-crypt-key nil)
19258 ;; GPG key to use for encryption
19259 ;; Either the Key ID or set to nil to use symmetric encryption.
19261 (setq auto-save-default nil)
19262 ;; Auto-saving does not cooperate with org-crypt.el: so you need to
19263 ;; turn it off if you plan to use org-crypt.el quite often. Otherwise,
19264 ;; you'll get an (annoying) message each time you start Org.
19266 ;; To turn it off only locally, you can insert this:
19268 ;; # -*- buffer-auto-save-file-name: nil; -*-
19271 It's possible to use different keys for different headings by
19272 specifying the respective key as property =CRYPTKEY=, e.g.:
19275 ,* Totally secret :crypt:
19277 :CRYPTKEY: 0x0123456789012345678901234567890123456789
19281 Excluding the =crypt= tag from inheritance prevents already encrypted
19282 text from being encrypted again.
19286 :DESCRIPTION: Viewing and capture on a mobile device.
19288 #+cindex: smartphone
19290 Org Mobile is a protocol for synchronizing Org files between Emacs and
19291 other applications, e.g., on mobile devices. It enables offline-views
19292 and capture support for an Org mode system that is rooted on a "real"
19293 computer. The external application can also record changes to
19296 This appendix describes Org's support for agenda view formats
19297 compatible with Org Mobile. It also describes synchronizing changes,
19298 such as to notes, between the mobile application and the computer.
19300 To change tags and TODO states in the mobile application, first
19301 customize the variables ~org-todo-keywords~ and ~org-tag-alist~.
19302 These should cover all the important tags and TODO keywords, even if
19303 Org files use only some of them. Though the mobile application is
19304 expected to support in-buffer settings, it is required to understand
19305 TODO states /sets/ (see [[*Setting up keywords for individual files]]) and
19306 /mutually exclusive/ tags (see [[*Setting Tags]]) only for those set in
19309 *** Setting up the staging area
19311 :DESCRIPTION: For the mobile device.
19314 #+vindex: org-mobile-directory
19315 The mobile application needs access to a file directory on
19316 a server[fn:147] to interact with Emacs. Pass its location through
19317 the ~org-mobile-directory~ variable. If you can mount that directory
19318 locally just set the variable to point to that directory:
19320 #+begin_src emacs-lisp
19321 (setq org-mobile-directory "~/orgmobile/")
19324 #+texinfo: @noindent
19325 Alternatively, by using TRAMP (see [[info:tramp][TRAMP User Manual]]),
19326 ~org-mobile-directory~ may point to a remote directory accessible
19327 through, for example, SSH and SCP:
19329 #+begin_src emacs-lisp
19330 (setq org-mobile-directory "/scpc:user@remote.host:org/webdav/")
19333 #+vindex: org-mobile-encryption
19334 With a public server, consider encrypting the files. Org also
19335 requires OpenSSL installed on the local computer. To turn on
19336 encryption, set the same password in the mobile application and in
19337 Emacs. Set the password in the variable
19338 ~org-mobile-use-encryption~[fn:148]. Note that even after the mobile
19339 application encrypts the file contents, the file name remains visible
19340 on the file systems of the local computer, the server, and the mobile
19343 *** Pushing to the mobile application
19345 :DESCRIPTION: Uploading Org files and agendas.
19348 #+findex: org-mobile-push
19349 #+vindex: org-mobile-files
19350 The command ~org-mobile-push~ copies files listed in
19351 ~org-mobile-files~ into the staging area. Files include agenda files
19352 (as listed in ~org-agenda-files~). Customize ~org-mobile-files~ to
19353 add other files. File names are staged with paths relative to
19354 ~org-directory~, so all files should be inside this directory[fn:149].
19356 Push creates a special Org file =agendas.org= with custom agenda views
19357 defined by the user[fn:150].
19359 Finally, Org writes the file =index.org=, containing links to other
19360 files. The mobile application reads this file first from the server
19361 to determine what other files to download for agendas. For faster
19362 downloads, it is expected to only read files whose checksums[fn:151]
19365 *** Pulling from the mobile application
19367 :DESCRIPTION: Integrating captured and flagged items.
19370 #+findex: org-mobile-pull
19371 The command ~org-mobile-pull~ synchronizes changes with the server.
19372 More specifically, it first pulls the Org files for viewing. It then
19373 appends captured entries and pointers to flagged or changed entries to
19374 the file =mobileorg.org= on the server. Org ultimately integrates its
19375 data in an inbox file format, through the following steps:
19378 #+vindex: org-mobile-inbox-for-pull
19379 Org moves all entries found in =mobileorg.org=[fn:152] and appends
19380 them to the file pointed to by the variable
19381 ~org-mobile-inbox-for-pull~. It should reside neither in the
19382 staging area nor on the server. Each captured entry and each
19383 editing event is a top-level entry in the inbox file.
19386 #+cindex: @samp{FLAGGED}, tag
19387 After moving the entries, Org processes changes to the shared
19388 files. Some of them are applied directly and without user
19389 interaction. Examples include changes to tags, TODO state,
19390 headline and body text. Entries requiring further action are
19391 tagged as =FLAGGED=. Org marks entries with problems with an error
19392 message in the inbox. They have to be resolved manually.
19394 3. Org generates an agenda view for flagged entries for user
19395 intervention to clean up. For notes stored in flagged entries, Org
19396 displays them in the echo area when point is on the corresponding
19401 Pressing {{{kbd(?)}}} displays the entire flagged note in
19402 another window. Org also pushes it to the kill ring. To
19403 store flagged note as a normal note, use {{{kbd(? z C-y C-c
19404 C-c)}}}. Pressing {{{kbd(?)}}} twice does these things: first
19405 it removes the =FLAGGED= tag; second, it removes the flagged
19406 note from the property drawer; third, it signals that manual
19407 editing of the flagged entry is now finished.
19409 #+kindex: ? @r{(Agenda dispatcher)}
19410 From the agenda dispatcher, {{{kbd(?)}}} returns to the view to finish
19411 processing flagged entries. Note that these entries may not be the
19412 most recent since the mobile application searches files that were last
19413 pulled. To get an updated agenda view with changes since the last
19418 :DESCRIPTION: Formal description of Org's syntax.
19421 A reference document providing a formal description of Org's syntax is
19422 available as [[https://orgmode.org/worg/dev/org-syntax.html][a draft on Worg]], written and maintained by Nicolas
19423 Goaziou. It defines Org's core internal concepts such as "headlines",
19424 "sections", "affiliated keywords", "(greater) elements" and "objects".
19425 Each part of an Org document belongs to one of the previous
19428 To explore the abstract structure of an Org buffer, run this in
19431 : M-: (org-element-parse-buffer) <RET>
19433 #+texinfo: @noindent
19434 It outputs a list containing the buffer's content represented as an
19435 abstract structure. The export engine relies on the information
19436 stored in this list. Most interactive commands---e.g., for structure
19437 editing---also rely on the syntactic meaning of the surrounding
19440 #+cindex: syntax checker
19443 You can probe the syntax of your documents with the command
19445 : M-x org-lint <RET>
19447 #+texinfo: @noindent
19448 It runs a number of checks to find common mistakes. It then displays
19449 their location in a dedicated buffer, along with a description and
19450 a "trust level", since false-positive are possible. From there, you
19451 can operate on the reports with the following keys:
19453 #+attr_texinfo: :columns 0.22 0.78
19454 | {{{kbd(C-j)}}}, {{{kbd(TAB)}}} | Display the offending line |
19455 | {{{kbd(RET)}}} | Move point to the offending line |
19456 | {{{kbd(g)}}} | Check the document again |
19457 | {{{kbd(h)}}} | Hide all reports from the same checker |
19458 | {{{kbd(i)}}} | Also remove them from all subsequent checks |
19459 | {{{kbd(S)}}} | Sort reports by the column at point |
19463 :DESCRIPTION: How to hack your way around.
19468 This appendix describes some ways a user can extend the functionality
19473 :DESCRIPTION: How to reach into Org's internals.
19477 Org has a large number of hook variables for adding functionality.
19478 This appendix illustrates using a few. A complete list of hooks with
19479 documentation is maintained by the Worg project at
19480 https://orgmode.org/worg/doc.html#hooks.
19484 :DESCRIPTION: Available extensions.
19486 #+cindex: add-on packages
19488 Various authors wrote a large number of add-on packages for Org.
19490 These packages are not part of Emacs, but they are distributed as
19491 contributed packages with the separate release available at
19492 https://orgmode.org. See the =contrib/README= file in the source code
19493 directory for a list of contributed files. Worg page with more
19494 information is at: https://orgmode.org/worg/org-contrib/.
19496 ** Adding Hyperlink Types
19498 :DESCRIPTION: New custom link types.
19500 #+cindex: hyperlinks, adding new types
19502 Org has many built-in hyperlink types (see [[*Hyperlinks]]), and an
19503 interface for adding new link types. The following example shows the
19504 process of adding Org links to Unix man pages, which look like this
19506 : [[man:printf][The printf manual]]
19508 #+texinfo: @noindent
19509 The following =org-man.el= file implements it
19511 #+begin_src emacs-lisp
19512 ;;; org-man.el - Support for links to man pages in Org mode
19515 (org-link-set-parameters "man"
19516 :follow org-man-command
19517 :export #'org-man-export
19518 :store #'org-man-store-link)
19520 (defcustom org-man-command 'man
19521 "The Emacs command to be used to display a man page."
19523 :type '(choice (const man) (const woman)))
19525 (defun org-man-store-link ()
19526 "Store a link to a man page."
19527 (when (memq major-mode '(Man-mode woman-mode))
19528 ;; This is a man page, we do make this link.
19529 (let* ((page (org-man-get-page-name))
19530 (link (concat "man:" page))
19531 (description (format "Man page for %s" page)))
19532 (org-store-link-props
19535 :description description))))
19537 (defun org-man-get-page-name ()
19538 "Extract the page name from the buffer name."
19539 ;; This works for both `Man-mode' and `woman-mode'.
19540 (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
19541 (match-string 1 (buffer-name))
19542 (error "Cannot create link to this man page")))
19544 (defun org-man-export (link description format)
19545 "Export a man page link from Org files."
19546 (let ((path (format "http://man.he.net/?topic=%s§ion=all" link))
19547 (desc (or description link)))
19549 (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
19550 (`latex (format "\\href{%s}{%s}" path desc))
19551 (`texinfo (format "@uref{%s,%s}" path desc))
19552 (`ascii (format "%s (%s)" desc path))
19556 ;;; org-man.el ends here
19559 #+texinfo: @noindent
19560 To activate links to man pages in Org, enter this in the Emacs init
19563 #+begin_src emacs-lisp
19567 #+texinfo: @noindent
19568 A review of =org-man.el=:
19570 1. First, ~(require 'org)~ ensures =org.el= is loaded.
19574 #+findex: org-link-set-parameters
19575 #+vindex: org-link-parameters
19576 Then ~org-link-set-parameters~ defines a new link type with =man=
19577 prefix and associates functions for following, exporting and
19578 storing such links. See the variable ~org-link-parameters~ for
19579 a complete list of possible associations.
19581 3. The rest of the file implements necessary variables and functions.
19583 For example, ~org-man-store-link~ is responsible for storing a link
19584 when ~org-store-link~ (see [[*Handling Links]]) is called from a buffer
19585 displaying a man page. It first checks if the ~major-mode~ is
19586 appropriate. If check fails, the function returns ~nil~, which
19587 means it isn't responsible for creating a link to the current
19588 buffer. Otherwise the function makes a link string by combining
19589 the =man:= prefix with the man topic. It also provides a default
19590 description. The function ~org-insert-link~ can insert it back
19591 into an Org buffer later on.
19593 ** Adding Export Back-ends
19595 :DESCRIPTION: How to write new export back-ends.
19597 #+cindex: Export, writing back-ends
19599 Org's export engine makes it easy for writing new back-ends. The
19600 framework on which the engine was built makes it easy to derive new
19601 back-ends from existing ones.
19603 #+findex: org-export-define-backend
19604 #+findex: org-export-define-derived-backend
19605 The two main entry points to the export engine are:
19606 ~org-export-define-backend~ and ~org-export-define-derived-backend~.
19607 To grok these functions, see =ox-latex.el= for an example of defining
19608 a new back-end from scratch, and =ox-beamer.el= for an example of
19609 deriving from an existing engine.
19611 For creating a new back-end from scratch, first set its name as
19612 a symbol in an alist consisting of elements and export functions. To
19613 make the back-end visible to the export dispatcher, set ~:menu-entry~
19614 keyword. For export options specific to this back-end, set the
19617 For creating a new back-end from an existing one, set
19618 ~:translate-alist~ to an alist of export functions. This alist
19619 replaces the parent back-end functions.
19621 For complete documentation, see [[https://orgmode.org/worg/dev/org-export-reference.html][the Org Export Reference on Worg]].
19623 ** Tables in Arbitrary Syntax
19625 :DESCRIPTION: Orgtbl for LaTeX and other programs.
19627 #+cindex: tables, in other modes
19628 #+cindex: lists, in other modes
19629 #+cindex: Orgtbl mode
19631 Due to Org's success in handling tables with Orgtbl, a frequently
19632 requested feature is the use of Org's table functions in other modes,
19633 e.g., LaTeX. This would be hard to do in a general way without
19634 complicated customization nightmares. Moreover, that would take Org
19635 away from its simplicity roots that Orgtbl has proven. There is,
19636 however, an alternate approach to accomplishing the same.
19638 This approach involves implementing a custom /translate/ function that
19639 operates on a native Org /source table/ to produce a table in another
19640 format. This strategy would keep the excellently working Orgtbl
19641 simple and isolate complications, if any, confined to the translate
19642 function. To add more alien table formats, we just add more translate
19643 functions. Also the burden of developing custom translate functions
19644 for new table formats is in the hands of those who know those formats
19649 :DESCRIPTION: Sending and receiving radio tables.
19651 #+cindex: radio tables
19653 Radio tables are target locations for translated tables that are not near
19654 their source. Org finds the target location and inserts the translated
19657 The key to finding the target location is the magic words =BEGIN/END
19658 RECEIVE ORGTBL=. They have to appear as comments in the current mode.
19659 If the mode is C, then:
19662 /* BEGIN RECEIVE ORGTBL table_name */
19663 /* END RECEIVE ORGTBL table_name */
19666 #+texinfo: @noindent
19667 At the location of source, Org needs a special line to direct Orgtbl
19668 to translate and to find the target for inserting the translated
19669 table. For example:
19671 #+cindex: @samp{ORGTBL}, keyword
19672 : #+ORGTBL: SEND table_name translation_function arguments ...
19674 #+texinfo: @noindent
19675 =table_name= is the table's reference name, which is also used in the
19676 receiver lines, and the =translation_function= is the Lisp function
19677 that translates. This line, in addition, may also contain alternating
19678 key and value arguments at the end. The translation function gets
19679 these values as a property list. A few standard parameters are
19680 already recognized and acted upon before the translation function is
19685 Skip the first N lines of the table. Hlines do count; include
19686 them if they are to be skipped.
19688 - =:skipcols (n1 n2 ...)= ::
19690 List of columns to be skipped. First Org automatically discards
19691 columns with calculation marks and then sends the table to the
19692 translator function, which then skips columns as specified in
19695 #+texinfo: @noindent
19696 To keep the source table intact in the buffer without being disturbed
19697 when the source file is compiled or otherwise being worked on, use one
19698 of these strategies:
19700 - Place the table in a block comment. For example, in C mode you
19701 could wrap the table between =/*= and =*/= lines.
19703 - Put the table after an "end" statement. For example ~\bye~ in TeX
19704 and ~\end{document}~ in LaTeX.
19706 - Comment and un-comment each line of the table during edits. The
19707 {{{kbd(M-x orgtbl-toggle-comment)}}} command makes toggling easy.
19709 *** A LaTeX example of radio tables
19711 :DESCRIPTION: Step by step, almost a tutorial.
19712 :ALT_TITLE: A LaTeX example
19714 #+cindex: @LaTeX{}, and Orgtbl mode
19716 To wrap a source table in LaTeX, use the =comment= environment
19717 provided by =comment.sty=[fn:153]. To activate it, put
19718 ~\usepackage{comment}~ in the document header. Orgtbl mode inserts
19719 a radio table skeleton[fn:146] with the command {{{kbd(M-x
19720 orgtbl-insert-radio-table)}}}, which prompts for a table name. For
19721 example, if =salesfigures= is the name, the template inserts:
19724 % BEGIN RECEIVE ORGTBL salesfigures
19725 % END RECEIVE ORGTBL salesfigures
19727 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
19732 #+vindex: LaTeX-verbatim-environments
19733 #+texinfo: @noindent
19734 The line =#+ORGTBL: SEND= tells Orgtbl mode to use the function
19735 ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert
19736 the table at the target (receive) location named =salesfigures=. Now
19737 the table is ready for data entry. It can even use spreadsheet
19741 % BEGIN RECEIVE ORGTBL salesfigures
19742 % END RECEIVE ORGTBL salesfigures
19744 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex
19745 | Month | Days | Nr sold | per day |
19746 |-------+------+---------+---------|
19747 | Jan | 23 | 55 | 2.4 |
19748 | Feb | 21 | 16 | 0.8 |
19749 | March | 22 | 278 | 12.6 |
19750 ,#+TBLFM: $4=$3/$2;%.1f
19751 % $ (optional extra dollar to keep Font Lock happy, see footnote)
19755 #+texinfo: @noindent
19756 After editing, {{{kbd(C-c C-c)}}} inserts the translated table at the
19757 target location, between the two marker lines.
19759 For hand-made custom tables, note that the translator needs to skip
19760 the first two lines of the source table. Also the command has to
19761 /splice/ out the target table without the header and footer.
19764 \begin{tabular}{lrrr}
19765 Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\
19766 % BEGIN RECEIVE ORGTBL salesfigures
19767 % END RECEIVE ORGTBL salesfigures
19771 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
19772 | Month | Days | Nr sold | per day |
19773 |-------+------+---------+---------|
19774 | Jan | 23 | 55 | 2.4 |
19775 | Feb | 21 | 16 | 0.8 |
19776 | March | 22 | 278 | 12.6 |
19777 ,#+TBLFM: $4=$3/$2;%.1f
19781 The LaTeX translator function ~orgtbl-to-latex~ is already part of
19782 Orgtbl mode and uses a =tabular= environment to typeset the table and
19783 marks horizontal lines with ~\hline~. For additional parameters to
19784 control output, see [[*Translator functions]]:
19786 - ~:splice nil/t~ ::
19788 When non-~nil~, return only table body lines; not wrapped in
19789 tabular environment. Default is ~nil~.
19793 Format to warp each field. It should contain =%s= for the
19794 original field value. For example, to wrap each field value in
19795 dollar symbol, you could use =:fmt "$%s$"=. Format can also wrap
19796 a property list with column numbers and formats, for example
19797 =:fmt (2 "$%s$" 4 "%s\\%%")=. In place of a string, a function
19798 of one argument can be used; the function must return a formatted
19803 Format numbers as exponentials. The spec should have =%s= twice
19804 for inserting mantissa and exponent, for example
19805 ="%s\\times10^{%s}"=. This may also be a property list with
19806 column numbers and formats, for example =:efmt (2
19807 "$%s\\times10^{%s}$" 4 "$%s\\cdot10^{%s}$")=. After
19808 {{{var(EFMT)}}} has been applied to a value, {{{var(FMT)}}}---see
19809 above---is also be applied. Functions with two arguments can be
19810 supplied instead of strings. By default, no special formatting
19813 *** Translator functions
19815 :DESCRIPTION: Copy and modify.
19817 #+cindex: HTML, and Orgtbl mode
19818 #+cindex: translator function
19820 #+findex: orgtbl-to-csv
19821 #+findex: orgtbl-to-tsv
19822 #+findex: orgtbl-to-latex
19823 #+findex: orgtbl-to-html
19824 #+findex: orgtbl-to-texinfo
19825 #+findex: orgtbl-to-unicode
19826 #+findex: orgtbl-to-orgtbl
19827 #+findex: orgtbl-to-generic
19828 Orgtbl mode has built-in translator functions: ~orgtbl-to-csv~
19829 (comma-separated values), ~orgtbl-to-tsv~ (TAB-separated values),
19830 ~orgtbl-to-latex~, ~orgtbl-to-html~, ~orgtbl-to-texinfo~,
19831 ~orgtbl-to-unicode~ and ~orgtbl-to-orgtbl~. They use the generic
19832 translator, ~orgtbl-to-generic~, which delegates translations to
19833 various export back-ends.
19835 Properties passed to the function through the =ORGTBL SEND= line take
19836 precedence over properties defined inside the function. For example,
19837 this overrides the default LaTeX line endings, ~\\~, with ~\\[2mm]~:
19839 : #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
19841 For a new language translator, define a converter function. It can be
19842 a generic function, such as shown in this example. It marks
19843 a beginning and ending of a table with =!BTBL!= and =!ETBL!=;
19844 a beginning and ending of lines with =!BL!= and =!EL!=; and uses a TAB
19845 for a field separator:
19847 #+begin_src emacs-lisp
19848 (defun orgtbl-to-language (table params)
19849 "Convert the orgtbl-mode TABLE to language."
19852 (org-combine-plists
19853 '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
19857 #+texinfo: @noindent
19858 The documentation for the ~orgtbl-to-generic~ function shows
19859 a complete list of parameters, each of which can be passed through to
19860 ~orgtbl-to-latex~, ~orgtbl-to-texinfo~, and any other function using
19861 that generic function.
19863 For complicated translations the generic translator function could be
19864 replaced by a custom translator function. Such a custom function must
19865 take two arguments and return a single string containing the formatted
19866 table. The first argument is the table whose lines are a list of
19867 fields or the symbol ~hline~. The second argument is the property
19868 list consisting of parameters specified in the =#+ORGTBL: SEND= line.
19869 Please share your translator functions by posting them to the Org
19870 users mailing list, at mailto:emacs-orgmode@gnu.org.
19874 :DESCRIPTION: Automatically filled blocks.
19876 #+cindex: dynamic blocks
19878 Org supports /dynamic blocks/ in Org documents. They are inserted
19879 with begin and end markers like any other code block, but the contents
19880 are updated automatically by a user function. For example, {{{kbd(C-c
19881 C-x C-r)}}} inserts a dynamic table that updates the work time (see
19882 [[*Clocking Work Time]]).
19884 Dynamic blocks can have names and function parameters. The syntax is
19885 similar to source code block specifications:
19888 ,#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
19893 These commands update dynamic blocks:
19895 - {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) ::
19897 #+kindex: C-c C-x C-u
19898 #+findex: org-dblock-update
19899 Update dynamic block at point.
19901 - {{{kbd(C-u C-c C-x C-u)}}} ::
19903 #+kindex: C-u C-c C-x C-u
19904 Update all dynamic blocks in the current file.
19906 Before updating a dynamic block, Org removes content between the
19907 =BEGIN= and =END= markers. Org then reads the parameters on the
19908 =BEGIN= line for passing to the writer function. If the function
19909 expects to access the removed content, then Org expects an extra
19910 parameter, =:content=, on the =BEGIN= line.
19912 The syntax for naming a writer function with a dynamic block labelled
19913 =myblock= is: ~org-dblock-write:myblock~. Parameters come from the
19916 The following is an example of a dynamic block and a block writer function
19917 that updates the time when the function was last run:
19920 ,#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
19925 #+texinfo: @noindent
19926 The dynamic block's writer function:
19928 #+begin_src emacs-lisp
19929 (defun org-dblock-write:block-update-time (params)
19930 (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
19931 (insert "Last block update at: "
19932 (format-time-string fmt))))
19935 To keep dynamic blocks up-to-date in an Org file, use the function,
19936 ~org-update-all-dblocks~ in hook, such as ~before-save-hook~. The
19937 ~org-update-all-dblocks~ function does not run if the file is not in
19940 #+findex: org-narrow-to-block
19941 Dynamic blocks, like any other block, can be narrowed with
19942 ~org-narrow-to-block~.
19944 ** Special Agenda Views
19946 :DESCRIPTION: Customized views.
19948 #+cindex: agenda views, user-defined
19950 #+vindex: org-agenda-skip-function
19951 #+vindex: org-agenda-skip-function-global
19952 Org provides a special hook to further limit items in agenda views:
19953 ~agenda~, ~agenda*~[fn:155], ~todo~, ~alltodo~, ~tags~, ~tags-todo~,
19954 ~tags-tree~. Specify a custom function that tests inclusion of every
19955 matched item in the view. This function can also skip as much as is
19958 For a global condition applicable to agenda views, use the
19959 ~org-agenda-skip-function-global~ variable. Org uses a global
19960 condition with ~org-agenda-skip-function~ for custom searching.
19962 This example defines a function for a custom view showing TODO items
19963 with =waiting= status. Manually this is a multi-step search process,
19964 but with a custom view, this can be automated as follows:
19966 The custom function searches the subtree for the =waiting= tag and
19967 returns ~nil~ on match. Otherwise it gives the location from where
19968 the search continues.
19970 #+begin_src emacs-lisp
19971 (defun my-skip-unless-waiting ()
19972 "Skip trees that are not waiting"
19973 (let ((subtree-end (save-excursion (org-end-of-subtree t))))
19974 (if (re-search-forward ":waiting:" subtree-end t)
19975 nil ; tag found, do not skip
19976 subtree-end))) ; tag not found, continue after end of subtree
19979 To use this custom function in a custom agenda command:
19981 #+begin_src emacs-lisp
19982 (org-add-agenda-custom-command
19983 '("b" todo "PROJECT"
19984 ((org-agenda-skip-function 'my-skip-unless-waiting)
19985 (org-agenda-overriding-header "Projects waiting for something: "))))
19988 #+vindex: org-agenda-overriding-header
19989 Note that this also binds ~org-agenda-overriding-header~ to a more
19990 meaningful string suitable for the agenda view.
19992 #+vindex: org-odd-levels-only
19993 #+vindex: org-agenda-skip-function
19994 Search for entries with a limit set on levels for the custom search.
19995 This is a general approach to creating custom searches in Org. To
19996 include all levels, use =LEVEL>0=[fn:156]. Then to selectively pick
19997 the matched entries, use ~org-agenda-skip-function~, which also
19998 accepts Lisp forms, such as ~org-agenda-skip-entry-if~ and
19999 ~org-agenda-skip-subtree-if~. For example:
20001 - ~(org-agenda-skip-entry-if 'scheduled)~ ::
20003 Skip current entry if it has been scheduled.
20005 - ~(org-agenda-skip-entry-if 'notscheduled)~ ::
20007 Skip current entry if it has not been scheduled.
20009 - ~(org-agenda-skip-entry-if 'deadline)~ ::
20011 Skip current entry if it has a deadline.
20013 - ~(org-agenda-skip-entry-if 'scheduled 'deadline)~ ::
20015 Skip current entry if it has a deadline, or if it is scheduled.
20017 - ~(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))~ ::
20019 Skip current entry if the TODO keyword is TODO or WAITING.
20021 - ~(org-agenda-skip-entry-if 'todo 'done)~ ::
20023 Skip current entry if the TODO keyword marks a DONE state.
20025 - ~(org-agenda-skip-entry-if 'timestamp)~ ::
20027 Skip current entry if it has any timestamp, may also be deadline
20030 - ~(org-agenda-skip-entry-if 'regexp "regular expression")~ ::
20032 Skip current entry if the regular expression matches in the
20035 - ~(org-agenda-skip-entry-if 'notregexp "regular expression")~ ::
20037 Skip current entry unless the regular expression matches.
20039 - ~(org-agenda-skip-subtree-if 'regexp "regular expression")~ ::
20041 Same as above, but check and skip the entire subtree.
20043 The following is an example of a search for =waiting= without the
20046 #+begin_src emacs-lisp
20047 (org-add-agenda-custom-command
20048 '("b" todo "PROJECT"
20049 ((org-agenda-skip-function '(org-agenda-skip-subtree-if
20050 'regexp ":waiting:"))
20051 (org-agenda-overriding-header "Projects waiting for something: "))))
20054 ** Speeding Up Your Agendas
20056 :DESCRIPTION: Tips on how to speed up your agendas.
20058 #+cindex: agenda views, optimization
20060 Some agenda commands slow down when the Org files grow in size or
20061 number. Here are tips to speed up:
20063 - Reduce the number of Org agenda files to avoid slowdowns due to hard drive
20066 - Reduce the number of DONE and archived headlines so agenda
20067 operations that skip over these can finish faster.
20069 - Do not dim blocked tasks:
20070 #+vindex: org-agenda-dim-blocked-tasks
20072 #+begin_src emacs-lisp
20073 (setq org-agenda-dim-blocked-tasks nil)
20076 - Stop preparing agenda buffers on startup:
20077 #+vindex: org-startup-folded
20078 #+vindex: org-agenda-inhibit-startup
20080 #+begin_src emacs-lisp
20081 (setq org-agenda-inhibit-startup nil)
20084 - Disable tag inheritance for agendas:
20085 #+vindex: org-agenda-show-inherited-tags
20086 #+vindex: org-agenda-use-tag-inheritance
20088 #+begin_src emacs-lisp
20089 (setq org-agenda-use-tag-inheritance nil)
20092 These options can be applied to selected agenda views. For more
20093 details about generation of agenda views, see the docstrings for the
20094 relevant variables, and this [[https://orgmode.org/worg/agenda-optimization.html][dedicated Worg page]] for agenda
20097 ** Extracting Agenda Information
20099 :DESCRIPTION: Post-processing agenda information.
20101 #+cindex: agenda, pipe
20102 #+cindex: scripts, for agenda processing
20104 Org provides commands to access agendas through Emacs batch mode.
20105 Through this command-line interface, agendas are automated for further
20106 processing or printing.
20108 #+vindex: org-agenda-custom-commands
20109 #+findex: org-batch-agenda
20110 ~org-batch-agenda~ creates an agenda view in ASCII and outputs to
20111 standard output. This command takes one string parameter. When
20112 string consists of a single character, Org uses it as a key to
20113 ~org-agenda-custom-commands~. These are the same ones available
20114 through the agenda dispatcher (see [[*The Agenda Dispatcher]]).
20116 This example command line directly prints the TODO list to the printer:
20118 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
20120 When the string parameter length is two or more characters, Org
20121 matches it with tags/TODO strings. For example, this example command
20122 line prints items tagged with =shop=, but excludes items tagged with
20126 emacs -batch -l ~/.emacs \
20127 -eval '(org-batch-agenda "+shop-NewYork")' | lpr
20130 #+texinfo: @noindent
20131 An example showing on-the-fly parameter modifications:
20134 emacs -batch -l ~/.emacs \
20135 -eval '(org-batch-agenda "a" \
20136 org-agenda-span (quote month) \
20137 org-agenda-include-diary nil \
20138 org-agenda-files (quote ("~/org/project.org")))' \
20142 #+texinfo: @noindent
20143 which produces an agenda for the next 30 days from just the
20144 =~/org/projects.org= file.
20146 #+findex: org-batch-agenda-csv
20147 For structured processing of agenda output, use ~org-batch-agenda-csv~
20148 with the following fields:
20150 - category :: The category of the item
20151 - head :: The headline, without TODO keyword, TAGS and PRIORITY
20152 - type :: The type of the agenda entry, can be
20154 | ~todo~ | selected in TODO match |
20155 | ~tagsmatch~ | selected in tags match |
20156 | ~diary~ | imported from diary |
20157 | ~deadline~ | a deadline |
20158 | ~scheduled~ | scheduled |
20159 | ~timestamp~ | appointment, selected by timestamp |
20160 | ~closed~ | entry was closed on date |
20161 | ~upcoming-deadline~ | warning about nearing deadline |
20162 | ~past-scheduled~ | forwarded scheduled item |
20163 | ~block~ | entry has date block including date |
20165 - todo :: The TODO keyword, if any
20166 - tags :: All tags including inherited ones, separated by colons
20167 - date :: The relevant date, like =2007-2-14=
20168 - time :: The time, like =15:00-16:50=
20169 - extra :: String with extra planning info
20170 - priority-l :: The priority letter if any was given
20171 - priority-n :: The computed numerical priority
20173 #+texinfo: @noindent
20174 If the selection of the agenda item was based on a timestamp,
20175 including those items with =DEADLINE= and =SCHEDULED= keywords, then
20176 Org includes date and time in the output.
20178 If the selection of the agenda item was based on a timestamp (or
20179 deadline/scheduled), then Org includes date and time in the output.
20181 Here is an example of a post-processing script in Perl. It takes the
20182 CSV output from Emacs and prints with a checkbox:
20187 # define the Emacs command to run
20188 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
20190 # run it and capture the output
20191 $agenda = qx{$cmd 2>/dev/null};
20193 # loop over all lines
20194 foreach $line (split(/\n/,$agenda)) {
20195 # get the individual values
20196 ($category,$head,$type,$todo,$tags,$date,$time,$extra,
20197 $priority_l,$priority_n) = split(/,/,$line);
20198 # process and print
20199 print "[ ] $head\n";
20203 ** Using the Property API
20205 :DESCRIPTION: Writing programs that use entry properties.
20207 #+cindex: API, for properties
20208 #+cindex: properties, API
20210 Here is a description of the functions that can be used to work with
20213 #+attr_texinfo: :options org-entry-properties &optional pom which
20215 Get all properties of the entry at point-or-marker {{{var(POM)}}}.
20216 This includes the TODO keyword, the tags, time strings for deadline,
20217 scheduled, and clocking, and any additional properties defined in the
20218 entry. The return value is an alist. Keys may occur multiple times
20219 if the property key was used several times. {{{var(POM)}}} may also
20220 be ~nil~, in which case the current entry is used. If
20221 {{{var(WHICH)}}} is ~nil~ or ~all~, get all properties. If
20222 {{{var(WHICH)}}} is ~special~ or ~standard~, only get that subclass.
20225 #+vindex: org-use-property-inheritance
20226 #+findex: org-insert-property-drawer
20227 #+attr_texinfo: :options org-entry-get pom property &optional inherit
20229 Get value of {{{var(PROPERTY)}}} for entry at point-or-marker
20230 {{{var(POM)}}}. By default, this only looks at properties defined
20231 locally in the entry. If {{{var(INHERIT)}}} is non-~nil~ and the
20232 entry does not have the property, then also check higher levels of the
20233 hierarchy. If {{{var(INHERIT)}}} is the symbol ~selective~, use
20234 inheritance if and only if the setting of
20235 ~org-use-property-inheritance~ selects {{{var(PROPERTY)}}} for
20239 #+attr_texinfo: :options org-entry-delete pom property
20241 Delete the property {{{var(PROPERTY)}}} from entry at point-or-marker
20245 #+attr_texinfo: :options org-entry-put pom property value
20247 Set {{{var(PROPERTY)}}} to {{{var(VALUES)}}} for entry at
20248 point-or-marker POM.
20251 #+attr_texinfo: :options org-buffer-property-keys &optional include-specials
20253 Get all property keys in the current buffer.
20256 #+attr_texinfo: :options org-insert-property-drawer
20258 Insert a property drawer for the current entry. Also
20261 #+attr_texinfo: :options org-entry-put-multivalued-property pom property &rest values
20263 Set {{{var(PROPERTY)}}} at point-or-marker {{{var(POM)}}} to
20264 {{{var(VALUES)}}}. {{{var(VALUES)}}} should be a list of strings.
20265 They are concatenated, with spaces as separators.
20268 #+attr_texinfo: :options org-entry-get-multivalued-property pom property
20270 Treat the value of the property {{{var(PROPERTY)}}} as
20271 a whitespace-separated list of values and return the values as a list
20275 #+attr_texinfo: :options org-entry-add-to-multivalued-property pom property value
20277 Treat the value of the property {{{var(PROPERTY)}}} as
20278 a whitespace-separated list of values and make sure that
20279 {{{var(VALUE)}}} is in this list.
20282 #+attr_texinfo: :options org-entry-remove-from-multivalued-property pom property value
20284 Treat the value of the property {{{var(PROPERTY)}}} as
20285 a whitespace-separated list of values and make sure that
20286 {{{var(VALUE)}}} is /not/ in this list.
20289 #+attr_texinfo: :options org-entry-member-in-multivalued-property pom property value
20291 Treat the value of the property {{{var(PROPERTY)}}} as
20292 a whitespace-separated list of values and check if {{{var(VALUE)}}} is
20296 #+attr_texinfo: :options org-property-allowed-value-functions
20298 Hook for functions supplying allowed values for a specific property.
20299 The functions must take a single argument, the name of the property,
20300 and return a flat list of allowed values. If =:ETC= is one of the
20301 values, use the values as completion help, but allow also other values
20302 to be entered. The functions must return ~nil~ if they are not
20303 responsible for this property.
20306 ** Using the Mapping API
20308 :DESCRIPTION: Mapping over all or selected entries.
20310 #+cindex: API, for mapping
20311 #+cindex: mapping entries, API
20313 Org has sophisticated mapping capabilities to find all entries
20314 satisfying certain criteria. Internally, this functionality is used
20315 to produce agenda views, but there is also an API that can be used to
20316 execute arbitrary functions for each or selected entries. The main
20317 entry point for this API is:
20319 #+attr_texinfo: :options org-map-entries func &optional match scope &rest skip
20321 Call {{{(var(FUNC))}}} at each headline selected by {{{var(MATCH)}}}
20322 in {{{var(SCOPE)}}}.
20324 {{{var(FUNC)}}} is a function or a Lisp form. With point positioned
20325 at the beginning of the headline, call the function without arguments.
20326 Org returns an alist of return values of calls to the function.
20328 To avoid preserving point, Org wraps the call to {{{var(FUNC)}}} in
20329 ~save-excursion~ form. After evaluation, Org moves point to the end
20330 of the line that was just processed. Search continues from that point
20331 forward. This may not always work as expected under some conditions,
20332 such as if the current sub-tree was removed by a previous archiving
20333 operation. In such rare circumstances, Org skips the next entry
20334 entirely when it should not. To stop Org from such skips, make
20335 {{{var(FUNC)}}} set the variable ~org-map-continue-from~ to a specific
20338 {{{var(MATCH)}}} is a tags/property/TODO match. Org iterates only
20339 matched headlines. Org iterates over all headlines when
20340 {{{var(MATCH)}}} is ~nil~ or ~t~.
20342 {{{var(SCOPE)}}} determines the scope of this command. It can be any
20347 The current buffer, respecting the restriction, if any.
20351 The subtree started with the entry at point.
20355 The entries within the active region, if any.
20359 The current buffer, without restriction.
20361 - ~file-with-archives~ ::
20363 The current buffer, and any archives associated with it.
20369 - ~agenda-with-archives~ ::
20371 All agenda files with any archive files associated with them.
20373 - ~(file1 file2 ...)~ ::
20375 If this is a list, all files in the list are scanned.
20377 #+texinfo: @noindent
20378 The remaining arguments are treated as settings for the scanner's
20379 skipping facilities. Valid arguments are:
20383 Skip trees with the archive tag.
20387 Skip trees with the COMMENT keyword.
20389 - function or Lisp form ::
20391 #+vindex: org-agenda-skip-function
20392 Used as value for ~org-agenda-skip-function~, so whenever the
20393 function returns ~t~, {{{var(FUNC)}}} is called for that entry
20394 and search continues from the point where the function leaves it.
20397 The mapping routine can call any arbitrary function, even functions
20398 that change meta data or query the property API (see [[*Using the
20399 Property API]]). Here are some handy functions:
20401 #+attr_texinfo: :options org-todo &optional arg
20403 Change the TODO state of the entry. See the docstring of the
20404 functions for the many possible values for the argument
20408 #+attr_texinfo: :options org-priority &optional action
20410 Change the priority of the entry. See the docstring of this function
20411 for the possible values for {{{var(ACTION)}}}.
20414 #+attr_texinfo: :options org-toggle-tag tag &optional onoff
20416 Toggle the tag {{{var(TAG)}}} in the current entry. Setting
20417 {{{var(ONOFF)}}} to either ~on~ or ~off~ does not toggle tag, but
20418 ensure that it is either on or off.
20421 #+attr_texinfo: :options org-promote
20423 Promote the current entry.
20426 #+attr_texinfo: :options org-demote
20428 Demote the current entry.
20431 This example turns all entries tagged with =TOMORROW= into TODO
20432 entries with keyword =UPCOMING=. Org ignores entries in comment trees
20435 #+begin_src emacs-lisp
20436 (org-map-entries '(org-todo "UPCOMING")
20437 "+TOMORROW" 'file 'archive 'comment)
20440 The following example counts the number of entries with TODO keyword
20441 =WAITING=, in all agenda files.
20443 #+begin_src emacs-lisp
20444 (length (org-map-entries t "/+WAITING" 'agenda))
20447 * History and Acknowledgments
20449 :DESCRIPTION: How Org came into being.
20458 Org was born in 2003, out of frustration over the user interface of
20459 the Emacs Outline mode. I was trying to organize my notes and
20460 projects, and using Emacs seemed to be the natural way to go.
20461 However, having to remember eleven different commands with two or
20462 three keys per command, only to hide and show parts of the outline
20463 tree, that seemed entirely unacceptable to me. Also, when using
20464 outlines to take notes, I constantly wanted to restructure the tree,
20465 organizing it parallel to my thoughts and plans. /Visibility cycling/
20466 and /structure editing/ were originally implemented in the package
20467 =outline-magic.el=, but quickly moved to the more general =org.el=.
20468 As this environment became comfortable for project planning, the next
20469 step was adding /TODO entries/, basic /timestamps/, and /table
20470 support/. These areas highlighted the two main goals that Org still
20471 has today: to be a new, outline-based, plain text mode with innovative
20472 and intuitive editing features, and to incorporate project planning
20473 functionality directly into a notes file.
20475 Since the first release, literally thousands of emails to me or to the
20476 [[mailto:emacs-orgmode@gnu.org][mailing list]] have provided a constant stream of bug reports, feedback,
20477 new ideas, and sometimes patches and add-on code. Many thanks to
20478 everyone who has helped to improve this package. I am trying to keep
20479 here a list of the people who had significant influence in shaping one
20480 or more aspects of Org. The list may not be complete, if I have
20481 forgotten someone, please accept my apologies and let me know.
20483 Before I get to this list, a few special mentions are in order:
20485 - Bastien Guerry ::
20487 Bastien has written a large number of extensions to Org (most of
20488 them integrated into the core by now), including the LaTeX
20489 exporter and the plain list parser. His support during the early
20490 days was central to the success of this project. Bastien also
20491 invented Worg, helped establishing the Web presence of Org, and
20492 sponsored hosting costs for the orgmode.org website. Bastien
20493 stepped in as maintainer of Org between 2011 and 2013, at a time
20494 when I desperately needed a break.
20496 - Eric Schulte and Dan Davison ::
20498 Eric and Dan are jointly responsible for the Org Babel system,
20499 which turns Org into a multi-language environment for evaluating
20500 code and doing literate programming and reproducible research.
20501 This has become one of Org's killer features that define what Org
20506 John has contributed a number of great ideas and patches directly
20507 to Org, including the attachment system (=org-attach.el=),
20508 integration with Apple Mail (=org-mac-message.el=), hierarchical
20509 dependencies of TODO items, habit tracking (=org-habits.el=), and
20510 encryption (=org-crypt.el=). Also, the capture system is really
20511 an extended copy of his great =remember.el=.
20513 - Sebastian Rose ::
20515 Without Sebastian, the HTML/XHTML publishing of Org would be the
20516 pitiful work of an ignorant amateur. Sebastian has pushed this
20517 part of Org onto a much higher level. He also wrote
20518 =org-info.js=, a Java script for displaying webpages derived from
20519 Org using an Info-like or a folding interface with single-key
20522 #+texinfo: @noindent
20523 See below for the full list of contributions! Again, please let me
20524 know what I am missing here!
20531 I (Bastien) have been maintaining Org between 2011 and 2013. This
20532 appendix would not be complete without adding a few more
20533 acknowledgments and thanks.
20535 I am first grateful to Carsten for his trust while handing me over the
20536 maintainership of Org. His unremitting support is what really helped
20537 me getting more confident over time, with both the community and the
20540 When I took over maintainership, I knew I would have to make Org more
20541 collaborative than ever, as I would have to rely on people that are
20542 more knowledgeable than I am on many parts of the code. Here is
20543 a list of the persons I could rely on, they should really be
20544 considered co-maintainers, either of the code or the community:
20548 Eric is maintaining the Babel parts of Org. His reactivity here
20549 kept me away from worrying about possible bugs here and let me
20550 focus on other parts.
20552 - Nicolas Goaziou ::
20554 Nicolas is maintaining the consistency of the deepest parts of
20555 Org. His work on =org-element.el= and =ox.el= has been
20556 outstanding, and it opened the doors for many new ideas and
20557 features. He rewrote many of the old exporters to use the new
20558 export engine, and helped with documenting this major change.
20559 More importantly (if that's possible), he has been more than
20560 reliable during all the work done for Org 8.0, and always very
20561 reactive on the mailing list.
20565 Achim rewrote the building process of Org, turning some /ad hoc/
20566 tools into a flexible and conceptually clean process. He
20567 patiently coped with the many hiccups that such a change can
20572 The Org mode mailing list would not be such a nice place without
20573 Nick, who patiently helped users so many times. It is impossible
20574 to overestimate such a great help, and the list would not be so
20575 active without him.
20577 I received support from so many users that it is clearly impossible to
20578 be fair when shortlisting a few of them, but Org's history would not
20579 be complete if the ones above were not mentioned in this manual.
20581 ** List of Contributions
20586 - Russel Adams came up with the idea for drawers.
20588 - Thomas Baumann wrote =org-bbdb.el= and =org-mhe.el=.
20590 - Christophe Bataillon created the great unicorn logo that we use on
20591 the Org mode website.
20593 - Alex Bochannek provided a patch for rounding timestamps.
20595 - Jan Böcker wrote =org-docview.el=.
20597 - Brad Bozarth showed how to pull RSS feed data into Org files.
20599 - Tom Breton wrote =org-choose.el=.
20601 - Charles Cave's suggestion sparked the implementation of templates
20602 for Remember, which are now templates for capture.
20604 - Pavel Chalmoviansky influenced the agenda treatment of items with
20607 - Gregory Chernov patched support for Lisp forms into table
20608 calculations and improved XEmacs compatibility, in particular by
20609 porting =nouline.el= to XEmacs.
20611 - Sacha Chua suggested copying some linking code from Planner.
20613 - Baoqiu Cui contributed the DocBook exporter.
20615 - Eddward DeVilla proposed and tested checkbox statistics. He also
20616 came up with the idea of properties, and that there should be an API
20619 - Nick Dokos tracked down several nasty bugs.
20621 - Kees Dullemond used to edit projects lists directly in HTML and so
20622 inspired some of the early development, including HTML export. He
20623 also asked for a way to narrow wide table columns.
20625 - Thomas\nbsp{}S.\nbsp{}Dye contributed documentation on Worg and helped
20626 integrating the Org Babel documentation into the manual.
20628 - Christian Egli converted the documentation into Texinfo format,
20629 inspired the agenda, patched CSS formatting into the HTML exporter,
20630 and wrote =org-taskjuggler.el=.
20632 - David Emery provided a patch for custom CSS support in exported HTML
20635 - Nic Ferrier contributed mailcap and XOXO support.
20637 - Miguel\nbsp{}A.\nbsp{}Figueroa-Villanueva implemented hierarchical checkboxes.
20639 - John Foerch figured out how to make incremental search show context
20640 around a match in a hidden outline tree.
20642 - Raimar Finken wrote =org-git-line.el=.
20644 - Mikael Fornius works as a mailing list moderator.
20646 - Austin Frank works as a mailing list moderator.
20648 - Eric Fraga drove the development of Beamer export with ideas and
20651 - Barry Gidden did proofreading the manual in preparation for the book
20652 publication through Network Theory Ltd.
20654 - Niels Giesen had the idea to automatically archive DONE trees.
20656 - Nicolas Goaziou rewrote much of the plain list code.
20658 - Kai Grossjohann pointed out key-binding conflicts with other
20661 - Brian Gough of Network Theory Ltd publishes the Org mode manual as
20664 - Bernt Hansen has driven much of the support for auto-repeating
20665 tasks, task state change logging, and the clocktable. His clear
20666 explanations have been critical when we started to adopt the Git
20667 version control system.
20669 - Manuel Hermenegildo has contributed various ideas, small fixes and
20672 - Phil Jackson wrote =org-irc.el=.
20674 - Scott Jaderholm proposed footnotes, control over whitespace between
20675 folded entries, and column view for properties.
20677 - Matt Jones wrote MobileOrg Android.
20679 - Tokuya Kameshima wrote =org-wl.el= and =org-mew.el=.
20681 - Shidai Liu ("Leo") asked for embedded LaTeX and tested it. He also
20682 provided frequent feedback and some patches.
20684 - Matt Lundin has proposed last-row references for table formulas and
20685 named invisible anchors. He has also worked a lot on the FAQ.
20687 - David Maus wrote =org-atom.el=, maintains the issues file for Org,
20688 and is a prolific contributor on the mailing list with competent
20689 replies, small fixes and patches.
20691 - Jason\nbsp{}F.\nbsp{}McBrayer suggested agenda export to CSV format.
20693 - Max Mikhanosha came up with the idea of refiling.
20695 - Dmitri Minaev sent a patch to set priority limits on a per-file
20698 - Stefan Monnier provided a patch to keep the Emacs Lisp compiler
20701 - Richard Moreland wrote MobileOrg for the iPhone.
20703 - Rick Moynihan proposed allowing multiple TODO sequences in a file
20704 and being able to quickly restrict the agenda to a subtree.
20706 - Todd Neal provided patches for links to Info files and Elisp forms.
20708 - Greg Newman refreshed the unicorn logo into its current form.
20710 - Tim O'Callaghan suggested in-file links, search options for general
20711 file links, and tags.
20713 - Osamu Okano wrote =orgcard2ref.pl=, a Perl program to create a text
20714 version of the reference card.
20716 - Takeshi Okano translated the manual and David O'Toole's tutorial
20719 - Oliver Oppitz suggested multi-state TODO items.
20721 - Scott Otterson sparked the introduction of descriptive text for
20722 links, among other things.
20724 - Pete Phillips helped during the development of the TAGS feature,
20725 and provided frequent feedback.
20727 - Martin Pohlack provided the code snippet to bundle character
20728 insertion into bundles of 20 for undo.
20730 - T.\nbsp{}V.\nbsp{}Raman reported bugs and suggested improvements.
20732 - Matthias Rempe (Oelde) provided ideas, Windows support, and quality
20735 - Paul Rivier provided the basic implementation of named footnotes.
20736 He also acted as mailing list moderator for some time.
20738 - Kevin Rogers contributed code to access VM files on remote hosts.
20740 - Frank Ruell solved the mystery of the =keymapp nil= bug, a conflict
20743 - Jason Riedy generalized the send-receive mechanism for Orgtbl
20744 tables with extensive patches.
20746 - Philip Rooke created the Org reference card, provided lots of
20747 feedback, developed and applied standards to the Org documentation.
20749 - Christian Schlauer proposed angular brackets around links, among
20752 - Paul Sexton wrote =org-ctags.el=.
20754 - Tom Shannon's =organizer-mode.el= inspired linking to VM/BBDB/Gnus.
20756 - Ilya Shlyakhter proposed the Archive Sibling, line numbering in
20757 literal examples, and remote highlighting for referenced code lines.
20759 - Stathis Sideris wrote the =ditaa.jar= ASCII to PNG converter that is
20760 now packaged into Org's =contrib/= directory.
20762 - Daniel Sinder came up with the idea of internal archiving by locking
20765 - Dale Smith proposed link abbreviations.
20767 - James TD Smith has contributed a large number of patches for
20768 useful tweaks and features.
20770 - Adam Spiers asked for global linking commands, inspired the link
20771 extension system, added support for Mairix, and proposed the mapping
20774 - Ulf Stegemann created the table to translate special symbols to
20775 HTML, LaTeX, UTF-8, Latin-1 and ASCII.
20777 - Andy Stewart contributed code to =org-w3m.el=, to copy
20778 HTML content with links transformation to Org syntax.
20780 - David O'Toole wrote =org-publish.el= and drafted the
20781 manual chapter about publishing.
20783 - Jambunathan\nbsp{}K.\nbsp{}contributed the ODT exporter.
20785 - Sebastien Vauban reported many issues with LaTeX and Beamer export
20786 and enabled source code highlighting in Gnus.
20788 - Stefan Vollmar organized a video-recorded talk at the
20789 Max-Planck-Institute for Neurology. He also inspired the creation
20790 of a concept index for HTML export.
20792 - Jürgen Vollmer contributed code generating the table of contents in
20795 - Samuel Wales has provided important feedback and bug reports.
20797 - Chris Wallace provided a patch implementing the =QUOTE= block.
20799 - David Wainberg suggested archiving, and improvements to the
20802 - Carsten Wimmer suggested some changes and helped fix a bug in
20805 - Roland Winkler requested additional key bindings to make Org work on
20808 - Piotr Zielinski wrote =org-mouse.el=, proposed agenda
20809 blocks and contributed various ideas and code snippets.
20811 - Marco Wahl wrote =org-eww.el=.
20813 * GNU Free Documentation License
20816 :DESCRIPTION: The license for this documentation.
20819 #+texinfo: @include doclicense.texi
20824 :DESCRIPTION: An index of Org's concepts and features.
20829 :DESCRIPTION: Key bindings and where they are described.
20833 * Command and Function Index
20835 :DESCRIPTION: Command names and some internal functions.
20841 :DESCRIPTION: Variables mentioned in the manual.
20845 This is not a complete index of variables and faces, only the ones
20846 that are mentioned in the manual. For a more complete list, use
20847 {{{kbd(M-x org-customize)}}} and then click yourself through the tree.
20854 This manual is for Org version {{{version}}}.
20856 Copyright \copy 2004--2018 Free Software Foundation, Inc.
20859 Permission is granted to copy, distribute and/or modify this document
20860 under the terms of the GNU Free Documentation License, Version 1.3 or
20861 any later version published by the Free Software Foundation; with no
20862 Invariant Sections, with the Front-Cover Texts being "A GNU Manual,"
20863 and with the Back-Cover Texts as in (a) below. A copy of the license
20864 is included in the section entitled "GNU Free Documentation License."
20866 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
20867 modify this GNU manual."
20870 * Export Setup :noexport:
20872 #+subtitle: Release {{{version}}}
20873 #+author: The Org Mode Developers
20874 #+date: {{{modification-time}}}
20877 # XXX: We cannot use TODO keyword as a node starts with "TODO".
20878 #+todo: REVIEW FIXME | DONE
20879 #+property: header-args :eval no
20880 #+startup: overview nologdone
20882 #+export_file_name: org.texi
20884 #+texinfo_dir_category: Emacs editing modes
20885 #+texinfo_dir_title: Org Mode: (org)
20886 #+texinfo_dir_desc: Outline-based notes management and organizer
20888 # Use proper quote and backtick for code sections in PDF output
20889 # Cf. Texinfo manual 14.2
20890 #+texinfo_header: @set txicodequoteundirected
20891 #+texinfo_header: @set txicodequotebacktick
20894 #+texinfo_header: @set MAINTAINERSITE @uref{https://orgmode.org,maintainers webpage}
20895 #+texinfo_header: @set MAINTAINER Carsten Dominik
20896 #+texinfo_header: @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
20897 #+texinfo_header: @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
20899 #+options: H:4 num:t toc:t author:t \n:nil ::t |:t ^:nil -:t f:t *:t <:t e:t ':t
20900 #+options: d:nil todo:nil pri:nil tags:not-in-toc stat:nil broken-links:mark
20901 #+select_tags: export
20902 #+exclude_tags: noexport
20904 #+macro: cite @@texinfo:@cite{@@$1@@texinfo:}@@
20905 #+macro: var @@texinfo:@var{@@$1@@texinfo:}@@
20907 # The "version" macro extracts "Version" keyword from "org.el". It
20908 # returns major.minor version number. This is sufficient since bugfix
20909 # releases are not expected to add features and therefore imply manual
20911 #+macro: version (eval (with-current-buffer (find-file-noselect "../lisp/org.el") (org-with-point-at 1 (if (re-search-forward "Version: +\\([0-9.]+\\)" nil t) (mapconcat #'identity (cl-subseq (split-string (match-string-no-properties 1) "\\.") 0 2) ".") (error "Missing \"Version\" keyword in \"org.el\"")))))
20913 # The "kbd" macro turns KBD into @kbd{KBD}. Additionnally, it
20914 # encloses case-sensitive special keys (SPC, RET...) within @key{...}.
20915 #+macro: kbd (eval (let ((case-fold-search nil) (regexp (regexp-opt '("SPC" "RET" "LFD" "TAB" "BS" "ESC" "DELETE" "SHIFT" "Ctrl" "Meta" "Alt" "Cmd" "Super" "UP" "LEFT" "RIGHT" "DOWN") 'words))) (format "@@texinfo:@kbd{@@%s@@texinfo:}@@" (replace-regexp-in-string regexp "@@texinfo:@key{@@\\&@@texinfo:}@@" $1 t))))
20919 [fn:1] If you do not use Font Lock globally turn it on in Org buffer
20920 with ~(add-hook 'org-mode-hook 'turn-on-font-lock)~.
20922 [fn:2] Please consider subscribing to the mailing list in order to
20923 minimize the work the mailing list moderators have to do.
20925 [fn:3] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~,
20926 and ~org-ctrl-k-protect-subtree~ to configure special behavior of
20927 {{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines. Note
20928 also that clocking only works with headings indented less than 30
20931 [fn:4] See, however, the option ~org-cycle-emulate-tab~.
20933 [fn:5] The indirect buffer contains the entire buffer, but is narrowed
20934 to the current tree. Editing the indirect buffer also changes the
20935 original buffer, but without affecting visibility in that buffer. For
20936 more information about indirect buffers, see [[info:emacs#Indirect%20Buffers][GNU Emacs Manual]].
20938 [fn:6] When ~org-agenda-inhibit-startup~ is non-~nil~, Org does not
20939 honor the default visibility state when first opening a file for the
20940 agenda (see [[*Speeding Up Your Agendas]]).
20942 [fn:7] See also the variable ~org-show-context-detail~ to decide how
20943 much context is shown around each match.
20945 [fn:8] This depends on the option ~org-remove-highlights-with-change~.
20947 [fn:9] When using =*= as a bullet, lines must be indented so that they
20948 are not interpreted as headlines. Also, when you are hiding leading
20949 stars to get a clean outline view, plain list items starting with
20950 a star may be hard to distinguish from true headlines. In short: even
20951 though =*= is supported, it may be better to not use it for plain list
20954 [fn:10] You can filter out any of them by configuring
20955 ~org-plain-list-ordered-item-terminator~.
20957 [fn:11] You can also get =a.=, =A.=, =a)= and =A)= by configuring
20958 ~org-list-allow-alphabetical~. To minimize confusion with normal
20959 text, those are limited to one character only. Beyond that limit,
20960 bullets automatically become numbers.
20962 [fn:12] If there's a checkbox in the item, the cookie must be put
20963 /before/ the checkbox. If you have activated alphabetical lists, you
20964 can also use counters like =[@b]=.
20966 [fn:13] If you do not want the item to be split, customize the
20967 variable ~org-M-RET-may-split-line~.
20969 [fn:14] If you want to cycle around items that way, you may customize
20970 ~org-list-use-circular-motion~.
20972 [fn:15] See ~org-list-use-circular-motion~ for a cyclic behavior.
20974 [fn:16] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows.
20975 Use {{{kbd(C-M-i)}}} or {{{kbd(ESC TAB)}}} instead.
20977 [fn:17] The corresponding in-buffer setting is: =#+STARTUP: fninline=
20978 or =#+STARTUP: nofninline=.
20980 [fn:18] The corresponding in-buffer options are =#+STARTUP: fnadjust=
20981 and =#+STARTUP: nofnadjust=.
20983 [fn:19] To insert a vertical bar into a table field, use =\vert= or,
20984 inside a word =abc\vert{}def=.
20986 [fn:20] Org understands references typed by the user as =B4=, but it
20987 does not use this syntax when offering a formula for editing. You can
20988 customize this behavior using the variable
20989 ~org-table-use-standard-references~.
20991 [fn:21] The computation time scales as O(N^2) because table
20992 {{{var(FOO)}}} is parsed for each field to be copied.
20994 [fn:22] The file =constants.el= can supply the values of constants in
20995 two different unit systems, =SI= and =cgs=. Which one is used depends
20996 on the value of the variable ~constants-unit-system~. You can use the
20997 =STARTUP= options =constSI= and =constcgs= to set this value for the
21000 [fn:23] The printf reformatting is limited in precision because the
21001 value passed to it is converted into an "integer" or "double". The
21002 "integer" is limited in size by truncating the signed value to 32
21003 bits. The "double" is limited in precision to 64 bits overall which
21004 leaves approximately 16 significant decimal digits.
21006 [fn:24] Such names must start with an alphabetic character and use
21007 only alphanumeric/underscore characters.
21009 [fn:25] More accurately, the precise behavior depends on how point
21010 arrived there---see [[info:elisp#Invisible%20Text][Invisible Text]].
21012 [fn:26] To insert a link targeting a headline, in-buffer completion
21013 can be used. Just type a star followed by a few optional letters into
21014 the buffer and press {{{kbd(M-TAB)}}}. All headlines in the current
21015 buffer are offered as completions.
21017 [fn:27] When targeting a =NAME= keyword, the =CAPTION= keyword is
21018 mandatory in order to get proper numbering (see [[*Captions]]).
21020 [fn:28] The actual behavior of the search depends on the value of the
21021 variable ~org-link-search-must-match-exact-headline~. If its value is
21022 ~nil~, then a fuzzy text search is done. If it is ~t~, then only the
21023 exact headline is matched, ignoring spaces and statistic cookies. If
21024 the value is ~query-to-create~, then an exact headline is searched; if
21025 it is not found, then the user is queried to create it.
21027 [fn:29] If the headline contains a timestamp, it is removed from the
21028 link, which results in a wrong link---you should avoid putting
21029 a timestamp in the headline.
21031 [fn:30] The Org Id library must first be loaded, either through
21032 ~org-customize~, by enabling ~id~ in ~org-modules~, or by adding
21033 ~(require 'org-id)~ in your Emacs init file.
21035 [fn:31] Note that you do not have to use this command to insert
21036 a link. Links in Org are plain text, and you can type or paste them
21037 straight into the buffer. By using this command, the links are
21038 automatically enclosed in double brackets, and you will be asked for
21039 the optional descriptive text.
21041 [fn:32] After insertion of a stored link, the link will be removed
21042 from the list of stored links. To keep it in the list for later use,
21043 use a triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
21044 configure the option ~org-keep-stored-link-after-insertion~.
21046 [fn:33] This works if a function has been defined in the ~:complete~
21047 property of a link in ~org-link-parameters~.
21049 [fn:34] See the variable ~org-display-internal-link-with-indirect-buffer~.
21051 [fn:35] For backward compatibility, line numbers can also follow a
21054 [fn:36] Of course, you can make a document that contains only long
21055 lists of TODO items, but this is not required.
21057 [fn:37] Changing the variable ~org-todo-keywords~ only becomes
21058 effective after restarting Org mode in a buffer.
21060 [fn:38] This is also true for the {{{kbd(t)}}} command in the agenda
21063 [fn:39] All characters are allowed except =@=, =^= and =!=, which have
21064 a special meaning here.
21066 [fn:40] Check also the variable ~org-fast-tag-selection-include-todo~,
21067 it allows you to change the TODO state through the tags interface (see
21068 [[*Setting Tags]]), in case you like to mingle the two concepts. Note
21069 that this means you need to come up with unique keys across both sets
21072 [fn:41] Org mode parses these lines only when Org mode is activated
21073 after visiting a file. {{{kbd(C-c C-c)}}} with point in a line
21074 starting with =#+= is simply restarting Org mode for the current
21077 [fn:42] The corresponding in-buffer setting is: =#+STARTUP: logdone=.
21079 [fn:43] The corresponding in-buffer setting is: =#+STARTUP:
21082 [fn:44] See the variable ~org-log-states-order-reversed~.
21084 [fn:45] Note that the =LOGBOOK= drawer is unfolded when pressing
21085 {{{kbd(SPC)}}} in the agenda to show an entry---use {{{kbd(C-u
21086 SPC)}}} to keep it folded here.
21088 [fn:46] It is possible that Org mode records two timestamps when you
21089 are using both ~org-log-done~ and state change logging. However, it
21090 never prompts for two notes: if you have configured both, the state
21091 change recording note takes precedence and cancel the closing note.
21093 [fn:47] See also the option ~org-priority-start-cycle-with-default~.
21095 [fn:48] To keep subtasks out of the global TODO list, see the option
21096 ~org-agenda-todo-list-sublevels~.
21098 [fn:49] With the exception of description lists. But you can allow it
21099 by modifying ~org-list-automatic-rules~ accordingly.
21101 [fn:50] Set the variable ~org-hierarchical-checkbox-statistics~ if you
21102 want such cookies to count all checkboxes below the cookie, not just
21103 those belonging to direct children.
21105 [fn:51] {{{kbd(C-u C-c C-c)}}} on the /first/ item of a list with no
21106 checkbox adds checkboxes to the rest of the list.
21108 [fn:52] As with all these in-buffer settings, pressing {{{kbd(C-c
21109 C-c)}}} activates any changes in the line.
21111 [fn:53] This is only true if the search does not involve more complex
21112 tests including properties (see [[*Property Searches]]).
21114 [fn:54] To extend this default list to all tags used in all agenda
21115 files (see [[*Agenda Views]]), customize the variable
21116 ~org-complete-tags-always-offer-all-agenda-tags~.
21118 [fn:55] Keys are automatically assigned to tags that have no
21121 [fn:56] If more than one summary type applies to the same property,
21122 the parent values are computed according to the first of them.
21124 [fn:57] An age can be defined as a duration, using units defined in
21125 ~org-duration-units~, e.g., =3d 1h=. If any value in the column is as
21126 such, the summary is also expressed as a duration.
21128 [fn:58] Please note that the =COLUMNS= definition must be on a single
21129 line; it is wrapped here only because of formatting constraints.
21131 [fn:59] Contributed packages are not part of Emacs, but are
21132 distributed with the main distribution of Org---visit
21133 [[https://orgmode.org]].
21135 [fn:60] The Org date format is inspired by the standard ISO 8601
21136 date/time format. To use an alternative format, see [[*Custom time
21137 format]]. The day name is optional when you type the date yourself.
21138 However, any date inserted or modified by Org adds that day name, for
21139 reading convenience.
21141 [fn:61] When working with the standard diary sexp functions, you need
21142 to be very careful with the order of the arguments. That order
21143 depends evilly on the variable ~calendar-date-style~. For example, to
21144 specify a date December 12, 2005, the call might look like
21145 =(diary-date 12 1 2005)= or =(diary-date 1 12 2005)= or =(diary-date
21146 2005 12 1)=, depending on the settings. This has been the source of
21147 much confusion. Org mode users can resort to special versions of
21148 these functions like ~org-date~ or ~org-anniversary~. These work just
21149 like the corresponding ~diary-~ functions, but with stable ISO order
21150 of arguments (year, month, day) wherever applicable, independent of
21151 the value of ~calendar-date-style~.
21153 [fn:62] See the variable ~org-read-date-prefer-future~. You may set
21154 that variable to the symbol ~time~ to even make a time before now
21155 shift the date to tomorrow.
21157 [fn:63] If you do not need/want the calendar, configure the variable
21158 ~org-popup-calendar-for-date-prompt~.
21160 [fn:64] If you find this distracting, turn off the display with
21161 ~org-read-date-display-live~.
21163 [fn:65] It will still be listed on that date after it has been marked
21164 DONE. If you do not like this, set the variable
21165 ~org-agenda-skip-scheduled-if-done~.
21167 [fn:66] The =SCHEDULED= and =DEADLINE= dates are inserted on the line
21168 right below the headline. Do not put any text between this line and
21171 [fn:67] Note the corresponding =STARTUP= options =logredeadline=,
21172 =lognoteredeadline=, and =nologredeadline=.
21174 [fn:68] Note the corresponding =STARTUP= options =logreschedule=,
21175 =lognotereschedule=, and =nologreschedule=.
21177 [fn:69] In fact, the target state is taken from, in this sequence, the
21178 =REPEAT_TO_STATE= property, the variable ~org-todo-repeat-to-state~ if
21179 it is a string, the previous TODO state if ~org-todo-repeat-to-state~
21180 is ~t~, or the first state of the TODO state sequence.
21182 [fn:70] You can change this using the option ~org-log-repeat~, or the
21183 =STARTUP= options =logrepeat=, =lognoterepeat=, and =nologrepeat=.
21184 With =lognoterepeat=, you will also be prompted for a note.
21186 [fn:71] Clocking only works if all headings are indented with less
21187 than 30 stars. This is a hard-coded limitation of ~lmax~ in
21190 [fn:72] To resume the clock under the assumption that you have worked
21191 on this task while outside Emacs, use ~(setq org-clock-persist t)~.
21193 [fn:73] To add an effort estimate "on the fly", hook a function doing
21194 this to ~org-clock-in-prepare-hook~.
21196 [fn:74] The last reset of the task is recorded by the =LAST_REPEAT=
21199 [fn:75] See also the variable ~org-clock-mode-line-total~.
21201 [fn:76] The corresponding in-buffer setting is: =#+STARTUP:
21204 [fn:77] Language terms can be set through the variable
21205 ~org-clock-clocktable-language-setup~.
21207 [fn:78] Note that all parameters must be specified in a single
21208 line---the line is broken here only to fit it into the manual.
21210 [fn:79] On computers using macOS, idleness is based on actual user
21211 idleness, not just Emacs' idle time. For X11, you can install
21212 a utility program =x11idle.c=, available in the =contrib/scripts/=
21213 directory of the Org Git distribution, or install the xprintidle
21214 package and set it to the variable ~org-clock-x11idle-program-name~ if
21215 you are running Debian, to get the same general treatment of idleness.
21216 On other systems, idle time refers to Emacs idle time only.
21218 [fn:80] Please note the pitfalls of summing hierarchical data in
21219 a flat list (see [[*Using Column View in the Agenda]]).
21221 [fn:81] Org used to offer four different targets for date/week tree
21222 capture. Now, Org automatically translates these to use
21223 ~file+olp+datetree~, applying the ~:time-prompt~ and ~:tree-type~
21224 properties. Please rewrite your date/week-tree targets using
21225 ~file+olp+datetree~ since the older targets are now deprecated.
21227 [fn:82] A date tree is an outline structure with years on the highest
21228 level, months or ISO weeks as sublevels and then dates on the lowest
21229 level. Tags are allowed in the tree structure.
21231 [fn:83] If you need one of these sequences literally, escape the =%=
21234 [fn:84] If you define your own link types (see [[*Adding Hyperlink
21235 Types]]), any property you store with ~org-store-link-props~ can be
21236 accessed in capture templates in a similar way.
21238 [fn:85] This is always the other, not the user. See the variable
21239 ~org-from-is-user-regexp~.
21241 [fn:86] If you move entries or Org files from one directory to
21242 another, you may want to configure ~org-attach-directory~ to contain
21245 [fn:87] Note the corresponding =STARTUP= options =logrefile=,
21246 =lognoterefile=, and =nologrefile=.
21248 [fn:88] If the value of that variable is not a list, but a single file
21249 name, then the list of agenda files in maintained in that external
21252 [fn:89] When using the dispatcher, pressing {{{kbd(<)}}} before
21253 selecting a command actually limits the command to the current file,
21254 and ignores ~org-agenda-files~ until the next dispatcher command.
21256 [fn:90] For backward compatibility, you can also press {{{kbd(1)}}} to
21257 restrict to the current buffer.
21259 [fn:91] For backward compatibility, you can also press {{{kbd(0)}}} to
21260 restrict to the current region/subtree.
21262 [fn:92] For backward compatibility, the universal prefix argument
21263 {{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda.
21264 This feature is deprecated, use the dedicated TODO list, or a block
21265 agenda instead (see [[*Block agenda]]).
21267 [fn:93] The variable ~org-anniversary~ used in the example is just
21268 like ~diary-anniversary~, but the argument order is always according
21269 to ISO and therefore independent of the value of
21270 ~calendar-date-style~.
21272 [fn:94] You can, however, disable this by setting
21273 ~org-agenda-search-headline-for-time~ variable to a ~nil~ value.
21275 [fn:95] Custom commands can preset a filter by binding the variable
21276 ~org-agenda-tag-filter-preset~ as an option. This filter is then
21277 applied to the view and persists as a basic filter through refreshes
21278 and more secondary filtering. The filter is a global property of the
21279 entire agenda view---in a block agenda, you should only set this in
21280 the global options section, not in the section of an individual block.
21282 [fn:96] Only tags filtering is respected here, effort filtering is
21285 [fn:97] You can also create persistent custom functions through
21286 ~org-agenda-bulk-custom-functions~.
21288 [fn:98] This file is parsed for the agenda when
21289 ~org-agenda-include-diary~ is set.
21291 [fn:99] You can provide a description for a prefix key by inserting
21292 a cons cell with the prefix and the description.
21294 [fn:100] /Planned/ means here that these entries have some planning
21295 information attached to them, like a time-stamp, a scheduled or
21296 a deadline string. See ~org-agenda-entry-types~ on how to set what
21297 planning information is taken into account.
21299 [fn:101] For HTML you need to install Hrvoje Niksic's =htmlize.el=
21300 from [[https://github.com/hniksic/emacs-htmlize][Hrvoje Niksic's repository]].
21302 [fn:102] To create PDF output, the Ghostscript ps2pdf utility must be
21303 installed on the system. Selecting a PDF file also creates the
21306 [fn:103] If you want to store standard views like the weekly agenda or
21307 the global TODO list as well, you need to define custom commands for
21308 them in order to be able to specify file names.
21310 [fn:104] Quoting depends on the system you use, please check the FAQ
21313 [fn:105] You can turn this on by default by setting the variable
21314 ~org-pretty-entities~, or on a per-file base with the =STARTUP= option
21317 [fn:106] This behavior can be disabled with =-= export setting (see
21318 [[*Export Settings]]).
21320 [fn:107] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX
21321 system. Many of the features described here as "LaTeX" are really
21322 from TeX, but for simplicity I am blurring this distinction.
21324 [fn:108] When MathJax is used, only the environments recognized by
21325 MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is
21326 used to create images, any LaTeX environment is handled.
21328 [fn:109] These are respectively available at
21329 [[http://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]]
21330 and from the ImageMagick suite. Choose the converter by setting the
21331 variable ~org-preview-latex-default-process~ accordingly.
21333 [fn:110] Org mode has a method to test if point is inside such
21334 a fragment, see the documentation of the function
21335 ~org-inside-LaTeX-fragment-p~.
21337 [fn:111] This works automatically for the HTML backend (it requires
21338 version 1.34 of the =htmlize.el= package, which you need to install).
21339 Fontified code chunks in LaTeX can be achieved using either the
21340 [[https://www.ctan.org/pkg/listings][listings]] package or the [[https://www.ctan.org/pkg/minted][minted]] package. Refer to
21341 ~org-export-latex-listings~ for details.
21343 [fn:112] Source code in code blocks may also be evaluated either
21344 interactively or on export. See [[*Working with Source Code]] for more
21345 information on evaluating code blocks.
21347 [fn:113] Adding =-k= to =-n -r= /keeps/ the labels in the source code
21348 while using line numbers for the links, which might be useful to
21349 explain those in an Org mode example code.
21351 [fn:114] Upon exit, lines starting with =*=, =,*=, =#+= and =,#+= get
21352 a comma prepended, to keep them from being interpreted by Org as
21353 outline nodes or special syntax. These commas are stripped when
21354 editing with {{{kbd(C-c ')}}}, and also before export.
21356 [fn:115] You may select a different-mode with the variable
21357 ~org-edit-fixed-width-region-mode~.
21359 [fn:116] What Emacs considers to be an image depends on
21360 ~image-file-name-extensions~ and ~image-file-name-regexps~.
21362 [fn:117] The variable ~org-startup-with-inline-images~ can be set
21363 within a buffer with the =STARTUP= options =inlineimages= and
21366 [fn:118] The variable ~org-export-date-timestamp-format~ defines how
21367 this timestamp are exported.
21369 [fn:119] At the moment, some export back-ends do not obey this
21370 specification. For example, LaTeX export excludes every unnumbered
21371 headline from the table of contents.
21373 [fn:120] Note that ~org-link-search-must-match-exact-headline~ is
21374 locally bound to non-~nil~. Therefore, ~org-link-search~ only matches
21375 headlines and named elements.
21377 [fn:121] Since commas separate the arguments, commas within arguments
21378 have to be escaped with the backslash character. So only those
21379 backslash characters before a comma need escaping with another
21380 backslash character.
21382 [fn:122] For a less drastic behavior, consider using a select tag (see
21383 [[*Export Settings]]) instead.
21385 [fn:123] If =BEAMER_ENV= is set, Org export adds =B_environment= tag
21386 to make it visible. The tag serves as a visual aid and has no
21387 semantic relevance.
21389 [fn:124] By default Org loads MathJax from [[https://cdnjs.com][cdnjs.com]] as recommended by
21390 [[http://www.mathjax.org][MathJax]].
21392 [fn:125] Please note that exported formulas are part of an HTML
21393 document, and that signs such as =<=, =>=, or =&= have special
21394 meanings. See [[http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX support]].
21396 [fn:126] 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
21399 [fn:127] If the classes on TODO keywords and tags lead to conflicts,
21400 use the variables ~org-html-todo-kwd-class-prefix~ and
21401 ~org-html-tag-class-prefix~ to make them unique.
21403 [fn:128] This does not allow setting different bibliography compilers
21404 for different files. However, "smart" LaTeX compilation systems, such
21405 as latexmk, can select the correct bibliography compiler.
21407 [fn:129] See [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open Document Format for Office Applications
21408 (OpenDocument) Version 1.2]].
21410 [fn:130] See [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].
21412 [fn:131] See [[http://dlmf.nist.gov/LaTeXML/]].
21414 [fn:132] [[http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 Specification]]
21416 [fn:133] See the =<table:table-template>= element of the
21417 OpenDocument-v1.2 specification.
21419 [fn:134] See the attributes =table:template-name=,
21420 =table:use-first-row-styles=, =table:use-last-row-styles=,
21421 =table:use-first-column-styles=, =table:use-last-column-styles=,
21422 =table:use-banding-rows-styles=, and =table:use-banding-column-styles=
21423 of the =<table:table>= element in the OpenDocument-v1.2 specification.
21425 [fn:135] If the publishing directory is the same as the source
21426 directory, =file.org= is exported as =file.org.org=, so you probably
21427 do not want to do this.
21429 [fn:136] The option ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used
21430 to remove code evaluation from the {{{kbd(C-c C-c)}}} key binding.
21432 [fn:137] Actually, the constructs =call_<name>()= and =src_<lang>{}=
21433 are not evaluated when they appear in a keyword (see [[*Summary of
21434 In-Buffer Settings]]).
21436 [fn:138] Due to the way this header argument is implemented, it
21437 implies ":results file". Therefore if it is set for multiple blocks
21438 at once (by a subtree or buffer property for example), all blocks are
21439 forced to produce file results. This is seldom desired behavior, so
21440 it is recommended to set this header only on a per-block basis. It is
21441 possible that this aspect of the implementation might change in the
21444 [fn:139] C++ language is handled in =ob-C.el=. Even though the
21445 identifier for such source blocks is =C++=, you activate it by loading
21448 [fn:140] D language is handled in =ob-C.el=. Even though the
21449 identifier for such source blocks is =D=, you activate it by loading
21452 [fn:141] For Noweb literate programming details, see
21453 http://www.cs.tufts.edu/~nr/noweb/.
21455 [fn:142] For more information, please refer to the commentary section
21458 [fn:143] Note that ~org-indent-mode~ also sets the ~wrap-prefix~
21459 property, such that ~visual-line-mode~ (or purely setting ~word-wrap~)
21460 wraps long lines (including headlines) correctly indented.
21462 [fn:144] The ~org-indent-mode~ also sets the ~wrap-prefix~ correctly
21463 for indenting and wrapping long lines of headlines or text. This
21464 minor mode handles ~visual-line-mode~ and directly applied settings
21465 through ~word-wrap~.
21467 [fn:145] Also see the variable ~org-adapt-indentation~.
21469 [fn:146] Because =LEVEL=2= has 3 stars, =LEVEL=3= has 4 stars, and so
21472 [fn:147] For a server to host files, consider using a WebDAV server,
21473 such as [[https://nextcloud.com][Nextcloud]]. Additional help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]].
21475 [fn:148] If Emacs is configured for safe storing of passwords, then
21476 configure the variable ~org-mobile-encryption-password~; please read
21477 the docstring of that variable.
21479 [fn:149] Symbolic links in ~org-directory~ need to have the same name
21482 [fn:150] While creating the agendas, Org mode forces ID properties on
21483 all referenced entries, so that these entries can be uniquely
21484 identified if Org Mobile flags them for further action. To avoid
21485 setting properties configure the variable
21486 ~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode then relies
21487 on outline paths, assuming they are unique.
21489 [fn:151] Checksums are stored automatically in the file
21492 [fn:152] The file will be empty after this operation.
21494 [fn:153] https://www.ctan.org/pkg/comment
21496 [fn:154] If the =TBLFM= keyword contains an odd number of dollar
21497 characters, this may cause problems with Font Lock in LaTeX mode. As
21498 shown in the example you can fix this by adding an extra line inside
21499 the =comment= environment that is used to balance the dollar
21500 expressions. If you are using AUCTeX with the font-latex library,
21501 a much better solution is to add the =comment= environment to the
21502 variable ~LaTeX-verbatim-environments~.
21504 [fn:155] The ~agenda*~ view is the same as ~agenda~ except that it
21505 only considers /appointments/, i.e., scheduled and deadline items that
21506 have a time specification =[h]h:mm= in their time-stamps.
21508 [fn:156] Note that, for ~org-odd-levels-only~, a level number
21509 corresponds to order in the hierarchy, not to the number of stars.