3 @setfilename ../../info/org
4 @settitle The Org Manual
9 @c Version and Contact Info
10 @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
11 @set AUTHOR Carsten Dominik
12 @set MAINTAINER Carsten Dominik
13 @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
14 @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
19 @hyphenation{time-stamp time-stamps time-stamp-ing time-stamp-ed}
20 @c I created macros for the ``id est'' abbreviation; if you are Strunkian
21 @c then use the ``i.e.,'' expansion, otherwise use ``i.e.@:''.
28 @c Similarly, there are macros for the ``exempli gratia'' abbreviation.
36 @c Subheadings inside a table.
37 @macro tsubheading{text}
47 This manual is for Org version @value{VERSION}.
49 Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
52 Permission is granted to copy, distribute and/or modify this document
53 under the terms of the GNU Free Documentation License, Version 1.3 or
54 any later version published by the Free Software Foundation; with no
55 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
56 and with the Back-Cover Texts as in (a) below. A copy of the license
57 is included in the section entitled ``GNU Free Documentation License.''
59 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
60 modify this GNU manual. Buying copies from the FSF supports it in
61 developing GNU and promoting software freedom.''
63 This document is part of a collection distributed under the GNU Free
64 Documentation License. If you want to distribute this document
65 separately from the collection, you can do so by adding a copy of the
66 license to the document, as described in section 6 of the license.
72 * Org Mode: (org). Outline-based notes management and organizer
78 @subtitle Release @value{VERSION}
79 @author by Carsten Dominik
81 @c The following two commands start the copyright page.
83 @vskip 0pt plus 1filll
87 @c Output the table of contents at the beginning.
91 @node Top, Introduction, (dir), (dir)
98 * Introduction:: Getting started
99 * Document Structure:: A tree works like your brain
100 * Tables:: Pure magic for quick formatting
101 * Hyperlinks:: Notes in context
102 * TODO Items:: Every tree branch can be a TODO item
103 * Tags:: Tagging headlines and matching sets of tags
104 * Properties and Columns:: Storing information about an entry
105 * Dates and Times:: Making items useful for planning
106 * Capture:: Creating tasks and attaching files
107 * Agenda Views:: Collecting information into views
108 * Embedded LaTeX:: LaTeX fragments and formulas
109 * Exporting:: Sharing and publishing of notes
110 * Publishing:: Create a web site of linked Org files
111 * Miscellaneous:: All the rest which did not fit elsewhere
112 * Hacking:: How to hack your way around
113 * History and Acknowledgments:: How Org came into being
114 * Main Index:: An index of Org's concepts and features
115 * Key Index:: Key bindings and where they are described
116 * Variable Index:: Variables mentiond in the manual
119 --- The Detailed Node Listing ---
123 * Summary:: Brief summary of what Org does
124 * Installation:: How to install a downloaded version of Org
125 * Activation:: How to activate Org for certain buffers
126 * Feedback:: Bug reports, ideas, patches etc.
127 * Conventions:: Type-setting conventions in the manual
131 * Outlines:: Org is based on Outline mode
132 * Headlines:: How to typeset Org tree headlines
133 * Visibility cycling:: Show and hide, much simplified
134 * Motion:: Jumping to other headlines
135 * Structure editing:: Changing sequence and level of headlines
136 * Archiving:: Move done task trees to a different place
137 * Sparse trees:: Matches embedded in context
138 * Plain lists:: Additional structure within an entry
139 * Drawers:: Tucking stuff away
140 * Blocks:: Folding blocks
141 * Footnotes:: How footnotes are defined in Org's syntax
142 * Orgstruct mode:: Structure editing outside Org
146 * ARCHIVE tag:: Marking a tree as inactive
147 * Moving subtrees:: Moving a tree to an archive file
151 * Built-in table editor:: Simple tables
152 * Narrow columns:: Stop wasting space in tables
153 * Column groups:: Grouping to trigger vertical lines
154 * Orgtbl mode:: The table editor as minor mode
155 * The spreadsheet:: The table editor has spreadsheet capabilities
156 * Org-Plot:: Plotting from org tables
160 * References:: How to refer to another field or range
161 * Formula syntax for Calc:: Using Calc to compute stuff
162 * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
163 * Field formulas:: Formulas valid for a single field
164 * Column formulas:: Formulas valid for an entire column
165 * Editing and debugging formulas:: Fixing formulas
166 * Updating the table:: Recomputing all dependent fields
167 * Advanced features:: Field names, parameters and automatic recalc
171 * Link format:: How links in Org are formatted
172 * Internal links:: Links to other places in the current file
173 * External links:: URL-like links to the world
174 * Handling links:: Creating, inserting and following
175 * Using links outside Org:: Linking from my C source code?
176 * Link abbreviations:: Shortcuts for writing complex links
177 * Search options:: Linking to a specific location
178 * Custom searches:: When the default search is not enough
182 * Radio targets:: Make targets trigger links in plain text
186 * TODO basics:: Marking and displaying TODO entries
187 * TODO extensions:: Workflow and assignments
188 * Progress logging:: Dates and notes for progress
189 * Priorities:: Some things are more important than others
190 * Breaking down tasks:: Splitting a task into manageable pieces
191 * Checkboxes:: Tick-off lists
193 Extended use of TODO keywords
195 * Workflow states:: From TODO to DONE in steps
196 * TODO types:: I do this, Fred does the rest
197 * Multiple sets in one file:: Mixing it all, and still finding your way
198 * Fast access to TODO states:: Single letter selection of a state
199 * Per-file keywords:: Different files, different requirements
200 * Faces for TODO keywords:: Highlighting states
201 * TODO dependencies:: When one task needs to wait for others
205 * Closing items:: When was this entry marked DONE?
206 * Tracking TODO state changes:: When did the status change?
210 * Tag inheritance:: Tags use the tree structure of the outline
211 * Setting tags:: How to assign tags to a headline
212 * Tag searches:: Searching for combinations of tags
214 Properties and Columns
216 * Property syntax:: How properties are spelled out
217 * Special properties:: Access to other Org mode features
218 * Property searches:: Matching property values
219 * Property inheritance:: Passing values down the tree
220 * Column view:: Tabular viewing and editing
221 * Property API:: Properties for Lisp programmers
225 * Defining columns:: The COLUMNS format property
226 * Using column view:: How to create and use column view
227 * Capturing column view:: A dynamic block for column view
231 * Scope of column definitions:: Where defined, where valid?
232 * Column attributes:: Appearance and content of a column
236 * Timestamps:: Assigning a time to a tree entry
237 * Creating timestamps:: Commands which insert timestamps
238 * Deadlines and scheduling:: Planning your work
239 * Clocking work time:: Tracking how long you spend on a task
240 * Effort estimates:: Planning work effort in advance
241 * Relative timer:: Notes with a running timer
245 * The date/time prompt:: How Org mode helps you entering date and time
246 * Custom time format:: Making dates look different
248 Deadlines and scheduling
250 * Inserting deadline/schedule:: Planning items
251 * Repeated tasks:: Items that show up again and again
255 * Remember:: Capture new tasks/ideas with little interruption
256 * Attachments:: Add files to tasks.
257 * RSS Feeds:: Getting input from RSS feeds
258 * Protocols:: External (e.g. Browser) access to Emacs and Org
262 * Setting up Remember:: Some code for .emacs to get things going
263 * Remember templates:: Define the outline of different note types
264 * Storing notes:: Directly get the note to where it belongs
265 * Refiling notes:: Moving a note or task to a project
269 * Agenda files:: Files being searched for agenda information
270 * Agenda dispatcher:: Keyboard access to agenda views
271 * Built-in agenda views:: What is available out of the box?
272 * Presentation and sorting:: How agenda items are prepared for display
273 * Agenda commands:: Remote editing of Org trees
274 * Custom agenda views:: Defining special searches and views
275 * Exporting Agenda Views::
276 * Agenda column view:: Using column view for collected entries
278 The built-in agenda views
280 * Weekly/daily agenda:: The calendar page with current tasks
281 * Global TODO list:: All unfinished action items
282 * Matching tags and properties:: Structured information with fine-tuned search
283 * Timeline:: Time-sorted view for single file
284 * Keyword search:: Finding entries by keyword
285 * Stuck projects:: Find projects you need to review
287 Presentation and sorting
289 * Categories:: Not all tasks are equal
290 * Time-of-day specifications:: How the agenda knows the time
291 * Sorting of agenda items:: The order of things
295 * Storing searches:: Type once, use often
296 * Block agenda:: All the stuff you need in a single buffer
297 * Setting Options:: Changing the rules
301 * Math symbols:: @TeX{} macros for symbols and Greek letters
302 * Subscripts and superscripts:: Simple syntax for raising/lowering text
303 * LaTeX fragments:: Complex formulas made easy
304 * Processing LaTeX fragments:: Previewing La@TeX{} processing
305 * CDLaTeX mode:: Speed up entering of formulas
309 * Markup rules:: Which structures are recognized?
310 * Selective export:: Using tags to select and exclude trees
311 * Export options:: Per-file export settings
312 * The export dispatcher:: How to access exporter commands
313 * ASCII export:: Exporting to plain ASCII
314 * HTML export:: Exporting to HTML
315 * LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF
316 * DocBook export:: Exporting to DocBook
317 * XOXO export:: Exporting to XOXO
318 * iCalendar export:: Exporting in iCalendar format
322 * Document title:: How the document title is determined
323 * Headings and sections:: The main structure of the exported document
324 * Table of contents:: If, where, how to create a table of contents
325 * Initial text:: Text before the first headline
326 * Lists:: Plain lists are exported
327 * Paragraphs:: What determines beginning and ending
328 * Literal examples:: Source code and other examples
329 * Include files:: Include the contents of a file during export
330 * Tables exported:: Tables are exported richly
331 * Inlined images:: How to inline images during export
332 * Footnote markup:: ASCII representation of footnotes
333 * Emphasis and monospace:: To bold or not to bold
334 * TeX macros and LaTeX fragments:: Create special, rich export.
335 * Horizontal rules:: A line across the page
336 * Comment lines:: Some lines will not be exported
337 * Macro replacement:: Global replacement of place holdes
341 * HTML Export commands:: How to invoke HTML export
342 * Quoting HTML tags:: Using direct HTML in Org mode
343 * Links:: Transformation of links for HTML
344 * Tables in HTML export:: How to modify the formatting of tables
345 * Images in HTML export:: How to insert figures into HTML output
346 * Text areas in HTML export:: An alternative way to show an example
347 * CSS support:: Changing the appearance of the output
348 * Javascript support:: Info and Folding in a web browser
350 La@TeX{} and PDF export
352 * LaTeX/PDF export commands:: Which key invokes which commands
353 * Quoting LaTeX code:: Incorporating literal La@TeX{} code
354 * Sectioning structure:: Changing sectioning in La@TeX{} output
355 * Tables in LaTeX export:: Options for exporting tables to La@TeX{}
356 * Images in LaTeX export:: How to insert figures into La@TeX{} output
360 * DocBook export commands:: How to invoke DocBook export
361 * Quoting DocBook code:: Incorporating DocBook code in Org files
362 * Recursive sections:: Recursive sections in DocBook
363 * Tables in DocBook export:: Tables are exported as HTML tables
364 * Images in DocBook export:: How to insert figures into DocBook output
365 * Special characters:: How to handle special characters
369 * Configuration:: Defining projects
370 * Uploading files:: How to get files up on the server
371 * Sample configuration:: Example projects
372 * Triggering publication:: Publication commands
376 * Project alist:: The central configuration variable
377 * Sources and destinations:: From here to there
378 * Selecting files:: What files are part of the project?
379 * Publishing action:: Setting the function doing the publishing
380 * Publishing options:: Tweaking HTML export
381 * Publishing links:: Which links keep working after publishing?
382 * Project page index:: Publishing a list of project files
386 * Simple example:: One-component publishing
387 * Complex example:: A multi-component publishing example
391 * Completion:: M-TAB knows what you need
392 * Customization:: Adapting Org to your taste
393 * In-buffer settings:: Overview of the #+KEYWORDS
394 * The very busy C-c C-c key:: When in doubt, press C-c C-c
395 * Clean view:: Getting rid of leading stars in the outline
396 * TTY keys:: Using Org on a tty
397 * Interaction:: Other Emacs packages
399 Interaction with other packages
401 * Cooperation:: Packages Org cooperates with
402 * Conflicts:: Packages that lead to conflicts
406 * Hooks:: Who to reach into Org's internals
407 * Add-on packages:: Available extensions
408 * Adding hyperlink types:: New custom link types
409 * Context-sensitive commands:: How to add functioality to such commands
410 * Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs
411 * Dynamic blocks:: Automatically filled blocks
412 * Special agenda views:: Customized views
413 * Extracting agenda information:: Postprocessing of agenda information
414 * Using the property API:: Writing programs that use entry properties
415 * Using the mapping API:: Mapping over all or selected entries
417 Tables and lists in arbitrary syntax
419 * Radio tables:: Sending and receiving
420 * A LaTeX example:: Step by step, almost a tutorial
421 * Translator functions:: Copy and modify
422 * Radio lists:: Doing the same for lists
427 @node Introduction, Document Structure, Top, Top
428 @chapter Introduction
432 * Summary:: Brief summary of what Org does
433 * Installation:: How to install a downloaded version of Org
434 * Activation:: How to activate Org for certain buffers
435 * Feedback:: Bug reports, ideas, patches etc.
436 * Conventions:: Type-setting conventions in the manual
439 @node Summary, Installation, Introduction, Introduction
443 Org is a mode for keeping notes, maintaining TODO lists, and doing
444 project planning with a fast and effective plain-text system.
446 Org develops organizational tasks around NOTES files that contain
447 lists or information about projects as plain text. Org is
448 implemented on top of Outline mode, which makes it possible to keep the
449 content of large files well structured. Visibility cycling and
450 structure editing help to work with the tree. Tables are easily created
451 with a built-in table editor. Org supports TODO items, deadlines,
452 timestamps, and scheduling. It dynamically compiles entries into an
453 agenda that utilizes and smoothly integrates much of the Emacs calendar
454 and diary. Plain text URL-like links connect to websites, emails,
455 Usenet messages, BBDB entries, and any files related to the projects.
456 For printing and sharing of notes, an Org file can be exported as a
457 structured ASCII file, as HTML, or (TODO and agenda items only) as an
458 iCalendar file. It can also serve as a publishing tool for a set of
461 An important design aspect that distinguishes Org from, for example,
462 Planner/Muse is that it encourages you to store every piece of information
463 only once. In Planner, you have project pages, day pages and possibly
464 other files, duplicating some information such as tasks. In Org,
465 you only have notes files. In your notes you mark entries as tasks, and
466 label them with tags and timestamps. All necessary lists, like a
467 schedule for the day, the agenda for a meeting, tasks lists selected by
468 tags, etc., are created dynamically when you need them.
470 Org keeps simple things simple. When first fired up, it should
471 feel like a straightforward, easy to use outliner. Complexity is not
472 imposed, but a large amount of functionality is available when you need
473 it. Org is a toolbox and can be used in different ways, for
477 @r{@bullet{} an outline extension with visibility cycling and structure editing}
478 @r{@bullet{} an ASCII system and table editor for taking structured notes}
479 @r{@bullet{} an ASCII table editor with spreadsheet-like capabilities}
480 @r{@bullet{} a TODO list editor}
481 @r{@bullet{} a full agenda and planner with deadlines and work scheduling}
482 @pindex GTD, Getting Things Done
483 @r{@bullet{} an environment to implement David Allen's GTD system}
484 @r{@bullet{} a basic database application}
485 @r{@bullet{} a simple hypertext system, with HTML and La@TeX{} export}
486 @r{@bullet{} a publishing tool to create a set of interlinked webpages}
489 Org's automatic, context-sensitive table editor with spreadsheet
490 capabilities can be integrated into any major mode by activating the
491 minor Orgtbl mode. Using a translation step, it can be used to maintain
492 tables in arbitrary file types, for example in La@TeX{}. The structure
493 editing and list creation capabilities can be used outside Org with
494 the minor Orgstruct mode.
497 There is a website for Org which provides links to the newest
498 version of Org, as well as additional information, frequently asked
499 questions (FAQ), links to tutorials, etc@. This page is located at
500 @uref{http://orgmode.org}.
505 @node Installation, Activation, Summary, Introduction
506 @section Installation
510 @b{Important:} @i{If Org is part of the Emacs distribution or an
511 XEmacs package, please skip this section and go directly to
514 If you have downloaded Org from the Web, either as a distribution @file{.zip}
515 or @file{.tar} file, or as a Git archive, you must take the following steps
516 to install it: Go into the unpacked Org distribution directory and edit the
517 top section of the file @file{Makefile}. You must set the name of the Emacs
518 binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
519 directories where local Lisp and Info files are kept. If you don't have
520 access to the system-wide directories, you can simply run Org directly from
521 the distribution directory by adding the @file{lisp} subdirectory to the
522 Emacs load path. To do this, add the following line to @file{.emacs}:
525 (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
529 If you plan to use code from the @file{contrib} subdirectory, do a similar
530 step for this directory:
533 (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
536 @b{XEmacs users now need to install the file @file{noutline.el} from
537 the @file{xemacs} sub-directory of the Org distribution. Use the
541 @b{make install-noutline}
544 @noindent Now byte-compile the Lisp files with the shell command:
550 @noindent If you are running Org from the distribution directory, this is
551 all. If you want to install into the system directories, use (as
557 Installing Info files is system dependent, because of differences in the
558 @file{install-info} program. In Debian it copies the info files into the
559 correct directory and modifies the info directory file. In many other
560 systems, the files need to be copied to the correct directory separately, and
561 @file{install-info} then only modifies the directory file. Check your system
562 documentation to find out which of the following commands you need:
566 make install-info-debian
569 @noindent Then add to @file{.emacs}:
572 ;; This line only if Org is not part of the X/Emacs distribution.
573 (require 'org-install)
576 Do not forget to activate Org as described in the following section.
578 @node Activation, Feedback, Installation, Introduction
582 @cindex global key bindings
583 @cindex key bindings, global
586 @b{Important:} @i{If you use copy-and-paste to copy Lisp code from the
587 PDF documentation as viewed by some PDF viewers to your @file{.emacs} file, the
588 single-quote character comes out incorrectly and the code will not work.
589 You need to fix the single-quotes by hand, or copy from Info
593 Add the following lines to your @file{.emacs} file. The last three lines
594 define @emph{global} keys for the commands @command{org-store-link},
595 @command{org-agenda}, and @command{org-iswitchb}---please choose suitable
599 ;; The following lines are always needed. Choose your own keys.
600 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
601 (global-set-key "\C-cl" 'org-store-link)
602 (global-set-key "\C-ca" 'org-agenda)
603 (global-set-key "\C-cb" 'org-iswitchb)
606 Furthermore, you must activate @code{font-lock-mode} in Org
607 buffers, because significant functionality depends on font-locking being
608 active. You can do this with either one of the following two lines
609 (XEmacs users must use the second option):
611 (global-font-lock-mode 1) ; for all buffers
612 (add-hook 'org-mode-hook 'turn-on-font-lock) ; Org buffers only
615 @cindex Org mode, turning on
616 With this setup, all files with extension @samp{.org} will be put
617 into Org mode. As an alternative, make the first line of a file look
621 MY PROJECTS -*- mode: org; -*-
624 @vindex org-insert-mode-line-in-empty-file
625 @noindent which will select Org mode for this buffer no matter what
626 the file's name is. See also the variable
627 @code{org-insert-mode-line-in-empty-file}.
629 Many commands in Org work on the region if the region is @i{active}. To make
630 use of this, you need to have @code{transient-mark-mode}
631 (@code{zmacs-regions} in XEmacs) turned on. In Emacs 23 this is the default,
632 in Emacs 22 you need to do this yourself with
634 (transient-mark-mode 1)
636 @noindent If you do not like @code{transient-make-mode}, you can create an
637 active region by using the mouse to select a region, or pressing
638 @kbd{C-@key{SPC}} twice before moving the cursor.
640 @node Feedback, Conventions, Activation, Introduction
647 If you find problems with Org, or if you have questions, remarks, or ideas
648 about it, please mail to the Org mailing list @email{emacs-orgmode@@gnu.org}.
649 If you are not a member of the mailing list, your mail will be reviewed by a
650 moderator and then passed through to the list.
652 For bug reports, please provide as much information as possible,
653 including the version information of Emacs (@kbd{C-h v emacs-version
654 @key{RET}}) and Org (@kbd{C-h v org-version @key{RET}}), as well as
655 the Org related setup in @file{.emacs}. If an error occurs, a
656 backtrace can be very useful (see below on how to create one). Often a
657 small example file helps, along with clear information about:
660 @item What exactly did you do?
661 @item What did you expect to happen?
662 @item What happened instead?
664 @noindent Thank you for helping to improve this mode.
666 @subsubheading How to create a useful backtrace
668 @cindex backtrace of an error
669 If working with Org produces an error with a message you don't
670 understand, you may have hit a bug. The best way to report this is by
671 providing, in addition to what was mentioned above, a @emph{backtrace}.
672 This is information from the built-in debugger about where and how the
673 error occurred. Here is how to produce a useful backtrace:
677 Reload uncompiled versions of all Org-mode Lisp files. The backtrace
678 contains much more information if it is produced with uncompiled code.
681 C-u M-x org-reload RET
684 or select @code{Org -> Refresh/Reload -> Reload Org uncompiled} from the
687 Go to the @code{Options} menu and select @code{Enter Debugger on Error}
688 (XEmacs has this option in the @code{Troubleshooting} sub-menu).
690 Do whatever you have to do to hit the error. Don't forget to
691 document the steps you take.
693 When you hit the error, a @file{*Backtrace*} buffer will appear on the
694 screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and
695 attach it to your bug report.
698 @node Conventions, , Feedback, Introduction
699 @section Typesetting conventions used in this manual
701 Org uses three types of keywords: TODO keywords, tags, and property
702 names. In this manual we use the following conventions:
707 TODO keywords are written with all capitals, even if they are
711 User-defined tags are written in lowercase; built-in tags with special
712 meaning are written with all capitals.
715 User-defined properties are capitalized; built-in properties with
716 special meaning are written with all capitals.
719 @node Document Structure, Tables, Introduction, Top
720 @chapter Document Structure
721 @cindex document structure
722 @cindex structure of document
724 Org is based on Outline mode and provides flexible commands to
725 edit the structure of the document.
728 * Outlines:: Org is based on Outline mode
729 * Headlines:: How to typeset Org tree headlines
730 * Visibility cycling:: Show and hide, much simplified
731 * Motion:: Jumping to other headlines
732 * Structure editing:: Changing sequence and level of headlines
733 * Archiving:: Move done task trees to a different place
734 * Sparse trees:: Matches embedded in context
735 * Plain lists:: Additional structure within an entry
736 * Drawers:: Tucking stuff away
737 * Blocks:: Folding blocks
738 * Footnotes:: How footnotes are defined in Org's syntax
739 * Orgstruct mode:: Structure editing outside Org
742 @node Outlines, Headlines, Document Structure, Document Structure
747 Org is implemented on top of Outline mode. Outlines allow a
748 document to be organized in a hierarchical structure, which (at least
749 for me) is the best representation of notes and thoughts. An overview
750 of this structure is achieved by folding (hiding) large parts of the
751 document to show only the general document structure and the parts
752 currently being worked on. Org greatly simplifies the use of
753 outlines by compressing the entire show/hide functionality into a single
754 command, @command{org-cycle}, which is bound to the @key{TAB} key.
756 @node Headlines, Visibility cycling, Outlines, Document Structure
760 @vindex org-special-ctrl-a/e
762 Headlines define the structure of an outline tree. The headlines in
763 Org start with one or more stars, on the left margin@footnote{See
764 the variable @code{org-special-ctrl-a/e} to configure special behavior
765 of @kbd{C-a} and @kbd{C-e} in headlines.}. For example:
775 * Another top level headline
778 @noindent Some people find the many stars too noisy and would prefer an
779 outline that has whitespace followed by a single star as headline
780 starters. @ref{Clean view}, describes a setup to realize this.
782 @vindex org-cycle-separator-lines
783 An empty line after the end of a subtree is considered part of it and
784 will be hidden when the subtree is folded. However, if you leave at
785 least two empty lines, one empty line will remain visible after folding
786 the subtree, in order to structure the collapsed view. See the
787 variable @code{org-cycle-separator-lines} to modify this behavior.
789 @node Visibility cycling, Motion, Headlines, Document Structure
790 @section Visibility cycling
791 @cindex cycling, visibility
792 @cindex visibility cycling
793 @cindex trees, visibility
794 @cindex show hidden text
797 Outlines make it possible to hide parts of the text in the buffer.
798 Org uses just two commands, bound to @key{TAB} and
799 @kbd{S-@key{TAB}} to change the visibility in the buffer.
801 @cindex subtree visibility states
802 @cindex subtree cycling
803 @cindex folded, subtree visibility state
804 @cindex children, subtree visibility state
805 @cindex subtree, subtree visibility state
809 @emph{Subtree cycling}: Rotate current subtree among the states
812 ,-> FOLDED -> CHILDREN -> SUBTREE --.
813 '-----------------------------------'
816 @vindex org-cycle-emulate-tab
817 @vindex org-cycle-global-at-bob
818 The cursor must be on a headline for this to work@footnote{see, however,
819 the option @code{org-cycle-emulate-tab}.}. When the cursor is at the
820 beginning of the buffer and the first line is not a headline, then
821 @key{TAB} actually runs global cycling (see below)@footnote{see the
822 option @code{org-cycle-global-at-bob}.}. Also when called with a prefix
823 argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
825 @cindex global visibility states
826 @cindex global cycling
827 @cindex overview, global visibility state
828 @cindex contents, global visibility state
829 @cindex show all, global visibility state
833 @emph{Global cycling}: Rotate the entire buffer among the states
836 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
837 '--------------------------------------'
840 When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
841 CONTENTS view up to headlines of level N will be shown. Note that inside
842 tables, @kbd{S-@key{TAB}} jumps to the previous field.
844 @cindex show all, command
845 @kindex C-u C-u C-u @key{TAB}
846 @item C-u C-u C-u @key{TAB}
847 Show all, including drawers.
850 Reveal context around point, showing the current entry, the following heading
851 and the hierarchy above. Useful for working near a location that has been
852 exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
853 (@pxref{Agenda commands}). With a prefix argument show, on each
854 level, all sibling headings.
857 Show the current subtree in an indirect buffer@footnote{The indirect
860 (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
863 (see the Emacs manual for more information about indirect buffers)
865 will contain the entire buffer, but will be narrowed to the current
866 tree. Editing the indirect buffer will also change the original buffer,
867 but without affecting visibility in that buffer.}. With a numeric
868 prefix argument N, go up to level N and then take that tree. If N is
869 negative then go up that many levels. With a @kbd{C-u} prefix, do not remove
870 the previously used indirect buffer.
873 @vindex org-startup-folded
874 When Emacs first visits an Org file, the global state is set to
875 OVERVIEW, @ie only the top level headlines are visible. This can be
876 configured through the variable @code{org-startup-folded}, or on a
877 per-file basis by adding one of the following lines anywhere in the
886 @cindex property, VISIBILITY
888 Furthermore, any entries with a @samp{VISIBILITY} property (@pxref{Properties
889 and Columns}) will get their visibility adapted accordingly. Allowed values
890 for this property are @code{folded}, @code{children}, @code{content}, and
893 @kindex C-u C-u @key{TAB}
894 @item C-u C-u @key{TAB}
895 Switch back to the startup visibility of the buffer, @ie whatever is
896 requested by startup options and @samp{VISIBILITY} properties in individual
900 @node Motion, Structure editing, Visibility cycling, Document Structure
902 @cindex motion, between headlines
903 @cindex jumping, to headlines
904 @cindex headline navigation
905 The following commands jump to other headlines in the buffer.
916 Next heading same level.
919 Previous heading same level.
922 Backward to higher level heading.
925 Jump to a different place without changing the current outline
926 visibility. Shows the document structure in a temporary buffer, where
927 you can use the following keys to find your destination:
928 @vindex org-goto-auto-isearch
930 @key{TAB} @r{Cycle visibility.}
931 @key{down} / @key{up} @r{Next/previous visible headline.}
932 @key{RET} @r{Select this location.}
933 @kbd{/} @r{Do a Sparse-tree search}
934 @r{The following keys work if you turn off @code{org-goto-auto-isearch}}
935 n / p @r{Next/previous visible headline.}
936 f / b @r{Next/previous headline same level.}
938 0-9 @r{Digit argument.}
941 @vindex org-goto-interface
943 See also the variable @code{org-goto-interface}.
946 @node Structure editing, Archiving, Motion, Document Structure
947 @section Structure editing
948 @cindex structure editing
949 @cindex headline, promotion and demotion
950 @cindex promotion, of subtrees
951 @cindex demotion, of subtrees
952 @cindex subtree, cut and paste
953 @cindex pasting, of subtrees
954 @cindex cutting, of subtrees
955 @cindex copying, of subtrees
956 @cindex subtrees, cut and paste
961 @vindex org-M-RET-may-split-line
962 Insert new heading with same level as current. If the cursor is in a
963 plain list item, a new item is created (@pxref{Plain lists}). To force
964 creation of a new headline, use a prefix argument, or first press @key{RET}
965 to get to the beginning of the next line. When this command is used in
966 the middle of a line, the line is split and the rest of the line becomes
967 the new headline@footnote{If you do not want the line to be split,
968 customize the variable @code{org-M-RET-may-split-line}.}. If the
969 command is used at the beginning of a headline, the new headline is
970 created before the current line. If at the beginning of any other line,
971 the content of that line is made the new heading. If the command is
972 used at the end of a folded subtree (@ie behind the ellipses at the end
973 of a headline), then a headline like the current one will be inserted
974 after the end of the subtree.
977 Just like @kbd{M-@key{RET}}, except when adding a new heading below the
978 current heading, the new heading is placed after the body instead of before
979 it. This command works from anywhere in the entry.
980 @kindex M-S-@key{RET}
982 @vindex org-treat-insert-todo-heading-as-state-change
983 Insert new TODO entry with same level as current heading. See also the
984 variable @code{org-treat-insert-todo-heading-as-state-change}.
985 @kindex C-S-@key{RET}
987 Insert new TODO entry with same level as current heading. Like
988 @kbd{C-@key{RET}}, the new headline will be inserted after the current
992 Promote current heading by one level.
993 @kindex M-@key{right}
995 Demote current heading by one level.
996 @kindex M-S-@key{left}
998 Promote the current subtree by one level.
999 @kindex M-S-@key{right}
1000 @item M-S-@key{right}
1001 Demote the current subtree by one level.
1002 @kindex M-S-@key{up}
1004 Move subtree up (swap with previous subtree of same
1006 @kindex M-S-@key{down}
1007 @item M-S-@key{down}
1008 Move subtree down (swap with next subtree of same level).
1011 Kill subtree, @ie remove it from buffer but save in kill ring.
1012 With a numeric prefix argument N, kill N sequential subtrees.
1015 Copy subtree to kill ring. With a numeric prefix argument N, copy the N
1016 sequential subtrees.
1019 Yank subtree from kill ring. This does modify the level of the subtree to
1020 make sure the tree fits in nicely at the yank position. The yank level can
1021 also be specified with a numeric prefix argument, or by yanking after a
1022 headline marker like @samp{****}.
1025 @vindex org-yank-adjusted-subtrees
1026 @vindex org-yank-folded-subtrees
1027 Depending on the variables @code{org-yank-adjusted-subtrees} and
1028 @code{org-yank-folded-subtrees}, Org's internal @code{yank} command will
1029 paste subtrees folded and in a clever way, using the same command as @kbd{C-c
1030 C-x C-y}. With the default settings, no level adjustment will take place,
1031 but the yanked tree will be folded unless doing so would swallow text
1032 previously visible. Any prefix argument to this command will force a normal
1033 @code{yank} to be executed, with the prefix passed along. A good way to
1034 force a normal yank is @kbd{C-u C-y}. If you use @code{yank-pop} after a
1035 yank, it will yank previous kill items plainly, without adjustment and
1039 Clone a subtree by making a number of sibling copies of it. You will be
1040 prompted for the number of copies to make, and you can also specify if any
1041 timestamps in the entry should be shifted. This can be useful, for example,
1042 to create a number of tasks related to a series of lectures to prepare. For
1043 more details, see the docstring of the command
1044 @code{org-clone-subtree-with-time-shift}.
1047 Refile entry or region to a different location. @xref{Refiling notes}.
1050 Sort same-level entries. When there is an active region, all entries in the
1051 region will be sorted. Otherwise the children of the current headline are
1052 sorted. The command prompts for the sorting method, which can be
1053 alphabetically, numerically, by time (first timestamp with active preferred,
1054 creation time, scheduled time, deadline time), by priority, by TODO keyword
1055 (in the sequence the keywords have been defined in the setup) or by the value
1056 of a property. Reverse sorting is possible as well. You can also supply
1057 your own function to extract the sorting key. With a @kbd{C-u} prefix,
1058 sorting will be case-sensitive. With two @kbd{C-u C-u} prefixes, duplicate
1059 entries will also be removed.
1062 Narrow buffer to current subtree.
1065 Widen buffer to remove narrowing.
1068 Turn a normal line or plain list item into a headline (so that it becomes a
1069 subheading at its location). Also turn a headline into a normal line by
1070 removing the stars. If there is an active region, turn all lines in the
1071 region into headlines. If the first line in the region was an item, turn
1072 only the item lines into headlines. Finally, if the first line is a
1073 headline, remove the stars from all headlines in the region.
1076 @cindex region, active
1077 @cindex active region
1078 @cindex transient mark mode
1079 When there is an active region (Transient Mark mode), promotion and
1080 demotion work on all headlines in the region. To select a region of
1081 headlines, it is best to place both point and mark at the beginning of a
1082 line, mark at the beginning of the first headline, and point at the line
1083 just after the last headline to change. Note that when the cursor is
1084 inside a table (@pxref{Tables}), the Meta-Cursor keys have different
1087 @node Archiving, Sparse trees, Structure editing, Document Structure
1091 When a project represented by a (sub)tree is finished, you may want
1092 to move the tree out of the way and to stop it from contributing to the
1093 agenda. Org mode knows two ways of archiving. You can mark a tree with
1094 the ARCHIVE tag, or you can move an entire (sub)tree to a different
1098 * ARCHIVE tag:: Marking a tree as inactive
1099 * Moving subtrees:: Moving a tree to an archive file
1102 @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
1103 @subsection The ARCHIVE tag
1104 @cindex internal archiving
1106 A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
1107 its location in the outline tree, but behaves in the following way:
1110 @vindex org-cycle-open-archived-trees
1111 It does not open when you attempt to do so with a visibility cycling
1112 command (@pxref{Visibility cycling}). You can force cycling archived
1113 subtrees with @kbd{C-@key{TAB}}, or by setting the option
1114 @code{org-cycle-open-archived-trees}. Also normal outline commands like
1115 @code{show-all} will open archived subtrees.
1117 @vindex org-sparse-tree-open-archived-trees
1118 During sparse tree construction (@pxref{Sparse trees}), matches in
1119 archived subtrees are not exposed, unless you configure the option
1120 @code{org-sparse-tree-open-archived-trees}.
1122 @vindex org-agenda-skip-archived-trees
1123 During agenda view construction (@pxref{Agenda Views}), the content of
1124 archived trees is ignored unless you configure the option
1125 @code{org-agenda-skip-archived-trees}, in which case these trees will always
1126 be included. In the agenda you can press the @kbd{v} key to get archives
1127 temporarily included.
1129 @vindex org-export-with-archived-trees
1130 Archived trees are not exported (@pxref{Exporting}), only the headline
1131 is. Configure the details using the variable
1132 @code{org-export-with-archived-trees}.
1134 @vindex org-columns-skip-arrchived-trees
1135 Archived trees are excluded from column view unless the variable
1136 @code{org-columns-skip-arrchived-trees} is configured to @code{nil}.
1139 The following commands help managing the ARCHIVE tag:
1144 Toggle the ARCHIVE tag for the current headline. When the tag is set,
1145 the headline changes to a shadowed face, and the subtree below it is
1147 @kindex C-u C-c C-x a
1149 Check if any direct children of the current headline should be archived.
1150 To do this, each subtree is checked for open TODO entries. If none are
1151 found, the command offers to set the ARCHIVE tag for the child. If the
1152 cursor is @emph{not} on a headline when this command is invoked, the
1153 level 1 trees will be checked.
1156 Cycle a tree even if it is tagged with ARCHIVE.
1159 @node Moving subtrees, , ARCHIVE tag, Archiving
1160 @subsection Moving subtrees
1161 @cindex external archiving
1163 Once an entire project is finished, you may want to move it to a different
1164 location. Org can move it to an @emph{Archive Sibling} in the same tree, to a
1165 different tree in the current file, or to a different file, the archive file.
1170 Move the current entry to the @emph{Archive Sibling}. This is a sibling of
1171 the entry with the heading @samp{Archive} and the tag @samp{ARCHIVE}
1172 (@pxref{ARCHIVE tag}). The entry becomes a child of that sibling and in this
1173 way retains a lot of its original context, including inherited tags and
1174 approximate position in the outline.
1179 @vindex org-archive-location
1180 Archive the subtree starting at the cursor position to the location
1181 given by @code{org-archive-location}. Context information that could be
1182 lost, like the file name, the category, inherited tags, and the TODO
1183 state will be stored as properties in the entry.
1184 @kindex C-u C-c C-x C-s
1185 @item C-u C-c C-x C-s
1186 Check if any direct children of the current headline could be moved to
1187 the archive. To do this, each subtree is checked for open TODO entries.
1188 If none are found, the command offers to move it to the archive
1189 location. If the cursor is @emph{not} on a headline when this command
1190 is invoked, the level 1 trees will be checked.
1193 @cindex archive locations
1194 The default archive location is a file in the same directory as the
1195 current file, with the name derived by appending @file{_archive} to the
1196 current file name. For information and examples on how to change this,
1197 see the documentation string of the variable
1198 @code{org-archive-location}. There is also an in-buffer option for
1199 setting this variable, for example@footnote{For backward compatibility,
1200 the following also works: If there are several such lines in a file,
1201 each specifies the archive location for the text below it. The first
1202 such line also applies to any text before its definition. However,
1203 using this method is @emph{strongly} deprecated as it is incompatible
1204 with the outline structure of the document. The correct method for
1205 setting multiple archive locations in a buffer is using properties.}:
1209 #+ARCHIVE: %s_done::
1212 @cindex property, ARCHIVE
1214 If you would like to have a special ARCHIVE location for a single entry
1215 or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
1216 location as the value (@pxref{Properties and Columns}).
1218 @vindex org-archive-save-context-info
1219 When a subtree is moved, it receives a number of special properties that
1220 record context information like the file from where the entry came, its
1221 outline path the archiving time etc. Configure the variable
1222 @code{org-archive-save-context-info} to adjust the amount of information
1225 @node Sparse trees, Plain lists, Archiving, Document Structure
1226 @section Sparse trees
1227 @cindex sparse trees
1228 @cindex trees, sparse
1229 @cindex folding, sparse trees
1230 @cindex occur, command
1232 @vindex org-show-hierarchy-above
1233 @vindex org-show-following-heading
1234 @vindex org-show-siblings
1235 @vindex org-show-entry-below
1236 An important feature of Org mode is the ability to construct @emph{sparse
1237 trees} for selected information in an outline tree, so that the entire
1238 document is folded as much as possible, but the selected information is made
1239 visible along with the headline structure above it@footnote{See also the
1240 variables @code{org-show-hierarchy-above}, @code{org-show-following-heading},
1241 @code{org-show-siblings}, and @code{org-show-entry-below} for detailed
1242 control on how much context is shown around each match.}. Just try it out
1243 and you will see immediately how it works.
1245 Org mode contains several commands creating such trees, all these
1246 commands can be accessed through a dispatcher:
1251 This prompts for an extra key to select a sparse-tree creating command.
1254 @vindex org-remove-highlights-with-change
1255 Occur. Prompts for a regexp and shows a sparse tree with all matches. If
1256 the match is in a headline, the headline is made visible. If the match is in
1257 the body of an entry, headline and body are made visible. In order to
1258 provide minimal context, also the full hierarchy of headlines above the match
1259 is shown, as well as the headline following the match. Each match is also
1260 highlighted; the highlights disappear when the buffer is changed by an
1261 editing command@footnote{This depends on the option
1262 @code{org-remove-highlights-with-change}}, or by pressing @kbd{C-c C-c}.
1263 When called with a @kbd{C-u} prefix argument, previous highlights are kept,
1264 so several calls to this command can be stacked.
1268 @vindex org-agenda-custom-commands
1269 For frequently used sparse trees of specific search strings, you can
1270 use the variable @code{org-agenda-custom-commands} to define fast
1271 keyboard access to specific sparse trees. These commands will then be
1272 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
1276 (setq org-agenda-custom-commands
1277 '(("f" occur-tree "FIXME")))
1280 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
1281 a sparse tree matching the string @samp{FIXME}.
1283 The other sparse tree commands select headings based on TODO keywords,
1284 tags, or properties and will be discussed later in this manual.
1287 @cindex printing sparse trees
1288 @cindex visible text, printing
1289 To print a sparse tree, you can use the Emacs command
1290 @code{ps-print-buffer-with-faces} which does not print invisible parts
1291 of the document @footnote{This does not work under XEmacs, because
1292 XEmacs uses selective display for outlining, not text properties.}.
1293 Or you can use the command @kbd{C-c C-e v} to export only the visible
1294 part of the document and print the resulting file.
1296 @node Plain lists, Drawers, Sparse trees, Document Structure
1297 @section Plain lists
1299 @cindex lists, plain
1300 @cindex lists, ordered
1301 @cindex ordered lists
1303 Within an entry of the outline tree, hand-formatted lists can provide
1304 additional structure. They also provide a way to create lists of
1305 checkboxes (@pxref{Checkboxes}). Org supports editing such lists,
1306 and the HTML exporter (@pxref{Exporting}) parses and formats them.
1308 Org knows ordered lists, unordered lists, and description lists.
1311 @emph{Unordered} list items start with @samp{-}, @samp{+}, or
1312 @samp{*}@footnote{When using @samp{*} as a bullet, lines must be indented or
1313 they will be seen as top-level headlines. Also, when you are hiding leading
1314 stars to get a clean outline view, plain list items starting with a star are
1315 visually indistinguishable from true headlines. In short: even though
1316 @samp{*} is supported, it may be better to not use it for plain list items.}
1319 @emph{Ordered} list items start with a numeral followed by either a period or
1320 a right parenthesis, such as @samp{1.} or @samp{1)}.
1322 @emph{Description} list items are like unordered list items, but contain the
1323 separator @samp{ :: } to separate the description @emph{term} from the
1327 @vindex org-empty-line-terminates-plain-lists
1328 Items belonging to the same list must have the same indentation on the first
1329 line. In particular, if an ordered list reaches number @samp{10.}, then the
1330 2--digit numbers must be written left-aligned with the other numbers in the
1331 list. Indentation also determines the end of a list item. It ends before
1332 the next line that is indented like the bullet/number, or less. Empty lines
1333 are part of the previous item, so you can have several paragraphs in one
1334 item. If you would like an empty line to terminate all currently open plain
1335 lists, configure the variable @code{org-empty-line-terminates-plain-lists}.
1340 ** Lord of the Rings
1341 My favorite scenes are (in this order)
1342 1. The attack of the Rohirrim
1343 2. Eowyn's fight with the witch king
1344 + this was already my favorite scene in the book
1345 + I really like Miranda Otto.
1346 3. Peter Jackson being shot by Legolas
1348 He makes a really funny face when it happens.
1349 But in the end, no individual scenes matter but the film as a whole.
1350 Important actors in this film are:
1351 - @b{Elijah Wood} :: He plays Frodo
1352 - @b{Sean Austin} :: He plays Sam, Frodo's friend. I still remember
1353 him very well from his role as Mikey Walsh in @i{The Goonies}.
1357 Org supports these lists by tuning filling and wrapping commands to deal with
1358 them correctly@footnote{Org only changes the filling settings for Emacs. For
1359 XEmacs, you should use Kyle E. Jones' @file{filladapt.el}. To turn this on,
1360 put into @file{.emacs}: @code{(require 'filladapt)}}, and by exporting them
1361 properly (@pxref{Exporting}). Since indentation is what governs the
1362 structure of these lists, many structural constructs like @code{#+BEGIN_...}
1363 blocks can be indented to signal that they should be part of a list item.
1365 The following commands act on items when the cursor is in the first line
1366 of an item (the line with the bullet or number).
1371 @vindex org-cycle-include-plain-lists
1372 Items can be folded just like headline levels if you set the variable
1373 @code{org-cycle-include-plain-lists}. The level of an item is then
1374 given by the indentation of the bullet/number. Items are always
1375 subordinate to real headlines, however; the hierarchies remain
1376 completely separated.
1378 If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
1379 fixes the indentation of the current line in a heuristic way.
1382 @vindex org-M-RET-may-split-line
1383 Insert new item at current level. With a prefix argument, force a new
1384 heading (@pxref{Structure editing}). If this command is used in the middle
1385 of a line, the line is @emph{split} and the rest of the line becomes the new
1386 item@footnote{If you do not want the line to be split, customize the variable
1387 @code{org-M-RET-may-split-line}.}. If this command is executed in the
1388 @emph{whitespace before a bullet or number}, the new item is created
1389 @emph{before} the current item. If the command is executed in the white
1390 space before the text that is part of an item but does not contain the
1391 bullet, a bullet is added to the current line.
1392 @kindex M-S-@key{RET}
1394 Insert a new item with a checkbox (@pxref{Checkboxes}).
1396 @kindex S-@key{down}
1399 @cindex shift-selection-mode
1400 @vindex org-support-shift-select
1401 Jump to the previous/next item in the current list, but only if
1402 @code{org-support-shift-select} is off. If not, you can still use paragraph
1403 jumping commands like @kbd{C-@key{up}} and @kbd{C-@key{down}} to quite
1405 @kindex M-S-@key{up}
1406 @kindex M-S-@key{down}
1408 @itemx M-S-@key{down}
1409 Move the item including subitems up/down (swap with previous/next item
1410 of same indentation). If the list is ordered, renumbering is
1412 @kindex M-S-@key{left}
1413 @kindex M-S-@key{right}
1414 @item M-S-@key{left}
1415 @itemx M-S-@key{right}
1416 Decrease/increase the indentation of the item, including subitems.
1417 Initially, the item tree is selected based on current indentation.
1418 When these commands are executed several times in direct succession,
1419 the initially selected region is used, even if the new indentation
1420 would imply a different hierarchy. To use the new hierarchy, break
1421 the command chain with a cursor motion or so.
1424 If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
1425 state of the checkbox. If not, this command makes sure that all the
1426 items on this list level use the same bullet. Furthermore, if this is
1427 an ordered list, make sure the numbering is OK.
1430 Cycle the entire list level through the different itemize/enumerate bullets
1431 (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}). With a numeric prefix
1432 argument N, select the Nth bullet from this list. If there is an active
1433 region when calling this, all lines will be converted to list items. If the
1434 first line already was a list item, any item markers will be removed from the
1435 list. Finally, even without an active region, a normal line will be
1436 converted into a list item.
1437 @kindex S-@key{left}
1438 @kindex S-@key{right}
1439 @item S-@key{left}/@key{right}
1440 @vindex org-support-shift-select
1441 This command also cycles bullet styles when the cursor in on the bullet or
1442 anywhere in an item line, details depending on
1443 @code{org-support-shift-select}.
1446 Sort the plain list. You will be prompted for the sorting method:
1447 numerically, alphabetically, by time, or by custom function.
1450 @node Drawers, Blocks, Plain lists, Document Structure
1454 @cindex visibility cycling, drawers
1457 Sometimes you want to keep information associated with an entry, but you
1458 normally don't want to see it. For this, Org mode has @emph{drawers}.
1459 Drawers need to be configured with the variable
1460 @code{org-drawers}@footnote{You can define drawers on a per-file basis
1461 with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}. Drawers
1465 ** This is a headline
1466 Still outside the drawer
1468 This is inside the drawer.
1473 Visibility cycling (@pxref{Visibility cycling}) on the headline will hide and
1474 show the entry, but keep the drawer collapsed to a single line. In order to
1475 look inside the drawer, you need to move the cursor to the drawer line and
1476 press @key{TAB} there. Org mode uses the @code{PROPERTIES} drawer for
1477 storing properties (@pxref{Properties and Columns}), and you can also arrange
1478 for state change notes (@pxref{Tracking TODO state changes}) and clock times
1479 (@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}.
1481 @node Blocks, Footnotes, Drawers, Document Structure
1484 @vindex org-hide-block-startup
1485 @cindex blocks, folding
1486 Org-mode uses begin...end blocks for various purposes from including source
1487 code examples (@pxref{Literal examples}) to capturing time logging
1488 information (@pxref{Clocking work time}). These blocks can be folded and
1489 unfolded by pressing TAB in the begin line. You can also get all blocks
1490 folded at startup by configuring the variable @code{org-hide-block-startup}
1491 or on a per-file basis by using
1493 @cindex @code{hideblocks}, STARTUP keyword
1494 @cindex @code{nohideblocks}, STARTUP keyword
1496 #+STARTUP: hideblocks
1497 #+STARTUP: nohideblocks
1500 @node Footnotes, Orgstruct mode, Blocks, Document Structure
1504 Org mode supports the creation of footnotes. In contrast to the
1505 @file{footnote.el} package, Org mode's footnotes are designed for work on a
1506 larger document, not only for one-off documents like emails. The basic
1507 syntax is similar to the one used by @file{footnote.el}, @ie a footnote is
1508 defined in a paragraph that is started by a footnote marker in square
1509 brackets in column 0, no indentation allowed. If you need a paragraph break
1510 inside a footnote, use the La@TeX{} idiom @samp{\par}. The footnote reference
1511 is simply the marker in square brackets, inside text. For example:
1514 The Org homepage[fn:1] now looks a lot better than it used to.
1516 [fn:1] The link is: http://orgmode.org
1519 Org mode extends the number-based syntax to @emph{named} footnotes and
1520 optional inline definition. Using plain numbers as markers (as
1521 @file{footnote.el} does) is supported for backward compatibility, but not
1522 encouraged because of possible conflicts with La@TeX{} snippets (@pxref{Embedded
1523 LaTeX}). Here are the valid references:
1527 A plain numeric footnote marker.
1529 A named footnote reference, where @code{name} is a unique label word, or, for
1530 simplicity of automatic creation, a number.
1531 @item [fn:: This is the inline definition of this footnote]
1532 A La@TeX{}-like anonymous footnote where the definition is given directly at the
1534 @item [fn:name: a definition]
1535 An inline definition of a footnote, which also specifies a name for the note.
1536 Since Org allows multiple references to the same note, you can then use
1537 @code{[fn:name]} to create additional references.
1540 @vindex org-footnote-auto-label
1541 Footnote labels can be created automatically, or you can create names yourself.
1542 This is handled by the variable @code{org-footnote-auto-label} and its
1543 corresponding @code{#+STARTUP} keywords, see the docstring of that variable
1546 @noindent The following command handles footnotes:
1551 The footnote action command.
1553 When the cursor is on a footnote reference, jump to the definition. When it
1554 is at a definition, jump to the (first) reference.
1556 @vindex org-footnote-define-inline
1557 @vindex org-footnote-section
1558 Otherwise, create a new footnote. Depending on the variable
1559 @code{org-footnote-define-inline}@footnote{The corresponding in-buffer
1560 setting is: @code{#+STARTUP: fninline} or @code{#+STARTUP: nofninline}}, the
1561 definition will be placed right into the text as part of the reference, or
1562 separately into the location determined by the variable
1563 @code{org-footnote-section}.
1565 When this command is called with a prefix argument, a menu of additional
1568 s @r{Sort the footnote definitions by reference sequence. During editing,}
1569 @r{Org makes no effort to sort footnote definitions into a particular}
1570 @r{sequence. If you want them sorted, use this command, which will}
1571 @r{also move entries according to @code{org-footnote-section}.}
1572 n @r{Normalize the footnotes by collecting all definitions (including}
1573 @r{inline definitions) into a special section, and then numbering them}
1574 @r{in sequence. The references will then also be numbers. This is}
1575 @r{meant to be the final step before finishing a document (@eg{} sending}
1576 @r{off an email). The exporters do this automatically, and so could}
1577 @r{something like @code{message-send-hook}.}
1578 d @r{Delete the footnote at point, and all definitions of and references}
1583 If the cursor is on a footnote reference, jump to the definition. If it is a
1584 the definition, jump back to the reference. When called at a footnote
1585 location with a prefix argument, offer the same menu as @kbd{C-c C-x f}.
1589 @item C-c C-c @r{or} mouse-1/2
1590 Footnote labels are also links to the corresponding definition/reference, and
1591 you can use the usual commands to follow these links.
1594 @node Orgstruct mode, , Footnotes, Document Structure
1595 @section The Orgstruct minor mode
1596 @cindex Orgstruct mode
1597 @cindex minor mode for structure editing
1599 If you like the intuitive way the Org mode structure editing and list
1600 formatting works, you might want to use these commands in other modes like
1601 Text mode or Mail mode as well. The minor mode @code{orgstruct-mode} makes
1602 this possible. Toggle the mode with @kbd{M-x orgstruct-mode}, or
1603 turn it on by default, for example in Mail mode, with one of:
1606 (add-hook 'mail-mode-hook 'turn-on-orgstruct)
1607 (add-hook 'mail-mode-hook 'turn-on-orgstruct++)
1610 When this mode is active and the cursor is on a line that looks to Org like a
1611 headline or the first line of a list item, most structure editing commands
1612 will work, even if the same keys normally have different functionality in the
1613 major mode you are using. If the cursor is not in one of those special
1614 lines, Orgstruct mode lurks silently in the shadow. When you use
1615 @code{orgstruct++-mode}, Org will also export indentation and autofill
1616 settings into that mode, and detect item context after the first line of an
1619 @node Tables, Hyperlinks, Document Structure, Top
1622 @cindex editing tables
1624 Org comes with a fast and intuitive table editor. Spreadsheet-like
1625 calculations are supported in connection with the Emacs @file{calc}
1628 (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
1631 (see the Emacs Calculator manual for more information about the Emacs
1636 * Built-in table editor:: Simple tables
1637 * Narrow columns:: Stop wasting space in tables
1638 * Column groups:: Grouping to trigger vertical lines
1639 * Orgtbl mode:: The table editor as minor mode
1640 * The spreadsheet:: The table editor has spreadsheet capabilities
1641 * Org-Plot:: Plotting from org tables
1644 @node Built-in table editor, Narrow columns, Tables, Tables
1645 @section The built-in table editor
1646 @cindex table editor, built-in
1648 Org makes it easy to format tables in plain ASCII. Any line with
1649 @samp{|} as the first non-whitespace character is considered part of a
1650 table. @samp{|} is also the column separator. A table might look like
1654 | Name | Phone | Age |
1655 |-------+-------+-----|
1656 | Peter | 1234 | 17 |
1657 | Anna | 4321 | 25 |
1660 A table is re-aligned automatically each time you press @key{TAB} or
1661 @key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
1662 the next field (@key{RET} to the next row) and creates new table rows
1663 at the end of the table or before horizontal lines. The indentation
1664 of the table is set by the first line. Any line starting with
1665 @samp{|-} is considered as a horizontal separator line and will be
1666 expanded on the next re-align to span the whole table width. So, to
1667 create the above table, you would only type
1674 @noindent and then press @key{TAB} to align the table and start filling in
1675 fields. Even faster would be to type @code{|Name|Phone|Age} followed by
1676 @kbd{C-c @key{RET}}.
1678 @vindex org-enable-table-editor
1679 @vindex org-table-auto-blank-field
1680 When typing text into a field, Org treats @key{DEL},
1681 @key{Backspace}, and all character keys in a special way, so that
1682 inserting and deleting avoids shifting other fields. Also, when
1683 typing @emph{immediately after the cursor was moved into a new field
1684 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
1685 field is automatically made blank. If this behavior is too
1686 unpredictable for you, configure the variables
1687 @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
1690 @tsubheading{Creation and conversion}
1693 Convert the active region to table. If every line contains at least one
1694 TAB character, the function assumes that the material is tab separated.
1695 If every line contains a comma, comma-separated values (CSV) are assumed.
1696 If not, lines are split at whitespace into fields. You can use a prefix
1697 argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
1698 C-u} forces TAB, and a numeric argument N indicates that at least N
1699 consecutive spaces, or alternatively a TAB will be the separator.
1701 If there is no active region, this command creates an empty Org
1702 table. But it's easier just to start typing, like
1703 @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
1705 @tsubheading{Re-aligning and field motion}
1708 Re-align the table without moving the cursor.
1712 Re-align the table, move to the next field. Creates a new row if
1717 Re-align, move to previous field.
1721 Re-align the table and move down to next row. Creates a new row if
1722 necessary. At the beginning or end of a line, @key{RET} still does
1723 NEWLINE, so it can be used to split a table.
1727 Move to beginning of the current table field, or on to the previous field.
1730 Move to end of the current table field, or on to the next field.
1732 @tsubheading{Column and row editing}
1733 @kindex M-@key{left}
1734 @kindex M-@key{right}
1736 @itemx M-@key{right}
1737 Move the current column left/right.
1739 @kindex M-S-@key{left}
1740 @item M-S-@key{left}
1741 Kill the current column.
1743 @kindex M-S-@key{right}
1744 @item M-S-@key{right}
1745 Insert a new column to the left of the cursor position.
1748 @kindex M-@key{down}
1751 Move the current row up/down.
1753 @kindex M-S-@key{up}
1755 Kill the current row or horizontal line.
1757 @kindex M-S-@key{down}
1758 @item M-S-@key{down}
1759 Insert a new row above the current row. With a prefix argument, the line is
1760 created below the current one.
1764 Insert a horizontal line below current row. With a prefix argument, the line
1765 is created above the current line.
1767 @kindex C-c @key{RET}
1769 Insert a horizontal line below current row, and move the cursor into the row
1774 Sort the table lines in the region. The position of point indicates the
1775 column to be used for sorting, and the range of lines is the range
1776 between the nearest horizontal separator lines, or the entire table. If
1777 point is before the first column, you will be prompted for the sorting
1778 column. If there is an active region, the mark specifies the first line
1779 and the sorting column, while point should be in the last line to be
1780 included into the sorting. The command prompts for the sorting type
1781 (alphabetically, numerically, or by time). When called with a prefix
1782 argument, alphabetic sorting will be case-sensitive.
1784 @tsubheading{Regions}
1787 Copy a rectangular region from a table to a special clipboard. Point
1788 and mark determine edge fields of the rectangle. The process ignores
1789 horizontal separator lines.
1793 Copy a rectangular region from a table to a special clipboard, and
1794 blank all fields in the rectangle. So this is the ``cut'' operation.
1798 Paste a rectangular region into a table.
1799 The upper left corner ends up in the current field. All involved fields
1800 will be overwritten. If the rectangle does not fit into the present table,
1801 the table is enlarged as needed. The process ignores horizontal separator
1806 Wrap several fields in a column like a paragraph. If there is an active
1807 region, and both point and mark are in the same column, the text in the
1808 column is wrapped to minimum width for the given number of lines. A numeric
1809 prefix argument may be used to change the number of desired lines. If there
1810 is no region, the current field is split at the cursor position and the text
1811 fragment to the right of the cursor is prepended to the field one line
1812 down. If there is no region, but you specify a prefix argument, the current
1813 field is made blank, and the content is appended to the field above.
1815 @tsubheading{Calculations}
1816 @cindex formula, in tables
1817 @cindex calculations, in tables
1818 @cindex region, active
1819 @cindex active region
1820 @cindex transient mark mode
1823 Sum the numbers in the current column, or in the rectangle defined by
1824 the active region. The result is shown in the echo area and can
1825 be inserted with @kbd{C-y}.
1829 @vindex org-table-copy-increment
1830 When current field is empty, copy from first non-empty field above. When not
1831 empty, copy current field down to next row and move cursor along with it.
1832 Depending on the variable @code{org-table-copy-increment}, integer field
1833 values will be incremented during copy. Integers that are too large will not
1834 be incremented. Also, a @code{0} prefix argument temporarily disables the
1835 increment. This key is also used by shift-selection and related modes
1836 (@pxref{Conflicts}).
1838 @tsubheading{Miscellaneous}
1841 Edit the current field in a separate window. This is useful for fields
1842 that are not fully visible (@pxref{Narrow columns}). When called with a
1843 @kbd{C-u} prefix, just make the full field visible, so that it can be
1846 @item M-x org-table-import
1847 Import a file as a table. The table should be TAB or whitespace
1848 separated. Use, for example, to import a spreadsheet table or data
1849 from a database, because these programs generally can write
1850 TAB-separated text files. This command works by inserting the file into
1851 the buffer and then converting the region to a table. Any prefix
1852 argument is passed on to the converter, which uses it to determine the
1855 Tables can also be imported by pasting tabular text into the Org
1856 buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
1857 @kbd{C-c |} command (see above under @i{Creation and conversion}).
1859 @item M-x org-table-export
1860 @vindex org-table-export-default-format
1861 Export the table, by default as a TAB-separated file. Use for data
1862 exchange with, for example, spreadsheet or database programs. The format
1863 used to export the file can be configured in the variable
1864 @code{org-table-export-default-format}. You may also use properties
1865 @code{TABLE_EXPORT_FILE} and @code{TABLE_EXPORT_FORMAT} to specify the file
1866 name and the format for table export in a subtree. Org supports quite
1867 general formats for exported tables. The exporter format is the same as the
1868 format used by Orgtbl radio tables, see @ref{Translator functions}, for a
1869 detailed description.
1872 If you don't like the automatic table editor because it gets in your
1873 way on lines which you would like to start with @samp{|}, you can turn
1877 (setq org-enable-table-editor nil)
1880 @noindent Then the only table command that still works is
1881 @kbd{C-c C-c} to do a manual re-align.
1883 @node Narrow columns, Column groups, Built-in table editor, Tables
1884 @section Narrow columns
1885 @cindex narrow columns in tables
1887 The width of columns is automatically determined by the table editor.
1888 Sometimes a single field or a few fields need to carry more text,
1889 leading to inconveniently wide columns. To limit@footnote{This feature
1890 does not work on XEmacs.} the width of a column, one field anywhere in
1891 the column may contain just the string @samp{<N>} where @samp{N} is an
1892 integer specifying the width of the column in characters. The next
1893 re-align will then set the width of this column to no more than this
1898 |---+------------------------------| |---+--------|
1900 | 1 | one | | 1 | one |
1901 | 2 | two | ----\ | 2 | two |
1902 | 3 | This is a long chunk of text | ----/ | 3 | This=> |
1903 | 4 | four | | 4 | four |
1904 |---+------------------------------| |---+--------|
1909 Fields that are wider become clipped and end in the string @samp{=>}.
1910 Note that the full text is still in the buffer, it is only invisible.
1911 To see the full text, hold the mouse over the field---a tool-tip window
1912 will show the full content. To edit such a field, use the command
1913 @kbd{C-c `} (that is @kbd{C-c} followed by the backquote). This will
1914 open a new window with the full field. Edit it and finish with @kbd{C-c
1917 @vindex org-startup-align-all-tables
1918 When visiting a file containing a table with narrowed columns, the
1919 necessary character hiding has not yet happened, and the table needs to
1920 be aligned before it looks nice. Setting the option
1921 @code{org-startup-align-all-tables} will realign all tables in a file
1922 upon visiting, but also slow down startup. You can also set this option
1923 on a per-file basis with:
1930 @node Column groups, Orgtbl mode, Narrow columns, Tables
1931 @section Column groups
1932 @cindex grouping columns in tables
1934 When Org exports tables, it does so by default without vertical
1935 lines because that is visually more satisfying in general. Occasionally
1936 however, vertical lines can be useful to structure a table into groups
1937 of columns, much like horizontal lines can do for groups of rows. In
1938 order to specify column groups, you can use a special row where the
1939 first field contains only @samp{/}. The further fields can either
1940 contain @samp{<} to indicate that this column should start a group,
1941 @samp{>} to indicate the end of a column, or @samp{<>} to make a column
1942 a group of its own. Boundaries between column groups will upon export be
1943 marked with vertical lines. Here is an example:
1946 | | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1947 |---+----+-----+-----+-----+---------+------------|
1948 | / | <> | < | | > | < | > |
1949 | # | 1 | 1 | 1 | 1 | 1 | 1 |
1950 | # | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
1951 | # | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
1952 |---+----+-----+-----+-----+---------+------------|
1953 #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2)))
1956 It is also sufficient to just insert the column group starters after
1957 every vertical line you'd like to have:
1960 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1961 |----+-----+-----+-----+---------+------------|
1965 @node Orgtbl mode, The spreadsheet, Column groups, Tables
1966 @section The Orgtbl minor mode
1968 @cindex minor mode for tables
1970 If you like the intuitive way the Org table editor works, you
1971 might also want to use it in other modes like Text mode or Mail mode.
1972 The minor mode Orgtbl mode makes this possible. You can always toggle
1973 the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
1974 example in mail mode, use
1977 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
1980 Furthermore, with some special setup, it is possible to maintain tables
1981 in arbitrary syntax with Orgtbl mode. For example, it is possible to
1982 construct La@TeX{} tables with the underlying ease and power of
1983 Orgtbl mode, including spreadsheet capabilities. For details, see
1984 @ref{Tables in arbitrary syntax}.
1986 @node The spreadsheet, Org-Plot, Orgtbl mode, Tables
1987 @section The spreadsheet
1988 @cindex calculations, in tables
1989 @cindex spreadsheet capabilities
1990 @cindex @file{calc} package
1992 The table editor makes use of the Emacs @file{calc} package to implement
1993 spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to
1994 derive fields from other fields. While fully featured, Org's
1995 implementation is not identical to other spreadsheets. For example,
1996 Org knows the concept of a @emph{column formula} that will be
1997 applied to all non-header fields in a column without having to copy the
1998 formula to each relevant field.
2001 * References:: How to refer to another field or range
2002 * Formula syntax for Calc:: Using Calc to compute stuff
2003 * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
2004 * Field formulas:: Formulas valid for a single field
2005 * Column formulas:: Formulas valid for an entire column
2006 * Editing and debugging formulas:: Fixing formulas
2007 * Updating the table:: Recomputing all dependent fields
2008 * Advanced features:: Field names, parameters and automatic recalc
2011 @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
2012 @subsection References
2015 To compute fields in the table from other fields, formulas must
2016 reference other fields or ranges. In Org, fields can be referenced
2017 by name, by absolute coordinates, and by relative coordinates. To find
2018 out what the coordinates of a field are, press @kbd{C-c ?} in that
2019 field, or press @kbd{C-c @}} to toggle the display of a grid.
2021 @subsubheading Field references
2022 @cindex field references
2023 @cindex references, to fields
2025 Formulas can reference the value of another field in two ways. Like in
2026 any other spreadsheet, you may reference fields with a letter/number
2027 combination like @code{B3}, meaning the 2nd field in the 3rd row.
2028 @c Such references are always fixed to that field, they don't change
2029 @c when you copy and paste a formula to a different field. So
2030 @c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
2033 Org also uses another, more general operator that looks like this:
2035 @@@var{row}$@var{column}
2039 Column references can be absolute like @samp{1}, @samp{2},...@samp{@var{N}},
2040 or relative to the current column like @samp{+1} or @samp{-2}.
2042 The row specification only counts data lines and ignores horizontal
2043 separator lines (hlines). You can use absolute row numbers
2044 @samp{1}...@samp{@var{N}}, and row numbers relative to the current row like
2045 @samp{+3} or @samp{-1}. Or specify the row relative to one of the
2046 hlines: @samp{I} refers to the first hline@footnote{Note that only
2047 hlines are counted that @emph{separate} table lines. If the table
2048 starts with a hline above the header, it does not count.}, @samp{II} to
2049 the second, etc@. @samp{-I} refers to the first such line above the
2050 current line, @samp{+I} to the first such line below the current line.
2051 You can also write @samp{III+2} which is the second data line after the
2052 third hline in the table. Relative row numbers like @samp{-3} will not
2053 cross hlines if the current line is too close to the hline. Instead,
2054 the value directly at the hline is used.
2056 @samp{0} refers to the current row and column. Also, if you omit
2057 either the column or the row part of the reference, the current
2058 row/column is implied.
2060 Org's references with @emph{unsigned} numbers are fixed references
2061 in the sense that if you use the same reference in the formula for two
2062 different fields, the same field will be referenced each time.
2063 Org's references with @emph{signed} numbers are floating
2064 references because the same reference operator can reference different
2065 fields depending on the field being calculated by the formula.
2067 As a special case, references like @samp{$LR5} and @samp{$LR12} can be used to
2068 refer in a stable way to the 5th and 12th field in the last row of the
2071 Here are a few examples:
2074 @@2$3 @r{2nd row, 3rd column}
2075 C2 @r{same as previous}
2076 $5 @r{column 5 in the current row}
2077 E& @r{same as previous}
2078 @@2 @r{current column, row 2}
2079 @@-1$-3 @r{the field one row up, three columns to the left}
2080 @@-I$2 @r{field just under hline above current row, column 2}
2083 @subsubheading Range references
2084 @cindex range references
2085 @cindex references, to ranges
2087 You may reference a rectangular range of fields by specifying two field
2088 references connected by two dots @samp{..}. If both fields are in the
2089 current row, you may simply use @samp{$2..$7}, but if at least one field
2090 is in a different row, you need to use the general @code{@@row$column}
2091 format at least for the first field (i.e the reference must start with
2092 @samp{@@} in order to be interpreted correctly). Examples:
2095 $1..$3 @r{First three fields in the current row.}
2096 $P..$Q @r{Range, using column names (see under Advanced)}
2097 @@2$1..@@4$3 @r{6 fields between these two fields.}
2098 A2..C4 @r{Same as above.}
2099 @@-1$-2..@@-1 @r{3 numbers from the column to the left, 2 up to current row}
2102 @noindent Range references return a vector of values that can be fed
2103 into Calc vector functions. Empty fields in ranges are normally
2104 suppressed, so that the vector contains only the non-empty fields (but
2105 see the @samp{E} mode switch below). If there are no non-empty fields,
2106 @samp{[0]} is returned to avoid syntax errors in formulas.
2108 @subsubheading Named references
2109 @cindex named references
2110 @cindex references, named
2111 @cindex name, of column or field
2112 @cindex constants, in calculations
2115 @vindex org-table-formula-constants
2116 @samp{$name} is interpreted as the name of a column, parameter or
2117 constant. Constants are defined globally through the variable
2118 @code{org-table-formula-constants}, and locally (for the file) through a
2122 #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
2126 @vindex constants-unit-system
2127 @pindex constants.el
2128 Also properties (@pxref{Properties and Columns}) can be used as
2129 constants in table formulas: For a property @samp{:Xyz:} use the name
2130 @samp{$PROP_Xyz}, and the property will be searched in the current
2131 outline entry and in the hierarchy above it. If you have the
2132 @file{constants.el} package, it will also be used to resolve constants,
2133 including natural constants like @samp{$h} for Planck's constant, and
2134 units like @samp{$km} for kilometers@footnote{@file{constants.el} can
2135 supply the values of constants in two different unit systems, @code{SI}
2136 and @code{cgs}. Which one is used depends on the value of the variable
2137 @code{constants-unit-system}. You can use the @code{#+STARTUP} options
2138 @code{constSI} and @code{constcgs} to set this value for the current
2139 buffer.}. Column names and parameters can be specified in special table
2140 lines. These are described below, see @ref{Advanced features}. All
2141 names must start with a letter, and further consist of letters and
2144 @subsubheading Remote references
2145 @cindex remote references
2146 @cindex references, remote
2147 @cindex references, to a different table
2148 @cindex name, of column or field
2149 @cindex constants, in calculations
2152 You may also reference constants, fields and ranges from a different table,
2153 either in the current file or even in a different file. The syntax is
2156 remote(NAME-OR-ID,REF)
2160 where NAME can be the name of a table in the current file as set by a
2161 @code{#+TBLNAME: NAME} line before the table. It can also be the ID of an
2162 entry, even in a different file, and the reference then refers to the first
2163 table in that entry. REF is an absolute field or range reference as
2164 described above, valid in the referenced table.
2166 @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
2167 @subsection Formula syntax for Calc
2168 @cindex formula syntax, Calc
2169 @cindex syntax, of formulas
2171 A formula can be any algebraic expression understood by the Emacs
2172 @file{Calc} package. @b{Note that @file{calc} has the
2173 non-standard convention that @samp{/} has lower precedence than
2174 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before
2175 evaluation by @code{calc-eval} (@pxref{Calling Calc from
2176 Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
2177 Emacs Calc Manual}),
2178 @c FIXME: The link to the Calc manual in HTML does not work.
2179 variable substitution takes place according to the rules described above.
2180 @cindex vectors, in table calculations
2181 The range vectors can be directly fed into the Calc vector functions
2182 like @samp{vmean} and @samp{vsum}.
2184 @cindex format specifier
2185 @cindex mode, for @file{calc}
2186 @vindex org-calc-default-modes
2187 A formula can contain an optional mode string after a semicolon. This
2188 string consists of flags to influence Calc and other modes during
2189 execution. By default, Org uses the standard Calc modes (precision
2190 12, angular units degrees, fraction and symbolic modes off). The display
2191 format, however, has been changed to @code{(float 8)} to keep tables
2192 compact. The default settings can be configured using the variable
2193 @code{org-calc-default-modes}.
2196 p20 @r{switch the internal precision to 20 digits}
2197 n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format}
2198 D R @r{angle modes: degrees, radians}
2199 F S @r{fraction and symbolic modes}
2200 N @r{interpret all fields as numbers, use 0 for non-numbers}
2201 T @r{force text interpretation}
2202 E @r{keep empty fields in ranges}
2207 In addition, you may provide a @code{printf} format specifier to
2208 reformat the final result. A few examples:
2211 $1+$2 @r{Sum of first and second field}
2212 $1+$2;%.2f @r{Same, format result to two decimals}
2213 exp($2)+exp($1) @r{Math functions can be used}
2214 $0;%.1f @r{Reformat current cell to 1 decimal}
2215 ($3-32)*5/9 @r{Degrees F -> C conversion}
2216 $c/$1/$cm @r{Hz -> cm conversion, using @file{constants.el}}
2217 tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
2218 sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
2219 vmean($2..$7) @r{Compute column range mean, using vector function}
2220 vmean($2..$7);EN @r{Same, but treat empty fields as 0}
2221 taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
2224 Calc also contains a complete set of logical operations. For example
2227 if($1<20,teen,string("")) @r{``teen'' if age $1 less than 20, else empty}
2230 @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
2231 @subsection Emacs Lisp forms as formulas
2232 @cindex Lisp forms, as table formulas
2234 It is also possible to write a formula in Emacs Lisp; this can be useful
2235 for string manipulation and control structures, if Calc's
2236 functionality is not enough. If a formula starts with a single-quote
2237 followed by an opening parenthesis, then it is evaluated as a Lisp form.
2238 The evaluation should return either a string or a number. Just as with
2239 @file{calc} formulas, you can specify modes and a printf format after a
2240 semicolon. With Emacs Lisp forms, you need to be conscious about the way
2241 field references are interpolated into the form. By default, a
2242 reference will be interpolated as a Lisp string (in double-quotes)
2243 containing the field. If you provide the @samp{N} mode switch, all
2244 referenced elements will be numbers (non-number fields will be zero) and
2245 interpolated as Lisp numbers, without quotes. If you provide the
2246 @samp{L} flag, all fields will be interpolated literally, without quotes.
2247 @Ie{}, if you want a reference to be interpreted as a string by the Lisp
2248 form, enclose the reference operator itself in double-quotes, like
2249 @code{"$3"}. Ranges are inserted as space-separated fields, so you can
2250 embed them in list or vector syntax. A few examples, note how the
2251 @samp{N} mode is used when we do computations in Lisp.
2254 @r{Swap the first two characters of the content of column 1}
2255 '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
2256 @r{Add columns 1 and 2, equivalent to Calc's @code{$1+$2}}
2258 @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
2259 '(apply '+ '($1..$4));N
2262 @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
2263 @subsection Field formulas
2264 @cindex field formula
2265 @cindex formula, for individual table field
2267 To assign a formula to a particular field, type it directly into the
2268 field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you
2269 press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
2270 the field, the formula will be stored as the formula for this field,
2271 evaluated, and the current field replaced with the result.
2274 Formulas are stored in a special line starting with @samp{#+TBLFM:}
2275 directly below the table. If you typed the equation in the 4th field of
2276 the 3rd data line in the table, the formula will look like
2277 @samp{@@3$4=$1+$2}. When inserting/deleting/swapping column and rows
2278 with the appropriate commands, @i{absolute references} (but not relative
2279 ones) in stored formulas are modified in order to still reference the
2280 same field. Of course this is not true if you edit the table structure
2281 with normal editing commands---then you must fix the equations yourself.
2282 The left-hand side of a formula may also be a named field (@pxref{Advanced
2283 features}), or a last-row reference like @samp{$LR3}.
2285 Instead of typing an equation into the field, you may also use the
2291 Install a new formula for the current field. The command prompts for a
2292 formula with default taken from the @samp{#+TBLFM:} line, applies
2293 it to the current field, and stores it.
2296 @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
2297 @subsection Column formulas
2298 @cindex column formula
2299 @cindex formula, for table column
2301 Often in a table, the same formula should be used for all fields in a
2302 particular column. Instead of having to copy the formula to all fields
2303 in that column, Org allows you to assign a single formula to an entire
2304 column. If the table contains horizontal separator hlines, everything
2305 before the first such line is considered part of the table @emph{header}
2306 and will not be modified by column formulas.
2308 To assign a formula to a column, type it directly into any field in the
2309 column, preceded by an equal sign, like @samp{=$1+$2}. When you press
2310 @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the field,
2311 the formula will be stored as the formula for the current column, evaluated
2312 and the current field replaced with the result. If the field contains only
2313 @samp{=}, the previously stored formula for this column is used. For each
2314 column, Org will only remember the most recently used formula. In the
2315 @samp{#+TBLFM:} line, column formulas will look like @samp{$4=$1+$2}. The left-hand
2316 side of a column formula cannot currently be the name of column, it
2317 must be the numeric column reference.
2319 Instead of typing an equation into the field, you may also use the
2325 Install a new formula for the current column and replace current field with
2326 the result of the formula. The command prompts for a formula, with default
2327 taken from the @samp{#+TBLFM} line, applies it to the current field and
2328 stores it. With a numeric prefix argument(@eg @kbd{C-5 C-c =}) the command
2329 will apply it to that many consecutive fields in the current column.
2332 @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
2333 @subsection Editing and debugging formulas
2334 @cindex formula editing
2335 @cindex editing, of table formulas
2337 @vindex org-table-use-standard-references
2338 You can edit individual formulas in the minibuffer or directly in the
2339 field. Org can also prepare a special buffer with all active
2340 formulas of a table. When offering a formula for editing, Org
2341 converts references to the standard format (like @code{B3} or @code{D&})
2342 if possible. If you prefer to only work with the internal format (like
2343 @code{@@3$2} or @code{$4}), configure the variable
2344 @code{org-table-use-standard-references}.
2351 Edit the formula associated with the current column/field in the
2352 minibuffer. See @ref{Column formulas}, and @ref{Field formulas}.
2353 @kindex C-u C-u C-c =
2355 Re-insert the active formula (either a
2356 field formula, or a column formula) into the current field, so that you
2357 can edit it directly in the field. The advantage over editing in the
2358 minibuffer is that you can use the command @kbd{C-c ?}.
2361 While editing a formula in a table field, highlight the field(s)
2362 referenced by the reference at the cursor position in the formula.
2365 Toggle the display of row and column numbers for a table, using
2366 overlays. These are updated each time the table is aligned; you can
2367 force it with @kbd{C-c C-c}.
2370 Toggle the formula debugger on and off. See below.
2373 Edit all formulas for the current table in a special buffer, where the
2374 formulas will be displayed one per line. If the current field has an
2375 active formula, the cursor in the formula editor will mark it.
2376 While inside the special buffer, Org will automatically highlight
2377 any field or range reference at the cursor position. You may edit,
2378 remove and add formulas, and use the following commands:
2384 Exit the formula editor and store the modified formulas. With @kbd{C-u}
2385 prefix, also apply the new formulas to the entire table.
2388 Exit the formula editor without installing changes.
2391 Toggle all references in the formula editor between standard (like
2392 @code{B3}) and internal (like @code{@@3$2}).
2395 Pretty-print or indent Lisp formula at point. When in a line containing
2396 a Lisp formula, format the formula according to Emacs Lisp rules.
2397 Another @key{TAB} collapses the formula back again. In the open
2398 formula, @key{TAB} re-indents just like in Emacs Lisp mode.
2401 Complete Lisp symbols, just like in Emacs Lisp mode.
2403 @kindex S-@key{down}
2404 @kindex S-@key{left}
2405 @kindex S-@key{right}
2406 @item S-@key{up}/@key{down}/@key{left}/@key{right}
2407 Shift the reference at point. For example, if the reference is
2408 @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
2409 This also works for relative references and for hline references.
2410 @kindex M-S-@key{up}
2411 @kindex M-S-@key{down}
2412 @item M-S-@key{up}/@key{down}
2413 Move the test line for column formulas in the Org buffer up and
2416 @kindex M-@key{down}
2417 @item M-@key{up}/@key{down}
2418 Scroll the window displaying the table.
2421 Turn the coordinate grid in the table on and off.
2425 Making a table field blank does not remove the formula associated with
2426 the field, because that is stored in a different line (the @samp{#+TBLFM}
2427 line)---during the next recalculation the field will be filled again.
2428 To remove a formula from a field, you have to give an empty reply when
2429 prompted for the formula, or to edit the @samp{#+TBLFM} line.
2432 You may edit the @samp{#+TBLFM} directly and re-apply the changed
2433 equations with @kbd{C-c C-c} in that line or with the normal
2434 recalculation commands in the table.
2436 @subsubheading Debugging formulas
2437 @cindex formula debugging
2438 @cindex debugging, of table formulas
2439 When the evaluation of a formula leads to an error, the field content
2440 becomes the string @samp{#ERROR}. If you would like see what is going
2441 on during variable substitution and calculation in order to find a bug,
2442 turn on formula debugging in the @code{Tbl} menu and repeat the
2443 calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
2444 field. Detailed information will be displayed.
2446 @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
2447 @subsection Updating the table
2448 @cindex recomputing table fields
2449 @cindex updating, table
2451 Recalculation of a table is normally not automatic, but needs to be
2452 triggered by a command. See @ref{Advanced features}, for a way to make
2453 recalculation at least semi-automatic.
2455 In order to recalculate a line of a table or the entire table, use the
2461 Recalculate the current row by first applying the stored column formulas
2462 from left to right, and all field formulas in the current row.
2468 Recompute the entire table, line by line. Any lines before the first
2469 hline are left alone, assuming that these are part of the table header.
2471 @kindex C-u C-u C-c *
2472 @kindex C-u C-u C-c C-c
2474 @itemx C-u C-u C-c C-c
2475 Iterate the table by recomputing it until no further changes occur.
2476 This may be necessary if some computed fields use the value of other
2477 fields that are computed @i{later} in the calculation sequence.
2480 @node Advanced features, , Updating the table, The spreadsheet
2481 @subsection Advanced features
2483 If you want the recalculation of fields to happen automatically, or if
2484 you want to be able to assign @i{names} to fields and columns, you need
2485 to reserve the first column of the table for special marking characters.
2489 Rotate the calculation mark in first column through the states @samp{},
2490 @samp{#}, @samp{*}, @samp{!}, @samp{$}. When there is an active region,
2491 change all marks in the region.
2494 Here is an example of a table that collects exam results of students and
2495 makes use of these features:
2499 |---+---------+--------+--------+--------+-------+------|
2500 | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2501 |---+---------+--------+--------+--------+-------+------|
2502 | ! | | P1 | P2 | P3 | Tot | |
2503 | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
2504 | ^ | | m1 | m2 | m3 | mt | |
2505 |---+---------+--------+--------+--------+-------+------|
2506 | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
2507 | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
2508 |---+---------+--------+--------+--------+-------+------|
2509 | | Average | | | | 29.7 | |
2510 | ^ | | | | | at | |
2511 | $ | max=50 | | | | | |
2512 |---+---------+--------+--------+--------+-------+------|
2513 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
2517 @noindent @b{Important}: Please note that for these special tables,
2518 recalculating the table with @kbd{C-u C-c *} will only affect rows that
2519 are marked @samp{#} or @samp{*}, and fields that have a formula assigned
2520 to the field itself. The column formulas are not applied in rows with
2523 @cindex marking characters, tables
2524 The marking characters have the following meaning:
2527 The fields in this line define names for the columns, so that you may
2528 refer to a column as @samp{$Tot} instead of @samp{$6}.
2530 This row defines names for the fields @emph{above} the row. With such
2531 a definition, any formula in the table may use @samp{$m1} to refer to
2532 the value @samp{10}. Also, if you assign a formula to a names field, it
2533 will be stored as @samp{$name=...}.
2535 Similar to @samp{^}, but defines names for the fields in the row
2538 Fields in this row can define @emph{parameters} for formulas. For
2539 example, if a field in a @samp{$} row contains @samp{max=50}, then
2540 formulas in this table can refer to the value 50 using @samp{$max}.
2541 Parameters work exactly like constants, only that they can be defined on
2544 Fields in this row are automatically recalculated when pressing
2545 @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
2546 is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
2547 lines will be left alone by this command.
2549 Selects this line for global recalculation with @kbd{C-u C-c *}, but
2550 not for automatic recalculation. Use this when automatic
2551 recalculation slows down editing too much.
2553 Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
2554 All lines that should be recalculated should be marked with @samp{#}
2557 Do not export this line. Useful for lines that contain the narrowing
2561 Finally, just to whet your appetite for what can be done with the
2562 fantastic @file{calc.el} package, here is a table that computes the Taylor
2563 series of degree @code{n} at location @code{x} for a couple of
2568 |---+-------------+---+-----+--------------------------------------|
2569 | | Func | n | x | Result |
2570 |---+-------------+---+-----+--------------------------------------|
2571 | # | exp(x) | 1 | x | 1 + x |
2572 | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
2573 | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
2574 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2575 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
2576 | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
2577 |---+-------------+---+-----+--------------------------------------|
2578 #+TBLFM: $5=taylor($2,$4,$3);n3
2582 @node Org-Plot, , The spreadsheet, Tables
2584 @cindex graph, in tables
2585 @cindex plot tables using gnuplot
2588 Org-Plot can produce 2D and 3D graphs of information stored in org tables
2589 using @file{Gnuplot} @uref{http://www.gnuplot.info/} and @file{gnuplot-mode}
2590 @uref{http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html}. To see
2591 this in action, ensure that you have both Gnuplot and Gnuplot mode installed
2592 on your system, then call @code{org-plot/gnuplot} on the following table.
2596 #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
2597 | Sede | Max cites | H-index |
2598 |-----------+-----------+---------|
2599 | Chile | 257.72 | 21.39 |
2600 | Leeds | 165.77 | 19.68 |
2601 | Sao Paolo | 71.00 | 11.50 |
2602 | Stockholm | 134.19 | 14.33 |
2603 | Morelia | 257.56 | 17.67 |
2607 Notice that Org Plot is smart enough to apply the table's headers as labels.
2608 Further control over the labels, type, content, and appearance of plots can
2609 be exercised through the @code{#+PLOT:} lines preceding a table. See below
2610 for a complete list of Org-plot options. For more information and examples
2611 see the Org-plot tutorial at
2612 @uref{http://orgmode.org/worg/org-tutorials/org-plot.php}.
2614 @subsubheading Plot Options
2618 Specify any @command{gnuplot} option to be set when graphing.
2621 Specify the title of the plot.
2624 Specify which column of the table to use as the @code{x} axis.
2627 Specify the columns to graph as a Lisp style list, surrounded by parentheses
2628 and separated by spaces for example @code{dep:(3 4)} to graph the third and
2629 fourth columns (defaults to graphing all other columns aside from the @code{ind}
2633 Specify whether the plot will be @code{2d}, @code{3d}, or @code{grid}.
2636 Specify a @code{with} option to be inserted for every col being plotted
2637 (@eg @code{lines}, @code{points}, @code{boxes}, @code{impulses}, etc...).
2638 Defaults to @code{lines}.
2641 If you want to plot to a file, specify @code{"@var{path/to/desired/output-file}"}.
2644 List of labels to be used for the deps (defaults to the column headers if
2648 Specify an entire line to be inserted in the Gnuplot script.
2651 When plotting @code{3d} or @code{grid} types, set this to @code{t} to graph a
2652 flat mapping rather than a @code{3d} slope.
2655 Specify format of Org-mode timestamps as they will be parsed by Gnuplot.
2656 Defaults to @samp{%Y-%m-%d-%H:%M:%S}.
2659 If you want total control, you can specify a script file (place the file name
2660 between double-quotes) which will be used to plot. Before plotting, every
2661 instance of @code{$datafile} in the specified script will be replaced with
2662 the path to the generated data file. Note: Even if you set this option, you
2663 may still want to specify the plot type, as that can impact the content of
2667 @node Hyperlinks, TODO Items, Tables, Top
2671 Like HTML, Org provides links inside a file, external links to
2672 other files, Usenet articles, emails, and much more.
2675 * Link format:: How links in Org are formatted
2676 * Internal links:: Links to other places in the current file
2677 * External links:: URL-like links to the world
2678 * Handling links:: Creating, inserting and following
2679 * Using links outside Org:: Linking from my C source code?
2680 * Link abbreviations:: Shortcuts for writing complex links
2681 * Search options:: Linking to a specific location
2682 * Custom searches:: When the default search is not enough
2685 @node Link format, Internal links, Hyperlinks, Hyperlinks
2686 @section Link format
2688 @cindex format, of links
2690 Org will recognize plain URL-like links and activate them as
2691 clickable links. The general link format, however, looks like this:
2694 [[link][description]] @r{or alternatively} [[link]]
2698 Once a link in the buffer is complete (all brackets present), Org
2699 will change the display so that @samp{description} is displayed instead
2700 of @samp{[[link][description]]} and @samp{link} is displayed instead of
2701 @samp{[[link]]}. Links will be highlighted in the face @code{org-link},
2702 which by default is an underlined face. You can directly edit the
2703 visible part of a link. Note that this can be either the @samp{link}
2704 part (if there is no description) or the @samp{description} part. To
2705 edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
2708 If you place the cursor at the beginning or just behind the end of the
2709 displayed text and press @key{BACKSPACE}, you will remove the
2710 (invisible) bracket at that location. This makes the link incomplete
2711 and the internals are again displayed as plain text. Inserting the
2712 missing bracket hides the link internals again. To show the
2713 internal structure of all links, use the menu entry
2714 @code{Org->Hyperlinks->Literal links}.
2716 @node Internal links, External links, Link format, Hyperlinks
2717 @section Internal links
2718 @cindex internal links
2719 @cindex links, internal
2720 @cindex targets, for links
2722 @cindex property, CUSTOM_ID
2723 If the link does not look like a URL, it is considered to be internal in the
2724 current file. The most important case is a link like
2725 @samp{[[#my-custom-id]]} which will link to the entry with the
2726 @code{CUSTOM_ID} property @samp{my-custom-id}. Such custom IDs are very good
2727 for HTML export (@pxref{HTML export}) where they produce pretty section
2728 links. You are responsible yourself to make sure these custom IDs are unique
2731 Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]}
2732 lead to a text search in the current file.
2734 The link can be followed with @kbd{C-c C-o} when the cursor is on the link,
2735 or with a mouse click (@pxref{Handling links}). Links to custom IDs will
2736 point to the corresponding headline. The preferred match for a text link is
2737 a @i{dedicated target}: the same string in double angular brackets. Targets
2738 may be located anywhere; sometimes it is convenient to put them into a
2739 comment line. For example
2745 @noindent In HTML export (@pxref{HTML export}), such targets will become
2746 named anchors for direct access through @samp{http} links@footnote{Note that
2747 text before the first headline is usually not exported, so the first such
2748 target should be after the first headline, or in the line directly before the
2751 If no dedicated target exists, Org will search for the words in the link. In
2752 the above example the search would be for @samp{my target}. Links starting
2753 with a star like @samp{*My Target} restrict the search to
2754 headlines@footnote{To insert a link targeting a headline, in-buffer
2755 completion can be used. Just type a star followed by a few optional letters
2756 into the buffer and press @kbd{M-@key{TAB}}. All headlines in the current
2757 buffer will be offered as completions. @xref{Handling links}, for more
2758 commands creating links.}. When searching, Org mode will first try an
2759 exact match, but then move on to more and more lenient searches. For
2760 example, the link @samp{[[*My Targets]]} will find any of the following:
2764 ** TODO my targets are bright
2765 ** my 20 targets are
2769 Following a link pushes a mark onto Org's own mark ring. You can
2770 return to the previous position with @kbd{C-c &}. Using this command
2771 several times in direct succession goes back to positions recorded
2775 * Radio targets:: Make targets trigger links in plain text
2778 @node Radio targets, , Internal links, Internal links
2779 @subsection Radio targets
2780 @cindex radio targets
2781 @cindex targets, radio
2782 @cindex links, radio targets
2784 Org can automatically turn any occurrences of certain target names
2785 in normal text into a link. So without explicitly creating a link, the
2786 text connects to the target radioing its position. Radio targets are
2787 enclosed by triple angular brackets. For example, a target @samp{<<<My
2788 Target>>>} causes each occurrence of @samp{my target} in normal text to
2789 become activated as a link. The Org file is scanned automatically
2790 for radio targets only when the file is first loaded into Emacs. To
2791 update the target list during editing, press @kbd{C-c C-c} with the
2792 cursor on or at a target.
2794 @node External links, Handling links, Internal links, Hyperlinks
2795 @section External links
2796 @cindex links, external
2797 @cindex external links
2798 @cindex links, external
2806 @cindex WANDERLUST links
2808 @cindex USENET links
2813 Org supports links to files, websites, Usenet and email messages,
2814 BBDB database entries and links to both IRC conversations and their
2815 logs. External links are URL-like locators. They start with a short
2816 identifying string followed by a colon. There can be no space after
2817 the colon. The following list shows examples for each link type.
2820 http://www.astro.uva.nl/~dominik @r{on the web}
2821 file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
2822 /home/dominik/images/jupiter.jpg @r{same as above}
2823 file:papers/last.pdf @r{file, relative path}
2824 ./papers/last.pdf @r{same as above}
2825 file:projects.org @r{another Org file}
2826 file:projects.org::some words @r{text search in Org file}
2827 file:projects.org::*task title @r{heading search in Org file}
2828 id:B7423F4D-2E8A-471B-8810-C40F074717E9 @r{Link to heading by ID}
2829 news:comp.emacs @r{Usenet link}
2830 mailto:adent@@galaxy.net @r{Mail link}
2831 vm:folder @r{VM folder link}
2832 vm:folder#id @r{VM message link}
2833 vm://myself@@some.where.org/folder#id @r{VM on remote machine}
2834 wl:folder @r{WANDERLUST folder link}
2835 wl:folder#id @r{WANDERLUST message link}
2836 mhe:folder @r{MH-E folder link}
2837 mhe:folder#id @r{MH-E message link}
2838 rmail:folder @r{RMAIL folder link}
2839 rmail:folder#id @r{RMAIL message link}
2840 gnus:group @r{Gnus group link}
2841 gnus:group#id @r{Gnus article link}
2842 bbdb:R.*Stallman @r{BBDB link (with regexp)}
2843 irc:/irc.com/#emacs/bob @r{IRC link}
2844 shell:ls *.org @r{A shell command}
2845 elisp:org-agenda @r{Interactive Elisp command}
2846 elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate}
2849 A link should be enclosed in double brackets and may contain a
2850 descriptive text to be displayed instead of the URL (@pxref{Link
2851 format}), for example:
2854 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
2858 If the description is a file name or URL that points to an image, HTML
2859 export (@pxref{HTML export}) will inline the image as a clickable
2860 button. If there is no description at all and the link points to an
2862 that image will be inlined into the exported HTML file.
2864 @cindex square brackets, around links
2865 @cindex plain text external links
2866 Org also finds external links in the normal text and activates them
2867 as links. If spaces must be part of the link (for example in
2868 @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
2869 about the end of the link, enclose them in square brackets.
2871 @node Handling links, Using links outside Org, External links, Hyperlinks
2872 @section Handling links
2873 @cindex links, handling
2875 Org provides methods to create a link in the correct syntax, to
2876 insert it into an Org file, and to follow the link.
2880 @cindex storing links
2882 Store a link to the current location. This is a @emph{global} command (you
2883 must create the key binding yourself) which can be used in any buffer to
2884 create a link. The link will be stored for later insertion into an Org
2885 buffer (see below). What kind of link will be created depends on the current
2888 @b{Org-mode buffers}@*
2889 For Org files, if there is a @samp{<<target>>} at the cursor, the link points
2890 to the target. Otherwise it points to the current headline, which will also
2893 @vindex org-link-to-org-use-id
2894 @cindex property, CUSTOM_ID
2895 @cindex property, ID
2896 If the headline has a @code{CUSTOM_ID} property, a link to this custom ID
2897 will be stored. In addition or alternatively (depending on the value of
2898 @code{org-link-to-org-use-id}), a globally unique @code{ID} property will be
2899 created and/or used to construct a link. So using this command in Org
2900 buffers will potentially create two links: A human-readable from the custom
2901 ID, and one that is globally unique and works even if the entry is moved from
2902 file to file. Later, when inserting the link, you need to decide which one
2905 @b{Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus}@*
2906 Pretty much all Emacs mail clients are supported. The link will point to the
2907 current article, or, in some GNUS buffers, to the group. The description is
2908 constructed from the author and the subject.
2910 @b{Web browsers: W3 and W3M}@*
2911 Here the link will be the current URL, with the page title as description.
2913 @b{Contacts: BBDB}@*
2914 Links created in a BBDB buffer will point to the current entry.
2917 @vindex org-irc-link-to-logs
2918 For IRC links, if you set the variable @code{org-irc-link-to-logs} to
2919 @code{t}, a @samp{file:/} style link to the relevant point in the logs for
2920 the current conversation is created. Otherwise an @samp{irc:/} style link to
2921 the user/channel/server under the point will be stored.
2924 For any other files, the link will point to the file, with a search string
2925 (@pxref{Search options}) pointing to the contents of the current line. If
2926 there is an active region, the selected words will form the basis of the
2927 search string. If the automatically created link is not working correctly or
2928 accurately enough, you can write custom functions to select the search string
2929 and to do the search for particular file types---see @ref{Custom searches}.
2930 The key binding @kbd{C-c l} is only a suggestion---see @ref{Installation}.
2933 @cindex link completion
2934 @cindex completion, of links
2935 @cindex inserting links
2937 @vindex org-keep-stored-link-after-insertion
2938 Insert a link@footnote{ Note that you don't have to use this command to
2939 insert a link. Links in Org are plain text, and you can type or paste them
2940 straight into the buffer. By using this command, the links are automatically
2941 enclosed in double brackets, and you will be asked for the optional
2942 descriptive text.}. This prompts for a link to be inserted into the buffer.
2943 You can just type a link, using text for an internal link, or one of the link
2944 type prefixes mentioned in the examples above. The link will be inserted
2945 into the buffer@footnote{After insertion of a stored link, the link will be
2946 removed from the list of stored links. To keep it in the list later use, use
2947 a triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
2948 @code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
2949 If some text was selected when this command is called, the selected text
2950 becomes the default description.
2952 @b{Inserting stored links}@*
2953 All links stored during the
2954 current session are part of the history for this prompt, so you can access
2955 them with @key{up} and @key{down} (or @kbd{M-p/n}).
2957 @b{Completion support}@* Completion with @key{TAB} will help you to insert
2958 valid link prefixes like @samp{http:} or @samp{ftp:}, including the prefixes
2959 defined through link abbreviations (@pxref{Link abbreviations}). If you
2960 press @key{RET} after inserting only the @var{prefix}, Org will offer
2961 specific completion support for some link types@footnote{This works by
2962 calling a special function @code{org-PREFIX-complete-link}.} For
2963 example, if you type @kbd{file @key{RET}}, file name completion (alternative
2964 access: @kbd{C-u C-c C-l}, see below) will be offered, and after @kbd{bbdb
2965 @key{RET}} you can complete contact names.
2967 @cindex file name completion
2968 @cindex completion, of file names
2970 When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
2971 a file will be inserted and you may use file name completion to select
2972 the name of the file. The path to the file is inserted relative to the
2973 directory of the current Org file, if the linked file is in the current
2974 directory or in a sub-directory of it, or if the path is written relative
2975 to the current directory using @samp{../}. Otherwise an absolute path
2976 is used, if possible with @samp{~/} for your home directory. You can
2977 force an absolute path with two @kbd{C-u} prefixes.
2979 @item C-c C-l @r{(with cursor on existing link)}
2980 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
2981 link and description parts of the link.
2983 @cindex following links
2986 @item C-c C-o @r{or} @key{RET}
2987 @vindex org-file-apps
2988 Open link at point. This will launch a web browser for URLs (using
2989 @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for
2990 the corresponding links, and execute the command in a shell link. When the
2991 cursor is on an internal link, this commands runs the corresponding search.
2992 When the cursor is on a TAG list in a headline, it creates the corresponding
2993 TAGS view. If the cursor is on a timestamp, it compiles the agenda for that
2994 date. Furthermore, it will visit text and remote files in @samp{file:} links
2995 with Emacs and select a suitable application for local non-text files.
2996 Classification of files is based on file extension only. See option
2997 @code{org-file-apps}. If you want to override the default application and
2998 visit the file with Emacs, use a @kbd{C-u} prefix. If you want to avoid
2999 opening in Emacs, use a @kbd{C-u C-u} prefix.
3005 On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
3006 would. Under Emacs 22, @kbd{mouse-1} will also follow a link.
3010 @vindex org-display-internal-link-with-indirect-buffer
3011 Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
3012 internal links to be displayed in another window@footnote{See the
3013 variable @code{org-display-internal-link-with-indirect-buffer}}.
3018 Push the current position onto the mark ring, to be able to return
3019 easily. Commands following an internal link do this automatically.
3021 @cindex links, returning to
3024 Jump back to a recorded position. A position is recorded by the
3025 commands following internal links, and by @kbd{C-c %}. Using this
3026 command several times in direct succession moves through a ring of
3027 previously recorded positions.
3031 @cindex links, finding next/previous
3034 Move forward/backward to the next link in the buffer. At the limit of
3035 the buffer, the search fails once, and then wraps around. The key
3036 bindings for this are really too long, you might want to bind this also
3037 to @kbd{C-n} and @kbd{C-p}
3039 (add-hook 'org-load-hook
3041 (define-key 'org-mode-map "\C-n" 'org-next-link)
3042 (define-key 'org-mode-map "\C-p" 'org-previous-link)))
3046 @node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
3047 @section Using links outside Org
3049 You can insert and follow links that have Org syntax not only in
3050 Org, but in any Emacs buffer. For this, you should create two
3051 global commands, like this (please select suitable global keys
3055 (global-set-key "\C-c L" 'org-insert-link-global)
3056 (global-set-key "\C-c o" 'org-open-at-point-global)
3059 @node Link abbreviations, Search options, Using links outside Org, Hyperlinks
3060 @section Link abbreviations
3061 @cindex link abbreviations
3062 @cindex abbreviation, links
3064 Long URLs can be cumbersome to type, and often many similar links are
3065 needed in a document. For this you can use link abbreviations. An
3066 abbreviated link looks like this
3069 [[linkword:tag][description]]
3073 @vindex org-link-abbrev-alist
3074 where the tag is optional. The @i{linkword} must be a word; letter, numbers,
3075 @samp{-}, and @samp{_} are allowed here. Abbreviations are resolved
3076 according to the information in the variable @code{org-link-abbrev-alist}
3077 that relates the linkwords to replacement text. Here is an example:
3081 (setq org-link-abbrev-alist
3082 '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
3083 ("google" . "http://www.google.com/search?q=")
3084 ("ads" . "http://adsabs.harvard.edu/cgi-bin/
3085 nph-abs_connect?author=%s&db_key=AST")))
3089 If the replacement text contains the string @samp{%s}, it will be
3090 replaced with the tag. Otherwise the tag will be appended to the string
3091 in order to create the link. You may also specify a function that will
3092 be called with the tag as the only argument to create the link.
3094 With the above setting, you could link to a specific bug with
3095 @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
3096 @code{[[google:OrgMode]]} and find out what the Org author is
3097 doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
3099 If you need special abbreviations just for a single Org buffer, you
3100 can define them in the file with
3104 #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
3105 #+LINK: google http://www.google.com/search?q=%s
3109 In-buffer completion (@pxref{Completion}) can be used after @samp{[} to
3110 complete link abbreviations. You may also define a function
3111 @code{org-PREFIX-complete-link} that implements special (@eg completion)
3112 support for inserting such a link with @kbd{C-c C-l}. Such a function should
3113 not accept any arguments, and return the full link with prefix.
3115 @node Search options, Custom searches, Link abbreviations, Hyperlinks
3116 @section Search options in file links
3117 @cindex search option in file links
3118 @cindex file links, searching
3120 File links can contain additional information to make Emacs jump to a
3121 particular location in the file when following a link. This can be a
3122 line number or a search option after a double@footnote{For backward
3123 compatibility, line numbers can also follow a single colon.} colon. For
3124 example, when the command @kbd{C-c l} creates a link (@pxref{Handling
3125 links}) to a file, it encodes the words in the current line as a search
3126 string that can be used to find this line back later when following the
3127 link with @kbd{C-c C-o}.
3129 Here is the syntax of the different ways to attach a search to a file
3130 link, together with an explanation:
3133 [[file:~/code/main.c::255]]
3134 [[file:~/xx.org::My Target]]
3135 [[file:~/xx.org::*My Target]]
3136 [[file:~/xx.org::/regexp/]]
3143 Search for a link target @samp{<<My Target>>}, or do a text search for
3144 @samp{my target}, similar to the search in internal links, see
3145 @ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
3146 link will become an HTML reference to the corresponding named anchor in
3149 In an Org file, restrict search to headlines.
3151 Do a regular expression search for @code{regexp}. This uses the Emacs
3152 command @code{occur} to list all matches in a separate window. If the
3153 target file is in Org mode, @code{org-occur} is used to create a
3154 sparse tree with the matches.
3155 @c If the target file is a directory,
3156 @c @code{grep} will be used to search all files in the directory.
3159 As a degenerate case, a file link with an empty file name can be used
3160 to search the current file. For example, @code{[[file:::find me]]} does
3161 a search for @samp{find me} in the current file, just as
3162 @samp{[[find me]]} would.
3164 @node Custom searches, , Search options, Hyperlinks
3165 @section Custom Searches
3166 @cindex custom search strings
3167 @cindex search strings, custom
3169 The default mechanism for creating search strings and for doing the
3170 actual search related to a file link may not work correctly in all
3171 cases. For example, Bib@TeX{} database files have many entries like
3172 @samp{year="1993"} which would not result in good search strings,
3173 because the only unique identification for a Bib@TeX{} entry is the
3176 @vindex org-create-file-search-functions
3177 @vindex org-execute-file-search-functions
3178 If you come across such a problem, you can write custom functions to set
3179 the right search string for a particular file type, and to do the search
3180 for the string in the file. Using @code{add-hook}, these functions need
3181 to be added to the hook variables
3182 @code{org-create-file-search-functions} and
3183 @code{org-execute-file-search-functions}. See the docstring for these
3184 variables for more information. Org actually uses this mechanism
3185 for Bib@TeX{} database files, and you can use the corresponding code as
3186 an implementation example. See the file @file{org-bibtex.el}.
3188 @node TODO Items, Tags, Hyperlinks, Top
3192 Org mode does not maintain TODO lists as separate documents@footnote{Of
3193 course, you can make a document that contains only long lists of TODO items,
3194 but this is not required.}. Instead, TODO items are an integral part of the
3195 notes file, because TODO items usually come up while taking notes! With Org
3196 mode, simply mark any entry in a tree as being a TODO item. In this way,
3197 information is not duplicated, and the entire context from which the TODO
3198 item emerged is always present.
3200 Of course, this technique for managing TODO items scatters them
3201 throughout your notes file. Org mode compensates for this by providing
3202 methods to give you an overview of all the things that you have to do.
3205 * TODO basics:: Marking and displaying TODO entries
3206 * TODO extensions:: Workflow and assignments
3207 * Progress logging:: Dates and notes for progress
3208 * Priorities:: Some things are more important than others
3209 * Breaking down tasks:: Splitting a task into manageable pieces
3210 * Checkboxes:: Tick-off lists
3213 @node TODO basics, TODO extensions, TODO Items, TODO Items
3214 @section Basic TODO functionality
3216 Any headline becomes a TODO item when it starts with the word
3217 @samp{TODO}, for example:
3220 *** TODO Write letter to Sam Fortune
3224 The most important commands to work with TODO entries are:
3228 @cindex cycling, of TODO states
3230 Rotate the TODO state of the current item among
3233 ,-> (unmarked) -> TODO -> DONE --.
3234 '--------------------------------'
3237 The same rotation can also be done ``remotely'' from the timeline and
3238 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
3242 Select a specific keyword using completion or (if it has been set up)
3243 the fast selection interface. For the latter, you need to assign keys
3244 to TODO states, see @ref{Per-file keywords}, and @ref{Setting tags}, for
3247 @kindex S-@key{right}
3248 @kindex S-@key{left}
3249 @vindex org-treat-S-cursor-todo-selection-as-state-change
3252 Select the following/preceding TODO state, similar to cycling. Useful
3253 mostly if more than two TODO states are possible (@pxref{TODO
3254 extensions}). See also @ref{Conflicts}, for a discussion of the interaction
3255 with @code{shift-selection-mode}. See also the variable
3256 @code{org-treat-S-cursor-todo-selection-as-state-change}.
3259 @cindex sparse tree, for TODO
3262 @vindex org-todo-keywords
3263 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds the
3264 entire buffer, but shows all TODO items and the headings hierarchy above
3265 them. With a prefix argument, search for a specific TODO. You will be
3266 prompted for the keyword, and you can also give a list of keywords like
3267 @code{KWD1|KWD2|...} to list entries that match any one of these keywords.
3268 With numeric prefix argument N, show the tree for the Nth keyword in the
3269 variable @code{org-todo-keywords}. With two prefix arguments, find all TODO
3273 Show the global TODO list. Collects the TODO items from all agenda
3274 files (@pxref{Agenda Views}) into a single buffer. The new buffer will
3275 be in @code{agenda-mode}, which provides commands to examine and
3276 manipulate the TODO entries from the new buffer (@pxref{Agenda
3277 commands}). @xref{Global TODO list}, for more information.
3278 @kindex S-M-@key{RET}
3280 Insert a new TODO entry below the current one.
3284 @vindex org-todo-state-tags-triggers
3285 Changing a TODO state can also trigger tag changes. See the docstring of the
3286 option @code{org-todo-state-tags-triggers} for details.
3288 @node TODO extensions, Progress logging, TODO basics, TODO Items
3289 @section Extended use of TODO keywords
3290 @cindex extended TODO keywords
3292 @vindex org-todo-keywords
3293 By default, marked TODO entries have one of only two states: TODO and
3294 DONE. Org mode allows you to classify TODO items in more complex ways
3295 with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With
3296 special setup, the TODO keyword system can work differently in different
3299 Note that @i{tags} are another way to classify headlines in general and
3300 TODO items in particular (@pxref{Tags}).
3303 * Workflow states:: From TODO to DONE in steps
3304 * TODO types:: I do this, Fred does the rest
3305 * Multiple sets in one file:: Mixing it all, and still finding your way
3306 * Fast access to TODO states:: Single letter selection of a state
3307 * Per-file keywords:: Different files, different requirements
3308 * Faces for TODO keywords:: Highlighting states
3309 * TODO dependencies:: When one task needs to wait for others
3312 @node Workflow states, TODO types, TODO extensions, TODO extensions
3313 @subsection TODO keywords as workflow states
3314 @cindex TODO workflow
3315 @cindex workflow states as TODO keywords
3317 You can use TODO keywords to indicate different @emph{sequential} states
3318 in the process of working on an item, for example@footnote{Changing
3319 this variable only becomes effective after restarting Org mode in a
3323 (setq org-todo-keywords
3324 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
3327 The vertical bar separates the TODO keywords (states that @emph{need
3328 action}) from the DONE states (which need @emph{no further action}). If
3329 you don't provide the separator bar, the last state is used as the DONE
3331 @cindex completion, of TODO keywords
3332 With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
3333 to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. You may
3334 also use a numeric prefix argument to quickly select a specific state. For
3335 example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
3336 Or you can use @kbd{S-@key{left}} to go backward through the sequence. If you
3337 define many keywords, you can use in-buffer completion
3338 (@pxref{Completion}) or even a special one-key selection scheme
3339 (@pxref{Fast access to TODO states}) to insert these words into the
3340 buffer. Changing a TODO state can be logged with a timestamp, see
3341 @ref{Tracking TODO state changes}, for more information.
3343 @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
3344 @subsection TODO keywords as types
3346 @cindex names as TODO keywords
3347 @cindex types as TODO keywords
3349 The second possibility is to use TODO keywords to indicate different
3350 @emph{types} of action items. For example, you might want to indicate
3351 that items are for ``work'' or ``home''. Or, when you work with several
3352 people on a single project, you might want to assign action items
3353 directly to persons, by using their names as TODO keywords. This would
3354 be set up like this:
3357 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
3360 In this case, different keywords do not indicate a sequence, but rather
3361 different types. So the normal work flow would be to assign a task to a
3362 person, and later to mark it DONE. Org mode supports this style by adapting
3363 the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
3364 @kbd{t} command in the timeline and agenda buffers.}. When used several
3365 times in succession, it will still cycle through all names, in order to first
3366 select the right type for a task. But when you return to the item after some
3367 time and execute @kbd{C-c C-t} again, it will switch from any name directly
3368 to DONE. Use prefix arguments or completion to quickly select a specific
3369 name. You can also review the items of a specific TODO type in a sparse tree
3370 by using a numeric prefix to @kbd{C-c C-v}. For example, to see all things
3371 Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect Lucy's items
3372 from all agenda files into a single buffer, you would use the numeric prefix
3373 argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
3375 @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
3376 @subsection Multiple keyword sets in one file
3377 @cindex TODO keyword sets
3379 Sometimes you may want to use different sets of TODO keywords in
3380 parallel. For example, you may want to have the basic
3381 @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
3382 separate state indicating that an item has been canceled (so it is not
3383 DONE, but also does not require action). Your setup would then look
3387 (setq org-todo-keywords
3388 '((sequence "TODO" "|" "DONE")
3389 (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
3390 (sequence "|" "CANCELED")))
3393 The keywords should all be different, this helps Org mode to keep track
3394 of which subsequence should be used for a given entry. In this setup,
3395 @kbd{C-c C-t} only operates within a subsequence, so it switches from
3396 @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
3397 (nothing) to @code{REPORT}. Therefore you need a mechanism to initially
3398 select the correct sequence. Besides the obvious ways like typing a
3399 keyword or using completion, you may also apply the following commands:
3402 @kindex C-S-@key{right}
3403 @kindex C-S-@key{left}
3404 @kindex C-u C-u C-c C-t
3405 @item C-u C-u C-c C-t
3406 @itemx C-S-@key{right}
3407 @itemx C-S-@key{left}
3408 These keys jump from one TODO subset to the next. In the above example,
3409 @kbd{C-u C-u C-c C-t} or @kbd{C-S-@key{right}} would jump from @code{TODO} or
3410 @code{DONE} to @code{REPORT}, and any of the words in the second row to
3411 @code{CANCELED}. Note that the @kbd{C-S-} key binding conflict with
3412 @code{shift-selection-mode} (@pxref{Conflicts}).
3413 @kindex S-@key{right}
3414 @kindex S-@key{left}
3417 @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through @emph{all}
3418 keywords from all sets, so for example @kbd{S-@key{<right>}} would switch
3419 from @code{DONE} to @code{REPORT} in the example above. See also
3420 @ref{Conflicts}, for a discussion of the interaction with
3421 @code{shift-selection-mode}.
3424 @node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
3425 @subsection Fast access to TODO states
3427 If you would like to quickly change an entry to an arbitrary TODO state
3428 instead of cycling through the states, you can set up keys for
3429 single-letter access to the states. This is done by adding the section
3430 key after each keyword, in parentheses. For example:
3433 (setq org-todo-keywords
3434 '((sequence "TODO(t)" "|" "DONE(d)")
3435 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
3436 (sequence "|" "CANCELED(c)")))
3439 @vindex org-fast-tag-selection-include-todo
3440 If you then press @code{C-c C-t} followed by the selection key, the entry
3441 will be switched to this state. @key{SPC} can be used to remove any TODO
3442 keyword from an entry.@footnote{Check also the variable
3443 @code{org-fast-tag-selection-include-todo}, it allows you to change the TODO
3444 state through the tags interface (@pxref{Setting tags}), in case you like to
3445 mingle the two concepts. Note that this means you need to come up with
3446 unique keys across both sets of keywords.}
3448 @node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
3449 @subsection Setting up keywords for individual files
3450 @cindex keyword options
3451 @cindex per-file keywords
3456 It can be very useful to use different aspects of the TODO mechanism in
3457 different files. For file-local settings, you need to add special lines
3458 to the file which set the keywords and interpretation for that file
3459 only. For example, to set one of the two examples discussed above, you
3460 need one of the following lines, starting in column zero anywhere in the
3464 #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
3466 @noindent (you may also write @code{#+SEQ_TODO} to be explicit about the
3467 interpretation, but it means the same as @code{#+TODO}), or
3469 #+TYP_TODO: Fred Sara Lucy Mike | DONE
3472 A setup for using several sets in parallel would be:
3476 #+TODO: REPORT BUG KNOWNCAUSE | FIXED
3480 @cindex completion, of option keywords
3482 @noindent To make sure you are using the correct keyword, type
3483 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
3485 @cindex DONE, final TODO keyword
3486 Remember that the keywords after the vertical bar (or the last keyword
3487 if no bar is there) must always mean that the item is DONE (although you
3488 may use a different word). After changing one of these lines, use
3489 @kbd{C-c C-c} with the cursor still in the line to make the changes
3490 known to Org mode@footnote{Org mode parses these lines only when
3491 Org mode is activated after visiting a file. @kbd{C-c C-c} with the
3492 cursor in a line starting with @samp{#+} is simply restarting Org mode
3493 for the current buffer.}.
3495 @node Faces for TODO keywords, TODO dependencies, Per-file keywords, TODO extensions
3496 @subsection Faces for TODO keywords
3497 @cindex faces, for TODO keywords
3499 @vindex org-todo @r{(face)}
3500 @vindex org-done @r{(face)}
3501 @vindex org-todo-keyword-faces
3502 Org mode highlights TODO keywords with special faces: @code{org-todo}
3503 for keywords indicating that an item still has to be acted upon, and
3504 @code{org-done} for keywords indicating that an item is finished. If
3505 you are using more than 2 different states, you might want to use
3506 special faces for some of them. This can be done using the variable
3507 @code{org-todo-keyword-faces}. For example:
3511 (setq org-todo-keyword-faces
3512 '(("TODO" . org-warning)
3513 ("DEFERRED" . shadow)
3514 ("CANCELED" . (:foreground "blue" :weight bold))))
3518 While using a list with face properties as shown for CANCELED
3519 @emph{should} work, this does not aways seem to be the case. If
3520 necessary, define a special face and use that.
3522 @node TODO dependencies, , Faces for TODO keywords, TODO extensions
3523 @subsection TODO dependencies
3524 @cindex TODO dependencies
3525 @cindex dependencies, of TODO states
3527 @vindex org-enforce-todo-dependencies
3528 @cindex property, ORDERED
3529 The structure of Org files (hierarchy and lists) makes it easy to define TODO
3530 dependencies. Usually, a parent TODO task should not be marked DONE until
3531 all subtasks (defined as children tasks) are marked as DONE. And sometimes
3532 there is a logical sequence to a number of (sub)tasks, so that one task
3533 cannot be acted upon before all siblings above it are done. If you customize
3534 the variable @code{org-enforce-todo-dependencies}, Org will block entries
3535 from changing state to DONE while they have children that are not DONE.
3536 Furthermore, if an entry has a property @code{ORDERED}, each of its children
3537 will be blocked until all earlier siblings are marked DONE. Here is an
3541 * TODO Blocked until (two) is done
3550 ** TODO b, needs to wait for (a)
3551 ** TODO c, needs to wait for (a) and (b)
3557 @vindex org-track-ordered-property-with-tag
3558 @cindex property, ORDERED
3559 Toggle the @code{ORDERED} property of the current entry. A property is used
3560 for this behavior because this should be local to the current entry, not
3561 inherited like a tag. However, if you would like to @i{track} the value of
3562 this property with a tag for better visibility, customize the variable
3563 @code{org-track-ordered-property-with-tag}.
3564 @kindex C-u C-u C-u C-c C-t
3565 @item C-u C-u C-u C-c C-t
3566 Change TODO state, circumventing any state blocking.
3569 @vindex org-agenda-dim-blocked-tasks
3570 If you set the variable @code{org-agenda-dim-blocked-tasks}, TODO entries
3571 that cannot be closed because of such dependencies will be shown in a dimmed
3572 font or even made invisible in agenda views (@pxref{Agenda Views}).
3574 @cindex checkboxes and TODO dependencies
3575 @vindex org-enforce-todo-dependencies
3576 You can also block changes of TODO states by looking at checkboxes
3577 (@pxref{Checkboxes}). If you set the variable
3578 @code{org-enforce-todo-checkbox-dependencies}, an entry that has unchecked
3579 checkboxes will be blocked from switching to DONE.
3581 If you need more complex dependency structures, for example dependencies
3582 between entries in different trees or files, check out the contributed
3583 module @file{org-depend.el}.
3586 @node Progress logging, Priorities, TODO extensions, TODO Items
3587 @section Progress logging
3588 @cindex progress logging
3589 @cindex logging, of progress
3591 Org mode can automatically record a timestamp and possibly a note when
3592 you mark a TODO item as DONE, or even each time you change the state of
3593 a TODO item. This system is highly configurable, settings can be on a
3594 per-keyword basis and can be localized to a file or even a subtree. For
3595 information on how to clock working time for a task, see @ref{Clocking
3599 * Closing items:: When was this entry marked DONE?
3600 * Tracking TODO state changes:: When did the status change?
3603 @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
3604 @subsection Closing items
3606 The most basic logging is to keep track of @emph{when} a certain TODO
3607 item was finished. This is achieved with@footnote{The corresponding
3608 in-buffer setting is: @code{#+STARTUP: logdone}}.
3611 (setq org-log-done 'time)
3615 Then each time you turn an entry from a TODO (not-done) state into any
3616 of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
3617 just after the headline. If you turn the entry back into a TODO item
3618 through further state cycling, that line will be removed again. If you
3619 want to record a note along with the timestamp, use@footnote{The
3620 corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
3623 (setq org-log-done 'note)
3627 You will then be prompted for a note, and that note will be stored below
3628 the entry with a @samp{Closing Note} heading.
3630 In the timeline (@pxref{Timeline}) and in the agenda
3631 (@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
3632 display the TODO items with a @samp{CLOSED} timestamp on each day,
3633 giving you an overview of what has been done.
3635 @node Tracking TODO state changes, , Closing items, Progress logging
3636 @subsection Tracking TODO state changes
3637 @cindex drawer, for state change recording
3639 @vindex org-log-states-order-reversed
3640 @vindex org-log-into-drawer
3641 @cindex property, LOG_INTO_DRAWER
3642 When TODO keywords are used as workflow states (@pxref{Workflow states}), you
3643 might want to keep track of when a state change occurred and maybe take a
3644 note about this change. You can either record just a timestamp, or a
3645 time-stamped note for a change. These records will be inserted after the
3646 headline as an itemized list, newest first@footnote{See the variable
3647 @code{org-log-states-order-reversed}}. When taking a lot of notes, you might
3648 want to get the notes out of the way into a drawer (@pxref{Drawers}).
3649 Customize the variable @code{org-log-into-drawer} to get this
3650 behavior---the recommended drawer for this is called @code{LOGBOOK}. You can
3651 also overrule the setting of this variable for a subtree by setting a
3652 @code{LOG_INTO_DRAWER} property.
3654 Since it is normally too much to record a note for every state, Org mode
3655 expects configuration on a per-keyword basis for this. This is achieved by
3656 adding special markers @samp{!} (for a timestamp) and @samp{@@} (for a note)
3657 in parentheses after each keyword. For example, with the setting
3660 (setq org-todo-keywords
3661 '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
3665 @vindex org-log-done
3666 you not only define global TODO keywords and fast access keys, but also
3667 request that a time is recorded when the entry is set to
3668 DONE@footnote{It is possible that Org mode will record two timestamps
3669 when you are using both @code{org-log-done} and state change logging.
3670 However, it will never prompt for two notes---if you have configured
3671 both, the state change recording note will take precedence and cancel
3672 the @samp{Closing Note}.}, and that a note is recorded when switching to
3673 WAIT or CANCELED. The setting for WAIT is even more special: The
3674 @samp{!} after the slash means that in addition to the note taken when
3675 entering the state, a timestamp should be recorded when @i{leaving} the
3676 WAIT state, if and only if the @i{target} state does not configure
3677 logging for entering it. So it has no effect when switching from WAIT
3678 to DONE, because DONE is configured to record a timestamp only. But
3679 when switching from WAIT back to TODO, the @samp{/!} in the WAIT
3680 setting now triggers a timestamp even though TODO has no logging
3683 You can use the exact same syntax for setting logging preferences local
3686 #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
3689 @cindex property, LOGGING
3690 In order to define logging settings that are local to a subtree or a
3691 single item, define a LOGGING property in this entry. Any non-empty
3692 LOGGING property resets all logging settings to nil. You may then turn
3693 on logging for this specific tree using STARTUP keywords like
3694 @code{lognotedone} or @code{logrepeat}, as well as adding state specific
3695 settings like @code{TODO(!)}. For example
3698 * TODO Log each state with only a time
3700 :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
3702 * TODO Only log when switching to WAIT, and when repeating
3704 :LOGGING: WAIT(@@) logrepeat
3706 * TODO No logging at all
3712 @node Priorities, Breaking down tasks, Progress logging, TODO Items
3716 If you use Org mode extensively, you may end up enough TODO items that
3717 it starts to make sense to prioritize them. Prioritizing can be done by
3718 placing a @emph{priority cookie} into the headline of a TODO item, like
3722 *** TODO [#A] Write letter to Sam Fortune
3726 By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
3727 @samp{C}. @samp{A} is the highest priority. An entry without a cookie
3728 is treated as priority @samp{B}. Priorities make a difference only in
3729 the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
3730 no inherent meaning to Org mode.
3732 Priorities can be attached to any outline tree entries; they do not need
3738 Set the priority of the current headline. The command prompts for a
3739 priority character @samp{A}, @samp{B} or @samp{C}. When you press
3740 @key{SPC} instead, the priority cookie is removed from the headline.
3741 The priorities can also be changed ``remotely'' from the timeline and
3742 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
3745 @kindex S-@key{down}
3748 @vindex org-priority-start-cycle-with-default
3749 Increase/decrease priority of current headline@footnote{See also the option
3750 @code{org-priority-start-cycle-with-default}.}. Note that these keys are
3751 also used to modify timestamps (@pxref{Creating timestamps}). See also
3752 @ref{Conflicts}, for a discussion of the interaction with
3753 @code{shift-selection-mode}.
3756 @vindex org-highest-priority
3757 @vindex org-lowest-priority
3758 @vindex org-default-priority
3759 You can change the range of allowed priorities by setting the variables
3760 @code{org-highest-priority}, @code{org-lowest-priority}, and
3761 @code{org-default-priority}. For an individual buffer, you may set
3762 these values (highest, lowest, default) like this (please make sure that
3763 the highest priority is earlier in the alphabet than the lowest
3766 @cindex #+PRIORITIES
3771 @node Breaking down tasks, Checkboxes, Priorities, TODO Items
3772 @section Breaking tasks down into subtasks
3773 @cindex tasks, breaking down
3775 @vindex org-agenda-todo-list-sublevels
3776 It is often advisable to break down large tasks into smaller, manageable
3777 subtasks. You can do this by creating an outline tree below a TODO item,
3778 with detailed subtasks on the tree@footnote{To keep subtasks out of the
3779 global TODO list, see the @code{org-agenda-todo-list-sublevels}.}. To keep
3780 the overview over the fraction of subtasks that are already completed, insert
3781 either @samp{[/]} or @samp{[%]} anywhere in the headline. These cookies will
3782 be updates each time the todo status of a child changes. For example:
3785 * Organize Party [33%]
3786 ** TODO Call people [1/2]
3790 ** DONE Talk to neighbor
3793 @cindex property, COOKIE_DATA
3794 If a heading has both checkboxes and TODO children below it, the meaning of
3795 the statistics cookie become ambiguous. Set the property
3796 @code{COOKIE_DATA} to either @samp{checkbox} or @samp{todo} to resolve
3799 If you would like a TODO entry to automatically change to DONE
3800 when all children are done, you can use the following setup:
3803 (defun org-summary-todo (n-done n-not-done)
3804 "Switch entry to DONE when all subentries are done, to TODO otherwise."
3805 (let (org-log-done org-log-states) ; turn off logging
3806 (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
3808 (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
3812 Another possibility is the use of checkboxes to identify (a hierarchy of) a
3813 large number of subtasks (@pxref{Checkboxes}).
3816 @node Checkboxes, , Breaking down tasks, TODO Items
3820 Every item in a plain list (@pxref{Plain lists}) can be made into a
3821 checkbox by starting it with the string @samp{[ ]}. This feature is
3822 similar to TODO items (@pxref{TODO Items}), but is more lightweight.
3823 Checkboxes are not included into the global TODO list, so they are often
3824 great to split a task into a number of simple steps. Or you can use
3825 them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or
3826 use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
3828 Here is an example of a checkbox list.
3831 * TODO Organize party [2/4]
3832 - [-] call people [1/3]
3837 - [ ] think about what music to play
3838 - [X] talk to the neighbors
3841 Checkboxes work hierarchically, so if a checkbox item has children that
3842 are checkboxes, toggling one of the children checkboxes will make the
3843 parent checkbox reflect if none, some, or all of the children are
3846 @cindex statistics, for checkboxes
3847 @cindex checkbox statistics
3848 @cindex property, COOKIE_DATA
3849 The @samp{[2/4]} and @samp{[1/3]} in the first and second line are cookies
3850 indicating how many checkboxes present in this entry have been checked off,
3851 and the total number of checkboxes present. This can give you an idea on
3852 how many checkboxes remain, even without opening a folded entry. The cookies
3853 can be placed into a headline or into (the first line of) a plain list item.
3854 Each cookie covers checkboxes of direct children structurally below the
3855 headline/item on which the cookie appears@footnote{Set the variable
3856 @code{org-recursive-checkbox-statistics} if you want such cookes to represent
3857 the all checkboxes below the cookie, not just the direct children.}. You
3858 have to insert the cookie yourself by typing either @samp{[/]} or @samp{[%]}.
3859 With @samp{[/]} you get an @samp{n out of m} result, as in the examples
3860 above. With @samp{[%]} you get information about the percentage of
3861 checkboxes checked (in the above example, this would be @samp{[50%]} and
3862 @samp{[33%]}, respectively). In a headline, a cookie can count either
3863 checkboxes below the heading or TODO states of children, and it will display
3864 whatever was changed last. Set the property @code{COOKIE_DATA} to either
3865 @samp{checkbox} or @samp{todo} to resolve this issue.
3867 @cindex blocking, of checkboxes
3868 @cindex checkbox blocking
3869 @cindex property, ORDERED
3870 If the current outline node has an @code{ORDERED} property, checkboxes must
3871 be checked off in sequence, and an error will be thrown if you try to check
3872 off a box while there are unchecked boxes bove it.
3874 @noindent The following commands work with checkboxes:
3879 Toggle checkbox status or (with prefix arg) checkbox presence at point. With
3880 double prefix argument, set it to @samp{[-]}, which is considered to be an
3884 Toggle checkbox status or (with prefix arg) checkbox presence at point. With
3885 double prefix argument, set it to @samp{[-]}, which is considered to be an
3889 If there is an active region, toggle the first checkbox in the region
3890 and set all remaining boxes to the same status as the first. With a prefix
3891 arg, add or remove the checkbox for all items in the region.
3893 If the cursor is in a headline, toggle checkboxes in the region between
3894 this headline and the next (so @emph{not} the entire subtree).
3896 If there is no active region, just toggle the checkbox at point.
3898 @kindex M-S-@key{RET}
3900 Insert a new item with a checkbox.
3901 This works only if the cursor is already in a plain list item
3902 (@pxref{Plain lists}).
3905 @vindex org-track-ordered-property-with-tag
3906 @cindex property, ORDERED
3907 Toggle the @code{ORDERED} property of the entry, to toggle if checkboxes must
3908 be checked off in sequence. A property is used for this behavior because
3909 this should be local to the current entry, not inherited like a tag.
3910 However, if you would like to @i{track} the value of this property with a tag
3911 for better visibility, customize the variable
3912 @code{org-track-ordered-property-with-tag}.
3915 Update the checkbox statistics in the current outline entry. When
3916 called with a @kbd{C-u} prefix, update the entire file. Checkbox
3917 statistic cookies are updated automatically if you toggle checkboxes
3918 with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}. If you
3919 delete boxes or add/change them by hand, use this command to get things
3920 back into sync. Or simply toggle any checkbox twice with @kbd{C-c C-c}.
3923 @node Tags, Properties and Columns, TODO Items, Top
3926 @cindex headline tagging
3927 @cindex matching, tags
3928 @cindex sparse tree, tag based
3930 An excellent way to implement labels and contexts for cross-correlating
3931 information is to assign @i{tags} to headlines. Org mode has extensive
3934 @vindex org-tag-faces
3935 Every headline can contain a list of tags; they occur at the end of the
3936 headline. Tags are normal words containing letters, numbers, @samp{_}, and
3937 @samp{@@}. Tags must be preceded and followed by a single colon, @eg{},
3938 @samp{:work:}. Several tags can be specified, as in @samp{:work:urgent:}.
3939 Tags will by default be in bold face with the same color as the headline.
3940 You may specify special faces for specific tags using the variable
3941 @code{org-tag-faces}, in much the same way as you can for TODO keywords
3942 (@pxref{Faces for TODO keywords}).
3945 * Tag inheritance:: Tags use the tree structure of the outline
3946 * Setting tags:: How to assign tags to a headline
3947 * Tag searches:: Searching for combinations of tags
3950 @node Tag inheritance, Setting tags, Tags, Tags
3951 @section Tag inheritance
3952 @cindex tag inheritance
3953 @cindex inheritance, of tags
3954 @cindex sublevels, inclusion into tags match
3956 @i{Tags} make use of the hierarchical structure of outline trees. If a
3957 heading has a certain tag, all subheadings will inherit the tag as
3958 well. For example, in the list
3961 * Meeting with the French group :work:
3962 ** Summary by Frank :boss:notes:
3963 *** TODO Prepare slides for him :action:
3967 the final heading will have the tags @samp{:work:}, @samp{:boss:},
3968 @samp{:notes:}, and @samp{:action:} even though the final heading is not
3969 explicitly marked with those tags. You can also set tags that all entries in
3970 a file should inherit just as if these tags were defined in a hypothetical
3971 level zero that surrounds the entire file.
3975 #+FILETAGS: :Peter:Boss:Secret:
3979 @vindex org-use-tag-inheritance
3980 @vindex org-tags-exclude-from-inheritance
3981 To limit tag inheritance to specific tags, or to turn it off entirely, use
3982 the variables @code{org-use-tag-inheritance} and
3983 @code{org-tags-exclude-from-inheritance}.
3985 @vindex org-tags-match-list-sublevels
3986 When a headline matches during a tags search while tag inheritance is turned
3987 on, all the sublevels in the same tree will (for a simple match form) match
3988 as well@footnote{This is only true if the search does not involve more
3989 complex tests including properties (@pxref{Property searches}).}. The list
3990 of matches may then become very long. If you only want to see the first tags
3991 match in a subtree, configure the variable
3992 @code{org-tags-match-list-sublevels} (not recommended).
3994 @node Setting tags, Tag searches, Tag inheritance, Tags
3995 @section Setting tags
3996 @cindex setting tags
3997 @cindex tags, setting
4000 Tags can simply be typed into the buffer at the end of a headline.
4001 After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
4002 also a special command for inserting tags:
4007 @cindex completion, of tags
4008 @vindex org-tags-column
4009 Enter new tags for the current headline. Org mode will either offer
4010 completion or a special single-key interface for setting tags, see
4011 below. After pressing @key{RET}, the tags will be inserted and aligned
4012 to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all
4013 tags in the current buffer will be aligned to that column, just to make
4014 things look nice. TAGS are automatically realigned after promotion,
4015 demotion, and TODO state changes (@pxref{TODO basics}).
4018 When the cursor is in a headline, this does the same as @kbd{C-c C-q}.
4021 @vindex org-tag-alist
4022 Org will support tag insertion based on a @emph{list of tags}. By
4023 default this list is constructed dynamically, containing all tags
4024 currently used in the buffer. You may also globally specify a hard list
4025 of tags with the variable @code{org-tag-alist}. Finally you can set
4026 the default tags for a given file with lines like
4030 #+TAGS: @@work @@home @@tennisclub
4031 #+TAGS: laptop car pc sailboat
4034 If you have globally defined your preferred set of tags using the
4035 variable @code{org-tag-alist}, but would like to use a dynamic tag list
4036 in a specific file, add an empty TAGS option line to that file:
4042 @vindex org-tag-persistent-alist
4043 If you have a preferred set of tags that you would like to use in every file,
4044 in addition to those defined on a per-file basis by TAGS option lines, then
4045 you may specify a list of tags with the variable
4046 @code{org-tag-persistent-alist}. You may turn this off on a per-file basis
4047 by adding a STARTUP option line to that file:
4053 By default Org mode uses the standard minibuffer completion facilities for
4054 entering tags. However, it also implements another, quicker, tag selection
4055 method called @emph{fast tag selection}. This allows you to select and
4056 deselect tags with just a single key press. For this to work well you should
4057 assign unique letters to most of your commonly used tags. You can do this
4058 globally by configuring the variable @code{org-tag-alist} in your
4059 @file{.emacs} file. For example, you may find the need to tag many items in
4060 different files with @samp{:@@home:}. In this case you can set something
4064 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
4067 @noindent If the tag is only relevant to the file you are working on, then you
4068 can instead set the TAGS option line as:
4071 #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
4074 @noindent The tags interface will show the available tags in a splash
4075 window. If you want to start a new line after a specific tag, insert
4076 @samp{\n} into the tag list
4079 #+TAGS: @@work(w) @@home(h) @@tennisclub(t) \n laptop(l) pc(p)
4082 @noindent or write them in two lines:
4085 #+TAGS: @@work(w) @@home(h) @@tennisclub(t)
4086 #+TAGS: laptop(l) pc(p)
4090 You can also group together tags that are mutually exclusive by using
4094 #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
4097 @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
4098 and @samp{@@tennisclub} should be selected. Multiple such groups are allowed.
4100 @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
4101 these lines to activate any changes.
4104 To set these mutually exclusive groups in the variable @code{org-tags-alist},
4105 you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
4106 of the braces. Similarly, you can use @code{:newline} to indicate a line
4107 break. The previous example would be set globally by the following
4111 (setq org-tag-alist '((:startgroup . nil)
4112 ("@@work" . ?w) ("@@home" . ?h)
4113 ("@@tennisclub" . ?t)
4115 ("laptop" . ?l) ("pc" . ?p)))
4118 If at least one tag has a selection key then pressing @kbd{C-c C-c} will
4119 automatically present you with a special interface, listing inherited tags,
4120 the tags of the current headline, and a list of all valid tags with
4121 corresponding keys@footnote{Keys will automatically be assigned to tags which
4122 have no configured keys.}. In this interface, you can use the following
4127 Pressing keys assigned to tags will add or remove them from the list of
4128 tags in the current line. Selecting a tag in a group of mutually
4129 exclusive tags will turn off any other tags from that group.
4132 Enter a tag in the minibuffer, even if the tag is not in the predefined
4133 list. You will be able to complete on all tags present in the buffer.
4136 Clear all tags for this line.
4139 Accept the modified set.
4141 Abort without installing changes.
4143 If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
4145 Turn off groups of mutually exclusive tags. Use this to (as an
4146 exception) assign several tags from such a group.
4148 Toggle auto-exit after the next change (see below).
4149 If you are using expert mode, the first @kbd{C-c} will display the
4154 This method lets you assign tags to a headline with very few keys. With
4155 the above setup, you could clear the current tags and set @samp{@@home},
4156 @samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
4157 C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to
4158 @samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
4159 alternatively with @kbd{C-c C-c C-c w}. Adding the non-predefined tag
4160 @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
4161 @key{RET} @key{RET}}.
4163 @vindex org-fast-tag-selection-single-key
4164 If you find that most of the time you need only a single key press to
4165 modify your list of tags, set the variable
4166 @code{org-fast-tag-selection-single-key}. Then you no longer have to
4167 press @key{RET} to exit fast tag selection---it will immediately exit
4168 after the first change. If you then occasionally need more keys, press
4169 @kbd{C-c} to turn off auto-exit for the current tag selection process
4170 (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
4171 C-c}). If you set the variable to the value @code{expert}, the special
4172 window is not even shown for single-key tag selection, it comes up only
4173 when you press an extra @kbd{C-c}.
4175 @node Tag searches, , Setting tags, Tags
4176 @section Tag searches
4177 @cindex tag searches
4178 @cindex searching for tags
4180 Once a system of tags has been set up, it can be used to collect related
4181 information into special lists.
4188 Create a sparse tree with all headlines matching a tags search. With a
4189 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
4192 Create a global list of tag matches from all agenda files.
4193 @xref{Matching tags and properties}.
4196 @vindex org-tags-match-list-sublevels
4197 Create a global list of tag matches from all agenda files, but check
4198 only TODO items and force checking subitems (see variable
4199 @code{org-tags-match-list-sublevels}).
4202 These commands all prompt for a match string which allows basic Boolean logic
4203 like @samp{+boss+urgent-project1}, to find entries with tags @samp{boss} and
4204 @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find entries
4205 which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of the search
4206 string is rich and allows also matching against TODO keywords, entry levels
4207 and properties. For a complete description with many examples, see
4208 @ref{Matching tags and properties}.
4211 @node Properties and Columns, Dates and Times, Tags, Top
4212 @chapter Properties and Columns
4215 Properties are a set of key-value pairs associated with an entry. There
4216 are two main applications for properties in Org mode. First, properties
4217 are like tags, but with a value. Second, you can use properties to
4218 implement (very basic) database capabilities in an Org buffer. For
4219 an example of the first application, imagine maintaining a file where
4220 you document bugs and plan releases for a piece of software. Instead of
4221 using tags like @code{:release_1:}, @code{:release_2:}, one can use a
4222 property, say @code{:Release:}, that in different subtrees has different
4223 values, such as @code{1.0} or @code{2.0}. For an example of the second
4224 application of properties, imagine keeping track of your music CDs,
4225 where properties could be things such as the album, artist, date of
4226 release, number of tracks, and so on.
4228 Properties can be conveniently edited and viewed in column view
4229 (@pxref{Column view}).
4232 * Property syntax:: How properties are spelled out
4233 * Special properties:: Access to other Org mode features
4234 * Property searches:: Matching property values
4235 * Property inheritance:: Passing values down the tree
4236 * Column view:: Tabular viewing and editing
4237 * Property API:: Properties for Lisp programmers
4240 @node Property syntax, Special properties, Properties and Columns, Properties and Columns
4241 @section Property syntax
4242 @cindex property syntax
4243 @cindex drawer, for properties
4245 Properties are key-value pairs. They need to be inserted into a special
4246 drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property
4247 is specified on a single line, with the key (surrounded by colons)
4248 first, and the value after it. Here is an example:
4253 *** Goldberg Variations
4255 :Title: Goldberg Variations
4256 :Composer: J.S. Bach
4258 :Publisher: Deutsche Grammophon
4263 You may define the allowed values for a particular property @samp{:Xyz:}
4264 by setting a property @samp{:Xyz_ALL:}. This special property is
4265 @emph{inherited}, so if you set it in a level 1 entry, it will apply to
4266 the entire tree. When allowed values are defined, setting the
4267 corresponding property becomes easier and is less prone to typing
4268 errors. For the example with the CD collection, we can predefine
4269 publishers and the number of disks in a box like this:
4274 :NDisks_ALL: 1 2 3 4
4275 :Publisher_ALL: "Deutsche Grammophon" Philips EMI
4279 If you want to set properties that can be inherited by any entry in a
4280 file, use a line like
4281 @cindex property, _ALL
4284 #+PROPERTY: NDisks_ALL 1 2 3 4
4287 @vindex org-global-properties
4288 Property values set with the global variable
4289 @code{org-global-properties} can be inherited by all entries in all
4293 The following commands help to work with properties:
4298 After an initial colon in a line, complete property keys. All keys used
4299 in the current file will be offered as possible completions.
4302 Set a property. This prompts for a property name and a value. If
4303 necessary, the property drawer is created as well.
4304 @item M-x org-insert-property-drawer
4305 Insert a property drawer into the current entry. The drawer will be
4306 inserted early in the entry, but after the lines with planning
4307 information like deadlines.
4310 With the cursor in a property drawer, this executes property commands.
4312 Set a property in the current entry. Both the property and the value
4313 can be inserted using completion.
4314 @kindex S-@key{right}
4315 @kindex S-@key{left}
4316 @item S-@key{left}/@key{right}
4317 Switch property at point to the next/previous allowed value.
4319 Remove a property from the current entry.
4321 Globally remove a property, from all entries in the current file.
4323 Compute the property at point, using the operator and scope from the
4324 nearest column format definition.
4327 @node Special properties, Property searches, Property syntax, Properties and Columns
4328 @section Special properties
4329 @cindex properties, special
4331 Special properties provide an alternative access method to Org mode
4332 features, like the TODO state or the priority of an entry, discussed in the
4333 previous chapters. This interface exists so that you can include
4334 these states in a column view (@pxref{Column view}), or to use them in
4335 queries. The following property names are special and should not be
4336 used as keys in the properties drawer:
4338 @cindex property, special, TODO
4339 @cindex property, special, TAGS
4340 @cindex property, special, ALLTAGS
4341 @cindex property, special, CATEGORY
4342 @cindex property, special, PRIORITY
4343 @cindex property, special, DEADLINE
4344 @cindex property, special, SCHEDULED
4345 @cindex property, special, CLOSED
4346 @cindex property, special, TIMESTAMP
4347 @cindex property, special, TIMESTAMP_IA
4348 @cindex property, special, CLOCKSUM
4349 @c guessing that ITEM is needed in this area; also, should this list be sorted?
4350 @cindex property, special, ITEM
4352 TODO @r{The TODO keyword of the entry.}
4353 TAGS @r{The tags defined directly in the headline.}
4354 ALLTAGS @r{All tags, including inherited ones.}
4355 CATEGORY @r{The category of an entry.}
4356 PRIORITY @r{The priority of the entry, a string with a single letter.}
4357 DEADLINE @r{The deadline time string, without the angular brackets.}
4358 SCHEDULED @r{The scheduling timestamp, without the angular brackets.}
4359 CLOSED @r{When was this entry closed?}
4360 TIMESTAMP @r{The first keyword-less timestamp in the entry.}
4361 TIMESTAMP_IA @r{The first inactive timestamp in the entry.}
4362 CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}}
4363 @r{must be run first to compute the values.}
4364 ITEM @r{The content of the entry.}
4367 @node Property searches, Property inheritance, Special properties, Properties and Columns
4368 @section Property searches
4369 @cindex properties, searching
4370 @cindex searching, of properties
4372 To create sparse trees and special lists with selection based on properties,
4373 the same commands are used as for tag searches (@pxref{Tag searches}).
4379 Create a sparse tree with all matching entries. With a
4380 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
4383 Create a global list of tag/property matches from all agenda files.
4384 @xref{Matching tags and properties}.
4387 @vindex org-tags-match-list-sublevels
4388 Create a global list of tag matches from all agenda files, but check
4389 only TODO items and force checking of subitems (see variable
4390 @code{org-tags-match-list-sublevels}).
4393 The syntax for the search string is described in @ref{Matching tags and
4396 There is also a special command for creating sparse trees based on a
4402 Create a sparse tree based on the value of a property. This first
4403 prompts for the name of a property, and then for a value. A sparse tree
4404 is created with all entries that define this property with the given
4405 value. If you enclose the value into curly braces, it is interpreted as
4406 a regular expression and matched against the property values.
4409 @node Property inheritance, Column view, Property searches, Properties and Columns
4410 @section Property Inheritance
4411 @cindex properties, inheritance
4412 @cindex inheritance, of properties
4414 @vindex org-use-property-inheritance
4415 The outline structure of Org-mode documents lends itself for an
4416 inheritance model of properties: If the parent in a tree has a certain
4417 property, the children can inherit this property. Org mode does not
4418 turn this on by default, because it can slow down property searches
4419 significantly and is often not needed. However, if you find inheritance
4420 useful, you can turn it on by setting the variable
4421 @code{org-use-property-inheritance}. It may be set to @code{t} to make
4422 all properties inherited from the parent, to a list of properties
4423 that should be inherited, or to a regular expression that matches
4424 inherited properties.
4426 Org mode has a few properties for which inheritance is hard-coded, at
4427 least for the special applications for which they are used:
4429 @cindex property, COLUMNS
4432 The @code{:COLUMNS:} property defines the format of column view
4433 (@pxref{Column view}). It is inherited in the sense that the level
4434 where a @code{:COLUMNS:} property is defined is used as the starting
4435 point for a column view table, independently of the location in the
4436 subtree from where columns view is turned on.
4438 @cindex property, CATEGORY
4439 For agenda view, a category set through a @code{:CATEGORY:} property
4440 applies to the entire subtree.
4442 @cindex property, ARCHIVE
4443 For archiving, the @code{:ARCHIVE:} property may define the archive
4444 location for the entire subtree (@pxref{Moving subtrees}).
4446 @cindex property, LOGGING
4447 The LOGGING property may define logging settings for an entry or a
4448 subtree (@pxref{Tracking TODO state changes}).
4451 @node Column view, Property API, Property inheritance, Properties and Columns
4452 @section Column view
4454 A great way to view and edit properties in an outline tree is
4455 @emph{column view}. In column view, each outline item is turned into a
4456 table row. Columns in this table provide access to properties of the
4457 entries. Org mode implements columns by overlaying a tabular structure
4458 over the headline of each item. While the headlines have been turned
4459 into a table row, you can still change the visibility of the outline
4460 tree. For example, you get a compact table by switching to CONTENTS
4461 view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
4462 is active), but you can still open, read, and edit the entry below each
4463 headline. Or, you can switch to column view after executing a sparse
4464 tree command and in this way get a table only for the selected items.
4465 Column view also works in agenda buffers (@pxref{Agenda Views}) where
4466 queries have collected selected items, possibly from a number of files.
4469 * Defining columns:: The COLUMNS format property
4470 * Using column view:: How to create and use column view
4471 * Capturing column view:: A dynamic block for column view
4474 @node Defining columns, Using column view, Column view, Column view
4475 @subsection Defining columns
4476 @cindex column view, for properties
4477 @cindex properties, column view
4479 Setting up a column view first requires defining the columns. This is
4480 done by defining a column format line.
4483 * Scope of column definitions:: Where defined, where valid?
4484 * Column attributes:: Appearance and content of a column
4487 @node Scope of column definitions, Column attributes, Defining columns, Defining columns
4488 @subsubsection Scope of column definitions
4490 To define a column format for an entire file, use a line like
4494 #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
4497 To specify a format that only applies to a specific tree, add a
4498 @code{:COLUMNS:} property to the top node of that tree, for example:
4501 ** Top node for columns view
4503 :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
4507 If a @code{:COLUMNS:} property is present in an entry, it defines columns
4508 for the entry itself, and for the entire subtree below it. Since the
4509 column definition is part of the hierarchical structure of the document,
4510 you can define columns on level 1 that are general enough for all
4511 sublevels, and more specific columns further down, when you edit a
4512 deeper part of the tree.
4514 @node Column attributes, , Scope of column definitions, Defining columns
4515 @subsubsection Column attributes
4516 A column definition sets the attributes of a column. The general
4517 definition looks like this:
4520 %[@var{width}]@var{property}[(@var{title})][@{@var{summary-type}@}]
4524 Except for the percent sign and the property name, all items are
4525 optional. The individual parts have the following meaning:
4528 @var{width} @r{An integer specifying the width of the column in characters.}
4529 @r{If omitted, the width will be determined automatically.}
4530 @var{property} @r{The property that should be edited in this column.}
4531 (title) @r{The header text for the column. If omitted, the}
4532 @r{property name is used.}
4533 @{@var{summary-type}@} @r{The summary type. If specified, the column values for}
4534 @r{parent nodes are computed from the children.}
4535 @r{Supported summary types are:}
4536 @{+@} @r{Sum numbers in this column.}
4537 @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.}
4538 @{$@} @r{Currency, short for @samp{+;%.2f}.}
4539 @{:@} @r{Sum times, HH:MM:SS, plain numbers are hours.}
4540 @{X@} @r{Checkbox status, @samp{[X]} if all children are @samp{[X]}.}
4541 @{X/@} @r{Checkbox status, @samp{[n/m]}.}
4542 @{X%@} @r{Checkbox status, @samp{[n%]}.}
4543 @{min@} @r{Smallest number in column.}
4544 @{max@} @r{Largest number.}
4545 @{mean@} @r{Arithmetic mean of numbers.}
4546 @{:min@} @r{Smallest time value in column.}
4547 @{:max@} @r{Largest time value.}
4548 @{:mean@} @r{Arithmetic mean of time values.}
4552 Here is an example for a complete columns definition, along with allowed
4556 :COLUMNS: %20ITEM %9Approved(Approved?)@{X@} %Owner %11Status \@footnote{Please note that the COLUMNS definition must be on a single line---it is wrapped here only because of formatting constraints.}
4557 %10Time_Estimate@{:@} %CLOCKSUM
4558 :Owner_ALL: Tammy Mark Karl Lisa Don
4559 :Status_ALL: "In progress" "Not started yet" "Finished" ""
4560 :Approved_ALL: "[ ]" "[X]"
4564 The first column, @samp{%25ITEM}, means the first 25 characters of the
4565 item itself, @ie of the headline. You probably always should start the
4566 column definition with the @samp{ITEM} specifier. The other specifiers
4567 create columns @samp{Owner} with a list of names as allowed values, for
4568 @samp{Status} with four different possible values, and for a checkbox
4569 field @samp{Approved}. When no width is given after the @samp{%}
4570 character, the column will be exactly as wide as it needs to be in order
4571 to fully display all values. The @samp{Approved} column does have a
4572 modified title (@samp{Approved?}, with a question mark). Summaries will
4573 be created for the @samp{Time_Estimate} column by adding time duration
4574 expressions like HH:MM, and for the @samp{Approved} column, by providing
4575 an @samp{[X]} status if all children have been checked. The
4576 @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
4579 @node Using column view, Capturing column view, Defining columns, Column view
4580 @subsection Using column view
4583 @tsubheading{Turning column view on and off}
4586 @vindex org-columns-default-format
4587 Create the column view for the local environment. This command searches
4588 the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
4589 a format. When one is found, the column view table is established for
4590 the entire tree, starting from the entry that contains the @code{:COLUMNS:}
4591 property. If none is found, the format is taken from the @code{#+COLUMNS}
4592 line or from the variable @code{org-columns-default-format}, and column
4593 view is established for the current entry and its subtree.
4596 Recreate the column view, to include recent changes made in the buffer.
4603 @tsubheading{Editing values}
4604 @item @key{left} @key{right} @key{up} @key{down}
4605 Move through the column view from field to field.
4606 @kindex S-@key{left}
4607 @kindex S-@key{right}
4608 @item S-@key{left}/@key{right}
4609 Switch to the next/previous allowed value of the field. For this, you
4610 have to have specified allowed values for a property.
4612 Directly select the nth allowed value, @kbd{0} selects the 10th value.
4616 Same as @kbd{S-@key{left}/@key{right}}
4619 Edit the property at point. For the special properties, this will
4620 invoke the same interface that you normally use to change that
4621 property. For example, when editing a TAGS property, the tag completion
4622 or fast selection interface will pop up.
4625 When there is a checkbox at point, toggle it.
4628 View the full value of this property. This is useful if the width of
4629 the column is smaller than that of the value.
4632 Edit the list of allowed values for this property. If the list is found
4633 in the hierarchy, the modified values is stored there. If no list is
4634 found, the new value is stored in the first entry that is part of the
4635 current column view.
4636 @tsubheading{Modifying the table structure}
4640 Make the column narrower/wider by one character.
4641 @kindex S-M-@key{right}
4642 @item S-M-@key{right}
4643 Insert a new column, to the left of the current column.
4644 @kindex S-M-@key{left}
4645 @item S-M-@key{left}
4646 Delete the current column.
4649 @node Capturing column view, , Using column view, Column view
4650 @subsection Capturing column view
4652 Since column view is just an overlay over a buffer, it cannot be
4653 exported or printed directly. If you want to capture a column view, use
4654 a @code{columnview} dynamic block (@pxref{Dynamic blocks}). The frame
4655 of this block looks like this:
4657 @cindex #+BEGIN, columnview
4660 #+BEGIN: columnview :hlines 1 :id "label"
4665 @noindent This dynamic block has the following parameters:
4669 This is the most important parameter. Column view is a feature that is
4670 often localized to a certain (sub)tree, and the capture block might be
4671 at a different location in the file. To identify the tree whose view to
4672 capture, you can use 4 values:
4673 @cindex property, ID
4675 local @r{use the tree in which the capture block is located}
4676 global @r{make a global view, including all headings in the file}
4677 "file:@var{path-to-file}"
4678 @r{run column view at the top of this file}
4679 "@var{ID}" @r{call column view in the tree that has an @code{:ID:}}
4680 @r{property with the value @i{label}. You can use}
4681 @r{@kbd{M-x org-id-copy} to create a globally unique ID for}
4682 @r{the current entry and copy it to the kill-ring.}
4685 When @code{t}, insert an hline after every line. When a number @var{N}, insert
4686 an hline before each headline with level @code{<= @var{N}}.
4688 When set to @code{t}, force column groups to get vertical lines.
4690 When set to a number, don't capture entries below this level.
4691 @item :skip-empty-rows
4692 When set to @code{t}, skip rows where the only non-empty specifier of the
4693 column view is @code{ITEM}.
4698 The following commands insert or update the dynamic block:
4703 Insert a dynamic block capturing a column view. You will be prompted
4704 for the scope or ID of the view.
4709 Update dynamic block at point. The cursor needs to be in the
4710 @code{#+BEGIN} line of the dynamic block.
4711 @kindex C-u C-c C-x C-u
4712 @item C-u C-c C-x C-u
4713 Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
4714 you have several clock table blocks in a buffer.
4717 You can add formulas to the column view table and you may add plotting
4718 instructions in front of the table---these will survive an update of the
4719 block. If there is a @code{#+TBLFM:} after the table, the table will
4720 actually be recalculated automatically after an update.
4722 An alternative way to capture and process property values into a table is
4723 provided by Eric Schulte's @file{org-collector.el} which is a contributed
4724 package@footnote{Contributed packages are not part of Emacs, but are
4725 distributed with the main distribution of Org (visit
4726 @uref{http://orgmode.org}).}. It provides a general API to collect
4727 properties from entries in a certain scope, and arbitrary Lisp expressions to
4728 process these values before inserting them into a table or a dynamic block.
4730 @node Property API, , Column view, Properties and Columns
4731 @section The Property API
4732 @cindex properties, API
4733 @cindex API, for properties
4735 There is a full API for accessing and changing properties. This API can
4736 be used by Emacs Lisp programs to work with properties and to implement
4737 features based on them. For more information see @ref{Using the
4740 @node Dates and Times, Capture, Properties and Columns, Top
4741 @chapter Dates and Times
4747 To assist project planning, TODO items can be labeled with a date and/or
4748 a time. The specially formatted string carrying the date and time
4749 information is called a @emph{timestamp} in Org mode. This may be a
4750 little confusing because timestamp is often used as indicating when
4751 something was created or last changed. However, in Org mode this term
4752 is used in a much wider sense.
4755 * Timestamps:: Assigning a time to a tree entry
4756 * Creating timestamps:: Commands which insert timestamps
4757 * Deadlines and scheduling:: Planning your work
4758 * Clocking work time:: Tracking how long you spend on a task
4759 * Effort estimates:: Planning work effort in advance
4760 * Relative timer:: Notes with a running timer
4764 @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
4765 @section Timestamps, deadlines, and scheduling
4767 @cindex ranges, time
4772 A timestamp is a specification of a date (possibly with a time or a range
4773 of times) in a special format, either @samp{<2003-09-16 Tue>} or
4774 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
4775 12:00-12:30>}@footnote{This is the standard ISO date/time format. To
4776 use an alternative format, see @ref{Custom time format}.}. A timestamp
4777 can appear anywhere in the headline or body of an Org tree entry. Its
4778 presence causes entries to be shown on specific dates in the agenda
4779 (@pxref{Weekly/daily agenda}). We distinguish:
4782 @item Plain timestamp; Event; Appointment
4784 A simple timestamp just assigns a date/time to an item. This is just
4785 like writing down an appointment or event in a paper agenda. In the
4786 timeline and agenda displays, the headline of an entry associated with a
4787 plain timestamp will be shown exactly on that date.
4790 * Meet Peter at the movies <2006-11-01 Wed 19:15>
4791 * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
4794 @item Timestamp with repeater interval
4795 @cindex timestamp, with repeater interval
4796 A timestamp may contain a @emph{repeater interval}, indicating that it
4797 applies not only on the given date, but again and again after a certain
4798 interval of N days (d), weeks (w), months (m), or years (y). The
4799 following will show up in the agenda every Wednesday:
4802 * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
4805 @item Diary-style sexp entries
4806 For more complex date specifications, Org mode supports using the
4807 special sexp diary entries implemented in the Emacs calendar/diary
4808 package. For example
4811 * The nerd meeting on every 2nd Thursday of the month
4812 <%%(diary-float t 4 2)>
4815 @item Time/Date range
4818 Two timestamps connected by @samp{--} denote a range. The headline
4819 will be shown on the first and last day of the range, and on any dates
4820 that are displayed and fall in the range. Here is an example:
4823 ** Meeting in Amsterdam
4824 <2004-08-23 Mon>--<2004-08-26 Thu>
4827 @item Inactive timestamp
4828 @cindex timestamp, inactive
4829 @cindex inactive timestamp
4830 Just like a plain timestamp, but with square brackets instead of
4831 angular ones. These timestamps are inactive in the sense that they do
4832 @emph{not} trigger an entry to show up in the agenda.
4835 * Gillian comes late for the fifth time [2006-11-01 Wed]
4840 @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
4841 @section Creating timestamps
4842 @cindex creating timestamps
4843 @cindex timestamps, creating
4845 For Org mode to recognize timestamps, they need to be in the specific
4846 format. All commands listed below produce timestamps in the correct
4852 Prompt for a date and insert a corresponding timestamp. When the cursor is
4853 at an existing timestamp in the buffer, the command is used to modify this
4854 timestamp instead of inserting a new one. When this command is used twice in
4855 succession, a time range is inserted.
4859 Like @kbd{C-c .}, but insert an inactive timestamp that will not cause
4866 @vindex org-time-stamp-rounding-minutes
4867 Like @kbd{C-c .} and @kbd{C-c !}, but use the alternative format which
4868 contains date and time. The default time can be rounded to multiples of 5
4869 minutes, see the option @code{org-time-stamp-rounding-minutes}.
4873 Insert a timestamp corresponding to the cursor date in the Calendar.
4877 Access the Emacs calendar for the current date. If there is a
4878 timestamp in the current line, go to the corresponding date
4883 Access the agenda for the date given by the timestamp or -range at
4884 point (@pxref{Weekly/daily agenda}).
4886 @kindex S-@key{left}
4887 @kindex S-@key{right}
4889 @itemx S-@key{right}
4890 Change date at cursor by one day. These key bindings conflict with
4891 shift-selection and related modes (@pxref{Conflicts}).
4894 @kindex S-@key{down}
4897 Change the item under the cursor in a timestamp. The cursor can be on a
4898 year, month, day, hour or minute. When the timestamp contains a time range
4899 like @samp{15:30-16:30}, modifying the first time will also shift the second,
4900 shifting the time block with constant length. To change the length, modify
4901 the second time. Note that if the cursor is in a headline and not at a
4902 timestamp, these same keys modify the priority of an item.
4903 (@pxref{Priorities}). The key bindings also conflict with shift-selection and
4904 related modes (@pxref{Conflicts}).
4907 @cindex evaluate time range
4909 Evaluate a time range by computing the difference between start and end.
4910 With a prefix argument, insert result after the time range (in a table: into
4911 the following column).
4916 * The date/time prompt:: How Org mode helps you entering date and time
4917 * Custom time format:: Making dates look different
4920 @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
4921 @subsection The date/time prompt
4922 @cindex date, reading in minibuffer
4923 @cindex time, reading in minibuffer
4925 @vindex org-read-date-prefer-future
4926 When Org mode prompts for a date/time, the default is shown as an ISO
4927 date, and the prompt therefore seems to ask for an ISO date. But it
4928 will in fact accept any string containing some date and/or time
4929 information, and it is really smart about interpreting your input. You
4930 can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
4931 copied from an email message. Org mode will find whatever information
4932 is in there and derive anything you have not specified from the
4933 @emph{default date and time}. The default is usually the current date
4934 and time, but when modifying an existing timestamp, or when entering
4935 the second stamp of a range, it is taken from the stamp in the buffer.
4936 When filling in information, Org mode assumes that most of the time you
4937 will want to enter a date in the future: If you omit the month/year and
4938 the given day/month is @i{before} today, it will assume that you mean a
4939 future date@footnote{See the variable
4940 @code{org-read-date-prefer-future}.}.
4942 For example, let's assume that today is @b{June 13, 2006}. Here is how
4943 various inputs will be interpreted, the items filled in by Org mode are
4947 3-2-5 --> 2003-02-05
4948 14 --> @b{2006}-@b{06}-14
4949 12 --> @b{2006}-@b{07}-12
4950 Fri --> nearest Friday (defaultdate or later)
4951 sep 15 --> @b{2006}-09-15
4952 feb 15 --> @b{2007}-02-15
4953 sep 12 9 --> 2009-09-12
4954 12:45 --> @b{2006}-@b{06}-@b{13} 12:45
4955 22 sept 0:34 --> @b{2006}-09-22 0:34
4956 w4 --> ISO week for of the current year @b{2006}
4957 2012 w4 fri --> Friday of ISO week 4 in 2012
4958 2012-w04-5 --> Same as above
4961 Furthermore you can specify a relative date by giving, as the
4962 @emph{first} thing in the input: a plus/minus sign, a number and a
4963 letter ([dwmy]) to indicate change in days, weeks, months, or years. With a
4964 single plus or minus, the date is always relative to today. With a
4965 double plus or minus, it is relative to the default date. If instead of
4966 a single letter, you use the abbreviation of day name, the date will be
4967 the nth such day. @Eg
4972 +4d --> four days from today
4973 +4 --> same as above
4974 +2w --> two weeks from today
4975 ++5 --> five days from default date
4976 +2tue --> second tuesday from now.
4979 @vindex parse-time-months
4980 @vindex parse-time-weekdays
4981 The function understands English month and weekday abbreviations. If
4982 you want to use unabbreviated names and/or other languages, configure
4983 the variables @code{parse-time-months} and @code{parse-time-weekdays}.
4985 @cindex calendar, for selecting date
4986 @vindex org-popup-calendar-for-date-prompt
4987 Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
4988 you don't need/want the calendar, configure the variable
4989 @code{org-popup-calendar-for-date-prompt}.}. When you exit the date
4990 prompt, either by clicking on a date in the calendar, or by pressing
4991 @key{RET}, the date selected in the calendar will be combined with the
4992 information entered at the prompt. You can control the calendar fully
4993 from the minibuffer:
4998 @kindex S-@key{right}
4999 @kindex S-@key{left}
5000 @kindex S-@key{down}
5002 @kindex M-S-@key{right}
5003 @kindex M-S-@key{left}
5006 > / < @r{Scroll calendar forward/backward by one month.}
5007 mouse-1 @r{Select date by clicking on it.}
5008 S-@key{right}/@key{left} @r{One day forward/backward.}
5009 S-@key{down}/@key{up} @r{One week forward/backward.}
5010 M-S-@key{right}/@key{left} @r{One month forward/backward.}
5011 @key{RET} @r{Choose date in calendar.}
5014 @vindex org-read-date-display-live
5015 The actions of the date/time prompt may seem complex, but I assure you they
5016 will grow on you, and you will start getting annoyed by pretty much any other
5017 way of entering a date/time out there. To help you understand what is going
5018 on, the current interpretation of your input will be displayed live in the
5019 minibuffer@footnote{If you find this distracting, turn the display of with
5020 @code{org-read-date-display-live}.}.
5022 @node Custom time format, , The date/time prompt, Creating timestamps
5023 @subsection Custom time format
5024 @cindex custom date/time format
5025 @cindex time format, custom
5026 @cindex date format, custom
5028 @vindex org-display-custom-times
5029 @vindex org-time-stamp-custom-formats
5030 Org mode uses the standard ISO notation for dates and times as it is
5031 defined in ISO 8601. If you cannot get used to this and require another
5032 representation of date and time to keep you happy, you can get it by
5033 customizing the variables @code{org-display-custom-times} and
5034 @code{org-time-stamp-custom-formats}.
5039 Toggle the display of custom formats for dates and times.
5043 Org mode needs the default format for scanning, so the custom date/time
5044 format does not @emph{replace} the default format---instead it is put
5045 @emph{over} the default format using text properties. This has the
5046 following consequences:
5049 You cannot place the cursor onto a timestamp anymore, only before or
5052 The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
5053 each component of a timestamp. If the cursor is at the beginning of
5054 the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
5055 just like @kbd{S-@key{left}/@key{right}}. At the end of the stamp, the
5056 time will be changed by one minute.
5058 If the timestamp contains a range of clock times or a repeater, these
5059 will not be overlayed, but remain in the buffer as they were.
5061 When you delete a timestamp character-by-character, it will only
5062 disappear from the buffer after @emph{all} (invisible) characters
5063 belonging to the ISO timestamp have been removed.
5065 If the custom timestamp format is longer than the default and you are
5066 using dates in tables, table alignment will be messed up. If the custom
5067 format is shorter, things do work as expected.
5071 @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
5072 @section Deadlines and scheduling
5074 A timestamp may be preceded by special keywords to facilitate planning:
5078 @cindex DEADLINE keyword
5080 Meaning: the task (most likely a TODO item, though not necessarily) is supposed
5081 to be finished on that date.
5083 @vindex org-deadline-warning-days
5084 On the deadline date, the task will be listed in the agenda. In
5085 addition, the agenda for @emph{today} will carry a warning about the
5086 approaching or missed deadline, starting
5087 @code{org-deadline-warning-days} before the due date, and continuing
5088 until the entry is marked DONE. An example:
5091 *** TODO write article about the Earth for the Guide
5092 The editor in charge is [[bbdb:Ford Prefect]]
5093 DEADLINE: <2004-02-29 Sun>
5096 You can specify a different lead time for warnings for a specific
5097 deadlines using the following syntax. Here is an example with a warning
5098 period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
5101 @cindex SCHEDULED keyword
5103 Meaning: you are planning to start working on that task on the given
5106 @vindex org-agenda-skip-scheduled-if-done
5107 The headline will be listed under the given date@footnote{It will still
5108 be listed on that date after it has been marked DONE. If you don't like
5109 this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In
5110 addition, a reminder that the scheduled date has passed will be present
5111 in the compilation for @emph{today}, until the entry is marked DONE.
5112 @Ie the task will automatically be forwarded until completed.
5115 *** TODO Call Trillian for a date on New Years Eve.
5116 SCHEDULED: <2004-12-25 Sat>
5120 @b{Important:} Scheduling an item in Org mode should @i{not} be
5121 understood in the same way that we understand @i{scheduling a meeting}.
5122 Setting a date for a meeting is just a simple appointment, you should
5123 mark this entry with a simple plain timestamp, to get this item shown
5124 on the date where it applies. This is a frequent misunderstanding by
5125 Org users. In Org mode, @i{scheduling} means setting a date when you
5126 want to start working on an action item.
5129 You may use timestamps with repeaters in scheduling and deadline
5130 entries. Org mode will issue early and late warnings based on the
5131 assumption that the timestamp represents the @i{nearest instance} of
5132 the repeater. However, the use of diary sexp entries like
5134 @code{<%%(diary-float t 42)>}
5136 in scheduling and deadline timestamps is limited. Org mode does not
5137 know enough about the internals of each sexp function to issue early and
5138 late warnings. However, it will show the item on each day where the
5142 * Inserting deadline/schedule:: Planning items
5143 * Repeated tasks:: Items that show up again and again
5146 @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
5147 @subsection Inserting deadlines or schedules
5149 The following commands allow you to quickly insert a deadline or to schedule
5156 Insert @samp{DEADLINE} keyword along with a stamp. The insertion will
5157 happen in the line directly following the headline. When called with a
5158 prefix arg, an existing deadline will be removed from the entry.
5159 @c FIXME Any CLOSED timestamp will be removed.????????
5163 Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will
5164 happen in the line directly following the headline. Any CLOSED
5165 timestamp will be removed. When called with a prefix argument, remove
5166 the scheduling date from the entry.
5172 Mark the current entry for agenda action. After you have marked the entry
5173 like this, you can open the agenda or the calendar to find an appropriate
5174 date. With the cursor on the selected date, press @kbd{k s} or @kbd{k d} to
5175 schedule the marked item.
5178 @cindex sparse tree, for deadlines
5180 @vindex org-deadline-warning-days
5181 Create a sparse tree with all deadlines that are either past-due, or
5182 which will become due within @code{org-deadline-warning-days}.
5183 With @kbd{C-u} prefix, show all deadlines in the file. With a numeric
5184 prefix, check that many days. For example, @kbd{C-1 C-c / d} shows
5185 all deadlines due tomorrow.
5189 Sparse tree for deadlines and scheduled items before a given date.
5193 Sparse tree for deadlines and scheduled items after a given date.
5196 @node Repeated tasks, , Inserting deadline/schedule, Deadlines and scheduling
5197 @subsection Repeated tasks
5198 @cindex tasks, repeated
5199 @cindex repeated tasks
5201 Some tasks need to be repeated again and again. Org mode helps to
5202 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
5203 or plain timestamp. In the following example
5205 ** TODO Pay the rent
5206 DEADLINE: <2005-10-01 Sat +1m>
5209 the @code{+1m} is a repeater; the intended interpretation is that the task
5210 has a deadline on <2005-10-01> and repeats itself every (one) month starting
5211 from that time. If you need both a repeater and a special warning period in
5212 a deadline entry, the repeater should come first and the warning period last:
5213 @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
5215 Deadlines and scheduled items produce entries in the agenda when they
5216 are over-due, so it is important to be able to mark such an entry as
5217 completed once you have done so. When you mark a DEADLINE or a SCHEDULE
5218 with the TODO keyword DONE, it will no longer produce entries in the
5219 agenda. The problem with this is, however, that then also the
5220 @emph{next} instance of the repeated entry will not be active. Org mode
5221 deals with this in the following way: When you try to mark such an entry
5222 DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
5223 timestamp by the repeater interval, and immediately set the entry state
5224 back to TODO. In the example above, setting the state to DONE would
5225 actually switch the date like this:
5228 ** TODO Pay the rent
5229 DEADLINE: <2005-11-01 Tue +1m>
5232 @vindex org-log-repeat
5233 A timestamp@footnote{You can change this using the option
5234 @code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
5235 @code{lognoterepeat}, and @code{nologrepeat}. With @code{lognoterepeat}, you
5236 will also be prompted for a note.} will be added under the deadline, to keep
5237 a record that you actually acted on the previous instance of this deadline.
5239 As a consequence of shifting the base date, this entry will no longer be
5240 visible in the agenda when checking past dates, but all future instances
5243 With the @samp{+1m} cookie, the date shift will always be exactly one
5244 month. So if you have not paid the rent for three months, marking this
5245 entry DONE will still keep it as an overdue deadline. Depending on the
5246 task, this may not be the best way to handle it. For example, if you
5247 forgot to call you father for 3 weeks, it does not make sense to call
5248 him 3 times in a single day to make up for it. Finally, there are tasks
5249 like changing batteries which should always repeat a certain time
5250 @i{after} the last time you did it. For these tasks, Org mode has
5251 special repeaters markers with @samp{++} and @samp{.+}. For example:
5255 DEADLINE: <2008-02-10 Sun ++1w>
5256 Marking this DONE will shift the date by at least one week,
5257 but also by as many weeks as it takes to get this date into
5258 the future. However, it stays on a Sunday, even if you called
5259 and marked it done on Saturday.
5260 ** TODO Check the batteries in the smoke detectors
5261 DEADLINE: <2005-11-01 Tue .+1m>
5262 Marking this DONE will shift the date to one month after
5266 You may have both scheduling and deadline information for a specific
5267 task---just make sure that the repeater intervals on both are the same.
5269 An alternative to using a repeater is to create a number of copies of a task
5270 subtree, with dates shifted in each copy. The command @kbd{C-c C-x c} was
5271 created for this purpose, it is described in @ref{Structure editing}.
5274 @node Clocking work time, Effort estimates, Deadlines and scheduling, Dates and Times
5275 @section Clocking work time
5277 Org mode allows you to clock the time you spend on specific tasks in a
5278 project. When you start working on an item, you can start the clock.
5279 When you stop working on that task, or when you mark the task done, the
5280 clock is stopped and the corresponding time interval is recorded. It
5281 also computes the total time spent on each subtree of a project.
5283 Normally, the clock does not survive exiting and re-entereing Emacs, but you
5284 can arrange for the clock information to persist across Emacs sessions with
5287 (setq org-clock-persist t)
5288 (org-clock-persistence-insinuate)
5294 @vindex org-clock-into-drawer
5295 Start the clock on the current item (clock-in). This inserts the CLOCK
5296 keyword together with a timestamp. If this is not the first clocking of
5297 this item, the multiple CLOCK lines will be wrapped into a
5298 @code{:LOGBOOK:} drawer (see also the variable
5299 @code{org-clock-into-drawer}). When called with a @kbd{C-u} prefix argument,
5300 select the task from a list of recently clocked tasks. With two @kbd{C-u
5301 C-u} prefixes, clock into the task at point and mark it as the default task.
5302 The default task will always be available when selecting a clocking task,
5303 with letter @kbd{d}.@*
5304 @cindex property: CLOCK_MODELINE_TOTAL
5305 @cindex property: LAST_REPEAT
5306 @vindex org-clock-modeline-total
5307 While the clock is running, the current clocking time is shown in the mode
5308 line, along with the title of the task. The clock time shown will be all
5309 time ever clocked for this task and its children. If the task is a repeating
5310 one (@pxref{Repeated tasks}), only the time since the last reset of the task
5311 @footnote{as recorded by the @code{LAST_REPEAT} property} will be shown.
5312 More control over what time is shown can be exercised with the
5313 @code{CLOCK_MODELINE_TOTAL} property. It may have the values @code{current}
5314 to show only the current clocking instance, @code{today} to show all time
5315 clocked on this tasks today (see also the variable
5316 @code{org-extend-today-until}), @code{all} to include all time, or
5317 @code{auto} which is the default@footnote{See also the variable
5318 @code{org-clock-modeline-total}.}.@*
5319 Clicking with @kbd{mouse-1} onto the mode line entry will pop up a menu with
5323 @vindex org-log-note-clock-out
5324 Stop the clock (clock-out). This inserts another timestamp at the same
5325 location where the clock was last started. It also directly computes
5326 the resulting time in inserts it after the time range as @samp{=>
5327 HH:MM}. See the variable @code{org-log-note-clock-out} for the
5328 possibility to record an additional note together with the clock-out
5329 timestamp@footnote{The corresponding in-buffer setting is:
5330 @code{#+STARTUP: lognoteclock-out}}.
5333 Update the effort estimate for the current clock task.
5336 @item C-c C-y @ @ @r{or}@ @ C-c C-c
5337 Recompute the time interval after changing one of the timestamps. This
5338 is only necessary if you edit the timestamps directly. If you change
5339 them with @kbd{S-@key{cursor}} keys, the update is automatic.
5342 Changing the TODO state of an item to DONE automatically stops the clock
5343 if it is running in this same item.
5346 Cancel the current clock. This is useful if a clock was started by
5347 mistake, or if you ended up working on something else.
5350 Jump to the entry that contains the currently running clock. With a
5351 @kbd{C-u} prefix arg, select the target task from a list of recently clocked
5355 @vindex org-remove-highlights-with-change
5356 Display time summaries for each subtree in the current buffer. This
5357 puts overlays at the end of each headline, showing the total time
5358 recorded under that heading, including the time of any subheadings. You
5359 can use visibility cycling to study the tree, but the overlays disappear
5360 when you change the buffer (see variable
5361 @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
5364 Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
5365 report as an Org-mode table into the current file. When the cursor is
5366 at an existing clock table, just update it. When called with a prefix
5367 argument, jump to the first clock report in the current document and
5369 @cindex #+BEGIN, clocktable
5371 #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
5375 If such a block already exists at point, its content is replaced by the
5376 new table. The @samp{BEGIN} line can specify options:
5378 :maxlevel @r{Maximum level depth to which times are listed in the table.}
5379 :emphasize @r{When @code{t}, emphasize level one and level two items.}
5380 :scope @r{The scope to consider. This can be any of the following:}
5381 nil @r{the current buffer or narrowed region}
5382 file @r{the full current buffer}
5383 subtree @r{the subtree where the clocktable is located}
5384 tree@var{N} @r{the surrounding level @var{N} tree, for example @code{tree3}}
5385 tree @r{the surrounding level 1 tree}
5386 agenda @r{all agenda files}
5387 ("file"..) @r{scan these files}
5388 file-with-archives @r{current file and its archives}
5389 agenda-with-archives @r{all agenda files, including archives}
5390 :block @r{The time block to consider. This block is specified either}
5391 @r{absolute, or relative to the current time and may be any of}
5393 2007-12-31 @r{New year eve 2007}
5394 2007-12 @r{December 2007}
5395 2007-W50 @r{ISO-week 50 in 2007}
5396 2007 @r{the year 2007}
5397 today, yesterday, today-@var{N} @r{a relative day}
5398 thisweek, lastweek, thisweek-@var{N} @r{a relative week}
5399 thismonth, lastmonth, thismonth-@var{N} @r{a relative month}
5400 thisyear, lastyear, thisyear-@var{N} @r{a relative year}
5401 @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
5402 :tstart @r{A time string specifying when to start considering times.}
5403 :tend @r{A time string specifying when to stop considering times.}
5404 :step @r{@code{week} or @code{day}, to split the table into chunks.}
5405 @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
5406 :link @r{Link the item headlines in the table to their origins.}
5407 :formula @r{Content of a @code{#+TBLFM} line to be added and evaluated.}
5408 @r{As a special case, @samp{:formula %} adds a column with % time.}
5409 @r{If you do not specify a formula here, any existing formula.}
5410 @r{below the clock table will survive updates and be evaluated.}
5412 To get a clock summary of the current level 1 tree, for the current
5413 day, you could write
5415 #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
5419 and to use a specific time range you could write@footnote{Note that all
5420 parameters must be specified in a single line---the line is broken here
5421 only to fit it into the manual.}
5423 #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
5424 :tend "<2006-08-10 Thu 12:00>"
5427 A summary of the current subtree with % times would be
5429 #+BEGIN: clocktable :scope subtree :link t :formula %
5436 Update dynamic block at point. The cursor needs to be in the
5437 @code{#+BEGIN} line of the dynamic block.
5438 @kindex C-u C-c C-x C-u
5439 @item C-u C-c C-x C-u
5440 Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
5441 you have several clock table blocks in a buffer.
5442 @kindex S-@key{left}
5443 @kindex S-@key{right}
5445 @itemx S-@key{right}
5446 Shift the current @code{:block} interval and update the table. The cursor
5447 needs to be in the @code{#+BEGIN: clocktable} line for this command. If
5448 @code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
5451 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
5452 the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
5453 worked on or closed during a day.
5455 @node Effort estimates, Relative timer, Clocking work time, Dates and Times
5456 @section Effort estimates
5457 @cindex effort estimates
5459 @cindex property, Effort
5460 @vindex org-effort-property
5461 If you want to plan your work in a very detailed way, or if you need to
5462 produce offers with quotations of the estimated work effort, you may want to
5463 assign effort estimates to entries. If you are also clocking your work, you
5464 may later want to compare the planned effort with the actual working time, a
5465 great way to improve planning estimates. Effort estimates are stored in a
5466 special property @samp{Effort}@footnote{You may change the property being
5467 used with the variable @code{org-effort-property}.}. Clearly the best way to
5468 work with effort estimates is through column view (@pxref{Column view}). You
5469 should start by setting up discrete values for effort estimates, and a
5470 @code{COLUMNS} format that displays these values together with clock sums (if
5471 you want to clock your time). For a specific buffer you can use
5474 #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00
5475 #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
5479 @vindex org-global-properties
5480 @vindex org-columns-default-format
5481 or, even better, you can set up these values globally by customizing the
5482 variables @code{org-global-properties} and @code{org-columns-default-format}.
5483 In particular if you want to use this setup also in the agenda, a global
5484 setup may be advised.
5486 The way to assign estimates to individual items is then to switch to column
5487 mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the
5488 value. The values you enter will immediately be summed up in the hierarchy.
5489 In the column next to it, any clocked time will be displayed.
5491 @vindex org-agenda-columns-add-appointments-to-effort-sum
5492 If you switch to column view in the daily/weekly agenda, the effort column
5493 will summarize the estimated work effort for each day@footnote{Please note
5494 the pitfalls of summing hierarchical data in a flat list (@pxref{Agenda
5495 column view}).}, and you can use this to find space in your schedule. To get
5496 an overview of the entire part of the day that is committed, you can set the
5497 option @code{org-agenda-columns-add-appointments-to-effort-sum}. The
5498 appointments on a day that take place over a specified time interval will
5499 then also be added to the load estimate of the day.
5501 Effort estimates can be used in secondary agenda filtering that is triggered
5502 with the @kbd{/} key in the agenda (@pxref{Agenda commands}). If you have
5503 these estimates defined consistently, two or three key presses will narrow
5504 down the list to stuff that fits into an available time slot.
5506 @node Relative timer, , Effort estimates, Dates and Times
5507 @section Taking notes with a relative timer
5508 @cindex relative timer
5510 When taking notes during, for example, a meeting or a video viewing, it can
5511 be useful to have access to times relative to a starting time. Org provides
5512 such a relative timer and make it easy to create timed notes.
5517 Insert a relative time into the buffer. The first time you use this, the
5518 timer will be started. When called with a prefix argument, the timer is
5522 Insert a description list item with the current relative time. With a prefix
5523 argument, first reset the timer to 0.
5526 Once the timer list is started, you can also use @kbd{M-@key{RET}} to insert
5530 Pause the timer, or continue it if it is already paused.
5531 @c removed the sentence because it is redundant to the following item
5532 @kindex C-u C-c C-x ,
5534 Stop the timer. After this, you can only start a new timer, not continue the
5535 old one. This command also removes the timer from the mode line.
5538 Reset the timer without inserting anything into the buffer. By default, the
5539 timer is reset to 0. When called with a @kbd{C-u} prefix, reset the timer to
5540 specific starting offset. The user is prompted for the offset, with a
5541 default taken from a timer string at point, if any, So this can be used to
5542 restart taking notes after a break in the process. When called with a double
5543 prefix argument @kbd{C-c C-u}, change all timer strings in the active region
5544 by a certain amount. This can be used to fix timer strings if the timer was
5545 not started at exactly the right moment.
5548 @node Capture, Agenda Views, Dates and Times, Top
5552 An important part of any organization system is the ability to quickly
5553 capture new ideas and tasks, and to associate reference material with them.
5554 Org uses the @file{remember.el} package to create tasks, and stores files
5555 related to a task (@i{attachments}) in a special directory.
5558 * Remember:: Capture new tasks/ideas with little interruption
5559 * Attachments:: Add files to tasks.
5560 * RSS Feeds:: Getting input from RSS feeds
5561 * Protocols:: External (@eg Browser) access to Emacs and Org
5564 @node Remember, Attachments, Capture, Capture
5566 @cindex @file{remember.el}
5568 The Remember package by John Wiegley lets you store quick notes with
5569 little interruption of your work flow. See
5570 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
5571 information. It is an excellent way to add new notes and tasks to
5572 Org files. Org significantly expands the possibilities of
5573 Remember: You may define templates for different note types, and
5574 associate target files and headlines with specific templates. It also
5575 allows you to select the location where a note should be stored
5576 interactively, on the fly.
5579 * Setting up Remember:: Some code for .emacs to get things going
5580 * Remember templates:: Define the outline of different note types
5581 * Storing notes:: Directly get the note to where it belongs
5582 * Refiling notes:: Moving a note or task to a project
5585 @node Setting up Remember, Remember templates, Remember, Remember
5586 @subsection Setting up Remember
5588 The following customization will tell Remember to use Org files as
5589 target, and to create annotations compatible with Org links.
5592 (org-remember-insinuate)
5593 (setq org-directory "~/path/to/my/orgfiles/")
5594 (setq org-default-notes-file (concat org-directory "/notes.org"))
5595 (define-key global-map "\C-cr" 'org-remember)
5599 The last line binds the command @code{org-remember} to a global
5600 key@footnote{Please select your own key, @kbd{C-c r} is only a
5601 suggestion.}. @code{org-remember} basically just calls Remember,
5602 but it makes a few things easier: If there is an active region, it will
5603 automatically copy the region into the Remember buffer. It also allows
5604 to jump to the buffer and location where Remember notes are being
5605 stored: Just call @code{org-remember} with a prefix argument. If you
5606 use two prefix arguments, Org jumps to the location where the last
5607 remember note was stored.
5609 The Remember buffer will actually use @code{org-mode} as its major mode, so
5610 that all editing features of Org mode are available. In addition to this, a
5611 minor mode @code{org-remember-mode} is turned on, for the single purpose that
5612 you can use its keymap @code{org-remember-mode-map} to overwrite some of
5613 Org mode's key bindings.
5615 You can also call @code{org-remember} in a special way from the agenda,
5616 using the @kbd{k r} key combination. With this access, any timestamps
5617 inserted by the selected Remember template (see below) will default to
5618 the cursor date in the agenda, rather than to the current date.
5620 @node Remember templates, Storing notes, Setting up Remember, Remember
5621 @subsection Remember templates
5622 @cindex templates, for Remember
5624 In combination with Org, you can use templates to generate
5625 different types of Remember notes. For example, if you would like
5626 to use one template to create general TODO entries, another one for
5627 journal entries, and a third one for collecting random ideas, you could
5631 (setq org-remember-templates
5632 '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks")
5633 ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
5634 ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
5637 @vindex org-remember-default-headline
5638 @vindex org-directory
5639 @noindent In these entries, the first string is just a name, and the
5640 character specifies how to select the template. It is useful if the
5641 character is also the first letter of the name. The next string specifies
5642 the template. Two more (optional) strings give the file in which, and the
5643 headline under which, the new note should be stored. The file (if not present
5644 or @code{nil}) defaults to @code{org-default-notes-file}, the heading to
5645 @code{org-remember-default-headline}. If the file name is not an absolute
5646 path, it will be interpreted relative to @code{org-directory}. The heading
5647 can also be the symbols @code{top} or @code{bottom} to send notes as level 1
5648 entries to the beginning or end of the file, respectively.
5650 An optional sixth element specifies the contexts in which the user can select
5651 the template. This element can be a list of major modes or a function.
5652 @code{org-remember} will first check whether the function returns @code{t} or
5653 if we are in any of the listed major modes, and exclude templates for which
5654 this condition is not fulfilled. Templates that do not specify this element
5655 at all, or that use @code{nil} or @code{t} as a value will always be
5661 (setq org-remember-templates
5662 '(("Bug" ?b "* BUG %?\n %i\n %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
5663 ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" "X" my-check)
5664 ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
5668 The first template will only be available when invoking @code{org-remember}
5669 from an buffer in @code{emacs-lisp-mode}. The second template will only be
5670 available when the function @code{my-check} returns @code{t}. The third
5671 template will be proposed in any context.
5673 When you call @kbd{M-x org-remember} (or @kbd{M-x remember}) to remember
5674 something, Org will prompt for a key to select the template (if you have
5675 more than one template) and then prepare the buffer like
5678 [[file:@var{link to where you called remember}]]
5682 During expansion of the template, special @kbd{%}-escapes allow dynamic
5683 insertion of content:
5685 %^@{@var{prompt}@} @r{prompt the user for a string and replace this sequence with it.}
5686 @r{You may specify a default value and a completion table with}
5687 @r{%^@{prompt|default|completion2|completion3...@}}
5688 @r{The arrow keys access a prompt-specific history.}
5689 %a @r{annotation, normally the link created with @code{org-store-link}}
5690 %A @r{like @code{%a}, but prompt for the description part}
5691 %i @r{initial content, the region when remember is called with C-u.}
5692 @r{The entire text will be indented like @code{%i} itself.}
5693 %t @r{timestamp, date only}
5694 %T @r{timestamp with date and time}
5695 %u, %U @r{like the above, but inactive timestamps}
5696 %^t @r{like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}}
5697 @r{You may define a prompt like @code{%^@{Birthday@}t}}
5698 %n @r{user name (taken from @code{user-full-name})}
5699 %c @r{Current kill ring head.}
5700 %x @r{Content of the X clipboard.}
5701 %^C @r{Interactive selection of which kill or clip to use.}
5702 %^L @r{Like @code{%^C}, but insert as link.}
5703 %^g @r{prompt for tags, with completion on tags in target file.}
5704 %k @r{title of currently clocked task}
5705 %K @r{link to currently clocked task}
5706 %^G @r{prompt for tags, with completion all tags in all agenda files.}
5707 %^@{@var{prop}@}p @r{Prompt the user for a value for property @var{prop}}
5708 %:keyword @r{specific information for certain link types, see below}
5709 %[@var{file}] @r{insert the contents of the file given by @var{file}}
5710 %(@var{sexp}) @r{evaluate Elisp @var{sexp} and replace with the result}
5711 %! @r{immediately store note after completing the template}
5712 @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
5713 %& @r{jump to target location immediately after storing note}
5717 For specific link types, the following keywords will be
5718 defined@footnote{If you define your own link types (@pxref{Adding
5719 hyperlink types}), any property you store with
5720 @code{org-store-link-props} can be accessed in remember templates in a
5723 @vindex org-from-is-user-regexp
5725 Link type | Available keywords
5726 -------------------+----------------------------------------------
5727 bbdb | %:name %:company
5728 bbdb | %::server %:port %:nick
5729 vm, wl, mh, rmail | %:type %:subject %:message-id
5730 | %:from %:fromname %:fromaddress
5731 | %:to %:toname %:toaddress
5732 | %:fromto @r{(either "to NAME" or "from NAME")@footnote{This will always be the other, not the user. See the variable @code{org-from-is-user-regexp}.}}
5733 gnus | %:group, @r{for messages also all email fields}
5735 info | %:file %:node
5740 To place the cursor after template expansion use:
5743 %? @r{After completing the template, position cursor here.}
5747 If you change your mind about which template to use, call
5748 @code{org-remember} in the remember buffer. You may then select a new
5749 template that will be filled with the previous context information.
5751 @node Storing notes, Refiling notes, Remember templates, Remember
5752 @subsection Storing notes
5754 @vindex org-remember-clock-out-on-exit
5755 When you are finished preparing a note with Remember, you have to press
5756 @kbd{C-c C-c} to file the note away. If you have started the clock in the
5757 Remember buffer, you will first be asked if you want to clock out
5758 now@footnote{To avoid this query, configure the variable
5759 @code{org-remember-clock-out-on-exit}.}. If you answer @kbd{n}, the clock
5760 will continue to run after the note was filed away.
5762 The handler will then store the note in the file and under the headline
5763 specified in the template, or it will use the default file and headline.
5764 The window configuration will be restored, sending you back to the working
5765 context before the call to Remember. To re-use the location found
5766 during the last call to Remember, exit the Remember buffer with
5767 @kbd{C-0 C-c C-c}, @ie specify a zero prefix argument to @kbd{C-c C-c}.
5768 Another special case is @kbd{C-2 C-c C-c} which files the note as a child of
5769 the currently clocked item.
5771 @vindex org-remember-store-without-prompt
5772 If you want to store the note directly to a different place, use
5773 @kbd{C-1 C-c C-c} instead to exit Remember@footnote{Configure the
5774 variable @code{org-remember-store-without-prompt} to make this behavior
5775 the default.}. The handler will then first prompt for a target file---if
5776 you press @key{RET}, the value specified for the template is used.
5777 Then the command offers the headings tree of the selected file, with the
5778 cursor position at the default headline (if you specified one in the
5779 template). You can either immediately press @key{RET} to get the note
5780 placed there. Or you can use the following keys to find a different
5783 @key{TAB} @r{Cycle visibility.}
5784 @key{down} / @key{up} @r{Next/previous visible headline.}
5785 n / p @r{Next/previous visible headline.}
5786 f / b @r{Next/previous headline same level.}
5788 @c 0-9 @r{Digit argument.}
5791 Pressing @key{RET} or @key{left} or @key{right}
5792 then leads to the following result.
5794 @vindex org-reverse-note-order
5795 @multitable @columnfractions 0.2 0.15 0.65
5796 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
5797 @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor, first or last
5798 @item @tab @tab depending on @code{org-reverse-note-order}.
5799 @item @tab @key{left}/@key{right} @tab as same level, before/after current heading
5800 @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
5801 @item @tab @tab depending on @code{org-reverse-note-order}.
5802 @item not on headline @tab @key{RET}
5803 @tab at cursor position, level taken from context.
5806 Before inserting the text into a tree, the function ensures that the text has
5807 a headline, @ie a first line that starts with a @samp{*}. If not, a
5808 headline is constructed from the current date. If you have indented the text
5809 of the note below the headline, the indentation will be adapted if inserting
5810 the note into the tree requires demotion from level 1.
5812 @node Refiling notes, , Storing notes, Remember
5813 @subsection Refiling notes
5814 @cindex refiling notes
5816 Remember is usually used to quickly capture notes and tasks into one or
5817 a few capture lists. When reviewing the captured data, you may want to
5818 refile some of the entries into a different list, for example into a
5819 project. Cutting, finding the right location, and then pasting the note
5820 is cumbersome. To simplify this process, you can use the following
5826 @vindex org-reverse-note-order
5827 @vindex org-refile-targets
5828 @vindex org-refile-use-outline-path
5829 @vindex org-outline-path-complete-in-steps
5830 @vindex org-refile-allow-creating-parent-nodes
5831 Refile the entry or region at point. This command offers possible locations
5832 for refiling the entry and lets you select one with completion. The item (or
5833 all items in the region) is filed below the target heading as a subitem.
5834 Depending on @code{org-reverse-note-order}, it will be either the first or
5836 By default, all level 1 headlines in the current buffer are considered to be
5837 targets, but you can have more complex definitions across a number of files.
5838 See the variable @code{org-refile-targets} for details. If you would like to
5839 select a location via a file-path-like completion along the outline path, see
5840 the variables @code{org-refile-use-outline-path} and
5841 @code{org-outline-path-complete-in-steps}. If you would like to be able to
5842 create new nodes as new parents for for refiling on the fly, check the
5843 variable @code{org-refile-allow-creating-parent-nodes}.
5846 Use the refile interface to jump to a heading.
5847 @kindex C-u C-u C-c C-w
5848 @item C-u C-u C-c C-w
5849 Jump to the location where @code{org-refile} last moved a tree to.
5853 @node Attachments, RSS Feeds, Remember, Capture
5854 @section Attachments
5857 @vindex org-attach-directory
5858 It is often useful to associate reference material with an outline node/task.
5859 Small chunks of plain text can simply be stored in the subtree of a project.
5860 Hyperlinks (@pxref{Hyperlinks}) can be used to establish associations with
5861 files that live elsewhere on your computer or in the cloud, like emails or
5862 source code files belonging to a project. Another method is @i{attachments},
5863 which are files located in a directory belonging to an outline node. Org
5864 uses directories named by the unique ID of each entry. These directories are
5865 located in the @file{data} directory which lives in the same directory where
5866 your Org file lives@footnote{If you move entries or Org files from one
5867 directory to another, you may want to configure @code{org-attach-directory}
5868 to contain an absolute path.}. If you initialize this directory with
5869 @code{git init}, Org will automatically commit changes when it sees them.
5870 The attachment system has been contributed to Org by John Wiegley.
5872 In cases where it seems better to do so, you can also attach a directory of your
5873 choice to an entry. You can also make children inherit the attachment
5874 directory from a parent, so that an entire subtree uses the same attached
5877 @noindent The following commands deal with attachments.
5883 The dispatcher for commands related to the attachment system. After these
5884 keys, a list of commands is displayed and you need to press an additional key
5885 to select a command:
5890 @vindex org-attach-method
5891 Select a file and move it into the task's attachment directory. The file
5892 will be copied, moved, or linked, depending on @code{org-attach-method}.
5893 Note that hard links are not supported on all systems.
5899 Attach a file using the copy/move/link method.
5900 Note that hard links are not supported on all systems.
5904 Create a new attachment as an Emacs buffer.
5908 Synchronize the current task with its attachment directory, in case you added
5909 attachments yourself.
5913 @vindex org-file-apps
5914 Open current task's attachment. If there are more than one, prompt for a
5915 file name first. Opening will follow the rules set by @code{org-file-apps}.
5916 For more details, see the information on following hyperlinks
5917 (@pxref{Handling links}).
5921 Also open the attachment, but force opening the file in Emacs.
5925 Open the current task's attachment directory.
5929 Also open the directory, but force using @command{dired} in Emacs.
5933 Select and delete a single attachment.
5937 Delete all of a task's attachments. A safer way is to open the directory in
5938 @command{dired} and delete from there.
5942 @cindex property, ATTACH_DIR
5943 Set a specific directory as the entry's attachment directory. This works by
5944 putting the directory path into the @code{ATTACH_DIR} property.
5948 @cindex property, ATTACH_DIR_INHERIT
5949 Set the @code{ATTACH_DIR_INHERIT} property, so that children will use the
5950 same directory for attachments as the parent does.
5954 @node RSS Feeds, Protocols, Attachments, Capture
5958 Org has the capablity to add and change entries based on information found in
5959 RSS feeds. You could use this to make a task out of each new podcast in a
5960 podcast feed. Or you could use a phone-based note-creating service on the
5961 web to import tasks into Org. To access feeds, you need to configure the
5962 variable @code{org-feed-alist}. The docstring of this variable has detailed
5963 information. Here is just an example:
5966 (setq org-feed-alist
5967 '(("ReQall" "http://www.reqall.com/user/feeds/rss/a1b2c3....."
5968 "~/org/feeds.org" "ReQall Entries")
5971 will configure that new items from the feed provided by @file{reqall.com}
5972 will result in new entries in the file @file{~/org/feeds.org} under the
5973 heading @samp{ReQall Entries}, whenever the following command is used:
5978 Collect items from the feeds configured in @code{org-feed-alist} and act upon
5982 Prompt for a feed name and go to the inbox configured for this feed.
5985 Under the same headline, Org will create a drawer @samp{FEEDSTATUS} in which
5986 it will store information about the status of items in the feed, to avoid
5987 adding the same item several times. You should add @samp{FEEDSTATUS} to the
5988 list of drawers in that file:
5991 #+DRAWERS: LOGBOOK PROPERTIES FEEDSTATUS
5994 For more information, see @file{org-feed.el} and the docstring of
5995 @code{org-feed-alist}.
5997 @node Protocols, , RSS Feeds, Capture
5998 @section Protocols for external access
5999 @cindex protocols, for external access
6002 You can set up Org for handling protocol calls from outside applications that
6003 are passed to Emacs through the @file{emacsserver}. For example, you can
6004 configure bookmarks in your web browser to send a link to the current page to
6005 Org and create a note from it using Remember (@pxref{Remember}). Or you
6006 could create a bookmark that will tell Emacs to open the local source file of
6007 a remote website you are looking at with the browser. See
6008 @uref{http://orgmode.org/worg/org-contrib/org-protocol.php} for detailed
6009 documentation and setup instructions.
6012 @node Agenda Views, Embedded LaTeX, Capture, Top
6013 @chapter Agenda Views
6014 @cindex agenda views
6016 Due to the way Org works, TODO items, time-stamped items, and
6017 tagged headlines can be scattered throughout a file or even a number of
6018 files. To get an overview of open action items, or of events that are
6019 important for a particular date, this information must be collected,
6020 sorted and displayed in an organized way.
6022 Org can select items based on various criteria and display them
6023 in a separate buffer. Seven different view types are provided:
6027 an @emph{agenda} that is like a calendar and shows information
6030 a @emph{TODO list} that covers all unfinished
6033 a @emph{match view}, showings headlines based on the tags, properties, and
6034 TODO state associated with them,
6036 a @emph{timeline view} that shows all events in a single Org file,
6037 in time-sorted view,
6039 a @emph{keyword search view} that shows all entries from multiple files
6040 that contain specified keywords,
6042 a @emph{stuck projects view} showing projects that currently don't move
6045 @emph{custom views} that are special tag/keyword searches and
6046 combinations of different views.
6050 The extracted information is displayed in a special @emph{agenda
6051 buffer}. This buffer is read-only, but provides commands to visit the
6052 corresponding locations in the original Org files, and even to
6053 edit these files remotely.
6055 @vindex org-agenda-window-setup
6056 @vindex org-agenda-restore-windows-after-quit
6057 Two variables control how the agenda buffer is displayed and whether the
6058 window configuration is restored when the agenda exits:
6059 @code{org-agenda-window-setup} and
6060 @code{org-agenda-restore-windows-after-quit}.
6063 * Agenda files:: Files being searched for agenda information
6064 * Agenda dispatcher:: Keyboard access to agenda views
6065 * Built-in agenda views:: What is available out of the box?
6066 * Presentation and sorting:: How agenda items are prepared for display
6067 * Agenda commands:: Remote editing of Org trees
6068 * Custom agenda views:: Defining special searches and views
6069 * Exporting Agenda Views::
6070 * Agenda column view:: Using column view for collected entries
6073 @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
6074 @section Agenda files
6075 @cindex agenda files
6076 @cindex files for agenda
6078 @vindex org-agenda-files
6079 The information to be shown is normally collected from all @emph{agenda
6080 files}, the files listed in the variable
6081 @code{org-agenda-files}@footnote{If the value of that variable is not a
6082 list, but a single file name, then the list of agenda files will be
6083 maintained in that external file.}. If a directory is part of this list,
6084 all files with the extension @file{.org} in this directory will be part
6087 Thus, even if you only work with a single Org file, that file should
6088 be put into the list@footnote{When using the dispatcher, pressing
6089 @kbd{<} before selecting a command will actually limit the command to
6090 the current file, and ignore @code{org-agenda-files} until the next
6091 dispatcher command.}. You can customize @code{org-agenda-files}, but
6092 the easiest way to maintain it is through the following commands
6094 @cindex files, adding to agenda list
6098 Add current file to the list of agenda files. The file is added to
6099 the front of the list. If it was already in the list, it is moved to
6100 the front. With a prefix argument, file is added/moved to the end.
6103 Remove current file from the list of agenda files.
6108 Cycle through agenda file list, visiting one file after the other.
6109 @kindex M-x org-iswitchb
6110 @item M-x org-iswitchb
6111 Command to use an @code{iswitchb}-like interface to switch to and between Org
6116 The Org menu contains the current list of files and can be used
6117 to visit any of them.
6119 If you would like to focus the agenda temporarily on a file not in
6120 this list, or on just one file in the list, or even on only a subtree in a
6121 file, then this can be done in different ways. For a single agenda command,
6122 you may press @kbd{<} once or several times in the dispatcher
6123 (@pxref{Agenda dispatcher}). To restrict the agenda scope for an
6124 extended period, use the following commands:
6129 Permanently restrict the agenda to the current subtree. When with a
6130 prefix argument, or with the cursor before the first headline in a file,
6131 the agenda scope is set to the entire file. This restriction remains in
6132 effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
6133 or @kbd{>} in the agenda dispatcher. If there is a window displaying an
6134 agenda view, the new restriction takes effect immediately.
6137 Remove the permanent restriction created by @kbd{C-c C-x <}.
6141 When working with @file{speedbar.el}, you can use the following commands in
6145 @item < @r{in the speedbar frame}
6146 Permanently restrict the agenda to the item---either an Org file or a subtree
6147 in such a file---at the cursor in the Speedbar frame.
6148 If there is a window displaying an agenda view, the new restriction takes
6151 @item > @r{in the speedbar frame}
6152 Lift the restriction.
6155 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
6156 @section The agenda dispatcher
6157 @cindex agenda dispatcher
6158 @cindex dispatching agenda commands
6159 The views are created through a dispatcher, which should be bound to a
6160 global key---for example @kbd{C-c a} (@pxref{Installation}). In the
6161 following we will assume that @kbd{C-c a} is indeed how the dispatcher
6162 is accessed and list keyboard access to commands accordingly. After
6163 pressing @kbd{C-c a}, an additional letter is required to execute a
6164 command. The dispatcher offers the following default commands:
6167 Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
6169 Create a list of all TODO items (@pxref{Global TODO list}).
6171 Create a list of headlines matching a TAGS expression (@pxref{Matching
6172 tags and properties}).
6174 Create the timeline view for the current buffer (@pxref{Timeline}).
6176 Create a list of entries selected by a boolean expression of keywords
6177 and/or regular expressions that must or must not occur in the entry.
6179 @vindex org-agenda-text-search-extra-files
6180 Search for a regular expression in all agenda files and additionally in
6181 the files listed in @code{org-agenda-text-search-extra-files}. This
6182 uses the Emacs command @code{multi-occur}. A prefix argument can be
6183 used to specify the number of context lines for each match, default is
6186 Create a list of stuck projects (@pxref{Stuck projects}).
6188 Restrict an agenda command to the current buffer@footnote{For backward
6189 compatibility, you can also press @kbd{1} to restrict to the current
6190 buffer.}. After pressing @kbd{<}, you still need to press the character
6191 selecting the command.
6193 If there is an active region, restrict the following agenda command to
6194 the region. Otherwise, restrict it to the current subtree@footnote{For
6195 backward compatibility, you can also press @kbd{0} to restrict to the
6196 current region/subtree.}. After pressing @kbd{< <}, you still need to press the
6197 character selecting the command.
6200 You can also define custom commands that will be accessible through the
6201 dispatcher, just like the default commands. This includes the
6202 possibility to create extended agenda buffers that contain several
6203 blocks together, for example the weekly agenda, the global TODO list and
6204 a number of special tags matches. @xref{Custom agenda views}.
6206 @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
6207 @section The built-in agenda views
6209 In this section we describe the built-in views.
6212 * Weekly/daily agenda:: The calendar page with current tasks
6213 * Global TODO list:: All unfinished action items
6214 * Matching tags and properties:: Structured information with fine-tuned search
6215 * Timeline:: Time-sorted view for single file
6216 * Keyword search:: Finding entries by keyword
6217 * Stuck projects:: Find projects you need to review
6220 @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
6221 @subsection The weekly/daily agenda
6223 @cindex weekly agenda
6224 @cindex daily agenda
6226 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
6227 paper agenda, showing all the tasks for the current week or day.
6230 @cindex org-agenda, command
6233 @vindex org-agenda-ndays
6234 Compile an agenda for the current week from a list of Org files. The agenda
6235 shows the entries for each day. With a numeric prefix@footnote{For backward
6236 compatibility, the universal prefix @kbd{C-u} causes all TODO entries to be
6237 listed before the agenda. This feature is deprecated, use the dedicated TODO
6238 list, or a block agenda instead (@pxref{Block agenda}).} (like @kbd{C-u 2 1
6239 C-c a a}) you may set the number of days to be displayed (see also the
6240 variable @code{org-agenda-ndays})
6243 Remote editing from the agenda buffer means, for example, that you can
6244 change the dates of deadlines and appointments from the agenda buffer.
6245 The commands available in the Agenda buffer are listed in @ref{Agenda
6248 @subsubheading Calendar/Diary integration
6249 @cindex calendar integration
6250 @cindex diary integration
6252 Emacs contains the calendar and diary by Edward M. Reingold. The
6253 calendar displays a three-month calendar with holidays from different
6254 countries and cultures. The diary allows you to keep track of
6255 anniversaries, lunar phases, sunrise/set, recurrent appointments
6256 (weekly, monthly) and more. In this way, it is quite complementary to
6257 Org. It can be very useful to combine output from Org with
6260 In order to include entries from the Emacs diary into Org mode's
6261 agenda, you only need to customize the variable
6264 (setq org-agenda-include-diary t)
6267 @noindent After that, everything will happen automatically. All diary
6268 entries including holidays, anniversaries, etc., will be included in the
6269 agenda buffer created by Org mode. @key{SPC}, @key{TAB}, and
6270 @key{RET} can be used from the agenda buffer to jump to the diary
6271 file in order to edit existing diary entries. The @kbd{i} command to
6272 insert new entries for the current date works in the agenda buffer, as
6273 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
6274 Sunrise/Sunset times, show lunar phases and to convert to other
6275 calendars, respectively. @kbd{c} can be used to switch back and forth
6276 between calendar and agenda.
6278 If you are using the diary only for sexp entries and holidays, it is
6279 faster to not use the above setting, but instead to copy or even move
6280 the entries into an Org file. Org mode evaluates diary-style sexp
6281 entries, and does it faster because there is no overhead for first
6282 creating the diary display. Note that the sexp entries must start at
6283 the left margin, no whitespace is allowed before them. For example,
6284 the following segment of an Org file will be processed and entries
6285 will be made in the agenda:
6288 * Birthdays and similar stuff
6290 %%(org-calendar-holiday) ; special function for holiday names
6292 %%(diary-anniversary 14 5 1956) Arthur Dent is %d years old
6293 %%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old
6296 @subsubheading Anniversaries from BBDB
6297 @cindex BBDB, anniversaries
6298 @cindex anniversaries, from BBDB
6300 If you are using the Big Brothers Database to store your contacts, you will
6301 very likely prefer to store anniversaries in BBDB rather than in a
6302 separate Org or diary file. Org supports this and will show BBDB
6303 anniversaries as part of the agenda. All you need to do is to add the
6304 following to one your your agenda files:
6311 %%(org-bbdb-anniversaries)
6314 You can then go ahead and define anniversaries for a BBDB record. Basically,
6315 you need to press @kbd{C-o anniversary @key{RET}} with the cursor in a BBDB
6316 record and then add the date in the format @code{YYYY-MM-DD}, followed by a
6317 space and the class of the anniversary (@samp{birthday} or @samp{wedding}, or
6318 a format string). If you omit the class, it will default to @samp{birthday}.
6319 Here are a few examples, the header for the file @file{org-bbdb.el} contains
6320 more detailed information.
6325 2008-04-14 %s released version 6.01 of org-mode, %d years ago
6328 After a change to BBDB, or for the first agenda display during an Emacs
6329 session, the agenda display will suffer a short delay as Org updates its
6330 hash with anniversaries. However, from then on things will be very fast---much
6331 faster in fact than a long list of @samp{%%(diary-anniversary)} entries
6332 in an Org or Diary file.
6334 @subsubheading Appointment reminders
6335 @cindex @file{appt.el}
6336 @cindex appointment reminders
6338 Org can interact with Emacs appointments notification facility. To add all
6339 the appointments of your agenda files, use the command
6340 @code{org-agenda-to-appt}. This command also lets you filter through the
6341 list of your appointments and add only those belonging to a specific category
6342 or matching a regular expression. See the docstring for details.
6344 @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
6345 @subsection The global TODO list
6346 @cindex global TODO list
6347 @cindex TODO list, global
6349 The global TODO list contains all unfinished TODO items formatted and
6350 collected into a single place.
6355 Show the global TODO list. This collects the TODO items from all
6356 agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in
6357 @code{agenda-mode}, so there are commands to examine and manipulate
6358 the TODO entries directly from that buffer (@pxref{Agenda commands}).
6361 @cindex TODO keyword matching
6362 @vindex org-todo-keywords
6363 Like the above, but allows selection of a specific TODO keyword. You
6364 can also do this by specifying a prefix argument to @kbd{C-c a t}. With
6365 a @kbd{C-u} prefix you are prompted for a keyword, and you may also
6366 specify several keywords by separating them with @samp{|} as the boolean OR
6367 operator. With a numeric prefix, the nth keyword in
6368 @code{org-todo-keywords} is selected.
6370 The @kbd{r} key in the agenda buffer regenerates it, and you can give
6371 a prefix argument to this command to change the selected TODO keyword,
6372 for example @kbd{3 r}. If you often need a search for a specific
6373 keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
6374 Matching specific TODO keywords can also be done as part of a tags
6375 search (@pxref{Tag searches}).
6378 Remote editing of TODO items means that you can change the state of a
6379 TODO entry with a single key press. The commands available in the
6380 TODO list are described in @ref{Agenda commands}.
6382 @cindex sublevels, inclusion into TODO list
6383 Normally the global TODO list simply shows all headlines with TODO
6384 keywords. This list can become very long. There are two ways to keep
6388 @vindex org-agenda-todo-ignore-scheduled
6389 @vindex org-agenda-todo-ignore-deadlines
6390 @vindex org-agenda-todo-ignore-with-date
6391 Some people view a TODO item that has been @emph{scheduled} for execution or
6392 have a @emph{deadline} (@pxref{Timestamps}) as no longer @emph{open}.
6393 Configure the variables @code{org-agenda-todo-ignore-scheduled},
6394 @code{org-agenda-todo-ignore-deadlines}, and/or
6395 @code{org-agenda-todo-ignore-with-date} to exclude such items from the
6398 @vindex org-agenda-todo-list-sublevels
6399 TODO items may have sublevels to break up the task into subtasks. In
6400 such cases it may be enough to list only the highest level TODO headline
6401 and omit the sublevels from the global list. Configure the variable
6402 @code{org-agenda-todo-list-sublevels} to get this behavior.
6405 @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
6406 @subsection Matching tags and properties
6407 @cindex matching, of tags
6408 @cindex matching, of properties
6412 If headlines in the agenda files are marked with @emph{tags} (@pxref{Tags}),
6413 or have properties (@pxref{Properties and Columns}), you can select headlines
6414 based on this metadata and collect them into an agenda buffer. The match
6415 syntax described here also applies when creating sparse trees with @kbd{C-c /
6421 Produce a list of all headlines that match a given set of tags. The
6422 command prompts for a selection criterion, which is a boolean logic
6423 expression with tags, like @samp{+work+urgent-withboss} or
6424 @samp{work|home} (@pxref{Tags}). If you often need a specific search,
6425 define a custom command for it (@pxref{Agenda dispatcher}).
6428 @vindex org-tags-match-list-sublevels
6429 @vindex org-agenda-tags-todo-honor-ignore-options
6430 Like @kbd{C-c a m}, but only select headlines that are also TODO items and
6431 force checking subitems (see variable @code{org-tags-match-list-sublevels}).
6432 To exclude scheduled/deadline items, see the variable
6433 @code{org-agenda-tags-todo-honor-ignore-options}. Matching specific TODO
6434 keywords together with a tags match is also possible, see @ref{Tag searches}.
6437 The commands available in the tags list are described in @ref{Agenda
6440 @subsubheading Match syntax
6442 @cindex Boolean logic, for tag/property searches
6443 A search string can use Boolean operators @samp{&} for AND and @samp{|} for
6444 OR. @samp{&} binds more strongly than @samp{|}. Parentheses are currently
6445 not implemented. Each element in the search is either a tag, a regular
6446 expression matching tags, or an expression like @code{PROPERTY OPERATOR
6447 VALUE} with a comparison operator, accessing a property value. Each element
6448 may be preceded by @samp{-}, to select against it, and @samp{+} is syntactic
6449 sugar for positive selection. The AND operator @samp{&} is optional when
6450 @samp{+} or @samp{-} is present. Here are some examples, using only tags.
6454 Select headlines tagged @samp{:work:}, but discard those also tagged
6457 Selects lines tagged @samp{:work:} or @samp{:laptop:}.
6458 @item work|laptop+night
6459 Like before, but require the @samp{:laptop:} lines to be tagged also
6463 @cindex regular expressions, with tags search
6464 Instead of a tag, you may also specify a regular expression enclosed in curly
6465 braces. For example,
6466 @samp{work+@{^boss.*@}} matches headlines that contain the tag
6467 @samp{:work:} and any tag @i{starting} with @samp{boss}.
6469 @cindex TODO keyword matching, with tags search
6470 @cindex level, require for tags/property match
6471 @cindex category, require for tags/property match
6472 @vindex org-odd-levels-only
6473 You may also test for properties (@pxref{Properties and Columns}) at the same
6474 time as matching tags. The properties may be real properties, or special
6475 properties that represent other metadata (@pxref{Special properties}). For
6476 example, the ``property'' @code{TODO} represents the TODO keyword of the
6477 entry. Or, the ``property'' @code{LEVEL} represents the level of an entry.
6478 So a search @samp{+LEVEL=3+boss-TODO="DONE"} lists all level three headlines
6479 that have the tag @samp{boss} and are @emph{not} marked with the TODO keyword
6480 DONE. In buffers with @code{org-odd-levels-only} set, @samp{LEVEL} does not
6481 count the number of stars, but @samp{LEVEL=2} will correspond to 3 stars etc.
6483 Here are more examples:
6485 @item work+TODO="WAITING"
6486 Select @samp{:work:}-tagged TODO lines with the specific TODO
6487 keyword @samp{WAITING}.
6488 @item work+TODO="WAITING"|home+TODO="WAITING"
6489 Waiting tasks both at work and at home.
6492 When matching properties, a number of different operators can be used to test
6493 the value of a property. Here is a complex example:
6496 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2 \
6497 +With=@{Sarah\|Denny@}+SCHEDULED>="<2008-10-11>"
6501 The type of comparison will depend on how the comparison value is written:
6504 If the comparison value is a plain number, a numerical comparison is done,
6505 and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=},
6506 @samp{>=}, and @samp{<>}.
6508 If the comparison value is enclosed in double-quotes,
6509 a string comparison is done, and the same operators are allowed.
6511 If the comparison value is enclosed in double-quotes @emph{and} angular
6512 brackets (like @samp{DEADLINE<="<2008-12-24 18:30>"}), both values are
6513 assumed to be date/time specifications in the standard Org way, and the
6514 comparison will be done accordingly. Special values that will be recognized
6515 are @code{"<now>"} for now (including time), and @code{"<today>"}, and
6516 @code{"<tomorrow>"} for these days at 0:00 hours, @ie without a time
6517 specification. Also strings like @code{"<+5d>"} or @code{"<-2m>"} with units
6518 @code{d}, @code{w}, @code{m}, and @code{y} for day, week, month, and year,
6519 respectively, can be used.
6521 If the comparison value is enclosed
6522 in curly braces, a regexp match is performed, with @samp{=} meaning that the
6523 regexp matches the property value, and @samp{<>} meaning that it does not
6527 So the search string in the example finds entries tagged @samp{:work:} but
6528 not @samp{:boss:}, which also have a priority value @samp{A}, a
6529 @samp{:Coffee:} property with the value @samp{unlimited}, an @samp{Effort}
6530 property that is numerically smaller than 2, a @samp{:With:} property that is
6531 matched by the regular expression @samp{Sarah\|Denny}, and that are scheduled
6532 on or after October 11, 2008.
6534 Accessing TODO, LEVEL, and CATEGORY during a search is fast. Accessing any
6535 other properties will slow down the search. However, once you have paid the
6536 price by accessing one property, testing additional properties is cheap
6539 You can configure Org mode to use property inheritance during a search, but
6540 beware that this can slow down searches considerably. See @ref{Property
6541 inheritance}, for details.
6543 For backward compatibility, and also for typing speed, there is also a
6544 different way to test TODO states in a search. For this, terminalte the
6545 tags/property part of the search string (which may include several terms
6546 connected with @samp{|}) with a @samp{/} and then specify a Boolean
6547 expression just for TODO keywords. The syntax is then similar to that for
6548 tags, but should be applied with care: For example, a positive
6549 selection on several TODO keywords cannot meaningfully be combined with
6550 boolean AND. However, @emph{negative selection} combined with AND can be
6551 meaningful. To make sure that only lines are checked that actually have any
6552 TODO keyword (resulting in a speed-up), use @kbd{C-c a M}, or equivalently
6553 start the TODO part after the slash with @samp{!}. Examples:
6557 Same as @samp{work+TODO="WAITING"}
6558 @item work/!-WAITING-NEXT
6559 Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
6561 @item work/!+WAITING|+NEXT
6562 Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
6566 @node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
6567 @subsection Timeline for a single file
6568 @cindex timeline, single file
6569 @cindex time-sorted view
6571 The timeline summarizes all time-stamped items from a single Org mode
6572 file in a @emph{time-sorted view}. The main purpose of this command is
6573 to give an overview over events in a project.
6578 Show a time-sorted view of the Org file, with all time-stamped items.
6579 When called with a @kbd{C-u} prefix, all unfinished TODO entries
6580 (scheduled or not) are also listed under the current date.
6584 The commands available in the timeline buffer are listed in
6585 @ref{Agenda commands}.
6587 @node Keyword search, Stuck projects, Timeline, Built-in agenda views
6588 @subsection Keyword search
6589 @cindex keyword search
6590 @cindex searching, for keywords
6592 This agenda view is a general text search facility for Org mode entries.
6593 It is particularly useful to find notes.
6598 This is a special search that lets you select entries by keywords or
6599 regular expression, using a boolean logic. For example, the search
6603 +computer +wifi -ethernet -@{8\.11[bg]@}
6607 will search for note entries that contain the keywords @code{computer}
6608 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
6609 not matched by the regular expression @code{8\.11[bg]}, meaning to
6610 exclude both 8.11b and 8.11g.
6612 @vindex org-agenda-text-search-extra-files
6613 Note that in addition to the agenda files, this command will also search
6614 the files listed in @code{org-agenda-text-search-extra-files}.
6617 @node Stuck projects, , Keyword search, Built-in agenda views
6618 @subsection Stuck projects
6620 If you are following a system like David Allen's GTD to organize your
6621 work, one of the ``duties'' you have is a regular review to make sure
6622 that all projects move along. A @emph{stuck} project is a project that
6623 has no defined next actions, so it will never show up in the TODO lists
6624 Org mode produces. During the review, you need to identify such
6625 projects and define next actions for them.
6630 List projects that are stuck.
6633 @vindex org-stuck-projects
6634 Customize the variable @code{org-stuck-projects} to define what a stuck
6635 project is and how to find it.
6638 You almost certainly will have to configure this view before it will
6639 work for you. The built-in default assumes that all your projects are
6640 level-2 headlines, and that a project is not stuck if it has at least
6641 one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
6643 Let's assume that you, in your own way of using Org mode, identify
6644 projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
6645 indicate a project that should not be considered yet. Let's further
6646 assume that the TODO keyword DONE marks finished projects, and that NEXT
6647 and TODO indicate next actions. The tag @@SHOP indicates shopping and
6648 is a next action even without the NEXT tag. Finally, if the project
6649 contains the special word IGNORE anywhere, it should not be listed
6650 either. In this case you would start by identifying eligible projects
6651 with a tags/todo match@footnote{@xref{Tag searches}.}
6652 @samp{+PROJECT/-MAYBE-DONE}, and then check for TODO, NEXT, @@SHOP, and
6653 IGNORE in the subtree to identify projects that are not stuck. The
6654 correct customization for this is
6657 (setq org-stuck-projects
6658 '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
6662 Note that if a project is identified as non-stuck, the subtree of this entry
6663 will still be searched for stuck projets.
6665 @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
6666 @section Presentation and sorting
6667 @cindex presentation, of agenda items
6669 @vindex org-agenda-prefix-format
6670 Before displaying items in an agenda view, Org mode visually prepares
6671 the items and sorts them. Each item occupies a single line. The line
6672 starts with a @emph{prefix} that contains the @emph{category}
6673 (@pxref{Categories}) of the item and other important information. You can
6674 customize the prefix using the option @code{org-agenda-prefix-format}.
6675 The prefix is followed by a cleaned-up version of the outline headline
6676 associated with the item.
6679 * Categories:: Not all tasks are equal
6680 * Time-of-day specifications:: How the agenda knows the time
6681 * Sorting of agenda items:: The order of things
6684 @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
6685 @subsection Categories
6688 The category is a broad label assigned to each agenda item. By default,
6689 the category is simply derived from the file name, but you can also
6690 specify it with a special line in the buffer, like this@footnote{For
6691 backward compatibility, the following also works: If there are several
6692 such lines in a file, each specifies the category for the text below it.
6693 The first category also applies to any text before the first CATEGORY
6694 line. However, using this method is @emph{strongly} deprecated as it is
6695 incompatible with the outline structure of the document. The correct
6696 method for setting multiple categories in a buffer is using a
6704 @cindex property, CATEGORY
6705 If you would like to have a special CATEGORY for a single entry or a
6706 (sub)tree, give the entry a @code{:CATEGORY:} property with the
6707 special category you want to apply as the value.
6710 The display in the agenda buffer looks best if the category is not
6711 longer than 10 characters.
6713 @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
6714 @subsection Time-of-day specifications
6715 @cindex time-of-day specification
6717 Org mode checks each agenda item for a time-of-day specification. The
6718 time can be part of the timestamp that triggered inclusion into the
6719 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time
6720 ranges can be specified with two timestamps, like
6722 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
6724 In the headline of the entry itself, a time(range) may also appear as
6725 plain text (like @samp{12:45} or a @samp{8:30-1pm}). If the agenda
6726 integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
6727 specifications in diary entries are recognized as well.
6729 For agenda display, Org mode extracts the time and displays it in a
6730 standard 24 hour format as part of the prefix. The example times in
6731 the previous paragraphs would end up in the agenda like this:
6734 8:30-13:00 Arthur Dent lies in front of the bulldozer
6735 12:45...... Ford Prefect arrives and takes Arthur to the pub
6736 19:00...... The Vogon reads his poem
6737 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
6741 If the agenda is in single-day mode, or for the display of today, the
6742 timed entries are embedded in a time grid, like
6745 8:00...... ------------------
6746 8:30-13:00 Arthur Dent lies in front of the bulldozer
6747 10:00...... ------------------
6748 12:00...... ------------------
6749 12:45...... Ford Prefect arrives and takes Arthur to the pub
6750 14:00...... ------------------
6751 16:00...... ------------------
6752 18:00...... ------------------
6753 19:00...... The Vogon reads his poem
6754 20:00...... ------------------
6755 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
6758 @vindex org-agenda-use-time-grid
6759 @vindex org-agenda-time-grid
6760 The time grid can be turned on and off with the variable
6761 @code{org-agenda-use-time-grid}, and can be configured with
6762 @code{org-agenda-time-grid}.
6764 @node Sorting of agenda items, , Time-of-day specifications, Presentation and sorting
6765 @subsection Sorting of agenda items
6766 @cindex sorting, of agenda items
6767 @cindex priorities, of agenda items
6768 Before being inserted into a view, the items are sorted. How this is
6769 done depends on the type of view.
6772 @vindex org-agenda-files
6773 For the daily/weekly agenda, the items for each day are sorted. The
6774 default order is to first collect all items containing an explicit
6775 time-of-day specification. These entries will be shown at the beginning
6776 of the list, as a @emph{schedule} for the day. After that, items remain
6777 grouped in categories, in the sequence given by @code{org-agenda-files}.
6778 Within each category, items are sorted by priority (@pxref{Priorities}),
6779 which is composed of the base priority (2000 for priority @samp{A}, 1000
6780 for @samp{B}, and 0 for @samp{C}), plus additional increments for
6781 overdue scheduled or deadline items.
6783 For the TODO list, items remain in the order of categories, but within
6784 each category, sorting takes place according to priority
6785 (@pxref{Priorities}). The priority used for sorting derives from the
6786 priority cookie, with additions depending on how close an item is to its due
6789 For tags matches, items are not sorted at all, but just appear in the
6790 sequence in which they are found in the agenda files.
6793 @vindex org-agenda-sorting-strategy
6794 Sorting can be customized using the variable
6795 @code{org-agenda-sorting-strategy}, and may also include criteria based on
6796 the estimated effort of an entry (@pxref{Effort estimates}).
6798 @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
6799 @section Commands in the agenda buffer
6800 @cindex commands, in agenda buffer
6802 Entries in the agenda buffer are linked back to the Org file or diary
6803 file where they originate. You are not allowed to edit the agenda
6804 buffer itself, but commands are provided to show and jump to the
6805 original entry location, and to edit the Org files ``remotely'' from
6806 the agenda buffer. In this way, all information is stored only once,
6807 removing the risk that your agenda and note files may diverge.
6809 Some commands can be executed with mouse clicks on agenda lines. For
6810 the other commands, the cursor needs to be in the desired line.
6813 @tsubheading{Motion}
6814 @cindex motion commands in agenda
6817 Next line (same as @key{up} and @kbd{C-p}).
6820 Previous line (same as @key{down} and @kbd{C-n}).
6821 @tsubheading{View/Go to Org file}
6826 Display the original location of the item in another window.
6827 With prefix arg, make sure that the entire entry is made visible in the
6828 outline, not only the heading.
6832 Display original location and recenter that window.
6840 Go to the original location of the item in another window. Under Emacs
6841 22, @kbd{mouse-1} will also works for this.
6845 Go to the original location of the item and delete other windows.
6849 @vindex org-agenda-start-with-follow-mode
6850 Toggle Follow mode. In Follow mode, as you move the cursor through
6851 the agenda buffer, the other window always shows the corresponding
6852 location in the Org file. The initial setting for this mode in new
6853 agenda buffers can be set with the variable
6854 @code{org-agenda-start-with-follow-mode}.
6858 Display the entire subtree of the current item in an indirect buffer. With a
6859 numeric prefix argument N, go up to level N and then take that tree. If N is
6860 negative, go up that many levels. With a @kbd{C-u} prefix, do not remove the
6861 previously used indirect buffer.
6865 @vindex org-log-done
6866 @vindex org-agenda-log-mode-items
6867 Toggle Logbook mode. In Logbook mode, entries that were marked DONE while
6868 logging was on (variable @code{org-log-done}) are shown in the agenda, as are
6869 entries that have been clocked on that day. You can configure the entry
6870 types that should be included in log mode using the variable
6871 @code{org-agenda-log-mode-items}. When called with a @kbd{C-u} prefix, show
6872 all possible logbook entries, including state changes. When called with two
6873 prefix args @kbd{C-u C-u}, show only logging information, nothing else.
6877 Toggle Archives mode. In Archives mode, trees that are marked
6878 @code{ARCHIVED} are also scanned when producing the agenda. When you call
6879 this command with a @kbd{C-u} prefix argument, even all archive files are
6880 included. To exit archives mode, press @kbd{v} again.
6884 @vindex org-agenda-start-with-clockreport-mode
6885 Toggle Clockreport mode. In Clockreport mode, the daily/weekly agenda will
6886 always show a table with the clocked times for the timespan and file scope
6887 covered by the current agenda view. The initial setting for this mode in new
6888 agenda buffers can be set with the variable
6889 @code{org-agenda-start-with-clockreport-mode}.
6891 @tsubheading{Change display}
6892 @cindex display changing, in agenda
6895 Delete other windows.
6902 Switch to day/week/month/year view. When switching to day or week view,
6903 this setting becomes the default for subsequent agenda commands. Since
6904 month and year views are slow to create, they do not become the default.
6905 A numeric prefix argument may be used to jump directly to a specific day
6906 of the year, ISO week, month, or year, respectively. For example,
6907 @kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9. When
6908 setting day, week, or month view, a year may be encoded in the prefix
6909 argument as well. For example, @kbd{200712 w} will jump to week 12 in
6910 2007. If such a year specification has only one or two digits, it will
6911 be mapped to the interval 1938-2037.
6915 Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
6919 @vindex org-agenda-use-time-grid
6920 @vindex org-agenda-time-grid
6921 Toggle the time grid on and off. See also the variables
6922 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
6926 Recreate the agenda buffer, for example to reflect the changes after
6927 modification of the timestamps of items with S-@key{left} and
6928 @kbd{S-@key{right}}. When the buffer is the global TODO list, a prefix
6929 argument is interpreted to create a selective list for a specific TODO
6939 Save all Org buffers in the current Emacs session, and also the locations of
6944 @vindex org-agenda-ndays
6945 Display the following @code{org-agenda-ndays} days. For example, if
6946 the display covers a week, switch to the following week. With prefix
6947 arg, go forward that many times @code{org-agenda-ndays} days.
6951 Display the previous dates.
6959 Prompt for a date and go there.
6963 @vindex org-columns-default-format
6964 Invoke column view (@pxref{Column view}) in the agenda buffer. The column
6965 view format is taken from the entry at point, or (if there is no entry at
6966 point), from the first entry in the agenda view. So whatever the format for
6967 that entry would be in the original buffer (taken from a property, from a
6968 @code{#+COLUMNS} line, or from the default variable
6969 @code{org-columns-default-format}), will be used in the agenda.
6973 Remove the restriction lock on the agenda, if it is currently restricted to a
6974 file or subtree (@pxref{Agenda files}).
6976 @tsubheading{Secondary filtering and query editing}
6977 @cindex filtering, by tag and effort, in agenda
6978 @cindex tag filtering, in agenda
6979 @cindex effort filtering, in agenda
6980 @cindex query editing, in agenda
6984 @vindex org-agenda-filter-preset
6985 Filter the current agenda view with respect to a tag and/or effort estimates.
6986 The difference between this and a custom agenda command is that filtering is
6987 very fast, so that you can switch quickly between different filters without
6988 having to recreate the agenda@footnote{Custom commands can preset a filter by
6989 binding the variable @code{org-agenda-filter-preset} as an option. This
6990 filter will then be applied to the view and presist as a basic filter through
6991 refreshes and more secondary filtering.}
6993 You will be prompted for a tag selection letter. Pressing @key{TAB} at that
6994 prompt will offer use completion to select a tag (including any tags that do
6995 not have a selection character). The command then hides all entries that do
6996 not contain or inherit this tag. When called with prefix arg, remove the
6997 entries that @emph{do} have the tag. A second @kbd{/} at the prompt will
6998 turn off the filter and unhide any hidden entries. If the first key you
6999 press is either @kbd{+} or @kbd{-}, the previous filter will be narrowed by
7000 requiring or forbidding the selected additional tag. Instead of pressing
7001 @kbd{+} or @kbd{-} after @kbd{/}, you can also immediately use the @kbd{\}
7004 @vindex org-sort-agenda-noeffort-is-high
7005 In order to filter for effort estimates, you should set-up allowed
7006 efforts globally, for example
7008 (setq org-global-properties
7009 '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
7011 You can then filter for an effort by first typing an operator, one of
7012 @kbd{<}, @kbd{>}, and @kbd{=}, and then the one-digit index of an effort
7013 estimate in your array of allowed values, where @kbd{0} means the 10th value.
7014 The filter will then restrict to entries with effort smaller-or-equal, equal,
7015 or larger-or-equal than the selected value. If the digits 0-9 are not used
7016 as fast access keys to tags, you can also simply press the index digit
7017 directly without an operator. In this case, @kbd{<} will be assumed. For
7018 application of the operator, entries without a defined effort will be treated
7019 according to the value of @code{org-sort-agenda-noeffort-is-high}. To filter
7020 for tasks without effort definition, press @kbd{?} as the operator.
7024 Narrow the current agenda filter by an additional condition. When called with
7025 prefix arg, remove the entries that @emph{do} have the tag, or that do match
7026 the effort criterion. You can achieve the same effect by pressing @kbd{+} or
7027 @kbd{-} as the first key after the @kbd{/} command.
7034 In the @i{search view} (@pxref{Keyword search}), these keys add new search
7035 words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{} and
7036 @kbd{@}}) to the query string. The opening bracket/brace will add a positive
7037 search term prefixed by @samp{+}, indicating that this search term @i{must}
7038 occur/match in the entry. The closing bracket/brace will add a negative
7039 search term which @i{must not} occur/match in the entry for it to be
7043 @tsubheading{Remote editing}
7044 @cindex remote editing, from agenda
7049 @cindex undoing remote-editing events
7050 @cindex remote editing, undo
7053 Undo a change due to a remote editing command. The change is undone
7054 both in the agenda buffer and in the remote buffer.
7058 Change the TODO state of the item, both in the agenda and in the
7063 @vindex org-agenda-confirm-kill
7064 Delete the current agenda item along with the entire subtree belonging
7065 to it in the original Org file. If the text to be deleted remotely
7066 is longer than one line, the kill needs to be confirmed by the user. See
7067 variable @code{org-agenda-confirm-kill}.
7071 Toggle the ARCHIVE tag for the current headline.
7075 Move the subtree corresponding to the current entry to its @emph{archive
7080 Archive the subtree corresponding to the current headline. This means the
7081 entry will be moved to the configured archive location, most likely a
7086 @vindex org-agenda-show-inherited-tags
7087 Show all tags associated with the current item. This is useful if you have
7088 turned off @code{org-agenda-show-inherited-tags}, but still want to see all
7089 tags of a headline occasionally.
7093 Set tags for the current headline. If there is an active region in the
7094 agenda, change a tag for all headings in the region.
7098 Set the priority for the current item. Org mode prompts for the
7099 priority character. If you reply with @key{SPC}, the priority cookie
7100 is removed from the entry.
7104 Display weighted priority of current item.
7110 Increase the priority of the current item. The priority is changed in
7111 the original buffer, but the agenda is not resorted. Use the @kbd{r}
7115 @kindex S-@key{down}
7118 Decrease the priority of the current item.
7122 @vindex org-log-into-drawer
7123 Add a note to the entry. This note will be recorded, and then files to the
7124 same location where state change notes are put. Depending on
7125 @code{org-log-into-drawer}, this maybe inside a drawer.
7129 Dispatcher for all command related to attachments.
7137 Set a deadline for this item.
7141 Agenda actions, to set dates for selected items to the cursor date.
7142 This command also works in the calendar! The command prompts for an
7145 m @r{Mark the entry at point for action. You can also make entries}
7146 @r{in Org files with @kbd{C-c C-x C-k}.}
7147 d @r{Set the deadline of the marked entry to the date at point.}
7148 s @r{Schedule the marked entry at the date at point.}
7149 r @r{Call @code{org-remember} with the cursor date as default date.}
7152 Press @kbd{r} afterward to refresh the agenda and see the effect of the
7155 @kindex S-@key{right}
7157 Change the timestamp associated with the current line by one day into the
7158 future. With a numeric prefix argument, change it by that many days. For
7159 example, @kbd{3 6 5 S-@key{right}} will change it by a year. With a
7160 @kbd{C-u} prefix, change the time by one hour. If you immediately repeat the
7161 command, it will continue to change hours even without the prefix arg. With
7162 a double @kbd{C-u C-u} prefix, do the same for changing minutes. The stamp
7163 is changed in the original Org file, but the change is not directly reflected
7164 in the agenda buffer. Use @kbd{r} or @kbd{g} to update the buffer.
7166 @kindex S-@key{left}
7168 Change the timestamp associated with the current line by one day
7173 Change the timestamp associated with the current line to today.
7174 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
7179 Start the clock on the current item. If a clock is running already, it
7184 Stop the previously started clock.
7188 Cancel the currently running clock.
7192 Jump to the running clock in another window.
7194 @tsubheading{Calendar commands}
7195 @cindex calendar commands, from agenda
7198 Open the Emacs calendar and move to the date at the agenda cursor.
7201 When in the calendar, compute and show the Org mode agenda for the
7204 @cindex diary entries, creating from agenda
7207 Insert a new entry into the diary. Prompts for the type of entry
7208 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
7209 entry in the diary, just as @kbd{i d}, etc., would do in the calendar.
7210 The date is taken from the cursor position.
7214 Show the phases of the moon for the three months around current date.
7218 Show sunrise and sunset times. The geographical location must be set
7219 with calendar variables, see the documentation for the Emacs calendar.
7223 Convert the date at cursor into many other cultural and historic
7228 Show holidays for three months around the cursor date.
7230 @item M-x org-export-icalendar-combine-agenda-files
7231 Export a single iCalendar file containing entries from all agenda files.
7232 This is a globally available command, and also available in the agenda menu.
7234 @tsubheading{Exporting to a file}
7237 @cindex exporting agenda views
7238 @cindex agenda views, exporting
7239 @vindex org-agenda-exporter-settings
7240 Write the agenda view to a file. Depending on the extension of the selected
7241 file name, the view will be exported as HTML (extension @file{.html} or
7242 @file{.htm}), Postscript (extension @file{.ps}), PDF (extension @file{.pdf}),
7243 or plain text (any other extension). When called with a @kbd{C-u} prefix
7244 argument, immediately open the newly created file. Use the variable
7245 @code{org-agenda-exporter-settings} to set options for @file{ps-print} and
7246 for @file{htmlize} to be used during export.
7248 @tsubheading{Quit and Exit}
7251 Quit agenda, remove the agenda buffer.
7254 @cindex agenda files, removing buffers
7256 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
7257 for the compilation of the agenda. Buffers created by the user to
7258 visit Org files will not be removed.
7262 @node Custom agenda views, Exporting Agenda Views, Agenda commands, Agenda Views
7263 @section Custom agenda views
7264 @cindex custom agenda views
7265 @cindex agenda views, custom
7267 Custom agenda commands serve two purposes: to store and quickly access
7268 frequently used TODO and tags searches, and to create special composite
7269 agenda buffers. Custom agenda commands will be accessible through the
7270 dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
7273 * Storing searches:: Type once, use often
7274 * Block agenda:: All the stuff you need in a single buffer
7275 * Setting Options:: Changing the rules
7278 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
7279 @subsection Storing searches
7281 The first application of custom searches is the definition of keyboard
7282 shortcuts for frequently used searches, either creating an agenda
7283 buffer, or a sparse tree (the latter covering of course only the current
7286 @vindex org-agenda-custom-commands
7287 Custom commands are configured in the variable
7288 @code{org-agenda-custom-commands}. You can customize this variable, for
7289 example by pressing @kbd{C-c a C}. You can also directly set it with
7290 Emacs Lisp in @file{.emacs}. The following example contains all valid
7295 (setq org-agenda-custom-commands
7296 '(("w" todo "WAITING")
7297 ("W" todo-tree "WAITING")
7298 ("u" tags "+boss-urgent")
7299 ("v" tags-todo "+boss-urgent")
7300 ("U" tags-tree "+boss-urgent")
7301 ("f" occur-tree "\\<FIXME\\>")
7302 ("h" . "HOME+Name tags searches") ; description for "h" prefix
7303 ("hl" tags "+home+Lisa")
7304 ("hp" tags "+home+Peter")
7305 ("hk" tags "+home+Kim")))
7310 The initial string in each entry defines the keys you have to press
7311 after the dispatcher command @kbd{C-c a} in order to access the command.
7312 Usually this will be just a single character, but if you have many
7313 similar commands, you can also define two-letter combinations where the
7314 first character is the same in several combinations and serves as a
7315 prefix key@footnote{You can provide a description for a prefix key by
7316 inserting a cons cell with the prefix and the description.}. The second
7317 parameter is the search type, followed by the string or regular
7318 expression to be used for the matching. The example above will
7323 as a global search for TODO entries with @samp{WAITING} as the TODO
7326 as the same search, but only in the current buffer and displaying the
7327 results as a sparse tree
7329 as a global tags search for headlines marked @samp{:boss:} but not
7332 as the same search as @kbd{C-c a u}, but limiting the search to
7333 headlines that are also TODO items
7335 as the same search as @kbd{C-c a u}, but only in the current buffer and
7336 displaying the result as a sparse tree
7338 to create a sparse tree (again: current buffer only) with all entries
7339 containing the word @samp{FIXME}
7341 as a prefix command for a HOME tags search where you have to press an
7342 additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
7343 Peter, or Kim) as additional tag to match.
7346 @node Block agenda, Setting Options, Storing searches, Custom agenda views
7347 @subsection Block agenda
7348 @cindex block agenda
7349 @cindex agenda, with block views
7351 Another possibility is the construction of agenda views that comprise
7352 the results of @emph{several} commands, each of which creates a block in
7353 the agenda buffer. The available commands include @code{agenda} for the
7354 daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
7355 for the global TODO list (as constructed with @kbd{C-c a t}), and the
7356 matching commands discussed above: @code{todo}, @code{tags}, and
7357 @code{tags-todo}. Here are two examples:
7361 (setq org-agenda-custom-commands
7362 '(("h" "Agenda and Home-related tasks"
7366 ("o" "Agenda and Office-related tasks"
7374 This will define @kbd{C-c a h} to create a multi-block view for stuff
7375 you need to attend to at home. The resulting agenda buffer will contain
7376 your agenda for the current week, all TODO items that carry the tag
7377 @samp{home}, and also all lines tagged with @samp{garden}. Finally the
7378 command @kbd{C-c a o} provides a similar view for office tasks.
7380 @node Setting Options, , Block agenda, Custom agenda views
7381 @subsection Setting options for custom commands
7382 @cindex options, for custom agenda views
7384 @vindex org-agenda-custom-commands
7385 Org mode contains a number of variables regulating agenda construction
7386 and display. The global variables define the behavior for all agenda
7387 commands, including the custom commands. However, if you want to change
7388 some settings just for a single custom view, you can do so. Setting
7389 options requires inserting a list of variable names and values at the
7390 right spot in @code{org-agenda-custom-commands}. For example:
7394 (setq org-agenda-custom-commands
7395 '(("w" todo "WAITING"
7396 ((org-agenda-sorting-strategy '(priority-down))
7397 (org-agenda-prefix-format " Mixed: ")))
7398 ("U" tags-tree "+boss-urgent"
7399 ((org-show-following-heading nil)
7400 (org-show-hierarchy-above nil)))
7402 ((org-agenda-files '("~org/notes.org"))
7403 (org-agenda-text-search-extra-files nil)))))
7408 Now the @kbd{C-c a w} command will sort the collected entries only by
7409 priority, and the prefix format is modified to just say @samp{ Mixed: }
7410 instead of giving the category of the entry. The sparse tags tree of
7411 @kbd{C-c a U} will now turn out ultra-compact, because neither the
7412 headline hierarchy above the match, nor the headline following the match
7413 will be shown. The command @kbd{C-c a N} will do a text search limited
7414 to only a single file.
7416 @vindex org-agenda-custom-commands
7417 For command sets creating a block agenda,
7418 @code{org-agenda-custom-commands} has two separate spots for setting
7419 options. You can add options that should be valid for just a single
7420 command in the set, and options that should be valid for all commands in
7421 the set. The former are just added to the command entry, the latter
7422 must come after the list of command entries. Going back to the block
7423 agenda example (@pxref{Block agenda}), let's change the sorting strategy
7424 for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
7425 the results for GARDEN tags query in the opposite order,
7426 @code{priority-up}. This would look like this:
7430 (setq org-agenda-custom-commands
7431 '(("h" "Agenda and Home-related tasks"
7435 ((org-agenda-sorting-strategy '(priority-up)))))
7436 ((org-agenda-sorting-strategy '(priority-down))))
7437 ("o" "Agenda and Office-related tasks"
7444 As you see, the values and parentheses setting is a little complex.
7445 When in doubt, use the customize interface to set this variable---it
7446 fully supports its structure. Just one caveat: When setting options in
7447 this interface, the @emph{values} are just Lisp expressions. So if the
7448 value is a string, you need to add the double-quotes around the value
7452 @node Exporting Agenda Views, Agenda column view, Custom agenda views, Agenda Views
7453 @section Exporting Agenda Views
7454 @cindex agenda views, exporting
7456 If you are away from your computer, it can be very useful to have a printed
7457 version of some agenda views to carry around. Org mode can export custom
7458 agenda views as plain text, HTML@footnote{You need to install Hrvoje Niksic's
7459 @file{htmlize.el}.}, Postscript, PDF@footnote{To create PDF output, the
7460 ghostscript @file{ps2pdf} utility must be installed on the system. Selecting
7461 a PDF file with also create the postscript file.}, and iCalendar files. If
7462 you want to do this only occasionally, use the command
7467 @cindex exporting agenda views
7468 @cindex agenda views, exporting
7469 @vindex org-agenda-exporter-settings
7470 Write the agenda view to a file. Depending on the extension of the
7471 selected file name, the view will be exported as HTML (extension
7472 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
7473 iCalendar (extension @file{.ics}), or plain text (any other extension).
7474 Use the variable @code{org-agenda-exporter-settings} to
7475 set options for @file{ps-print} and for @file{htmlize} to be used during
7478 @vindex org-agenda-add-entry-text-maxlines
7479 @vindex htmlize-output-type
7480 @vindex ps-number-of-columns
7481 @vindex ps-landscape-mode
7483 (setq org-agenda-exporter-settings
7484 '((ps-number-of-columns 2)
7485 (ps-landscape-mode t)
7486 (org-agenda-add-entry-text-maxlines 5)
7487 (htmlize-output-type 'css)))
7491 If you need to export certain agenda views frequently, you can associate
7492 any custom agenda command with a list of output file names
7493 @footnote{If you want to store standard views like the weekly agenda
7494 or the global TODO list as well, you need to define custom commands for
7495 them in order to be able to specify file names.}. Here is an example
7496 that first defines custom commands for the agenda and the global
7497 TODO list, together with a number of files to which to export them.
7498 Then we define two block agenda commands and specify file names for them
7499 as well. File names can be relative to the current working directory,
7504 (setq org-agenda-custom-commands
7505 '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
7506 ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
7507 ("h" "Agenda and Home-related tasks"
7512 ("~/views/home.html"))
7513 ("o" "Agenda and Office-related tasks"
7518 ("~/views/office.ps" "~/calendars/office.ics"))))
7522 The extension of the file name determines the type of export. If it is
7523 @file{.html}, Org mode will use the @file{htmlize.el} package to convert
7524 the buffer to HTML and save it to this file name. If the extension is
7525 @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
7526 Postscript output. If the extension is @file{.ics}, iCalendar export is
7527 run export over all files that were used to construct the agenda, and
7528 limit the export to entries listed in the agenda. Any other
7529 extension produces a plain ASCII file.
7531 The export files are @emph{not} created when you use one of those
7532 commands interactively because this might use too much overhead.
7533 Instead, there is a special command to produce @emph{all} specified
7539 Export all agenda views that have export file names associated with
7543 You can use the options section of the custom agenda commands to also
7544 set options for the export commands. For example:
7547 (setq org-agenda-custom-commands
7549 ((ps-number-of-columns 2)
7550 (ps-landscape-mode t)
7551 (org-agenda-prefix-format " [ ] ")
7552 (org-agenda-with-colors nil)
7553 (org-agenda-remove-tags t))
7558 This command sets two options for the Postscript exporter, to make it
7559 print in two columns in landscape format---the resulting page can be cut
7560 in two and then used in a paper agenda. The remaining settings modify
7561 the agenda prefix to omit category and scheduling information, and
7562 instead include a checkbox to check off items. We also remove the tags
7563 to make the lines compact, and we don't want to use colors for the
7564 black-and-white printer. Settings specified in
7565 @code{org-agenda-exporter-settings} will also apply, but the settings
7566 in @code{org-agenda-custom-commands} take precedence.
7569 From the command line you may also use
7571 emacs -f org-batch-store-agenda-views -kill
7574 or, if you need to modify some parameters@footnote{Quoting depends on the
7575 system you use, please check the FAQ for examples.}
7577 emacs -eval '(org-batch-store-agenda-views \
7578 org-agenda-ndays 30 \
7579 org-agenda-start-day "2007-11-01" \
7580 org-agenda-include-diary nil \
7581 org-agenda-files (quote ("~/org/project.org")))' \
7585 which will create the agenda views restricted to the file
7586 @file{~/org/project.org}, without diary entries and with a 30-day
7589 You can also extract agenda information in a way that allows further
7590 processing by other programs. See @ref{Extracting agenda information}, for
7594 @node Agenda column view, , Exporting Agenda Views, Agenda Views
7595 @section Using column view in the agenda
7596 @cindex column view, in agenda
7597 @cindex agenda, column view
7599 Column view (@pxref{Column view}) is normally used to view and edit
7600 properties embedded in the hierarchical structure of an Org file. It can be
7601 quite useful to use column view also from the agenda, where entries are
7602 collected by certain criteria.
7607 Turn on column view in the agenda.
7610 To understand how to use this properly, it is important to realize that the
7611 entries in the agenda are no longer in their proper outline environment.
7612 This causes the following issues:
7616 @vindex org-columns-default-format
7617 @vindex org-overriding-columns-format
7618 Org needs to make a decision which @code{COLUMNS} format to use. Since the
7619 entries in the agenda are collected from different files, and different files
7620 may have different @code{COLUMNS} formats, this is a non-trivial problem.
7621 Org first checks if the variable @code{org-overriding-columns-format} is
7622 currently set, and if so, takes the format from there. Otherwise it takes
7623 the format associated with the first item in the agenda, or, if that item
7624 does not have a specific format (defined in a property, or in its file), it
7625 uses @code{org-columns-default-format}.
7627 @cindex property, special, CLOCKSUM
7628 If any of the columns has a summary type defined (@pxref{Column attributes}),
7629 turning on column view in the agenda will visit all relevant agenda files and
7630 make sure that the computations of this property are up to date. This is
7631 also true for the special @code{CLOCKSUM} property. Org will then sum the
7632 values displayed in the agenda. In the daily/weekly agenda, the sums will
7633 cover a single day, in all other views they cover the entire block. It is
7634 vital to realize that the agenda may show the same entry @emph{twice} (for
7635 example as scheduled and as a deadline), and it may show two entries from the
7636 same hierarchy (for example a @emph{parent} and its @emph{child}). In these
7637 cases, the summation in the agenda will lead to incorrect results because
7638 some values will count double.
7640 When the column view in the agenda shows the @code{CLOCKSUM}, that is always
7641 the entire clocked time for this item. So even in the daily/weekly agenda,
7642 the clocksum listed in column view may originate from times outside the
7643 current view. This has the advantage that you can compare these values with
7644 a column listing the planned total effort for a task---one of the major
7645 applications for column view in the agenda. If you want information about
7646 clocked time in the displayed period use clock table mode (press @kbd{R} in
7651 @node Embedded LaTeX, Exporting, Agenda Views, Top
7652 @chapter Embedded La@TeX{}
7653 @cindex @TeX{} interpretation
7654 @cindex La@TeX{} interpretation
7656 Plain ASCII is normally sufficient for almost all note taking. One
7657 exception, however, are scientific notes which need to be able to contain
7658 mathematical symbols and the occasional formula. La@TeX{}@footnote{La@TeX{}
7659 is a macro system based on Donald E. Knuth's @TeX{} system. Many of the
7660 features described here as ``La@TeX{}'' are really from @TeX{}, but for
7661 simplicity I am blurring this distinction.} is widely used to typeset
7662 scientific documents. Org mode supports embedding La@TeX{} code into its
7663 files, because many academics are used to reading La@TeX{} source code, and
7664 because it can be readily processed into images for HTML production.
7666 It is not necessary to mark La@TeX{} macros and code in any special way.
7667 If you observe a few conventions, Org mode knows how to find it and what
7671 * Math symbols:: @TeX{} macros for symbols and Greek letters
7672 * Subscripts and superscripts:: Simple syntax for raising/lowering text
7673 * LaTeX fragments:: Complex formulas made easy
7674 * Processing LaTeX fragments:: Previewing La@TeX{} processing
7675 * CDLaTeX mode:: Speed up entering of formulas
7678 @node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
7679 @section Math symbols
7680 @cindex math symbols
7681 @cindex @TeX{} macros
7683 You can use La@TeX{} macros to insert special symbols like @samp{\alpha} to
7684 indicate the Greek letter, or @samp{\to} to indicate an arrow. Completion
7685 for these macros is available, just type @samp{\} and maybe a few letters,
7686 and press @kbd{M-@key{TAB}} to see possible completions. Unlike La@TeX{}
7687 code, Org mode allows these macros to be present without surrounding math
7688 delimiters, for example:
7691 Angles are written as Greek letters \alpha, \beta and \gamma.
7694 During HTML export (@pxref{HTML export}), these symbols are translated
7695 into the proper syntax for HTML, for the above examples this is
7696 @samp{α} and @samp{→}, respectively. If you need such a symbol
7697 inside a word, terminate it like this: @samp{\Aacute@{@}stor}.
7699 @node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
7700 @section Subscripts and superscripts
7704 Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
7705 and subscripts. Again, these can be used without embedding them in
7706 math-mode delimiters. To increase the readability of ASCII text, it is
7707 not necessary (but OK) to surround multi-character sub- and superscripts
7708 with curly braces. For example
7711 The mass if the sun is M_sun = 1.989 x 10^30 kg. The radius of
7712 the sun is R_@{sun@} = 6.96 x 10^8 m.
7715 To avoid interpretation as raised or lowered text, you can quote
7716 @samp{^} and @samp{_} with a backslash: @samp{\^} and @samp{\_}.
7718 During HTML export (@pxref{HTML export}), subscript and superscripts
7719 are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
7721 @node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
7722 @section La@TeX{} fragments
7723 @cindex La@TeX{} fragments
7725 @vindex org-format-latex-header
7726 With symbols, sub- and superscripts, HTML is pretty much at its end when
7727 it comes to representing mathematical formulas@footnote{Yes, there is
7728 MathML, but that is not yet fully supported by many browsers, and there
7729 is no decent converter for turning La@TeX{} or ASCII representations of
7730 formulas into MathML. So for the time being, converting formulas into
7731 images seems the way to go.}. More complex expressions need a dedicated
7732 formula processor. To this end, Org mode can contain arbitrary La@TeX{}
7733 fragments. It provides commands to preview the typeset result of these
7734 fragments, and upon export to HTML, all fragments will be converted to
7735 images and inlined into the HTML document@footnote{The La@TeX{} export
7736 will not use images for displaying La@TeX{} fragments but include these
7737 fragments directly into the La@TeX{} code.}. For this to work you
7738 need to be on a system with a working La@TeX{} installation. You also
7739 need the @file{dvipng} program, available at
7740 @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
7741 will be used when processing a fragment can be configured with the
7742 variable @code{org-format-latex-header}.
7744 La@TeX{} fragments don't need any special marking at all. The following
7745 snippets will be identified as La@TeX{} source code:
7748 Environments of any kind. The only requirement is that the
7749 @code{\begin} statement appears on a new line, preceded by only
7752 Text within the usual La@TeX{} math delimiters. To avoid conflicts with
7753 currency specifications, single @samp{$} characters are only recognized as
7754 math delimiters if the enclosed text contains at most two line breaks, is
7755 directly attached to the @samp{$} characters with no whitespace in between,
7756 and if the closing @samp{$} is followed by whitespace, punctuation or a dash.
7757 For the other delimiters, there is no such restriction, so when in doubt, use
7758 @samp{\(...\)} as inline math delimiters.
7761 @noindent For example:
7764 \begin@{equation@} % arbitrary environments,
7765 x=\sqrt@{b@} % even tables, figures
7766 \end@{equation@} % etc
7768 If $a^2=b$ and \( b=2 \), then the solution must be
7769 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
7773 @vindex org-format-latex-options
7774 If you need any of the delimiter ASCII sequences for other purposes, you
7775 can configure the option @code{org-format-latex-options} to deselect the
7776 ones you do not wish to have interpreted by the La@TeX{} converter.
7778 @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
7779 @section Processing LaTeX fragments
7780 @cindex LaTeX fragments, preview
7782 La@TeX{} fragments can be processed to produce preview images of the
7783 typeset expressions:
7788 Produce a preview image of the La@TeX{} fragment at point and overlay it
7789 over the source code. If there is no fragment at point, process all
7790 fragments in the current entry (between two headlines). When called
7791 with a prefix argument, process the entire subtree. When called with
7792 two prefix arguments, or when the cursor is before the first headline,
7793 process the entire buffer.
7796 Remove the overlay preview images.
7799 During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
7800 converted into images and inlined into the document if the following
7804 (setq org-export-with-LaTeX-fragments t)
7807 @node CDLaTeX mode, , Processing LaTeX fragments, Embedded LaTeX
7808 @section Using CDLa@TeX{} to enter math
7811 CDLa@TeX{} mode is a minor mode that is normally used in combination with a
7812 major La@TeX{} mode like AUC@TeX{} in order to speed-up insertion of
7813 environments and math templates. Inside Org mode, you can make use of
7814 some of the features of CDLa@TeX{} mode. You need to install
7815 @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
7816 AUC@TeX{}) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
7817 Don't use CDLa@TeX{} mode itself under Org mode, but use the light
7818 version @code{org-cdlatex-mode} that comes as part of Org mode. Turn it
7819 on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
7823 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
7826 When this mode is enabled, the following features are present (for more
7827 details see the documentation of CDLa@TeX{} mode):
7831 Environment templates can be inserted with @kbd{C-c @{}.
7834 The @key{TAB} key will do template expansion if the cursor is inside a
7835 La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
7836 inside such a fragment, see the documentation of the function
7837 @code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will
7838 expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
7839 correctly inside the first brace. Another @key{TAB} will get you into
7840 the second brace. Even outside fragments, @key{TAB} will expand
7841 environment abbreviations at the beginning of a line. For example, if
7842 you write @samp{equ} at the beginning of a line and press @key{TAB},
7843 this abbreviation will be expanded to an @code{equation} environment.
7844 To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
7848 @vindex cdlatex-simplify-sub-super-scripts
7849 Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
7850 characters together with a pair of braces. If you use @key{TAB} to move
7851 out of the braces, and if the braces surround only a single character or
7852 macro, they are removed again (depending on the variable
7853 @code{cdlatex-simplify-sub-super-scripts}).
7856 Pressing the backquote @kbd{`} followed by a character inserts math
7857 macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds
7858 after the backquote, a help window will pop up.
7861 Pressing the single-quote @kbd{'} followed by another character modifies
7862 the symbol before point with an accent or a font. If you wait more than
7863 1.5 seconds after the backquote, a help window will pop up. Character
7864 modification will work only inside La@TeX{} fragments, outside the quote
7868 @node Exporting, Publishing, Embedded LaTeX, Top
7872 Org-mode documents can be exported into a variety of other formats. For
7873 printing and sharing of notes, ASCII export produces a readable and simple
7874 version of an Org file. HTML export allows you to publish a notes file on
7875 the web, while the XOXO format provides a solid base for exchange with a
7876 broad range of other applications. La@TeX{} export lets you use Org mode and
7877 its structured editing functions to easily create La@TeX{} files. DocBook
7878 export makes it possible to convert Org files to many other formats using
7879 DocBook tools. To incorporate entries with associated times like deadlines
7880 or appointments into a desktop calendar program like iCal, Org mode can also
7881 produce extracts in the iCalendar format. Currently Org mode only supports
7882 export, not import of these different formats.
7884 Org supports export of selected regions when @code{transient-mark-mode} is
7885 enabled (default in Emacs 23).
7888 * Markup rules:: Which structures are recognized?
7889 * Selective export:: Using tags to select and exclude trees
7890 * Export options:: Per-file export settings
7891 * The export dispatcher:: How to access exporter commands
7892 * ASCII export:: Exporting to plain ASCII
7893 * HTML export:: Exporting to HTML
7894 * LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF
7895 * DocBook export:: Exporting to DocBook
7896 * XOXO export:: Exporting to XOXO
7897 * iCalendar export:: Exporting in iCalendar format
7900 @node Markup rules, Selective export, Exporting, Exporting
7901 @section Markup rules
7903 When exporting Org-mode documents, the exporter tries to reflect the
7904 structure of the document as accurately as possible in the backend. Since
7905 export targets like HTML, La@TeX{}, or DocBook allow much richer formatting,
7906 Org mode has rules on how to prepare text for rich export. This section
7907 summarizes the markup rules used in an Org-mode buffer.
7910 * Document title:: How the document title is determined
7911 * Headings and sections:: The main structure of the exported document
7912 * Table of contents:: If, where, how to create a table of contents
7913 * Initial text:: Text before the first headline
7914 * Lists:: Plain lists are exported
7915 * Paragraphs:: What determines beginning and ending
7916 * Literal examples:: Source code and other examples
7917 * Include files:: Include the contents of a file during export
7918 * Tables exported:: Tables are exported richly
7919 * Inlined images:: How to inline images during export
7920 * Footnote markup:: ASCII representation of footnotes
7921 * Emphasis and monospace:: To bold or not to bold
7922 * TeX macros and LaTeX fragments:: Create special, rich export.
7923 * Horizontal rules:: A line across the page
7924 * Comment lines:: Some lines will not be exported
7925 * Macro replacement:: Global replacement of place holdes
7928 @node Document title, Headings and sections, Markup rules, Markup rules
7929 @subheading Document title
7930 @cindex document title, markup rules
7933 The title of the exported document is taken from the special line
7937 #+TITLE: This is the title of the document
7941 If this line does not exist, the title is derived from the first non-empty,
7942 non-comment line in the buffer. If no such line exists, or if you have
7943 turned off exporting of the text before the first headline (see below), the
7944 title will be the file name without extension.
7946 @cindex property, EXPORT_TITLE
7947 If you are exporting only a subtree by marking is as the region, the heading
7948 of the subtree will become the title of the document. If the subtree has a
7949 property @code{EXPORT_TITLE}, that will take precedence.
7951 @node Headings and sections, Table of contents, Document title, Markup rules
7952 @subheading Headings and sections
7953 @cindex headings and sections, markup rules
7955 @vindex org-headline-levels
7956 The outline structure of the document as described in @ref{Document
7957 Structure}, forms the basis for defining sections of the exported document.
7958 However, since the outline structure is also used for (for example) lists of
7959 tasks, only the first three outline levels will be used as headings. Deeper
7960 levels will become itemized lists. You can change the location of this
7961 switch globally by setting the variable @code{org-headline-levels}, or on a
7962 per-file basis with a line
7969 @node Table of contents, Initial text, Headings and sections, Markup rules
7970 @subheading Table of contents
7971 @cindex table of contents, markup rules
7973 @vindex org-export-with-toc
7974 The table of contents is normally inserted directly before the first headline
7975 of the file. If you would like to get it to a different location, insert the
7976 string @code{[TABLE-OF-CONTENTS]} on a line by itself at the desired
7977 location. The depth of the table of contents is by default the same as the
7978 number of headline levels, but you can choose a smaller number, or turn off
7979 the table of contents entirely, by configuring the variable
7980 @code{org-export-with-toc}, or on a per-file basis with a line like
7983 #+OPTIONS: toc:2 (only to two levels in TOC)
7984 #+OPTIONS: toc:nil (no TOC at all)
7987 @node Initial text, Lists, Table of contents, Markup rules
7988 @subheading Text before the first headline
7989 @cindex text before first headline, markup rules
7992 Org mode normally exports the text before the first headline, and even uses
7993 the first line as the document title. The text will be fully marked up. If
7994 you need to include literal HTML, La@TeX{}, or DocBook code, use the special
7995 constructs described below in the sections for the individual exporters.
7997 @vindex org-export-skip-text-before-1st-heading
7998 Some people like to use the space before the first headline for setup and
7999 internal links and therefore would like to control the exported text before
8000 the first headline in a different way. You can do so by setting the variable
8001 @code{org-export-skip-text-before-1st-heading} to @code{t}. On a per-file
8002 basis, you can get the same effect with @samp{#+OPTIONS: skip:t}.
8005 If you still want to have some text before the first headline, use the
8006 @code{#+TEXT} construct:
8010 #+TEXT: This text will go before the *first* headline.
8011 #+TEXT: [TABLE-OF-CONTENTS]
8012 #+TEXT: This goes between the table of contents and the first headline
8015 @node Lists, Paragraphs, Initial text, Markup rules
8017 @cindex lists, markup rules
8019 Plain lists as described in @ref{Plain lists}, are translated to the backend's
8020 syntax for such lists. Most backends support unordered, ordered, and
8023 @node Paragraphs, Literal examples, Lists, Markup rules
8024 @subheading Paragraphs, line breaks, and quoting
8025 @cindex paragraphs, markup rules
8027 Paragraphs are separated by at least one empty line. If you need to enforce
8028 a line break within a paragraph, use @samp{\\} at the end of a line.
8030 To keep the line breaks in a region, but otherwise use normal formatting, you
8031 can use this construct, which can also be used to format poetry.
8033 @cindex #+BEGIN_VERSE
8036 Great clouds overhead
8037 Tiny black birds rise and fall
8044 When quoting a passage from another document, it is customary to format this
8045 as a paragraph that is indented on both the left and the right margin. You
8046 can include quotations in Org-mode documents like this:
8048 @cindex #+BEGIN_QUOTE
8051 Everything should be made as simple as possible,
8052 but not any simpler -- Albert Einstein
8056 If you would like to center some text, do it like this:
8057 @cindex #+BEGIN_CENTER
8060 Everything should be made as simple as possible, \\
8065 @node Literal examples, Include files, Paragraphs, Markup rules
8066 @subheading Literal examples
8067 @cindex literal examples, markup rules
8068 @cindex code line refenences, markup rules
8070 You can include literal examples that should not be subjected to
8071 markup. Such examples will be typeset in monospace, so this is well suited
8072 for source code and similar examples.
8073 @cindex #+BEGIN_EXAMPLE
8077 Some example from a text file.
8081 Note that such blocks may be @i{indented} in order to align nicely with
8082 indented text and in particular with plain list structure (@pxref{Plain
8083 lists}). For simplicity when using small examples, you can also start the
8084 example lines with a colon followed by a space. There may also be additional
8085 whitespace before the colon:
8089 : Some example from a text file.
8092 @cindex formatting source code, markup rules
8093 If the example is source code from a programming language, or any other text
8094 that can be marked up by font-lock in Emacs, you can ask for the example to
8095 look like the fontified Emacs buffer@footnote{Currently this works only for
8096 the HTML backend, and requires the @file{htmlize.el} package version 1.34 or
8097 later.}. This is done with the @samp{src} block, where you also need to
8098 specify the name of the major mode that should be used to fontify the
8103 #+BEGIN_SRC emacs-lisp
8104 (defun org-xor (a b)
8110 Both in @code{example} and in @code{src} snippets, you can add a @code{-n}
8111 switch to the end of the @code{BEGIN} line, to get the lines of the example
8112 numbered. If you use a @code{+n} switch, the numbering from the previous
8113 numbered snippet will be continued in the current one. In literal examples,
8114 Org will interpret strings like @samp{(ref:name)} as labels, and use them as
8115 targets for special hyperlinks like @code{[[(name)]]} (@ie the reference
8116 name enclosed in single parenthesis). In HTML, hovering the mouse over such
8117 a link will remote-highlight the corresponding code line, which is kind of
8118 cool. If the example/src snippet is numbered, you can also add a @code{-r}
8119 switch. Then labels will be @i{removed} from the source code and the links
8120 will be @i{replaced}@footnote{If you want to explain the use of such labels
8121 themelves in org-mode example code, you can use the @code{-k} switch to make
8122 sure they are not touched.} with line numbers from the code listing. Here is
8126 #+BEGIN_SRC emacs-lisp -n -r
8127 (save-excursion (ref:sc)
8128 (goto-char (point-min)) (ref:jump)
8130 In line [[(sc)]] we remember the current positon. [[(jump)][Line (jump)]]
8134 @vindex org-coderef-label-format
8135 If the syntax for the label format conflicts with the language syntax, use a
8136 @code{-l} switch to change the format, for example @samp{#+BEGIN_SRC pascal
8137 -n -r -l "((%s))"}. See also the variable @code{org-coderef-label-format}.
8139 HTML export also allows examples to be published as text areas, @xref{Text
8140 areas in HTML export}.
8145 Edit the source code example at point in its native mode. This works by
8146 switching to a temporary buffer with the source code. You need to exit by
8147 pressing @kbd{C-c '} again@footnote{Upon exit, lines starting with @samp{*}
8148 or @samp{#} will get a comma prepended, to keep them from being interpreted
8149 by Org as outline nodes or special comments. These commas will be striped
8150 for editing with @kbd{C-c '}, and also for export.}, the edited version will
8151 then replace the old version in the Org buffer. Fixed-width regions
8152 (where each line starts with a colon followed by a space) will be edited
8153 using @code{artist-mode}@footnote{You may select a different-mode with the
8154 variable @code{org-edit-fixed-width-region-mode}.} to allow creating ASCII
8155 drawings easily. Using this command in an empty line will create a new
8159 Calling @code{org-store-link} while editing a source code example in a
8160 temporary buffer created with @kbd{C-c '} will prompt for a label, make sure
8161 that it is unique in the current buffer, and insert it with the proper
8162 formatting like @samp{(ref:label)} at the end of the current line. Then the
8163 label is stored as a link @samp{(label)}, for retrieval with @kbd{C-c C-l}.
8167 @node Include files, Tables exported, Literal examples, Markup rules
8168 @subheading Include files
8169 @cindex include files, markup rules
8171 During export, you can include the content of another file. For example, to
8172 include your @file{.emacs} file, you could use:
8176 #+INCLUDE: "~/.emacs" src emacs-lisp
8179 The optional second and third parameter are the markup (@samp{quote},
8180 @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
8181 language for formatting the contents. The markup is optional, if it is not
8182 given, the text will be assumed to be in Org mode format and will be
8183 processed normally. The include line will also allow additional keyword
8184 parameters @code{:prefix1} and @code{:prefix} to specify prefixes for the
8185 first line and for each following line, as well as any options accepted by
8186 the selected markup. For example, to include a file as an item, use
8189 #+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " "
8195 Visit the include file at point.
8198 @node Tables exported, Inlined images, Include files, Markup rules
8200 @cindex tables, markup rules
8202 Both the native Org mode tables (@pxref{Tables}) and tables formatted with
8203 the @file{table.el} package will be exported properly. For Org mode tables,
8204 the lines before the first horizontal separator line will become table header
8205 lines. You can use the following lines somewhere before the table to assign
8206 a caption and a label for cross references:
8209 #+CAPTION: This is the caption for the next table (or link)
8210 #+LABEL: tbl:basic-data
8213 @node Inlined images, Footnote markup, Tables exported, Markup rules
8214 @subheading Inlined Images
8215 @cindex inlined images, markup rules
8217 Some backends (HTML, La@TeX{}, and DocBook) allow you to directly include images
8218 into the exported document. Org does this, if a link to an image files does
8219 not have a description part, for example @code{[[./img/a.jpg]]}. If you wish
8220 to define a caption for the image and maybe a label for internal cross
8221 references, you can use (before, but close to the link)
8224 #+CAPTION: This is the caption for the next figure link (or table)
8225 #+LABEL: fig:SED-HR4049
8228 You may also define additional attributes for the figure. As this is
8229 backend-specific, see the sections about the individual backends for more
8232 @node Footnote markup, Emphasis and monospace, Inlined images, Markup rules
8233 @subheading Footnote markup
8234 @cindex footnotes, markup rules
8235 @cindex @file{footnote.el}
8237 Footnotes defined in the way described in @ref{Footnotes}, will be exported by
8238 all backends. Org allows multiple references to the same note, and
8239 different backends support this to varying degrees.
8241 @node Emphasis and monospace, TeX macros and LaTeX fragments, Footnote markup, Markup rules
8242 @subheading Emphasis and monospace
8244 @cindex underlined text, markup rules
8245 @cindex bold text, markup rules
8246 @cindex italic text, markup rules
8247 @cindex verbatim text, markup rules
8248 @cindex code text, markup rules
8249 @cindex strike-through text, markup rules
8250 You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
8251 and @code{~verbatim~}, and, if you must, @samp{+strike-through+}. Text
8252 in the code and verbatim string is not processed for Org-mode specific
8253 syntax, it is exported verbatim.
8255 @node TeX macros and LaTeX fragments, Horizontal rules, Emphasis and monospace, Markup rules
8256 @subheading @TeX{} macros and La@TeX{} fragments
8257 @cindex La@TeX{} fragments, markup rules
8258 @cindex @TeX{} macros, markup rules
8259 @cindex HTML entities
8260 @cindex La@TeX{} entities
8262 @vindex org-html-entities
8263 A @TeX{}-like syntax is used to specify special characters. Where possible,
8264 these will be transformed into the native format of the exporter backend.
8265 Strings like @code{\alpha} will be exported as @code{α} in the HTML
8266 output, and as @code{$\alpha$} in the La@TeX{} output. Similarly,
8267 @code{\nbsp} will become @code{ } in HTML and @code{~} in La@TeX{}.
8268 This applies for a large number of entities, with names taken from both HTML
8269 and La@TeX{}, see the variable @code{org-html-entities} for the complete
8270 list. If you are unsure about a name, use @kbd{M-@key{TAB}} for completion
8271 after having typed the backslash and optionally a few characters
8272 (@pxref{Completion}).
8274 La@TeX{} fragments are converted into images for HTML export, and they are
8275 written literally into the La@TeX{} export. See also @ref{Embedded LaTeX}.
8277 Finally, @samp{\-} is treated as a shy hyphen, and @samp{--}, @samp{---}, and
8278 @samp{...} are all converted into special commands creating hyphens of
8279 different lengths or a compact set of dots.
8281 @node Horizontal rules, Comment lines, TeX macros and LaTeX fragments, Markup rules
8282 @subheading Horizontal rules
8283 @cindex horizontal rules, markup rules
8284 A line consisting of only dashes, and at least 5 of them, will be
8285 exported as a horizontal line (@samp{<hr/>} in HTML).
8287 @node Comment lines, Macro replacement, Horizontal rules, Markup rules
8288 @subheading Comment lines
8289 @cindex comment lines
8290 @cindex exporting, not
8291 @cindex #+BEGIN_COMMENT
8293 Lines starting with @samp{#} in column zero are treated as comments and will
8294 never be exported. Also entire subtrees starting with the word
8295 @samp{COMMENT} will never be exported. Finally, regions surrounded by
8296 @samp{#+BEGIN_COMMENT} ... @samp{#+END_COMMENT} will not be exported.
8301 Toggle the COMMENT keyword at the beginning of an entry.
8304 @node Macro replacement, , Comment lines, Markup rules
8305 @subheading Macro replacement
8306 @cindex macro replacement, during export
8309 You can define text snippets with
8312 #+MACRO: name replacement text $1, $2 are arguments
8315 @noindent which can be referenced anywhere in the document (even in
8316 code examples) with @code{@{@{@{name(arg1,arg2)@}@}@}}. In addition to
8317 defined macros, @code{@{@{@{title@}@}@}}, @code{@{@{@{author@}@}@}}, etc.,
8318 will reference information set by the @code{#+TITLE:}, @code{#+AUTHOR:}, and
8319 similar lines. Also, @code{@{@{@{date(@var{FORMAT})@}@}@}} and
8320 @code{@{@{@{modification-time(@var{FORMAT})@}@}@}} refer to current date time
8321 and to the modification time of the file being exported, respectively.
8322 @var{FORMAT} should be a format string understood by
8323 @code{format-time-string}.
8325 @node Selective export, Export options, Markup rules, Exporting
8326 @section Selective export
8327 @cindex export, selective by tags
8329 @vindex org-export-select-tags
8330 @vindex org-export-exclude-tags
8331 You may use tags to select the parts of a document that should be exported,
8332 or to exclude parts from export. This behavior is governed by two variables:
8333 @code{org-export-select-tags} and @code{org-export-exclude-tags}.
8335 Org first checks if any of the @emph{select} tags is present in the buffer.
8336 If yes, all trees that do not carry one of these tags will be excluded. If a
8337 selected tree is a subtree, the heading hierarchy above it will also be
8338 selected for export, but not the text below those headings.
8341 If none of the select tags is found, the whole buffer will be selected for
8345 Finally, all subtrees that are marked by any of the @emph{exclude} tags will
8346 be removed from the export buffer.
8348 @node Export options, The export dispatcher, Selective export, Exporting
8349 @section Export options
8350 @cindex options, for export
8352 @cindex completion, of option keywords
8353 The exporter recognizes special lines in the buffer which provide
8354 additional information. These lines may be put anywhere in the file.
8355 The whole set of lines can be inserted into the buffer with @kbd{C-c
8356 C-e t}. For individual lines, a good way to make sure the keyword is
8357 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
8358 (@pxref{Completion}). For a summary of other in-buffer settings not
8359 specifically related to export, see @ref{In-buffer settings}.
8360 In particular, note that you can place commonly-used (export) options in
8361 a separate file which can be included using @code{#+SETUPFILE}.
8366 Insert template with export options, see example below.
8373 @cindex #+DESCRIPTION
8380 @cindex #+EXPORT_SELECT_TAGS
8381 @cindex #+EXPORT_EXCLUDE_TAGS
8382 @cindex #+LATEX_HEADER
8383 @vindex user-full-name
8384 @vindex user-mail-address
8385 @vindex org-export-default-language
8387 #+TITLE: the title to be shown (default is the buffer name)
8388 #+AUTHOR: the author (default taken from @code{user-full-name})
8389 #+DATE: a date, fixed, of a format string for @code{format-time-string}
8390 #+EMAIL: his/her email address (default from @code{user-mail-address})
8391 #+DESCRIPTION: the page description, @eg for the XHTML meta tag
8392 #+KEYWORDS: the page keywords, @eg for the XHTML meta tag
8393 #+LANGUAGE: language for HTML, @eg @samp{en} (@code{org-export-default-language})
8394 #+TEXT: Some descriptive text to be inserted at the beginning.
8395 #+TEXT: Several lines may be given.
8396 #+OPTIONS: H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
8397 #+LINK_UP: the ``up'' link of an exported page
8398 #+LINK_HOME: the ``home'' link of an exported page
8399 #+LATEX_HEADER: extra line(s) for the LaTeX header, like \usepackage@{xyz@}
8400 #+EXPORT_SELECT_TAGS: Tags that select a tree for export
8401 #+EXPORT_EXCLUDE_TAGS: Tags that exclude a tree from export
8405 The OPTIONS line is a compact@footnote{If you want to configure many options
8406 this way, you can use several OPTIONS lines.} form to specify export settings. Here
8408 @cindex headline levels
8409 @cindex section-numbers
8410 @cindex table of contents
8411 @cindex line-break preservation
8412 @cindex quoted HTML tags
8413 @cindex fixed-width sections
8415 @cindex @TeX{}-like syntax for sub- and superscripts
8417 @cindex special strings
8418 @cindex emphasized text
8419 @cindex @TeX{} macros
8420 @cindex La@TeX{} fragments
8421 @cindex author info, in export
8422 @cindex time info, in export
8424 H: @r{set the number of headline levels for export}
8425 num: @r{turn on/off section-numbers}
8426 toc: @r{turn on/off table of contents, or set level limit (integer)}
8427 \n: @r{turn on/off line-break-preservation}
8428 @@: @r{turn on/off quoted HTML tags}
8429 :: @r{turn on/off fixed-width sections}
8430 |: @r{turn on/off tables}
8431 ^: @r{turn on/off @TeX{}-like syntax for sub- and superscripts. If}
8432 @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
8433 @r{the simple @code{a_b} will be left as it is.}
8434 -: @r{turn on/off conversion of special strings.}
8435 f: @r{turn on/off footnotes like this[1].}
8436 todo: @r{turn on/off inclusion of TODO keywords into exported text}
8437 pri: @r{turn on/off priority cookies}
8438 tags: @r{turn on/off inclusion of tags, may also be @code{not-in-toc}}
8439 <: @r{turn on/off inclusion of any time/date stamps like DEADLINES}
8440 *: @r{turn on/off emphasized text (bold, italic, underlined)}
8441 TeX: @r{turn on/off simple @TeX{} macros in plain text}
8442 LaTeX: @r{turn on/off La@TeX{} fragments}
8443 skip: @r{turn on/off skipping the text before the first heading}
8444 author: @r{turn on/off inclusion of author name/email into exported file}
8445 creator: @r{turn on/off inclusion of creator info into exported file}
8446 timestamp: @r{turn on/off inclusion creation time into exported file}
8447 d: @r{turn on/off inclusion of drawers}
8450 These options take effect in both the HTML and La@TeX{} export, except
8451 for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
8452 @code{nil} for the La@TeX{} export.
8454 When exporting only a single subtree by selecting it with @kbd{C-c @@} before
8455 calling an export command, the subtree can overrule some of the file's export
8456 settings with properties @code{EXPORT_FILE_NAME}, @code{EXPORT_TITLE},
8457 @code{EXPORT_TEXT}, @code{EXPORT_AUTHOR}, @code{EXPORT_DATE}, and
8458 @code{EXPORT_OPTIONS}.
8460 @node The export dispatcher, ASCII export, Export options, Exporting
8461 @section The export dispatcher
8462 @cindex dispatcher, for export commands
8464 All export commands can be reached using the export dispatcher, which is a
8465 prefix key that prompts for an additional key specifying the command.
8466 Normally the entire file is exported, but if there is an active region that
8467 contains one outline tree, the first heading is used as document title and
8468 the subtrees are exported.
8473 @vindex org-export-run-in-background
8474 Dispatcher for export and publishing commands. Displays a help-window
8475 listing the additional key(s) needed to launch an export or publishing
8476 command. The prefix arg is passed through to the exporter. A double prefix
8477 @kbd{C-u C-u} causes most commands to be executed in the background, in a
8478 separate Emacs process@footnote{To make this behavior the default, customize
8479 the variable @code{org-export-run-in-background}.}.
8482 Like @kbd{C-c C-e}, but only export the text that is currently visible
8483 (@ie not hidden by outline visibility).
8484 @kindex C-u C-u C-c C-e
8485 @item C-u C-u C-c C-e
8486 @vindex org-export-run-in-background
8487 Call an the exporter, but reverse the setting of
8488 @code{org-export-run-in-background}, @ie request background processing if
8489 not set, or force processing in the current Emacs process if set.
8492 @node ASCII export, HTML export, The export dispatcher, Exporting
8493 @section ASCII export
8494 @cindex ASCII export
8496 ASCII export produces a simple and very readable version of an Org-mode
8499 @cindex region, active
8500 @cindex active region
8501 @cindex transient-mark-mode
8505 @cindex property, EXPORT_FILE_NAME
8506 Export as ASCII file. For an Org file, @file{myfile.org}, the ASCII file
8507 will be @file{myfile.txt}. The file will be overwritten without
8508 warning. If there is an active region@footnote{This requires
8509 @code{transient-mark-mode} be turned on.}, only the region will be
8510 exported. If the selected region is a single tree@footnote{To select the
8511 current subtree, use @kbd{C-c @@}.}, the tree head will
8512 become the document title. If the tree head entry has or inherits an
8513 @code{EXPORT_FILE_NAME} property, that name will be used for the
8517 Export to a temporary buffer, do not create a file.
8520 Export only the visible part of the document.
8523 @cindex headline levels, for exporting
8524 In the exported version, the first 3 outline levels will become
8525 headlines, defining a general document structure. Additional levels
8526 will be exported as itemized lists. If you want that transition to occur
8527 at a different level, specify it with a prefix argument. For example,
8534 creates only top level headlines and does the rest as items. When
8535 headlines are converted to items, the indentation of the text following
8536 the headline is changed to fit nicely under the item. This is done with
8537 the assumption that the first body line indicates the base indentation of
8538 the body text. Any indentation larger than this is adjusted to preserve
8539 the layout relative to the first line. Should there be lines with less
8540 indentation than the first, these are left alone.
8542 @vindex org-export-ascii-links-to-notes
8543 Links will be exported in a footnote-like style, with the descriptive part in
8544 the text and the link in a note before the next heading. See the variable
8545 @code{org-export-ascii-links-to-notes} for details and other options.
8547 @node HTML export, LaTeX and PDF export, ASCII export, Exporting
8548 @section HTML export
8551 Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
8552 HTML formatting, in ways similar to John Gruber's @emph{markdown}
8553 language, but with additional support for tables.
8556 * HTML Export commands:: How to invoke HTML export
8557 * Quoting HTML tags:: Using direct HTML in Org mode
8558 * Links:: Transformation of links for HTML
8559 * Tables in HTML export:: How to modify the formatting of tables
8560 * Images in HTML export:: How to insert figures into HTML output
8561 * Text areas in HTML export:: An alternative way to show an example
8562 * CSS support:: Changing the appearance of the output
8563 * Javascript support:: Info and Folding in a web browser
8566 @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
8567 @subsection HTML export commands
8569 @cindex region, active
8570 @cindex active region
8571 @cindex transient-mark-mode
8575 @cindex property, EXPORT_FILE_NAME
8576 Export as HTML file @file{myfile.html}. For an Org file @file{myfile.org},
8577 the ASCII file will be @file{myfile.html}. The file will be overwritten
8578 without warning. If there is an active region@footnote{This requires
8579 @code{transient-mark-mode} be turned on.}, only the region will be
8580 exported. If the selected region is a single tree@footnote{To select the
8581 current subtree, use @kbd{C-c @@}.}, the tree head will become the document
8582 title. If the tree head entry has, or inherits, an @code{EXPORT_FILE_NAME}
8583 property, that name will be used for the export.
8586 Export as HTML file and immediately open it with a browser.
8589 Export to a temporary buffer, do not create a file.
8592 Export the active region to a temporary buffer. With a prefix argument, do
8593 not produce the file header and footer, but just the plain HTML section for
8594 the region. This is good for cut-and-paste operations.
8603 Export only the visible part of the document.
8604 @item M-x org-export-region-as-html
8605 Convert the region to HTML under the assumption that it was Org-mode
8606 syntax before. This is a global command that can be invoked in any
8608 @item M-x org-replace-region-by-HTML
8609 Replace the active region (assumed to be in Org-mode syntax) by HTML
8613 @cindex headline levels, for exporting
8614 In the exported version, the first 3 outline levels will become headlines,
8615 defining a general document structure. Additional levels will be exported as
8616 itemized lists. If you want that transition to occur at a different level,
8617 specify it with a numeric prefix argument. For example,
8624 creates two levels of headings and does the rest as items.
8626 @node Quoting HTML tags, Links, HTML Export commands, HTML export
8627 @subsection Quoting HTML tags
8629 Plain @samp{<} and @samp{>} are always transformed to @samp{<} and
8630 @samp{>} in HTML export. If you want to include simple HTML tags
8631 which should be interpreted as such, mark them with @samp{@@} as in
8632 @samp{@@<b>bold text@@</b>}. Note that this really works only for
8633 simple tags. For more extensive HTML that should be copied verbatim to
8634 the exported file use either
8637 @cindex #+BEGIN_HTML
8639 #+HTML: Literal HTML code for export
8643 @cindex #+BEGIN_HTML
8647 All lines between these markers are exported literally
8652 @node Links, Tables in HTML export, Quoting HTML tags, HTML export
8655 @cindex links, in HTML export
8656 @cindex internal links, in HTML export
8657 @cindex external links, in HTML export
8658 Internal links (@pxref{Internal links}) will continue to work in HTML. This
8659 includes automatic links created by radio targets (@pxref{Radio
8660 targets}). Links to external files will still work if the target file is on
8661 the same @i{relative} path as the published Org file. Links to other
8662 @file{.org} files will be translated into HTML links under the assumption
8663 that an HTML version also exists of the linked file, at the same relative
8664 path. @samp{id:} links can then be used to jump to specific entries across
8665 files. For information related to linking files while publishing them to a
8666 publishing directory see @ref{Publishing links}.
8668 If you want to specify attributes for links, you can do so using a special
8669 @code{#+ATTR_HTML} line to define attributes that will be added to the
8670 @code{<a>} or @code{<img>} tags. Here is an example that sets @code{title}
8671 and @code{style} attributes for a link:
8675 #+ATTR_HTML: title="The Org-mode homepage" style="color:red;"
8676 [[http://orgmode.org]]
8679 @node Tables in HTML export, Images in HTML export, Links, HTML export
8681 @cindex tables, in HTML
8682 @vindex org-export-html-table-tag
8684 Org-mode tables are exported to HTML using the table tag defined in
8685 @code{org-export-html-table-tag}. The default setting makes tables without
8686 cell borders and frame. If you would like to change this for individual
8687 tables, place somthing like the following before the table:
8691 #+CAPTION: This is a table with lines around and between cells
8692 #+ATTR_HTML: border="2" rules="all" frame="all"
8695 @node Images in HTML export, Text areas in HTML export, Tables in HTML export, HTML export
8698 @cindex images, inline in HTML
8699 @cindex inlining images in HTML
8700 @vindex org-export-html-inline-images
8701 HTML export can inline images given as links in the Org file, and
8702 it can make an image the clickable part of a link. By
8703 default@footnote{But see the variable
8704 @code{org-export-html-inline-images}.}, images are inlined if a link does
8705 not have a description. So @samp{[[file:myimg.jpg]]} will be inlined,
8706 while @samp{[[file:myimg.jpg][the image]]} will just produce a link
8707 @samp{the image} that points to the image. If the description part
8708 itself is a @code{file:} link or a @code{http:} URL pointing to an
8709 image, this image will be inlined and activated so that clicking on the
8710 image will activate the link. For example, to include a thumbnail that
8711 will link to a high resolution version of the image, you could use:
8714 [[file:highres.jpg][file:thumb.jpg]]
8717 If you need to add attributes to an inlines image, use a @code{#+ATTR_HTML},
8722 #+CAPTION: A black cat stalking a spider
8723 #+ATTR_HTML: alt="cat/spider image" title="one second before action"
8728 and you could use @code{http} addresses just as well.
8730 @node Text areas in HTML export, CSS support, Images in HTML export, HTML export
8731 @subsection Text areas
8733 @cindex text areas, in HTML
8734 An alternative way to publish literal code examples in HTML is to use text
8735 areas, where the example can even be edited before pasting it into an
8736 application. It is triggered by a @code{-t} switch at an @code{example} or
8737 @code{src} block. Using this switch disables any options for syntax and
8738 label highlighting, and line numbering, which may be present. You may also
8739 use @code{-h} and @code{-w} switches to specify the height and width of the
8740 text area, which default to the number of lines in the example, and 80,
8741 respectively. For example
8744 #+BEGIN_EXAMPLE -t -w 40
8745 (defun org-xor (a b)
8752 @node CSS support, Javascript support, Text areas in HTML export, HTML export
8753 @subsection CSS support
8754 @cindex CSS, for HTML export
8755 @cindex HTML export, CSS
8757 @vindex org-export-html-todo-kwd-class-prefix
8758 @vindex org-export-html-tag-class-prefix
8759 You can also give style information for the exported file. The HTML exporter
8760 assigns the following special CSS classes@footnote{If the classes on TODO
8761 keywords and tags lead to conflicts, use the variables
8762 @code{org-export-html-todo-kwd-class-prefix} and
8763 @code{org-export-html-tag-class-prefix} to make them unique.} to appropriate
8764 parts of the document---your style specifications may change these, in
8765 addition to any of the standard classes like for headlines, tables, etc.
8767 p.author @r{author information, including email}
8768 p.date @r{publishing date}
8769 p.creator @r{creator info, about org-mode version}
8770 .title @r{document title}
8771 .todo @r{TODO keywords, all not-done states}
8772 .done @r{the DONE keywords, all stated the count as done}
8773 .WAITING @r{each TODO keyword also uses a class named after itself}
8774 .timestamp @r{timestamp}
8775 .timestamp-kwd @r{keyword associated with a timestamp, like SCHEDULED}
8776 .timestamp-wrapper @r{span around keyword plus timestamp}
8777 .tag @r{tag in a headline}
8778 ._HOME @r{each tag uses itself as a class, "@@" replaced by "_"}
8779 .target @r{target for links}
8780 .linenr @r{the line number in a code example}
8781 .code-highlighted @r{for highlighting referenced code lines}
8782 div.outline-N @r{div for outline level N (headline plus text))}
8783 div.outline-text-N @r{extra div for text at outline level N}
8784 .section-number-N @r{section number in headlines, different for each level}
8785 div.figure @r{how to format an inlined image}
8786 pre.src @r{formatted source code}
8787 pre.example @r{normal example}
8788 p.verse @r{verse paragraph}
8789 div.footnotes @r{footnote section headline}
8790 p.footnote @r{footnote definition paragraph, containing a footnote}
8791 .footref @r{a footnote reference number (always a <sup>)}
8792 .footnum @r{footnote number in footnote definition (always <sup>)}
8795 @vindex org-export-html-style-default
8796 @vindex org-export-html-style-include-default
8797 @vindex org-export-html-style
8798 @vindex org-export-html-extra
8799 @vindex org-export-html-style-default
8800 Each exported file contains a compact default style that defines these
8801 classes in a basic way@footnote{This style is defined in the constant
8802 @code{org-export-html-style-default}, which you should not modify. To turn
8803 inclusion of these defaults off, customize
8804 @code{org-export-html-style-include-default}}. You may overwrite these
8805 settings, or add to them by using the variables @code{org-export-html-style}
8806 (for Org-wide settings) and @code{org-export-html-style-extra} (for more
8807 granular settings, like file-local settings). To set the latter variable
8808 individually for each file, you can use
8812 #+STYLE: <link rel="stylesheet" type="text/css" href="stylesheet.css" />
8816 For longer style definitions, you can use several such lines. You could also
8817 directly write a @code{<style>} @code{</style>} section in this way, without
8818 referring to an external file.
8820 @c FIXME: More about header and footer styles
8821 @c FIXME: Talk about links and targets.
8823 @node Javascript support, , CSS support, HTML export
8824 @subsection Javascript supported display of web pages
8826 @cindex Rose, Sebastian
8827 Sebastian Rose has written a JavaScript program especially designed to
8828 enhance the web viewing experience of HTML files created with Org. This
8829 program allows you to view large files in two different ways. The first one
8830 is an @emph{Info}-like mode where each section is displayed separately and
8831 navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
8832 as well, press @kbd{?} for an overview of the available keys). The second
8833 view type is a @emph{folding} view much like Org provides inside Emacs. The
8834 script is available at @url{http://orgmode.org/org-info.js} and you can find
8835 the documentation for it at @url{http://orgmode.org/worg/code/org-info-js/}.
8836 We host the script at our site, but if you use it a lot, you might
8837 not want to be dependent on @url{orgmode.org} and prefer to install a local
8838 copy on your own web server.
8840 To use the script, you need to make sure that the @file{org-jsinfo.el} module
8841 gets loaded. It should be loaded by default, but you can try @kbd{M-x
8842 customize-variable @key{RET} org-modules @key{RET}} to convince yourself that
8843 this is indeed the case. All it then takes to make use of the program is
8844 adding a single line to the Org file:
8846 @cindex #+INFOJS_OPT
8848 #+INFOJS_OPT: view:info toc:nil
8852 If this line is found, the HTML header will automatically contain the code
8853 needed to invoke the script. Using the line above, you can set the following
8857 path: @r{The path to the script. The default is to grab the script from}
8858 @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
8859 @r{a local copy and use a path like @samp{../scripts/org-info.js}.}
8860 view: @r{Initial view when website is first shown. Possible values are:}
8861 info @r{Info-like interface with one section per page.}
8862 overview @r{Folding interface, initially showing only top-level.}
8863 content @r{Folding interface, starting with all headlines visible.}
8864 showall @r{Folding interface, all headlines and text visible.}
8865 sdepth: @r{Maximum headline level that will still become an independent}
8866 @r{section for info and folding modes. The default is taken from}
8867 @r{@code{org-headline-levels} (= the @code{H} switch in @code{#+OPTIONS}).}
8868 @r{If this is smaller than in @code{org-headline-levels}, each}
8869 @r{info/folding section can still contain child headlines.}
8870 toc: @r{Should the table of content @emph{initially} be visible?}
8871 @r{Even when @code{nil}, you can always get to the "toc" with @kbd{i}.}
8872 tdepth: @r{The depth of the table of contents. The defaults are taken from}
8873 @r{the variables @code{org-headline-levels} and @code{org-export-with-toc}.}
8874 ftoc: @r{Does the css of the page specify a fixed position for the "toc"?}
8875 @r{If yes, the toc will never be displayed as a section.}
8876 ltoc: @r{Should there be short contents (children) in each section?}
8877 @r{Make this @code{above} if the section should be above initial text.}
8878 mouse: @r{Headings are highlighted when the mouse is over them. Should be}
8879 @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
8880 buttons: @r{Should view-toggle buttons be everywhere? When @code{nil} (the}
8881 @r{default), only one such button will be present.}
8884 @vindex org-infojs-options
8885 @vindex org-export-html-use-infojs
8886 You can choose default values for these options by customizing the variable
8887 @code{org-infojs-options}. If you always want to apply the script to your
8888 pages, configure the variable @code{org-export-html-use-infojs}.
8890 @node LaTeX and PDF export, DocBook export, HTML export, Exporting
8891 @section La@TeX{} and PDF export
8892 @cindex La@TeX{} export
8894 @cindex Guerry, Bastian
8896 Org mode contains a La@TeX{} exporter written by Bastien Guerry. With
8897 further processing, this backend is also used to produce PDF output. Since
8898 the La@TeX{} output uses @file{hyperref} to implement links and cross
8899 references, the PDF output file will be fully linked.
8902 * LaTeX/PDF export commands:: Which key invokes which commands
8903 * Quoting LaTeX code:: Incorporating literal La@TeX{} code
8904 * Sectioning structure:: Changing sectioning in La@TeX{} output
8905 * Tables in LaTeX export:: Options for exporting tables to La@TeX{}
8906 * Images in LaTeX export:: How to insert figures into La@TeX{} output
8909 @node LaTeX/PDF export commands, Quoting LaTeX code, LaTeX and PDF export, LaTeX and PDF export
8910 @subsection La@TeX{} export commands
8912 @cindex region, active
8913 @cindex active region
8914 @cindex transient-mark-mode
8918 @cindex property EXPORT_FILE_NAME
8919 Export as La@TeX{} file @file{myfile.tex}. For an Org file
8920 @file{myfile.org}, the ASCII file will be @file{myfile.tex}. The file will
8921 be overwritten without warning. If there is an active region@footnote{This
8922 requires @code{transient-mark-mode} be turned on.}, only the region will be
8923 exported. If the selected region is a single tree@footnote{To select the
8924 current subtree, use @kbd{C-c @@}.}, the tree head will become the document
8925 title. If the tree head entry has or inherits an @code{EXPORT_FILE_NAME}
8926 property, that name will be used for the export.
8929 Export to a temporary buffer, do not create a file.
8934 Export only the visible part of the document.
8935 @item M-x org-export-region-as-latex
8936 Convert the region to La@TeX{} under the assumption that it was Org mode
8937 syntax before. This is a global command that can be invoked in any
8939 @item M-x org-replace-region-by-latex
8940 Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
8944 Export as La@TeX{} and then process to PDF.
8947 Export as La@TeX{} and then process to PDF, then open the resulting PDF file.
8950 @cindex headline levels, for exporting
8951 @vindex org-latex-low-levels
8952 In the exported version, the first 3 outline levels will become
8953 headlines, defining a general document structure. Additional levels
8954 will be exported as description lists. The exporter can ignore them or
8955 convert them to a custom string depending on
8956 @code{org-latex-low-levels}.
8958 If you want that transition to occur at a different level, specify it
8959 with a numeric prefix argument. For example,
8966 creates two levels of headings and does the rest as items.
8968 @node Quoting LaTeX code, Sectioning structure, LaTeX/PDF export commands, LaTeX and PDF export
8969 @subsection Quoting La@TeX{} code
8971 Embedded La@TeX{} as described in @ref{Embedded LaTeX}, will be correctly
8972 inserted into the La@TeX{} file. This includes simple macros like
8973 @samp{\ref@{LABEL@}} to create a cross reference to a figure. Furthermore,
8974 you can add special code that should only be present in La@TeX{} export with
8975 the following constructs:
8978 @cindex #+BEGIN_LaTeX
8980 #+LaTeX: Literal LaTeX code for export
8984 @cindex #+BEGIN_LaTeX
8988 All lines between these markers are exported literally
8992 @node Sectioning structure, Tables in LaTeX export, Quoting LaTeX code, LaTeX and PDF export
8993 @subsection Sectioning structure
8994 @cindex La@TeX{} class
8995 @cindex La@TeX{} sectioning structure
8997 By default, the La@TeX{} output uses the class @code{article}.
8999 @vindex org-export-latex-default-class
9000 @vindex org-export-latex-classes
9001 @cindex #+LATEX_HEADER
9002 @cindex #+LATEX_CLASS
9003 @cindex property, LATEX_CLASS
9004 You can change this globally by setting a different value for
9005 @code{org-export-latex-default-class} or locally by adding an option like
9006 @code{#+LaTeX_CLASS: myclass} in your file, or with a @code{:LaTeX_CLASS:}
9007 property that applies when exporting a region containing only this (sub)tree.
9008 The class should be listed in @code{org-export-latex-classes}, where you can
9009 also define the sectioning structure for each class, as well as defining
9010 additional classes. You can also use @code{#+LATEX_HEADER:
9011 \usepackage@{xyz@}} to add lines to the header.
9013 @node Tables in LaTeX export, Images in LaTeX export, Sectioning structure, LaTeX and PDF export
9014 @subsection Tables in La@TeX{} export
9015 @cindex tables, in La@TeX{} export
9017 For La@TeX{} export of a table, you can specify a label and a caption
9018 (@pxref{Markup rules}). You can also use the @code{ATTR_LaTeX} line to
9019 request a longtable environment for the table, so that it may span several
9020 pages. Finally, you can set the alignment string:
9024 @cindex #+ATTR_LaTeX
9026 #+CAPTION: A long table
9028 #+ATTR_LaTeX: longtable align=l|lp@{3cm@}r|l
9034 @node Images in LaTeX export, , Tables in LaTeX export, LaTeX and PDF export
9035 @subsection Images in La@TeX{} export
9036 @cindex images, inline in La@TeX{}
9037 @cindex inlining images in La@TeX{}
9039 Images that are linked to without a description part in the link, like
9040 @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]} will be inserted into the PDF
9041 output files resulting from La@TeX{} output. Org will use an
9042 @code{\includegraphics} macro to insert the image. If you have specified a
9043 caption and/or a label as described in @ref{Markup rules}, the figure will
9044 be wrapped into a @code{figure} environment and thus become a floating
9045 element. Finally, you can use an @code{#+ATTR_LaTeX:} line to specify the
9046 options that can be used in the optional argument of the
9047 @code{\includegraphics} macro.
9051 @cindex #+ATTR_LaTeX
9053 #+CAPTION: The black-body emission of the disk around HR 4049
9054 #+LABEL: fig:SED-HR4049
9055 #+ATTR_LaTeX: width=5cm,angle=90
9056 [[./img/sed-hr4049.pdf]]
9059 @vindex org-export-latex-inline-image-extensions
9060 If you need references to a label created in this way, write
9061 @samp{\ref@{fig:SED-HR4049@}} just like in La@TeX{}. The default settings will
9062 recognize files types that can be included as images during processing by
9063 @command{pdflatex} (@file{png}, @file{jpg}, and @file{pdf} files). If you process your
9064 files in a different way, you may need to customize the variable
9065 @code{org-export-latex-inline-image-extensions}.
9067 @node DocBook export, XOXO export, LaTeX and PDF export, Exporting
9068 @section DocBook export
9069 @cindex DocBook export
9073 Org contains a DocBook exporter written by Baoqiu Cui. Once an Org file is
9074 exported to DocBook format, it can be further processed to produce other
9075 formats, including PDF, HTML, man pages, etc., using many available DocBook
9076 tools and stylesheets.
9078 Currently DocBook exporter only supports DocBook V5.0.
9081 * DocBook export commands:: How to invoke DocBook export
9082 * Quoting DocBook code:: Incorporating DocBook code in Org files
9083 * Recursive sections:: Recursive sections in DocBook
9084 * Tables in DocBook export:: Tables are exported as HTML tables
9085 * Images in DocBook export:: How to insert figures into DocBook output
9086 * Special characters:: How to handle special characters
9089 @node DocBook export commands, Quoting DocBook code, DocBook export, DocBook export
9090 @subsection DocBook export commands
9092 @cindex region, active
9093 @cindex active region
9094 @cindex transient-mark-mode
9098 @cindex property EXPORT_FILE_NAME
9099 Export as DocBook file. For an Org file, @file{myfile.org}, the DocBook XML
9100 file will be @file{myfile.xml}. The file will be overwritten without
9101 warning. If there is an active region@footnote{This requires
9102 @code{transient-mark-mode} to be turned on}, only the region will be
9103 exported. If the selected region is a single tree@footnote{To select the
9104 current subtree, use @kbd{C-c @@}.}, the tree head will become the document
9105 title. If the tree head entry has, or inherits, an @code{EXPORT_FILE_NAME}
9106 property, that name will be used for the export.
9109 Export as DocBook file, process to PDF, then open the resulting PDF file.
9111 @vindex org-export-docbook-xslt-proc-command
9112 @vindex org-export-docbook-xsl-fo-proc-command
9113 Note that, in order to produce PDF output based on exported DocBook file, you
9114 need to have XSLT processor and XSL-FO processor software installed on your
9115 system. Check variables @code{org-export-docbook-xslt-proc-command} and
9116 @code{org-export-docbook-xsl-fo-proc-command}.
9120 Export only the visible part of the document.
9123 @node Quoting DocBook code, Recursive sections, DocBook export commands, DocBook export
9124 @subsection Quoting DocBook code
9126 You can quote DocBook code in Org files and copy it verbatim into exported
9127 DocBook file with the following constructs:
9130 @cindex #+BEGIN_DOCBOOK
9132 #+DOCBOOK: Literal DocBook code for export
9136 @cindex #+BEGIN_DOCBOOK
9140 All lines between these markers are exported by DocBook exporter
9145 For example, you can use the following lines to include a DocBook warning
9146 admonition. As to what this warning says, you should pay attention to the
9147 document context when quoting DocBook code in Org files. You may make
9148 exported DocBook XML files invalid by not quoting DocBook code correctly.
9153 <para>You should know what you are doing when quoting DocBook XML code
9154 in your Org file. Invalid DocBook XML file may be generated by
9155 DocBook exporter if you are not careful!</para>
9160 @node Recursive sections, Tables in DocBook export, Quoting DocBook code, DocBook export
9161 @subsection Recursive sections
9162 @cindex DocBook recursive sections
9164 DocBook exporter exports Org files as articles using the @code{article}
9165 element in DocBook. Recursive sections, @ie @code{section} elements, are
9166 used in exported articles. Top level headlines in Org files are exported as
9167 top level sections, and lower level headlines are exported as nested
9168 sections. The entire structure of Org files will be exported completely, no
9169 matter how many nested levels of headlines there are.
9171 Using recursive sections makes it easy to port and reuse exported DocBook
9172 code in other DocBook document types like @code{book} or @code{set}.
9174 @node Tables in DocBook export, Images in DocBook export, Recursive sections, DocBook export
9175 @subsection Tables in DocBook export
9176 @cindex tables, in DocBook export
9178 Tables in Org files are exported as HTML tables, which have been supported since
9181 If a table does not have a caption, an informal table is generated using the
9182 @code{informaltable} element; otherwise, a formal table will be generated
9183 using the @code{table} element.
9185 @node Images in DocBook export, Special characters, Tables in DocBook export, DocBook export
9186 @subsection Images in DocBook export
9187 @cindex images, inline in DocBook
9188 @cindex inlining images in DocBook
9190 Images that are linked to without a description part in the link, like
9191 @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]}, will be exported to DocBook
9192 using @code{mediaobject} elements. Each @code{mediaobject} element contains
9193 an @code{imageobject} that wraps an @code{imagedata} element. If you have
9194 specified a caption for an image as described in @ref{Markup rules}, a
9195 @code{caption} element will be added in @code{mediaobject}. If a label is
9196 also specified, it will be exported as an @code{xml:id} attribute of the
9197 @code{mediaobject} element.
9199 @vindex org-export-docbook-default-image-attributes
9200 Image attributes supported by the @code{imagedata} element, like @code{align}
9201 or @code{width}, can be specified in two ways: you can either customize
9202 variable @code{org-export-docbook-default-image-attributes} or use the
9203 @code{#+ATTR_DOCBOOK:} line. Attributes sepcified in variable
9204 @code{org-export-docbook-default-image-attributes} are applied to all inline
9205 images in the Org file to be exported (unless they are overwritten by image
9206 attributes specified in @code{#+ATTR_DOCBOOK:} lines).
9208 The @code{#+ATTR_DOCBOOK:} line can be used to specify additional image
9209 attributes or overwrite default image attributes for individual images. If
9210 the same attribute appears in both the @code{#+ATTR_DOCBOOK:} line and
9211 variable @code{org-export-docbook-default-image-attributes}, the former
9212 overwrites the latter. Here is an example about how image attributes can be
9217 @cindex #+ATTR_DOCBOOK
9219 #+CAPTION: The logo of Org mode
9220 #+LABEL: unicorn-svg
9221 #+ATTR_DOCBOOK: scalefit="1" width="100%" depth="100%"
9222 [[./img/org-mode-unicorn.svg]]
9225 @vindex org-export-docbook-inline-image-extensions
9226 By default, DocBook exporter recognizes the following image file types:
9227 @file{jpeg}, @file{jpg}, @file{png}, @file{gif}, and @file{svg}. You can
9228 customize variable @code{org-export-docbook-inline-image-extensions} to add
9229 more types to this list as long as DocBook supports them.
9231 @node Special characters, , Images in DocBook export, DocBook export
9232 @subsection Special characters in DocBook export
9233 @cindex Special characters in DocBook export
9235 @vindex org-export-docbook-doctype
9236 @vindex org-html-entities
9237 Special characters that are written in @TeX{}-like syntax, such as @code{\alpha},
9238 @code{\Gamma}, and @code{\Zeta}, are supported by DocBook exporter. These
9239 characters are rewritten to XML entities, like @code{α},
9240 @code{Γ}, and @code{Ζ}, based on the list saved in variable
9241 @code{org-html-entities}. As long as the generated DocBook file includes the
9242 corresponding entities, these special characters are recognized.
9244 You can customize variable @code{org-export-docbook-doctype} to include the
9245 entities you need. For example, you can set variable
9246 @code{org-export-docbook-doctype} to the following value to recognize all
9247 special characters included in XHTML entities:
9250 "<!DOCTYPE article [
9251 <!ENTITY % xhtml1-symbol PUBLIC
9252 \"-//W3C//ENTITIES Symbol for HTML//EN//XML\"
9253 \"http://www.w3.org/2003/entities/2007/xhtml1-symbol.ent\"
9260 @node XOXO export, iCalendar export, DocBook export, Exporting
9261 @section XOXO export
9264 Org mode contains an exporter that produces XOXO-style output.
9265 Currently, this exporter only handles the general outline structure and
9266 does not interpret any additional Org-mode features.
9271 Export as XOXO file @file{myfile.html}.
9274 Export only the visible part of the document.
9277 @node iCalendar export, , XOXO export, Exporting
9278 @section iCalendar export
9279 @cindex iCalendar export
9281 @vindex org-icalendar-include-todo
9282 @vindex org-icalendar-use-deadline
9283 @vindex org-icalendar-use-scheduled
9284 @vindex org-icalendar-categories
9285 Some people use Org mode for keeping track of projects, but still prefer a
9286 standard calendar application for anniversaries and appointments. In this
9287 case it can be useful to show deadlines and other time-stamped items in Org
9288 files in the calendar application. Org mode can export calendar information
9289 in the standard iCalendar format. If you also want to have TODO entries
9290 included in the export, configure the variable
9291 @code{org-icalendar-include-todo}. Plain timestamps are exported as VEVENT,
9292 and TODO items as VTODO. It will also create events from deadlines that are
9293 in non-TODO items. Deadlines and scheduling dates in TODO items will be used
9294 to set the start and due dates for the TODO entry@footnote{See the variables
9295 @code{org-icalendar-use-deadline} and @code{org-icalendar-use-scheduled}.}.
9296 As categories, it will use the tags locally defined in the heading, and the
9297 file/tree category@footnote{To add inherited tags or the TODO state,
9298 configure the variable @code{org-icalendar-categories}.}.
9300 @vindex org-icalendar-store-UID
9301 @cindex property, ID
9302 The iCalendar standard requires each entry to have a globally unique
9303 identifier (UID). Org creates these identifiers during export. If you set
9304 the variable @code{org-icalendar-store-UID}, the UID will be stored in the
9305 @code{:ID:} property of the entry and re-used next time you report this
9306 entry. Since a single entry can give rise to multiple iCalendar entries (as
9307 a timestamp, a deadline, a scheduled item, and as a TODO item), Org adds
9308 prefixes to the UID, depending on what triggered the inclusion of the entry.
9309 In this way the UID remains unique, but a synchronization program can still
9310 figure out from which entry all the different instances originate.
9315 Create iCalendar entries for the current file and store them in the same
9316 directory, using a file extension @file{.ics}.
9319 @vindex org-agenda-files
9320 Like @kbd{C-c C-e i}, but do this for all files in
9321 @code{org-agenda-files}. For each of these files, a separate iCalendar
9322 file will be written.
9325 @vindex org-combined-agenda-icalendar-file
9326 Create a single large iCalendar file from all files in
9327 @code{org-agenda-files} and write it to the file given by
9328 @code{org-combined-agenda-icalendar-file}.
9331 @vindex org-use-property-inheritance
9332 @vindex org-icalendar-include-body
9333 @cindex property, SUMMARY
9334 @cindex property, DESCRIPTION
9335 @cindex property, LOCATION
9336 The export will honor SUMMARY, DESCRIPTION and LOCATION@footnote{The LOCATION
9337 property can be inherited from higher in the hierarchy if you configure
9338 @code{org-use-property-inheritance} accordingly.} properties if the selected
9339 entries have them. If not, the summary will be derived from the headline,
9340 and the description from the body (limited to
9341 @code{org-icalendar-include-body} characters).
9343 How this calendar is best read and updated, depends on the application
9344 you are using. The FAQ covers this issue.
9346 @node Publishing, Miscellaneous, Exporting, Top
9349 @cindex O'Toole, David
9351 Org includes a publishing management system that allows you to configure
9352 automatic HTML conversion of @emph{projects} composed of interlinked org
9353 files. You can also configure Org to automatically upload your exported HTML
9354 pages and related attachments, such as images and source code files, to a web
9357 You can also use Org to convert files into PDF, or even combine HTML and PDF
9358 conversion so that files are available in both formats on the server.
9360 Publishing has been contributed to Org by David O'Toole.
9363 * Configuration:: Defining projects
9364 * Uploading files:: How to get files up on the server
9365 * Sample configuration:: Example projects
9366 * Triggering publication:: Publication commands
9369 @node Configuration, Uploading files, Publishing, Publishing
9370 @section Configuration
9372 Publishing needs significant configuration to specify files, destination
9373 and many other properties of a project.
9376 * Project alist:: The central configuration variable
9377 * Sources and destinations:: From here to there
9378 * Selecting files:: What files are part of the project?
9379 * Publishing action:: Setting the function doing the publishing
9380 * Publishing options:: Tweaking HTML export
9381 * Publishing links:: Which links keep working after publishing?
9382 * Project page index:: Publishing a list of project files
9385 @node Project alist, Sources and destinations, Configuration, Configuration
9386 @subsection The variable @code{org-publish-project-alist}
9387 @cindex org-publish-project-alist
9388 @cindex projects, for publishing
9390 @vindex org-publish-project-alist
9391 Publishing is configured almost entirely through setting the value of one
9392 variable, called @code{org-publish-project-alist}. Each element of the list
9393 configures one project, and may be in one of the two following forms:
9396 ("project-name" :property value :property value ...)
9398 ("project-name" :components ("project-name" "project-name" ...))
9402 In both cases, projects are configured by specifying property values. A
9403 project defines the set of files that will be published, as well as the
9404 publishing configuration to use when publishing those files. When a project
9405 takes the second form listed above, the individual members of the
9406 @code{:components} property are taken to be sub-projects, which group
9407 together files requiring different publishing options. When you publish such
9408 a ``meta-project'', all the components will also be published, in the
9411 @node Sources and destinations, Selecting files, Project alist, Configuration
9412 @subsection Sources and destinations for files
9413 @cindex directories, for publishing
9415 Most properties are optional, but some should always be set. In
9416 particular, Org needs to know where to look for source files,
9417 and where to put published files.
9419 @multitable @columnfractions 0.3 0.7
9420 @item @code{:base-directory}
9421 @tab Directory containing publishing source files
9422 @item @code{:publishing-directory}
9423 @tab Directory where output files will be published. You can directly
9424 publish to a webserver using a file name syntax appropriate for
9425 the Emacs @file{tramp} package. Or you can publish to a local directory and
9426 use external tools to upload your website (@pxref{Uploading files}).
9427 @item @code{:preparation-function}
9428 @tab Function called before starting the publishing process, for example, to
9429 run @code{make} for updating files to be published.
9430 @item @code{:completion-function}
9431 @tab Function called after finishing the publishing process, for example, to
9432 change permissions of the resulting files.
9436 @node Selecting files, Publishing action, Sources and destinations, Configuration
9437 @subsection Selecting files
9438 @cindex files, selecting for publishing
9440 By default, all files with extension @file{.org} in the base directory
9441 are considered part of the project. This can be modified by setting the
9443 @multitable @columnfractions 0.25 0.75
9444 @item @code{:base-extension}
9445 @tab Extension (without the dot!) of source files. This actually is a
9446 regular expression. Set this to the symbol @code{any} if you want to get all
9447 files in @code{:base-directory}, even without extension.
9449 @item @code{:exclude}
9450 @tab Regular expression to match file names that should not be
9451 published, even though they have been selected on the basis of their
9454 @item @code{:include}
9455 @tab List of files to be included regardless of @code{:base-extension}
9456 and @code{:exclude}.
9459 @node Publishing action, Publishing options, Selecting files, Configuration
9460 @subsection Publishing action
9461 @cindex action, for publishing
9463 Publishing means that a file is copied to the destination directory and
9464 possibly transformed in the process. The default transformation is to export
9465 Org files as HTML files, and this is done by the function
9466 @code{org-publish-org-to-html} which calls the HTML exporter (@pxref{HTML
9467 export}). But you also can publish your content as PDF files using
9468 @code{org-publish-org-to-pdf}. If you want to publish the Org file itself,
9469 but with @i{archived}, @i{commented}, and @i{tag-excluded} trees removed, use
9470 @code{org-publish-org-to-org} and set the parameters @code{:plain-source}
9471 and/or @code{:htmlized-source}. This will produce @file{file.org} and
9472 @file{file.org.html} in the publishing
9473 directory@footnote{@file{file-source.org} and @file{file-source.org.html} if
9474 source and publishing directories are equal.}. Other files like images only
9475 need to be copied to the publishing destination, for this you may use
9476 @code{org-publish-attachment}. For non-Org files, you always need to
9477 specify the publishing function:
9479 @multitable @columnfractions 0.3 0.7
9480 @item @code{:publishing-function}
9481 @tab Function executing the publication of a file. This may also be a
9482 list of functions, which will all be called in turn.
9483 @item @code{:plain-source}
9484 @tab Non-nil means, publish plain source.
9485 @item @code{:htmlized-source}
9486 @tab Non-nil means, publish htmlized source.
9489 The function must accept two arguments: a property list containing at least a
9490 @code{:publishing-directory} property, and the name of the file to be
9491 published. It should take the specified file, make the necessary
9492 transformation (if any) and place the result into the destination folder.
9494 @node Publishing options, Publishing links, Publishing action, Configuration
9495 @subsection Options for the HTML/La@TeX{} exporters
9496 @cindex options, for publishing
9498 The property list can be used to set many export options for the HTML
9499 and La@TeX{} exporters. In most cases, these properties correspond to user
9500 variables in Org. The table below lists these properties along
9501 with the variable they belong to. See the documentation string for the
9502 respective variable for details.
9504 @vindex org-export-html-link-up
9505 @vindex org-export-html-link-home
9506 @vindex org-export-default-language
9507 @vindex org-display-custom-times
9508 @vindex org-export-headline-levels
9509 @vindex org-export-with-section-numbers
9510 @vindex org-export-section-number-format
9511 @vindex org-export-with-toc
9512 @vindex org-export-preserve-breaks
9513 @vindex org-export-with-archived-trees
9514 @vindex org-export-with-emphasize
9515 @vindex org-export-with-sub-superscripts
9516 @vindex org-export-with-special-strings
9517 @vindex org-export-with-footnotes
9518 @vindex org-export-with-drawers
9519 @vindex org-export-with-tags
9520 @vindex org-export-with-todo-keywords
9521 @vindex org-export-with-priority
9522 @vindex org-export-with-TeX-macros
9523 @vindex org-export-with-LaTeX-fragments
9524 @vindex org-export-skip-text-before-1st-heading
9525 @vindex org-export-with-fixed-width
9526 @vindex org-export-with-timestamps
9527 @vindex org-export-author-info
9528 @vindex org-export-creator-info
9529 @vindex org-export-with-tables
9530 @vindex org-export-highlight-first-table-line
9531 @vindex org-export-html-style-include-default
9532 @vindex org-export-html-style
9533 @vindex org-export-html-style-extra
9534 @vindex org-export-html-link-org-files-as-html
9535 @vindex org-export-html-inline-images
9536 @vindex org-export-html-extension
9537 @vindex org-export-html-table-tag
9538 @vindex org-export-html-expand
9539 @vindex org-export-html-with-timestamp
9540 @vindex org-export-publishing-directory
9541 @vindex org-export-html-preamble
9542 @vindex org-export-html-postamble
9543 @vindex org-export-html-auto-preamble
9544 @vindex org-export-html-auto-postamble
9545 @vindex user-full-name
9546 @vindex user-mail-address
9547 @vindex org-export-select-tags
9548 @vindex org-export-exclude-tags
9550 @multitable @columnfractions 0.32 0.68
9551 @item @code{:link-up} @tab @code{org-export-html-link-up}
9552 @item @code{:link-home} @tab @code{org-export-html-link-home}
9553 @item @code{:language} @tab @code{org-export-default-language}
9554 @item @code{:customtime} @tab @code{org-display-custom-times}
9555 @item @code{:headline-levels} @tab @code{org-export-headline-levels}
9556 @item @code{:section-numbers} @tab @code{org-export-with-section-numbers}
9557 @item @code{:section-number-format} @tab @code{org-export-section-number-format}
9558 @item @code{:table-of-contents} @tab @code{org-export-with-toc}
9559 @item @code{:preserve-breaks} @tab @code{org-export-preserve-breaks}
9560 @item @code{:archived-trees} @tab @code{org-export-with-archived-trees}
9561 @item @code{:emphasize} @tab @code{org-export-with-emphasize}
9562 @item @code{:sub-superscript} @tab @code{org-export-with-sub-superscripts}
9563 @item @code{:special-strings} @tab @code{org-export-with-special-strings}
9564 @item @code{:footnotes} @tab @code{org-export-with-footnotes}
9565 @item @code{:drawers} @tab @code{org-export-with-drawers}
9566 @item @code{:tags} @tab @code{org-export-with-tags}
9567 @item @code{:todo-keywords} @tab @code{org-export-with-todo-keywords}
9568 @item @code{:priority} @tab @code{org-export-with-priority}
9569 @item @code{:TeX-macros} @tab @code{org-export-with-TeX-macros}
9570 @item @code{:LaTeX-fragments} @tab @code{org-export-with-LaTeX-fragments}
9571 @item @code{:skip-before-1st-heading} @tab @code{org-export-skip-text-before-1st-heading}
9572 @item @code{:fixed-width} @tab @code{org-export-with-fixed-width}
9573 @item @code{:timestamps} @tab @code{org-export-with-timestamps}
9574 @item @code{:author-info} @tab @code{org-export-author-info}
9575 @item @code{:creator-info} @tab @code{org-export-creator-info}
9576 @item @code{:tables} @tab @code{org-export-with-tables}
9577 @item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line}
9578 @item @code{:style-include-default} @tab @code{org-export-html-style-include-default}
9579 @item @code{:style} @tab @code{org-export-html-style}
9580 @item @code{:style-extra} @tab @code{org-export-html-style-extra}
9581 @item @code{:convert-org-links} @tab @code{org-export-html-link-org-files-as-html}
9582 @item @code{:inline-images} @tab @code{org-export-html-inline-images}
9583 @item @code{:html-extension} @tab @code{org-export-html-extension}
9584 @item @code{:xml-declaration} @tab @code{org-export-html-xml-declaration}
9585 @item @code{:html-table-tag} @tab @code{org-export-html-table-tag}
9586 @item @code{:expand-quoted-html} @tab @code{org-export-html-expand}
9587 @item @code{:timestamp} @tab @code{org-export-html-with-timestamp}
9588 @item @code{:publishing-directory} @tab @code{org-export-publishing-directory}
9589 @item @code{:preamble} @tab @code{org-export-html-preamble}
9590 @item @code{:postamble} @tab @code{org-export-html-postamble}
9591 @item @code{:auto-preamble} @tab @code{org-export-html-auto-preamble}
9592 @item @code{:auto-postamble} @tab @code{org-export-html-auto-postamble}
9593 @item @code{:author} @tab @code{user-full-name}
9594 @item @code{:email} @tab @code{user-mail-address} : @code{addr;addr;..}
9595 @item @code{:select-tags} @tab @code{org-export-select-tags}
9596 @item @code{:exclude-tags} @tab @code{org-export-exclude-tags}
9597 @item @code{:latex-image-options} @tab @code{org-export-latex-image-default-option}
9600 Most of the @code{org-export-with-*} variables have the same effect in
9601 both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
9602 @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
9605 @vindex org-publish-project-alist
9606 When a property is given a value in @code{org-publish-project-alist},
9607 its setting overrides the value of the corresponding user variable (if
9608 any) during publishing. Options set within a file (@pxref{Export
9609 options}), however, override everything.
9611 @node Publishing links, Project page index, Publishing options, Configuration
9612 @subsection Links between published files
9613 @cindex links, publishing
9615 To create a link from one Org file to another, you would use
9616 something like @samp{[[file:foo.org][The foo]]} or simply
9617 @samp{file:foo.org.} (@pxref{Hyperlinks}). When published, this link
9618 becomes a link to @file{foo.html}. In this way, you can interlink the
9619 pages of your "org web" project and the links will work as expected when
9620 you publish them to HTML. If you also publish the Org source file and want
9621 to link to that, use an @code{http:} link instead of a @code{file:} link,
9622 because @code{file:} links are converted to link to the corresponding
9625 You may also link to related files, such as images. Provided you are careful
9626 with relative file names, and provided you have also configured Org to upload
9627 the related files, these links will work too. See @ref{Complex example}, for
9628 an example of this usage.
9630 Sometimes an Org file to be published may contain links that are
9631 only valid in your production environment, but not in the publishing
9632 location. In this case, use the property
9634 @multitable @columnfractions 0.4 0.6
9635 @item @code{:link-validation-function}
9636 @tab Function to validate links
9640 to define a function for checking link validity. This function must
9641 accept two arguments, the file name and a directory relative to which
9642 the file name is interpreted in the production environment. If this
9643 function returns @code{nil}, then the HTML generator will only insert a
9644 description into the HTML file, but no link. One option for this
9645 function is @code{org-publish-validate-link} which checks if the given
9646 file is part of any project in @code{org-publish-project-alist}.
9648 @node Project page index, , Publishing links, Configuration
9649 @subsection Project page index
9650 @cindex index, of published pages
9652 The following properties may be used to control publishing of an
9653 index of files or a summary page for a given project.
9655 @multitable @columnfractions 0.25 0.75
9656 @item @code{:auto-index}
9657 @tab When non-nil, publish an index during @code{org-publish-current-project}
9658 or @code{org-publish-all}.
9660 @item @code{:index-filename}
9661 @tab Filename for output of index. Defaults to @file{sitemap.org} (which
9662 becomes @file{sitemap.html}).
9664 @item @code{:index-title}
9665 @tab Title of index page. Defaults to name of file.
9667 @item @code{:index-function}
9668 @tab Plug-in function to use for generation of index.
9669 Defaults to @code{org-publish-org-index}, which generates a plain list
9670 of links to all files in the project.
9673 @node Uploading files, Sample configuration, Configuration, Publishing
9674 @section Uploading files
9678 For those people already utilising third party sync tools such as
9679 @command{rsync} or @command{unison}, it might be preferable not to use the built in
9680 @i{remote} publishing facilities of Org mode which rely heavily on
9681 Tramp. Tramp, while very useful and powerful, tends not to be
9682 so efficient for multiple file transfer and has been known to cause problems
9685 Specialised synchronization utilities offer several advantages. In addition
9686 to timestamp comparison, they also do content and permissions/attribute
9687 checks. For this reason you might prefer to publish your web to a local
9688 directory (possibly even @i{in place} with your Org files) and then use
9689 @file{unison} or @file{rsync} to do the synchronisation with the remote host.
9691 Since Unison (for example) can be configured as to which files to transfer to
9692 a certain remote destination, it can greatly simplify the project publishing
9693 definition. Simply keep all files in the correct location, process your Org
9694 files with @code{org-publish} and let the synchronization tool do the rest.
9695 You do not need, in this scenario, to include attachments such as @file{jpg},
9696 @file{css} or @file{gif} files in the project definition since the 3rd party
9699 Publishing to a local directory is also much faster than to a remote one, so
9700 that you can afford more easily to republish entire projects. If you set
9701 @code{org-publish-use-timestamps-flag} to @code{nil}, you gain the main
9702 benefit of re-including any changed external files such as source example
9703 files you might include with @code{#+INCLUDE}. The timestamp mechanism in
9704 Org is not smart enough to detect if included files have been modified.
9706 @node Sample configuration, Triggering publication, Uploading files, Publishing
9707 @section Sample configuration
9709 Below we provide two example configurations. The first one is a simple
9710 project publishing only a set of Org files. The second example is
9711 more complex, with a multi-component project.
9714 * Simple example:: One-component publishing
9715 * Complex example:: A multi-component publishing example
9718 @node Simple example, Complex example, Sample configuration, Sample configuration
9719 @subsection Example: simple publishing configuration
9721 This example publishes a set of Org files to the @file{public_html}
9722 directory on the local machine.
9725 (setq org-publish-project-alist
9727 :base-directory "~/org/"
9728 :publishing-directory "~/public_html"
9729 :section-numbers nil
9730 :table-of-contents nil
9731 :style "<link rel=\"stylesheet\"
9732 href=\"../other/mystyle.css\"
9733 type=\"text/css\">")))
9736 @node Complex example, , Simple example, Sample configuration
9737 @subsection Example: complex publishing configuration
9739 This more complicated example publishes an entire website, including
9740 Org files converted to HTML, image files, Emacs Lisp source code, and
9741 style sheets. The publishing directory is remote and private files are
9744 To ensure that links are preserved, care should be taken to replicate
9745 your directory structure on the web server, and to use relative file
9746 paths. For example, if your Org files are kept in @file{~/org} and your
9747 publishable images in @file{~/images}, you'd link to an image with
9750 file:../images/myimage.png
9753 On the web server, the relative path to the image should be the
9754 same. You can accomplish this by setting up an "images" folder in the
9755 right place on the web server, and publishing images to it.
9758 (setq org-publish-project-alist
9760 :base-directory "~/org/"
9761 :base-extension "org"
9762 :publishing-directory "/ssh:user@@host:~/html/notebook/"
9763 :publishing-function org-publish-org-to-html
9764 :exclude "PrivatePage.org" ;; regexp
9766 :section-numbers nil
9767 :table-of-contents nil
9768 :style "<link rel=\"stylesheet\"
9769 href=\"../other/mystyle.css\" type=\"text/css\">"
9771 :auto-postamble nil)
9774 :base-directory "~/images/"
9775 :base-extension "jpg\\|gif\\|png"
9776 :publishing-directory "/ssh:user@@host:~/html/images/"
9777 :publishing-function org-publish-attachment)
9780 :base-directory "~/other/"
9781 :base-extension "css\\|el"
9782 :publishing-directory "/ssh:user@@host:~/html/other/"
9783 :publishing-function org-publish-attachment)
9784 ("website" :components ("orgfiles" "images" "other"))))
9787 @node Triggering publication, , Sample configuration, Publishing
9788 @section Triggering publication
9790 Once properly configured, Org can publish with the following commands:
9795 Prompt for a specific project and publish all files that belong to it.
9798 Publish the project containing the current file.
9801 Publish only the current file.
9804 Publish every project.
9807 @vindex org-publish-use-timestamps-flag
9808 Org uses timestamps to track when a file has changed. The above functions
9809 normally only publish changed files. You can override this and force
9810 publishing of all files by giving a prefix argument, or by customizing the
9811 variable @code{org-publish-use-timestamps-flag}. This may be necessary in
9812 particular if files include other files via @code{#+SETUPFILE:} or
9815 @node Miscellaneous, Hacking, Publishing, Top
9816 @chapter Miscellaneous
9819 * Completion:: M-TAB knows what you need
9820 * Customization:: Adapting Org to your taste
9821 * In-buffer settings:: Overview of the #+KEYWORDS
9822 * The very busy C-c C-c key:: When in doubt, press C-c C-c
9823 * Clean view:: Getting rid of leading stars in the outline
9824 * TTY keys:: Using Org on a tty
9825 * Interaction:: Other Emacs packages
9829 @node Completion, Customization, Miscellaneous, Miscellaneous
9831 @cindex completion, of @TeX{} symbols
9832 @cindex completion, of TODO keywords
9833 @cindex completion, of dictionary words
9834 @cindex completion, of option keywords
9835 @cindex completion, of tags
9836 @cindex completion, of property keys
9837 @cindex completion, of link abbreviations
9838 @cindex @TeX{} symbol completion
9839 @cindex TODO keywords completion
9840 @cindex dictionary word completion
9841 @cindex option keyword completion
9842 @cindex tag completion
9843 @cindex link abbreviations, completion of
9845 Org supports in-buffer completion. This type of completion does
9846 not make use of the minibuffer. You simply type a few letters into
9847 the buffer and use the key to complete text right there.
9852 Complete word at point
9855 At the beginning of a headline, complete TODO keywords.
9857 After @samp{\}, complete @TeX{} symbols supported by the exporter.
9859 After @samp{*}, complete headlines in the current buffer so that they
9860 can be used in search links like @samp{[[*find this headline]]}.
9862 After @samp{:} in a headline, complete tags. The list of tags is taken
9863 from the variable @code{org-tag-alist} (possibly set through the
9864 @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
9865 dynamically from all tags used in the current buffer.
9867 After @samp{:} and not in a headline, complete property keys. The list
9868 of keys is constructed dynamically from all keys used in the current
9871 After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
9873 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
9874 @samp{OPTIONS} which set file-specific options for Org mode. When the
9875 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
9876 will insert example settings for this keyword.
9878 In the line after @samp{#+STARTUP: }, complete startup keywords,
9879 @ie valid keys for this line.
9881 Elsewhere, complete dictionary words using Ispell.
9885 @node Customization, In-buffer settings, Completion, Miscellaneous
9886 @section Customization
9887 @cindex customization
9888 @cindex options, for customization
9889 @cindex variables, for customization
9891 There are more than 180 variables that can be used to customize
9892 Org. For the sake of compactness of the manual, I am not
9893 describing the variables here. A structured overview of customization
9894 variables is available with @kbd{M-x org-customize}. Or select
9895 @code{Browse Org Group} from the @code{Org->Customization} menu. Many
9896 settings can also be activated on a per-file basis, by putting special
9897 lines into the buffer (@pxref{In-buffer settings}).
9899 @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
9900 @section Summary of in-buffer settings
9901 @cindex in-buffer settings
9902 @cindex special keywords
9904 Org mode uses special lines in the buffer to define settings on a
9905 per-file basis. These lines start with a @samp{#+} followed by a
9906 keyword, a colon, and then individual words defining a setting. Several
9907 setting words can be in the same line, but you can also have multiple
9908 lines for the keyword. While these settings are described throughout
9909 the manual, here is a summary. After changing any of those lines in the
9910 buffer, press @kbd{C-c C-c} with the cursor still in the line to
9911 activate the changes immediately. Otherwise they become effective only
9912 when the file is visited again in a new Emacs session.
9914 @vindex org-archive-location
9916 @item #+ARCHIVE: %s_done::
9917 This line sets the archive location for the agenda file. It applies for
9918 all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
9919 of the file. The first such line also applies to any entries before it.
9920 The corresponding variable is @code{org-archive-location}.
9922 This line sets the category for the agenda file. The category applies
9923 for all subsequent lines until the next @samp{#+CATEGORY} line, or the
9924 end of the file. The first such line also applies to any entries before it.
9925 @item #+COLUMNS: %25ITEM .....
9926 @cindex property, COLUMNS
9927 Set the default format for columns view. This format applies when
9928 columns view is invoked in locations where no @code{COLUMNS} property
9930 @item #+CONSTANTS: name1=value1 ...
9931 @vindex org-table-formula-constants
9932 @vindex org-table-formula
9933 Set file-local values for constants to be used in table formulas. This
9934 line set the local variable @code{org-table-formula-constants-local}.
9935 The global version of this variable is
9936 @code{org-table-formula-constants}.
9937 @item #+FILETAGS: :tag1:tag2:tag3:
9938 Set tags that can be inherited by any entry in the file, including the
9940 @item #+DRAWERS: NAME1 .....
9942 Set the file-local set of drawers. The corresponding global variable is
9944 @item #+LINK: linkword replace
9945 @vindex org-link-abbrev-alist
9946 These lines (several are allowed) specify link abbreviations.
9947 @xref{Link abbreviations}. The corresponding variable is
9948 @code{org-link-abbrev-alist}.
9949 @item #+PRIORITIES: highest lowest default
9950 @vindex org-highest-priority
9951 @vindex org-lowest-priority
9952 @vindex org-default-priority
9953 This line sets the limits and the default for the priorities. All three
9954 must be either letters A-Z or numbers 0-9. The highest priority must
9955 have a lower ASCII number that the lowest priority.
9956 @item #+PROPERTY: Property_Name Value
9957 This line sets a default inheritance value for entries in the current
9958 buffer, most useful for specifying the allowed values of a property.
9960 @item #+SETUPFILE: file
9961 This line defines a file that holds more in-buffer setup. Normally this is
9962 entirely ignored. Only when the buffer is parsed for option-setting lines
9963 (@ie when starting Org mode for a file, when pressing @kbd{C-c C-c} in a
9964 settings line, or when exporting), then the contents of this file are parsed
9965 as if they had been included in the buffer. In particular, the file can be
9966 any other Org mode file with internal setup. You can visit the file the
9967 cursor is in the line with @kbd{C-c '}.
9970 @vindex org-startup-folded
9971 This line sets options to be used at startup of Org mode, when an
9972 Org file is being visited. The first set of options deals with the
9973 initial visibility of the outline tree. The corresponding variable for
9974 global default settings is @code{org-startup-folded}, with a default
9975 value @code{t}, which means @code{overview}.
9976 @cindex @code{overview}, STARTUP keyword
9977 @cindex @code{content}, STARTUP keyword
9978 @cindex @code{showall}, STARTUP keyword
9980 overview @r{top-level headlines only}
9981 content @r{all headlines}
9982 showall @r{no folding at all, show everything}
9984 @vindex org-startup-align-all-tables
9985 Then there are options for aligning tables upon visiting a file. This
9986 is useful in files containing narrowed table columns. The corresponding
9987 variable is @code{org-startup-align-all-tables}, with a default value
9989 @cindex @code{align}, STARTUP keyword
9990 @cindex @code{noalign}, STARTUP keyword
9992 align @r{align all tables}
9993 noalign @r{don't align tables on startup}
9995 @vindex org-log-done
9996 @vindex org-log-note-clock-out
9997 @vindex org-log-repeat
9998 Logging the closing and reopening of TODO items and clock intervals can be
9999 configured using these options (see variables @code{org-log-done},
10000 @code{org-log-note-clock-out} and @code{org-log-repeat})
10001 @cindex @code{logdone}, STARTUP keyword
10002 @cindex @code{lognotedone}, STARTUP keyword
10003 @cindex @code{nologdone}, STARTUP keyword
10004 @cindex @code{lognoteclock-out}, STARTUP keyword
10005 @cindex @code{nolognoteclock-out}, STARTUP keyword
10006 @cindex @code{logrepeat}, STARTUP keyword
10007 @cindex @code{lognoterepeat}, STARTUP keyword
10008 @cindex @code{nologrepeat}, STARTUP keyword
10010 logdone @r{record a timestamp when an item is marked DONE}
10011 lognotedone @r{record timestamp and a note when DONE}
10012 nologdone @r{don't record when items are marked DONE}
10013 logrepeat @r{record a time when reinstating a repeating item}
10014 lognoterepeat @r{record a note when reinstating a repeating item}
10015 nologrepeat @r{do not record when reinstating repeating item}
10016 lognoteclock-out @r{record a note when clocking out}
10017 nolognoteclock-out @r{don't record a note when clocking out}
10019 @vindex org-hide-leading-stars
10020 @vindex org-odd-levels-only
10021 Here are the options for hiding leading stars in outline headings, and for
10022 indenting outlines. The corresponding variables are
10023 @code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with a
10024 default setting @code{nil} (meaning @code{showstars} and @code{oddeven}).
10025 @cindex @code{hidestars}, STARTUP keyword
10026 @cindex @code{showstars}, STARTUP keyword
10027 @cindex @code{odd}, STARTUP keyword
10028 @cindex @code{even}, STARTUP keyword
10030 hidestars @r{make all but one of the stars starting a headline invisible.}
10031 showstars @r{show all stars starting a headline}
10032 indent @r{virtual indentation according to outline level}
10033 noindent @r{no virtual indentation according to outline level}
10034 odd @r{allow only odd outline levels (1,3,...)}
10035 oddeven @r{allow all outline levels}
10037 @vindex org-put-time-stamp-overlays
10038 @vindex org-time-stamp-overlay-formats
10039 To turn on custom format overlays over timestamps (variables
10040 @code{org-put-time-stamp-overlays} and
10041 @code{org-time-stamp-overlay-formats}), use
10042 @cindex @code{customtime}, STARTUP keyword
10044 customtime @r{overlay custom time format}
10046 @vindex constants-unit-system
10047 The following options influence the table spreadsheet (variable
10048 @code{constants-unit-system}).
10049 @cindex @code{constcgs}, STARTUP keyword
10050 @cindex @code{constSI}, STARTUP keyword
10052 constcgs @r{@file{constants.el} should use the c-g-s unit system}
10053 constSI @r{@file{constants.el} should use the SI unit system}
10055 @vindex org-footnote-define-inline
10056 @vindex org-footnote-auto-label
10057 To influence footnote settings, use the following keywords. The
10058 corresponding variables are @code{org-footnote-define-inline} and
10059 @code{org-footnote-auto-label}.
10060 @cindex @code{fninline}, STARTUP keyword
10061 @cindex @code{fnnoinline}, STARTUP keyword
10062 @cindex @code{fnlocal}, STARTUP keyword
10063 @cindex @code{fnprompt}, STARTUP keyword
10064 @cindex @code{fnauto}, STARTUP keyword
10065 @cindex @code{fnconfirm}, STARTUP keyword
10066 @cindex @code{fnplain}, STARTUP keyword
10068 fninline @r{define footnotes inline}
10069 fnnoinline @r{define footnotes in separate section}
10070 fnlocal @r{define footnotes near first reference, but not inline}
10071 fnprompt @r{prompt for footnote labels}
10072 fnauto @r{create [fn:1]-like labels automatically (default)}
10073 fnconfirm @r{offer automatic label for editing or confirmation}
10074 fnplain @r{create [1]-like labels automatically}
10076 @cindex org-hide-block-startup
10077 To hide blocks on startup, use these keywords. The corresponding variable is
10078 @code{org-hide-block-startup}.
10079 @cindex @code{hideblocks}, STARTUP keyword
10080 @cindex @code{nohideblocks}, STARTUP keyword
10082 hideblocks @r{Hide all begin/end blocks on startup}
10083 nohideblocks @r{Do not hide blocks on startup}
10085 @item #+TAGS: TAG1(c1) TAG2(c2)
10086 @vindex org-tag-alist
10087 These lines (several such lines are allowed) specify the valid tags in
10088 this file, and (potentially) the corresponding @emph{fast tag selection}
10089 keys. The corresponding variable is @code{org-tag-alist}.
10091 This line contains the formulas for the table directly above the line.
10092 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:,
10093 @itemx #+DESCRIPTION:, #+KEYWORDS:
10094 @itemx #+LATEX_HEADER:, #+STYLE:, #+LINK_UP:, #+LINK_HOME:,
10095 @itemx #+EXPORT_SELECT_TAGS:, #+EXPORT_EXCLUDE_TAGS:
10096 These lines provide settings for exporting files. For more details see
10097 @ref{Export options}.
10098 @item #+TODO: #+SEQ_TODO: #+TYP_TODO:
10099 @vindex org-todo-keywords
10100 These lines set the TODO keywords and their interpretation in the
10101 current file. The corresponding variable is @code{org-todo-keywords}.
10104 @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
10105 @section The very busy C-c C-c key
10107 @cindex C-c C-c, overview
10109 The key @kbd{C-c C-c} has many purposes in Org, which are all
10110 mentioned scattered throughout this manual. One specific function of
10111 this key is to add @emph{tags} to a headline (@pxref{Tags}). In many
10112 other circumstances it means something like @emph{``Hey Org, look
10113 here and update according to what you see here''}. Here is a summary of
10114 what this means in different contexts.
10118 If there are highlights in the buffer from the creation of a sparse
10119 tree, or from clock display, remove these highlights.
10121 If the cursor is in one of the special @code{#+KEYWORD} lines, this
10122 triggers scanning the buffer for these lines and updating the
10125 If the cursor is inside a table, realign the table. This command
10126 works even if the automatic table editor has been turned off.
10128 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
10131 If the cursor is inside a table created by the @file{table.el} package,
10132 activate that table.
10134 If the current buffer is a Remember buffer, close the note and file it.
10135 With a prefix argument, file it, without further interaction, to the
10138 If the cursor is on a @code{<<<target>>>}, update radio targets and
10139 corresponding links in this buffer.
10141 If the cursor is in a property line or at the start or end of a property
10142 drawer, offer property commands.
10144 If the cursor is at a footnote reference, go to the corresponding
10145 definition, and vice versa.
10147 If the cursor is in a plain list item with a checkbox, toggle the status
10150 If the cursor is on a numbered item in a plain list, renumber the
10153 If the cursor is on the @code{#+BEGIN} line of a dynamic block, the
10157 @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
10158 @section A cleaner outline view
10159 @cindex hiding leading stars
10160 @cindex dynamic indentation
10161 @cindex odd-levels-only outlines
10162 @cindex clean outline view
10164 Some people find it noisy and distracting that the Org headlines start
10165 with a potentially large number of stars, and that text below the headlines
10166 is not indented. This is not really a problem when you are writing a book
10167 where the outline headings are really section headlines. However, in a more
10168 list-oriented outline, it is clear that an indented structure is a lot
10169 cleaner, as can be seen by comparing the two columns in the following
10174 * Top level headline | * Top level headline
10175 ** Second level | * Second level
10176 *** 3rd level | * 3rd level
10177 some text | some text
10178 *** 3rd level | * 3rd level
10179 more text | more text
10180 * Another top level headline | * Another top level headline
10185 It is non-trivial to make such a look work in Emacs, but Org contains three
10186 separate features that, combined, achieve just that.
10190 @emph{Indentation of text below headlines}@*
10191 You may indent text below each headline to make the left boundary line up
10192 with the headline, like
10196 more text, now indented
10199 @vindex org-adapt-indentation
10200 A good way to get this indentation is by hand, and Org supports this with
10201 paragraph filling, line wrapping, and structure editing@footnote{See also the
10202 variable @code{org-adapt-indentation}.} preserving or adapting the
10203 indentation as appropriate. A different approach would be to have a way to
10204 automatically indent lines according to outline structure by adding overlays
10205 or text properties. But I have not yet found a robust and efficient way to
10206 do this in large files.
10209 @vindex org-hide-leading-stars
10210 @emph{Hiding leading stars}@* You can modify the display in such a way that
10211 all leading stars become invisible. To do this in a global way, configure
10212 the variable @code{org-hide-leading-stars} or change this on a per-file basis
10216 #+STARTUP: hidestars
10220 Note that the opposite behavior is selected with @code{showstars}.
10222 With hidden stars, the tree becomes:
10226 * Top level headline
10234 @vindex org-hide @r{(face)}
10235 Note that the leading stars are not truly replaced by whitespace, they
10236 are only fontified with the face @code{org-hide} that uses the
10237 background color as font color. If you are not using either white or
10238 black background, you may have to customize this face to get the wanted
10239 effect. Another possibility is to set this font such that the extra
10240 stars are @i{almost} invisible, for example using the color
10241 @code{grey90} on a white background.
10244 @vindex org-odd-levels-only
10245 Things become cleaner still if you skip all the even levels and use only odd
10246 levels 1, 3, 5..., effectively adding two stars to go from one outline level
10247 to the next@footnote{When you need to specify a level for a property search
10248 or refile targets, @samp{LEVEL=2} will correspond to 3 stars, etc@.}. In this
10249 way we get the outline view shown at the beginning of this section. In order
10250 to make the structure editing and export commands handle this convention
10251 correctly, configure the variable @code{org-odd-levels-only}, or set this on
10252 a per-file basis with one of the following lines:
10259 You can convert an Org file from single-star-per-level to the
10260 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
10261 RET} in that file. The reverse operation is @kbd{M-x
10262 org-convert-to-oddeven-levels}.
10265 @node TTY keys, Interaction, Clean view, Miscellaneous
10266 @section Using Org on a tty
10267 @cindex tty key bindings
10269 Because Org contains a large number of commands, by default many of
10270 Org's core commands are bound to keys that are generally not
10271 accessible on a tty, such as the cursor keys (@key{left}, @key{right},
10272 @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
10273 together with modifiers like @key{Meta} and/or @key{Shift}. To access
10274 these commands on a tty when special keys are unavailable, the following
10275 alternative bindings can be used. The tty bindings below will likely be
10276 more cumbersome; you may find for some of the bindings below that a
10277 customized workaround suits you better. For example, changing a timestamp
10278 is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
10279 tty you would rather use @kbd{C-c .} to re-insert the timestamp.
10281 @multitable @columnfractions 0.15 0.2 0.2
10282 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
10283 @item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab
10284 @item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{@key{Esc} @key{left}}
10285 @item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab
10286 @item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{@key{Esc} @key{right}}
10287 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab
10288 @item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{@key{Esc} @key{up}}
10289 @item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab
10290 @item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{@key{Esc} @key{down}}
10291 @item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab
10292 @item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab
10293 @item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{@key{Esc} @key{RET}}
10294 @item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab
10295 @item @kbd{S-@key{left}} @tab @kbd{C-c @key{left}} @tab
10296 @item @kbd{S-@key{right}} @tab @kbd{C-c @key{right}} @tab
10297 @item @kbd{S-@key{up}} @tab @kbd{C-c @key{up}} @tab
10298 @item @kbd{S-@key{down}} @tab @kbd{C-c @key{down}} @tab
10299 @item @kbd{C-S-@key{left}} @tab @kbd{C-c C-x @key{left}} @tab
10300 @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
10304 @node Interaction, , TTY keys, Miscellaneous
10305 @section Interaction with other packages
10306 @cindex packages, interaction with other
10307 Org lives in the world of GNU Emacs and interacts in various ways
10308 with other code out there.
10311 * Cooperation:: Packages Org cooperates with
10312 * Conflicts:: Packages that lead to conflicts
10315 @node Cooperation, Conflicts, Interaction, Interaction
10316 @subsection Packages that Org cooperates with
10319 @cindex @file{calc.el}
10320 @cindex Gillespie, Dave
10321 @item @file{calc.el} by Dave Gillespie
10322 Org uses the Calc package for implementing spreadsheet
10323 functionality in its tables (@pxref{The spreadsheet}). Org
10324 checks for the availability of Calc by looking for the function
10325 @code{calc-eval} which will have been autoloaded during setup if Calc has
10326 been installed properly. As of Emacs 22, Calc is part of the Emacs
10327 distribution. Another possibility for interaction between the two
10328 packages is using Calc for embedded calculations. @xref{Embedded Mode,
10329 , Embedded Mode, Calc, GNU Emacs Calc Manual}.
10330 @item @file{constants.el} by Carsten Dominik
10331 @cindex @file{constants.el}
10332 @cindex Dominik, Carsten
10333 @vindex org-table-formula-constants
10334 In a table formula (@pxref{The spreadsheet}), it is possible to use
10335 names for natural constants or units. Instead of defining your own
10336 constants in the variable @code{org-table-formula-constants}, install
10337 the @file{constants} package which defines a large number of constants
10338 and units, and lets you use unit prefixes like @samp{M} for
10339 @samp{Mega}, etc@. You will need version 2.0 of this package, available
10340 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
10341 the function @code{constants-get}, which has to be autoloaded in your
10342 setup. See the installation instructions in the file
10343 @file{constants.el}.
10344 @item @file{cdlatex.el} by Carsten Dominik
10345 @cindex @file{cdlatex.el}
10346 @cindex Dominik, Carsten
10347 Org mode can make use of the CDLa@TeX{} package to efficiently enter
10348 La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
10349 @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
10350 @cindex @file{imenu.el}
10351 Imenu allows menu access to an index of items in a file. Org mode
10352 supports Imenu---all you need to do to get the index is the following:
10354 (add-hook 'org-mode-hook
10355 (lambda () (imenu-add-to-menubar "Imenu")))
10357 @vindex org-imenu-depth
10358 By default the index is two levels deep---you can modify the depth using
10359 the option @code{org-imenu-depth}.
10360 @item @file{remember.el} by John Wiegley
10361 @cindex @file{remember.el}
10362 @cindex Wiegley, John
10363 Org cooperates with remember, see @ref{Remember}.
10364 @file{Remember.el} is not part of Emacs, find it on the web.
10365 @item @file{speedbar.el} by Eric M. Ludlam
10366 @cindex @file{speedbar.el}
10367 @cindex Ludlam, Eric M.
10368 Speedbar is a package that creates a special frame displaying files and
10369 index items in files. Org mode supports Speedbar and allows you to
10370 drill into Org files directly from the Speedbar. It also allows you to
10371 restrict the scope of agenda commands to a file or a subtree by using
10372 the command @kbd{<} in the Speedbar frame.
10373 @cindex @file{table.el}
10374 @item @file{table.el} by Takaaki Ota
10376 @cindex table editor, @file{table.el}
10377 @cindex @file{table.el}
10378 @cindex Ota, Takaaki
10380 Complex ASCII tables with automatic line wrapping, column- and
10381 row-spanning, and alignment can be created using the Emacs table
10382 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
10383 and also part of Emacs 22).
10384 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
10385 will call @command{table-recognize-table} and move the cursor into the
10386 table. Inside a table, the keymap of Org mode is inactive. In order
10387 to execute Org mode-related commands, leave the table.
10392 Recognize @file{table.el} table. Works when the cursor is in a
10397 Insert a @file{table.el} table. If there is already a table at point, this
10398 command converts it between the @file{table.el} format and the Org-mode
10399 format. See the documentation string of the command
10400 @code{org-convert-table} for the restrictions under which this is
10403 @file{table.el} is part of Emacs 22.
10404 @item @file{footnote.el} by Steven L. Baur
10405 @cindex @file{footnote.el}
10406 @cindex Baur, Steven L.
10407 Org mode recognizes numerical footnotes as provided by this package.
10408 However, Org mode also has its own footnote support (@pxref{Footnotes}),
10409 which makes using @file{footnote.el} unnecessary.
10412 @node Conflicts, , Cooperation, Interaction
10413 @subsection Packages that lead to conflicts with Org mode
10417 @cindex @code{shift-selection-mode}
10418 @vindex org-support-shift-select
10419 In Emacs 23, @code{shift-selection-mode} is on by default, meaning that
10420 cursor motions combined with the shift key should start or enlarge regions.
10421 This conflicts with the use of @kbd{S-@key{cursor}} commands in Org to change
10422 timestamps, TODO keywords, priorities, and item bullet types if the cursor is
10423 at such a location. By default, @kbd{S-@key{cursor}} commands outside
10424 special contexts don't do anything, but you can customize the variable
10425 @code{org-support-shift-select}. Org mode then tries to accommodate shift
10426 selection by (i) using it outside of the special contexts where special
10427 commands apply, and by (ii) extending an existing active region even if the
10428 cursor moves across a special context.
10430 @item @file{CUA.el} by Kim. F. Storm
10431 @cindex @file{CUA.el}
10432 @cindex Storm, Kim. F.
10433 @vindex org-replace-disputed-keys
10434 Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by CUA mode
10435 (as well as @code{pc-select-mode} and @code{s-region-mode}) to select and extend the
10436 region. In fact, Emacs 23 has this built-in in the form of
10437 @code{shift-selection-mode}, see previous paragraph. If you are using Emacs
10438 23, you probably don't want to use another package for this purpose. However,
10439 if you prefer to leave these keys to a different package while working in
10440 Org mode, configure the variable @code{org-replace-disputed-keys}. When set,
10441 Org will move the following key bindings in Org files, and in the agenda
10442 buffer (but not during date selection).
10445 S-UP -> M-p S-DOWN -> M-n
10446 S-LEFT -> M-- S-RIGHT -> M-+
10447 C-S-LEFT -> M-S-- C-S-RIGHT -> M-S-+
10450 @vindex org-disputed-keys
10451 Yes, these are unfortunately more difficult to remember. If you want
10452 to have other replacement keys, look at the variable
10453 @code{org-disputed-keys}.
10455 @item @file{yasnippet.el}
10456 @cindex @file{yasnippet.el}
10457 The way Org-mode binds the TAB key (binding to @code{[tab]} instead of
10458 @code{"\t"}) overrules yasnippets' access to this key. The following code
10459 fixed this problem:
10462 (add-hook 'org-mode-hook
10464 (org-set-local 'yas/trigger-key [tab])
10465 (define-key yas/keymap [tab] 'yas/next-field-group)))
10468 @item @file{windmove.el} by Hovav Shacham
10469 @cindex @file{windmove.el}
10470 This package also uses the @kbd{S-<cursor>} keys, so everything written
10471 in the paragraph above about CUA mode also applies here.
10475 @node Hacking, History and Acknowledgments, Miscellaneous, Top
10479 This appendix covers some aspects where users can extend the functionality of
10483 * Hooks:: Who to reach into Org's internals
10484 * Add-on packages:: Available extensions
10485 * Adding hyperlink types:: New custom link types
10486 * Context-sensitive commands:: How to add functioality to such commands
10487 * Tables in arbitrary syntax:: Orgtbl for La@TeX{} and other programs
10488 * Dynamic blocks:: Automatically filled blocks
10489 * Special agenda views:: Customized views
10490 * Extracting agenda information:: Postprocessing of agenda information
10491 * Using the property API:: Writing programs that use entry properties
10492 * Using the mapping API:: Mapping over all or selected entries
10495 @node Hooks, Add-on packages, Hacking, Hacking
10499 Org has a large number of hook variables that can be used to add
10500 functionality. This appendix about hacking is going to illustrate the
10501 use of some of them. A complete list of all hooks with documentation is
10502 maintained by the Worg project and can be found at
10503 @uref{http://orgmode.org/worg/org-configs/org-hooks.php}.
10505 @node Add-on packages, Adding hyperlink types, Hooks, Hacking
10506 @section Add-on packages
10507 @cindex add-on packages
10509 A large number of add-on packages have been written by various authors.
10510 These packages are not part of Emacs, but they are distributed as contributed
10511 packages with the separate release available at the Org mode home page at
10512 @uref{http://orgmode.org}. The list of contributed packages, along with
10513 documentation about each package, is maintained by the Worg project at
10514 @uref{http://orgmode.org/worg/org-contrib/}.
10518 @node Adding hyperlink types, Context-sensitive commands, Add-on packages, Hacking
10519 @section Adding hyperlink types
10520 @cindex hyperlinks, adding new types
10522 Org has a large number of hyperlink types built-in
10523 (@pxref{Hyperlinks}). If you would like to add new link types, Org
10524 provides an interface for doing so. Let's look at an example file,
10525 @file{org-man.el}, that will add support for creating links like
10526 @samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
10530 ;;; org-man.el - Support for links to manpages in Org
10534 (org-add-link-type "man" 'org-man-open)
10535 (add-hook 'org-store-link-functions 'org-man-store-link)
10537 (defcustom org-man-command 'man
10538 "The Emacs command to be used to display a man page."
10540 :type '(choice (const man) (const woman)))
10542 (defun org-man-open (path)
10543 "Visit the manpage on PATH.
10544 PATH should be a topic that can be thrown at the man command."
10545 (funcall org-man-command path))
10547 (defun org-man-store-link ()
10548 "Store a link to a manpage."
10549 (when (memq major-mode '(Man-mode woman-mode))
10550 ;; This is a man page, we do make this link
10551 (let* ((page (org-man-get-page-name))
10552 (link (concat "man:" page))
10553 (description (format "Manpage for %s" page)))
10554 (org-store-link-props
10557 :description description))))
10559 (defun org-man-get-page-name ()
10560 "Extract the page name from the buffer name."
10561 ;; This works for both `Man-mode' and `woman-mode'.
10562 (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
10563 (match-string 1 (buffer-name))
10564 (error "Cannot create link to this man page")))
10568 ;;; org-man.el ends here
10572 You would activate this new link type in @file{.emacs} with
10579 Let's go through the file and see what it does.
10582 It does @code{(require 'org)} to make sure that @file{org.el} has been
10585 The next line calls @code{org-add-link-type} to define a new link type
10586 with prefix @samp{man}. The call also contains the name of a function
10587 that will be called to follow such a link.
10589 @vindex org-store-link-functions
10590 The next line adds a function to @code{org-store-link-functions}, in
10591 order to allow the command @kbd{C-c l} to record a useful link in a
10592 buffer displaying a man page.
10595 The rest of the file defines the necessary variables and functions.
10596 First there is a customization variable that determines which Emacs
10597 command should be used to display man pages. There are two options,
10598 @code{man} and @code{woman}. Then the function to follow a link is
10599 defined. It gets the link path as an argument---in this case the link
10600 path is just a topic for the manual command. The function calls the
10601 value of @code{org-man-command} to display the man page.
10603 Finally the function @code{org-man-store-link} is defined. When you try
10604 to store a link with @kbd{C-c l}, this function will be called to
10605 try to make a link. The function must first decide if it is supposed to
10606 create the link for this buffer type; we do this by checking the value
10607 of the variable @code{major-mode}. If not, the function must exit and
10608 return the value @code{nil}. If yes, the link is created by getting the
10609 manual topic from the buffer name and prefixing it with the string
10610 @samp{man:}. Then it must call the command @code{org-store-link-props}
10611 and set the @code{:type} and @code{:link} properties. Optionally you
10612 can also set the @code{:description} property to provide a default for
10613 the link description when the link is later inserted into an Org
10614 buffer with @kbd{C-c C-l}.
10616 When is makes sense for your new link type, you may also define a function
10617 @code{org-PREFIX-complete-link} that implements special (@eg completion)
10618 support for inserting such a link with @kbd{C-c C-l}. Such a function should
10619 not accept any arguments, and return the full link with prefix.
10621 @node Context-sensitive commands, Tables in arbitrary syntax, Adding hyperlink types, Hacking
10622 @section Context-sensitive commands
10623 @cindex context-sensitive commands, hooks
10624 @cindex add-ons, context-sensitive commands
10625 @vindex org-ctrl-c-ctrl-c-hook
10627 Org has several commands that act differently depending on context. The most
10628 important example it the @kbd{C-c C-c} (@pxref{The very busy C-c C-c key}).
10629 Also the @kbd{M-cursor} and @kbd{M-S-cursor} keys have this property.
10631 Add-ons can tap into this functionality by providing a function that detects
10632 special context for that add-on and executes functionality appropriate for
10633 the context. Here is an example from Dan Davison's @file{org-R.el} which
10634 allows you to evaluate commands based on the @file{R} programming language. For
10635 this package, special contexts are lines that start with @code{#+R:} or
10639 (defun org-R-apply-maybe ()
10640 "Detect if this is context for org-R and execute R commands."
10641 (if (save-excursion
10642 (beginning-of-line 1)
10643 (looking-at "#\\+RR?:"))
10644 (progn (call-interactively 'org-R-apply)
10645 t) ;; to signal that we took action
10646 nil)) ;; to signal that we did not
10648 (add-hook 'org-ctrl-c-ctrl-c-hook 'org-R-apply-maybe)
10651 The function first checks if the cursor is in such a line. If that is the
10652 case, @code{org-R-apply} is called and the function returns @code{t} to
10653 signal that action was taken, and @kbd{C-c C-c} will stop looking for other
10654 contexts. If the function finds it should do nothing locally, it returns @code{nil} so that other, similar functions can have a try.
10657 @node Tables in arbitrary syntax, Dynamic blocks, Context-sensitive commands, Hacking
10658 @section Tables and lists in arbitrary syntax
10659 @cindex tables, in other modes
10660 @cindex lists, in other modes
10661 @cindex Orgtbl mode
10663 Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
10664 frequent feature request has been to make it work with native tables in
10665 specific languages, for example La@TeX{}. However, this is extremely
10666 hard to do in a general way, would lead to a customization nightmare,
10667 and would take away much of the simplicity of the Orgtbl-mode table
10671 This appendix describes a different approach. We keep the Orgtbl mode
10672 table in its native format (the @i{source table}), and use a custom
10673 function to @i{translate} the table to the correct syntax, and to
10674 @i{install} it in the right location (the @i{target table}). This puts
10675 the burden of writing conversion functions on the user, but it allows
10676 for a very flexible system.
10678 Bastien added the ability to do the same with lists. You can use Org's
10679 facilities to edit and structure lists by turning @code{orgstruct-mode}
10680 on, then locally exporting such lists in another format (HTML, La@TeX{}
10685 * Radio tables:: Sending and receiving
10686 * A LaTeX example:: Step by step, almost a tutorial
10687 * Translator functions:: Copy and modify
10688 * Radio lists:: Doing the same for lists
10691 @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
10692 @subsection Radio tables
10693 @cindex radio tables
10695 To define the location of the target table, you first need to create two
10696 lines that are comments in the current mode, but contain magic words for
10697 Orgtbl mode to find. Orgtbl mode will insert the translated table
10698 between these lines, replacing whatever was there before. For example:
10701 /* BEGIN RECEIVE ORGTBL table_name */
10702 /* END RECEIVE ORGTBL table_name */
10706 Just above the source table, we put a special line that tells
10707 Orgtbl mode how to translate this table and where to install it. For
10711 #+ORGTBL: SEND table_name translation_function arguments....
10715 @code{table_name} is the reference name for the table that is also used
10716 in the receiver lines. @code{translation_function} is the Lisp function
10717 that does the translation. Furthermore, the line can contain a list of
10718 arguments (alternating key and value) at the end. The arguments will be
10719 passed as a property list to the translation function for
10720 interpretation. A few standard parameters are already recognized and
10721 acted upon before the translation function is called:
10725 Skip the first N lines of the table. Hlines do count as separate lines for
10728 @item :skipcols (n1 n2 ...)
10729 List of columns that should be skipped. If the table has a column with
10730 calculation marks, that column is automatically discarded as well.
10731 Please note that the translator function sees the table @emph{after} the
10732 removal of these columns, the function never knows that there have been
10733 additional columns.
10737 The one problem remaining is how to keep the source table in the buffer
10738 without disturbing the normal workings of the file, for example during
10739 compilation of a C file or processing of a La@TeX{} file. There are a
10740 number of different solutions:
10744 The table could be placed in a block comment if that is supported by the
10745 language. For example, in C mode you could wrap the table between
10746 @samp{/*} and @samp{*/} lines.
10748 Sometimes it is possible to put the table after some kind of @i{END}
10749 statement, for example @samp{\bye} in @TeX{} and @samp{\end@{document@}}
10752 You can just comment the table line-by-line whenever you want to process
10753 the file, and uncomment it whenever you need to edit the table. This
10754 only sounds tedious---the command @kbd{M-x orgtbl-toggle-comment}
10755 makes this comment-toggling very easy, in particular if you bind it to a
10759 @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
10760 @subsection A La@TeX{} example of radio tables
10761 @cindex La@TeX{}, and Orgtbl mode
10763 The best way to wrap the source table in La@TeX{} is to use the
10764 @code{comment} environment provided by @file{comment.sty}. It has to be
10765 activated by placing @code{\usepackage@{comment@}} into the document
10766 header. Orgtbl mode can insert a radio table skeleton@footnote{By
10767 default this works only for La@TeX{}, HTML, and Texinfo. Configure the
10768 variable @code{orgtbl-radio-tables} to install templates for other
10769 modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will
10770 be prompted for a table name, let's say we use @samp{salesfigures}. You
10771 will then get the following template:
10773 @cindex #+ORGTBL, SEND
10775 % BEGIN RECEIVE ORGTBL salesfigures
10776 % END RECEIVE ORGTBL salesfigures
10778 #+ORGTBL: SEND salesfigures orgtbl-to-latex
10784 @vindex La@TeX{}-verbatim-environments
10785 The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
10786 @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
10787 into the receiver location with name @code{salesfigures}. You may now
10788 fill in the table, feel free to use the spreadsheet features@footnote{If
10789 the @samp{#+TBLFM} line contains an odd number of dollar characters,
10790 this may cause problems with font-lock in La@TeX{} mode. As shown in the
10791 example you can fix this by adding an extra line inside the
10792 @code{comment} environment that is used to balance the dollar
10793 expressions. If you are using AUC@TeX{} with the font-latex library, a
10794 much better solution is to add the @code{comment} environment to the
10795 variable @code{LaTeX-verbatim-environments}.}:
10798 % BEGIN RECEIVE ORGTBL salesfigures
10799 % END RECEIVE ORGTBL salesfigures
10801 #+ORGTBL: SEND salesfigures orgtbl-to-latex
10802 | Month | Days | Nr sold | per day |
10803 |-------+------+---------+---------|
10804 | Jan | 23 | 55 | 2.4 |
10805 | Feb | 21 | 16 | 0.8 |
10806 | March | 22 | 278 | 12.6 |
10807 #+TBLFM: $4=$3/$2;%.1f
10808 % $ (optional extra dollar to keep font-lock happy, see footnote)
10813 When you are done, press @kbd{C-c C-c} in the table to get the converted
10814 table inserted between the two marker lines.
10816 Now let's assume you want to make the table header by hand, because you
10817 want to control how columns are aligned, etc@. In this case we make sure
10818 that the table translator skips the first 2 lines of the source
10819 table, and tell the command to work as a @i{splice}, @ie to not produce
10820 header and footer commands of the target table:
10823 \begin@{tabular@}@{lrrr@}
10824 Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
10825 % BEGIN RECEIVE ORGTBL salesfigures
10826 % END RECEIVE ORGTBL salesfigures
10830 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
10831 | Month | Days | Nr sold | per day |
10832 |-------+------+---------+---------|
10833 | Jan | 23 | 55 | 2.4 |
10834 | Feb | 21 | 16 | 0.8 |
10835 | March | 22 | 278 | 12.6 |
10836 #+TBLFM: $4=$3/$2;%.1f
10840 The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
10841 Orgtbl mode. It uses a @code{tabular} environment to typeset the table
10842 and marks horizontal lines with @code{\hline}. Furthermore, it
10843 interprets the following parameters (see also @pxref{Translator functions}):
10846 @item :splice nil/t
10847 When set to t, return only table body lines, don't wrap them into a
10848 tabular environment. Default is nil.
10851 A format to be used to wrap each field, it should contain @code{%s} for the
10852 original field value. For example, to wrap each field value in dollars,
10853 you could use @code{:fmt "$%s$"}. This may also be a property list with
10854 column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
10855 A function of one argument can be used in place of the strings; the
10856 function must return a formatted string.
10859 Use this format to print numbers with exponentials. The format should
10860 have @code{%s} twice for inserting mantissa and exponent, for example
10861 @code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This
10862 may also be a property list with column numbers and formats, for example
10863 @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
10864 @code{efmt} has been applied to a value, @code{fmt} will also be
10865 applied. Similar to @code{fmt}, functions of two arguments can be
10866 supplied instead of strings.
10869 @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
10870 @subsection Translator functions
10871 @cindex HTML, and Orgtbl mode
10872 @cindex translator function
10874 Orgtbl mode has several translator functions built-in: @code{orgtbl-to-csv}
10875 (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values)
10876 @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and @code{orgtbl-to-texinfo}.
10877 Except for @code{orgtbl-to-html}@footnote{The HTML translator uses the same
10878 code that produces tables during HTML export.}, these all use a generic
10879 translator, @code{orgtbl-to-generic}. For example, @code{orgtbl-to-latex}
10880 itself is a very short function that computes the column definitions for the
10881 @code{tabular} environment, defines a few field and line separators and then
10882 hands processing over to the generic translator. Here is the entire code:
10886 (defun orgtbl-to-latex (table params)
10887 "Convert the Orgtbl mode TABLE to LaTeX."
10888 (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
10889 org-table-last-alignment ""))
10892 :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
10893 :tend "\\end@{tabular@}"
10894 :lstart "" :lend " \\\\" :sep " & "
10895 :efmt "%s\\,(%s)" :hline "\\hline")))
10896 (orgtbl-to-generic table (org-combine-plists params2 params))))
10900 As you can see, the properties passed into the function (variable
10901 @var{PARAMS}) are combined with the ones newly defined in the function
10902 (variable @var{PARAMS2}). The ones passed into the function (@ie the
10903 ones set by the @samp{ORGTBL SEND} line) take precedence. So if you
10904 would like to use the La@TeX{} translator, but wanted the line endings to
10905 be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
10906 overrule the default with
10909 #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
10912 For a new language, you can either write your own converter function in
10913 analogy with the La@TeX{} translator, or you can use the generic function
10914 directly. For example, if you have a language where a table is started
10915 with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
10916 started with @samp{!BL!}, ended with @samp{!EL!}, and where the field
10917 separator is a TAB, you could call the generic translator like this (on
10921 #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
10922 :lstart "!BL! " :lend " !EL!" :sep "\t"
10926 Please check the documentation string of the function
10927 @code{orgtbl-to-generic} for a full list of parameters understood by
10928 that function, and remember that you can pass each of them into
10929 @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
10930 using the generic function.
10932 Of course you can also write a completely new function doing complicated
10933 things the generic translator cannot do. A translator function takes
10934 two arguments. The first argument is the table, a list of lines, each
10935 line either the symbol @code{hline} or a list of fields. The second
10936 argument is the property list containing all parameters specified in the
10937 @samp{#+ORGTBL: SEND} line. The function must return a single string
10938 containing the formatted table. If you write a generally useful
10939 translator, please post it on @email{emacs-orgmode@@gnu.org} so that
10940 others can benefit from your work.
10942 @node Radio lists, , Translator functions, Tables in arbitrary syntax
10943 @subsection Radio lists
10944 @cindex radio lists
10945 @cindex org-list-insert-radio-list
10947 Sending and receiving radio lists works exactly the same way than
10948 sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
10949 need to load the @code{org-export-latex.el} package to use radio lists
10950 since the relevant code is there for now.}. As for radio tables, you
10951 can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
10952 calling @code{org-list-insert-radio-list}.
10954 Here are the differences with radio tables:
10958 Use @code{ORGLST} instead of @code{ORGTBL}.
10960 The available translation functions for radio lists don't take
10963 @kbd{C-c C-c} will work when pressed on the first item of the list.
10966 Here is a La@TeX{} example. Let's say that you have this in your
10971 % BEGIN RECEIVE ORGLST to-buy
10972 % END RECEIVE ORGLST to-buy
10974 #+ORGLIST: SEND to-buy orgtbl-to-latex
10983 Pressing `C-c C-c' on @code{a new house} and will insert the converted
10984 La@TeX{} list between the two marker lines.
10986 @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Hacking
10987 @section Dynamic blocks
10988 @cindex dynamic blocks
10990 Org documents can contain @emph{dynamic blocks}. These are
10991 specially marked regions that are updated by some user-written function.
10992 A good example for such a block is the clock table inserted by the
10993 command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
10995 Dynamic block are enclosed by a BEGIN-END structure that assigns a name
10996 to the block and can also specify parameters for the function producing
10997 the content of the block.
10999 #+BEGIN:dynamic block
11001 #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
11006 Dynamic blocks are updated with the following commands
11009 @kindex C-c C-x C-u
11011 Update dynamic block at point.
11012 @kindex C-u C-c C-x C-u
11013 @item C-u C-c C-x C-u
11014 Update all dynamic blocks in the current file.
11017 Updating a dynamic block means to remove all the text between BEGIN and
11018 END, parse the BEGIN line for parameters and then call the specific
11019 writer function for this block to insert the new content. If you want
11020 to use the original content in the writer function, you can use the
11021 extra parameter @code{:content}.
11023 For a block with name @code{myblock}, the writer function is
11024 @code{org-dblock-write:myblock} with as only parameter a property list
11025 with the parameters given in the begin line. Here is a trivial example
11026 of a block that keeps track of when the block update function was last
11030 #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
11036 The corresponding block writer function could look like this:
11039 (defun org-dblock-write:block-update-time (params)
11040 (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
11041 (insert "Last block update at: "
11042 (format-time-string fmt (current-time)))))
11045 If you want to make sure that all dynamic blocks are always up-to-date,
11046 you could add the function @code{org-update-all-dblocks} to a hook, for
11047 example @code{before-save-hook}. @code{org-update-all-dblocks} is
11048 written in a way such that it does nothing in buffers that are not in
11051 @node Special agenda views, Extracting agenda information, Dynamic blocks, Hacking
11052 @section Special agenda views
11053 @cindex agenda views, user-defined
11055 Org provides a special hook that can be used to narrow down the
11056 selection made by any of the agenda views. You may specify a function
11057 that is used at each match to verify if the match should indeed be part
11058 of the agenda view, and if not, how much should be skipped.
11060 Let's say you want to produce a list of projects that contain a WAITING
11061 tag anywhere in the project tree. Let's further assume that you have
11062 marked all tree headings that define a project with the TODO keyword
11063 PROJECT. In this case you would run a TODO search for the keyword
11064 PROJECT, but skip the match unless there is a WAITING tag anywhere in
11065 the subtree belonging to the project line.
11067 To achieve this, you must write a function that searches the subtree for
11068 the tag. If the tag is found, the function must return @code{nil} to
11069 indicate that this match should not be skipped. If there is no such
11070 tag, return the location of the end of the subtree, to indicate that
11071 search should continue from there.
11074 (defun my-skip-unless-waiting ()
11075 "Skip trees that are not waiting"
11076 (let ((subtree-end (save-excursion (org-end-of-subtree t))))
11077 (if (re-search-forward ":waiting:" subtree-end t)
11078 nil ; tag found, do not skip
11079 subtree-end))) ; tag not found, continue after end of subtree
11082 Now you may use this function in an agenda custom command, for example
11086 (org-add-agenda-custom-command
11087 '("b" todo "PROJECT"
11088 ((org-agenda-skip-function 'my-skip-unless-waiting)
11089 (org-agenda-overriding-header "Projects waiting for something: "))))
11092 @vindex org-agenda-overriding-header
11093 Note that this also binds @code{org-agenda-overriding-header} to get a
11094 meaningful header in the agenda view.
11096 @vindex org-odd-levels-only
11097 @vindex org-agenda-skip-function
11098 A general way to create custom searches is to base them on a search for
11099 entries with a certain level limit. If you want to study all entries with
11100 your custom search function, simply do a search for
11101 @samp{LEVEL>0}@footnote{Note that, when using @code{org-odd-levels-only}, a
11102 level number corresponds to order in the hierarchy, not to the number of
11103 stars.}, and then use @code{org-agenda-skip-function} to select the entries
11104 you really want to have.
11106 You may also put a Lisp form into @code{org-agenda-skip-function}. In
11107 particular, you may use the functions @code{org-agenda-skip-entry-if}
11108 and @code{org-agenda-skip-subtree-if} in this form, for example:
11111 @item '(org-agenda-skip-entry-if 'scheduled)
11112 Skip current entry if it has been scheduled.
11113 @item '(org-agenda-skip-entry-if 'notscheduled)
11114 Skip current entry if it has not been scheduled.
11115 @item '(org-agenda-skip-entry-if 'deadline)
11116 Skip current entry if it has a deadline.
11117 @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
11118 Skip current entry if it has a deadline, or if it is scheduled.
11119 @item '(org-agenda-skip-entry-if 'timestamp)
11120 Skip current entry if it has any timestamp, may also be deadline or scheduled.
11121 @item '(org-agenda-skip-entry 'regexp "regular expression")
11122 Skip current entry if the regular expression matches in the entry.
11123 @item '(org-agenda-skip-entry 'notregexp "regular expression")
11124 Skip current entry unless the regular expression matches.
11125 @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
11126 Same as above, but check and skip the entire subtree.
11129 Therefore we could also have written the search for WAITING projects
11130 like this, even without defining a special function:
11133 (org-add-agenda-custom-command
11134 '("b" todo "PROJECT"
11135 ((org-agenda-skip-function '(org-agenda-skip-subtree-if
11136 'regexp ":waiting:"))
11137 (org-agenda-overriding-header "Projects waiting for something: "))))
11140 @node Extracting agenda information, Using the property API, Special agenda views, Hacking
11141 @section Extracting agenda information
11142 @cindex agenda, pipe
11143 @cindex Scripts, for agenda processing
11145 @vindex org-agenda-custom-commands
11146 Org provides commands to access agenda information for the command
11147 line in Emacs batch mode. This extracted information can be sent
11148 directly to a printer, or it can be read by a program that does further
11149 processing of the data. The first of these commands is the function
11150 @code{org-batch-agenda}, that produces an agenda view and sends it as
11151 ASCII text to STDOUT. The command takes a single string as parameter.
11152 If the string has length 1, it is used as a key to one of the commands
11153 you have configured in @code{org-agenda-custom-commands}, basically any
11154 key you can use after @kbd{C-c a}. For example, to directly print the
11155 current TODO list, you could use
11158 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
11161 If the parameter is a string with 2 or more characters, it is used as a
11162 tags/TODO match string. For example, to print your local shopping list
11163 (all items with the tag @samp{shop}, but excluding the tag
11164 @samp{NewYork}), you could use
11167 emacs -batch -l ~/.emacs \
11168 -eval '(org-batch-agenda "+shop-NewYork")' | lpr
11172 You may also modify parameters on the fly like this:
11175 emacs -batch -l ~/.emacs \
11176 -eval '(org-batch-agenda "a" \
11177 org-agenda-ndays 30 \
11178 org-agenda-include-diary nil \
11179 org-agenda-files (quote ("~/org/project.org")))' \
11184 which will produce a 30-day agenda, fully restricted to the Org file
11185 @file{~/org/projects.org}, not even including the diary.
11187 If you want to process the agenda data in more sophisticated ways, you
11188 can use the command @code{org-batch-agenda-csv} to get a comma-separated
11189 list of values for each agenda item. Each line in the output will
11190 contain a number of fields separated by commas. The fields in a line
11194 category @r{The category of the item}
11195 head @r{The headline, without TODO keyword, TAGS and PRIORITY}
11196 type @r{The type of the agenda entry, can be}
11197 todo @r{selected in TODO match}
11198 tagsmatch @r{selected in tags match}
11199 diary @r{imported from diary}
11200 deadline @r{a deadline}
11201 scheduled @r{scheduled}
11202 timestamp @r{appointment, selected by timestamp}
11203 closed @r{entry was closed on date}
11204 upcoming-deadline @r{warning about nearing deadline}
11205 past-scheduled @r{forwarded scheduled item}
11206 block @r{entry has date block including date}
11207 todo @r{The TODO keyword, if any}
11208 tags @r{All tags including inherited ones, separated by colons}
11209 date @r{The relevant date, like 2007-2-14}
11210 time @r{The time, like 15:00-16:50}
11211 extra @r{String with extra planning info}
11212 priority-l @r{The priority letter if any was given}
11213 priority-n @r{The computed numerical priority}
11217 Time and date will only be given if a timestamp (or deadline/scheduled)
11218 led to the selection of the item.
11220 A CSV list like this is very easy to use in a post-processing script.
11221 For example, here is a Perl program that gets the TODO list from
11222 Emacs/Org and prints all the items, preceded by a checkbox:
11227 # define the Emacs command to run
11228 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
11230 # run it and capture the output
11231 $agenda = qx@{$cmd 2>/dev/null@};
11233 # loop over all lines
11234 foreach $line (split(/\n/,$agenda)) @{
11235 # get the individual values
11236 ($category,$head,$type,$todo,$tags,$date,$time,$extra,
11237 $priority_l,$priority_n) = split(/,/,$line);
11238 # process and print
11239 print "[ ] $head\n";
11256 @node Using the property API, Using the mapping API, Extracting agenda information, Hacking
11257 @section Using the property API
11258 @cindex API, for properties
11259 @cindex properties, API
11261 Here is a description of the functions that can be used to work with
11264 @defun org-entry-properties &optional pom which
11265 Get all properties of the entry at point-or-marker POM.@*
11266 This includes the TODO keyword, the tags, time strings for deadline,
11267 scheduled, and clocking, and any additional properties defined in the
11268 entry. The return value is an alist, keys may occur multiple times
11269 if the property key was used several times.@*
11270 POM may also be nil, in which case the current entry is used.
11271 If WHICH is nil or `all', get all properties. If WHICH is
11272 `special' or `standard', only get that subclass.
11274 @vindex org-use-property-inheritance
11275 @defun org-entry-get pom property &optional inherit
11276 Get value of PROPERTY for entry at point-or-marker POM. By default,
11277 this only looks at properties defined locally in the entry. If INHERIT
11278 is non-nil and the entry does not have the property, then also check
11279 higher levels of the hierarchy. If INHERIT is the symbol
11280 @code{selective}, use inheritance if and only if the setting of
11281 @code{org-use-property-inheritance} selects PROPERTY for inheritance.
11284 @defun org-entry-delete pom property
11285 Delete the property PROPERTY from entry at point-or-marker POM.
11288 @defun org-entry-put pom property value
11289 Set PROPERTY to VALUE for entry at point-or-marker POM.
11292 @defun org-buffer-property-keys &optional include-specials
11293 Get all property keys in the current buffer.
11296 @defun org-insert-property-drawer
11297 Insert a property drawer at point.
11300 @defun org-entry-put-multivalued-property pom property &rest values
11301 Set PROPERTY at point-or-marker POM to VALUES. VALUES should be a list of
11302 strings. They will be concatenated, with spaces as separators.
11305 @defun org-entry-get-multivalued-property pom property
11306 Treat the value of the property PROPERTY as a whitespace-separated list of
11307 values and return the values as a list of strings.
11310 @defun org-entry-add-to-multivalued-property pom property value
11311 Treat the value of the property PROPERTY as a whitespace-separated list of
11312 values and make sure that VALUE is in this list.
11315 @defun org-entry-remove-from-multivalued-property pom property value
11316 Treat the value of the property PROPERTY as a whitespace-separated list of
11317 values and make sure that VALUE is @emph{not} in this list.
11320 @defun org-entry-member-in-multivalued-property pom property value
11321 Treat the value of the property PROPERTY as a whitespace-separated list of
11322 values and check if VALUE is in this list.
11325 @node Using the mapping API, , Using the property API, Hacking
11326 @section Using the mapping API
11327 @cindex API, for mapping
11328 @cindex mapping entries, API
11330 Org has sophisticated mapping capabilities to find all entries satisfying
11331 certain criteria. Internally, this functionality is used to produce agenda
11332 views, but there is also an API that can be used to execute arbitrary
11333 functions for each or selected entries. The main entry point for this API
11336 @defun org-map-entries func &optional match scope &rest skip
11337 Call FUNC at each headline selected by MATCH in SCOPE.
11339 FUNC is a function or a Lisp form. The function will be called without
11340 arguments, with the cursor positioned at the beginning of the headline.
11341 The return values of all calls to the function will be collected and
11342 returned as a list.
11344 The call to FUNC will be wrapped into a save-excursion form, so FUNC
11345 does not need to preserve point. After evaluaton, the cursor will be
11346 moved to the end of the line (presumably of the headline of the
11347 processed entry) and search continues from there. Under some
11348 circumstances, this may not produce the wanted results. For example,
11349 if you have removed (@eg archived) the current (sub)tree it could
11350 mean that the next entry will be skipped entirely. In such cases, you
11351 can specify the position from where search should continue by making
11352 FUNC set the variable `org-map-continue-from' to the desired buffer
11355 MATCH is a tags/property/todo match as it is used in the agenda match view.
11356 Only headlines that are matched by this query will be considered during
11357 the iteration. When MATCH is nil or t, all headlines will be
11358 visited by the iteration.
11360 SCOPE determines the scope of this command. It can be any of:
11363 nil @r{the current buffer, respecting the restriction if any}
11364 tree @r{the subtree started with the entry at point}
11365 file @r{the current buffer, without restriction}
11367 @r{the current buffer, and any archives associated with it}
11368 agenda @r{all agenda files}
11369 agenda-with-archives
11370 @r{all agenda files with any archive files associated with them}
11372 @r{if this is a list, all files in the list will be scanned}
11375 The remaining args are treated as settings for the skipping facilities of
11376 the scanner. The following items can be given here:
11378 @vindex org-agenda-skip-function
11380 archive @r{skip trees with the archive tag}
11381 comment @r{skip trees with the COMMENT keyword}
11382 function or Lisp form
11383 @r{will be used as value for @code{org-agenda-skip-function},}
11384 @r{so whenever the function returns t, FUNC}
11385 @r{will not be called for that entry and search will}
11386 @r{continue from the point where the function leaves it}
11390 The function given to that mapping routine can really do anything you like.
11391 It can use the property API (@pxref{Using the property API}) to gather more
11392 information about the entry, or in order to change metadata in the entry.
11393 Here are a couple of functions that might be handy:
11395 @defun org-todo &optional arg
11396 Change the TODO state of the entry, see the docstring of the functions for
11397 the many possible values for the argument ARG.
11400 @defun org-priority &optional action
11401 Change the priority of the entry, see the docstring of this function for the
11402 possible values for ACTION.
11405 @defun org-toggle-tag tag &optional onoff
11406 Toggle the tag TAG in the current entry. Setting ONOFF to either @code{on}
11407 or @code{off} will not toggle tag, but ensure that it is either on or off.
11411 Promote the current entry.
11415 Demote the current entry.
11418 Here is a simple example that will turn all entries in the current file with
11419 a tag @code{TOMORROW} into TODO entries with the keyword @code{UPCOMING}.
11420 Entries in comment trees and in archive trees will be ignored.
11424 '(org-todo "UPCOMING")
11425 "+TOMORROW" 'file 'archive 'comment)
11428 The following example counts the number of entries with TODO keyword
11429 @code{WAITING}, in all agenda files.
11432 (length (org-map-entries t "/+WAITING" 'agenda))
11435 @node History and Acknowledgments, Main Index, Hacking, Top
11436 @appendix History and Acknowledgments
11437 @cindex acknowledgments
11441 Org was born in 2003, out of frustration over the user interface
11442 of the Emacs Outline mode. I was trying to organize my notes and
11443 projects, and using Emacs seemed to be the natural way to go. However,
11444 having to remember eleven different commands with two or three keys per
11445 command, only to hide and show parts of the outline tree, that seemed
11446 entirely unacceptable to me. Also, when using outlines to take notes, I
11447 constantly wanted to restructure the tree, organizing it parallel to my
11448 thoughts and plans. @emph{Visibility cycling} and @emph{structure
11449 editing} were originally implemented in the package
11450 @file{outline-magic.el}, but quickly moved to the more general
11451 @file{org.el}. As this environment became comfortable for project
11452 planning, the next step was adding @emph{TODO entries}, basic
11453 @emph{timestamps}, and @emph{table support}. These areas highlighted the two main
11454 goals that Org still has today: To be a new, outline-based,
11455 plain text mode with innovative and intuitive editing features, and to
11456 incorporate project planning functionality directly into a notes file.
11458 A special thanks goes to @i{Bastien Guerry} who has not only written a large
11459 number of extensions to Org (most of them integrated into the core by now),
11460 but who has also helped in the development and maintenance of Org so much that he
11461 should be considered the main co-contributor to this package.
11463 Since the first release, literally thousands of emails to me or to
11464 @email{emacs-orgmode@@gnu.org} have provided a constant stream of bug
11465 reports, feedback, new ideas, and sometimes patches and add-on code.
11466 Many thanks to everyone who has helped to improve this package. I am
11467 trying to keep here a list of the people who had significant influence
11468 in shaping one or more aspects of Org. The list may not be
11469 complete, if I have forgotten someone, please accept my apologies and
11475 @i{Russel Adams} came up with the idea for drawers.
11477 @i{Thomas Baumann} wrote @file{org-bbdb.el} and @file{org-mhe.el}.
11479 @i{Christophe Bataillon} created the great unicorn logo that we use on the
11482 @i{Alex Bochannek} provided a patch for rounding timestamps.
11484 @i{Brad Bozarth} showed how to pull RSS feed data into Org-mode files.
11486 @i{Tom Breton} wrote @file{org-choose.el}.
11488 @i{Charles Cave}'s suggestion sparked the implementation of templates
11491 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
11494 @i{Gregory Chernov} patched support for Lisp forms into table
11495 calculations and improved XEmacs compatibility, in particular by porting
11496 @file{nouline.el} to XEmacs.
11498 @i{Sacha Chua} suggested copying some linking code from Planner.
11500 @i{Baoqiu Cui} contributed the DocBook exporter.
11502 @i{Eddward DeVilla} proposed and tested checkbox statistics. He also
11503 came up with the idea of properties, and that there should be an API for
11506 @i{Nick Dokos} tracked down several nasty bugs.
11508 @i{Kees Dullemond} used to edit projects lists directly in HTML and so
11509 inspired some of the early development, including HTML export. He also
11510 asked for a way to narrow wide table columns.
11512 @i{Christian Egli} converted the documentation into Texinfo format,
11513 patched CSS formatting into the HTML exporter, and inspired the agenda.
11515 @i{David Emery} provided a patch for custom CSS support in exported
11518 @i{Nic Ferrier} contributed mailcap and XOXO support.
11520 @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
11522 @i{John Foerch} figured out how to make incremental search show context
11523 around a match in a hidden outline tree.
11525 @i{Niels Giesen} had the idea to automatically archive DONE trees.
11527 @i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and
11528 has been prolific with patches, ideas, and bug reports.
11530 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
11532 @i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
11533 task state change logging, and the clocktable. His clear explanations have
11534 been critical when we started to adopt the Git version control system.
11536 @i{Manuel Hermenegildo} has contributed various ideas, small fixes and
11539 @i{Phil Jackson} wrote @file{org-irc.el}.
11541 @i{Scott Jaderholm} proposed footnotes, control over whitespace between
11542 folded entries, and column view for properties.
11544 @i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}.
11546 @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also
11547 provided frequent feedback and some patches.
11549 @i{Matt Lundin} has proposed last-row references for table formulas and named
11550 invisible anchors. He has also worked a lot on the FAQ.
11552 @i{Jason F. McBrayer} suggested agenda export to CSV format.
11554 @i{Max Mikhanosha} came up with the idea of refiling.
11556 @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
11559 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
11562 @i{Rick Moynihan} proposed allowing multiple TODO sequences in a file
11563 and being able to quickly restrict the agenda to a subtree.
11565 @i{Todd Neal} provided patches for links to Info files and Elisp forms.
11567 @i{Tim O'Callaghan} suggested in-file links, search options for general
11568 file links, and TAGS.
11570 @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
11573 @i{Oliver Oppitz} suggested multi-state TODO items.
11575 @i{Scott Otterson} sparked the introduction of descriptive text for
11576 links, among other things.
11578 @i{Pete Phillips} helped during the development of the TAGS feature, and
11579 provided frequent feedback.
11581 @i{Martin Pohlack} provided the code snippet to bundle character insertion
11582 into bundles of 20 for undo.
11584 @i{T.V. Raman} reported bugs and suggested improvements.
11586 @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
11589 @i{Paul Rivier} provided the basic implementation of named footnotes.
11591 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
11593 @i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
11594 webpages derived from Org using an Info-like or a folding interface with
11595 single-key navigation.
11597 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
11598 conflict with @file{allout.el}.
11600 @i{Jason Riedy} generalized the send-receive mechanism for Orgtbl tables with
11603 @i{Philip Rooke} created the Org reference card, provided lots
11604 of feedback, developed and applied standards to the Org documentation.
11606 @i{Christian Schlauer} proposed angular brackets around links, among
11609 @i{Eric Schulte} wrote @file{org-plot.el} and contributed various patches,
11610 small features and modules.
11612 Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s
11613 @file{organizer-mode.el}.
11615 @i{Ilya Shlyakhter} proposed the Archive Sibling, line numbering in literal
11616 examples, and remote highlighting for referenced code lines.
11618 @i{Stathis Sideris} wrote the @file{ditaa.jar} ASCII to PNG converter that is
11619 now packaged into Org's @file{contrib} directory.
11621 @i{Daniel Sinder} came up with the idea of internal archiving by locking
11624 @i{Dale Smith} proposed link abbreviations.
11626 @i{James TD Smith} has contributed a large number of patches for useful
11627 tweaks and features.
11629 @i{Adam Spiers} asked for global linking commands, inspired the link
11630 extension system, added support for mairix, and proposed the mapping API.
11632 @i{Andy Stewart} contributed code to @file{org-w3m.el}, to copy HTML content
11633 with links transformation to Org syntax.
11635 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
11636 chapter about publishing.
11638 @i{J@"urgen Vollmer} contributed code generating the table of contents
11641 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
11644 @i{David Wainberg} suggested archiving, and improvements to the linking
11647 @i{John Wiegley} wrote @file{emacs-wiki.el}, @file{planner.el}, and
11648 @file{muse.el}, which have some overlap with Org. Initially the development
11649 of Org was fully independent because I was not aware of the existence of
11650 these packages. But with time I have occasionally looked at John's code and
11651 learned a lot from it. John has also contributed a number of great ideas and
11652 patches directly to Org, including the attachment system
11653 (@file{org-attach.el}), integration with Apple Mail
11654 (@file{org-mac-message.el}), and hierarchical dependencies of TODO items.
11656 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
11659 @i{Roland Winkler} requested additional key bindings to make Org
11662 @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
11663 and contributed various ideas and code snippets.
11667 @node Main Index, Key Index, History and Acknowledgments, Top
11668 @unnumbered Concept Index
11672 @node Key Index, Variable Index, Main Index, Top
11673 @unnumbered Key Index
11677 @node Variable Index, , Key Index, Top
11678 @unnumbered Variable Index
11680 This is not a complete index of variables and faces, only the ones that are
11681 mentioned in the manual. For a more complete list, use @kbd{M-x
11682 org-customize @key{RET}} and then klick yourself through the tree.
11689 arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
11692 @c Local variables:
11693 @c ispell-local-dictionary: "en_US-w_accents"
11694 @c ispell-local-pdict: "./.aspell.org.pws"