Version number 6.05pre01, with a detailed list of changes.
[org-mode.git] / doc / org.texi
blob57a3f294b971847bcfb5db05b037cf5b87e38f21
1 \input texinfo
2 @c %**start of header
3 @setfilename ../../info/org
4 @settitle The Org Manual
6 @set VERSION 6.05pre01
7 @set DATE June 2008
9 @dircategory Emacs
10 @direntry
11 * Org Mode: (org).      Outline-based notes management and organizer
12 @end direntry
14 @c Version and Contact Info
15 @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
16 @set AUTHOR Carsten Dominik
17 @set MAINTAINER Carsten Dominik
18 @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
19 @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
20 @c %**end of header
21 @finalout
23 @c Macro definitions
25 @c Subheadings inside a table.
26 @macro tsubheading{text}
27 @ifinfo
28 @subsubheading \text\
29 @end ifinfo
30 @ifnotinfo
31 @item @b{\text\}
32 @end ifnotinfo
33 @end macro
35 @copying
36 This manual is for Org (version @value{VERSION}).
38 Copyright @copyright{} 2004, 2005, 2006, 2007, 2008 Free Software Foundation
40 @quotation
41 Permission is granted to copy, distribute and/or modify this document
42 under the terms of the GNU Free Documentation License, Version 1.1 or
43 any later version published by the Free Software Foundation; with no
44 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
45 and with the Back-Cover Texts as in (a) below.  A copy of the
46 license is included in the section entitled ``GNU Free Documentation
47 License.
49 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
50 this GNU Manual, like GNU software.  Copies published by the Free
51 Software Foundation raise funds for GNU development.''
52 @end quotation
53 @end copying
55 @titlepage
56 @title The Org Manual
58 @subtitle Release @value{VERSION}
59 @author by Carsten Dominik
61 @c The following two commands start the copyright page.
62 @page
63 @vskip 0pt plus 1filll
64 @insertcopying
65 @end titlepage
67 @c Output the table of contents at the beginning.
68 @contents
70 @ifnottex
71 @node Top, Introduction, (dir), (dir)
72 @top Org Mode Manual
74 @insertcopying
75 @end ifnottex
77 @menu
78 * Introduction::                Getting started
79 * Document Structure::          A tree works like your brain
80 * Tables::                      Pure magic for quick formatting
81 * Hyperlinks::                  Notes in context
82 * TODO Items::                  Every tree branch can be a TODO item
83 * Tags::                        Tagging headlines and matching sets of tags
84 * Properties and Columns::      Storing information about an entry
85 * Dates and Times::             Making items useful for planning
86 * Remember::                    Quickly adding nodes to the outline tree
87 * Agenda Views::                Collecting information into views
88 * Embedded LaTeX::              LaTeX fragments and formulas
89 * Exporting::                   Sharing and publishing of notes
90 * Publishing::                  Create a web site of linked Org files
91 * Miscellaneous::               All the rest which did not fit elsewhere
92 * Extensions::                 
93 * Hacking::                     
94 * History and Acknowledgments::  How Org came into being
95 * Main Index::                  An index of Org's concepts and features
96 * Key Index::                   Key bindings and where they are described
98 @detailmenu
99  --- The Detailed Node Listing ---
101 Introduction
103 * Summary::                     Brief summary of what Org does
104 * Installation::                How to install a downloaded version of Org
105 * Activation::                  How to activate Org for certain buffers
106 * Feedback::                    Bug reports, ideas, patches etc.
107 * Conventions::                 Type-setting conventions in the manual
109 Document Structure
111 * Outlines::                    Org is based on Outline mode
112 * Headlines::                   How to typeset Org tree headlines
113 * Visibility cycling::          Show and hide, much simplified
114 * Motion::                      Jumping to other headlines
115 * Structure editing::           Changing sequence and level of headlines
116 * Archiving::                   Move done task trees to a different place
117 * Sparse trees::                Matches embedded in context
118 * Plain lists::                 Additional structure within an entry
119 * Drawers::                     Tucking stuff away
120 * Orgstruct mode::              Structure editing outside Org
122 Archiving
124 * ARCHIVE tag::                 Marking a tree as inactive
125 * Moving subtrees::             Moving a tree to an archive file
127 Tables
129 * Built-in table editor::       Simple tables
130 * Narrow columns::              Stop wasting space in tables
131 * Column groups::               Grouping to trigger vertical lines
132 * Orgtbl mode::                 The table editor as minor mode
133 * The spreadsheet::             The table editor has spreadsheet capabilities
135 The spreadsheet
137 * References::                  How to refer to another field or range
138 * Formula syntax for Calc::     Using Calc to compute stuff
139 * Formula syntax for Lisp::     Writing formulas in Emacs Lisp
140 * Field formulas::              Formulas valid for a single field
141 * Column formulas::             Formulas valid for an entire column
142 * Editing and debugging formulas::  Fixing formulas
143 * Updating the table::          Recomputing all dependent fields
144 * Advanced features::           Field names, parameters and automatic recalc
146 Hyperlinks
148 * Link format::                 How links in Org are formatted
149 * Internal links::              Links to other places in the current file
150 * External links::              URL-like links to the world
151 * Handling links::              Creating, inserting and following
152 * Using links outside Org::     Linking from my C source code?
153 * Link abbreviations::          Shortcuts for writing complex links
154 * Search options::              Linking to a specific location
155 * Custom searches::             When the default search is not enough
157 Internal links
159 * Radio targets::               Make targets trigger links in plain text
161 TODO Items
163 * TODO basics::                 Marking and displaying TODO entries
164 * TODO extensions::             Workflow and assignments
165 * Progress logging::            Dates and notes for progress
166 * Priorities::                  Some things are more important than others
167 * Breaking down tasks::         Splitting a task into manageable pieces
168 * Checkboxes::                  Tick-off lists
170 Extended use of TODO keywords
172 * Workflow states::             From TODO to DONE in steps
173 * TODO types::                  I do this, Fred does the rest
174 * Multiple sets in one file::   Mixing it all, and still finding your way
175 * Fast access to TODO states::  Single letter selection of a state
176 * Per-file keywords::           Different files, different requirements
177 * Faces for TODO keywords::     Highlighting states
179 Progress logging
181 * Closing items::               When was this entry marked DONE?
182 * Tracking TODO state changes::  When did the status change?
184 Tags
186 * Tag inheritance::             Tags use the tree structure of the outline
187 * Setting tags::                How to assign tags to a headline
188 * Tag searches::                Searching for combinations of tags
190 Properties and Columns
192 * Property syntax::             How properties are spelled out
193 * Special properties::          Access to other Org mode features
194 * Property searches::           Matching property values
195 * Property inheritance::        Passing values down the tree
196 * Column view::                 Tabular viewing and editing
197 * Property API::                Properties for Lisp programmers
199 Column view
201 * Defining columns::            The COLUMNS format property
202 * Using column view::           How to create and use column view
203 * Capturing column view::       A dynamic block for column view
205 Defining columns
207 * Scope of column definitions::  Where defined, where valid?
208 * Column attributes::           Appearance and content of a column
210 Dates and Times
212 * Timestamps::                  Assigning a time to a tree entry
213 * Creating timestamps::         Commands which insert timestamps
214 * Deadlines and scheduling::    Planning your work
215 * Clocking work time::          Tracking how long you spend on a task
216 * Effort estimates::            Planning work effort in advance
218 Creating timestamps
220 * The date/time prompt::        How Org mode helps you entering date and time
221 * Custom time format::          Making dates look different
223 Deadlines and scheduling
225 * Inserting deadline/schedule::  Planning items
226 * Repeated tasks::              Items that show up again and again
228 Remember
230 * Setting up Remember::         Some code for .emacs to get things going
231 * Remember templates::          Define the outline of different note types
232 * Storing notes::               Directly get the note to where it belongs
233 * Refiling notes::              Moving a note or task to a project
235 Agenda Views
237 * Agenda files::                Files being searched for agenda information
238 * Agenda dispatcher::           Keyboard access to agenda views
239 * Built-in agenda views::       What is available out of the box?
240 * Presentation and sorting::    How agenda items are prepared for display
241 * Agenda commands::             Remote editing of Org trees
242 * Custom agenda views::         Defining special searches and views
243 * Agenda column view::          Using column view for collected entries
245 The built-in agenda views
247 * Weekly/daily agenda::         The calendar page with current tasks
248 * Global TODO list::            All unfinished action items
249 * Matching tags and properties::  Structured information with fine-tuned search
250 * Timeline::                    Time-sorted view for single file
251 * Keyword search::              Finding entries by keyword
252 * Stuck projects::              Find projects you need to review
254 Presentation and sorting
256 * Categories::                  Not all tasks are equal
257 * Time-of-day specifications::  How the agenda knows the time
258 * Sorting of agenda items::     The order of things
260 Custom agenda views
262 * Storing searches::            Type once, use often
263 * Block agenda::                All the stuff you need in a single buffer
264 * Setting Options::             Changing the rules
265 * Exporting Agenda Views::      Writing agendas to files
266 * Using the agenda elsewhere::  Using agenda information in other programs
268 Embedded LaTeX
270 * Math symbols::                TeX macros for symbols and Greek letters
271 * Subscripts and superscripts::  Simple syntax for raising/lowering text
272 * LaTeX fragments::             Complex formulas made easy
273 * Processing LaTeX fragments::  Previewing LaTeX processing
274 * CDLaTeX mode::                Speed up entering of formulas
276 Exporting
278 * Markup rules::                Which structures are recognized?
279 * Export options::              Per-file export settings
280 * The export dispatcher::       How to access exporter commands
281 * ASCII export::                Exporting to plain ASCII
282 * HTML export::                 Exporting to HTML
283 * LaTeX export::                Exporting to LaTeX
284 * XOXO export::                 Exporting to XOXO
285 * iCalendar export::            Exporting in iCalendar format
287 Markup rules
289 * Document title::              How the document title is determined
290 * Headings and sections::       The main structure of the exported document
291 * Table of contents::           If, where, how to create a table of contents
292 * Initial text::                Text before the first headline
293 * Lists::                       Plain lists are exported
294 * Paragraphs::                  What determines beginning and ending
295 * Literal examples::            Source code and other examples
296 * Include files::               Include the contents of a file during export
297 * Tables exported::             Tables are exported richly
298 * Footnotes::                   Numbers like [1]
299 * Emphasis and monospace::      To bold or not to bold
300 * TeX macros and LaTeX fragments::  Create special, rich export.
301 * Horizontal rules::            A line across the page
302 * Comment lines::               Some lines will not be exported
304 HTML export
306 * HTML Export commands::        How to invoke HTML export
307 * Quoting HTML tags::           Using direct HTML in Org mode
308 * Links::                       Transformation of links for HTML
309 * Images::                      How to include images
310 * CSS support::                 Changing the appearance of the output
311 * Javascript support::          Info and Folding in a web browser
313 LaTeX export
315 * LaTeX export commands::       How to invoke LaTeX export
316 * Quoting LaTeX code::          Incorporating literal LaTeX code
317 * Sectioning structure::        Changing sectioning in LaTeX output
319 Publishing
321 * Configuration::               Defining projects
322 * Sample configuration::        Example projects
323 * Triggering publication::      Publication commands
325 Configuration
327 * Project alist::               The central configuration variable
328 * Sources and destinations::    From here to there
329 * Selecting files::             What files are part of the project?
330 * Publishing action::           Setting the function doing the publishing
331 * Publishing options::          Tweaking HTML export
332 * Publishing links::            Which links keep working after publishing?
333 * Project page index::          Publishing a list of project files
335 Sample configuration
337 * Simple example::              One-component publishing
338 * Complex example::             A multi-component publishing example
340 Miscellaneous
342 * Completion::                  M-TAB knows what you need
343 * Customization::               Adapting Org to your taste
344 * In-buffer settings::          Overview of the #+KEYWORDS
345 * The very busy C-c C-c key::   When in doubt, press C-c C-c
346 * Clean view::                  Getting rid of leading stars in the outline
347 * TTY keys::                    Using Org on a tty
348 * Interaction::                 Other Emacs packages
349 * Bugs::                        Things which do not work perfectly
351 Interaction with other packages
353 * Cooperation::                 Packages Org cooperates with
354 * Conflicts::                   Packages that lead to conflicts
356 Extensions
358 * Extensions in the contrib directory::  These come with the Org distro
359 * Other extensions::            These you have to find on the web.
361 Hacking
363 * Adding hyperlink types::      New custom link types
364 * Tables in arbitrary syntax::  Orgtbl for LaTeX and other programs
365 * Dynamic blocks::              Automatically filled blocks
366 * Special agenda views::        Customized views
367 * Using the property API::      Writing programs that use entry properties
368 * Using the mapping API::       Mapping over all or selected entries
370 Tables and lists in arbitrary syntax
372 * Radio tables::                Sending and receiving
373 * A LaTeX example::             Step by step, almost a tutorial
374 * Translator functions::        Copy and modify
375 * Radio lists::                 Doing the same for lists
377 @end detailmenu
378 @end menu
380 @node Introduction, Document Structure, Top, Top
381 @chapter Introduction
382 @cindex introduction
384 @menu
385 * Summary::                     Brief summary of what Org does
386 * Installation::                How to install a downloaded version of Org
387 * Activation::                  How to activate Org for certain buffers
388 * Feedback::                    Bug reports, ideas, patches etc.
389 * Conventions::                 Type-setting conventions in the manual
390 @end menu
392 @node Summary, Installation, Introduction, Introduction
393 @section Summary
394 @cindex summary
396 Org is a mode for keeping notes, maintaining TODO lists, and doing
397 project planning with a fast and effective plain-text system.
399 Org develops organizational tasks around NOTES files that contain
400 lists or information about projects as plain text.  Org is
401 implemented on top of Outline mode, which makes it possible to keep the
402 content of large files well structured.  Visibility cycling and
403 structure editing help to work with the tree.  Tables are easily created
404 with a built-in table editor.  Org supports TODO items, deadlines,
405 time stamps, and scheduling.  It dynamically compiles entries into an
406 agenda that utilizes and smoothly integrates much of the Emacs calendar
407 and diary.  Plain text URL-like links connect to websites, emails,
408 Usenet messages, BBDB entries, and any files related to the projects.
409 For printing and sharing of notes, an Org file can be exported as a
410 structured ASCII file, as HTML, or (TODO and agenda items only) as an
411 iCalendar file.  It can also serve as a publishing tool for a set of
412 linked web pages.
414 An important design aspect that distinguishes Org from for example
415 Planner/Muse is that it encourages to store every piece of information
416 only once.  In Planner, you have project pages, day pages and possibly
417 other files, duplicating some information such as tasks.  In Org,
418 you only have notes files.  In your notes you mark entries as tasks,
419 label them with tags and timestamps.  All necessary lists like a
420 schedule for the day, the agenda for a meeting, tasks lists selected by
421 tags etc are created dynamically when you need them.
423 Org keeps simple things simple.  When first fired up, it should
424 feel like a straightforward, easy to use outliner.  Complexity is not
425 imposed, but a large amount of functionality is available when you need
426 it.  Org is a toolbox and can be used in different ways, for
427 example as:
429 @example
430 @r{@bullet{} outline extension with visibility cycling and structure editing}
431 @r{@bullet{} ASCII system and table editor for taking structured notes}
432 @r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
433 @r{@bullet{} TODO list editor}
434 @r{@bullet{} full agenda and planner with deadlines and work scheduling}
435 @r{@bullet{} environment to implement David Allen's GTD system}
436 @r{@bullet{} a basic database application}
437 @r{@bullet{} simple hypertext system, with HTML and LaTeX export}
438 @r{@bullet{} publishing tool to create a set of interlinked webpages}
439 @end example
441 Org's automatic, context sensitive table editor with spreadsheet
442 capabilities can be integrated into any major mode by activating the
443 minor Orgtbl mode.  Using a translation step, it can be used to maintain
444 tables in arbitrary file types, for example in La@TeX{}.  The structure
445 editing and list creation capabilities can be used outside Org with
446 the minor Orgstruct mode.
448 @cindex FAQ
449 There is a website for Org which provides links to the newest
450 version of Org, as well as additional information, frequently asked
451 questions (FAQ), links to tutorials etc.  This page is located at
452 @uref{http://orgmode.org}.
454 @page
457 @node Installation, Activation, Summary, Introduction
458 @section Installation
459 @cindex installation
460 @cindex XEmacs
462 @b{Important:} @i{If Org is part of the Emacs distribution or an
463 XEmacs package, please skip this section and go directly to
464 @ref{Activation}.}
466 If you have downloaded Org from the Web, either as a distribution @file{.zip}
467 or @file{.tar} file, or as a GIT archive, you must take the following steps
468 to install it: Go into the unpacked Org distribution directory and edit the
469 top section of the file @file{Makefile}.  You must set the name of the Emacs
470 binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
471 directories where local Lisp and Info files are kept.  If you don't have
472 access to the system-wide directories, you can simply run Org directly from
473 the distribution directory by adding the @file{lisp} subdirectory to the
474 Emacs load path.  To do this, add the following line to @file{.emacs}:
476 @example
477 (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
478 @end example
480 @noindent
481 If you plan to use code from the @file{contrib} subdirectory, do a similar
482 step for this directory:
484 @example
485 (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
486 @end example
488 @b{XEmacs users now need to install the file @file{noutline.el} from
489 the @file{xemacs} sub-directory of the Org distribution.  Use the
490 command:}
492 @example
493 @b{make install-noutline}
494 @end example
496 @noindent Now byte-compile the Lisp files with the shell command:
498 @example
499 make
500 @end example
502 @noindent If you are running Org from the distribution directory, this is
503 all.  If you want to install into the system directories, use
505 @example
506 make install
507 make install-info
508 @end example
510 @noindent Then add to @file{.emacs}:
512 @lisp
513 ;; This line only if Org is not part of the X/Emacs distribution.
514 (require 'org-install)
515 @end lisp
518 @node Activation, Feedback, Installation, Introduction
519 @section Activation
520 @cindex activation
521 @cindex autoload
522 @cindex global key bindings
523 @cindex key bindings, global
525 @iftex
526 @b{Important:} @i{If you use copy-and-paste to copy lisp code from the
527 PDF documentation as viewed by Acrobat reader to your .emacs file, the
528 single quote character comes out incorrectly and the code will not work.
529 You need to fix the single quotes by hand, or copy from Info
530 documentation.}
531 @end iftex
533 Add the following lines to your @file{.emacs} file.  The last two lines
534 define @emph{global} keys for the commands @command{org-store-link},
535 @command{org-agenda}, and @command{org-iswitchb} - please choose suitable
536 keys yourself.
538 @lisp
539 ;; The following lines are always needed.  Choose your own keys.
540 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
541 (global-set-key "\C-cl" 'org-store-link)
542 (global-set-key "\C-ca" 'org-agenda)
543 (global-set-key "\C-cb" 'org-iswitchb)
544 @end lisp
546 Furthermore, you must activate @code{font-lock-mode} in Org
547 buffers, because significant functionality depends on font-locking being
548 active.  You can do this with either one of the following two lines
549 (XEmacs user must use the second option):
550 @lisp
551 (global-font-lock-mode 1)                     ; for all buffers
552 (add-hook 'org-mode-hook 'turn-on-font-lock)  ; Org buffers only
553 @end lisp
555 @cindex Org mode, turning on
556 With this setup, all files with extension @samp{.org} will be put
557 into Org mode.  As an alternative, make the first line of a file look
558 like this:
560 @example
561 MY PROJECTS    -*- mode: org; -*-
562 @end example
564 @noindent which will select Org mode for this buffer no matter what
565 the file's name is.  See also the variable
566 @code{org-insert-mode-line-in-empty-file}.
568 @node Feedback, Conventions, Activation, Introduction
569 @section Feedback
570 @cindex feedback
571 @cindex bug reports
572 @cindex maintainer
573 @cindex author
575 If you find problems with Org, or if you have questions, remarks, or ideas
576 about it, please mail to the Org mailing list @code{emacs-orgmode@@gnu.org}.
577 If you are not a member of the mailing list, your mail will be reviewed by a
578 moderator and then passed through to the list.
580 For bug reports, please provide as much information as possible,
581 including the version information of Emacs (@kbd{C-h v emacs-version
582 @key{RET}}) and Org (@kbd{C-h v org-version @key{RET}}), as well as
583 the Org related setup in @file{.emacs}.  If an error occurs, a
584 backtrace can be very useful (see below on how to create one).  Often a
585 small example file helps, along with clear information about:
587 @enumerate
588 @item What exactly did you do?
589 @item What did you expect to happen?
590 @item What happened instead?
591 @end enumerate
592 @noindent Thank you for helping to improve this mode.
594 @subsubheading How to create a useful backtrace
596 @cindex backtrace of an error
597 If working with Org produces an error with a message you don't
598 understand, you may have hit a bug.  The best way to report this is by
599 providing, in addition to what was mentioned above, a @emph{Backtrace}.
600 This is information from the built-in debugger about where and how the
601 error occurred.  Here is how to produce a useful backtrace:
603 @enumerate
604 @item
605 Start a fresh Emacs or XEmacs, and make sure that it will load the
606 original Lisp code in @file{org.el} instead of the compiled version in
607 @file{org.elc}.  The backtrace contains much more information if it is
608 produced with uncompiled code.  To do this, either rename @file{org.elc}
609 to something else before starting Emacs, or ask Emacs explicitly to load
610 @file{org.el} by using the command line
611 @example
612 emacs -l /path/to/org.el
613 @end example
614 @item
615 Go to the @code{Options} menu and select @code{Enter Debugger on Error}
616 (XEmacs has this option in the @code{Troubleshooting} sub-menu).
617 @item
618 Do whatever you have to do to hit the error.  Don't forget to
619 document the steps you take.
620 @item
621 When you hit the error, a @file{*Backtrace*} buffer will appear on the
622 screen.  Save this buffer to a file (for example using @kbd{C-x C-w}) and
623 attach it to your bug report.
624 @end enumerate
626 @node Conventions,  , Feedback, Introduction
627 @section Typesetting conventions used in this manual
629 Org uses three types of keywords: TODO keywords, tags, and property
630 names.  In this manual we use the following conventions:
632 @table @code
633 @item TODO
634 @itemx WAITING
635 TODO keywords are written with all capitals, even if they are
636 user-defined.
637 @item boss
638 @itemx ARCHIVE
639 User-defined tags are written in lowercase; built-in tags with special
640 meaning are written with all capitals.
641 @item Release
642 @itemx PRIORITY
643 User-defined properties are capitalized; built-in properties with
644 special meaning are written with all capitals.
645 @end table
647 @node Document Structure, Tables, Introduction, Top
648 @chapter Document Structure
649 @cindex document structure
650 @cindex structure of document
652 Org is based on outline mode and provides flexible commands to
653 edit the structure of the document.
655 @menu
656 * Outlines::                    Org is based on Outline mode
657 * Headlines::                   How to typeset Org tree headlines
658 * Visibility cycling::          Show and hide, much simplified
659 * Motion::                      Jumping to other headlines
660 * Structure editing::           Changing sequence and level of headlines
661 * Archiving::                   Move done task trees to a different place
662 * Sparse trees::                Matches embedded in context
663 * Plain lists::                 Additional structure within an entry
664 * Drawers::                     Tucking stuff away
665 * Orgstruct mode::              Structure editing outside Org
666 @end menu
668 @node Outlines, Headlines, Document Structure, Document Structure
669 @section Outlines
670 @cindex outlines
671 @cindex Outline mode
673 Org is implemented on top of Outline mode.  Outlines allow a
674 document to be organized in a hierarchical structure, which (at least
675 for me) is the best representation of notes and thoughts.  An overview
676 of this structure is achieved by folding (hiding) large parts of the
677 document to show only the general document structure and the parts
678 currently being worked on.  Org greatly simplifies the use of
679 outlines by compressing the entire show/hide functionality into a single
680 command @command{org-cycle}, which is bound to the @key{TAB} key.
682 @node Headlines, Visibility cycling, Outlines, Document Structure
683 @section Headlines
684 @cindex headlines
685 @cindex outline tree
687 Headlines define the structure of an outline tree.  The headlines in
688 Org start with one or more stars, on the left margin@footnote{See
689 the variable @code{org-special-ctrl-a/e} to configure special behavior
690 of @kbd{C-a} and @kbd{C-e} in headlines.}.  For example:
692 @example
693 * Top level headline
694 ** Second level
695 *** 3rd level
696     some text
697 *** 3rd level
698     more text
700 * Another top level headline
701 @end example
703 @noindent Some people find the many stars too noisy and would prefer an
704 outline that has whitespace followed by a single star as headline
705 starters.  @ref{Clean view} describes a setup to realize this.
707 An empty line after the end of a subtree is considered part of it and
708 will be hidden when the subtree is folded.  However, if you leave at
709 least two empty lines, one empty line will remain visible after folding
710 the subtree, in order to structure the collapsed view.  See the
711 variable @code{org-cycle-separator-lines} to modify this behavior.
713 @node Visibility cycling, Motion, Headlines, Document Structure
714 @section Visibility cycling
715 @cindex cycling, visibility
716 @cindex visibility cycling
717 @cindex trees, visibility
718 @cindex show hidden text
719 @cindex hide text
721 Outlines make it possible to hide parts of the text in the buffer.
722 Org uses just two commands, bound to @key{TAB} and
723 @kbd{S-@key{TAB}} to change the visibility in the buffer.
725 @cindex subtree visibility states
726 @cindex subtree cycling
727 @cindex folded, subtree visibility state
728 @cindex children, subtree visibility state
729 @cindex subtree, subtree visibility state
730 @table @kbd
731 @kindex @key{TAB}
732 @item @key{TAB}
733 @emph{Subtree cycling}: Rotate current subtree among the states
735 @example
736 ,-> FOLDED -> CHILDREN -> SUBTREE --.
737 '-----------------------------------'
738 @end example
740 The cursor must be on a headline for this to work@footnote{see, however,
741 the option @code{org-cycle-emulate-tab}.}.  When the cursor is at the
742 beginning of the buffer and the first line is not a headline, then
743 @key{TAB} actually runs global cycling (see below)@footnote{see the
744 option @code{org-cycle-global-at-bob}.}.  Also when called with a prefix
745 argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
747 @cindex global visibility states
748 @cindex global cycling
749 @cindex overview, global visibility state
750 @cindex contents, global visibility state
751 @cindex show all, global visibility state
752 @kindex S-@key{TAB}
753 @item S-@key{TAB}
754 @itemx C-u @key{TAB}
755 @emph{Global cycling}: Rotate the entire buffer among the states
757 @example
758 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
759 '--------------------------------------'
760 @end example
762 When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
763 CONTENTS view up to headlines of level N will be shown.  Note that inside
764 tables, @kbd{S-@key{TAB}} jumps to the previous field.
766 @cindex show all, command
767 @kindex C-c C-a
768 @item C-c C-a
769 Show all.
770 @kindex C-c C-r
771 @item C-c C-r
772 Reveal context around point, showing the current entry, the following heading
773 and the hierarchy above.  Useful for working near a location that has been
774 exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
775 (@pxref{Agenda commands}).  With a prefix argument show, on each
776 level, all sibling headings.
777 @kindex C-c C-x b
778 @item C-c C-x b
779 Show the current subtree in an indirect buffer@footnote{The indirect
780 buffer
781 @ifinfo
782 (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
783 @end ifinfo
784 @ifnotinfo
785 (see the Emacs manual for more information about indirect buffers)
786 @end ifnotinfo
787 will contain the entire buffer, but will be narrowed to the current
788 tree.  Editing the indirect buffer will also change the original buffer,
789 but without affecting visibility in that buffer.}.  With a numeric
790 prefix argument N, go up to level N and then take that tree.  If N is
791 negative then go up that many levels.  With a @kbd{C-u} prefix, do not remove
792 the previously used indirect buffer.
793 @end table
795 When Emacs first visits an Org file, the global state is set to
796 OVERVIEW, i.e. only the top level headlines are visible.  This can be
797 configured through the variable @code{org-startup-folded}, or on a
798 per-file basis by adding one of the following lines anywhere in the
799 buffer:
801 @example
802 #+STARTUP: overview
803 #+STARTUP: content
804 #+STARTUP: showall
805 @end example
807 @noindent
808 Forthermore, any entries with a @samp{VISIBILITY} property (@pxref{Properties
809 and Columns}) will get their visibility adapted accordingly.  Allowed values
810 for this property are @code{folded}, @code{children}, @code{content}, and
811 @code{all}.
812 @table @kbd
813 @kindex C-u C-u @key{TAB}
814 @item C-u C-u @key{TAB}
815 Switch back to the startup visibility of the buffer, i.e. whatever is
816 requested by startup options and @samp{VISIBILITY} properties in individual
817 entries.
818 @end table
820 @node Motion, Structure editing, Visibility cycling, Document Structure
821 @section Motion
822 @cindex motion, between headlines
823 @cindex jumping, to headlines
824 @cindex headline navigation
825 The following commands jump to other headlines in the buffer.
827 @table @kbd
828 @kindex C-c C-n
829 @item C-c C-n
830 Next heading.
831 @kindex C-c C-p
832 @item C-c C-p
833 Previous heading.
834 @kindex C-c C-f
835 @item C-c C-f
836 Next heading same level.
837 @kindex C-c C-b
838 @item C-c C-b
839 Previous heading same level.
840 @kindex C-c C-u
841 @item C-c C-u
842 Backward to higher level heading.
843 @kindex C-c C-j
844 @item C-c C-j
845 Jump to a different place without changing the current outline
846 visibility.  Shows the document structure in a temporary buffer, where
847 you can use the following keys to find your destination:
848 @example
849 @key{TAB}         @r{Cycle visibility.}
850 @key{down} / @key{up}   @r{Next/previous visible headline.}
851 n / p        @r{Next/previous visible headline.}
852 f / b        @r{Next/previous headline same level.}
853 u            @r{One level up.}
854 0-9          @r{Digit argument.}
855 @key{RET}         @r{Select this location.}
856 @end example
857 @end table
859 @node Structure editing, Archiving, Motion, Document Structure
860 @section Structure editing
861 @cindex structure editing
862 @cindex headline, promotion and demotion
863 @cindex promotion, of subtrees
864 @cindex demotion, of subtrees
865 @cindex subtree, cut and paste
866 @cindex pasting, of subtrees
867 @cindex cutting, of subtrees
868 @cindex copying, of subtrees
869 @cindex subtrees, cut and paste
871 @table @kbd
872 @kindex M-@key{RET}
873 @item M-@key{RET}
874 Insert new heading with same level as current.  If the cursor is in a
875 plain list item, a new item is created (@pxref{Plain lists}).  To force
876 creation of a new headline, use a prefix argument, or first press @key{RET}
877 to get to the beginning of the next line.  When this command is used in
878 the middle of a line, the line is split and the rest of the line becomes
879 the new headline@footnote{If you do not want the line to be split,
880 customize the variable @code{org-M-RET-may-split-line}.}.  If the
881 command is used at the beginning of a headline, the new headline is
882 created before the current line.  If at the beginning of any other line,
883 the content of that line is made the new heading.  If the command is
884 used at the end of a folded subtree (i.e. behind the ellipses at the end
885 of a headline), then a headline like the current one will be inserted
886 after the end of the subtree.
887 @kindex C-@key{RET}
888 @item C-@key{RET}
889 Insert a new heading after the current subtree, same level as the
890 current headline.  This command works from anywhere in the entry.
891 @kindex M-S-@key{RET}
892 @item M-S-@key{RET}
893 Insert new TODO entry with same level as current heading.
894 @kindex M-@key{left}
895 @item M-@key{left}
896 Promote current heading by one level.
897 @kindex M-@key{right}
898 @item M-@key{right}
899 Demote current heading by one level.
900 @kindex M-S-@key{left}
901 @item M-S-@key{left}
902 Promote the current subtree by one level.
903 @kindex M-S-@key{right}
904 @item M-S-@key{right}
905 Demote the current subtree by one level.
906 @kindex M-S-@key{up}
907 @item M-S-@key{up}
908 Move subtree up (swap with previous subtree of same
909 level).
910 @kindex M-S-@key{down}
911 @item M-S-@key{down}
912 Move subtree down (swap with next subtree of same level).
913 @kindex C-c C-x C-w
914 @kindex C-c C-x C-k
915 @item C-c C-x C-w
916 @itemx C-c C-x C-k
917 Kill subtree, i.e. remove it from buffer but save in kill ring.
918 With a numeric prefix argument N, kill N sequential subtrees.
919 @kindex C-c C-x M-w
920 @item C-c C-x M-w
921 Copy subtree to kill ring.  With a numeric prefix argument N, copy the N
922 sequential subtrees.
923 @kindex C-c C-x C-y
924 @item C-c C-x C-y
925 Yank subtree from kill ring.  This does modify the level of the subtree to
926 make sure the tree fits in nicely at the yank position.  The yank level can
927 also be specified with a numeric prefix argument, or by yanking after a
928 headline marker like @samp{****}.
929 @kindex C-c C-w
930 @item C-c C-w
931 Refile entry to a different location.  @xref{Refiling notes}.
932 @kindex C-c ^
933 @item C-c ^
934 Sort same-level entries.  When there is an active region, all entries in the
935 region will be sorted.  Otherwise the children of the current headline are
936 sorted.  The command prompts for the sorting method, which can be
937 alphabetically, numerically, by time (using the first time stamp in each
938 entry), by priority, or by TODO keyword (in the sequence the keywords have
939 been defined in the setup).  Reverse sorting is possible as well.  You can
940 also supply your own function to extract the sorting key.  With a @kbd{C-u}
941 prefix, sorting will be case-sensitive.  With two @kbd{C-u C-u} prefixes,
942 duplicate entries will also be removed.
943 @kindex C-x n s
944 @item C-x n s
945 Narrow buffer to current subtree.
946 @kindex C-x n w
947 @item C-x n w
948 Widen buffer to remove a narrowing.
949 @kindex C-c *
950 @item C-c *
951 Turn a normal line or plain list item into a headline (so that it
952 becomes a subheading at its location).  Also turn a headline into a
953 normal line by removing the stars.  If there is an active region, turn
954 all lines in the region into headlines.  Or, if the first line is a
955 headline, remove the stars from all headlines in the region.
956 @end table
958 @cindex region, active
959 @cindex active region
960 @cindex Transient mark mode
961 When there is an active region (Transient mark mode), promotion and
962 demotion work on all headlines in the region.  To select a region of
963 headlines, it is best to place both point and mark at the beginning of a
964 line, mark at the beginning of the first headline, and point at the line
965 just after the last headline to change.  Note that when the cursor is
966 inside a table (@pxref{Tables}), the Meta-Cursor keys have different
967 functionality.
969 @node Archiving, Sparse trees, Structure editing, Document Structure
970 @section Archiving
971 @cindex archiving
973 When a project represented by a (sub)tree is finished, you may want
974 to move the tree out of the way and to stop it from contributing to the
975 agenda.  Org mode knows two ways of archiving.  You can mark a tree with
976 the ARCHIVE tag, or you can move an entire (sub)tree to a different
977 location.
979 @menu
980 * ARCHIVE tag::                 Marking a tree as inactive
981 * Moving subtrees::             Moving a tree to an archive file
982 @end menu
984 @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
985 @subsection The ARCHIVE tag
986 @cindex internal archiving
988 A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
989 its location in the outline tree, but behaves in the following way:
990 @itemize @minus
991 @item
992 It does not open when you attempt to do so with a visibility cycling
993 command (@pxref{Visibility cycling}).  You can force cycling archived
994 subtrees with @kbd{C-@key{TAB}}, or by setting the option
995 @code{org-cycle-open-archived-trees}.  Also normal outline commands like
996 @code{show-all} will open archived subtrees.
997 @item
998 During sparse tree construction (@pxref{Sparse trees}), matches in
999 archived subtrees are not exposed, unless you configure the option
1000 @code{org-sparse-tree-open-archived-trees}.
1001 @item
1002 During agenda view construction (@pxref{Agenda Views}), the content of
1003 archived trees is ignored unless you configure the option
1004 @code{org-agenda-skip-archived-trees}.
1005 @item
1006 Archived trees are not exported (@pxref{Exporting}), only the headline
1007 is.  Configure the details using the variable
1008 @code{org-export-with-archived-trees}.
1009 @end itemize
1011 The following commands help managing the ARCHIVE tag:
1013 @table @kbd
1014 @kindex C-c C-x a
1015 @item C-c C-x a
1016 Toggle the ARCHIVE tag for the current headline.  When the tag is set,
1017 the headline changes to a shadowed face, and the subtree below it is
1018 hidden.
1019 @kindex C-u C-c C-x a
1020 @item C-u C-c C-x a
1021 Check if any direct children of the current headline should be archived.
1022 To do this, each subtree is checked for open TODO entries.  If none are
1023 found, the command offers to set the ARCHIVE tag for the child.  If the
1024 cursor is @emph{not} on a headline when this command is invoked, the
1025 level 1 trees will be checked.
1026 @kindex C-@kbd{TAB}
1027 @item C-@kbd{TAB}
1028 Cycle a tree even if it is tagged with ARCHIVE.
1029 @end table
1031 @node Moving subtrees,  , ARCHIVE tag, Archiving
1032 @subsection Moving subtrees
1033 @cindex external archiving
1035 Once an entire project is finished, you may want to move it to a different
1036 location.  Org can move it to an @emph{Attic Sibling} in the same tree, to a
1037 different tree in the current file, or to a different file, the archive file.
1039 @table @kbd
1040 @kindex C-c C-x A
1041 @item C-c C-x A
1042 Move the current entry to the @emph{Attic Sibling}.  This is a sibling of the
1043 entry with the heading @samp{Attic} and the tag @samp{ARCHIVE}
1044 (@pxref{ARCHIVE tag}).  The entry becomes a child of that sibling and in this
1045 way retains a lot of its original context, including inherited tags and
1046 approximate position in the outline.
1047 @kindex C-c C-x C-s
1048 @item C-c C-x C-s
1049 Archive the subtree starting at the cursor position to the location
1050 given by @code{org-archive-location}.  Context information that could be
1051 lost like the file name, the category, inherited tags, and the TODO
1052 state will be store as properties in the entry.
1053 @kindex C-u C-c C-x C-s
1054 @item C-u C-c C-x C-s
1055 Check if any direct children of the current headline could be moved to
1056 the archive.  To do this, each subtree is checked for open TODO entries.
1057 If none are found, the command offers to move it to the archive
1058 location.  If the cursor is @emph{not} on a headline when this command
1059 is invoked, the level 1 trees will be checked.
1060 @end table
1062 @cindex archive locations
1063 The default archive location is a file in the same directory as the
1064 current file, with the name derived by appending @file{_archive} to the
1065 current file name.  For information and examples on how to change this,
1066 see the documentation string of the variable
1067 @code{org-archive-location}.  There is also an in-buffer option for
1068 setting this variable, for example@footnote{For backward compatibility,
1069 the following also works: If there are several such lines in a file,
1070 each specifies the archive location for the text below it.  The first
1071 such line also applies to any text before its definition.  However,
1072 using this method is @emph{strongly} deprecated as it is incompatible
1073 with the outline structure of the document.  The correct method for
1074 setting multiple archive locations in a buffer is using a property.}:
1076 @example
1077 #+ARCHIVE: %s_done::
1078 @end example
1080 @noindent
1081 If you would like to have a special ARCHIVE location for a single entry
1082 or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
1083 location as the value (@pxref{Properties and Columns}).
1085 When a subtree is moved, it receives a number of special properties that
1086 record context information like the file from where the entry came, it's
1087 outline path the archiving time etc.  Configure the variable
1088 @code{org-archive-save-context-info} to adjust the amount of information
1089 added.
1091 @node Sparse trees, Plain lists, Archiving, Document Structure
1092 @section Sparse trees
1093 @cindex sparse trees
1094 @cindex trees, sparse
1095 @cindex folding, sparse trees
1096 @cindex occur, command
1098 An important feature of Org mode is the ability to construct @emph{sparse
1099 trees} for selected information in an outline tree, so that the entire
1100 document is folded as much as possible, but the selected information is made
1101 visible along with the headline structure above it@footnote{See also the
1102 variables @code{org-show-hierarchy-above}, @code{org-show-following-heading},
1103 @code{org-show-siblings}, and @code{org-show-entry-below} for detailed
1104 control on how much context is shown around each match.}.  Just try it out
1105 and you will see immediately how it works.
1107 Org mode contains several commands creating such trees, all these
1108 commands can be accessed through a dispatcher:
1110 @table @kbd
1111 @kindex C-c /
1112 @item C-c /
1113 This prompts for an extra key to select a sparse-tree creating command.
1114 @kindex C-c / r
1115 @item C-c / r
1116 Occur.  Prompts for a regexp and shows a sparse tree with all matches.  If
1117 the match is in a headline, the headline is made visible.  If the match is in
1118 the body of an entry, headline and body are made visible.  In order to
1119 provide minimal context, also the full hierarchy of headlines above the match
1120 is shown, as well as the headline following the match.  Each match is also
1121 highlighted; the highlights disappear when the buffer is changed by an
1122 editing command@footnote{depending on the option
1123 @code{org-remove-highlights-with-change}}, or by pressing @kbd{C-c C-c}.
1124 When called with a @kbd{C-u} prefix argument, previous highlights are kept,
1125 so several calls to this command can be stacked.
1126 @end table
1128 @noindent
1129 For frequently used sparse trees of specific search strings, you can
1130 use the variable @code{org-agenda-custom-commands} to define fast
1131 keyboard access to specific sparse trees.  These commands will then be
1132 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
1133 For example:
1135 @lisp
1136 (setq org-agenda-custom-commands
1137       '(("f" occur-tree "FIXME")))
1138 @end lisp
1140 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
1141 a sparse tree matching the string @samp{FIXME}.
1143 The other sparse tree commands select headings based on TODO keywords,
1144 tags, or properties and will be discussed later in this manual.
1146 @kindex C-c C-e v
1147 @cindex printing sparse trees
1148 @cindex visible text, printing
1149 To print a sparse tree, you can use the Emacs command
1150 @code{ps-print-buffer-with-faces} which does not print invisible parts
1151 of the document @footnote{This does not work under XEmacs, because
1152 XEmacs uses selective display for outlining, not text properties.}.
1153 Or you can use the command @kbd{C-c C-e v} to export only the visible
1154 part of the document and print the resulting file.
1156 @node Plain lists, Drawers, Sparse trees, Document Structure
1157 @section Plain lists
1158 @cindex plain lists
1159 @cindex lists, plain
1160 @cindex lists, ordered
1161 @cindex ordered lists
1163 Within an entry of the outline tree, hand-formatted lists can provide
1164 additional structure.  They also provide a way to create lists of
1165 checkboxes (@pxref{Checkboxes}).  Org supports editing such lists,
1166 and the HTML exporter (@pxref{Exporting}) parses and formats them.
1168 Org knows ordered lists, unordered lists, and description lists.
1169 @itemize @bullet
1170 @item
1171 @emph{Unordered} list items start with @samp{-}, @samp{+}, or
1172 @samp{*}@footnote{When using @samp{*} as a bullet, lines must be indented or
1173 they will be seen as top-level headlines.  Also, when you are hiding leading
1174 stars to get a clean outline view, plain list items starting with a star are
1175 visually indistinguishable from true headlines.  In short: even though
1176 @samp{*} is supported, it may be better to not use it for plain list items.}
1177 as bullets.
1178 @item
1179 @emph{Ordered} list items start with a numeral followed by either a period or
1180 a right parenthesis, such as @samp{1.} or @samp{1)}.
1181 @item
1182 @emph{Description} list items are like unordered list items, but contain the
1183 separator @samp{ :: } to separate the description @emph{term} from the
1184 desciption.
1185 @end itemize
1187 Items belonging to the same list must have the same indentation on the first
1188 line.  In particular, if an ordered list reaches number @samp{10.}, then the
1189 2--digit numbers must be written left-aligned with the other numbers in the
1190 list.  Indentation also determines the end of a list item.  It ends before
1191 the next line that is indented like the bullet/number, or less.  Empty lines
1192 are part of the previous item, so you can have several paragraphs in one
1193 item.  If you would like an empty line to terminate all currently open plain
1194 lists, configure the variable @code{org-empty-line-terminates-plain-lists}.
1195 Here is an example:
1197 @example
1198 @group
1199 ** Lord of the Rings
1200    My favorite scenes are (in this order)
1201    1. The attack of the Rohirrim
1202    2. Eowyns fight with the witch king
1203       + this was already my favorite scene in the book
1204       + I really like Miranda Otto.
1205    3. Peter Jackson being shot by Legolas
1206        - on DVD only
1207       He makes a really funny face when it happens.
1208    But in the end, not individual scenes matter but the film as a whole.
1209    Important actors in this film are:
1210    - @b{Elijah Wood} :: He plays the Frodo
1211    - @b{Sean Austin} :: He plays the Sam, Frodos friend.  I still remember
1212      him very well from his role as Mikey Walsh a in the Goonies.
1213 @end group
1214 @end example
1216 Org supports these lists by tuning filling and wrapping commands to
1217 deal with them correctly@footnote{Org only changes the filling
1218 settings for Emacs.  For XEmacs, you should use Kyle E. Jones'
1219 @file{filladapt.el}.  To turn this on,  put into @file{.emacs}:
1220 @code{(require 'filladapt)}}, and by exporting them properly
1221 (@pxref{Exporting}).
1223 The following commands act on items when the cursor is in the first line
1224 of an item (the line with the bullet or number).
1226 @table @kbd
1227 @kindex @key{TAB}
1228 @item @key{TAB}
1229 Items can be folded just like headline levels if you set the variable
1230 @code{org-cycle-include-plain-lists}.  The level of an item is then
1231 given by the indentation of the bullet/number.  Items are always
1232 subordinate to real headlines, however; the hierarchies remain
1233 completely separated.
1235 If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
1236 fixes the indentation of the current line in a heuristic way.
1237 @kindex M-@key{RET}
1238 @item M-@key{RET}
1239 Insert new item at current level.  With a prefix argument, force a new
1240 heading (@pxref{Structure editing}).  If this command is used in the middle
1241 of a line, the line is @emph{split} and the rest of the line becomes the new
1242 item@footnote{If you do not want the line to be split, customize the variable
1243 @code{org-M-RET-may-split-line}.}.  If this command is executed in the
1244 @emph{whitespace before a bullet or number}, the new item is created
1245 @emph{before} the current item.  If the command is executed in the white
1246 space before the text that is part of an item but does not contain the
1247 bullet, a bullet is added to the current line.
1248 @kindex M-S-@key{RET}
1249 @item M-S-@key{RET}
1250 Insert a new item with a checkbox (@pxref{Checkboxes}).
1251 @kindex S-@key{up}
1252 @kindex S-@key{down}
1253 @item S-@key{up}
1254 @itemx S-@key{down}
1255 Jump to the previous/next item in the current list.
1256 @kindex M-S-@key{up}
1257 @kindex M-S-@key{down}
1258 @item M-S-@key{up}
1259 @itemx M-S-@key{down}
1260 Move the item including subitems up/down (swap with previous/next item
1261 of same indentation).  If the list is ordered, renumbering is
1262 automatic.
1263 @kindex M-S-@key{left}
1264 @kindex M-S-@key{right}
1265 @item M-S-@key{left}
1266 @itemx M-S-@key{right}
1267 Decrease/increase the indentation of the item, including subitems.
1268 Initially, the item tree is selected based on current indentation.
1269 When these commands are executed several times in direct succession,
1270 the initially selected region is used, even if the new indentation
1271 would imply a different hierarchy.  To use the new hierarchy, break
1272 the command chain with a cursor motion or so.
1273 @kindex C-c C-c
1274 @item C-c C-c
1275 If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
1276 state of the checkbox.  If not, this command makes sure that all the
1277 items on this list level use the same bullet.  Furthermore, if this is
1278 an ordered list, make sure the numbering is OK.
1279 @kindex C-c -
1280 @item C-c -
1281 Cycle the entire list level through the different itemize/enumerate bullets
1282 (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}).  With a numeric prefix
1283 argument N, select the Nth bullet from this list.  If there is an active
1284 region when calling this, all lines will be converted to list items.  If the
1285 first line already was a list item, any item markers will be removed from the
1286 list.  Finally, even without an active region, a normal line will be
1287 converted into a list item.
1288 @end table
1290 @node Drawers, Orgstruct mode, Plain lists, Document Structure
1291 @section Drawers
1292 @cindex drawers
1293 @cindex visibility cycling, drawers
1295 Sometimes you want to keep information associated with an entry, but you
1296 normally don't want to see it.  For this, Org mode has @emph{drawers}.
1297 Drawers need to be configured with the variable
1298 @code{org-drawers}@footnote{You can define drawers on a per-file basis
1299 with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}.  Drawers
1300 look like this:
1302 @example
1303 ** This is a headline
1304    Still outside the drawer
1305    :DRAWERNAME:
1306       This is inside the drawer.
1307    :END:
1308    After the drawer.
1309 @end example
1311 Visibility cycling (@pxref{Visibility cycling}) on the headline will
1312 hide and show the entry, but keep the drawer collapsed to a single line.
1313 In order to look inside the drawer, you need to move the cursor to the
1314 drawer line and press @key{TAB} there.  Org mode uses a drawer for
1315 storing properties (@pxref{Properties and Columns}), and another one for
1316 storing clock times (@pxref{Clocking work time}).
1318 @node Orgstruct mode,  , Drawers, Document Structure
1319 @section The Orgstruct minor mode
1320 @cindex Orgstruct mode
1321 @cindex minor mode for structure editing
1323 If you like the intuitive way the Org mode structure editing and list
1324 formatting works, you might want to use these commands in other modes
1325 like Text mode or Mail mode as well.  The minor mode Orgstruct mode
1326 makes this possible.  You can always toggle the mode with @kbd{M-x
1327 orgstruct-mode}.  To turn it on by default, for example in Mail mode,
1330 @lisp
1331 (add-hook 'mail-mode-hook 'turn-on-orgstruct)
1332 @end lisp
1334 When this mode is active and the cursor is on a line that looks to
1335 Org like a headline of the first line of a list item, most
1336 structure editing commands will work, even if the same keys normally
1337 have different functionality in the major mode you are using.  If the
1338 cursor is not in one of those special lines, Orgstruct mode lurks
1339 silently in the shadow.
1341 @node Tables, Hyperlinks, Document Structure, Top
1342 @chapter Tables
1343 @cindex tables
1344 @cindex editing tables
1346 Org comes with a fast and intuitive table editor.  Spreadsheet-like
1347 calculations are supported in connection with the Emacs @file{calc}
1348 package
1349 @ifinfo
1350 (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
1351 @end ifinfo
1352 @ifnotinfo
1353 (see the Emacs Calculator manual for more information about the Emacs
1354 calculator).
1355 @end ifnotinfo
1357 @menu
1358 * Built-in table editor::       Simple tables
1359 * Narrow columns::              Stop wasting space in tables
1360 * Column groups::               Grouping to trigger vertical lines
1361 * Orgtbl mode::                 The table editor as minor mode
1362 * The spreadsheet::             The table editor has spreadsheet capabilities
1363 @end menu
1365 @node Built-in table editor, Narrow columns, Tables, Tables
1366 @section The built-in table editor
1367 @cindex table editor, built-in
1369 Org makes it easy to format tables in plain ASCII.  Any line with
1370 @samp{|} as the first non-whitespace character is considered part of a
1371 table.  @samp{|} is also the column separator.  A table might look like
1372 this:
1374 @example
1375 | Name  | Phone | Age |
1376 |-------+-------+-----|
1377 | Peter |  1234 |  17 |
1378 | Anna  |  4321 |  25 |
1379 @end example
1381 A table is re-aligned automatically each time you press @key{TAB} or
1382 @key{RET} or @kbd{C-c C-c} inside the table.  @key{TAB} also moves to
1383 the next field (@key{RET} to the next row) and creates new table rows
1384 at the end of the table or before horizontal lines.  The indentation
1385 of the table is set by the first line.  Any line starting with
1386 @samp{|-} is considered as a horizontal separator line and will be
1387 expanded on the next re-align to span the whole table width.  So, to
1388 create the above table, you would only type
1390 @example
1391 |Name|Phone|Age|
1393 @end example
1395 @noindent and then press @key{TAB} to align the table and start filling in
1396 fields.
1398 When typing text into a field, Org treats @key{DEL},
1399 @key{Backspace}, and all character keys in a special way, so that
1400 inserting and deleting avoids shifting other fields.  Also, when
1401 typing @emph{immediately after the cursor was moved into a new field
1402 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
1403 field is automatically made blank.  If this behavior is too
1404 unpredictable for you, configure the variables
1405 @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
1407 @table @kbd
1408 @tsubheading{Creation and conversion}
1409 @kindex C-c |
1410 @item C-c |
1411 Convert the active region to table. If every line contains at least one
1412 TAB character, the function assumes that the material is tab separated.
1413 If every line contains a comma, comma-separated values (CSV) are assumed.
1414 If not, lines are split at whitespace into fields.  You can use a prefix
1415 argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
1416 C-u} forces TAB, and a numeric argument N indicates that at least N
1417 consecutive spaces, or alternatively a TAB will be the separator.
1419 If there is no active region, this command creates an empty Org
1420 table.  But it's easier just to start typing, like
1421 @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
1423 @tsubheading{Re-aligning and field motion}
1424 @kindex C-c C-c
1425 @item C-c C-c
1426 Re-align the table without moving the cursor.
1428 @kindex @key{TAB}
1429 @item @key{TAB}
1430 Re-align the table, move to the next field.  Creates a new row if
1431 necessary.
1433 @kindex S-@key{TAB}
1434 @item S-@key{TAB}
1435 Re-align, move to previous field.
1437 @kindex @key{RET}
1438 @item @key{RET}
1439 Re-align the table and move down to next row.  Creates a new row if
1440 necessary.  At the beginning or end of a line, @key{RET} still does
1441 NEWLINE, so it can be used to split a table.
1443 @tsubheading{Column and row editing}
1444 @kindex M-@key{left}
1445 @kindex M-@key{right}
1446 @item M-@key{left}
1447 @itemx M-@key{right}
1448 Move the current column left/right.
1450 @kindex M-S-@key{left}
1451 @item M-S-@key{left}
1452 Kill the current column.
1454 @kindex M-S-@key{right}
1455 @item M-S-@key{right}
1456 Insert a new column to the left of the cursor position.
1458 @kindex M-@key{up}
1459 @kindex M-@key{down}
1460 @item M-@key{up}
1461 @itemx M-@key{down}
1462 Move the current row up/down.
1464 @kindex M-S-@key{up}
1465 @item M-S-@key{up}
1466 Kill the current row or horizontal line.
1468 @kindex M-S-@key{down}
1469 @item M-S-@key{down}
1470 Insert a new row above the current row.  With a prefix argument, the line is
1471 created below the current one.
1473 @kindex C-c -
1474 @item C-c -
1475 Insert a horizontal line below current row. With a prefix argument, the line
1476 is created above the current line.
1478 @kindex C-c ^
1479 @item C-c ^
1480 Sort the table lines in the region.  The position of point indicates the
1481 column to be used for sorting, and the range of lines is the range
1482 between the nearest horizontal separator lines, or the entire table.  If
1483 point is before the first column, you will be prompted for the sorting
1484 column.  If there is an active region, the mark specifies the first line
1485 and the sorting column, while point should be in the last line to be
1486 included into the sorting.  The command prompts for the sorting type
1487 (alphabetically, numerically, or by time).  When called with a prefix
1488 argument, alphabetic sorting will be case-sensitive.
1490 @tsubheading{Regions}
1491 @kindex C-c C-x M-w
1492 @item C-c C-x M-w
1493 Copy a rectangular region from a table to a special clipboard.  Point
1494 and mark determine edge fields of the rectangle.  The process ignores
1495 horizontal separator lines.
1497 @kindex C-c C-x C-w
1498 @item C-c C-x C-w
1499 Copy a rectangular region from a table to a special clipboard, and
1500 blank all fields in the rectangle.  So this is the ``cut'' operation.
1502 @kindex C-c C-x C-y
1503 @item C-c C-x C-y
1504 Paste a rectangular region into a table.
1505 The upper right corner ends up in the current field.  All involved fields
1506 will be overwritten.  If the rectangle does not fit into the present table,
1507 the table is enlarged as needed.  The process ignores horizontal separator
1508 lines.
1510 @kindex C-c C-q
1511 @kindex M-@key{RET}
1512 @item C-c C-q
1513 @itemx M-@kbd{RET}
1514 Wrap several fields in a column like a paragraph.  If there is an active
1515 region, and both point and mark are in the same column, the text in the
1516 column is wrapped to minimum width for the given number of lines.  A numeric
1517 prefix argument may be used to change the number of desired lines.  If there
1518 is no region, the current field is split at the cursor position and the text
1519 fragment to the right of the cursor is prepended to the field one line
1520 down. If there is no region, but you specify a prefix argument, the current
1521 field is made blank, and the content is appended to the field above.
1523 @tsubheading{Calculations}
1524 @cindex formula, in tables
1525 @cindex calculations, in tables
1526 @cindex region, active
1527 @cindex active region
1528 @cindex Transient mark mode
1529 @kindex C-c +
1530 @item C-c +
1531 Sum the numbers in the current column, or in the rectangle defined by
1532 the active region.  The result is shown in the echo area and can
1533 be inserted with @kbd{C-y}.
1535 @kindex S-@key{RET}
1536 @item S-@key{RET}
1537 When current field is empty, copy from first non-empty field above.
1538 When not empty, copy current field down to next row and move cursor
1539 along with it.  Depending on the variable
1540 @code{org-table-copy-increment}, integer field values will be
1541 incremented during copy.  This key is also used by CUA mode
1542 (@pxref{Cooperation}).
1544 @tsubheading{Miscellaneous}
1545 @kindex C-c `
1546 @item C-c `
1547 Edit the current field in a separate window.  This is useful for fields
1548 that are not fully visible (@pxref{Narrow columns}).  When called with a
1549 @kbd{C-u} prefix, just make the full field visible, so that it can be
1550 edited in place.
1552 @item M-x org-table-import
1553 Import a file as a table.  The table should be TAB- or whitespace
1554 separated.  Useful, for example, to import a spreadsheet table or data
1555 from a database, because these programs generally can write
1556 TAB-separated text files.  This command works by inserting the file into
1557 the buffer and then converting the region to a table.  Any prefix
1558 argument is passed on to the converter, which uses it to determine the
1559 separator.
1560 @item C-c |
1561 Tables can also be imported by pasting tabular text into the Org
1562 buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
1563 @kbd{C-c |} command (see above under @i{Creation and conversion}.
1565 @item M-x org-table-export
1566 Export the table, by default as a TAB-separated file.  Useful for data
1567 exchange with, for example, spreadsheet or database programs.  The format
1568 used to export the file can be configured in the variable
1569 @code{org-table-export-default-format}.  You may also use properties
1570 @code{TABLE_EXPORT_FILE} and @code{TABLE_EXPORT_FORMAT} to specify the file
1571 name and the format for table export in a subtree.  Org supports quite
1572 general formats for exported tables.  The exporter format is the same as the
1573 format used by Orgtbl radio tables, see @ref{Translator functions} for a
1574 detailed description.
1575 @end table
1577 If you don't like the automatic table editor because it gets in your
1578 way on lines which you would like to start with @samp{|}, you can turn
1579 it off with
1581 @lisp
1582 (setq org-enable-table-editor nil)
1583 @end lisp
1585 @noindent Then the only table command that still works is
1586 @kbd{C-c C-c} to do a manual re-align.
1588 @node Narrow columns, Column groups, Built-in table editor, Tables
1589 @section Narrow columns
1590 @cindex narrow columns in tables
1592 The width of columns is automatically determined by the table editor.
1593 Sometimes a single field or a few fields need to carry more text,
1594 leading to inconveniently wide columns.  To limit@footnote{This feature
1595 does not work on XEmacs.} the width of a column, one field anywhere in
1596 the column may contain just the string @samp{<N>} where @samp{N} is an
1597 integer specifying the width of the column in characters.  The next
1598 re-align will then set the width of this column to no more than this
1599 value.
1601 @example
1602 @group
1603 |---+------------------------------|               |---+--------|
1604 |   |                              |               |   | <6>    |
1605 | 1 | one                          |               | 1 | one    |
1606 | 2 | two                          |     ----\     | 2 | two    |
1607 | 3 | This is a long chunk of text |     ----/     | 3 | This=> |
1608 | 4 | four                         |               | 4 | four   |
1609 |---+------------------------------|               |---+--------|
1610 @end group
1611 @end example
1613 @noindent
1614 Fields that are wider become clipped and end in the string @samp{=>}.
1615 Note that the full text is still in the buffer, it is only invisible.
1616 To see the full text, hold the mouse over the field - a tool-tip window
1617 will show the full content.  To edit such a field, use the command
1618 @kbd{C-c `} (that is @kbd{C-c} followed by the backquote).  This will
1619 open a new window with the full field.  Edit it and finish with @kbd{C-c
1620 C-c}.
1622 When visiting a file containing a table with narrowed columns, the
1623 necessary character hiding has not yet happened, and the table needs to
1624 be aligned before it looks nice.  Setting the option
1625 @code{org-startup-align-all-tables} will realign all tables in a file
1626 upon visiting, but also slow down startup.  You can also set this option
1627 on a per-file basis with:
1629 @example
1630 #+STARTUP: align
1631 #+STARTUP: noalign
1632 @end example
1634 @node Column groups, Orgtbl mode, Narrow columns, Tables
1635 @section Column groups
1636 @cindex grouping columns in tables
1638 When Org exports tables, it does so by default without vertical
1639 lines because that is visually more satisfying in general.  Occasionally
1640 however, vertical lines can be useful to structure a table into groups
1641 of columns, much like horizontal lines can do for groups of rows.  In
1642 order to specify column groups, you can use a special row where the
1643 first field contains only @samp{/}.  The further fields can either
1644 contain @samp{<} to indicate that this column should start a group,
1645 @samp{>} to indicate the end of a column, or @samp{<>} to make a column
1646 a group of its own.  Boundaries between column groups will upon export be
1647 marked with vertical lines.  Here is an example:
1649 @example
1650 |   |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1651 |---+----+-----+-----+-----+---------+------------|
1652 | / | <> |   < |     |   > |       < |          > |
1653 | # |  1 |   1 |   1 |   1 |       1 |          1 |
1654 | # |  2 |   4 |   8 |  16 |  1.4142 |     1.1892 |
1655 | # |  3 |   9 |  27 |  81 |  1.7321 |     1.3161 |
1656 |---+----+-----+-----+-----+---------+------------|
1657 #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
1658 @end example
1660 It is also sufficient to just insert the column group starters after
1661 every vertical line you'd like to have:
1663 @example
1664 |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1665 |----+-----+-----+-----+---------+------------|
1666 | /  | <   |     |     | <       |            |
1667 @end example
1669 @node Orgtbl mode, The spreadsheet, Column groups, Tables
1670 @section The Orgtbl minor mode
1671 @cindex Orgtbl mode
1672 @cindex minor mode for tables
1674 If you like the intuitive way the Org table editor works, you
1675 might also want to use it in other modes like Text mode or Mail mode.
1676 The minor mode Orgtbl mode makes this possible.  You can always toggle
1677 the mode with @kbd{M-x orgtbl-mode}.  To turn it on by default, for
1678 example in mail mode, use
1680 @lisp
1681 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
1682 @end lisp
1684 Furthermore, with some special setup, it is possible to maintain tables
1685 in arbitrary syntax with Orgtbl mode.  For example, it is possible to
1686 construct La@TeX{} tables with the underlying ease and power of
1687 Orgtbl mode, including spreadsheet capabilities.  For details, see
1688 @ref{Tables in arbitrary syntax}.
1690 @node The spreadsheet,  , Orgtbl mode, Tables
1691 @section The spreadsheet
1692 @cindex calculations, in tables
1693 @cindex spreadsheet capabilities
1694 @cindex @file{calc} package
1696 The table editor makes use of the Emacs @file{calc} package to implement
1697 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms to
1698 derive fields from other fields.  While fully featured, Org's
1699 implementation is not identical to other spreadsheets.  For example,
1700 Org knows the concept of a @emph{column formula} that will be
1701 applied to all non-header fields in a column without having to copy the
1702 formula to each relevant field.
1704 @menu
1705 * References::                  How to refer to another field or range
1706 * Formula syntax for Calc::     Using Calc to compute stuff
1707 * Formula syntax for Lisp::     Writing formulas in Emacs Lisp
1708 * Field formulas::              Formulas valid for a single field
1709 * Column formulas::             Formulas valid for an entire column
1710 * Editing and debugging formulas::  Fixing formulas
1711 * Updating the table::          Recomputing all dependent fields
1712 * Advanced features::           Field names, parameters and automatic recalc
1713 @end menu
1715 @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
1716 @subsection References
1717 @cindex references
1719 To compute fields in the table from other fields, formulas must
1720 reference other fields or ranges.  In Org, fields can be referenced
1721 by name, by absolute coordinates, and by relative coordinates.  To find
1722 out what the coordinates of a field are, press @kbd{C-c ?} in that
1723 field, or press @kbd{C-c @}} to toggle the display of a grid.
1725 @subsubheading Field references
1726 @cindex field references
1727 @cindex references, to fields
1729 Formulas can reference the value of another field in two ways.  Like in
1730 any other spreadsheet, you may reference fields with a letter/number
1731 combination like @code{B3}, meaning the 2nd field in the 3rd row.
1732 @c Such references are always fixed to that field, they don't change
1733 @c when you copy and paste a formula to a different field.  So
1734 @c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
1736 @noindent
1737 Org also uses another, more general operator that looks like this:
1738 @example
1739 @@row$column
1740 @end example
1742 @noindent
1743 Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
1744 or relative to the current column like @samp{+1} or @samp{-2}.
1746 The row specification only counts data lines and ignores horizontal
1747 separator lines (hlines).  You can use absolute row numbers
1748 @samp{1}...@samp{N}, and row numbers relative to the current row like
1749 @samp{+3} or @samp{-1}.  Or specify the row relative to one of the
1750 hlines: @samp{I} refers to the first hline@footnote{Note that only
1751 hlines are counted that @emph{separate} table lines.  If the table
1752 starts with a hline above the header, it does not count.}, @samp{II} to
1753 the second etc.  @samp{-I} refers to the first such line above the
1754 current line, @samp{+I} to the first such line below the current line.
1755 You can also write @samp{III+2} which is the second data line after the
1756 third hline in the table.  Relative row numbers like @samp{-3} will not
1757 cross hlines if the current line is too close to the hline.  Instead,
1758 the value directly at the hline is used.
1760 @samp{0} refers to the current row and column.  Also, if you omit
1761 either the column or the row part of the reference, the current
1762 row/column is implied.
1764 Org's references with @emph{unsigned} numbers are fixed references
1765 in the sense that if you use the same reference in the formula for two
1766 different fields, the same field will be referenced each time.
1767 Org's references with @emph{signed} numbers are floating
1768 references because the same reference operator can reference different
1769 fields depending on the field being calculated by the formula.
1771 Here are a few examples:
1773 @example
1774 @@2$3      @r{2nd row, 3rd column}
1775 C2        @r{same as previous}
1776 $5        @r{column 5 in the current row}
1777 E&        @r{same as previous}
1778 @@2        @r{current column, row 2}
1779 @@-1$-3    @r{the field one row up, three columns to the left}
1780 @@-I$2     @r{field just under hline above current row, column 2}
1781 @end example
1783 @subsubheading Range references
1784 @cindex range references
1785 @cindex references, to ranges
1787 You may reference a rectangular range of fields by specifying two field
1788 references connected by two dots @samp{..}.  If both fields are in the
1789 current row, you may simply use @samp{$2..$7}, but if at least one field
1790 is in a different row, you need to use the general @code{@@row$column}
1791 format at least for the first field (i.e the reference must start with
1792 @samp{@@} in order to be interpreted correctly).  Examples:
1794 @example
1795 $1..$3        @r{First three fields in the current row.}
1796 $P..$Q        @r{Range, using column names (see under Advanced)}
1797 @@2$1..@@4$3    @r{6 fields between these two fields.}
1798 A2..C4        @r{Same as above.}
1799 @@-1$-2..@@-1   @r{3 numbers from the column to the left, 2 up to current row}
1800 @end example
1802 @noindent Range references return a vector of values that can be fed
1803 into Calc vector functions.  Empty fields in ranges are normally
1804 suppressed, so that the vector contains only the non-empty fields (but
1805 see the @samp{E} mode switch below).  If there are no non-empty fields,
1806 @samp{[0]} is returned to avoid syntax errors in formulas.
1808 @subsubheading Named references
1809 @cindex named references
1810 @cindex references, named
1811 @cindex name, of column or field
1812 @cindex constants, in calculations
1814 @samp{$name} is interpreted as the name of a column, parameter or
1815 constant.  Constants are defined globally through the variable
1816 @code{org-table-formula-constants}, and locally (for the file) through a
1817 line like
1819 @example
1820 #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
1821 @end example
1823 @noindent
1824 Also properties (@pxref{Properties and Columns}) can be used as
1825 constants in table formulas: For a property @samp{:Xyz:} use the name
1826 @samp{$PROP_Xyz}, and the property will be searched in the current
1827 outline entry and in the hierarchy above it.  If you have the
1828 @file{constants.el} package, it will also be used to resolve constants,
1829 including natural constants like @samp{$h} for Planck's constant, and
1830 units like @samp{$km} for kilometers@footnote{@file{Constant.el} can
1831 supply the values of constants in two different unit systems, @code{SI}
1832 and @code{cgs}.  Which one is used depends on the value of the variable
1833 @code{constants-unit-system}.  You can use the @code{#+STARTUP} options
1834 @code{constSI} and @code{constcgs} to set this value for the current
1835 buffer.}.  Column names and parameters can be specified in special table
1836 lines.  These are described below, see @ref{Advanced features}.  All
1837 names must start with a letter, and further consist of letters and
1838 numbers.
1840 @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
1841 @subsection Formula syntax for Calc
1842 @cindex formula syntax, Calc
1843 @cindex syntax, of formulas
1845 A formula can be any algebraic expression understood by the Emacs
1846 @file{Calc} package.  @b{Note that @file{calc} has the
1847 non-standard convention that @samp{/} has lower precedence than
1848 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.}  Before
1849 evaluation by @code{calc-eval} (@pxref{Calling Calc from
1850 Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
1851 Emacs Calc Manual}),
1852 @c FIXME:  The link to the Calc manual in HTML does not work.
1853 variable substitution takes place according to the rules described above.
1854 @cindex vectors, in table calculations
1855 The range vectors can be directly fed into the Calc vector functions
1856 like @samp{vmean} and @samp{vsum}.
1858 @cindex format specifier
1859 @cindex mode, for @file{calc}
1860 A formula can contain an optional mode string after a semicolon.  This
1861 string consists of flags to influence Calc and other modes during
1862 execution.  By default, Org uses the standard Calc modes (precision
1863 12, angular units degrees, fraction and symbolic modes off.  The display
1864 format, however, has been changed to @code{(float 5)} to keep tables
1865 compact.  The default settings can be configured using the variable
1866 @code{org-calc-default-modes}.
1868 @example
1869 p20           @r{switch the internal precision to 20 digits}
1870 n3 s3 e2 f4   @r{normal, scientific, engineering, or fixed display format}
1871 D R           @r{angle modes: degrees, radians}
1872 F S           @r{fraction and symbolic modes}
1873 N             @r{interpret all fields as numbers, use 0 for non-numbers}
1874 T             @r{force text interpretation}
1875 E             @r{keep empty fields in ranges}
1876 @end example
1878 @noindent
1879 In addition, you may provide a @code{printf} format specifier to
1880 reformat the final result.  A few examples:
1882 @example
1883 $1+$2                @r{Sum of first and second field}
1884 $1+$2;%.2f           @r{Same, format result to two decimals}
1885 exp($2)+exp($1)      @r{Math functions can be used}
1886 $0;%.1f              @r{Reformat current cell to 1 decimal}
1887 ($3-32)*5/9          @r{Degrees F -> C conversion}
1888 $c/$1/$cm            @r{Hz -> cm conversion, using @file{constants.el}}
1889 tan($1);Dp3s1        @r{Compute in degrees, precision 3, display SCI 1}
1890 sin($1);Dp3%.1e      @r{Same, but use printf specifier for display}
1891 vmean($2..$7)        @r{Compute column range mean, using vector function}
1892 vmean($2..$7);EN     @r{Same, but treat empty fields as 0}
1893 taylor($3,x=7,2)     @r{taylor series of $3, at x=7, second degree}
1894 @end example
1896 Calc also contains a complete set of logical operations.  For example
1898 @example
1899 if($1<20,teen,string(""))  @r{``teen'' if age $1 less than 20, else empty}
1900 @end example
1902 @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
1903 @subsection Emacs Lisp forms as formulas
1904 @cindex Lisp forms, as table formulas
1906 It is also possible to write a formula in Emacs Lisp; this can be useful
1907 for string manipulation and control structures, if the Calc's
1908 functionality is not enough.  If a formula starts with a single quote
1909 followed by an opening parenthesis, then it is evaluated as a lisp form.
1910 The evaluation should return either a string or a number.  Just as with
1911 @file{calc} formulas, you can specify modes and a printf format after a
1912 semicolon.  With Emacs Lisp forms, you need to be conscious about the way
1913 field references are interpolated into the form.  By default, a
1914 reference will be interpolated as a Lisp string (in double quotes)
1915 containing the field.  If you provide the @samp{N} mode switch, all
1916 referenced elements will be numbers (non-number fields will be zero) and
1917 interpolated as Lisp numbers, without quotes.  If you provide the
1918 @samp{L} flag, all fields will be interpolated literally, without quotes.
1919 I.e., if you want a reference to be interpreted as a string by the Lisp
1920 form, enclose the reference operator itself in double quotes, like
1921 @code{"$3"}.  Ranges are inserted as space-separated fields, so you can
1922 embed them in list or vector syntax.  A few examples, note how the
1923 @samp{N} mode is used when we do computations in lisp.
1925 @example
1926 @r{Swap the first two characters of the content of column 1}
1927   '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
1928 @r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
1929   '(+ $1 $2);N
1930 @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
1931   '(apply '+ '($1..$4));N
1932 @end example
1934 @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
1935 @subsection Field formulas
1936 @cindex field formula
1937 @cindex formula, for individual table field
1939 To assign a formula to a particular field, type it directly into the
1940 field, preceded by @samp{:=}, for example @samp{:=$1+$2}.  When you
1941 press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
1942 the field, the formula will be stored as the formula for this field,
1943 evaluated, and the current field replaced with the result.
1945 Formulas are stored in a special line starting with @samp{#+TBLFM:}
1946 directly below the table.  If you typed the equation in the 4th field of
1947 the 3rd data line in the table, the formula will look like
1948 @samp{@@3$4=$1+$2}.  When inserting/deleting/swapping column and rows
1949 with the appropriate commands, @i{absolute references} (but not relative
1950 ones) in stored formulas are modified in order to still reference the
1951 same field.  Of cause this is not true if you edit the table structure
1952 with normal editing commands - then you must fix the equations yourself.
1954 Instead of typing an equation into the field, you may also use the
1955 following command
1957 @table @kbd
1958 @kindex C-u C-c =
1959 @item C-u C-c =
1960 Install a new formula for the current field.  The command prompts for a
1961 formula, with default taken from the @samp{#+TBLFM:} line, applies
1962 it to the current field and stores it.
1963 @end table
1965 @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
1966 @subsection Column formulas
1967 @cindex column formula
1968 @cindex formula, for table column
1970 Often in a table, the same formula should be used for all fields in a
1971 particular column.  Instead of having to copy the formula to all fields
1972 in that column, Org allows to assign a single formula to an entire
1973 column.  If the table contains horizontal separator hlines, everything
1974 before the first such line is considered part of the table @emph{header}
1975 and will not be modified by column formulas.
1977 To assign a formula to a column, type it directly into any field in the
1978 column, preceded by an equal sign, like @samp{=$1+$2}.  When you press
1979 @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
1980 field, the formula will be stored as the formula for the current column,
1981 evaluated and the current field replaced with the result.  If the field
1982 contains only @samp{=}, the previously stored formula for this column is
1983 used.  For each column, Org will only remember the most recently
1984 used formula.  In the @samp{TBLFM:} line, column formulas will look like
1985 @samp{$4=$1+$2}.
1987 Instead of typing an equation into the field, you may also use the
1988 following command:
1990 @table @kbd
1991 @kindex C-c =
1992 @item C-c =
1993 Install a new formula for the current column and replace current field with
1994 the result of the formula.  The command prompts for a formula, with default
1995 taken from the @samp{#+TBLFM} line, applies it to the current field and
1996 stores it.  With a numeric prefix argument(e.g. @kbd{C-5 C-c =}) the command
1997 will apply it to that many consecutive fields in the current column.
1998 @end table
2000 @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
2001 @subsection Editing and debugging formulas
2002 @cindex formula editing
2003 @cindex editing, of table formulas
2005 You can edit individual formulas in the minibuffer or directly in the
2006 field.  Org can also prepare a special buffer with all active
2007 formulas of a table.  When offering a formula for editing, Org
2008 converts references to the standard format (like @code{B3} or @code{D&})
2009 if possible.  If you prefer to only work with the internal format (like
2010 @code{@@3$2} or @code{$4}), configure the variable
2011 @code{org-table-use-standard-references}.
2013 @table @kbd
2014 @kindex C-c =
2015 @kindex C-u C-c =
2016 @item C-c =
2017 @itemx C-u C-c =
2018 Edit the formula associated with the current column/field in the
2019 minibuffer.  See @ref{Column formulas} and @ref{Field formulas}.
2020 @kindex C-u C-u C-c =
2021 @item C-u C-u C-c =
2022 Re-insert the active formula (either a
2023 field formula, or a column formula) into the current field, so that you
2024 can edit it directly in the field.  The advantage over editing in the
2025 minibuffer is that you can use the command @kbd{C-c ?}.
2026 @kindex C-c ?
2027 @item C-c ?
2028 While editing a formula in a table field, highlight the field(s)
2029 referenced by the reference at the cursor position in the formula.
2030 @kindex C-c @}
2031 @item C-c @}
2032 Toggle the display of row and column numbers for a table, using
2033 overlays.  These are updated each time the table is aligned, you can
2034 force it with @kbd{C-c C-c}.
2035 @kindex C-c @{
2036 @item C-c @{
2037 Toggle the formula debugger on and off.  See below.
2038 @kindex C-c '
2039 @item C-c '
2040 Edit all formulas for the current table in a special buffer, where the
2041 formulas will be displayed one per line.  If the current field has an
2042 active formula, the cursor in the formula editor will mark it.
2043 While inside the special buffer, Org will automatically highlight
2044 any field or range reference at the cursor position.  You may edit,
2045 remove and add formulas, and use the following commands:
2046 @table @kbd
2047 @kindex C-c C-c
2048 @kindex C-x C-s
2049 @item C-c C-c
2050 @itemx C-x C-s
2051 Exit the formula editor and store the modified formulas.  With @kbd{C-u}
2052 prefix, also apply the new formulas to the entire table.
2053 @kindex C-c C-q
2054 @item C-c C-q
2055 Exit the formula editor without installing changes.
2056 @kindex C-c C-r
2057 @item C-c C-r
2058 Toggle all references in the formula editor between standard (like
2059 @code{B3}) and internal (like @code{@@3$2}).
2060 @kindex @key{TAB}
2061 @item @key{TAB}
2062 Pretty-print or indent lisp formula at point.  When in a line containing
2063 a lisp formula, format the formula according to Emacs Lisp rules.
2064 Another @key{TAB} collapses the formula back again.  In the open
2065 formula, @key{TAB} re-indents just like in Emacs lisp mode.
2066 @kindex M-@key{TAB}
2067 @item M-@key{TAB}
2068 Complete Lisp symbols, just like in Emacs lisp mode.
2069 @kindex S-@key{up}
2070 @kindex S-@key{down}
2071 @kindex S-@key{left}
2072 @kindex S-@key{right}
2073 @item S-@key{up}/@key{down}/@key{left}/@key{right}
2074 Shift the reference at point.  For example, if the reference is
2075 @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
2076 This also works for relative references, and for hline references.
2077 @kindex M-S-@key{up}
2078 @kindex M-S-@key{down}
2079 @item M-S-@key{up}/@key{down}
2080 Move the test line for column formulas in the Org buffer up and
2081 down.
2082 @kindex M-@key{up}
2083 @kindex M-@key{down}
2084 @item M-@key{up}/@key{down}
2085 Scroll the window displaying the table.
2086 @kindex C-c @}
2087 @item C-c @}
2088 Turn the coordinate grid in the table on and off.
2089 @end table
2090 @end table
2092 Making a table field blank does not remove the formula associated with
2093 the field, because that is stored in a different line (the @samp{TBLFM}
2094 line) - during the next recalculation the field will be filled again.
2095 To remove a formula from a field, you have to give an empty reply when
2096 prompted for the formula, or to edit the @samp{#+TBLFM} line.
2098 @kindex C-c C-c
2099 You may edit the @samp{#+TBLFM} directly and re-apply the changed
2100 equations with @kbd{C-c C-c} in that line, or with the normal
2101 recalculation commands in the table.
2103 @subsubheading Debugging formulas
2104 @cindex formula debugging
2105 @cindex debugging, of table formulas
2106 When the evaluation of a formula leads to an error, the field content
2107 becomes the string @samp{#ERROR}.  If you would like see what is going
2108 on during variable substitution and calculation in order to find a bug,
2109 turn on formula debugging in the @code{Tbl} menu and repeat the
2110 calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
2111 field.  Detailed information will be displayed.
2113 @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
2114 @subsection Updating the table
2115 @cindex recomputing table fields
2116 @cindex updating, table
2118 Recalculation of a table is normally not automatic, but needs to be
2119 triggered by a command.  See @ref{Advanced features} for a way to make
2120 recalculation at least semi-automatically.
2122 In order to recalculate a line of a table or the entire table, use the
2123 following commands:
2125 @table @kbd
2126 @kindex C-c *
2127 @item C-c *
2128 Recalculate the current row by first applying the stored column formulas
2129 from left to right, and all field formulas in the current row.
2131 @kindex C-u C-c *
2132 @item C-u C-c *
2133 @kindex C-u C-c C-c
2134 @itemx C-u C-c C-c
2135 Recompute the entire table, line by line.  Any lines before the first
2136 hline are left alone, assuming that these are part of the table header.
2138 @kindex C-u C-u C-c *
2139 @kindex C-u C-u C-c C-c
2140 @item C-u C-u C-c *
2141 @itemx C-u C-u C-c C-c
2142 Iterate the table by recomputing it until no further changes occur.
2143 This may be necessary if some computed fields use the value of other
2144 fields that are computed @i{later} in the calculation sequence.
2145 @end table
2147 @node Advanced features,  , Updating the table, The spreadsheet
2148 @subsection Advanced features
2150 If you want the recalculation of fields to happen automatically, or if
2151 you want to be able to assign @i{names} to fields and columns, you need
2152 to reserve the first column of the table for special marking characters.
2153 @table @kbd
2154 @kindex C-#
2155 @item C-#
2156 Rotate the calculation mark in first column through the states @samp{},
2157 @samp{#}, @samp{*}, @samp{!}, @samp{$}.  The meaning of these characters
2158 is discussed below.  When there is an active region, change all marks in
2159 the region.
2160 @end table
2162 Here is an example of a table that collects exam results of students and
2163 makes use of these features:
2165 @example
2166 @group
2167 |---+---------+--------+--------+--------+-------+------|
2168 |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2169 |---+---------+--------+--------+--------+-------+------|
2170 | ! |         |     P1 |     P2 |     P3 |   Tot |      |
2171 | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
2172 | ^ |         |     m1 |     m2 |     m3 |    mt |      |
2173 |---+---------+--------+--------+--------+-------+------|
2174 | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
2175 | # | Sara    |      6 |     14 |     19 |    39 |  7.8 |
2176 | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
2177 |---+---------+--------+--------+--------+-------+------|
2178 |   | Average |        |        |        |  29.7 |      |
2179 | ^ |         |        |        |        |    at |      |
2180 | $ | max=50  |        |        |        |       |      |
2181 |---+---------+--------+--------+--------+-------+------|
2182 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
2183 @end group
2184 @end example
2186 @noindent @b{Important}: Please note that for these special tables,
2187 recalculating the table with @kbd{C-u C-c *} will only affect rows that
2188 are marked @samp{#} or @samp{*}, and fields that have a formula assigned
2189 to the field itself.  The column formulas are not applied in rows with
2190 empty first field.
2192 @cindex marking characters, tables
2193 The marking characters have the following meaning:
2194 @table @samp
2195 @item !
2196 The fields in this line define names for the columns, so that you may
2197 refer to a column as @samp{$Tot} instead of @samp{$6}.
2198 @item ^
2199 This row defines names for the fields @emph{above} the row.  With such
2200 a definition, any formula in the table may use @samp{$m1} to refer to
2201 the value @samp{10}.  Also, if you assign a formula to a names field, it
2202 will be stored as @samp{$name=...}.
2203 @item _
2204 Similar to @samp{^}, but defines names for the fields in the row
2205 @emph{below}.
2206 @item $
2207 Fields in this row can define @emph{parameters} for formulas.  For
2208 example, if a field in a @samp{$} row contains @samp{max=50}, then
2209 formulas in this table can refer to the value 50 using @samp{$max}.
2210 Parameters work exactly like constants, only that they can be defined on
2211 a per-table basis.
2212 @item #
2213 Fields in this row are automatically recalculated when pressing
2214 @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row.  Also, this row
2215 is selected for a global recalculation with @kbd{C-u C-c *}.  Unmarked
2216 lines will be left alone by this command.
2217 @item *
2218 Selects this line for global recalculation with @kbd{C-u C-c *}, but
2219 not for automatic recalculation.  Use this when automatic
2220 recalculation slows down editing too much.
2221 @item
2222 Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
2223 All lines that should be recalculated should be marked with @samp{#}
2224 or @samp{*}.
2225 @item /
2226 Do not export this line.  Useful for lines that contain the narrowing
2227 @samp{<N>} markers.
2228 @end table
2230 Finally, just to whet your appetite on what can be done with the
2231 fantastic @file{calc} package, here is a table that computes the Taylor
2232 series of degree @code{n} at location @code{x} for a couple of
2233 functions.
2235 @example
2236 @group
2237 |---+-------------+---+-----+--------------------------------------|
2238 |   | Func        | n | x   | Result                               |
2239 |---+-------------+---+-----+--------------------------------------|
2240 | # | exp(x)      | 1 | x   | 1 + x                                |
2241 | # | exp(x)      | 2 | x   | 1 + x + x^2 / 2                      |
2242 | # | exp(x)      | 3 | x   | 1 + x + x^2 / 2 + x^3 / 6            |
2243 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2244 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2    |
2245 | * | tan(x)      | 3 | x   | 0.0175 x + 1.77e-6 x^3               |
2246 |---+-------------+---+-----+--------------------------------------|
2247 #+TBLFM: $5=taylor($2,$4,$3);n3
2248 @end group
2249 @end example
2251 @node Hyperlinks, TODO Items, Tables, Top
2252 @chapter Hyperlinks
2253 @cindex hyperlinks
2255 Like HTML, Org provides links inside a file, external links to
2256 other files, Usenet articles, emails, and much more.
2258 @menu
2259 * Link format::                 How links in Org are formatted
2260 * Internal links::              Links to other places in the current file
2261 * External links::              URL-like links to the world
2262 * Handling links::              Creating, inserting and following
2263 * Using links outside Org::     Linking from my C source code?
2264 * Link abbreviations::          Shortcuts for writing complex links
2265 * Search options::              Linking to a specific location
2266 * Custom searches::             When the default search is not enough
2267 @end menu
2269 @node Link format, Internal links, Hyperlinks, Hyperlinks
2270 @section Link format
2271 @cindex link format
2272 @cindex format, of links
2274 Org will recognize plain URL-like links and activate them as
2275 clickable links.  The general link format, however, looks like this:
2277 @example
2278 [[link][description]]       @r{or alternatively}           [[link]]
2279 @end example
2281 Once a link in the buffer is complete (all brackets present), Org
2282 will change the display so that @samp{description} is displayed instead
2283 of @samp{[[link][description]]} and @samp{link} is displayed instead of
2284 @samp{[[link]]}.  Links will be highlighted in the face @code{org-link},
2285 which by default is an underlined face.  You can directly edit the
2286 visible part of a link.  Note that this can be either the @samp{link}
2287 part (if there is no description) or the @samp{description} part.  To
2288 edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
2289 cursor on the link.
2291 If you place the cursor at the beginning or just behind the end of the
2292 displayed text and press @key{BACKSPACE}, you will remove the
2293 (invisible) bracket at that location.  This makes the link incomplete
2294 and the internals are again displayed as plain text.  Inserting the
2295 missing bracket hides the link internals again.  To show the
2296 internal structure of all links, use the menu entry
2297 @code{Org->Hyperlinks->Literal links}.
2299 @node Internal links, External links, Link format, Hyperlinks
2300 @section Internal links
2301 @cindex internal links
2302 @cindex links, internal
2303 @cindex targets, for links
2305 If the link does not look like a URL, it is considered to be internal in
2306 the current file.  Links such as @samp{[[My Target]]} or @samp{[[My
2307 Target][Find my target]]} lead to a text search in the current file.
2308 The link can be followed with @kbd{C-c C-o} when the cursor is on the
2309 link, or with a mouse click (@pxref{Handling links}).  The preferred
2310 match for such a link is a dedicated target: the same string in double
2311 angular brackets.  Targets may be located anywhere; sometimes it is
2312 convenient to put them into a comment line. For example
2314 @example
2315 # <<My Target>>
2316 @end example
2318 @noindent In HTML export (@pxref{HTML export}), such targets will become
2319 named anchors for direct access through @samp{http} links@footnote{Note
2320 that text before the first headline is usually not exported, so the
2321 first such target should be after the first headline.}.
2323 If no dedicated target exists, Org will search for the words in the
2324 link.  In the above example the search would be for @samp{my target}.
2325 Links starting with a star like @samp{*My Target} restrict the search to
2326 headlines.  When searching, Org mode will first try an exact match, but
2327 then move on to more and more lenient searches.  For example, the link
2328 @samp{[[*My Targets]]} will find any of the following:
2330 @example
2331 ** My targets
2332 ** TODO my targets are bright
2333 ** my 20 targets are
2334 @end example
2336 To insert a link targeting a headline, in-buffer completion can be used.
2337 Just type a star followed by a few optional letters into the buffer and
2338 press @kbd{M-@key{TAB}}.  All headlines in the current buffer will be
2339 offered as completions.  @xref{Handling links}, for more commands
2340 creating links.
2342 Following a link pushes a mark onto Org's own mark ring.  You can
2343 return to the previous position with @kbd{C-c &}.  Using this command
2344 several times in direct succession goes back to positions recorded
2345 earlier.
2347 @menu
2348 * Radio targets::               Make targets trigger links in plain text
2349 @end menu
2351 @node Radio targets,  , Internal links, Internal links
2352 @subsection Radio targets
2353 @cindex radio targets
2354 @cindex targets, radio
2355 @cindex links, radio targets
2357 Org can automatically turn any occurrences of certain target names
2358 in normal text into a link.  So without explicitly creating a link, the
2359 text connects to the target radioing its position.  Radio targets are
2360 enclosed by triple angular brackets.  For example, a target @samp{<<<My
2361 Target>>>} causes each occurrence of @samp{my target} in normal text to
2362 become activated as a link.  The Org file is scanned automatically
2363 for radio targets only when the file is first loaded into Emacs.  To
2364 update the target list during editing, press @kbd{C-c C-c} with the
2365 cursor on or at a target.
2367 @node External links, Handling links, Internal links, Hyperlinks
2368 @section External links
2369 @cindex links, external
2370 @cindex external links
2371 @cindex links, external
2372 @cindex Gnus links
2373 @cindex BBDB links
2374 @cindex IRC links
2375 @cindex URL links
2376 @cindex file links
2377 @cindex VM links
2378 @cindex RMAIL links
2379 @cindex WANDERLUST links
2380 @cindex MH-E links
2381 @cindex USENET links
2382 @cindex SHELL links
2383 @cindex Info links
2384 @cindex elisp links
2386 Org supports links to files, websites, Usenet and email messages,
2387 BBDB database entries and links to both IRC conversations and their
2388 logs.  External links are URL-like locators.  They start with a short
2389 identifying string followed by a colon.  There can be no space after
2390 the colon.  The following list shows examples for each link type.
2392 @example
2393 http://www.astro.uva.nl/~dominik          @r{on the web}
2394 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
2395 file:papers/last.pdf                      @r{file, relative path}
2396 news:comp.emacs                           @r{Usenet link}
2397 mailto:adent@@galaxy.net                  @r{Mail link}
2398 vm:folder                                 @r{VM folder link}
2399 vm:folder#id                              @r{VM message link}
2400 vm://myself@@some.where.org/folder#id     @r{VM on remote machine}
2401 wl:folder                                 @r{WANDERLUST folder link}
2402 wl:folder#id                              @r{WANDERLUST message link}
2403 mhe:folder                                @r{MH-E folder link}
2404 mhe:folder#id                             @r{MH-E message link}
2405 rmail:folder                              @r{RMAIL folder link}
2406 rmail:folder#id                           @r{RMAIL message link}
2407 gnus:group                                @r{Gnus group link}
2408 gnus:group#id                             @r{Gnus article link}
2409 bbdb:Richard Stallman                     @r{BBDB link}
2410 irc:/irc.com/#emacs/bob                   @r{IRC link}
2411 shell:ls *.org                            @r{A shell command}
2412 elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
2413 @end example
2415 A link should be enclosed in double brackets and may contain a
2416 descriptive text to be displayed instead of the URL (@pxref{Link
2417 format}), for example:
2419 @example
2420 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
2421 @end example
2423 @noindent
2424 If the description is a file name or URL that points to an image, HTML
2425 export (@pxref{HTML export}) will inline the image as a clickable
2426 button.  If there is no description at all and the link points to an
2427 image,
2428 that image will be inlined into the exported HTML file.
2430 @cindex angular brackets, around links
2431 @cindex plain text external links
2432 Org also finds external links in the normal text and activates them
2433 as links.  If spaces must be part of the link (for example in
2434 @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
2435 about the end of the link, enclose them in angular brackets.
2437 @node Handling links, Using links outside Org, External links, Hyperlinks
2438 @section Handling links
2439 @cindex links, handling
2441 Org provides methods to create a link in the correct syntax, to
2442 insert it into an Org file, and to follow the link.
2444 @table @kbd
2445 @kindex C-c l
2446 @cindex storing links
2447 @item C-c l
2448 Store a link to the current location.  This is a @emph{global} command
2449 which can be used in any buffer to create a link.  The link will be
2450 stored for later insertion into an Org buffer (see below).  For
2451 Org files, if there is a @samp{<<target>>} at the cursor, the
2452 link points to the target.  Otherwise it points to the current
2453 headline.  For VM, Rmail, Wanderlust, MH-E, Gnus and BBDB buffers, the
2454 link will indicate the current article/entry.  For W3 and W3M buffers,
2455 the link goes to the current URL.  For IRC links, if you set the
2456 variable @code{org-irc-link-to-logs} to non-nil then @kbd{C-c l} will
2457 store a @samp{file:/} style link to the relevant point in the logs for
2458 the current conversation. Otherwise an @samp{irc:/} style link to the
2459 user/channel/server under the point will be stored.  For any other
2460 files, the link will point to the file, with a search string
2461 (@pxref{Search options}) pointing to the contents of the current line.
2462 If there is an active region, the selected words will form the basis
2463 of the search string.  If the automatically created link is not
2464 working correctly or accurately enough, you can write custom functions
2465 to select the search string and to do the search for particular file
2466 types - see @ref{Custom searches}.  The key binding @kbd{C-c l} is
2467 only a suggestion - see @ref{Installation}.
2469 @kindex C-c C-l
2470 @cindex link completion
2471 @cindex completion, of links
2472 @cindex inserting links
2473 @item C-c C-l
2474 Insert a link.  This prompts for a link to be inserted into the buffer.  You
2475 can just type a link, using text for an internal link, or one of the link
2476 type prefixes mentioned in the examples above.  All links stored during the
2477 current session are part of the history for this prompt, so you can access
2478 them with @key{up} and @key{down} (or @kbd{M-p/n}).  Completion, on the other
2479 hand, will help you to insert valid link prefixes like @samp{http:} or
2480 @samp{ftp:}, including the prefixes defined through link abbreviations
2481 (@pxref{Link abbreviations}).  The link will be inserted into the
2482 buffer@footnote{After insertion of a stored link, the link will be removed
2483 from the list of stored links.  To keep it in the list later use, use a
2484 triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
2485 @code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
2486 If some text was selected when this command is called, the selected text
2487 becomes the default description.@* Note that you don't have to use this
2488 command to insert a link.  Links in Org are plain text, and you can type
2489 or paste them straight into the buffer.  By using this command, the links are
2490 automatically enclosed in double brackets, and you will be asked for the
2491 optional descriptive text.
2493 @c  If the link is a @samp{file:} link and
2494 @c the linked file is located in the same directory as the current file or
2495 @c a subdirectory of it, the path of the file will be inserted relative to
2496 @c the current directory.
2498 @kindex C-u C-c C-l
2499 @cindex file name completion
2500 @cindex completion, of file names
2501 @item C-u C-c C-l
2502 When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
2503 a file will be inserted and you may use file name completion to select
2504 the name of the file.  The path to the file is inserted relative to the
2505 directory of the current org file, if the linked file is in the current
2506 directory or in a sub-directory of it, or if the path is written relative
2507 to the current directory using @samp{../}.  Otherwise an absolute path
2508 is used, if possible with @samp{~/} for your home directory.  You can
2509 force an absolute path with two @kbd{C-u} prefixes.
2511 @item C-c C-l @r{(with cursor on existing link)}
2512 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
2513 link and description parts of the link.
2515 @cindex following links
2516 @kindex C-c C-o
2517 @item C-c C-o
2518 Open link at point.  This will launch a web browser for URLs (using
2519 @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
2520 for the corresponding links, and execute the command in a shell link.
2521 When the cursor is on an internal link, this commands runs the
2522 corresponding search.  When the cursor is on a TAG list in a headline,
2523 it creates the corresponding TAGS view.  If the cursor is on a time
2524 stamp, it compiles the agenda for that date.  Furthermore, it will visit
2525 text and remote files in @samp{file:} links with Emacs and select a
2526 suitable application for local non-text files.  Classification of files
2527 is based on file extension only.  See option @code{org-file-apps}.  If
2528 you want to override the default application and visit the file with
2529 Emacs, use a @kbd{C-u} prefix.
2531 @kindex mouse-2
2532 @kindex mouse-1
2533 @item mouse-2
2534 @itemx mouse-1
2535 On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
2536 would.  Under Emacs 22, also @kbd{mouse-1} will follow a link.
2538 @kindex mouse-3
2539 @item mouse-3
2540 Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
2541 internal links to be displayed in another window@footnote{See the
2542 variable @code{org-display-internal-link-with-indirect-buffer}}.
2544 @cindex mark ring
2545 @kindex C-c %
2546 @item C-c %
2547 Push the current position onto the mark ring, to be able to return
2548 easily. Commands following an internal link do this automatically.
2550 @cindex links, returning to
2551 @kindex C-c &
2552 @item C-c &
2553 Jump back to a recorded position.  A position is recorded by the
2554 commands following internal links, and by @kbd{C-c %}.  Using this
2555 command several times in direct succession moves through a ring of
2556 previously recorded positions.
2558 @kindex C-c C-x C-n
2559 @kindex C-c C-x C-p
2560 @cindex links, finding next/previous
2561 @item C-c C-x C-n
2562 @itemx C-c C-x C-p
2563 Move forward/backward to the next link in the buffer.  At the limit of
2564 the buffer, the search fails once, and then wraps around.  The key
2565 bindings for this are really too long, you might want to bind this also
2566 to @kbd{C-n} and @kbd{C-p}
2567 @lisp
2568 (add-hook 'org-load-hook
2569   (lambda ()
2570     (define-key 'org-mode-map "\C-n" 'org-next-link)
2571     (define-key 'org-mode-map "\C-p" 'org-previous-link)))
2572 @end lisp
2573 @end table
2575 @node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
2576 @section Using links outside Org
2578 You can insert and follow links that have Org syntax not only in
2579 Org, but in any Emacs buffer.  For this, you should create two
2580 global commands, like this (please select suitable global keys
2581 yourself):
2583 @lisp
2584 (global-set-key "\C-c L" 'org-insert-link-global)
2585 (global-set-key "\C-c o" 'org-open-at-point-global)
2586 @end lisp
2588 @node Link abbreviations, Search options, Using links outside Org, Hyperlinks
2589 @section Link abbreviations
2590 @cindex link abbreviations
2591 @cindex abbreviation, links
2593 Long URLs can be cumbersome to type, and often many similar links are
2594 needed in a document.  For this you can use link abbreviations.  An
2595 abbreviated link looks like this
2597 @example
2598 [[linkword:tag][description]]
2599 @end example
2601 @noindent
2602 where the tag is optional.  Such abbreviations are resolved according to
2603 the information in the variable @code{org-link-abbrev-alist} that
2604 relates the linkwords to replacement text.  Here is an example:
2606 @lisp
2607 @group
2608 (setq org-link-abbrev-alist
2609   '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
2610     ("google"   . "http://www.google.com/search?q=")
2611     ("ads"      . "http://adsabs.harvard.edu/cgi-bin/
2612                    nph-abs_connect?author=%s&db_key=AST")))
2613 @end group
2614 @end lisp
2616 If the replacement text contains the string @samp{%s}, it will be
2617 replaced with the tag.  Otherwise the tag will be appended to the string
2618 in order to create the link.  You may also specify a function that will
2619 be called with the tag as the only argument to create the link.
2621 With the above setting, you could link to a specific bug with
2622 @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
2623 @code{[[google:OrgMode]]} and find out what the Org author is
2624 doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
2626 If you need special abbreviations just for a single Org buffer, you
2627 can define them in the file with
2629 @example
2630 #+LINK: bugzilla  http://10.1.2.9/bugzilla/show_bug.cgi?id=
2631 #+LINK: google    http://www.google.com/search?q=%s
2632 @end example
2634 @noindent
2635 In-buffer completion @pxref{Completion} can be used after @samp{[} to
2636 complete link abbreviations.
2638 @node Search options, Custom searches, Link abbreviations, Hyperlinks
2639 @section Search options in file links
2640 @cindex search option in file links
2641 @cindex file links, searching
2643 File links can contain additional information to make Emacs jump to a
2644 particular location in the file when following a link.  This can be a
2645 line number or a search option after a double@footnote{For backward
2646 compatibility, line numbers can also follow a single colon.} colon. For
2647 example, when the command @kbd{C-c l} creates a link (@pxref{Handling
2648 links}) to a file, it encodes the words in the current line as a search
2649 string that can be used to find this line back later when following the
2650 link with @kbd{C-c C-o}.
2652 Here is the syntax of the different ways to attach a search to a file
2653 link, together with an explanation:
2655 @example
2656 [[file:~/code/main.c::255]]
2657 [[file:~/xx.org::My Target]]
2658 [[file:~/xx.org::*My Target]]
2659 [[file:~/xx.org::/regexp/]]
2660 @end example
2662 @table @code
2663 @item 255
2664 Jump to line 255.
2665 @item My Target
2666 Search for a link target @samp{<<My Target>>}, or do a text search for
2667 @samp{my target}, similar to the search in internal links, see
2668 @ref{Internal links}.  In HTML export (@pxref{HTML export}), such a file
2669 link will become an HTML reference to the corresponding named anchor in
2670 the linked file.
2671 @item *My Target
2672 In an Org file, restrict search to headlines.
2673 @item /regexp/
2674 Do a regular expression search for @code{regexp}.  This uses the Emacs
2675 command @code{occur} to list all matches in a separate window.  If the
2676 target file is in Org mode, @code{org-occur} is used to create a
2677 sparse tree with the matches.
2678 @c If the target file is a directory,
2679 @c @code{grep} will be used to search all files in the directory.
2680 @end table
2682 As a degenerate case, a file link with an empty file name can be used
2683 to search the current file.  For example, @code{[[file:::find me]]} does
2684 a search for @samp{find me} in the current file, just as
2685 @samp{[[find me]]} would.
2687 @node Custom searches,  , Search options, Hyperlinks
2688 @section Custom Searches
2689 @cindex custom search strings
2690 @cindex search strings, custom
2692 The default mechanism for creating search strings and for doing the
2693 actual search related to a file link may not work correctly in all
2694 cases.  For example, BibTeX database files have many entries like
2695 @samp{year="1993"} which would not result in good search strings,
2696 because the only unique identification for a BibTeX entry is the
2697 citation key.
2699 If you come across such a problem, you can write custom functions to set
2700 the right search string for a particular file type, and to do the search
2701 for the string in the file.  Using @code{add-hook}, these functions need
2702 to be added to the hook variables
2703 @code{org-create-file-search-functions} and
2704 @code{org-execute-file-search-functions}.  See the docstring for these
2705 variables for more information.  Org actually uses this mechanism
2706 for Bib@TeX{} database files, and you can use the corresponding code as
2707 an implementation example.  Search for @samp{BibTeX links} in the source
2708 file.
2710 @node TODO Items, Tags, Hyperlinks, Top
2711 @chapter TODO Items
2712 @cindex TODO items
2714 Org mode does not maintain TODO lists as separate documents.  Instead,
2715 TODO items are an integral part of the notes file, because TODO items
2716 usually come up while taking notes!  With Org mode, simply mark any
2717 entry in a tree as being a TODO item.  In this way, information is not
2718 duplicated, and the entire context from which the TODO item emerged is
2719 always present.
2721 Of course, this technique for managing TODO items scatters them
2722 throughout your notes file.  Org mode compensates for this by providing
2723 methods to give you an overview of all the things that you have to do.
2725 @menu
2726 * TODO basics::                 Marking and displaying TODO entries
2727 * TODO extensions::             Workflow and assignments
2728 * Progress logging::            Dates and notes for progress
2729 * Priorities::                  Some things are more important than others
2730 * Breaking down tasks::         Splitting a task into manageable pieces
2731 * Checkboxes::                  Tick-off lists
2732 @end menu
2734 @node TODO basics, TODO extensions, TODO Items, TODO Items
2735 @section Basic TODO functionality
2737 Any headline becomes a TODO item when it starts with the word
2738 @samp{TODO}, for example:
2740 @example
2741 *** TODO Write letter to Sam Fortune
2742 @end example
2744 @noindent
2745 The most important commands to work with TODO entries are:
2747 @table @kbd
2748 @kindex C-c C-t
2749 @cindex cycling, of TODO states
2750 @item C-c C-t
2751 Rotate the TODO state of the current item among
2753 @example
2754 ,-> (unmarked) -> TODO -> DONE --.
2755 '--------------------------------'
2756 @end example
2758 The same rotation can also be done ``remotely'' from the timeline and
2759 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
2761 @kindex C-u C-c C-t
2762 @item C-u C-c C-t
2763 Select a specific keyword using completion or (if it has been set up)
2764 the fast selection interface.  For the latter, you need to assign keys
2765 to TODO states, see @ref{Per-file keywords} and @ref{Setting tags} for
2766 more information.
2768 @kindex S-@key{right}
2769 @kindex S-@key{left}
2770 @item S-@key{right}
2771 @itemx S-@key{left}
2772 Select the following/preceding TODO state, similar to cycling.  Useful
2773 mostly if more than two TODO states are possible (@pxref{TODO
2774 extensions}).
2775 @kindex C-c C-v
2776 @kindex C-c / t
2777 @cindex sparse tree, for TODO
2778 @item C-c C-v
2779 @itemx C-c / t
2780 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
2781 the entire buffer, but shows all TODO items and the headings hierarchy
2782 above them.  With a prefix argument, search for a specific TODO.  You will be
2783 prompted for the keyword, and you can also give a list of keywords like
2784 @code{KWD1|KWD2|...}.  With numeric prefix argument N, show the tree for the
2785 Nth keyword in the variable @code{org-todo-keywords}.  With two prefix
2786 arguments, find all TODO and DONE entries.
2787 @kindex C-c a t
2788 @item C-c a t
2789 Show the global TODO list.  Collects the TODO items from all agenda
2790 files (@pxref{Agenda Views}) into a single buffer.  The new buffer will
2791 be in @code{agenda-mode}, which provides commands to examine and
2792 manipulate the TODO entries from the new buffer (@pxref{Agenda
2793 commands}).  @xref{Global TODO list}, for more information.
2794 @kindex S-M-@key{RET}
2795 @item S-M-@key{RET}
2796 Insert a new TODO entry below the current one.
2797 @end table
2799 @node TODO extensions, Progress logging, TODO basics, TODO Items
2800 @section Extended use of TODO keywords
2801 @cindex extended TODO keywords
2803 By default, marked TODO entries have one of only two states: TODO and
2804 DONE.  Org mode allows you to classify TODO items in more complex ways
2805 with @emph{TODO keywords} (stored in @code{org-todo-keywords}).  With
2806 special setup, the TODO keyword system can work differently in different
2807 files.
2809 Note that @i{tags} are another way to classify headlines in general and
2810 TODO items in particular (@pxref{Tags}).
2812 @menu
2813 * Workflow states::             From TODO to DONE in steps
2814 * TODO types::                  I do this, Fred does the rest
2815 * Multiple sets in one file::   Mixing it all, and still finding your way
2816 * Fast access to TODO states::  Single letter selection of a state
2817 * Per-file keywords::           Different files, different requirements
2818 * Faces for TODO keywords::     Highlighting states
2819 @end menu
2821 @node Workflow states, TODO types, TODO extensions, TODO extensions
2822 @subsection TODO keywords as workflow states
2823 @cindex TODO workflow
2824 @cindex workflow states as TODO keywords
2826 You can use TODO keywords to indicate different @emph{sequential} states
2827 in the process of working on an item, for example@footnote{Changing
2828 this variable only becomes effective after restarting Org mode in a
2829 buffer.}:
2831 @lisp
2832 (setq org-todo-keywords
2833   '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
2834 @end lisp
2836 The vertical bar separates the TODO keywords (states that @emph{need
2837 action}) from the DONE states (which need @emph{no further action}.  If
2838 you don't provide the separator bar, the last state is used as the DONE
2839 state.
2840 @cindex completion, of TODO keywords
2841 With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
2842 to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED.  You may
2843 also use a numeric prefix argument to quickly select a specific state.  For
2844 example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
2845 Or you can use @kbd{S-left} to go backward through the sequence.  If you
2846 define many keywords, you can use in-buffer completion
2847 (@pxref{Completion}) or even a special one-key selection scheme
2848 (@pxref{Fast access to TODO states}) to insert these words into the
2849 buffer.  Changing a TODO state can be logged with a timestamp, see
2850 @ref{Tracking TODO state changes} for more information.
2852 @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
2853 @subsection TODO keywords as types
2854 @cindex TODO types
2855 @cindex names as TODO keywords
2856 @cindex types as TODO keywords
2858 The second possibility is to use TODO keywords to indicate different
2859 @emph{types} of action items.  For example, you might want to indicate
2860 that items are for ``work'' or ``home''.  Or, when you work with several
2861 people on a single project, you might want to assign action items
2862 directly to persons, by using their names as TODO keywords.  This would
2863 be set up like this:
2865 @lisp
2866 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
2867 @end lisp
2869 In this case, different keywords do not indicate a sequence, but rather
2870 different types.  So the normal work flow would be to assign a task to a
2871 person, and later to mark it DONE.  Org mode supports this style by adapting
2872 the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
2873 @kbd{t} command in the timeline and agenda buffers.}.  When used several
2874 times in succession, it will still cycle through all names, in order to first
2875 select the right type for a task.  But when you return to the item after some
2876 time and execute @kbd{C-c C-t} again, it will switch from any name directly
2877 to DONE.  Use prefix arguments or completion to quickly select a specific
2878 name.  You can also review the items of a specific TODO type in a sparse tree
2879 by using a numeric prefix to @kbd{C-c C-v}.  For example, to see all things
2880 Lucy has to do, you would use @kbd{C-3 C-c C-v}.  To collect Lucy's items
2881 from all agenda files into a single buffer, you would use the numeric prefix
2882 argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
2884 @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
2885 @subsection Multiple keyword sets in one file
2886 @cindex TODO keyword sets
2888 Sometimes you may want to use different sets of TODO keywords in
2889 parallel.  For example, you may want to have the basic
2890 @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
2891 separate state indicating that an item has been canceled (so it is not
2892 DONE, but also does not require action).  Your setup would then look
2893 like this:
2895 @lisp
2896 (setq org-todo-keywords
2897       '((sequence "TODO" "|" "DONE")
2898         (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
2899         (sequence "|" "CANCELED")))
2900 @end lisp
2902 The keywords should all be different, this helps Org mode to keep track
2903 of which subsequence should be used for a given entry.  In this setup,
2904 @kbd{C-c C-t} only operates within a subsequence, so it switches from
2905 @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
2906 (nothing) to @code{REPORT}.  Therefore you need a mechanism to initially
2907 select the correct sequence.  Besides the obvious ways like typing a
2908 keyword or using completion, you may also apply the following commands:
2910 @table @kbd
2911 @kindex C-S-@key{right}
2912 @kindex C-S-@key{left}
2913 @item C-S-@key{right}
2914 @itemx C-S-@key{left}
2915 These keys jump from one TODO subset to the next.  In the above example,
2916 @kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
2917 @code{REPORT}, and any of the words in the second row to @code{CANCELED}.
2918 @kindex S-@key{right}
2919 @kindex S-@key{left}
2920 @item S-@key{right}
2921 @itemx S-@key{left}
2922 @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
2923 @emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
2924 would switch from @code{DONE} to @code{REPORT} in the example above.
2925 @end table
2927 @node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
2928 @subsection Fast access to TODO states
2930 If you would like to quickly change an entry to an arbitrary TODO state
2931 instead of cycling through the states, you can set up keys for
2932 single-letter access to the states.  This is done by adding the section
2933 key after each keyword, in parenthesis.  For example:
2935 @lisp
2936 (setq org-todo-keywords
2937       '((sequence "TODO(t)" "|" "DONE(d)")
2938         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
2939         (sequence "|" "CANCELED(c)")))
2940 @end lisp
2942 If you then press @code{C-u C-c C-t} followed by the selection key, the
2943 entry will be switched to this state.  @key{SPC} can be used to remove
2944 any TODO keyword from an entry.  Should you like this way of selecting
2945 TODO states a lot, you might want to set the variable
2946 @code{org-use-fast-todo-selection} to @code{t} and make this behavior
2947 the default.  Check also the variable
2948 @code{org-fast-tag-selection-include-todo}, it allows to change the TODO
2949 state through the tags interface (@pxref{Setting tags}), in case you
2950 like to mingle the two concepts.
2952 @node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
2953 @subsection Setting up keywords for individual files
2954 @cindex keyword options
2955 @cindex per-file keywords
2957 It can be very useful to use different aspects of the TODO mechanism in
2958 different files.  For file-local settings, you need to add special lines
2959 to the file which set the keywords and interpretation for that file
2960 only.  For example, to set one of the two examples discussed above, you
2961 need one of the following lines, starting in column zero anywhere in the
2962 file:
2964 @example
2965 #+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
2966 @end example
2968 @example
2969 #+TYP_TODO: Fred Sara Lucy Mike | DONE
2970 @end example
2972 A setup for using several sets in parallel would be:
2974 @example
2975 #+SEQ_TODO: TODO | DONE
2976 #+SEQ_TODO: REPORT BUG KNOWNCAUSE | FIXED
2977 #+SEQ_TODO: | CANCELED
2978 @end example
2980 @cindex completion, of option keywords
2981 @kindex M-@key{TAB}
2982 @noindent To make sure you are using the correct keyword, type
2983 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
2985 @cindex DONE, final TODO keyword
2986 Remember that the keywords after the vertical bar (or the last keyword
2987 if no bar is there) must always mean that the item is DONE (although you
2988 may use a different word).  After changing one of these lines, use
2989 @kbd{C-c C-c} with the cursor still in the line to make the changes
2990 known to Org mode@footnote{Org mode parses these lines only when
2991 Org mode is activated after visiting a file.  @kbd{C-c C-c} with the
2992 cursor in a line starting with @samp{#+} is simply restarting Org mode
2993 for the current buffer.}.
2995 @node Faces for TODO keywords,  , Per-file keywords, TODO extensions
2996 @subsection Faces for TODO keywords
2997 @cindex faces, for TODO keywords
2999 Org mode highlights TODO keywords with special faces: @code{org-todo}
3000 for keywords indicating that an item still has to be acted upon, and
3001 @code{org-done} for keywords indicating that an item is finished.  If
3002 you are using more than 2 different states, you might want to use
3003 special faces for some of them.  This can be done using the variable
3004 @code{org-todo-keyword-faces}.  For example:
3006 @lisp
3007 (setq org-todo-keyword-faces
3008       '(("TODO"      . org-warning)
3009         ("DEFERRED"  . shadow)
3010         ("CANCELED"  . (:foreground "blue" :weight bold))))
3011 @end lisp
3013 While using a list with face properties as shown for CANCELED
3014 @emph{should} work, this does not aways seem to be the case.  If
3015 necessary, define a special face and use that.
3017 @page
3018 @node Progress logging, Priorities, TODO extensions, TODO Items
3019 @section Progress logging
3020 @cindex progress logging
3021 @cindex logging, of progress
3023 Org mode can automatically record a time stamp and possibly a note when
3024 you mark a TODO item as DONE, or even each time you change the state of
3025 a TODO item.  This system is highly configurable, settings can be on a
3026 per-keyword basis and can be localized to a file or even a subtree.  For
3027 information on how to clock working time for a task, see @ref{Clocking
3028 work time}.
3030 @menu
3031 * Closing items::               When was this entry marked DONE?
3032 * Tracking TODO state changes::  When did the status change?
3033 @end menu
3035 @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
3036 @subsection Closing items
3038 The most basic logging is to keep track of @emph{when} a certain TODO
3039 item was finished.  This is achieved with@footnote{The corresponding
3040 in-buffer setting is: @code{#+STARTUP: logdone}}.
3042 @lisp
3043 (setq org-log-done 'time)
3044 @end lisp
3046 @noindent
3047 Then each time you turn an entry from a TODO (not-done) state into any
3048 of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
3049 just after the headline.  If you turn the entry back into a TODO item
3050 through further state cycling, that line will be removed again.  If you
3051 want to record a note along with the timestamp, use@footnote{The
3052 corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
3054 @lisp
3055 (setq org-log-done 'note)
3056 @end lisp
3058 @noindent
3059 You will then be prompted for a note, and that note will be stored below
3060 the entry with a @samp{Closing Note} heading.
3062 In the timeline (@pxref{Timeline}) and in the agenda
3063 (@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
3064 display the TODO items with a @samp{CLOSED} timestamp on each day,
3065 giving you an overview of what has been done.
3067 @node Tracking TODO state changes,  , Closing items, Progress logging
3068 @subsection Tracking TODO state changes
3070 When TODO keywords are used as workflow states (@pxref{Workflow
3071 states}), you might want to keep track of when a state change occurred
3072 and maybe take a note about this change.  Since it is normally too much
3073 to record a note for every state, Org mode expects configuration on a
3074 per-keyword basis for this.  This is achieved by adding special markers
3075 @samp{!} (for a time stamp) and @samp{@@} (for a note) in parenthesis
3076 after each keyword.  For example, with the setting
3078 @lisp
3079 (setq org-todo-keywords
3080   '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
3081 @end lisp
3083 @noindent
3084 you not only define global TODO keywords and fast access keys, but also
3085 request that a time is recorded when the entry is turned into
3086 DONE@footnote{It is possible that Org mode will record two time stamps
3087 when you are using both @code{org-log-done} and state change logging.
3088 However, it will never prompt for two notes - if you have configured
3089 both, the state change recording note will take precedence and cancel
3090 the @samp{Closing Note}.}, and that a note is recorded when switching to
3091 WAIT or CANCELED.  The setting for WAIT is even more special: The
3092 @samp{!} after the slash means that in addition to the note taken when
3093 entering the state, a time stamp should be recorded when @i{leaving} the
3094 WAIT state, if and only if the @i{target} state does not configure
3095 logging for entering it.  So it has no effect when switching from WAIT
3096 to DONE, because DONE is configured to record a timestamp only.  But
3097 when switching from WAIT back to TODO, the @samp{/!} in the WAIT
3098 setting now triggers a timestamp even though TODO has no logging
3099 configured.
3101 You can use the exact same syntax for setting logging preferences local
3102 to a buffer:
3103 @example
3104 #+SEQ_TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
3105 @end example
3107 In order to define logging settings that are local to a subtree or a
3108 single item, define a LOGGING property in this entry.  Any non-empty
3109 LOGGING property resets all logging settings to nil.  You may then turn
3110 on logging for this specific tree using STARTUP keywords like
3111 @code{lognotedone} or @code{logrepeat}, as well as adding state specific
3112 settings like @code{TODO(!)}.  For example
3114 @example
3115 * TODO Log each state with only a time
3116   :PROPERTIES:
3117   :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
3118   :END:
3119 * TODO Only log when switching to WAIT, and when repeating
3120   :PROPERTIES:
3121   :LOGGING: WAIT(@@) logrepeat
3122   :END:
3123 * TODO No logging at all
3124   :PROPERTIES:
3125   :LOGGING: nil
3126   :END:
3127 @end example
3130 @node Priorities, Breaking down tasks, Progress logging, TODO Items
3131 @section Priorities
3132 @cindex priorities
3134 If you use Org mode extensively, you may end up enough TODO items that
3135 it starts to make sense to prioritize them.  Prioritizing can be done by
3136 placing a @emph{priority cookie} into the headline of a TODO item, like
3137 this
3139 @example
3140 *** TODO [#A] Write letter to Sam Fortune
3141 @end example
3143 @noindent
3144 By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
3145 @samp{C}.  @samp{A} is the highest priority.  An entry without a cookie
3146 is treated as priority @samp{B}.  Priorities make a difference only in
3147 the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
3148 no inherent meaning to Org mode.
3150 Priorities can be attached to any outline tree entries; they do not need
3151 to be TODO items.
3153 @table @kbd
3154 @kindex @kbd{C-c ,}
3155 @item @kbd{C-c ,}
3156 Set the priority of the current headline.  The command prompts for a
3157 priority character @samp{A}, @samp{B} or @samp{C}.  When you press
3158 @key{SPC} instead, the priority cookie is removed from the headline.
3159 The priorities can also be changed ``remotely'' from the timeline and
3160 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
3162 @kindex S-@key{up}
3163 @kindex S-@key{down}
3164 @item S-@key{up}
3165 @itemx S-@key{down}
3166 Increase/decrease priority of current headline@footnote{See also the
3167 option @code{org-priority-start-cycle-with-default'}.}.  Note that these
3168 keys are also used to modify time stamps (@pxref{Creating timestamps}).
3169 Furthermore, these keys are also used by CUA mode (@pxref{Conflicts}).
3170 @end table
3172 You can change the range of allowed priorities by setting the variables
3173 @code{org-highest-priority}, @code{org-lowest-priority}, and
3174 @code{org-default-priority}.  For an individual buffer, you may set
3175 these values (highest, lowest, default) like this (please make sure that
3176 the highest priority is earlier in the alphabet than the lowest
3177 priority):
3179 @example
3180 #+PRIORITIES: A C B
3181 @end example
3183 @node Breaking down tasks, Checkboxes, Priorities, TODO Items
3184 @section Breaking tasks down into subtasks
3185 @cindex tasks, breaking down
3187 It is often advisable to break down large tasks into smaller, manageable
3188 subtasks.  You can do this by creating an outline tree below a TODO item,
3189 with detailed subtasks on the tree@footnote{To keep subtasks out of the
3190 global TODO list, see the @code{org-agenda-todo-list-sublevels}.}.  To keep
3191 the overview over the fraction of subtasks that are already completed, insert
3192 either @samp{[/]} or @samp{[%]} anywhere in the headline.  These cookies will
3193 be updates each time the todo status of a child changes.  For example:
3195 @example
3196 * Organize Party [33%]
3197 ** TODO Call people [1/2]
3198 *** TODO Peter
3199 *** DONE Sarah
3200 ** TODO Buy food
3201 ** DONE Talk to neighbor
3202 @end example
3204 If you would like a TODO entry to automatically change to DONE when all
3205 chilrden are done, you can use the following setup:
3207 @example
3208 (defun org-summary-todo (n-done n-not-done)
3209   "Switch entry to DONE when all subentries are done, to TODO otherwise."
3210   (let (org-log-done org-log-states)   ; turn off logging
3211     (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
3213 (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
3214 @end example
3217 Another possibility is the use of checkboxes to identify (a hierarchy of) a
3218 large number of subtasks (@pxref{Checkboxes}).
3221 @node Checkboxes,  , Breaking down tasks, TODO Items
3222 @section Checkboxes
3223 @cindex checkboxes
3225 Every item in a plain list (@pxref{Plain lists}) can be made into a
3226 checkbox by starting it with the string @samp{[ ]}.  This feature is
3227 similar to TODO items (@pxref{TODO Items}), but is more lightweight.
3228 Checkboxes are not included into the global TODO list, so they are often
3229 great to split a task into a number of simple steps.  Or you can use
3230 them in a shopping list.  To toggle a checkbox, use @kbd{C-c C-c}, or
3231 use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
3233 Here is an example of a checkbox list.
3235 @example
3236 * TODO Organize party [2/4]
3237   - [-] call people [1/3]
3238     - [ ] Peter
3239     - [X] Sarah
3240     - [ ] Sam
3241   - [X] order food
3242   - [ ] think about what music to play
3243   - [X] talk to the neighbors
3244 @end example
3246 Checkboxes work hierarchically, so if a checkbox item has children that
3247 are checkboxes, toggling one of the children checkboxes will make the
3248 parent checkbox reflect if none, some, or all of the children are
3249 checked.
3251 @cindex statistics, for checkboxes
3252 @cindex checkbox statistics
3253 The @samp{[2/4]} and @samp{[1/3]} in the first and second line are
3254 cookies indicating how many checkboxes present in this entry have been
3255 checked off, and the total number of checkboxes are present.  This can
3256 give you an idea on how many checkboxes remain, even without opening a
3257 folded entry.  The cookies can be placed into a headline or into (the
3258 first line of) a plain list item. Each cookie covers all checkboxes
3259 structurally below the headline/item on which the cookie appear.  You
3260 have to insert the cookie yourself by typing either @samp{[/]} or
3261 @samp{[%]}.  With @samp{[/]} you get an @samp{n out of m} result, as in
3262 the examples above.  With @samp{[%]} you get information about the
3263 percentage of checkboxes checked (in the above example, this would be
3264 @samp{[50%]} and @samp{[33%]}, respectively).
3266 @noindent The following commands work with checkboxes:
3268 @table @kbd
3269 @kindex C-c C-c
3270 @item C-c C-c
3271 Toggle checkbox at point.  With a prefix argument, set it to @samp{[-]},
3272 which is considered to be an intermediate state.
3273 @kindex C-c C-x C-b
3274 @item C-c C-x C-b
3275 Toggle checkbox at point.
3276 @itemize @minus
3277 @item
3278 If there is an active region, toggle the first checkbox in the region
3279 and set all remaining boxes to the same status as the first.  If you
3280 want to toggle all boxes in the region independently, use a prefix
3281 argument.
3282 @item
3283 If the cursor is in a headline, toggle checkboxes in the region between
3284 this headline and the next (so @emph{not} the entire subtree).
3285 @item
3286 If there is no active region, just toggle the checkbox at point.
3287 @end itemize
3288 @kindex M-S-@key{RET}
3289 @item M-S-@key{RET}
3290 Insert a new item with a checkbox.
3291 This works only if the cursor is already in a plain list item
3292 (@pxref{Plain lists}).
3293 @kindex C-c #
3294 @item C-c #
3295 Update the checkbox statistics in the current outline entry.  When
3296 called with a @kbd{C-u} prefix, update the entire file.  Checkbox
3297 statistic cookies are updated automatically if you toggle checkboxes
3298 with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}.  If you
3299 delete boxes or add/change them by hand, use this command to get things
3300 back into synch.  Or simply toggle any checkbox twice with @kbd{C-c C-c}.
3301 @end table
3303 @node Tags, Properties and Columns, TODO Items, Top
3304 @chapter Tags
3305 @cindex tags
3306 @cindex headline tagging
3307 @cindex matching, tags
3308 @cindex sparse tree, tag based
3310 An excellent way to implement labels and contexts for cross-correlating
3311 information is to assign @i{tags} to headlines.  Org mode has extensive
3312 support for tags.
3314 Every headline can contain a list of tags; they occur at the end of the
3315 headline.  Tags are normal words containing letters, numbers, @samp{_},
3316 and @samp{@@}.  Tags must be preceded and followed by a single colon,
3317 e.g., @samp{:WORK:}.  Several tags can be specified, as in
3318 @samp{:work:URGENT:}.
3320 @menu
3321 * Tag inheritance::             Tags use the tree structure of the outline
3322 * Setting tags::                How to assign tags to a headline
3323 * Tag searches::                Searching for combinations of tags
3324 @end menu
3326 @node Tag inheritance, Setting tags, Tags, Tags
3327 @section Tag inheritance
3328 @cindex tag inheritance
3329 @cindex inheritance, of tags
3330 @cindex sublevels, inclusion into tags match
3332 @i{Tags} make use of the hierarchical structure of outline trees.  If a
3333 heading has a certain tag, all subheadings will inherit the tag as
3334 well.  For example, in the list
3336 @example
3337 * Meeting with the French group      :work:
3338 ** Summary by Frank                  :boss:notes:
3339 *** TODO Prepare slides for him      :action:
3340 @end example
3342 @noindent
3343 the final heading will have the tags @samp{:work:}, @samp{:boss:},
3344 @samp{:notes:}, and @samp{:action:} even though the final heading is not
3345 explicitly marked with those tags.  You can also set tags that all entries in
3346 a file should inherit as if these tags would be defined in a hypothetical
3347 level zero that surounds the entire file.
3349 @example
3350 #+FILETAGS: :Peter:Boss:Secret:
3351 @end example
3353 @noindent
3354 To limit tag inheritance to specific tags, or to turn it off entirely, use
3355 the variable @code{org-use-tag-inheritance}.
3357 When a headline matches during a tags search while tag inheritance is turned
3358 on, all the sublevels in the same tree will match as well@footnote{This is
3359 only true if the the search does not involve more complex tests including
3360 properties (@pxref{Property searches}).}.  The list of matches may then
3361 become very long.  If you only want to see the first tags match in a subtree,
3362 configure the variable @code{org-tags-match-list-sublevels}.
3364 @node Setting tags, Tag searches, Tag inheritance, Tags
3365 @section Setting tags
3366 @cindex setting tags
3367 @cindex tags, setting
3369 @kindex M-@key{TAB}
3370 Tags can simply be typed into the buffer at the end of a headline.
3371 After a colon, @kbd{M-@key{TAB}} offers completion on tags.  There is
3372 also a special command for inserting tags:
3374 @table @kbd
3375 @kindex C-c C-c
3376 @item C-c C-c
3377 @cindex completion, of tags
3378 Enter new tags for the current headline.  Org mode will either offer
3379 completion or a special single-key interface for setting tags, see
3380 below.  After pressing @key{RET}, the tags will be inserted and aligned
3381 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
3382 tags in the current buffer will be aligned to that column, just to make
3383 things look nice.  TAGS are automatically realigned after promotion,
3384 demotion, and TODO state changes (@pxref{TODO basics}).
3385 @end table
3387 Org will support tag insertion based on a @emph{list of tags}.  By
3388 default this list is constructed dynamically, containing all tags
3389 currently used in the buffer.  You may also globally specify a hard list
3390 of tags with the variable @code{org-tag-alist}.  Finally you can set
3391 the default tags for a given file with lines like
3393 @example
3394 #+TAGS: @@work @@home @@tennisclub
3395 #+TAGS: laptop car pc sailboat
3396 @end example
3398 If you have globally defined your preferred set of tags using the
3399 variable @code{org-tag-alist}, but would like to use a dynamic tag list
3400 in a specific file, add an empty TAGS option line to that file:
3402 @example
3403 #+TAGS:
3404 @end example
3406 By default Org mode uses the standard minibuffer completion facilities for
3407 entering tags.  However, it also implements another, quicker, tag selection
3408 method called @emph{fast tag selection}.  This allows you to select and
3409 deselect tags with just a single key press.  For this to work well you should
3410 assign unique letters to most of your commonly used tags.  You can do this
3411 globally by configuring the variable @code{org-tag-alist} in your
3412 @file{.emacs} file.  For example, you may find the need to tag many items in
3413 different files with @samp{:@@home:}.  In this case you can set something
3414 like:
3416 @lisp
3417 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
3418 @end lisp
3420 @noindent If the tag is only relevant to the file you are working on then you
3421 can, instead, set the TAGS option line as:
3423 @example
3424 #+TAGS: @@work(w)  @@home(h)  @@tennisclub(t)  laptop(l)  pc(p)
3425 @end example
3427 @noindent
3428 You can also group together tags that are mutually exclusive.  By using
3429 braces, as in:
3431 @example
3432 #+TAGS: @{ @@work(w)  @@home(h)  @@tennisclub(t) @}  laptop(l)  pc(p)
3433 @end example
3435 @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
3436 and @samp{@@tennisclub} should be selected.  Multiple such groups are allowed.
3438 @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
3439 these lines to activate any changes.
3441 @noindent
3442 To set these mutually exclusive groups in the variable @code{org-mode-alist}
3443 you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
3444 of the braces.  The previous example would be set globally by the following
3445 configuration:
3447 @lisp
3448 (setq org-tag-alist '((:startgroup . nil)
3449                       ("@@work" . ?w) ("@@home" . ?h)
3450                       ("@@tennisclub" . ?t)
3451                       (:endgroup . nil)
3452                       ("laptop" . ?l) ("pc" . ?p)))
3453 @end lisp
3455 If at least one tag has a selection key then pressing @kbd{C-c C-c} will
3456 automatically present you with a special interface, listing inherited tags,
3457 the tags of the current headline, and a list of all valid tags with
3458 corresponding keys@footnote{Keys will automatically be assigned to tags which
3459 have no configured keys.}.  In this interface, you can use the following
3460 keys:
3462 @table @kbd
3463 @item a-z...
3464 Pressing keys assigned to tags will add or remove them from the list of
3465 tags in the current line.  Selecting a tag in a group of mutually
3466 exclusive tags will turn off any other tags from that group.
3467 @kindex @key{TAB}
3468 @item @key{TAB}
3469 Enter a tag in the minibuffer, even if the tag is not in the predefined
3470 list.  You will be able to complete on all tags present in the buffer.
3471 @kindex @key{SPC}
3472 @item @key{SPC}
3473 Clear all tags for this line.
3474 @kindex @key{RET}
3475 @item @key{RET}
3476 Accept the modified set.
3477 @item C-g
3478 Abort without installing changes.
3479 @item q
3480 If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
3481 @item !
3482 Turn off groups of mutually exclusive tags.  Use this to (as an
3483 exception) assign several tags from such a group.
3484 @item C-c
3485 Toggle auto-exit after the next change (see below).
3486 If you are using expert mode, the first @kbd{C-c} will display the
3487 selection window.
3488 @end table
3490 @noindent
3491 This method lets you assign tags to a headline with very few keys.  With
3492 the above setup, you could clear the current tags and set @samp{@@home},
3493 @samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
3494 C-c @key{SPC} h l p @key{RET}}.  Switching from @samp{@@home} to
3495 @samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
3496 alternatively with @kbd{C-c C-c C-c w}.  Adding the non-predefined tag
3497 @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
3498 @key{RET} @key{RET}}.
3500 If you find that most of the time, you need only a single key press to
3501 modify your list of tags, set the variable
3502 @code{org-fast-tag-selection-single-key}.  Then you no longer have to
3503 press @key{RET} to exit fast tag selection - it will immediately exit
3504 after the first change.  If you then occasionally need more keys, press
3505 @kbd{C-c} to turn off auto-exit for the current tag selection process
3506 (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
3507 C-c}).  If you set the variable to the value @code{expert}, the special
3508 window is not even shown for single-key tag selection, it comes up only
3509 when you press an extra @kbd{C-c}.
3511 @node Tag searches,  , Setting tags, Tags
3512 @section Tag searches
3513 @cindex tag searches
3514 @cindex searching for tags
3516 Once a system of tags has been set up, it can be used to collect related
3517 information into special lists.
3519 @table @kbd
3520 @kindex C-c \
3521 @kindex C-c / T
3522 @item C-c \
3523 @itemx C-c / T
3524 Create a sparse tree with all headlines matching a tags search.  With a
3525 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
3526 @kindex C-c a m
3527 @item C-c a m
3528 Create a global list of tag matches from all agenda files.
3529 @xref{Matching tags and properties}.
3530 @kindex C-c a M
3531 @item C-c a M
3532 Create a global list of tag matches from all agenda files, but check
3533 only TODO items and force checking subitems (see variable
3534 @code{org-tags-match-list-sublevels}).
3535 @end table
3537 @cindex Boolean logic, for tag searches
3538 A @i{tags} search string can use Boolean operators @samp{&} for AND and
3539 @samp{|} for OR.  @samp{&} binds more strongly than @samp{|}.
3540 Parenthesis are currently not implemented.  A tag may also be preceded
3541 by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
3542 positive selection.  The AND operator @samp{&} is optional when @samp{+}
3543 or @samp{-} is present.  Examples:
3545 @table @samp
3546 @item +work-boss
3547 Select headlines tagged @samp{:work:}, but discard those also tagged
3548 @samp{:boss:}.
3549 @item work|laptop
3550 Selects lines tagged @samp{:work:} or @samp{:laptop:}.
3551 @item work|laptop&night
3552 Like before, but require the @samp{:laptop:} lines to be tagged also
3553 @samp{:night:}.
3554 @end table
3556 @cindex TODO keyword matching, with tags search
3557 If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
3558 can be useful to also match on the TODO keyword.  This can be done by
3559 adding a condition after a slash to a tags match.  The syntax is similar
3560 to the tag matches, but should be applied with consideration: For
3561 example, a positive selection on several TODO keywords can not
3562 meaningfully be combined with boolean AND.  However, @emph{negative
3563 selection} combined with AND can be meaningful.  To make sure that only
3564 lines are checked that actually have any TODO keyword, use @kbd{C-c a
3565 M}, or equivalently start the TODO part after the slash with @samp{!}.
3566 Examples:
3568 @table @samp
3569 @item work/WAITING
3570 Select @samp{:work:}-tagged TODO lines with the specific TODO
3571 keyword @samp{WAITING}.
3572 @item work/!-WAITING-NEXT
3573 Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
3574 nor @samp{NEXT}
3575 @item work/+WAITING|+NEXT
3576 Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
3577 @samp{NEXT}.
3578 @end table
3580 @cindex regular expressions, with tags search
3581 Any element of the tag/todo match can be a regular expression - in this
3582 case it must be enclosed in curly braces.  For example,
3583 @samp{work+@{^boss.*@}} matches headlines that contain the tag
3584 @samp{:work:} and any tag @i{starting} with @samp{boss}.
3586 @cindex level, require for tags/property match
3587 @cindex category, require for tags/property match
3588 You can also require a headline to be of a certain level or category, by
3589 writing instead of any TAG an expression like @samp{LEVEL=3} or
3590 @samp{CATEGORY="work"}, respectively.  For example, a search
3591 @samp{+LEVEL=3+boss/-DONE} lists all level three headlines that have the
3592 tag @samp{boss} and are @emph{not} marked with the TODO keyword DONE.
3594 @node Properties and Columns, Dates and Times, Tags, Top
3595 @chapter Properties and Columns
3596 @cindex properties
3598 Properties are a set of key-value pairs associated with an entry.  There
3599 are two main applications for properties in Org mode.  First, properties
3600 are like tags, but with a value.  Second, you can use properties to
3601 implement (very basic) database capabilities in an Org buffer.  For
3602 an example of the first application, imagine maintaining a file where
3603 you document bugs and plan releases of a piece of software.  Instead of
3604 using tags like @code{:release_1:}, @code{:release_2:}, one can use a
3605 property, say @code{:Release:}, that in different subtrees has different
3606 values, such as @code{1.0} or @code{2.0}.  For an example of the second
3607 application of properties, imagine keeping track of your music CD's,
3608 where properties could be things such as the album artist, date of
3609 release, number of tracks, and so on.
3611 Properties can be conveniently edited and viewed in column view
3612 (@pxref{Column view}).
3614 Properties are like tags, but with a value.  For example, in a file
3615 where you document bugs and plan releases of a piece of software,
3616 instead of using tags like @code{:release_1:}, @code{:release_2:}, it
3617 can be more efficient to use a property @code{:Release:} with a value
3618 @code{1.0} or @code{2.0}.  Second, you can use properties to implement
3619 (very basic) database capabilities in an Org buffer, for example to
3620 create a list of Music CD's you own.  You can edit and view properties
3621 conveniently in column view (@pxref{Column view}).
3623 @menu
3624 * Property syntax::             How properties are spelled out
3625 * Special properties::          Access to other Org mode features
3626 * Property searches::           Matching property values
3627 * Property inheritance::        Passing values down the tree
3628 * Column view::                 Tabular viewing and editing
3629 * Property API::                Properties for Lisp programmers
3630 @end menu
3632 @node Property syntax, Special properties, Properties and Columns, Properties and Columns
3633 @section Property syntax
3634 @cindex property syntax
3635 @cindex drawer, for properties
3637 Properties are key-value pairs.  They need to be inserted into a special
3638 drawer (@pxref{Drawers}) with the name @code{PROPERTIES}.  Each property
3639 is specified on a single line, with the key (surrounded by colons)
3640 first, and the value after it.  Here is an example:
3642 @example
3643 * CD collection
3644 ** Classic
3645 *** Goldberg Variations
3646     :PROPERTIES:
3647     :Title:     Goldberg Variations
3648     :Composer:  J.S. Bach
3649     :Artist:    Glen Gould
3650     :Publisher: Deutsche Grammphon
3651     :NDisks:    1
3652     :END:
3653 @end example
3655 You may define the allowed values for a particular property @samp{:Xyz:}
3656 by setting a property @samp{:Xyz_ALL:}.  This special property is
3657 @emph{inherited}, so if you set it in a level 1 entry, it will apply to
3658 the entire tree.  When allowed values are defined, setting the
3659 corresponding property becomes easier and is less prone to typing
3660 errors.  For the example with the CD collection, we can predefine
3661 publishers and the number of disks in a box like this:
3663 @example
3664 * CD collection
3665   :PROPERTIES:
3666   :NDisks_ALL:  1 2 3 4
3667   :Publisher_ALL: "Deutsche Grammophon" Phillips EMI
3668   :END:
3669 @end example
3671 If you want to set properties that can be inherited by any entry in a
3672 file, use a line like
3674 @example
3675 #+PROPERTY: NDisks_ALL 1 2 3 4
3676 @end example
3678 Property values set with the global variable
3679 @code{org-global-properties} can be inherited by all entries in all
3680 Org files.
3682 @noindent
3683 The following commands help to work with properties:
3685 @table @kbd
3686 @kindex M-@key{TAB}
3687 @item M-@key{TAB}
3688 After an initial colon in a line, complete property keys.  All keys used
3689 in the current file will be offered as possible completions.
3690 @kindex C-c C-x p
3691 @item C-c C-x p
3692 Set a property.  This prompts for a property name and a value.  If
3693 necessary, the property drawer is created as well.
3694 @item M-x org-insert-property-drawer
3695 Insert a property drawer into the current entry.  The drawer will be
3696 inserted early in the entry, but after the lines with planning
3697 information like deadlines.
3698 @kindex C-c C-c
3699 @item C-c C-c
3700 With the cursor in a property drawer, this executes property commands.
3701 @item C-c C-c s
3702 Set a property in the current entry.  Both the property and the value
3703 can be inserted using completion.
3704 @kindex S-@key{right}
3705 @kindex S-@key{left}
3706 @item S-@key{left}/@key{right}
3707 Switch property at point to the next/previous allowed value.
3708 @item C-c C-c d
3709 Remove a property from the current entry.
3710 @item C-c C-c D
3711 Globally remove a property, from all entries in the current file.
3712 @item C-c C-c c
3713 Compute the property at point, using the operator and scope from the
3714 nearest column format definition.
3715 @end table
3717 @node Special properties, Property searches, Property syntax, Properties and Columns
3718 @section Special properties
3719 @cindex properties, special
3721 Special properties provide alternative access method to Org mode
3722 features discussed in the previous chapters, like the TODO state or the
3723 priority of an entry.  This interface exists so that you can include
3724 these states into columns view (@pxref{Column view}), or to use them in
3725 queries.  The following property names are special and should not be
3726 used as keys in the properties drawer:
3728 @example
3729 TODO         @r{The TODO keyword of the entry.}
3730 TAGS         @r{The tags defined directly in the headline.}
3731 ALLTAGS      @r{All tags, including inherited ones.}
3732 PRIORITY     @r{The priority of the entry, a string with a single letter.}
3733 DEADLINE     @r{The deadline time string, without the angular brackets.}
3734 SCHEDULED    @r{The scheduling time stamp, without the angular brackets.}
3735 TIMESTAMP    @r{The first keyword-less time stamp in the entry.}
3736 TIMESTAMP_IA @r{The first inactive time stamp in the entry.}
3737 CLOCKSUM     @r{The sum of CLOCK intervals in the subtree.  @code{org-clock-sum}}
3738              @r{must be run first to compute the values.}
3739 @end example
3741 @node Property searches, Property inheritance, Special properties, Properties and Columns
3742 @section Property searches
3743 @cindex properties, searching
3744 @cindex searching, of properties
3746 To create sparse trees and special lists with selection based on properties,
3747 the same commands are used as for tag searches (@pxref{Tag searches}), and
3748 the same logic applies.  For example, here is a search string:
3750 @example
3751 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2+With=@{Sarah\|Denny@}
3752 @end example
3754 @noindent
3755 If the comparison value is a plain number, a numerical comparison is done,
3756 and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=},
3757 @samp{>=}, and @samp{<>}.  If the comparison value is enclosed in double
3758 quotes, a string comparison is done, and the same operators are allowed.  If
3759 the comparison value is enclosed in curly braces, a regexp match is
3760 performed, with @samp{=} meaning that the regexp matches the property value,
3761 and @samp{<>} meaning that it does not match.  So the search string in the
3762 example finds entries tagged @samp{:work:} but not @samp{:boss:}, which also
3763 have a priority value @samp{A}, a @samp{:Coffee:} property with the value
3764 @samp{unlimited}, an @samp{Effort} property that is numerically smaller than
3765 2, and a @samp{:With:} property that is matched by the regular expression
3766 @samp{Sarah\|Denny}.
3768 You can configure Org mode to use property inheritance during a search, but
3769 beware that this can slow down searches considerably.  See @ref{Property
3770 inheritance} for details.
3772 There is also a special command for creating sparse trees based on a
3773 single property:
3775 @table @kbd
3776 @kindex C-c / p
3777 @item C-c / p
3778 Create a sparse tree based on the value of a property.  This first
3779 prompts for the name of a property, and then for a value.  A sparse tree
3780 is created with all entries that define this property with the given
3781 value.  If you enclose the value into curly braces, it is interpreted as
3782 a regular expression and matched against the property values.
3783 @end table
3785 @node Property inheritance, Column view, Property searches, Properties and Columns
3786 @section Property Inheritance
3787 @cindex properties, inheritance
3788 @cindex inheritance, of properties
3790 The outline structure of Org mode documents lends itself for an
3791 inheritance model of properties: If the parent in a tree has a certain
3792 property, the children can inherit this property.  Org mode does not
3793 turn this on by default, because it can slow down property searches
3794 significantly and is often not needed.  However, if you find inheritance
3795 useful, you can turn it on by setting the variable
3796 @code{org-use-property-inheritance}.  It may be set to @code{t}, to make
3797 all properties inherited from the parent, to a list of properties
3798 that should be inherited, or to a regular expression that matches
3799 inherited properties.
3801 Org mode has a few properties for which inheritance is hard-coded, at
3802 least for the special applications for which they are used:
3804 @table @code
3805 @item COLUMNS
3806 The @code{:COLUMNS:} property defines the format of column view
3807 (@pxref{Column view}).  It is inherited in the sense that the level
3808 where a @code{:COLUMNS:} property is defined is used as the starting
3809 point for a column view table, independently of the location in the
3810 subtree from where columns view is turned on.
3811 @item CATEGORY
3812 For agenda view, a category set through a @code{:CATEGORY:} property
3813 applies to the entire subtree.
3814 @item ARCHIVE
3815 For archiving, the @code{:ARCHIVE:} property may define the archive
3816 location for the entire subtree (@pxref{Moving subtrees}).
3817 @item LOGGING
3818 The LOGGING property may define logging settings for an entry or a
3819 subtree (@pxref{Tracking TODO state changes}).
3820 @end table
3822 @node Column view, Property API, Property inheritance, Properties and Columns
3823 @section Column view
3825 A great way to view and edit properties in an outline tree is
3826 @emph{column view}.  In column view, each outline item is turned into a
3827 table row.  Columns in this table provide access to properties of the
3828 entries.  Org mode implements columns by overlaying a tabular structure
3829 over the headline of each item.  While the headlines have been turned
3830 into a table row, you can still change the visibility of the outline
3831 tree.  For example, you get a compact table by switching to CONTENTS
3832 view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
3833 is active), but you can still open, read, and edit the entry below each
3834 headline.  Or, you can switch to column view after executing a sparse
3835 tree command and in this way get a table only for the selected items.
3836 Column view also works in agenda buffers (@pxref{Agenda Views}) where
3837 queries have collected selected items, possibly from a number of files.
3839 @menu
3840 * Defining columns::            The COLUMNS format property
3841 * Using column view::           How to create and use column view
3842 * Capturing column view::       A dynamic block for column view
3843 @end menu
3845 @node Defining columns, Using column view, Column view, Column view
3846 @subsection Defining columns
3847 @cindex column view, for properties
3848 @cindex properties, column view
3850 Setting up a column view first requires defining the columns.  This is
3851 done by defining a column format line.
3853 @menu
3854 * Scope of column definitions::  Where defined, where valid?
3855 * Column attributes::           Appearance and content of a column
3856 @end menu
3858 @node Scope of column definitions, Column attributes, Defining columns, Defining columns
3859 @subsubsection Scope of column definitions
3861 To define a column format for an entire file, use a line like
3863 @example
3864 #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3865 @end example
3867 To specify a format that only applies to a specific tree, add a
3868 @code{:COLUMNS:} property to the top node of that tree, for example:
3870 @example
3871 ** Top node for columns view
3872    :PROPERTIES:
3873    :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3874    :END:
3875 @end example
3877 If a @code{:COLUMNS:} property is present in an entry, it defines columns
3878 for the entry itself, and for the entire subtree below it.  Since the
3879 column definition is part of the hierarchical structure of the document,
3880 you can define columns on level 1 that are general enough for all
3881 sublevels, and more specific columns further down, when you edit a
3882 deeper part of the tree.
3884 @node Column attributes,  , Scope of column definitions, Defining columns
3885 @subsubsection Column attributes
3886 A column definition sets the attributes of a column.  The general
3887 definition looks like this:
3889 @example
3890  %[width]property[(title)][@{summary-type@}]
3891 @end example
3893 @noindent
3894 Except for the percent sign and the property name, all items are
3895 optional.  The individual parts have the following meaning:
3897 @example
3898 width           @r{An integer specifying the width of the column in characters.}
3899                 @r{If omitted, the width will be determined automatically.}
3900 property        @r{The property that should be edited in this column.}
3901 (title)         @r{The header text for the column. If omitted, the}
3902                 @r{property name is used.}
3903 @{summary-type@}  @r{The summary type.  If specified, the column values for}
3904                 @r{parent nodes are computed from the children.}
3905                 @r{Supported summary types are:}
3906                 @{+@}       @r{Sum numbers in this column.}
3907                 @{+;%.1f@}  @r{Like @samp{+}, but format result with @samp{%.1f}.}
3908                 @{$@}       @r{Currency, short for @samp{+;%.2f}.}
3909                 @{:@}       @r{Sum times, HH:MM:SS, plain numbers are hours.}
3910                 @{X@}       @r{Checkbox status, [X] if all children are [X].}
3911                 @{X/@}      @r{Checkbox status, [n/m].}
3912                 @{X%@}      @r{Checkbox status, [n%].}
3913 @end example
3915 @noindent
3916 Here is an example for a complete columns definition, along with allowed
3917 values.
3919 @example
3920 :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.}
3921                    %10Time_Estimate@{:@} %CLOCKSUM
3922 :Owner_ALL:    Tammy Mark Karl Lisa Don
3923 :Status_ALL:   "In progress" "Not started yet" "Finished" ""
3924 :Approved_ALL: "[ ]" "[X]"
3925 @end example
3927 The first column, @samp{%25ITEM}, means the first 25 characters of the
3928 item itself, i.e. of the headline.  You probably always should start the
3929 column definition with the @samp{ITEM} specifier.  The other specifiers
3930 create columns @samp{Owner} with a list of names as allowed values, for
3931 @samp{Status} with four different possible values, and for a checkbox
3932 field @samp{Approved}.  When no width is given after the @samp{%}
3933 character, the column will be exactly as wide as it needs to be in order
3934 to fully display all values.  The @samp{Approved} column does have a
3935 modified title (@samp{Approved?}, with a question mark).  Summaries will
3936 be created for the @samp{Time_Estimate} column by adding time duration
3937 expressions like HH:MM, and for the @samp{Approved} column, by providing
3938 an @samp{[X]} status if all children have been checked.  The
3939 @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
3940 in the subtree.
3942 @node Using column view, Capturing column view, Defining columns, Column view
3943 @subsection Using column view
3945 @table @kbd
3946 @tsubheading{Turning column view on and off}
3947 @kindex C-c C-x C-c
3948 @item C-c C-x C-c
3949 Create the column view for the local environment.  This command searches
3950 the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
3951 a format.  When one is found, the column view table is established for
3952 the entire tree, starting from the entry that contains the @code{:COLUMNS:}
3953 property.  If none is found, the format is taken from the @code{#+COLUMNS}
3954 line or from the variable @code{org-columns-default-format}, and column
3955 view is established for the current entry and its subtree.
3956 @kindex r
3957 @item r
3958 Recreate the column view, to include recent changes made in the buffer.
3959 @kindex g
3960 @item g
3961 Same as @kbd{r}.
3962 @kindex q
3963 @item q
3964 Exit column view.
3965 @tsubheading{Editing values}
3966 @item @key{left} @key{right} @key{up} @key{down}
3967 Move through the column view from field to field.
3968 @kindex S-@key{left}
3969 @kindex S-@key{right}
3970 @item  S-@key{left}/@key{right}
3971 Switch to the next/previous allowed value of the field.  For this, you
3972 have to have specified allowed values for a property.
3973 @item 1..9,0
3974 Directly select the nth allowed value, @kbd{0} selects the 10th value.
3975 @kindex n
3976 @kindex p
3977 @itemx  n / p
3978 Same as @kbd{S-@key{left}/@key{right}}
3979 @kindex e
3980 @item e
3981 Edit the property at point.  For the special properties, this will
3982 invoke the same interface that you normally use to change that
3983 property.  For example, when editing a TAGS property, the tag completion
3984 or fast selection interface will pop up.
3985 @kindex C-c C-c
3986 @item C-c C-c
3987 When there is a checkbox at point, toggle it.
3988 @kindex v
3989 @item v
3990 View the full value of this property.  This is useful if the width of
3991 the column is smaller than that of the value.
3992 @kindex a
3993 @item a
3994 Edit the list of allowed values for this property.  If the list is found
3995 in the hierarchy, the modified values is stored there.  If no list is
3996 found, the new value is stored in the first entry that is part of the
3997 current column view.
3998 @tsubheading{Modifying the table structure}
3999 @kindex <
4000 @kindex >
4001 @item < / >
4002 Make the column narrower/wider by one character.
4003 @kindex S-M-@key{right}
4004 @item S-M-@key{right}
4005 Insert a new column, to the right of the current column.
4006 @kindex S-M-@key{left}
4007 @item S-M-@key{left}
4008 Delete the current column.
4009 @end table
4011 @node Capturing column view,  , Using column view, Column view
4012 @subsection Capturing column view
4014 Since column view is just an overlay over a buffer, it cannot be
4015 exported or printed directly.  If you want to capture a column view, use
4016 this @code{columnview} dynamic block (@pxref{Dynamic blocks}).  The frame
4017 of this block looks like this:
4019 @cindex #+BEGIN: columnview
4020 @example
4021 * The column view
4022 #+BEGIN: columnview :hlines 1 :id "label"
4024 #+END:
4025 @end example
4027 @noindent This dynamic block has the following parameters:
4029 @table @code
4030 @item :id
4031 This is most important parameter.  Column view is a feature that is
4032 often localized to a certain (sub)tree, and the capture block might be
4033 in a different location in the file.  To identify the tree whose view to
4034 capture, you can use 3 values:
4035 @example
4036 local     @r{use the tree in which the capture block is located}
4037 global    @r{make a global view, including all headings in the file}
4038 "label"   @r{call column view in the tree that has an @code{:ID:}}
4039           @r{property with the value @i{label}.  You can use}
4040           @r{@kbd{M-x org-id-copy} to create a globally unique ID for}
4041           @r{the current entry and copy it to the kill-ring.}
4042 @end example
4043 @item :hlines
4044 When @code{t}, insert a hline after every line.  When a number N, insert
4045 a hline before each headline with level @code{<= N}.
4046 @item :vlines
4047 When set to @code{t}, enforce column groups to get vertical lines.
4048 @item :maxlevel
4049 When set to a number, don't capture entries below this level.
4050 @item :skip-empty-rows
4051 When set to @code{t}, skip row where the only non-empty specifier of the
4052 column view is @code{ITEM}.
4054 @end table
4056 @noindent
4057 The following commands insert or update the dynamic block:
4059 @table @kbd
4060 @kindex C-c C-x r
4061 @item C-c C-x r
4062 Insert a dynamic block capturing a column view.  You will be prompted
4063 for the scope or id of the view.
4064 @kindex C-c C-c
4065 @item C-c C-c
4066 @kindex C-c C-x C-u
4067 @itemx C-c C-x C-u
4068 Update dynamical block at point.  The cursor needs to be in the
4069 @code{#+BEGIN} line of the dynamic block.
4070 @kindex C-u C-c C-x C-u
4071 @item C-u C-c C-x C-u
4072 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
4073 you have several clock table blocks in a buffer.
4074 @end table
4076 @node Property API,  , Column view, Properties and Columns
4077 @section The Property API
4078 @cindex properties, API
4079 @cindex API, for properties
4081 There is a full API for accessing and changing properties.  This API can
4082 be used by Emacs Lisp programs to work with properties and to implement
4083 features based on them.  For more information see @ref{Using the
4084 property API}.
4086 @node Dates and Times, Remember, Properties and Columns, Top
4087 @chapter Dates and Times
4088 @cindex dates
4089 @cindex times
4090 @cindex time stamps
4091 @cindex date stamps
4093 To assist project planning, TODO items can be labeled with a date and/or
4094 a time.  The specially formatted string carrying the date and time
4095 information is called a @emph{timestamp} in Org mode.  This may be a
4096 little confusing because timestamp is often used as indicating when
4097 something was created or last changed.  However, in Org mode this term
4098 is used in a much wider sense.
4100 @menu
4101 * Timestamps::                  Assigning a time to a tree entry
4102 * Creating timestamps::         Commands which insert timestamps
4103 * Deadlines and scheduling::    Planning your work
4104 * Clocking work time::          Tracking how long you spend on a task
4105 * Effort estimates::            Planning work effort in advance
4106 @end menu
4109 @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
4110 @section Timestamps, deadlines and scheduling
4111 @cindex time stamps
4112 @cindex ranges, time
4113 @cindex date stamps
4114 @cindex deadlines
4115 @cindex scheduling
4117 A time stamp is a specification of a date (possibly with time or a range
4118 of times) in a special format, either @samp{<2003-09-16 Tue>} or
4119 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
4120 12:00-12:30>}@footnote{This is the standard ISO date/time format.  To
4121 use an alternative format, see @ref{Custom time format}.}.  A time stamp
4122 can appear anywhere in the headline or body of an Org tree entry.  Its
4123 presence causes entries to be shown on specific dates in the agenda
4124 (@pxref{Weekly/daily agenda}).  We distinguish:
4126 @table @var
4127 @item Plain time stamp; Event; Appointment
4128 @cindex timestamp
4129 A simple time stamp just assigns a date/time to an item.  This is just
4130 like writing down an appointment or event in a paper agenda.  In the
4131 timeline and agenda displays, the headline of an entry associated with a
4132 plain time stamp will be shown exactly on that date.
4134 @example
4135 * Meet Peter at the movies <2006-11-01 Wed 19:15>
4136 * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
4137 @end example
4139 @item Time stamp with repeater interval
4140 @cindex timestamp, with repeater interval
4141 A time stamp may contain a @emph{repeater interval}, indicating that it
4142 applies not only on the given date, but again and again after a certain
4143 interval of N days (d), weeks (w), months(m), or years(y).  The
4144 following will show up in the agenda every Wednesday:
4146 @example
4147 * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
4148 @end example
4150 @item Diary-style sexp entries
4151 For more complex date specifications, Org mode supports using the
4152 special sexp diary entries implemented in the Emacs calendar/diary
4153 package.  For example
4155 @example
4156 * The nerd meeting on every 2nd Thursday of the month
4157   <%%(diary-float t 4 2)>
4158 @end example
4160 @item Time/Date range
4161 @cindex timerange
4162 @cindex date range
4163 Two time stamps connected by @samp{--} denote a range.  The headline
4164 will be shown on the first and last day of the range, and on any dates
4165 that are displayed and fall in the range.  Here is an example:
4167 @example
4168 ** Meeting in Amsterdam
4169    <2004-08-23 Mon>--<2004-08-26 Thu>
4170 @end example
4172 @item Inactive time stamp
4173 @cindex timestamp, inactive
4174 @cindex inactive timestamp
4175 Just like a plain time stamp, but with square brackets instead of
4176 angular ones.  These time stamps are inactive in the sense that they do
4177 @emph{not} trigger an entry to show up in the agenda.
4179 @example
4180 * Gillian comes late for the fifth time [2006-11-01 Wed]
4181 @end example
4183 @end table
4185 @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
4186 @section Creating timestamps
4187 @cindex creating timestamps
4188 @cindex timestamps, creating
4190 For Org mode to recognize time stamps, they need to be in the specific
4191 format.  All commands listed below produce time stamps in the correct
4192 format.
4194 @table @kbd
4195 @kindex C-c .
4196 @item C-c .
4197 Prompt for a date and insert a corresponding time stamp.  When the
4198 cursor is at a previously used time stamp, it is updated to NOW.  When
4199 this command is used twice in succession, a time range is inserted.
4201 @kindex C-u C-c .
4202 @item C-u C-c .
4203 Like @kbd{C-c .}, but use the alternative format which contains date
4204 and time.  The default time can be rounded to multiples of 5 minutes,
4205 see the option @code{org-time-stamp-rounding-minutes}.
4207 @kindex C-c !
4208 @item C-c !
4209 Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
4210 an agenda entry.
4212 @kindex C-c <
4213 @item C-c <
4214 Insert a time stamp corresponding to the cursor date in the Calendar.
4216 @kindex C-c >
4217 @item C-c >
4218 Access the Emacs calendar for the current date.  If there is a
4219 timestamp in the current line, go to the corresponding date
4220 instead.
4222 @kindex C-c C-o
4223 @item C-c C-o
4224 Access the agenda for the date given by the time stamp or -range at
4225 point (@pxref{Weekly/daily agenda}).
4227 @kindex S-@key{left}
4228 @kindex S-@key{right}
4229 @item S-@key{left}
4230 @itemx S-@key{right}
4231 Change date at cursor by one day.  These key bindings conflict with
4232 CUA mode (@pxref{Conflicts}).
4234 @kindex S-@key{up}
4235 @kindex S-@key{down}
4236 @item S-@key{up}
4237 @itemx S-@key{down}
4238 Change the item under the cursor in a timestamp.  The cursor can be on a
4239 year, month, day, hour or minute.  Note that if the cursor is in a
4240 headline and not at a time stamp, these same keys modify the priority of
4241 an item.  (@pxref{Priorities}). The key bindings also conflict with
4242 CUA mode (@pxref{Conflicts}).
4244 @kindex C-c C-y
4245 @cindex evaluate time range
4246 @item C-c C-y
4247 Evaluate a time range by computing the difference between start and end.
4248 With a prefix argument, insert result after the time range (in a table: into
4249 the following column).
4250 @end table
4253 @menu
4254 * The date/time prompt::        How Org mode helps you entering date and time
4255 * Custom time format::          Making dates look different
4256 @end menu
4258 @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
4259 @subsection The date/time prompt
4260 @cindex date, reading in minibuffer
4261 @cindex time, reading in minibuffer
4263 When Org mode prompts for a date/time, the default is shown as an ISO
4264 date, and the prompt therefore seems to ask for an ISO date.  But it
4265 will in fact accept any string containing some date and/or time
4266 information, and it is really smart about interpreting your input.  You
4267 can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
4268 copied from an email message.  Org mode will find whatever information
4269 is in there and derive anything you have not specified from the
4270 @emph{default date and time}.  The default is usually the current date
4271 and time, but when modifying an existing time stamp, or when entering
4272 the second stamp of a range, it is taken from the stamp in the buffer.
4273 When filling in information, Org mode assumes that most of the time you
4274 will want to enter a date in the future: If you omit the month/year and
4275 the given day/month is @i{before} today, it will assume that you mean a
4276 future date@footnote{See the variable
4277 @code{org-read-date-prefer-future}.}.
4279 For example, lets assume that today is @b{June 13, 2006}.  Here is how
4280 various inputs will be interpreted, the items filled in by Org mode are
4281 in @b{bold}.
4283 @example
4284 3-2-5         --> 2003-02-05
4285 14            --> @b{2006}-@b{06}-14
4286 12            --> @b{2006}-@b{07}-12
4287 Fri           --> nearest Friday (defaultdate or later)
4288 sep 15        --> @b{2006}-11-15
4289 feb 15        --> @b{2007}-02-15
4290 sep 12 9      --> 2009-09-12
4291 12:45         --> @b{2006}-@b{06}-@b{13} 12:45
4292 22 sept 0:34  --> @b{2006}-09-22 0:34
4293 w4            --> ISO week for of the current year @b{2006}
4294 2012 w4 fri   --> Friday of ISO week 4 in 2012
4295 2012-w04-5    --> Same as above
4296 @end example
4298 Furthermore you can specify a relative date by giving, as the
4299 @emph{first} thing in the input: a plus/minus sign, a number and a
4300 letter [dwmy] to indicate change in days weeks, months, years.  With a
4301 single plus or minus, the date is always relative to today.  With a
4302 double plus or minus, it is relative to the default date.  If instead of
4303 a single letter, you use the abbreviation of day name, the date will be
4304 the nth such day.  E.g.
4306 @example
4307 +0            --> today
4308 .             --> today
4309 +4d           --> four days from today
4310 +4            --> same as above
4311 +2w           --> two weeks from today
4312 ++5           --> five days from default date
4313 +2tue         --> second tuesday from now.
4314 @end example
4316 The function understands English month and weekday abbreviations.  If
4317 you want to use unabbreviated names and/or other languages, configure
4318 the variables @code{parse-time-months} and @code{parse-time-weekdays}.
4320 @cindex calendar, for selecting date
4321 Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
4322 you don't need/want the calendar, configure the variable
4323 @code{org-popup-calendar-for-date-prompt}.}.  When you exit the date
4324 prompt, either by clicking on a date in the calendar, or by pressing
4325 @key{RET}, the date selected in the calendar will be combined with the
4326 information entered at the prompt.  You can control the calendar fully
4327 from the minibuffer:
4329 @kindex <
4330 @kindex >
4331 @kindex mouse-1
4332 @kindex S-@key{right}
4333 @kindex S-@key{left}
4334 @kindex S-@key{down}
4335 @kindex S-@key{up}
4336 @kindex M-S-@key{right}
4337 @kindex M-S-@key{left}
4338 @kindex @key{RET}
4339 @example
4340 > / <          @r{Scroll calendar forward/backward by one month.}
4341 mouse-1        @r{Select date by clicking on it.}
4342 S-@key{right}/@key{left}     @r{One day forward/backward.}
4343 S-@key{down}/@key{up}     @r{One week forward/backward.}
4344 M-S-@key{right}/@key{left}   @r{One month forward/backward.}
4345 @key{RET}           @r{Choose date in calendar.}
4346 @end example
4348 The actions of the date/time prompt may seem complex, but I assure you they
4349 will grow on you, and you will start getting annoyed by pretty much any other
4350 way of entering a date/time out there.  To help you understand what is going
4351 on, the current interpretation of your input will be displayed live in the
4352 minibuffer@footnote{If you find this distracting, turn the display of with
4353 @code{org-read-date-display-live}.}.
4355 @node Custom time format,  , The date/time prompt, Creating timestamps
4356 @subsection Custom time format
4357 @cindex custom date/time format
4358 @cindex time format, custom
4359 @cindex date format, custom
4361 Org mode uses the standard ISO notation for dates and times as it is
4362 defined in ISO 8601.  If you cannot get used to this and require another
4363 representation of date and time to keep you happy, you can get it by
4364 customizing the variables @code{org-display-custom-times} and
4365 @code{org-time-stamp-custom-formats}.
4367 @table @kbd
4368 @kindex C-c C-x C-t
4369 @item C-c C-x C-t
4370 Toggle the display of custom formats for dates and times.
4371 @end table
4373 @noindent
4374 Org mode needs the default format for scanning, so the custom date/time
4375 format does not @emph{replace} the default format - instead it is put
4376 @emph{over} the default format using text properties.  This has the
4377 following consequences:
4378 @itemize @bullet
4379 @item
4380 You cannot place the cursor onto a time stamp anymore, only before or
4381 after.
4382 @item
4383 The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
4384 each component of a time stamp.  If the cursor is at the beginning of
4385 the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
4386 just like @kbd{S-@key{left}/@key{right}}.  At the end of the stamp, the
4387 time will be changed by one minute.
4388 @item
4389 If the time stamp contains a range of clock times or a repeater, these
4390 will not be overlayed, but remain in the buffer as they were.
4391 @item
4392 When you delete a time stamp character-by-character, it will only
4393 disappear from the buffer after @emph{all} (invisible) characters
4394 belonging to the ISO timestamp have been removed.
4395 @item
4396 If the custom time stamp format is longer than the default and you are
4397 using dates in tables, table alignment will be messed up.  If the custom
4398 format is shorter, things do work as expected.
4399 @end itemize
4402 @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
4403 @section Deadlines and scheduling
4405 A time stamp may be preceded by special keywords to facilitate planning:
4407 @table @var
4408 @item DEADLINE
4409 @cindex DEADLINE keyword
4411 Meaning: the task (most likely a TODO item, though not necessarily) is supposed
4412 to be finished on that date.
4414 On the deadline date, the task will be listed in the agenda.  In
4415 addition, the agenda for @emph{today} will carry a warning about the
4416 approaching or missed deadline, starting
4417 @code{org-deadline-warning-days} before the due date, and continuing
4418 until the entry is marked DONE.  An example:
4420 @example
4421 *** TODO write article about the Earth for the Guide
4422     The editor in charge is [[bbdb:Ford Prefect]]
4423     DEADLINE: <2004-02-29 Sun>
4424 @end example
4426 You can specify a different lead time for warnings for a specific
4427 deadlines using the following syntax.  Here is an example with a warning
4428 period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
4430 @item SCHEDULED
4431 @cindex SCHEDULED keyword
4433 Meaning: you are planning to start working on that task on the given
4434 date.
4436 The headline will be listed under the given date@footnote{It will still
4437 be listed on that date after it has been marked DONE.  If you don't like
4438 this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
4439 addition, a reminder that the scheduled date has passed will be present
4440 in the compilation for @emph{today}, until the entry is marked DONE.
4441 I.e., the task will automatically be forwarded until completed.
4443 @example
4444 *** TODO Call Trillian for a date on New Years Eve.
4445     SCHEDULED: <2004-12-25 Sat>
4446 @end example
4448 @noindent
4449 @b{Important:} Scheduling an item in Org mode should @i{not} be
4450 understood in the same way that we understand @i{scheduling a meeting}.
4451 Setting a date for a meeting is just a simple appointment, you should
4452 mark this entry with a simple plain time stamp, to get this item shown
4453 on the date where it applies.  This is a frequent mis-understanding from
4454 Org-users.  In Org mode, @i{scheduling} means setting a date when you
4455 want to start working on an action item.
4456 @end table
4458 You may use time stamps with repeaters in scheduling and deadline
4459 entries.  Org mode will issue early and late warnings based on the
4460 assumption that the time stamp represents the @i{nearest instance} of
4461 the repeater.  However, the use of diary sexp entries like
4463 @code{<%%(diary-float t 42)>}
4465 in scheduling and deadline timestamps is limited.  Org mode does not
4466 know enough about the internals of each sexp function to issue early and
4467 late warnings.  However, it will show the item on each day where the
4468 sexp entry matches.
4470 @menu
4471 * Inserting deadline/schedule::  Planning items
4472 * Repeated tasks::              Items that show up again and again
4473 @end menu
4475 @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
4476 @subsection Inserting deadlines or schedules
4478 The following commands allow to quickly insert a deadline or to schedule
4479 an item:
4481 @table @kbd
4483 @kindex C-c C-d
4484 @item C-c C-d
4485 Insert @samp{DEADLINE} keyword along with a stamp.  The insertion will
4486 happen in the line directly following the headline.  When called with a
4487 prefix arg, an existing deadline will be removed from the entry.
4488 @c FIXME Any CLOSED timestamp will be removed.????????
4490 @kindex C-c / d
4491 @cindex sparse tree, for deadlines
4492 @item C-c / d
4493 Create a sparse tree with all deadlines that are either past-due, or
4494 which will become due within @code{org-deadline-warning-days}.
4495 With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
4496 prefix, check that many days.  For example, @kbd{C-1 C-c / d} shows
4497 all deadlines due tomorrow.
4499 @kindex C-c C-s
4500 @item C-c C-s
4501 Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
4502 happen in the line directly following the headline.  Any CLOSED
4503 timestamp will be removed.  When called with a prefix argument, remove
4504 the scheduling date from the entry.
4505 @end table
4507 @node Repeated tasks,  , Inserting deadline/schedule, Deadlines and scheduling
4508 @subsection Repeated tasks
4510 Some tasks need to be repeated again and again.  Org mode helps to
4511 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
4512 or plain time stamp.  In the following example
4513 @example
4514 ** TODO Pay the rent
4515    DEADLINE: <2005-10-01 Sat +1m>
4516 @end example
4517 the @code{+1m} is a repeater; the intended interpretation is that the
4518 task has a deadline on <2005-10-01> and repeats itself every (one) month
4519 starting from that time.  If you need both a repeater and a special
4520 warning period in a deadline entry, the repeater comes first and the
4521 warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
4523 Deadlines and scheduled items produce entries in the agenda when they
4524 are over-due, so it is important to be able to mark such an entry as
4525 completed once you have done so.  When you mark a DEADLINE or a SCHEDULE
4526 with the TODO keyword DONE, it will no longer produce entries in the
4527 agenda.  The problem with this is, however, that then also the
4528 @emph{next} instance of the repeated entry will not be active.  Org mode
4529 deals with this in the following way: When you try to mark such an entry
4530 DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
4531 time stamp by the repeater interval, and immediately set the entry state
4532 back to TODO.  In the example above, setting the state to DONE would
4533 actually switch the date like this:
4535 @example
4536 ** TODO Pay the rent
4537    DEADLINE: <2005-11-01 Tue +1m>
4538 @end example
4540 A timestamp@footnote{You can change this using the option
4541 @code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
4542 @code{lognoterepeat}, and @code{nologrepeat}.  With @code{lognoterepeat}, you
4543 will aslo be prompted for a note.} will be added under the deadline, to keep
4544 a record that you actually acted on the previous instance of this deadline.
4546 As a consequence of shifting the base date, this entry will no longer be
4547 visible in the agenda when checking past dates, but all future instances
4548 will be visible.
4550 With the @samp{+1m} cookie, the date shift will always be exactly one
4551 month.  So if you have not payed the rent for three months, marking this
4552 entry DONE will still keep it as an overdue deadline.  Depending on the
4553 task, this may not be the best way to handle it.  For example, if you
4554 forgot to call you father for 3 weeks, it does not make sense to call
4555 him 3 times in a single day to make up for it.  Finally, there are tasks
4556 like changing batteries which should always repeat a certain time
4557 @i{after} the last time you did it.  For these tasks, Org mode has
4558 special repeaters markers with @samp{++} and @samp{.+}.  For example:
4560 @example
4561 ** TODO Call Father
4562    DEADLINE: <2008-02-10 Sun ++1w>
4563    Marking this DONE will shift the date by at least one week,
4564    but also by as many weeks as it takes to get this date into
4565    the future.  However, it stays on a Sunday, even if you called
4566    and marked it done on Saturday.
4567 ** TODO Check the batteries in the smoke detectors
4568    DEADLINE: <2005-11-01 Tue .+1m>
4569    Marking this DONE will shift the date to one month after
4570    today.
4571 @end example
4573 You may have both scheduling and deadline information for a specific
4574 task - just make sure that the repeater intervals on both are the same.
4576 @node Clocking work time, Effort estimates, Deadlines and scheduling, Dates and Times
4577 @section Clocking work time
4579 Org mode allows you to clock the time you spent on specific tasks in a
4580 project.  When you start working on an item, you can start the clock.
4581 When you stop working on that task, or when you mark the task done, the
4582 clock is stopped and the corresponding time interval is recorded.  It
4583 also computes the total time spent on each subtree of a project.
4585 @table @kbd
4586 @kindex C-c C-x C-i
4587 @item C-c C-x C-i
4588 Start the clock on the current item (clock-in).  This inserts the CLOCK
4589 keyword together with a timestamp.  If this is not the first clocking of
4590 this item, the multiple CLOCK lines will be wrapped into a
4591 @code{:CLOCK:} drawer (see also the variable
4592 @code{org-clock-into-drawer}).  When called with a @kbd{C-u} prefix argument,
4593 select the task from a list of recently clocked tasks.  With two @kbd{C-u
4594 C-u} prefixes, clock into the task at point and mark it as the default task.
4595 The default task will always be available when selecting a clocking task,
4596 with letter @kbd{d}.
4597 @kindex C-c C-x C-o
4598 @item C-c C-x C-o
4599 Stop the clock (clock-out).  The inserts another timestamp at the same
4600 location where the clock was last started.  It also directly computes
4601 the resulting time in inserts it after the time range as @samp{=>
4602 HH:MM}.  See the variable @code{org-log-note-clock-out} for the
4603 possibility to record an additional note together with the clock-out
4604 time stamp@footnote{The corresponding in-buffer setting is:
4605 @code{#+STARTUP: lognoteclock-out}}.
4606 @kindex C-c C-y
4607 @item C-c C-y
4608 Recompute the time interval after changing one of the time stamps.  This
4609 is only necessary if you edit the time stamps directly.  If you change
4610 them with @kbd{S-@key{cursor}} keys, the update is automatic.
4611 @kindex C-c C-t
4612 @item C-c C-t
4613 Changing the TODO state of an item to DONE automatically stops the clock
4614 if it is running in this same item.
4615 @kindex C-c C-x C-x
4616 @item C-c C-x C-x
4617 Cancel the current clock.  This is useful if a clock was started by
4618 mistake, or if you ended up working on something else.
4619 @kindex C-c C-x C-j
4620 @item C-c C-x C-j
4621 Jump to the entry that contains the currently running clock.  With a
4622 @kbd{C-u} prefix arg, select the target task from a list of recently clocked
4623 tasks.
4624 @kindex C-c C-x C-d
4625 @item C-c C-x C-d
4626 Display time summaries for each subtree in the current buffer.  This
4627 puts overlays at the end of each headline, showing the total time
4628 recorded under that heading, including the time of any subheadings. You
4629 can use visibility cycling to study the tree, but the overlays disappear
4630 when you change the buffer (see variable
4631 @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
4632 @kindex C-c C-x C-r
4633 @item C-c C-x C-r
4634 Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
4635 report as an Org mode table into the current file.  When the cursor is
4636 at an existing clock table, just update it.  When called with a prefix
4637 argument, jump to the first clock report in the current document and
4638 update it.
4639 @cindex #+BEGIN: clocktable
4640 @example
4641 #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
4642 #+END: clocktable
4643 @end example
4644 @noindent
4645 If such a block already exists at point, its content is replaced by the
4646 new table.  The @samp{BEGIN} line can specify options:
4647 @example
4648 :maxlevel    @r{Maximum level depth to which times are listed in the table.}
4649 :emphasize   @r{When @code{t}, emphasize level one and level two items}
4650 :scope       @r{The scope to consider.  This can be any of the following:}
4651              nil        @r{the current buffer or narrowed region}
4652              file       @r{the full current buffer}
4653              subtree    @r{the subtree where the clocktable is located}
4654              treeN      @r{the surrounding level N tree, for example @code{tree3}}
4655              tree       @r{the surrounding level 1 tree}
4656              agenda     @r{all agenda files}
4657              ("file"..) @r{scan these files}
4658              file-with-archives    @r{current file and its archives}
4659              agenda-with-archives  @r{all agenda files, including archives}
4660 :block       @r{The time block to consider.  This block is specified either}
4661              @r{absolute, or relative to the current time and may be any of}
4662              @r{these formats:}
4663              2007-12-31    @r{New year eve 2007}
4664              2007-12       @r{December 2007}
4665              2007-W50      @r{ISO-week 50 in 2007}
4666              2007          @r{the year 2007}
4667              today, yesterday, today-N          @r{a relative day}
4668              thisweek, lastweek, thisweek-N     @r{a relative week}
4669              thismonth, lastmonth, thismonth-N  @r{a relative month}
4670              thisyear, lastyear, thisyear-N     @r{a relative year}
4671              @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
4672 :tstart      @r{A time string specifying when to start considering times}
4673 :tend        @r{A time string specifying when to stop considering times}
4674 :step        @r{@code{week} or @code{day}, to split the table into chunks.}
4675              @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
4676 :link        @r{Link the item headlines in the table to their origins}
4677 @end example
4678 So to get a clock summary of the current level 1 tree, for the current
4679 day, you could write
4680 @example
4681 #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
4682 #+END: clocktable
4683 @end example
4684 and to use a specific time range you could write@footnote{Note that all
4685 parameters must be specified in a single line - the line is broken here
4686 only to fit it onto the manual.}
4687 @example
4688 #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
4689                     :tend "<2006-08-10 Thu 12:00>"
4690 #+END: clocktable
4691 @end example
4692 @kindex C-c C-c
4693 @item C-c C-c
4694 @kindex C-c C-x C-u
4695 @itemx C-c C-x C-u
4696 Update dynamical block at point.  The cursor needs to be in the
4697 @code{#+BEGIN} line of the dynamic block.
4698 @kindex C-u C-c C-x C-u
4699 @item C-u C-c C-x C-u
4700 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
4701 you have several clock table blocks in a buffer.
4702 @kindex S-@key{left}
4703 @kindex S-@key{right}
4704 @item S-@key{left}
4705 @itemx S-@key{right}
4706 Shift the current @code{:block} interval and update the table.  The cursor
4707 needs to be in the @code{#+BEGIN: clocktable} line for this command.  If
4708 @code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
4709 @end table
4711 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
4712 the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
4713 worked on or closed during a day.
4715 @node Effort estimates,  , Clocking work time, Dates and Times
4716 @section Effort estimates
4717 @cindex Effort estimates
4719 If you want to plan your work in a very detailed way, or if you need to
4720 produce offers with quotations of the estimated work effort, you may want to
4721 assign effort estimates to entries.  If you are also clocking your work, you
4722 may later want to compare the planned effort with the actual working time, a
4723 great way to improve planning estimates.  Effort estimates are stored in a
4724 special property @samp{Effort}@footnote{You may change the property being
4725 used with the variable @code{org-effort-property}.}.  Clearly the best way to
4726 work with effort estimates is through column view (@pxref{Column view}).  You
4727 should start by setting up discrete values for effort estimates, and a
4728 @code{COLUMNS} format that displays these values together with clock sums (if
4729 you want to clock your time).  For a specific buffer you can use
4731 @example
4732 #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00
4733 #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
4734 @end example
4736 @noindent
4737 or you can set up these values globally by customizing the variables
4738 @code{org-global-properties} and @code{org-columns-default-format}.  In
4739 particular if you want to use this setup also in the agenda, a global setup
4740 may be advised.
4742 The way to assign estimates to individual items is then to switch to column
4743 mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the
4744 value.  The values you enter will immediately be summed up in the hierarchy.
4745 In the column next to it, any clocked time will be displayed.
4747 If you switch to column view in the daily/weekly agenda, the effort column
4748 will summarize the estimated work effort for each day@footnote{Please note
4749 the pitfalls of summing hierarchical data in a flat list (@pxref{Agenda
4750 column view}).}, and you can use this to find space in your schedule.  To get
4751 an overview of the entire part of the day that is committed, you can set the
4752 option @code{org-agenda-columns-add-appointments-to-effort-sum}.  The
4753 appointments on a day that take place over a specified time interval will
4754 then also be added to the load estimate of the day.
4756 @node Remember, Agenda Views, Dates and Times, Top
4757 @chapter Remember
4758 @cindex @file{remember.el}
4760 The @i{Remember} package by John Wiegley lets you store quick notes with
4761 little interruption of your work flow.  See
4762 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
4763 information.  It is an excellent way to add new notes and tasks to
4764 Org files.  Org significantly expands the possibilities of
4765 @i{remember}: You may define templates for different note types, and
4766 associate target files and headlines with specific templates.  It also
4767 allows you to select the location where a note should be stored
4768 interactively, on the fly.
4770 @menu
4771 * Setting up Remember::         Some code for .emacs to get things going
4772 * Remember templates::          Define the outline of different note types
4773 * Storing notes::               Directly get the note to where it belongs
4774 * Refiling notes::              Moving a note or task to a project
4775 @end menu
4777 @node Setting up Remember, Remember templates, Remember, Remember
4778 @section Setting up Remember
4780 The following customization will tell @i{remember} to use org files as
4781 target, and to create annotations compatible with Org links.
4783 @example
4784 (org-remember-insinuate)
4785 (setq org-directory "~/path/to/my/orgfiles/")
4786 (setq org-default-notes-file (concat org-directory "/notes.org"))
4787 (define-key global-map "\C-cr" 'org-remember)
4788 @end example
4790 The last line binds the command @code{org-remember} to a global
4791 key@footnote{Please select your own key, @kbd{C-c r} is only a
4792 suggestion.}.  @code{org-remember} basically just calls @code{remember},
4793 but it makes a few things easier: If there is an active region, it will
4794 automatically copy the region into the remember buffer.  It also allows
4795 to jump to the buffer and location where remember notes are being
4796 stored: Just call @code{org-remember} with a prefix argument.  If you
4797 use two prefix arguments, Org jumps to the location where the last
4798 remember note was stored.
4800 @node Remember templates, Storing notes, Setting up Remember, Remember
4801 @section Remember templates
4802 @cindex templates, for remember
4804 In combination with Org, you can use templates to generate
4805 different types of @i{remember} notes.  For example, if you would like
4806 to use one template to create general TODO entries, another one for
4807 journal entries, and a third one for collecting random ideas, you could
4808 use:
4810 @example
4811 (setq org-remember-templates
4812  '(("Todo" ?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org" "Tasks")
4813    ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")
4814    ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
4815 @end example
4817 @noindent In these entries, the first string is just a name, and the
4818 character specifies how to select the template.  It is useful if the
4819 character is also the first letter of the name.  The next string specifies
4820 the template.  Two more (optional) strings give the file in which, and the
4821 headline under which the new note should be stored.  The file (if not present
4822 or @code{nil}) defaults to @code{org-default-notes-file}, the heading to
4823 @code{org-remember-default-headline}.  If the file name is not an absolute
4824 path, it will be interpreted relative to @code{org-directory}.  The heading
4825 can also be the symbols @code{top} or @code{bottom} to send note as level 1
4826 entries to the beginning or end of the file, respectively.
4828 An optional sixth element specifies the contexts in which the user can select
4829 the template.  This element can be a list of major modes or a function.
4830 @code{org-remember} will first check whether the function returns @code{t} or
4831 if we are in any of the listed major mode, and exclude templates fo which
4832 this condition is not fulfilled.  Templates that do not specify this element
4833 at all, or that use @code{nil} or @code{t} as a value will always be
4834 selectable.
4836 So for example:
4838 @example
4839 (setq org-remember-templates
4840  '(("Bug" ?b "* BUG %?\n  %i\n  %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
4841    ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org" "X" my-check)
4842    ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
4843 @end example
4845 The first template will only be available when invoking @code{org-remember}
4846 from an buffer in @code{emacs-lisp-mode}.  The second template will only be
4847 available when the function @code{my-check} returns @code{t}.  The third
4848 template will be proposed in any context.
4850 When you call @kbd{M-x org-remember} (or @kbd{M-x remember}) to remember
4851 something, Org will prompt for a key to select the template (if you have
4852 more than one template) and then prepare the buffer like
4853 @example
4854 * TODO
4855   [[file:link to where you called remember]]
4856 @end example
4858 @noindent
4859 During expansion of the template, special @kbd{%}-escapes allow dynamic
4860 insertion of content:
4861 @example
4862 %^@{prompt@}  @r{prompt the user for a string and replace this sequence with it.}
4863             @r{You may specify a default value and a completion table with}
4864             @r{%^@{prompt|default|completion2|completion3...@}}
4865             @r{The arrow keys access a prompt-specific history.}
4866 %a          @r{annotation, normally the link created with @code{org-store-link}}
4867 %A          @r{like @code{%a}, but prompt for the description part}
4868 %i          @r{initial content, the region when remember is called with C-u.}
4869             @r{The entire text will be indented like @code{%i} itself.}
4870 %t          @r{time stamp, date only}
4871 %T          @r{time stamp with date and time}
4872 %u, %U      @r{like the above, but inactive time stamps}
4873 %v, %V      @r{like %t,%T, but when called from agenda or calendar, use the}
4874             @r{cursor date as the default date.}
4875 %^t         @r{like @code{%t}, but prompt for date.  Similarly @code{%^T}, @code{%^u}, @code{%^U}}
4876             @r{You may define a prompt like @code{%^@{Birthday@}t}}
4877 %n          @r{user name (taken from @code{user-full-name})}
4878 %c          @r{Current kill ring head.}
4879 %x          @r{Content of the X clipboard.}
4880 %^C         @r{Interactive selection of which kill or clip to use.}
4881 %^L         @r{Like @code{%^C}, but insert as link.}
4882 %^g         @r{prompt for tags, with completion on tags in target file.}
4883 %^G         @r{prompt for tags, with completion all tags in all agenda files.}
4884 %:keyword   @r{specific information for certain link types, see below}
4885 %[pathname] @r{insert the contents of the file given by @code{pathname}}
4886 %(sexp)     @r{evaluate elisp @code{(sexp)} and replace with the result}
4887 %!          @r{immediately store note after completing the template}
4888             @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
4889 %&          @r{jump to target location immediately after storing note}
4890 @end example
4892 @noindent
4893 For specific link types, the following keywords will be
4894 defined@footnote{If you define your own link types (@pxref{Adding
4895 hyperlink types}), any property you store with
4896 @code{org-store-link-props} can be accessed in remember templates in a
4897 similar way.}:
4899 @example
4900 Link type          |  Available keywords
4901 -------------------+----------------------------------------------
4902 bbdb               |  %:name %:company
4903 bbdb               |  %::server %:port %:nick
4904 vm, wl, mh, rmail  |  %:type %:subject %:message-id
4905                    |  %:from %:fromname %:fromaddress
4906                    |  %:to   %:toname   %:toaddress
4907                    |  %: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}.}}
4908 gnus               |  %:group, @r{for messages also all email fields}
4909 w3, w3m            |  %:url
4910 info               |  %:file %:node
4911 calendar           |  %:date"
4912 @end example
4914 @noindent
4915 To place the cursor after template expansion use:
4917 @example
4918 %?          @r{After completing the template, position cursor here.}
4919 @end example
4921 @noindent
4922 If you change your mind about which template to use, call
4923 @code{org-remember} in the remember buffer.  You may then select a new
4924 template that will be filled with the previous context information.
4926 @node Storing notes, Refiling notes, Remember templates, Remember
4927 @section Storing notes
4929 When you are finished preparing a note with @i{remember}, you have to press
4930 @kbd{C-c C-c} to file the note away.  If you have started the clock in the
4931 remember buffer, you will first be asked if you want to clock out
4932 now@footnote{To avoid this query, configure the variable
4933 @code{org-remember-clock-out-on-exit}.}.  If you answer @kbd{n}, the clock
4934 will continue to run after the note is filed away.
4936 The handler will then store the note in the file and under the headline
4937 specified in the template, or it will use the default file and headlines.
4938 The window configuration will be restored, sending you back to the working
4939 context before the call to @code{remember}.  To re-use the location found
4940 during the last call to @code{remember}, exit the remember buffer with
4941 @kbd{C-u C-u C-c C-c}, i.e. specify a double prefix argument to @kbd{C-c
4942 C-c}.
4944 If you want to store the note directly to a different place, use
4945 @kbd{C-u C-c C-c} instead to exit remember@footnote{Configure the
4946 variable @code{org-remember-store-without-prompt} to make this behavior
4947 the default.}.  The handler will then first prompt for a target file -
4948 if you press @key{RET}, the value specified for the template is used.
4949 Then the command offers the headings tree of the selected file, with the
4950 cursor position at the default headline (if you had specified one in the
4951 template).  You can either immediately press @key{RET} to get the note
4952 placed there.  Or you can use the following keys to find a different
4953 location:
4954 @example
4955 @key{TAB}         @r{Cycle visibility.}
4956 @key{down} / @key{up}   @r{Next/previous visible headline.}
4957 n / p        @r{Next/previous visible headline.}
4958 f / b        @r{Next/previous headline same level.}
4959 u            @r{One level up.}
4960 @c 0-9          @r{Digit argument.}
4961 @end example
4962 @noindent
4963 Pressing @key{RET} or @key{left} or @key{right}
4964 then leads to the following result.
4966 @multitable @columnfractions 0.2 0.15 0.65
4967 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
4968 @item on headline     @tab @key{RET}              @tab as sublevel of the heading at cursor, first or last
4969 @item                 @tab                        @tab depending on @code{org-reverse-note-order}.
4970 @item                 @tab @key{left}/@key{right} @tab as same level, before/after current heading
4971 @item buffer-start    @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
4972 @item                 @tab @tab depending on @code{org-reverse-note-order}.
4973 @item not on headline @tab @key{RET}
4974       @tab at cursor position, level taken from context.
4975 @end multitable
4977 Before inserting the text into a tree, the function ensures that the
4978 text has a headline, i.e. a first line that starts with a @samp{*}.  If
4979 not, a headline is constructed from the current date and some additional
4980 data.  If you have indented the text of the note below the headline, the
4981 indentation will be adapted if inserting the note into the tree requires
4982 demotion from level 1.
4984 @node Refiling notes,  , Storing notes, Remember
4985 @section Refiling notes
4986 @cindex refiling notes
4988 Remember is usually used to quickly capture notes and tasks into one or
4989 a few capture lists.  When reviewing the captured data, you may want to
4990 refile some of the entries into a different list, for example into a
4991 project.  Cutting, finding the right location and then pasting the note
4992 is cumbersome.  To simplify this process, you can use the following
4993 special command:
4995 @table @kbd
4996 @kindex C-c C-w
4997 @item C-c C-w
4998 Refile the entry at point.  This command offers possible locations for
4999 refiling the entry and lets you select one with completion.  The item is
5000 filed below the target heading as a subitem.  Depending on
5001 @code{org-reverse-note-order}, it will be either the first of last
5002 subitem.@* By default, all level 1 headlines in the current buffer are
5003 considered to be targets, but you can have more complex definitions
5004 across a number of files.  See the variable @code{org-refile-targets}
5005 for details.  If you would like to select a location via a file-pathlike
5006 completion along the outline path, see the variable
5007 @code{org-refile-use-outline-path}.
5008 @kindex C-u C-c C-w
5009 @item C-u C-c C-w
5010 Use the refile interface to jump to a heading.
5011 @kindex C-u C-u C-c C-w
5012 @item C-u C-u C-c C-w
5013 Jump to the location where @code{org-refile} last moved a tree to.
5014 @end table
5016 @node Agenda Views, Embedded LaTeX, Remember, Top
5017 @chapter Agenda Views
5018 @cindex agenda views
5020 Due to the way Org works, TODO items, time-stamped items, and
5021 tagged headlines can be scattered throughout a file or even a number of
5022 files.  To get an overview of open action items, or of events that are
5023 important for a particular date, this information must be collected,
5024 sorted and displayed in an organized way.
5026 Org can select items based on various criteria, and display them
5027 in a separate buffer.  Seven different view types are provided:
5029 @itemize @bullet
5030 @item
5031 an @emph{agenda} that is like a calendar and shows information
5032 for specific dates,
5033 @item
5034 a @emph{TODO list} that covers all unfinished
5035 action items,
5036 @item
5037 a @emph{tags view}, showings headlines based on
5038 the tags associated with them,
5039 @item
5040 a @emph{timeline view} that shows all events in a single Org file,
5041 in time-sorted view,
5042 @item
5043 a @emph{keyword search view} that shows all entries from multiple files
5044 that contain specified keywords.
5045 @item
5046 a @emph{stuck projects view} showing projects that currently don't move
5047 along, and
5048 @item
5049 @emph{custom views} that are special tag/keyword searches and
5050 combinations of different views.
5051 @end itemize
5053 @noindent
5054 The extracted information is displayed in a special @emph{agenda
5055 buffer}.  This buffer is read-only, but provides commands to visit the
5056 corresponding locations in the original Org files, and even to
5057 edit these files remotely.
5059 Two variables control how the agenda buffer is displayed and whether the
5060 window configuration is restored when the agenda exits:
5061 @code{org-agenda-window-setup} and
5062 @code{org-agenda-restore-windows-after-quit}.
5064 @menu
5065 * Agenda files::                Files being searched for agenda information
5066 * Agenda dispatcher::           Keyboard access to agenda views
5067 * Built-in agenda views::       What is available out of the box?
5068 * Presentation and sorting::    How agenda items are prepared for display
5069 * Agenda commands::             Remote editing of Org trees
5070 * Custom agenda views::         Defining special searches and views
5071 * Agenda column view::          Using column view for collected entries
5072 @end menu
5074 @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
5075 @section Agenda files
5076 @cindex agenda files
5077 @cindex files for agenda
5079 The information to be shown is normally collected from all @emph{agenda
5080 files}, the files listed in the variable
5081 @code{org-agenda-files}@footnote{If the value of that variable is not a
5082 list, but a single file name, then the list of agenda files will be
5083 maintained in that external file.}. If a directory is part of this list,
5084 all files with the extension @file{.org} in this directory will be part
5085 of the list.
5087 Thus even if you only work with a single Org file, this file should
5088 be put into that list@footnote{When using the dispatcher, pressing
5089 @kbd{<} before selecting a command will actually limit the command to
5090 the current file, and ignore @code{org-agenda-files} until the next
5091 dispatcher command.}.  You can customize @code{org-agenda-files}, but
5092 the easiest way to maintain it is through the following commands
5094 @cindex files, adding to agenda list
5095 @table @kbd
5096 @kindex C-c [
5097 @item C-c [
5098 Add current file to the list of agenda files.  The file is added to
5099 the front of the list.  If it was already in the list, it is moved to
5100 the front.  With a prefix argument, file is added/moved to the end.
5101 @kindex C-c ]
5102 @item C-c ]
5103 Remove current file from the list of agenda files.
5104 @kindex C-,
5105 @kindex C-'
5106 @item C-,
5107 @itemx C-'
5108 Cycle through agenda file list, visiting one file after the other.
5109 @kindex M-x org-iswitchb
5110 @item M-x org-iswitchb
5111 Command to use an @code{iswitchb}-like interface to switch to and between Org
5112 buffers.
5113 @end table
5115 @noindent
5116 The Org menu contains the current list of files and can be used
5117 to visit any of them.
5119 If you would like to focus the agenda temporarily onto a file not in
5120 this list, or onto just one file in the list or even only a subtree in a
5121 file, this can be done in different ways.  For a single agenda command,
5122 you may press @kbd{<} once or several times in the dispatcher
5123 (@pxref{Agenda dispatcher}).  To restrict the agenda scope for an
5124 extended period, use the following commands:
5126 @table @kbd
5127 @kindex C-c C-x <
5128 @item C-c C-x <
5129 Permanently restrict the agenda to the current subtree.  When with a
5130 prefix argument, or with the cursor before the first headline in a file,
5131 the agenda scope is set to the entire file.  This restriction remains in
5132 effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
5133 or @kbd{>} in the agenda dispatcher.  If there is a window displaying an
5134 agenda view, the new restriction takes effect immediately.
5135 @kindex C-c C-x <
5136 @item C-c C-x <
5137 Remove the permanent restriction created by @kbd{C-c C-x <}.
5138 @end table
5140 @noindent
5141 When working with @file{Speedbar}, you can use the following commands in
5142 the Speedbar frame:
5143 @table @kbd
5144 @kindex <
5145 @item < @r{in the speedbar frame}
5146 Permanently restrict the agenda to the item at the cursor in the
5147 Speedbar frame, either an Org file or a subtree in such a file.
5148 If there is a window displaying an agenda view, the new restriction takes
5149 effect immediately.
5150 @kindex <
5151 @item > @r{in the speedbar frame}
5152 Lift the restriction again.
5153 @end table
5155 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
5156 @section The agenda dispatcher
5157 @cindex agenda dispatcher
5158 @cindex dispatching agenda commands
5159 The views are created through a dispatcher that should be bound to a
5160 global key, for example @kbd{C-c a} (@pxref{Installation}).  In the
5161 following we will assume that @kbd{C-c a} is indeed how the dispatcher
5162 is accessed and list keyboard access to commands accordingly.  After
5163 pressing @kbd{C-c a}, an additional letter is required to execute a
5164 command.  The dispatcher offers the following default commands:
5165 @table @kbd
5166 @item a
5167 Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
5168 @item t @r{/} T
5169 Create a list of all TODO items (@pxref{Global TODO list}).
5170 @item m @r{/} M
5171 Create a list of headlines matching a TAGS expression (@pxref{Matching
5172 tags and properties}).
5173 @item L
5174 Create the timeline view for the current buffer (@pxref{Timeline}).
5175 @item s
5176 Create a list of entries selected by a boolean expression of keywords
5177 and/or regular expressions that must or must not occur in the entry.
5178 @item /
5179 Search for a regular expression in all agenda files and additionally in
5180 the files listed in @code{org-agenda-multi-occur-extra-files}.  This
5181 uses the Emacs command @code{multi-occur}.  A prefix argument can be
5182 used to specify the number of context lines for each match, default is
5184 @item # @r{/} !
5185 Create a list of stuck projects (@pxref{Stuck projects}).
5186 @item <
5187 Restrict an agenda command to the current buffer@footnote{For backward
5188 compatibility, you can also press @kbd{1} to restrict to the current
5189 buffer.}.  After pressing @kbd{<}, you still need to press the character
5190 selecting the command.
5191 @item < <
5192 If there is an active region, restrict the following agenda command to
5193 the region.  Otherwise, restrict it to the current subtree@footnote{For
5194 backward compatibility, you can also press @kbd{0} to restrict to the
5195 current buffer.}.  After pressing @kbd{< <}, you still need to press the
5196 character selecting the command.
5197 @end table
5199 You can also define custom commands that will be accessible through the
5200 dispatcher, just like the default commands.  This includes the
5201 possibility to create extended agenda buffers that contain several
5202 blocks together, for example the weekly agenda, the global TODO list and
5203 a number of special tags matches.  @xref{Custom agenda views}.
5205 @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
5206 @section The built-in agenda views
5208 In this section we describe the built-in views.
5210 @menu
5211 * Weekly/daily agenda::         The calendar page with current tasks
5212 * Global TODO list::            All unfinished action items
5213 * Matching tags and properties::  Structured information with fine-tuned search
5214 * Timeline::                    Time-sorted view for single file
5215 * Keyword search::              Finding entries by keyword
5216 * Stuck projects::              Find projects you need to review
5217 @end menu
5219 @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
5220 @subsection The weekly/daily agenda
5221 @cindex agenda
5222 @cindex weekly agenda
5223 @cindex daily agenda
5225 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
5226 paper agenda, showing all the tasks for the current week or day.
5228 @table @kbd
5229 @cindex org-agenda, command
5230 @kindex C-c a a
5231 @item C-c a a
5232 Compile an agenda for the current week from a list of org files.  The
5233 agenda shows the entries for each day.  With a numeric
5234 prefix@footnote{For backward compatibility, the universal prefix
5235 @kbd{C-u} causes all TODO entries to be listed before the agenda.  This
5236 feature is deprecated, use the dedicated TODO list, or a block agenda
5237 instead.}  (like @kbd{C-u 2 1 C-c a a}) you may set the number of days
5238 to be displayed (see also the variable @code{org-agenda-ndays})
5239 @end table
5241 Remote editing from the agenda buffer means, for example, that you can
5242 change the dates of deadlines and appointments from the agenda buffer.
5243 The commands available in the Agenda buffer are listed in @ref{Agenda
5244 commands}.
5246 @subsubheading Calendar/Diary integration
5247 @cindex calendar integration
5248 @cindex diary integration
5250 Emacs contains the calendar and diary by Edward M. Reingold.  The
5251 calendar displays a three-month calendar with holidays from different
5252 countries and cultures.  The diary allows you to keep track of
5253 anniversaries, lunar phases, sunrise/set, recurrent appointments
5254 (weekly, monthly) and more.  In this way, it is quite complementary to
5255 Org.  It can be very useful to combine output from Org with
5256 the diary.
5258 In order to include entries from the Emacs diary into Org mode's
5259 agenda, you only need to customize the variable
5261 @lisp
5262 (setq org-agenda-include-diary t)
5263 @end lisp
5265 @noindent After that, everything will happen automatically.  All diary
5266 entries including holidays, anniversaries etc will be included in the
5267 agenda buffer created by Org mode.  @key{SPC}, @key{TAB}, and
5268 @key{RET} can be used from the agenda buffer to jump to the diary
5269 file in order to edit existing diary entries.  The @kbd{i} command to
5270 insert new entries for the current date works in the agenda buffer, as
5271 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
5272 Sunrise/Sunset times, show lunar phases and to convert to other
5273 calendars, respectively.  @kbd{c} can be used to switch back and forth
5274 between calendar and agenda.
5276 If you are using the diary only for sexp entries and holidays, it is
5277 faster to not use the above setting, but instead to copy or even move
5278 the entries into an Org file. Org mode evaluates diary-style sexp
5279 entries, and does it faster because there is no overhead for first
5280 creating the diary display.  Note that the sexp entries must start at
5281 the left margin, no white space is allowed before them.  For example,
5282 the following segment of an Org file will be processed and entries
5283 will be made in the agenda:
5285 @example
5286 * Birthdays and similar stuff
5287 #+CATEGORY: Holiday
5288 %%(org-calendar-holiday)   ; special function for holiday names
5289 #+CATEGORY: Ann
5290 %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
5291 %%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d years old
5292 @end example
5294 @subsubheading Appointment reminders
5295 @cindex @file{appt.el}
5296 @cindex appointment reminders
5298 Org can interact with Emacs appointments notification facility.
5300 To add all the appointments of your agenda files, use the command
5301 @code{org-agenda-to-appt}.  This commands also lets you filter through
5302 the list of your appointments and add only those belonging to a specific
5303 category or matching a regular expression. See the docstring for
5304 details.
5306 @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
5307 @subsection The global TODO list
5308 @cindex global TODO list
5309 @cindex TODO list, global
5311 The global TODO list contains all unfinished TODO items, formatted and
5312 collected into a single place.
5314 @table @kbd
5315 @kindex C-c a t
5316 @item C-c a t
5317 Show the global TODO list.  This collects the TODO items from all
5318 agenda files (@pxref{Agenda Views}) into a single buffer.  The buffer is in
5319 @code{agenda-mode}, so there are commands to examine and manipulate
5320 the TODO entries directly from that buffer (@pxref{Agenda commands}).
5321 @kindex C-c a T
5322 @item C-c a T
5323 @cindex TODO keyword matching
5324 Like the above, but allows selection of a specific TODO keyword.  You
5325 can also do this by specifying a prefix argument to @kbd{C-c a t}.  With
5326 a @kbd{C-u} prefix you are prompted for a keyword, and you may also
5327 specify several keywords by separating them with @samp{|} as boolean OR
5328 operator.  With a numeric prefix, the Nth keyword in
5329 @code{org-todo-keywords} is selected.
5330 @kindex r
5331 The @kbd{r} key in the agenda buffer regenerates it, and you can give
5332 a prefix argument to this command to change the selected TODO keyword,
5333 for example @kbd{3 r}.  If you often need a search for a specific
5334 keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
5335 Matching specific TODO keywords can also be done as part of a tags
5336 search (@pxref{Tag searches}).
5337 @end table
5339 Remote editing of TODO items means that you can change the state of a
5340 TODO entry with a single key press.  The commands available in the
5341 TODO list are described in @ref{Agenda commands}.
5343 @cindex sublevels, inclusion into TODO list
5344 Normally the global TODO list simply shows all headlines with TODO
5345 keywords.  This list can become very long.  There are two ways to keep
5346 it more compact:
5347 @itemize @minus
5348 @item
5349 Some people view a TODO item that has been @emph{scheduled} for
5350 execution (@pxref{Timestamps}) as no longer @emph{open}.  Configure the
5351 variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
5352 items from the global TODO list.
5353 @item
5354 TODO items may have sublevels to break up the task into subtasks.  In
5355 such cases it may be enough to list only the highest level TODO headline
5356 and omit the sublevels from the global list.  Configure the variable
5357 @code{org-agenda-todo-list-sublevels} to get this behavior.
5358 @end itemize
5360 @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
5361 @subsection Matching tags and properties
5362 @cindex matching, of tags
5363 @cindex matching, of properties
5364 @cindex tags view
5366 If headlines in the agenda files are marked with @emph{tags}
5367 (@pxref{Tags}), you can select headlines based on the tags that apply
5368 to them and collect them into an agenda buffer.
5370 @table @kbd
5371 @kindex C-c a m
5372 @item C-c a m
5373 Produce a list of all headlines that match a given set of tags.  The
5374 command prompts for a selection criterion, which is a boolean logic
5375 expression with tags, like @samp{+work+urgent-withboss} or
5376 @samp{work|home} (@pxref{Tags}).  If you often need a specific search,
5377 define a custom command for it (@pxref{Agenda dispatcher}).
5378 @kindex C-c a M
5379 @item C-c a M
5380 Like @kbd{C-c a m}, but only select headlines that are also TODO items
5381 and force checking subitems (see variable
5382 @code{org-tags-match-list-sublevels}).  Matching specific TODO keywords
5383 together with a tags match is also possible, see @ref{Tag searches}.
5384 @end table
5386 The commands available in the tags list are described in @ref{Agenda
5387 commands}.
5389 @node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
5390 @subsection Timeline for a single file
5391 @cindex timeline, single file
5392 @cindex time-sorted view
5394 The timeline summarizes all time-stamped items from a single Org mode
5395 file in a @emph{time-sorted view}.  The main purpose of this command is
5396 to give an overview over events in a project.
5398 @table @kbd
5399 @kindex C-c a L
5400 @item C-c a L
5401 Show a time-sorted view of the org file, with all time-stamped items.
5402 When called with a @kbd{C-u} prefix, all unfinished TODO entries
5403 (scheduled or not) are also listed under the current date.
5404 @end table
5406 @noindent
5407 The commands available in the timeline buffer are listed in
5408 @ref{Agenda commands}.
5410 @node Keyword search, Stuck projects, Timeline, Built-in agenda views
5411 @subsection Keyword search
5412 @cindex keyword search
5413 @cindex searching, for keywords
5415 This agenda view is a general text search facility for Org mode entries.
5416 It is particularly useful to find notes.
5418 @table @kbd
5419 @kindex C-c a s
5420 @item C-c a s
5421 This is a special search that lets you select entries by keywords or
5422 regular expression, using a boolean logic.  For example, the search
5423 string
5425 @example
5426 +computer +wifi -ethernet -@{8\.11[bg]@}
5427 @end example
5429 @noindent
5430 will search for note entries that contain the keywords @code{computer}
5431 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
5432 not matched by the regular expression @code{8\.11[bg]}, meaning to
5433 exclude both 8.11b and 8.11g.
5435 Note that in addition to the agenda files, this command will also search
5436 the files listed in @code{org-agenda-text-search-extra-files}.
5437 @end table
5439 @node Stuck projects,  , Keyword search, Built-in agenda views
5440 @subsection Stuck projects
5442 If you are following a system like David Allen's GTD to organize your
5443 work, one of the ``duties'' you have is a regular review to make sure
5444 that all projects move along.  A @emph{stuck} project is a project that
5445 has no defined next actions, so it will never show up in the TODO lists
5446 Org mode produces.  During the review, you need to identify such
5447 projects and define next actions for them.
5449 @table @kbd
5450 @kindex C-c a #
5451 @item C-c a #
5452 List projects that are stuck.
5453 @kindex C-c a !
5454 @item C-c a !
5455 Customize the variable @code{org-stuck-projects} to define what a stuck
5456 project is and how to find it.
5457 @end table
5459 You almost certainly will have to configure this view before it will
5460 work for you.  The built-in default assumes that all your projects are
5461 level-2 headlines, and that a project is not stuck if it has at least
5462 one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
5464 Lets assume that you, in your own way of using Org mode, identify
5465 projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
5466 indicate a project that should not be considered yet.  Lets further
5467 assume that the TODO keyword DONE marks finished projects, and that NEXT
5468 and TODO indicate next actions.  The tag @@SHOP indicates shopping and
5469 is a next action even without the NEXT tag.  Finally, if the project
5470 contains the special word IGNORE anywhere, it should not be listed
5471 either.  In this case you would start by identifying eligible projects
5472 with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
5473 TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
5474 are not stuck.  The correct customization for this is
5476 @lisp
5477 (setq org-stuck-projects
5478       '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
5479                                "\\<IGNORE\\>"))
5480 @end lisp
5483 @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
5484 @section Presentation and sorting
5485 @cindex presentation, of agenda items
5487 Before displaying items in an agenda view, Org mode visually prepares
5488 the items and sorts them.  Each item occupies a single line.  The line
5489 starts with a @emph{prefix} that contains the @emph{category}
5490 (@pxref{Categories}) of the item and other important information.  You can
5491 customize the prefix using the option @code{org-agenda-prefix-format}.
5492 The prefix is followed by a cleaned-up version of the outline headline
5493 associated with the item.
5495 @menu
5496 * Categories::                  Not all tasks are equal
5497 * Time-of-day specifications::  How the agenda knows the time
5498 * Sorting of agenda items::     The order of things
5499 @end menu
5501 @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
5502 @subsection Categories
5504 @cindex category
5505 The category is a broad label assigned to each agenda item.  By default,
5506 the category is simply derived from the file name, but you can also
5507 specify it with a special line in the buffer, like this@footnote{For
5508 backward compatibility, the following also works: If there are several
5509 such lines in a file, each specifies the category for the text below it.
5510 The first category also applies to any text before the first CATEGORY
5511 line.  However, using this method is @emph{strongly} deprecated as it is
5512 incompatible with the outline structure of the document.  The correct
5513 method for setting multiple categories in a buffer is using a
5514 property.}:
5516 @example
5517 #+CATEGORY: Thesis
5518 @end example
5520 @noindent
5521 If you would like to have a special CATEGORY for a single entry or a
5522 (sub)tree, give the entry a @code{:CATEGORY:} property with the location
5523 as the value (@pxref{Properties and Columns}).
5525 @noindent
5526 The display in the agenda buffer looks best if the category is not
5527 longer than 10 characters.
5529 @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
5530 @subsection Time-of-day specifications
5531 @cindex time-of-day specification
5533 Org mode checks each agenda item for a time-of-day specification.  The
5534 time can be part of the time stamp that triggered inclusion into the
5535 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}.  Time
5536 ranges can be specified with two time stamps, like
5538 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
5540 In the headline of the entry itself, a time(range) may also appear as
5541 plain text (like @samp{12:45} or a @samp{8:30-1pm}.  If the agenda
5542 integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
5543 specifications in diary entries are recognized as well.
5545 For agenda display, Org mode extracts the time and displays it in a
5546 standard 24 hour format as part of the prefix.  The example times in
5547 the previous paragraphs would end up in the agenda like this:
5549 @example
5550     8:30-13:00 Arthur Dent lies in front of the bulldozer
5551    12:45...... Ford Prefect arrives and takes Arthur to the pub
5552    19:00...... The Vogon reads his poem
5553    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5554 @end example
5556 @cindex time grid
5557 If the agenda is in single-day mode, or for the display of today, the
5558 timed entries are embedded in a time grid, like
5560 @example
5561     8:00...... ------------------
5562     8:30-13:00 Arthur Dent lies in front of the bulldozer
5563    10:00...... ------------------
5564    12:00...... ------------------
5565    12:45...... Ford Prefect arrives and takes Arthur to the pub
5566    14:00...... ------------------
5567    16:00...... ------------------
5568    18:00...... ------------------
5569    19:00...... The Vogon reads his poem
5570    20:00...... ------------------
5571    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5572 @end example
5574 The time grid can be turned on and off with the variable
5575 @code{org-agenda-use-time-grid}, and can be configured with
5576 @code{org-agenda-time-grid}.
5578 @node Sorting of agenda items,  , Time-of-day specifications, Presentation and sorting
5579 @subsection Sorting of agenda items
5580 @cindex sorting, of agenda items
5581 @cindex priorities, of agenda items
5582 Before being inserted into a view, the items are sorted.  How this is
5583 done depends on the type of view.
5584 @itemize @bullet
5585 @item
5586 For the daily/weekly agenda, the items for each day are sorted.  The
5587 default order is to first collect all items containing an explicit
5588 time-of-day specification.  These entries will be shown at the beginning
5589 of the list, as a @emph{schedule} for the day.  After that, items remain
5590 grouped in categories, in the sequence given by @code{org-agenda-files}.
5591 Within each category, items are sorted by priority (@pxref{Priorities}),
5592 which is composed of the base priority (2000 for priority @samp{A}, 1000
5593 for @samp{B}, and 0 for @samp{C}), plus additional increments for
5594 overdue scheduled or deadline items.
5595 @item
5596 For the TODO list, items remain in the order of categories, but within
5597 each category, sorting takes place according to priority
5598 (@pxref{Priorities}).
5599 @item
5600 For tags matches, items are not sorted at all, but just appear in the
5601 sequence in which they are found in the agenda files.
5602 @end itemize
5604 Sorting can be customized using the variable
5605 @code{org-agenda-sorting-strategy}, and may also include criteria based on
5606 the estimated effort of an entry.
5607 @c FIXME: link!!!!!!!!
5610 @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
5611 @section Commands in the agenda buffer
5612 @cindex commands, in agenda buffer
5614 Entries in the agenda buffer are linked back to the org file or diary
5615 file where they originate.  You are not allowed to edit the agenda
5616 buffer itself, but commands are provided to show and jump to the
5617 original entry location, and to edit the org-files ``remotely'' from
5618 the agenda buffer.  In this way, all information is stored only once,
5619 removing the risk that your agenda and note files may diverge.
5621 Some commands can be executed with mouse clicks on agenda lines.  For
5622 the other commands, the cursor needs to be in the desired line.
5624 @table @kbd
5625 @tsubheading{Motion}
5626 @cindex motion commands in agenda
5627 @kindex n
5628 @item n
5629 Next line (same as @key{up} and @kbd{C-p}).
5630 @kindex p
5631 @item p
5632 Previous line (same as @key{down} and @kbd{C-n}).
5633 @tsubheading{View/Go to org file}
5634 @kindex mouse-3
5635 @kindex @key{SPC}
5636 @item mouse-3
5637 @itemx @key{SPC}
5638 Display the original location of the item in another window.
5640 @kindex L
5641 @item L
5642 Display original location and recenter that window.
5644 @kindex mouse-2
5645 @kindex mouse-1
5646 @kindex @key{TAB}
5647 @item mouse-2
5648 @itemx mouse-1
5649 @itemx @key{TAB}
5650 Go to the original location of the item in another window.  Under Emacs
5651 22, @kbd{mouse-1} will also works for this.
5653 @kindex @key{RET}
5654 @itemx @key{RET}
5655 Go to the original location of the item and delete other windows.
5657 @kindex f
5658 @item f
5659 Toggle Follow mode.  In Follow mode, as you move the cursor through
5660 the agenda buffer, the other window always shows the corresponding
5661 location in the org file.  The initial setting for this mode in new
5662 agenda buffers can be set with the variable
5663 @code{org-agenda-start-with-follow-mode}.
5665 @kindex b
5666 @item b
5667 Display the entire subtree of the current item in an indirect buffer.  With a
5668 numeric prefix argument N, go up to level N and then take that tree.  If N is
5669 negative, go up that many levels.  With a @kbd{C-u} prefix, do not remove the
5670 previously used indirect buffer.
5672 @kindex l
5673 @item l
5674 Toggle Logbook mode.  In Logbook mode, entries that where marked DONE while
5675 logging was on (variable @code{org-log-done}) are shown in the agenda,
5676 as are entries that have been clocked on that day.
5678 @kindex R
5679 @item R
5680 Toggle Clockreport mode.  In clockreport mode, the daily/weekly agenda will
5681 always show a table with the clocked times for the timespan and file scope
5682 covered by the current agenda view.  The initial setting for this mode in new
5683 agenda buffers can be set with the variable
5684 @code{org-agenda-start-with-clockreport-mode}.
5686 @tsubheading{Change display}
5687 @cindex display changing, in agenda
5688 @kindex o
5689 @item o
5690 Delete other windows.
5692 @kindex d
5693 @kindex w
5694 @kindex m
5695 @kindex y
5696 @item d w m y
5697 Switch to day/week/month/year view.  When switching to day or week view,
5698 this setting becomes the default for subsequent agenda commands.  Since
5699 month and year views are slow to create, they do not become the default.
5700 A numeric prefix argument may be used to jump directly to a specific day
5701 of the year, ISO week, month, or year, respectively.  For example,
5702 @kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9.  When
5703 setting day, week, or month view, a year may be encoded in the prefix
5704 argument as well.  For example, @kbd{200712 w} will jump to week 12 in
5705 2007.  If such a year specification has only one or two digits, it will
5706 be mapped to the interval 1938-2037.
5708 @kindex D
5709 @item D
5710 Toggle the inclusion of diary entries.  See @ref{Weekly/daily agenda}.
5712 @kindex G
5713 @item G
5714 Toggle the time grid on and off.  See also the variables
5715 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
5717 @kindex r
5718 @item r
5719 Recreate the agenda buffer, for example to reflect the changes
5720 after modification of the time stamps of items with S-@key{left} and
5721 S-@key{right}.  When the buffer is the global TODO list, a prefix
5722 argument is interpreted to create a selective list for a specific TODO
5723 keyword.
5724 @kindex g
5725 @item g
5726 Same as @kbd{r}.
5728 @kindex s
5729 @kindex C-x C-s
5730 @item s
5731 @itemx C-x C-s
5732 Save all Org buffers in the current Emacs session.
5734 @kindex @key{right}
5735 @item @key{right}
5736 Display the following @code{org-agenda-ndays} days.  For example, if
5737 the display covers a week, switch to the following week.  With prefix
5738 arg, go forward that many times @code{org-agenda-ndays} days.
5740 @kindex @key{left}
5741 @item @key{left}
5742 Display the previous dates.
5744 @kindex .
5745 @item .
5746 Go to today.
5748 @kindex C-c C-x C-c
5749 @item C-c C-x C-c
5750 Invoke column view (@pxref{Column view}) in the agenda buffer.  The column
5751 view format is taken from the entry at point, or (if there is no entry at
5752 point), from the first entry in the agenda view.  So whatever the format for
5753 that entry would be in the original buffer (taken from a property, from a
5754 @code{#+COLUMNS} line, or from the default variable
5755 @code{org-columns-default-format}), will be used in the agenda.
5757 @tsubheading{Query editing}
5758 @cindex query editing, in agenda
5760 @kindex [
5761 @kindex ]
5762 @kindex @{
5763 @kindex @}
5764 @item [ ] @{ @}
5765 In the @i{search view} (@pxref{Keyword search}), these keys add new
5766 search words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{}
5767 and @kbd{@}}) to the query string.  The opening bracket/brace will add a
5768 positive search term prefixed by @samp{+}, indicating that this search
5769 term @i{must} occur/match in the entry.  Closing bracket/brace add a
5770 negative search term which @i{must not} occur/match in the entry for it
5771 to be selected.
5774 @tsubheading{Remote editing}
5775 @cindex remote editing, from agenda
5777 @item 0-9
5778 Digit argument.
5780 @cindex undoing remote-editing events
5781 @cindex remote editing, undo
5782 @kindex C-_
5783 @item C-_
5784 Undo a change due to a remote editing command.  The change is undone
5785 both in the agenda buffer and in the remote buffer.
5787 @kindex t
5788 @item t
5789 Change the TODO state of the item, both in the agenda and in the
5790 original org file.
5792 @kindex C-k
5793 @item C-k
5794 Delete the current agenda item along with the entire subtree belonging
5795 to it in the original Org file.  If the text to be deleted remotely
5796 is longer than one line, the kill needs to be confirmed by the user.  See
5797 variable @code{org-agenda-confirm-kill}.
5799 @kindex a
5800 @item a
5801 Toggle the ARCHIVE tag for the current headline.
5803 @kindex A
5804 @item A
5805 Move the subtree corresponding to the current entry to its @emph{Archive
5806 Sibling}.
5808 @kindex $
5809 @item $
5810 Archive the subtree corresponding to the current headline.  This means the
5811 entry will be moved to the configured archive location, most likely a
5812 different file.
5814 @kindex T
5815 @item T
5816 Show all tags associated with the current item.  Because of
5817 inheritance, this may be more than the tags listed in the line itself.
5819 @kindex :
5820 @item :
5821 Set tags for the current headline.  If there is an active region in the
5822 agenda, change a tag for all headings in the region.
5824 @kindex ,
5825 @item ,
5826 Set the priority for the current item.  Org mode prompts for the
5827 priority character. If you reply with @key{SPC}, the priority cookie
5828 is removed from the entry.
5830 @kindex P
5831 @item P
5832 Display weighted priority of current item.
5834 @kindex +
5835 @kindex S-@key{up}
5836 @item +
5837 @itemx S-@key{up}
5838 Increase the priority of the current item.  The priority is changed in
5839 the original buffer, but the agenda is not resorted.  Use the @kbd{r}
5840 key for this.
5842 @kindex -
5843 @kindex S-@key{down}
5844 @item -
5845 @itemx S-@key{down}
5846 Decrease the priority of the current item.
5848 @kindex C-c C-s
5849 @item C-c C-s
5850 Schedule this item
5852 @kindex C-c C-d
5853 @item C-c C-d
5854 Set a deadline for this item.
5856 @kindex S-@key{right}
5857 @item S-@key{right}
5858 Change the time stamp associated with the current line by one day into the
5859 future.  With a numeric prefix argument, change it by that many days.  For
5860 example, @kbd{3 6 5 S-@key{right}} will change it by a year.  The stamp is
5861 changed in the original org file, but the change is not directly reflected in
5862 the agenda buffer.  Use the @kbd{r} key to update the buffer.
5864 @kindex S-@key{left}
5865 @item S-@key{left}
5866 Change the time stamp associated with the current line by one day
5867 into the past.
5869 @kindex >
5870 @item >
5871 Change the time stamp associated with the current line to today.
5872 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
5873 on my keyboard.
5875 @kindex I
5876 @item I
5877 Start the clock on the current item.  If a clock is running already, it
5878 is stopped first.
5880 @kindex O
5881 @item O
5882 Stop the previously started clock.
5884 @kindex X
5885 @item X
5886 Cancel the currently running clock.
5888 @kindex J
5889 @item J
5890 Jump to the running clock in another window.
5892 @tsubheading{Calendar commands}
5893 @cindex calendar commands, from agenda
5894 @kindex c
5895 @item c
5896 Open the Emacs calendar and move to the date at the agenda cursor.
5898 @item c
5899 When in the calendar, compute and show the Org mode agenda for the
5900 date at the cursor.
5902 @cindex diary entries, creating from agenda
5903 @kindex i
5904 @item i
5905 Insert a new entry into the diary.  Prompts for the type of entry
5906 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
5907 entry in the diary, just as @kbd{i d} etc. would do in the calendar.
5908 The date is taken from the cursor position.
5910 @kindex M
5911 @item M
5912 Show the phases of the moon for the three months around current date.
5914 @kindex S
5915 @item S
5916 Show sunrise and sunset times.  The geographical location must be set
5917 with calendar variables, see documentation of the Emacs calendar.
5919 @kindex C
5920 @item C
5921 Convert the date at cursor into many other cultural and historic
5922 calendars.
5924 @kindex H
5925 @item H
5926 Show holidays for three month around the cursor date.
5928 @item M-x org-export-icalendar-combine-agenda-files
5929 Export a single iCalendar file containing entries from all agenda files.
5930 This is a globally available command, and also available in the agenda menu.
5932 @tsubheading{Exporting to a file}
5933 @kindex C-x C-w
5934 @item C-x C-w
5935 @cindex exporting agenda views
5936 @cindex agenda views, exporting
5937 Write the agenda view to a file.  Depending on the extension of the
5938 selected file name, the view will be exported as HTML (extension
5939 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
5940 plain text (any other extension).  Use the variable
5941 @code{org-agenda-exporter-settings} to set options for @file{ps-print}
5942 and for @file{htmlize} to be used during export.
5944 @tsubheading{Quit and Exit}
5945 @kindex q
5946 @item q
5947 Quit agenda, remove the agenda buffer.
5949 @kindex x
5950 @cindex agenda files, removing buffers
5951 @item x
5952 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
5953 for the compilation of the agenda.  Buffers created by the user to
5954 visit org files will not be removed.
5955 @end table
5958 @node Custom agenda views, Agenda column view, Agenda commands, Agenda Views
5959 @section Custom agenda views
5960 @cindex custom agenda views
5961 @cindex agenda views, custom
5963 Custom agenda commands serve two purposes: to store and quickly access
5964 frequently used TODO and tags searches, and to create special composite
5965 agenda buffers.  Custom agenda commands will be accessible through the
5966 dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
5968 @menu
5969 * Storing searches::            Type once, use often
5970 * Block agenda::                All the stuff you need in a single buffer
5971 * Setting Options::             Changing the rules
5972 * Exporting Agenda Views::      Writing agendas to files
5973 * Using the agenda elsewhere::  Using agenda information in other programs
5974 @end menu
5976 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
5977 @subsection Storing searches
5979 The first application of custom searches is the definition of keyboard
5980 shortcuts for frequently used searches, either creating an agenda
5981 buffer, or a sparse tree (the latter covering of course only the current
5982 buffer).
5983 @kindex C-c a C
5984 Custom commands are configured in the variable
5985 @code{org-agenda-custom-commands}.  You can customize this variable, for
5986 example by pressing @kbd{C-c a C}.  You can also directly set it with
5987 Emacs Lisp in @file{.emacs}.  The following example contains all valid
5988 search types:
5990 @lisp
5991 @group
5992 (setq org-agenda-custom-commands
5993       '(("w" todo "WAITING")
5994         ("W" todo-tree "WAITING")
5995         ("u" tags "+boss-urgent")
5996         ("v" tags-todo "+boss-urgent")
5997         ("U" tags-tree "+boss-urgent")
5998         ("f" occur-tree "\\<FIXME\\>")
5999         ("h" . "HOME+Name tags searches") ; description for "h" prefix
6000         ("hl" tags "+home+Lisa")
6001         ("hp" tags "+home+Peter")
6002         ("hk" tags "+home+Kim")))
6003 @end group
6004 @end lisp
6006 @noindent
6007 The initial string in each entry defines the keys you have to press
6008 after the dispatcher command @kbd{C-c a} in order to access the command.
6009 Usually this will be just a single character, but if you have many
6010 similar commands, you can also define two-letter combinations where the
6011 first character is the same in several combinations and serves as a
6012 prefix key@footnote{You can provide a description for a prefix key by
6013 inserting a cons cell with the prefix and the description.}.  The second
6014 parameter is the search type, followed by the string or regular
6015 expression to be used for the matching.  The example above will
6016 therefore define:
6018 @table @kbd
6019 @item C-c a w
6020 as a global search for TODO entries with @samp{WAITING} as the TODO
6021 keyword
6022 @item C-c a W
6023 as the same search, but only in the current buffer and displaying the
6024 results as a sparse tree
6025 @item C-c a u
6026 as a global tags search for headlines marked @samp{:boss:} but not
6027 @samp{:urgent:}
6028 @item C-c a v
6029 as the same search as @kbd{C-c a u}, but limiting the search to
6030 headlines that are also TODO items
6031 @item C-c a U
6032 as the same search as @kbd{C-c a u}, but only in the current buffer and
6033 displaying the result as a sparse tree
6034 @item C-c a f
6035 to create a sparse tree (again: current buffer only) with all entries
6036 containing the word @samp{FIXME}
6037 @item C-c a h
6038 as a prefix command for a HOME tags search where you have to press an
6039 additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
6040 Peter, or Kim) as additional tag to match.
6041 @end table
6043 @node Block agenda, Setting Options, Storing searches, Custom agenda views
6044 @subsection Block agenda
6045 @cindex block agenda
6046 @cindex agenda, with block views
6048 Another possibility is the construction of agenda views that comprise
6049 the results of @emph{several} commands, each of which creates a block in
6050 the agenda buffer.  The available commands include @code{agenda} for the
6051 daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
6052 for the global TODO list (as constructed with @kbd{C-c a t}), and the
6053 matching commands discussed above: @code{todo}, @code{tags}, and
6054 @code{tags-todo}.  Here are two examples:
6056 @lisp
6057 @group
6058 (setq org-agenda-custom-commands
6059       '(("h" "Agenda and Home-related tasks"
6060          ((agenda "")
6061           (tags-todo "home")
6062           (tags "garden")))
6063         ("o" "Agenda and Office-related tasks"
6064          ((agenda "")
6065           (tags-todo "work")
6066           (tags "office")))))
6067 @end group
6068 @end lisp
6070 @noindent
6071 This will define @kbd{C-c a h} to create a multi-block view for stuff
6072 you need to attend to at home.  The resulting agenda buffer will contain
6073 your agenda for the current week, all TODO items that carry the tag
6074 @samp{home}, and also all lines tagged with @samp{garden}.  Finally the
6075 command @kbd{C-c a o} provides a similar view for office tasks.
6077 @node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
6078 @subsection Setting options for custom commands
6079 @cindex options, for custom agenda views
6081 Org mode contains a number of variables regulating agenda construction
6082 and display.  The global variables define the behavior for all agenda
6083 commands, including the custom commands.  However, if you want to change
6084 some settings just for a single custom view, you can do so.  Setting
6085 options requires inserting a list of variable names and values at the
6086 right spot in @code{org-agenda-custom-commands}.  For example:
6088 @lisp
6089 @group
6090 (setq org-agenda-custom-commands
6091       '(("w" todo "WAITING"
6092          ((org-agenda-sorting-strategy '(priority-down))
6093           (org-agenda-prefix-format "  Mixed: ")))
6094         ("U" tags-tree "+boss-urgent"
6095          ((org-show-following-heading nil)
6096           (org-show-hierarchy-above nil)))
6097         ("N" search ""
6098          ((org-agenda-files '("~org/notes.org"))
6099           (org-agenda-text-search-extra-files nil)))))
6100 @end group
6101 @end lisp
6103 @noindent
6104 Now the @kbd{C-c a w} command will sort the collected entries only by
6105 priority, and the prefix format is modified to just say @samp{  Mixed: }
6106 instead of giving the category of the entry.  The sparse tags tree of
6107 @kbd{C-c a U} will now turn out ultra-compact, because neither the
6108 headline hierarchy above the match, nor the headline following the match
6109 will be shown.  The command @kbd{C-c a N} will do a text search limited
6110 to only a single file.
6112 For command sets creating a block agenda,
6113 @code{org-agenda-custom-commands} has two separate spots for setting
6114 options.  You can add options that should be valid for just a single
6115 command in the set, and options that should be valid for all commands in
6116 the set.  The former are just added to the command entry, the latter
6117 must come after the list of command entries.  Going back to the block
6118 agenda example (@pxref{Block agenda}), let's change the sorting strategy
6119 for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
6120 the results for GARDEN tags query in the opposite order,
6121 @code{priority-up}.  This would look like this:
6123 @lisp
6124 @group
6125 (setq org-agenda-custom-commands
6126       '(("h" "Agenda and Home-related tasks"
6127          ((agenda)
6128           (tags-todo "home")
6129           (tags "garden"
6130                 ((org-agenda-sorting-strategy '(priority-up)))))
6131          ((org-agenda-sorting-strategy '(priority-down))))
6132         ("o" "Agenda and Office-related tasks"
6133          ((agenda)
6134           (tags-todo "work")
6135           (tags "office")))))
6136 @end group
6137 @end lisp
6139 As you see, the values and parenthesis setting is a little complex.
6140 When in doubt, use the customize interface to set this variable - it
6141 fully supports its structure.  Just one caveat: When setting options in
6142 this interface, the @emph{values} are just lisp expressions.  So if the
6143 value is a string, you need to add the double quotes around the value
6144 yourself.
6147 @node Exporting Agenda Views, Using the agenda elsewhere, Setting Options, Custom agenda views
6148 @subsection Exporting Agenda Views
6149 @cindex agenda views, exporting
6151 If you are away from your computer, it can be very useful to have a
6152 printed version of some agenda views to carry around.  Org mode can
6153 export custom agenda views as plain text, HTML@footnote{You need to
6154 install Hrvoje Niksic' @file{htmlize.el}.} postscript, and iCalendar
6155 files.  If you want to do this only occasionally, use the command
6157 @table @kbd
6158 @kindex C-x C-w
6159 @item C-x C-w
6160 @cindex exporting agenda views
6161 @cindex agenda views, exporting
6162 Write the agenda view to a file.  Depending on the extension of the
6163 selected file name, the view will be exported as HTML (extension
6164 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
6165 iCalendar (extension @file{.ics}), or plain text (any other extension).
6166 Use the variable @code{org-agenda-exporter-settings} to
6167 set options for @file{ps-print} and for @file{htmlize} to be used during
6168 export, for example
6170 @lisp
6171 (setq org-agenda-exporter-settings
6172       '((ps-number-of-columns 2)
6173         (ps-landscape-mode t)
6174         (htmlize-output-type 'css)))
6175 @end lisp
6176 @end table
6178 If you need to export certain agenda views frequently, you can associate
6179 any custom agenda command with a list of output file names
6180 @footnote{If you want to store standard views like the weekly agenda
6181 or the global TODO list as well, you need to define custom commands for
6182 them in order to be able to specify file names.}.  Here is an example
6183 that first does define custom commands for the agenda and the global
6184 todo list, together with a number of files to which to export them.
6185 Then we define two block agenda commands and specify file names for them
6186 as well.  File names can be relative to the current working directory,
6187 or absolute.
6189 @lisp
6190 @group
6191 (setq org-agenda-custom-commands
6192       '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
6193         ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
6194         ("h" "Agenda and Home-related tasks"
6195          ((agenda "")
6196           (tags-todo "home")
6197           (tags "garden"))
6198          nil
6199          ("~/views/home.html"))
6200         ("o" "Agenda and Office-related tasks"
6201          ((agenda)
6202           (tags-todo "work")
6203           (tags "office"))
6204          nil
6205          ("~/views/office.ps" "~/calendars/office.ics"))))
6206 @end group
6207 @end lisp
6209 The extension of the file name determines the type of export.  If it is
6210 @file{.html}, Org mode will use the @file{htmlize.el} package to convert
6211 the buffer to HTML and save it to this file name.  If the extension is
6212 @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
6213 postscript output.  If the extension is @file{.ics}, iCalendar export is
6214 run export over all files that were used to construct the agenda, and
6215 limit the export to entries listed in the agenda now.  Any other
6216 extension produces a plain ASCII file.
6218 The export files are @emph{not} created when you use one of those
6219 commands interactively because this might use too much overhead.
6220 Instead, there is a special command to produce @emph{all} specified
6221 files in one step:
6223 @table @kbd
6224 @kindex C-c a e
6225 @item C-c a e
6226 Export all agenda views that have export file names associated with
6227 them.
6228 @end table
6230 You can use the options section of the custom agenda commands to also
6231 set options for the export commands.  For example:
6233 @lisp
6234 (setq org-agenda-custom-commands
6235       '(("X" agenda ""
6236          ((ps-number-of-columns 2)
6237           (ps-landscape-mode t)
6238           (org-agenda-prefix-format " [ ] ")
6239           (org-agenda-with-colors nil)
6240           (org-agenda-remove-tags t))
6241          ("theagenda.ps"))))
6242 @end lisp
6244 @noindent
6245 This command sets two options for the postscript exporter, to make it
6246 print in two columns in landscape format - the resulting page can be cut
6247 in two and then used in a paper agenda.  The remaining settings modify
6248 the agenda prefix to omit category and scheduling information, and
6249 instead include a checkbox to check off items.  We also remove the tags
6250 to make the lines compact, and we don't want to use colors for the
6251 black-and-white printer.  Settings specified in
6252 @code{org-agenda-exporter-settings} will also apply, but the settings
6253 in @code{org-agenda-custom-commands} take precedence.
6255 @noindent
6256 From the command line you may also use
6257 @example
6258 emacs -f org-batch-store-agenda-views -kill
6259 @end example
6260 @noindent
6261 or, if you need to modify some parameters
6262 @example
6263 emacs -eval '(org-batch-store-agenda-views                      \
6264               org-agenda-ndays 30                               \
6265               org-agenda-start-day "2007-11-01"                 \
6266               org-agenda-include-diary nil                      \
6267               org-agenda-files (quote ("~/org/project.org")))'  \
6268       -kill
6269 @end example
6270 @noindent
6271 which will create the agenda views restricted to the file
6272 @file{~/org/project.org}, without diary entries and with 30 days
6273 extent.
6275 @node Using the agenda elsewhere,  , Exporting Agenda Views, Custom agenda views
6276 @subsection Using agenda information outside of Org
6277 @cindex agenda, pipe
6278 @cindex Scripts, for agenda processing
6280 Org provides commands to access agenda information for the command
6281 line in emacs batch mode.  This extracted information can be sent
6282 directly to a printer, or it can be read by a program that does further
6283 processing of the data.  The first of these commands is the function
6284 @code{org-batch-agenda}, that produces an agenda view and sends it as
6285 ASCII text to STDOUT.  The command takes a single string as parameter.
6286 If the string has length 1, it is used as a key to one of the commands
6287 you have configured in @code{org-agenda-custom-commands}, basically any
6288 key you can use after @kbd{C-c a}.  For example, to directly print the
6289 current TODO list, you could use
6291 @example
6292 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
6293 @end example
6295 If the parameter is a string with 2 or more characters, it is used as a
6296 tags/todo match string.  For example, to print your local shopping list
6297 (all items with the tag @samp{shop}, but excluding the tag
6298 @samp{NewYork}), you could use
6300 @example
6301 emacs -batch -l ~/.emacs                                      \
6302       -eval '(org-batch-agenda "+shop-NewYork")' | lpr
6303 @end example
6305 @noindent
6306 You may also modify parameters on the fly like this:
6308 @example
6309 emacs -batch -l ~/.emacs                                      \
6310    -eval '(org-batch-agenda "a"                               \
6311             org-agenda-ndays 30                               \
6312             org-agenda-include-diary nil                      \
6313             org-agenda-files (quote ("~/org/project.org")))'  \
6314    | lpr
6315 @end example
6317 @noindent
6318 which will produce a 30 day agenda, fully restricted to the Org file
6319 @file{~/org/projects.org}, not even including the diary.
6321 If you want to process the agenda data in more sophisticated ways, you
6322 can use the command @code{org-batch-agenda-csv} to get a comma-separated
6323 list of values for each agenda item.  Each line in the output will
6324 contain a number of fields separated by commas.  The fields in a line
6325 are:
6327 @example
6328 category     @r{The category of the item}
6329 head         @r{The headline, without TODO kwd, TAGS and PRIORITY}
6330 type         @r{The type of the agenda entry, can be}
6331                 todo               @r{selected in TODO match}
6332                 tagsmatch          @r{selected in tags match}
6333                 diary              @r{imported from diary}
6334                 deadline           @r{a deadline}
6335                 scheduled          @r{scheduled}
6336                 timestamp          @r{appointment, selected by timestamp}
6337                 closed             @r{entry was closed on date}
6338                 upcoming-deadline  @r{warning about nearing deadline}
6339                 past-scheduled     @r{forwarded scheduled item}
6340                 block              @r{entry has date block including date}
6341 todo         @r{The TODO keyword, if any}
6342 tags         @r{All tags including inherited ones, separated by colons}
6343 date         @r{The relevant date, like 2007-2-14}
6344 time         @r{The time, like 15:00-16:50}
6345 extra        @r{String with extra planning info}
6346 priority-l   @r{The priority letter if any was given}
6347 priority-n   @r{The computed numerical priority}
6348 @end example
6350 @noindent
6351 Time and date will only be given if a timestamp (or deadline/scheduled)
6352 lead to the selection of the item.
6354 A CSV list like this is very easy to use in a post processing script.
6355 For example, here is a Perl program that gets the TODO list from
6356 Emacs/Org and prints all the items, preceded by a checkbox:
6358 @example
6359 @group
6360 #!/usr/bin/perl
6362 # define the Emacs command to run
6363 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
6365 # run it and capture the output
6366 $agenda = qx@{$cmd 2>/dev/null@};
6368 # loop over all lines
6369 foreach $line (split(/\n/,$agenda)) @{
6371   # get the individual values
6372   ($category,$head,$type,$todo,$tags,$date,$time,$extra,
6373    $priority_l,$priority_n) = split(/,/,$line);
6375   # proccess and print
6376   print "[ ] $head\n";
6378 @end group
6379 @end example
6381 @node Agenda column view,  , Custom agenda views, Agenda Views
6382 @section Using column view in the agenda
6383 @cindex column view, in agenda
6384 @cindex agenda, column view
6386 Column view (@pxref{Column view}) is normally used to view and edit
6387 properties embedded in the hierarchical structure of an Org file.  It can be
6388 quite useful to use column view also from the agenda, where entries are
6389 collected by certain criteria.
6391 @table @kbd
6392 @kindex C-c C-x C-c
6393 @item C-c C-x C-c
6394 Turn on column view in the agenda.
6395 @end table
6397 To understand how to use this properly, it is important to realize that the
6398 entries in the agenda are no longer in their proper outline environment.
6399 This causes the following issues:
6401 @enumerate
6402 @item
6403 Org needs to make a decision which @code{COLUMNS} format to use.  Since the
6404 entries in the agenda are collected from different files, and different files
6405 may have different @code{COLUMNS} formats, this is a non-trivial problem.
6406 Org first checks if the variable @code{org-overriding-columns-format} is
6407 currently set, and if yes takes the format from there.  Otherwise it takes
6408 the format associated with the first item in the agenda, or, if that item
6409 does not have a specific format (defined in a property, or in it's file), it
6410 uses @code{org-columns-default-format}.
6411 @item
6412 If any of the columns has a summary type defined (@pxref{Column attributes}),
6413 turning on column view in the agenda will visit all relevant agenda files and
6414 make sure that the computations of this property are up to date.  This is
6415 also true for the special @code{CLOCKSUM} property.  Org will then sum the
6416 values displayed in the agenda.  In the daily/weekly agenda, the sums will
6417 cover a single day, in all other views they cover the entire block.  It is
6418 vital to realize that the agenda may show the same entry @emph{twice} (for
6419 example as scheduled and as a deadline), and it may show two entries from the
6420 same hierarchy (for example a @emph{parent} and it's @emph{child}).  In these
6421 cases, the summation in the agenda will lead to incorrect results because
6422 some values will count double.
6423 @item
6424 When the column view in the agenda shows the @code{CLOCKSUM}, that is always
6425 the entire clocked time for this item.  So even in the daily/weekly agenda,
6426 the clocksum listed in column view may originate from times outside the
6427 current view.  This has the advantage that you can compare these values with
6428 a column listing the planned total effort for a task - one of the major
6429 applications for column view in the agenda.  If you want information about
6430 clocked time in the displayed period use clock table mode (press @kbd{R} in
6431 the agenda).
6432 @end enumerate
6435 @node Embedded LaTeX, Exporting, Agenda Views, Top
6436 @chapter Embedded LaTeX
6437 @cindex @TeX{} interpretation
6438 @cindex La@TeX{} interpretation
6440 Plain ASCII is normally sufficient for almost all note taking.  One
6441 exception, however, are scientific notes which need to be able to contain
6442 mathematical symbols and the occasional formula.  La@TeX{}@footnote{La@TeX{}
6443 is a macro system based on Donald E. Knuth's @TeX{} system.  Many of the
6444 features described here as ``La@TeX{}'' are really from @TeX{}, but for
6445 simplicity I am blurring this distinction.}  is widely used to typeset
6446 scientific documents. Org mode supports embedding La@TeX{} code into its
6447 files, because many academics are used to reading La@TeX{} source code, and
6448 because it can be readily processed into images for HTML production.
6450 It is not necessary to mark La@TeX{} macros and code in any special way.
6451 If you observe a few conventions, Org mode knows how to find it and what
6452 to do with it.
6454 @menu
6455 * Math symbols::                TeX macros for symbols and Greek letters
6456 * Subscripts and superscripts::  Simple syntax for raising/lowering text
6457 * LaTeX fragments::             Complex formulas made easy
6458 * Processing LaTeX fragments::  Previewing LaTeX processing
6459 * CDLaTeX mode::                Speed up entering of formulas
6460 @end menu
6462 @node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
6463 @section Math symbols
6464 @cindex math symbols
6465 @cindex TeX macros
6467 You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
6468 to indicate the Greek letter, or @samp{\to} to indicate an arrow.
6469 Completion for these macros is available, just type @samp{\} and maybe a
6470 few letters, and press @kbd{M-@key{TAB}} to see possible completions.
6471 Unlike La@TeX{} code, Org mode allows these macros to be present
6472 without surrounding math delimiters, for example:
6474 @example
6475 Angles are written as Greek letters \alpha, \beta and \gamma.
6476 @end example
6478 During HTML export (@pxref{HTML export}), these symbols are translated
6479 into the proper syntax for HTML, for the above examples this is
6480 @samp{&alpha;} and @samp{&rarr;}, respectively.
6482 @node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
6483 @section Subscripts and superscripts
6484 @cindex subscript
6485 @cindex superscript
6487 Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
6488 and subscripts.  Again, these can be used without embedding them in
6489 math-mode delimiters.  To increase the readability of ASCII text, it is
6490 not necessary (but OK) to surround multi-character sub- and superscripts
6491 with curly braces.  For example
6493 @example
6494 The mass if the sun is M_sun = 1.989 x 10^30 kg.  The radius of
6495 the sun is R_@{sun@} = 6.96 x 10^8 m.
6496 @end example
6498 To avoid interpretation as raised or lowered text, you can quote
6499 @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
6501 During HTML export (@pxref{HTML export}), subscript and superscripts
6502 are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
6504 @node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
6505 @section LaTeX fragments
6506 @cindex LaTeX fragments
6508 With symbols, sub- and superscripts, HTML is pretty much at its end when
6509 it comes to representing mathematical formulas@footnote{Yes, there is
6510 MathML, but that is not yet fully supported by many browsers, and there
6511 is no decent converter for turning La@TeX{} or ASCII representations of
6512 formulas into MathML. So for the time being, converting formulas into
6513 images seems the way to go.}. More complex expressions need a dedicated
6514 formula processor. To this end, Org mode can contain arbitrary La@TeX{}
6515 fragments. It provides commands to preview the typeset result of these
6516 fragments, and upon export to HTML, all fragments will be converted to
6517 images and inlined into the HTML document@footnote{The La@TeX{} export
6518 will not use images for displaying La@TeX{} fragments but include these
6519 fragments directly into the La@TeX{} code.}. For this to work you
6520 need to be on a system with a working La@TeX{} installation. You also
6521 need the @file{dvipng} program, available at
6522 @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
6523 will be used when processing a fragment can be configured with the
6524 variable @code{org-format-latex-header}.
6526 La@TeX{} fragments don't need any special marking at all.  The following
6527 snippets will be identified as La@TeX{} source code:
6528 @itemize @bullet
6529 @item
6530 Environments of any kind.  The only requirement is that the
6531 @code{\begin} statement appears on a new line, preceded by only
6532 whitespace.
6533 @item
6534 Text within the usual La@TeX{} math delimiters.  To avoid conflicts with
6535 currency specifications, single @samp{$} characters are only recognized
6536 as math delimiters if the enclosed text contains at most two line breaks,
6537 is directly attached to the @samp{$} characters with no whitespace in
6538 between, and if the closing @samp{$} is followed by whitespace or
6539 punctuation.  For the other delimiters, there is no such restriction, so
6540 when in doubt, use @samp{\(...\)} as inline math delimiters.
6541 @end itemize
6543 @noindent For example:
6545 @example
6546 \begin@{equation@}                          % arbitrary environments,
6547 x=\sqrt@{b@}                                % even tables, figures
6548 \end@{equation@}                            % etc
6550 If $a^2=b$ and \( b=2 \), then the solution must be
6551 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
6552 @end example
6554 @noindent
6555 If you need any of the delimiter ASCII sequences for other purposes, you
6556 can configure the option @code{org-format-latex-options} to deselect the
6557 ones you do not wish to have interpreted by the La@TeX{} converter.
6559 @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
6560 @section Processing LaTeX fragments
6561 @cindex LaTeX fragments, preview
6563 La@TeX{} fragments can be processed to produce a preview images of the
6564 typeset expressions:
6566 @table @kbd
6567 @kindex C-c C-x C-l
6568 @item C-c C-x C-l
6569 Produce a preview image of the La@TeX{} fragment at point and overlay it
6570 over the source code.  If there is no fragment at point, process all
6571 fragments in the current entry (between two headlines).  When called
6572 with a prefix argument, process the entire subtree.  When called with
6573 two prefix arguments, or when the cursor is before the first headline,
6574 process the entire buffer.
6575 @kindex C-c C-c
6576 @item C-c C-c
6577 Remove the overlay preview images.
6578 @end table
6580 During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
6581 converted into images and inlined into the document if the following
6582 setting is active:
6584 @lisp
6585 (setq org-export-with-LaTeX-fragments t)
6586 @end lisp
6588 @node CDLaTeX mode,  , Processing LaTeX fragments, Embedded LaTeX
6589 @section Using CDLaTeX to enter math
6590 @cindex CDLaTeX
6592 CDLaTeX mode is a minor mode that is normally used in combination with a
6593 major La@TeX{} mode like AUCTeX in order to speed-up insertion of
6594 environments and math templates.  Inside Org mode, you can make use of
6595 some of the features of CDLaTeX mode.  You need to install
6596 @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
6597 AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
6598 Don't use CDLaTeX mode itself under Org mode, but use the light
6599 version @code{org-cdlatex-mode} that comes as part of Org mode.  Turn it
6600 on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
6601 Org files with
6603 @lisp
6604 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
6605 @end lisp
6607 When this mode is enabled, the following features are present (for more
6608 details see the documentation of CDLaTeX mode):
6609 @itemize @bullet
6610 @kindex C-c @{
6611 @item
6612 Environment templates can be inserted with @kbd{C-c @{}.
6613 @item
6614 @kindex @key{TAB}
6615 The @key{TAB} key will do template expansion if the cursor is inside a
6616 La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
6617 inside such a fragment, see the documentation of the function
6618 @code{org-inside-LaTeX-fragment-p}.}.  For example, @key{TAB} will
6619 expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
6620 correctly inside the first brace.  Another @key{TAB} will get you into
6621 the second brace.  Even outside fragments, @key{TAB} will expand
6622 environment abbreviations at the beginning of a line.  For example, if
6623 you write @samp{equ} at the beginning of a line and press @key{TAB},
6624 this abbreviation will be expanded to an @code{equation} environment.
6625 To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
6626 @item
6627 @kindex _
6628 @kindex ^
6629 Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
6630 characters together with a pair of braces.  If you use @key{TAB} to move
6631 out of the braces, and if the braces surround only a single character or
6632 macro, they are removed again (depending on the variable
6633 @code{cdlatex-simplify-sub-super-scripts}).
6634 @item
6635 @kindex `
6636 Pressing the backquote @kbd{`} followed by a character inserts math
6637 macros, also outside La@TeX{} fragments.  If you wait more than 1.5 seconds
6638 after the backquote, a help window will pop up.
6639 @item
6640 @kindex '
6641 Pressing the normal quote @kbd{'} followed by another character modifies
6642 the symbol before point with an accent or a font.  If you wait more than
6643 1.5 seconds after the backquote, a help window will pop up.  Character
6644 modification will work only inside La@TeX{} fragments, outside the quote
6645 is normal.
6646 @end itemize
6648 @node Exporting, Publishing, Embedded LaTeX, Top
6649 @chapter Exporting
6650 @cindex exporting
6652 Org mode documents can be exported into a variety of other formats.  For
6653 printing and sharing of notes, ASCII export produces a readable and
6654 simple version of an Org file.  HTML export allows you to publish a
6655 notes file on the web, while the XOXO format provides a solid base for
6656 exchange with a broad range of other applications. La@TeX{} export lets
6657 you use Org mode and its structured editing functions to easily create
6658 La@TeX{} files.  To incorporate entries with associated times like
6659 deadlines or appointments into a desktop calendar program like iCal,
6660 Org mode can also produce extracts in the iCalendar format.  Currently
6661 Org mode only supports export, not import of these different formats.
6663 @menu
6664 * Markup rules::                Which structures are recognized?
6665 * Export options::              Per-file export settings
6666 * The export dispatcher::       How to access exporter commands
6667 * ASCII export::                Exporting to plain ASCII
6668 * HTML export::                 Exporting to HTML
6669 * LaTeX export::                Exporting to LaTeX
6670 * XOXO export::                 Exporting to XOXO
6671 * iCalendar export::            Exporting in iCalendar format
6672 @end menu
6674 @node Markup rules, Export options, Exporting, Exporting
6675 @section Markup rules
6677 When exporting Org mode documents,  the exporter tries to reflect the
6678 structure of the document as accurately as possible in the back-end.  Since
6679 export targets like HTML or La@TeX{} allow much richer formatting, Org mode
6680 has rules how to prepare text for rich export.  This section summarizes the
6681 markup rule used in an Org mode buffer.
6683 @menu
6684 * Document title::              How the document title is determined
6685 * Headings and sections::       The main structure of the exported document
6686 * Table of contents::           If, where, how to create a table of contents
6687 * Initial text::                Text before the first headline
6688 * Lists::                       Plain lists are exported
6689 * Paragraphs::                  What determines beginning and ending
6690 * Literal examples::            Source code and other examples
6691 * Include files::               Include the contents of a file during export
6692 * Tables exported::             Tables are exported richly
6693 * Footnotes::                   Numbers like [1]
6694 * Emphasis and monospace::      To bold or not to bold
6695 * TeX macros and LaTeX fragments::  Create special, rich export.
6696 * Horizontal rules::            A line across the page
6697 * Comment lines::               Some lines will not be exported
6698 @end menu
6700 @node Document title, Headings and sections, Markup rules, Markup rules
6701 @subheading Document title
6702 @cindex document title, markup rules
6704 @noindent
6705 The title of the exported document is taken from the special line
6707 @example
6708 #+TITLE: This is the title of the document
6709 @end example
6711 @noindent
6712 If this line does not exist, the title is derived from the first non-empty,
6713 non-comment line in the buffer.  If no such line exists, or if you have
6714 turned off exporting of the text before the first headline (see below), the
6715 title will be the file name without extension.
6717 If you are exporting only a subtree by marking is as the region, the heading
6718 of the subtree will become the title of the document.  If the subtree has a
6719 property @code{EXPORT_TITLE}, that will take precedence.
6721 @node Headings and sections, Table of contents, Document title, Markup rules
6722 @subheading Headings and sections
6723 @cindex headings and sections, markup rules
6725 The outline structure of the document as described in @ref{Document
6726 Structure} forms the basis for defining sections of the exported document.
6727 However, since the outline structure is also used for (for example) lists of
6728 tasks, only the first three outline levels will be used as headings.  Deeper
6729 levels will become itemized lists.  You can change the location of this
6730 switch, globally by setting the variable @code{org-headline-levels}, or on a
6731 per file basis with a line
6733 @example
6734 #+OPTIONS: H:4
6735 @end example
6737 @node Table of contents, Initial text, Headings and sections, Markup rules
6738 @subheading Table of contents
6739 @cindex table of contents, markup rules
6741 The table of contents is normally inserted directly before the first headline
6742 of the file.  If you would like to get it to a different location, insert the
6743 string @code{[TABLE-OF-CONTENTS]} on a line by itself at the desired
6744 location.  The depth of the table of contents is by default the same as the
6745 number of headline levels, but you can choose a smaller number or turn off
6746 the table of contents entirely by configuring the variable
6747 @code{org-export-with-toc}, or on a per-file basis with a line like
6749 @example
6750 #+OPTIONS: toc:2          (only to two levels in TOC)
6751 #+OPTIONS: toc:nil        (no TOC at all)
6752 @end example
6754 @node Initial text, Lists, Table of contents, Markup rules
6755 @subheading Text before the first headline
6756 @cindex text before first headline, markup rules
6757 @cindex #+TEXT
6759 Org mode normally exports the text before the first headline, and even uses
6760 the first line as the document title.  The text will be fully marked up.  If
6761 you need to include literal HTML or La@TeX{} code, use the special constructs
6762 described below in the sections for the individual exporters.
6764 Some people like to use the space before the first headline for setup and
6765 internal links and therefore would like to control the exported text before
6766 the first headline in a different way.  You can do so by setting the variable
6767 @code{org-export-skip-text-before-1st-heading} to @code{t}.  On a per-file
6768 basis, you can get the same effect with @samp{#+OPTIONS: skip:t}.
6770 @noindent
6771 If you still want to have some text before the first headline, use the
6772 @code{#+TEXT} construct:
6774 @example
6775 #+OPTIONS: skip:t
6776 #+TEXT: This text will go before the *first* headline.
6777 #+TEXT: [TABLE-OF-CONTENTS]
6778 #+TEXT: This goes between the table of contents and the first headline
6779 @end example
6781 @node Lists, Paragraphs, Initial text, Markup rules
6782 @subheading Lists
6783 @cindex lists, markup rules
6785 Plain lists as described in @ref{Plain lists} are translated to the back-ends
6786 syntax for such lists.  Most back-ends support unordered, ordered, and
6787 description lists.
6789 @node Paragraphs, Literal examples, Lists, Markup rules
6790 @subheading Paragraphs, line breaks, and quoting
6791 @cindex paragraphs, markup rules
6793 Paragraphs are separated by at least one empty line.  If you need to enforce
6794 a line break within a paragraph, use @samp{\\} at the end of a line.
6796 To keep the line breaks in a region, but otherwise use normal formatting, you
6797 can use this construct, which can also be used to format poetry.
6799 @example
6800 #+BEGIN_VERSE
6801 Everything should be made as simple as possible,
6802 but not any simpler -- Albert Einstein
6803 #+END_VERSE
6804 @end example
6806 When quoting a passage from another document, it is customary to format this
6807 as a paragraph that is indented on both the left and the right margin.  You
6808 can include quotations in Org mode documents like this:
6810 @example
6811 #+BEGIN_QUOTE
6812 Everything should be made as simple as possible,
6813 but not any simpler -- Albert Einstein
6814 #+END_QUOTE
6815 @end example
6818 @node Literal examples, Include files, Paragraphs, Markup rules
6819 @subheading Literal examples
6820 @cindex literal examples, markup rules
6822 You can include literal examples that should not be subjected to
6823 markup.  Such examples will be typeset in monospace, so this is well suited
6824 for source code and similar examples.
6825 @cindex #+BEGIN_EXAMPLE
6827 @example
6828 #+BEGIN_EXAMPLE
6829 Some example from a text file.
6830 #+END_EXAMPLE
6831 @end example
6833 For simplicity when using small examples, you can also start the example
6834 lines with a colon:
6836 @example
6837 : Some example from a text file.
6838 @end example
6840 @cindex formatting source code, markup rules
6841 If the example is source code from a programming language, or any other text
6842 that can be marked up by font-lock in Emacs, you can ask for the example to
6843 look like the fontified Emacs buffer@footnote{Currently this works only for
6844 the HTML back-end, and requires the @file{htmlize.el} package version 1.34 or
6845 later.}.  This is done with the @samp{src} block, where you also need to
6846 specify the name of the major mode that should be used to fontify the
6847 example:
6848 @cindex #+BEGIN_SRC
6850 @example
6851 #+BEGIN_SRC emacs-lisp
6852 (defun org-xor (a b)
6853    "Exclusive or."
6854    (if a (not b) b))
6855 #+END_SRC
6856 @end example
6858 @table @kbd
6859 @kindex C-c '
6860 @item C-c '
6861 Edit the source code example at point in its native mode.  This works by
6862 switching to an indirect buffer, narrowing the buffer and switching to the
6863 other mode.  You need to exit by pressing @kbd{C-c '} again.
6864 @end table
6867 @node Include files, Tables exported, Literal examples, Markup rules
6868 @subheading Include files
6869 @cindex include files, markup rules
6871 During export, you can include the content of another file.  For example, to
6872 include your .emacs file, you could use:
6873 @cindex #+INCLUDE
6875 @example
6876 #+INCLUDE: "~/.emacs" src emacs-lisp
6877 @end example
6879 The optional second and third parameter are the markup (@samp{quote},
6880 @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
6881 language for formatting the contents.  The markup is optional, if it is not
6882 given, the text will be assumed to be in Org mode format and will be
6883 processed normally.
6885 @table @kbd
6886 @kindex C-c '
6887 @item C-c '
6888 Visit the include file at point.
6889 @end table
6891 @node Tables exported, Footnotes, Include files, Markup rules
6892 @subheading Tables
6893 @cindex tables, markup rules
6895 Both the native Org mode tables (@pxref{Tables}) and tables formatted with
6896 the @file{table.el} package will be exported properly.  For Org mode tables,
6897 the lines before the first horizontal separator line will become table header
6898 lines.
6900 @node Footnotes, Emphasis and monospace, Tables exported, Markup rules
6901 @subheading Footnotes
6902 @cindex footnotes, markup rules
6903 @cindex @file{footnote.el}
6905 @kindex C-c !
6906 Numbers in square brackets are treated as footnote markers, and lines
6907 starting with such a marker are interpreted as the footnote itself.  You can
6908 use the Emacs package @file{footnote.el} to create footnotes@footnote{The
6909 @file{footnote} package uses @kbd{C-c !} to invoke its commands.  This
6910 binding conflicts with the Org mode command for inserting inactive time
6911 stamps.  You could use the variable @code{footnote-prefix} to switch
6912 footnotes commands to another key.  Or, if you are too used to this binding,
6913 you could use @code{org-replace-disputed-keys} and @code{org-disputed-keys}
6914 to change the settings in Org.}.  For example:
6916 @example
6917 The Org homepage[1] now looks a lot better than it used to.
6919 [1] The link is: http://orgmode.org
6920 @end example
6922 @node Emphasis and monospace, TeX macros and LaTeX fragments, Footnotes, Markup rules
6923 @subheading Emphasis and monospace
6925 @cindex underlined text, markup rules
6926 @cindex bold text, markup rules
6927 @cindex italic text, markup rules
6928 @cindex verbatim text, markup rules
6929 @cindex code text, markup rules
6930 @cindex strike-through text, markup rules
6931 You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
6932 and @code{~verbatim~}, and, if you must, @samp{+strike-through+}.  Text
6933 in the code and verbatim string is not processed for Org mode specific
6934 syntax, it is exported verbatim.
6936 @node TeX macros and LaTeX fragments, Horizontal rules, Emphasis and monospace, Markup rules
6937 @subheading @TeX{} macros and La@TeX{} fragments
6938 @cindex LaTeX fragments, markup rules
6939 @cindex TeX macros, markup rules
6940 @cindex HTML entities
6941 @cindex LaTeX entities
6943 A @TeX{}-like syntax is used to specify special characters.  Where possible,
6944 these will be transformed into the native format of the exporter back-end.
6945 Strings like @code{\alpha} will be exported as @code{&alpha;} in the HTML
6946 output, and as @code{$\alpha$} in the La@TeX{} output.  Similarly,
6947 @code{\nbsp} will become @code{&nbsp;} in HTML and @code{~} in La@TeX{}.
6948 This applies for a large number of entities, with names taken from both HTML
6949 and La@TeX{}, see the variable @code{org-html-entities} for the complete
6950 list.  If you are unsure about a name, use @kbd{M-@key{TAB}} for completion
6951 after having types the backslash and maybe a few characters
6952 (@pxref{Completion}).
6954 La@TeX{} fragments are converted into images for HTML export, and they are
6955 written literally into the La@TeX{} export.  See also @ref{Embedded LaTeX}.
6957 Finally, @samp{\-} is treated as a shy hyphen, and @samp{--}, @samp{---}, and
6958 @samp{...} are all converted into special commands creating hyphens of
6959 different lengths or a compact set of dots.
6961 @node Horizontal rules, Comment lines, TeX macros and LaTeX fragments, Markup rules
6962 @subheading  Horizontal rules
6963 @cindex horizontal rules, markup rules
6964 A line consisting of only dashes, and at least 5 of them, will be
6965 exported as a horizontal line (@samp{<hr/>} in HTML).
6967 @node Comment lines,  , Horizontal rules, Markup rules
6968 @subheading Comment lines
6969 @cindex comment lines
6970 @cindex exporting, not
6972 Lines starting with @samp{#} in column zero are treated as comments and will
6973 never be exported.  Also entire subtrees starting with the word
6974 @samp{COMMENT} will never be exported.  Finally, regions surrounded by
6975 @samp{#+BEGIN_COMMENT} ... @samp{#+END_COMMENT} will not be exported.
6977 @table @kbd
6978 @kindex C-c ;
6979 @item C-c ;
6980 Toggle the COMMENT keyword at the beginning of an entry.
6981 @end table
6983 @node Export options, The export dispatcher, Markup rules, Exporting
6984 @section Export options
6985 @cindex options, for export
6987 @cindex completion, of option keywords
6988 The exporter recognizes special lines in the buffer which provide
6989 additional information.  These lines may be put anywhere in the file.
6990 The whole set of lines can be inserted into the buffer with @kbd{C-c
6991 C-e t}.  For individual lines, a good way to make sure the keyword is
6992 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
6993 (@pxref{Completion}).
6995 @table @kbd
6996 @kindex C-c C-e t
6997 @item C-c C-e t
6998 Insert template with export options, see example below.
6999 @end table
7001 @cindex #+TITLE:
7002 @cindex #+AUTHOR:
7003 @cindex #+DATE:
7004 @cindex #+EMAIL:
7005 @cindex #+LANGUAGE:
7006 @cindex #+TEXT:
7007 @cindex #+OPTIONS:
7008 @cindex #+LINK_UP:
7009 @cindex #+LINK_HOME:
7010 @example
7011 #+TITLE:     the title to be shown (default is the buffer name)
7012 #+AUTHOR:    the author (default taken from @code{user-full-name})
7013 #+DATE:      A date, fixed, of a format string for @code{format-time-string}
7014 #+EMAIL:     his/her email address (default from @code{user-mail-address})
7015 #+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
7016 #+TEXT:      Some descriptive text to be inserted at the beginning.
7017 #+TEXT:      Several lines may be given.
7018 #+OPTIONS:   H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
7019 #+LINK_UP:   the ``up'' link of an exported page
7020 #+LINK_HOME: the ``home'' link of an exported page
7021 @end example
7023 @noindent
7024 The OPTIONS line is a compact@footnote{If you want to configure many options
7025 this way, you can use several OPTIONS lines.} form to specify export settings.  Here
7026 you can:
7027 @cindex headline levels
7028 @cindex section-numbers
7029 @cindex table of contents
7030 @cindex line-break preservation
7031 @cindex quoted HTML tags
7032 @cindex fixed-width sections
7033 @cindex tables
7034 @cindex @TeX{}-like syntax for sub- and superscripts
7035 @cindex footnotes
7036 @cindex special strings
7037 @cindex emphasized text
7038 @cindex @TeX{} macros
7039 @cindex La@TeX{} fragments
7040 @cindex author info, in export
7041 @cindex time info, in export
7042 @example
7043 H:         @r{set the number of headline levels for export}
7044 num:       @r{turn on/off section-numbers}
7045 toc:       @r{turn on/off table of contents, or set level limit (integer)}
7046 \n:        @r{turn on/off line-break-preservation}
7047 @@:         @r{turn on/off quoted HTML tags}
7048 ::         @r{turn on/off fixed-width sections}
7049 |:         @r{turn on/off tables}
7050 ^:         @r{turn on/off @TeX{}-like syntax for sub- and superscripts.  If}
7051            @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
7052            @r{the simple @code{a_b} will be left as it is.}
7053 -:         @r{turn on/off conversion of special strings.}
7054 f:         @r{turn on/off footnotes like this[1].}
7055 *:         @r{turn on/off emphasized text (bold, italic, underlined)}
7056 TeX:       @r{turn on/off simple @TeX{} macros in plain text}
7057 LaTeX:     @r{turn on/off La@TeX{} fragments}
7058 skip:      @r{turn on/off skipping the text before the first heading}
7059 author:    @r{turn on/off inclusion of author name/email into exported file}
7060 timestamp: @r{turn on/off inclusion creation time into exported file}
7061 d:         @r{turn on/off inclusion of drawers}
7062 @end example
7064 These options take effect in both the HTML and La@TeX{} export, except
7065 for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
7066 @code{nil} for the La@TeX{} export.
7068 When exporting only a single subtree by selecting it with @kbd{C-c @@} before
7069 calling an export command, the subtree can overrule some of the file's export
7070 settings with properties @code{EXPORT_FILE_NAME}, @code{EXPORT_TITLE},
7071 @code{EXPORT_TEXT}, and @code{EXPORT_OPTIONS}.
7073 @node The export dispatcher, ASCII export, Export options, Exporting
7074 @section The export dispatcher
7075 @cindex dispatcher, for export commands
7077 All export commands can be reached using the export dispatcher, which is a
7078 prefix key that prompts for an additional key specifying the command.
7079 Normally the entire file is exported, but if there is an active region that
7080 contains one outline tree, the first heading is used as document title and
7081 the subtrees are exported.
7083 @table @kbd
7084 @kindex C-c C-e
7085 @item C-c C-e
7086 Dispatcher for export and publishing commands.  Displays a help-window
7087 listing the additional key(s) needed to launch an export or publishing
7088 command.  The prefix arg is passed through to the exporter.  If the option
7089 @code{org-export-run-in-background} is set, Org will run the command in the
7090 background if that seems useful for the specific command (i.e. commands that
7091 write to a file).
7092 @kindex C-c C-e v
7093 @item C-c C-e v
7094 Like @kbd{C-c C-e}, but only export the text that is currently visible
7095 (i.e. not hidden by outline visibility).
7096 @kindex C-u C-u C-c C-e
7097 @item C-u C-u C-c C-e
7098 Call an the exporter, but reverse the setting of
7099 @code{org-export-run-in-background}, i.e. request background processing if
7100 not set, or force processing in the current Emacs process if st.
7101 @end table
7103 @node ASCII export, HTML export, The export dispatcher, Exporting
7104 @section ASCII export
7105 @cindex ASCII export
7107 ASCII export produces a simple and very readable version of an Org mode
7108 file.
7110 @cindex region, active
7111 @cindex active region
7112 @cindex Transient mark mode
7113 @table @kbd
7114 @kindex C-c C-e a
7115 @item C-c C-e a
7116 Export as ASCII file.  For an org file @file{myfile.org}, the ASCII file
7117 will be @file{myfile.txt}.  The file will be overwritten without
7118 warning.  If there is an active region, only the region will be
7119 exported. If the selected region is a single tree@footnote{To select the
7120 current subtree, use @kbd{C-c @@}.}, the tree head will
7121 become the document title.  If the tree head entry has or inherits an
7122 @code{EXPORT_FILE_NAME} property, that name will be used for the
7123 export.
7124 @kindex C-c C-e v a
7125 @item C-c C-e v a
7126 Export only the visible part of the document.
7127 @end table
7129 @cindex headline levels, for exporting
7130 In the exported version, the first 3 outline levels will become
7131 headlines, defining a general document structure.  Additional levels
7132 will be exported as itemized lists.  If you want that transition to occur
7133 at a different level, specify it with a prefix argument.  For example,
7135 @example
7136 @kbd{C-1 C-c C-e a}
7137 @end example
7139 @noindent
7140 creates only top level headlines and does the rest as items.  When
7141 headlines are converted to items, the indentation of the text following
7142 the headline is changed to fit nicely under the item.  This is done with
7143 the assumption that the first body line indicates the base indentation of
7144 the body text.  Any indentation larger than this is adjusted to preserve
7145 the layout relative to the first line.  Should there be lines with less
7146 indentation than the first, these are left alone.
7148 @node HTML export, LaTeX export, ASCII export, Exporting
7149 @section HTML export
7150 @cindex HTML export
7152 Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
7153 HTML formatting, in ways similar to John Grubers @emph{markdown}
7154 language, but with additional support for tables.
7156 @menu
7157 * HTML Export commands::        How to invoke HTML export
7158 * Quoting HTML tags::           Using direct HTML in Org mode
7159 * Links::                       Transformation of links for HTML
7160 * Images::                      How to include images
7161 * CSS support::                 Changing the appearance of the output
7162 * Javascript support::          Info and Folding in a web browser
7163 @end menu
7165 @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
7166 @subsection HTML export commands
7168 @cindex region, active
7169 @cindex active region
7170 @cindex Transient mark mode
7171 @table @kbd
7172 @kindex C-c C-e h
7173 @item C-c C-e h
7174 Export as HTML file @file{myfile.html}.  For an org file @file{myfile.org},
7175 the ASCII file will be @file{myfile.html}.  The file will be overwritten
7176 without warning.  If there is an active region, only the region will be
7177 exported. If the selected region is a single tree@footnote{To select the
7178 current subtree, use @kbd{C-c @@}.}, the tree head will become the document
7179 title.  If the tree head entry has or inherits an @code{EXPORT_FILE_NAME}
7180 property, that name will be used for the export.
7181 @kindex C-c C-e b
7182 @item C-c C-e b
7183 Export as HTML file and immediately open it with a browser.
7184 @kindex C-c C-e H
7185 @item C-c C-e H
7186 Export to a temporary buffer, do not create a file.
7187 @kindex C-c C-e R
7188 @item C-c C-e R
7189 Export the active region to a temporary buffer.  With a prefix argument, do
7190 not produce the file header and footer, but just the plain HTML section for
7191 the region.  This is good for cut-and-paste operations.
7192 @kindex C-c C-e v h
7193 @kindex C-c C-e v b
7194 @kindex C-c C-e v H
7195 @kindex C-c C-e v R
7196 @item C-c C-e v h
7197 @item C-c C-e v b
7198 @item C-c C-e v H
7199 @item C-c C-e v R
7200 Export only the visible part of the document.
7201 @item M-x org-export-region-as-html
7202 Convert the region to HTML under the assumption that it was Org mode
7203 syntax before.  This is a global command that can be invoked in any
7204 buffer.
7205 @item M-x org-replace-region-by-HTML
7206 Replace the active region (assumed to be in Org mode syntax) by HTML
7207 code.
7208 @end table
7210 @cindex headline levels, for exporting
7211 In the exported version, the first 3 outline levels will become headlines,
7212 defining a general document structure.  Additional levels will be exported as
7213 itemized lists.  If you want that transition to occur at a different level,
7214 specify it with a numeric prefix argument.  For example,
7216 @example
7217 @kbd{C-2 C-c C-e b}
7218 @end example
7220 @noindent
7221 creates two levels of headings and does the rest as items.
7223 @node Quoting HTML tags, Links, HTML Export commands, HTML export
7224 @subsection Quoting HTML tags
7226 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
7227 @samp{&gt;} in HTML export.  If you want to include simple HTML tags
7228 which should be interpreted as such, mark them with @samp{@@} as in
7229 @samp{@@<b>bold text@@</b>}.  Note that this really works only for
7230 simple tags.  For more extensive HTML that should be copied verbatim to
7231 the exported file use either
7233 @example
7234 #+HTML: Literal HTML code for export
7235 @end example
7237 @noindent or
7238 @cindex #+BEGIN_HTML
7240 @example
7241 #+BEGIN_HTML
7242 All lines between these markers are exported literally
7243 #+END_HTML
7244 @end example
7247 @node Links, Images, Quoting HTML tags, HTML export
7248 @subsection Links
7250 @cindex links, in HTML export
7251 @cindex internal links, in HTML export
7252 @cindex external links, in HTML export
7253 Internal links (@pxref{Internal links}) will continue to work in HTML
7254 files only if they match a dedicated @samp{<<target>>}.  Automatic links
7255 created by radio targets (@pxref{Radio targets}) will also work in the
7256 HTML file.  Links to external files will still work if the HTML file is
7257 in the same directory as the Org file.  Links to other @file{.org}
7258 files will be translated into HTML links under the assumption that an
7259 HTML version also exists of the linked file.  For information related to
7260 linking files while publishing them to a publishing directory see
7261 @ref{Publishing links}.
7263 @node Images, CSS support, Links, HTML export
7264 @subsection Images
7266 @cindex images, inline in HTML
7267 @cindex inlining images in HTML
7268 HTML export can inline images given as links in the Org file, and
7269 it can make an image the clickable part of a link.  By
7270 default@footnote{but see the variable
7271 @code{org-export-html-inline-images}}, images are inlined if a link does
7272 not have a description.  So @samp{[[file:myimg.jpg]]} will be inlined,
7273 while @samp{[[file:myimg.jpg][the image]]} will just produce a link
7274 @samp{the image} that points to the image.  If the description part
7275 itself is a @code{file:} link or a @code{http:} URL pointing to an
7276 image, this image will be inlined and activated so that clicking on the
7277 image will activate the link.  For example, to include a thumbnail that
7278 will link to a high resolution version of the image, you could use:
7280 @example
7281 [[file:highres.jpg][file:thumb.jpg]]
7282 @end example
7284 @noindent
7285 and you could use @code{http} addresses just as well.
7287 @node CSS support, Javascript support, Images, HTML export
7288 @subsection CSS support
7289 @cindex CSS, for HTML export
7290 @cindex HTML export, CSS
7292 You can also give style information for the exported file.  The HTML
7293 exporter assigns the following CSS classes to appropriate parts of the
7294 document - your style specifications may change these:
7295 @example
7296 .todo           @r{TODO keywords}
7297 .done           @r{the DONE keyword}
7298 .timestamp      @r{time stamp}
7299 .timestamp-kwd  @r{keyword associated with a time stamp, like SCHEDULED}
7300 .tag            @r{tag in a headline}
7301 .target         @r{target for links}
7302 @end example
7304 The default style specification can be configured through the option
7305 @code{org-export-html-style}.  If you want to use a file-local style,
7306 you may use file variables, best wrapped into a COMMENT section at the
7307 end of the outline tree.  For example@footnote{Under Emacs 21, the
7308 continuation lines for a variable value should have no @samp{#} at the
7309 start of the line.}:
7311 @example
7312 * COMMENT html style specifications
7314 # Local Variables:
7315 # org-export-html-style: "   <style type=\"text/css\">
7316 #       p @{font-weight: normal; color: gray; @}
7317 #       h1 @{color: black; @}
7318 #   </style>"
7319 # End:
7320 @end example
7322 Remember to execute @kbd{M-x normal-mode} after changing this to make
7323 the new style visible to Emacs.  This command restarts Org mode for the
7324 current buffer and forces Emacs to re-evaluate the local variables
7325 section in the buffer.
7327 @c FIXME: More about header and footer styles
7328 @c FIXME: Talk about links and targets.
7330 @node Javascript support,  , CSS support, HTML export
7331 @subsection Javascript supported display of web pages
7333 @emph{Sebastian Rose} has written a JavaScript program especially designed to
7334 enhance the web viewing experience of HTML files created with Org.  This
7335 program allows to view large files in two different ways.  The first one is
7336 an @emph{Info}-like mode where each section is displayed separately and
7337 navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
7338 as well, press @kbd{?} for an overview of the available keys).  The second
7339 view type is a @emph{folding} view much like Org provides it inside Emacs.
7340 The script is available at @url{http://orgmode.org/org-info.js} and you can
7341 find the documentation for it at
7342 @url{http://orgmode.org/worg/code/org-info-js/org-info.js.html}.  We are
7343 serving the script from our site, but if you use it a lot, you might not want
7344 to be dependent on @url{orgmode.org} and prefer to install a local copy on
7345 your own web server.
7347 To use the script, you need to make sure that the @file{org-jsinfo.el} module
7348 gets loaded.  It should be loaded by default, try @kbd{M-x customize-variable
7349 @key{RET} org-modules @key{RET}} to convince yourself that this is indeed the
7350 case.  All it then takes to make use of the program is adding a single line
7351 to the Org file:
7353 @example
7354 #+INFOJS_OPT: view:info toc:nil
7355 @end example
7357 @noindent
7358 If this line is found, the HTML header will automatically contain the code
7359 needed to invoke the script.  Using the line above, you can set the following
7360 viewing options:
7362 @example
7363 path:    @r{The path to the script.  The default is to grab the script from}
7364          @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
7365          @r{a local copy and use a path like @samp{../scripts/org-info.js}.}
7366 view:    @r{Initial view when website is first shown.  Possible values are:}
7367          info      @r{Info-like interface with one section per page.}
7368          overview  @r{Folding interface, initially showing only top-level.}
7369          content   @r{Folding interface, starting with all headlines visible.}
7370          showall   @r{Folding interface, all headlines and text visible.}
7371 sdepth:  @r{Maximum headline level that will still become an independent}
7372          @r{section for info and folding modes.  The default is taken from}
7373          @r{@code{org-headline-levels} (= the @code{H} switch in @code{#+OPTIONS}).}
7374          @r{If this is smaller than in @code{org-headline-levels}, each}
7375          @r{info/folding section can still contain children headlines.}
7376 toc:     @r{Should the table of content @emph{initially} be visible?}
7377          @r{Even when @code{nil}, you can always get to the toc with @kbd{i}.}
7378 tdepth:  @r{The depth of the table of contents.  The defaults are taken from}
7379          @r{the variables @code{org-headline-levels} and @code{org-export-with-toc}.}
7380 ftoc:    @r{Does the css of the page specify a fixed position for the toc?}
7381          @r{If yes, the toc will never be displayed as a section.}
7382 ltoc:    @r{Should there be short contents (children) in each section?}
7383 mouse:   @r{Headings are highlighted when the mouse is over them.  Should be}
7384          @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
7385 buttons: @r{Should view-toggle buttons be everywhere?  When @code{nil} (the}
7386          @r{default), only one such button will be present.}
7387 @end example
7389 You can choose default values for these options by customizing the variable
7390 @code{org-infojs-options}.  If you always want to apply the script to your
7391 pages, configure the variable @code{org-export-html-use-infojs}.
7393 @node LaTeX export, XOXO export, HTML export, Exporting
7394 @section LaTeX export
7395 @cindex LaTeX export
7397 Org mode contains a La@TeX{} exporter written by Bastien Guerry.
7399 @menu
7400 * LaTeX export commands::       How to invoke LaTeX export
7401 * Quoting LaTeX code::          Incorporating literal LaTeX code
7402 * Sectioning structure::        Changing sectioning in LaTeX output
7403 @end menu
7405 @node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
7406 @subsection LaTeX export commands
7408 @table @kbd
7409 @kindex C-c C-e l
7410 @item C-c C-e l
7411 Export as La@TeX{} file @file{myfile.tex}.  For an org file
7412 @file{myfile.org}, the ASCII file will be @file{myfile.tex}.  The file will
7413 be overwritten without warning.  If there is an active region, only the
7414 region will be exported. If the selected region is a single tree@footnote{To
7415 select the current subtree, use @kbd{C-c @@}.}, the tree head will become the
7416 document title.  If the tree head entry has or inherits an
7417 @code{EXPORT_FILE_NAME} property, that name will be used for the export.
7418 @kindex C-c C-e L
7419 @item C-c C-e L
7420 Export to a temporary buffer, do not create a file.
7421 @kindex C-c C-e v l
7422 @kindex C-c C-e v L
7423 @item C-c C-e v l
7424 @item C-c C-e v L
7425 Export only the visible part of the document.
7426 @item M-x org-export-region-as-latex
7427 Convert the region to La@TeX{} under the assumption that it was Org mode
7428 syntax before.  This is a global command that can be invoked in any
7429 buffer.
7430 @item M-x org-replace-region-by-latex
7431 Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
7432 code.
7433 @end table
7435 @cindex headline levels, for exporting
7436 In the exported version, the first 3 outline levels will become
7437 headlines, defining a general document structure.  Additional levels
7438 will be exported as description lists.  The exporter can ignore them or
7439 convert them to a custom string depending on
7440 @code{org-latex-low-levels}.
7442 If you want that transition to occur at a different level, specify it
7443 with a numeric prefix argument. For example,
7445 @example
7446 @kbd{C-2 C-c C-e l}
7447 @end example
7449 @noindent
7450 creates two levels of headings and does the rest as items.
7452 @node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export
7453 @subsection Quoting LaTeX code
7455 Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
7456 inserted into the La@TeX{} file.  Furthermore, you can add special code
7457 that should only be present in La@TeX{} export with the following
7458 constructs:
7460 @example
7461 #+LaTeX: Literal LaTeX code for export
7462 @end example
7464 @noindent or
7465 @cindex #+BEGIN_LaTeX
7467 @example
7468 #+BEGIN_LaTeX
7469 All lines between these markers are exported literally
7470 #+END_LaTeX
7471 @end example
7473 @node   Sectioning structure,  , Quoting LaTeX code, LaTeX export
7474 @subsection Sectioning structure
7475 @cindex LaTeX class
7476 @cindex LaTeX sectioning structure
7478 By default, the La@TeX{} output uses the class @code{article}.
7480 You can change this globally by setting a different value for
7481 @code{org-export-latex-default-class} or locally by adding an option
7482 like @code{#+LaTeX_CLASS: myclass} in your file.  The class should be
7483 listed in @code{org-export-latex-classes}, where you can also define the
7484 sectioning structure for each class.
7487 @node XOXO export, iCalendar export, LaTeX export, Exporting
7488 @section XOXO export
7489 @cindex XOXO export
7491 Org mode contains an exporter that produces XOXO-style output.
7492 Currently, this exporter only handles the general outline structure and
7493 does not interpret any additional Org mode features.
7495 @table @kbd
7496 @kindex C-c C-e x
7497 @item C-c C-e x
7498 Export as XOXO file @file{myfile.html}.
7499 @kindex C-c C-e v
7500 @item C-c C-e v x
7501 Export only the visible part of the document.
7502 @end table
7504 @node iCalendar export,  , XOXO export, Exporting
7505 @section iCalendar export
7506 @cindex iCalendar export
7508 Some people like to use Org mode for keeping track of projects, but
7509 still prefer a standard calendar application for anniversaries and
7510 appointments.  In this case it can be useful to have deadlines and
7511 other time-stamped items in Org files show up in the calendar
7512 application.  Org mode can export calendar information in the standard
7513 iCalendar format.  If you also want to have TODO entries included in the
7514 export, configure the variable @code{org-icalendar-include-todo}.
7516 The iCalendar standard requires each entry to have a globally unique
7517 identifier (UID).  Org creates these identifiers during export.  If you set
7518 the variable @code{org-icalendar-store-UID}, the UID will be stored in the
7519 @code{:ID:} property of the entry and re-used next time you report this
7520 entry.  Since a single entry can give rise to multiple iCalendar entries (as
7521 a timestamp, a deadline, a scheduled item, and as a TODO item), Org adds
7522 prefixes to the UID, depending on what triggered the inclusion of the entry.
7523 In this way the UID remains unique, but a synchronization program can still
7524 figure out from which entry all the different instances originate.
7526 @table @kbd
7527 @kindex C-c C-e i
7528 @item C-c C-e i
7529 Create iCalendar entries for the current file and store them in the same
7530 directory, using a file extension @file{.ics}.
7531 @kindex C-c C-e I
7532 @item C-c C-e I
7533 Like @kbd{C-c C-e i}, but do this for all files in
7534 @code{org-agenda-files}.  For each of these files, a separate iCalendar
7535 file will be written.
7536 @kindex C-c C-e c
7537 @item C-c C-e c
7538 Create a single large iCalendar file from all files in
7539 @code{org-agenda-files} and write it to the file given by
7540 @code{org-combined-agenda-icalendar-file}.
7541 @end table
7543 The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
7544 the selected entries have them.  If not, the summary will be derived
7545 from the headline, and the description from the body (limited to
7546 @code{org-icalendar-include-body} characters).
7548 How this calendar is best read and updated, depends on the application
7549 you are using.  The FAQ covers this issue.
7551 @node Publishing, Miscellaneous, Exporting, Top
7552 @chapter Publishing
7553 @cindex publishing
7555 Org includes@footnote{@file{org-publish.el} is not distributed with
7556 Emacs 21, if you are still using Emacs 21, you need you need to download
7557 this file separately.} a publishing management system that allows you to
7558 configure automatic HTML conversion of @emph{projects} composed of
7559 interlinked org files.  This system is called @emph{org-publish}.  You can
7560 also configure org-publish to automatically upload your exported HTML
7561 pages and related attachments, such as images and source code files, to
7562 a web server. Org-publish turns Org into a web-site authoring tool.
7564 You can also use Org-publish to convert files into La@TeX{}, or even
7565 combine HTML and La@TeX{} conversion so that files are available in both
7566 formats on the server@footnote{Since La@TeX{} files on a server are not
7567 that helpful, you surely want to perform further conversion on them --
7568 e.g. convert them to @code{PDF} format.}.
7570 Org-publish has been contributed to Org by David O'Toole.
7572 @menu
7573 * Configuration::               Defining projects
7574 * Sample configuration::        Example projects
7575 * Triggering publication::      Publication commands
7576 @end menu
7578 @node Configuration, Sample configuration, Publishing, Publishing
7579 @section Configuration
7581 Publishing needs significant configuration to specify files, destination
7582 and many other properties of a project.
7584 @menu
7585 * Project alist::               The central configuration variable
7586 * Sources and destinations::    From here to there
7587 * Selecting files::             What files are part of the project?
7588 * Publishing action::           Setting the function doing the publishing
7589 * Publishing options::          Tweaking HTML export
7590 * Publishing links::            Which links keep working after publishing?
7591 * Project page index::          Publishing a list of project files
7592 @end menu
7594 @node Project alist, Sources and destinations, Configuration, Configuration
7595 @subsection The variable @code{org-publish-project-alist}
7596 @cindex org-publish-project-alist
7597 @cindex projects, for publishing
7599 Org-publish is configured almost entirely through setting the value of
7600 one variable, called @code{org-publish-project-alist}.
7601 Each element of the list configures one project, and may be in one of
7602 the two following forms:
7604 @lisp
7605 ("project-name" :property value :property value ...)
7607 @r{or}
7609 ("project-name" :components ("project-name" "project-name" ...))
7611 @end lisp
7613 In both cases, projects are configured by specifying property values.
7614 A project defines the set of files that will be published, as well as
7615 the publishing configuration to use when publishing those files.  When
7616 a project takes the second form listed above, the individual members
7617 of the ``components'' property are taken to be components of the
7618 project, which group together files requiring different publishing
7619 options. When you publish such a ``meta-project'' all the components
7620 will also publish.
7622 @node Sources and destinations, Selecting files, Project alist, Configuration
7623 @subsection Sources and destinations for files
7624 @cindex directories, for publishing
7626 Most properties are optional, but some should always be set. In
7627 particular, org-publish needs to know where to look for source files,
7628 and where to put published files.
7630 @multitable @columnfractions 0.3 0.7
7631 @item @code{:base-directory}
7632 @tab Directory containing publishing source files
7633 @item @code{:publishing-directory}
7634 @tab Directory (possibly remote) where output files will be published.
7635 @item @code{:preparation-function}
7636 @tab Function called before starting the publishing process, for example to
7637 run @code{make} for updating files to be published.
7638 @item @code{:completion-function}
7639 @tab Function called after finishing the publishing process, for example to
7640 change permissions of the resulting files.
7641 @end multitable
7642 @noindent
7644 @node Selecting files, Publishing action, Sources and destinations, Configuration
7645 @subsection Selecting files
7646 @cindex files, selecting for publishing
7648 By default, all files with extension @file{.org} in the base directory
7649 are considered part of the project.  This can be modified by setting the
7650 properties
7651 @multitable @columnfractions 0.25 0.75
7652 @item @code{:base-extension}
7653 @tab Extension (without the dot!) of source files.  This actually is a
7654 regular expression.
7656 @item @code{:exclude}
7657 @tab Regular expression to match file names that should not be
7658 published, even though they have been selected on the basis of their
7659 extension.
7661 @item @code{:include}
7662 @tab List of files to be included regardless of @code{:base-extension}
7663 and @code{:exclude}.
7664 @end multitable
7666 @node Publishing action, Publishing options, Selecting files, Configuration
7667 @subsection Publishing action
7668 @cindex action, for publishing
7670 Publishing means that a file is copied to the destination directory and
7671 possibly transformed in the process.  The default transformation is to
7672 export Org files as HTML files, and this is done by the function
7673 @code{org-publish-org-to-html} which calls the HTML exporter
7674 (@pxref{HTML export}). But you also can publish your files in La@TeX{} by
7675 using the function @code{org-publish-org-to-latex} instead. Other files
7676 like images only need to be copied to the publishing destination. For
7677 non-Org files, you need to specify the publishing function.
7680 @multitable @columnfractions 0.3 0.7
7681 @item @code{:publishing-function}
7682 @tab Function executing the publication of a file.  This may also be a
7683 list of functions, which will all be called in turn.
7684 @end multitable
7686 The function must accept two arguments: a property list containing at
7687 least a @code{:publishing-directory} property, and the name of the file
7688 to be published.  It should take the specified file, make the necessary
7689 transformation (if any) and place the result into the destination folder.
7690 You can write your own publishing function, but @code{org-publish}
7691 provides one for attachments (files that only need to be copied):
7692 @code{org-publish-attachment}.
7694 @node Publishing options, Publishing links, Publishing action, Configuration
7695 @subsection Options for the HTML/LaTeX exporters
7696 @cindex options, for publishing
7698 The property list can be used to set many export options for the HTML
7699 and La@TeX{} exporters.  In most cases, these properties correspond to user
7700 variables in Org.  The table below lists these properties along
7701 with the variable they belong to.  See the documentation string for the
7702 respective variable for details.
7704 @multitable @columnfractions 0.3 0.7
7705 @item @code{:language}              @tab @code{org-export-default-language}
7706 @item @code{:headline-levels}       @tab @code{org-export-headline-levels}
7707 @item @code{:section-numbers}       @tab @code{org-export-with-section-numbers}
7708 @item @code{:table-of-contents}     @tab @code{org-export-with-toc}
7709 @item @code{:archived-trees}        @tab @code{org-export-with-archived-trees}
7710 @item @code{:emphasize}             @tab @code{org-export-with-emphasize}
7711 @item @code{:sub-superscript}       @tab @code{org-export-with-sub-superscripts}
7712 @item @code{:special-strings}       @tab @code{org-export-with-special-strings}
7713 @item @code{:TeX-macros}            @tab @code{org-export-with-TeX-macros}
7714 @item @code{:LaTeX-fragments}       @tab @code{org-export-with-LaTeX-fragments}
7715 @item @code{:fixed-width}           @tab @code{org-export-with-fixed-width}
7716 @item @code{:timestamps}           .@tab @code{org-export-with-timestamps}
7717 @item @code{:tags}                 .@tab @code{org-export-with-tags}
7718 @item @code{:tables}                @tab @code{org-export-with-tables}
7719 @item @code{:table-auto-headline}   @tab @code{org-export-highlight-first-table-line}
7720 @item @code{:style}                 @tab @code{org-export-html-style}
7721 @item @code{:convert-org-links}     @tab @code{org-export-html-link-org-files-as-html}
7722 @item @code{:inline-images}         @tab @code{org-export-html-inline-images}
7723 @item @code{:expand-quoted-html}    @tab @code{org-export-html-expand}
7724 @item @code{:timestamp}             @tab @code{org-export-html-with-timestamp}
7725 @item @code{:publishing-directory}  @tab @code{org-export-publishing-directory}
7726 @item @code{:preamble}              @tab @code{org-export-html-preamble}
7727 @item @code{:postamble}             @tab @code{org-export-html-postamble}
7728 @item @code{:auto-preamble}         @tab @code{org-export-html-auto-preamble}
7729 @item @code{:auto-postamble}        @tab @code{org-export-html-auto-postamble}
7730 @item @code{:author}                @tab @code{user-full-name}
7731 @item @code{:email}                 @tab @code{user-mail-address}
7732 @end multitable
7734 If you use several email addresses, separate them by a semi-column.
7736 Most of the @code{org-export-with-*} variables have the same effect in
7737 both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
7738 @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
7739 La@TeX{} export.
7741 When a property is given a value in @code{org-publish-project-alist},
7742 its setting overrides the value of the corresponding user variable (if
7743 any) during publishing.  Options set within a file (@pxref{Export
7744 options}), however, override everything.
7746 @node Publishing links, Project page index, Publishing options, Configuration
7747 @subsection Links between published files
7748 @cindex links, publishing
7750 To create a link from one Org file to another, you would use
7751 something like @samp{[[file:foo.org][The foo]]} or simply
7752 @samp{file:foo.org.} (@pxref{Hyperlinks}).  Upon publishing this link
7753 becomes a link to @file{foo.html}.  In this way, you can interlink the
7754 pages of your "org web" project and the links will work as expected when
7755 you publish them to HTML.
7757 You may also link to related files, such as images. Provided you are
7758 careful with relative pathnames, and provided you have also configured
7759 @code{org-publish} to upload the related files, these links will work
7760 too. @ref{Complex example} for an example of this usage.
7762 Sometime an Org file to be published may contain links that are
7763 only valid in your production environment, but not in the publishing
7764 location.  In this case, use the property
7766 @multitable @columnfractions 0.4 0.6
7767 @item @code{:link-validation-function}
7768 @tab Function to validate links
7769 @end multitable
7771 @noindent
7772 to define a function for checking link validity.  This function must
7773 accept two arguments, the file name and a directory relative to which
7774 the file name is interpreted in the production environment.  If this
7775 function returns @code{nil}, then the HTML generator will only insert a
7776 description into the HTML file, but no link.  One option for this
7777 function is @code{org-publish-validate-link} which checks if the given
7778 file is part of any project in @code{org-publish-project-alist}.
7780 @node Project page index,  , Publishing links, Configuration
7781 @subsection Project page index
7782 @cindex index, of published pages
7784 The following properties may be used to control publishing of an
7785 index of files or summary page for a given project.
7787 @multitable @columnfractions 0.25 0.75
7788 @item @code{:auto-index}
7789 @tab When non-nil, publish an index during org-publish-current-project or
7790 org-publish-all.
7792 @item @code{:index-filename}
7793 @tab Filename for output of index. Defaults to @file{index.org} (which
7794 becomes @file{index.html}).
7796 @item @code{:index-title}
7797 @tab Title of index page. Defaults to name of file.
7799 @item @code{:index-function}
7800 @tab Plug-in function to use for generation of index.
7801 Defaults to @code{org-publish-org-index}, which generates a plain list
7802 of links to all files in the project.
7803 @end multitable
7805 @node Sample configuration, Triggering publication, Configuration, Publishing
7806 @section Sample configuration
7808 Below we provide two example configurations.  The first one is a simple
7809 project publishing only a set of Org files.  The second example is
7810 more complex, with a multi-component project.
7812 @menu
7813 * Simple example::              One-component publishing
7814 * Complex example::             A multi-component publishing example
7815 @end menu
7817 @node Simple example, Complex example, Sample configuration, Sample configuration
7818 @subsection Example: simple publishing configuration
7820 This example publishes a set of Org files to the @file{public_html}
7821 directory on the local machine.
7823 @lisp
7824 (setq org-publish-project-alist
7825       '(("org"
7826          :base-directory "~/org/"
7827          :publishing-directory "~/public_html"
7828          :section-numbers nil
7829          :table-of-contents nil
7830          :style "<link rel=stylesheet
7831                 href=\"../other/mystyle.css\"
7832                 type=\"text/css\">")))
7833 @end lisp
7835 @node Complex example,  , Simple example, Sample configuration
7836 @subsection Example: complex publishing configuration
7838 This more complicated example publishes an entire website, including
7839 org files converted to HTML, image files, emacs lisp source code, and
7840 style sheets. The publishing-directory is remote and private files are
7841 excluded.
7843 To ensure that links are preserved, care should be taken to replicate
7844 your directory structure on the web server, and to use relative file
7845 paths. For example, if your org files are kept in @file{~/org} and your
7846 publishable images in @file{~/images}, you'd link to an image with
7848 @example
7849 file:../images/myimage.png
7850 @end example
7852 On the web server, the relative path to the image should be the
7853 same. You can accomplish this by setting up an "images" folder in the
7854 right place on the web server, and publishing images to it.
7856 @lisp
7857 (setq org-publish-project-alist
7858       '(("orgfiles"
7859           :base-directory "~/org/"
7860           :base-extension "org"
7861           :publishing-directory "/ssh:user@@host:~/html/notebook/"
7862           :publishing-function org-publish-org-to-html
7863           :exclude "PrivatePage.org"   ;; regexp
7864           :headline-levels 3
7865           :section-numbers nil
7866           :table-of-contents nil
7867           :style "<link rel=stylesheet
7868                   href=\"../other/mystyle.css\" type=\"text/css\">"
7869           :auto-preamble t
7870           :auto-postamble nil)
7872          ("images"
7873           :base-directory "~/images/"
7874           :base-extension "jpg\\|gif\\|png"
7875           :publishing-directory "/ssh:user@@host:~/html/images/"
7876           :publishing-function org-publish-attachment)
7878          ("other"
7879           :base-directory "~/other/"
7880           :base-extension "css\\|el"
7881           :publishing-directory "/ssh:user@@host:~/html/other/"
7882           :publishing-function org-publish-attachment)
7883          ("website" :components ("orgfiles" "images" "other"))))
7884 @end lisp
7886 @node Triggering publication,  , Sample configuration, Publishing
7887 @section Triggering publication
7889 Once org-publish is properly configured, you can publish with the
7890 following functions:
7892 @table @kbd
7893 @item C-c C-e C
7894 Prompt for a specific project and publish all files that belong to it.
7895 @item C-c C-e P
7896 Publish the project containing the current file.
7897 @item C-c C-e F
7898 Publish only the current file.
7899 @item C-c C-e A
7900 Publish all projects.
7901 @end table
7903 Org uses timestamps to track when a file has changed. The above
7904 functions normally only publish changed files. You can override this and
7905 force publishing of all files by giving a prefix argument.
7907 @node Miscellaneous, Extensions, Publishing, Top
7908 @chapter Miscellaneous
7910 @menu
7911 * Completion::                  M-TAB knows what you need
7912 * Customization::               Adapting Org to your taste
7913 * In-buffer settings::          Overview of the #+KEYWORDS
7914 * The very busy C-c C-c key::   When in doubt, press C-c C-c
7915 * Clean view::                  Getting rid of leading stars in the outline
7916 * TTY keys::                    Using Org on a tty
7917 * Interaction::                 Other Emacs packages
7918 * Bugs::                        Things which do not work perfectly
7919 @end menu
7921 @node Completion, Customization, Miscellaneous, Miscellaneous
7922 @section Completion
7923 @cindex completion, of @TeX{} symbols
7924 @cindex completion, of TODO keywords
7925 @cindex completion, of dictionary words
7926 @cindex completion, of option keywords
7927 @cindex completion, of tags
7928 @cindex completion, of property keys
7929 @cindex completion, of link abbreviations
7930 @cindex @TeX{} symbol completion
7931 @cindex TODO keywords completion
7932 @cindex dictionary word completion
7933 @cindex option keyword completion
7934 @cindex tag completion
7935 @cindex link abbreviations, completion of
7937 Org supports in-buffer completion.  This type of completion does
7938 not make use of the minibuffer.  You simply type a few letters into
7939 the buffer and use the key to complete text right there.
7941 @table @kbd
7942 @kindex M-@key{TAB}
7943 @item M-@key{TAB}
7944 Complete word at point
7945 @itemize @bullet
7946 @item
7947 At the beginning of a headline, complete TODO keywords.
7948 @item
7949 After @samp{\}, complete @TeX{} symbols supported by the exporter.
7950 @item
7951 After @samp{*}, complete headlines in the current buffer so that they
7952 can be used in search links like @samp{[[*find this headline]]}.
7953 @item
7954 After @samp{:} in a headline, complete tags.  The list of tags is taken
7955 from the variable @code{org-tag-alist} (possibly set through the
7956 @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
7957 dynamically from all tags used in the current buffer.
7958 @item
7959 After @samp{:} and not in a headline, complete property keys.  The list
7960 of keys is constructed dynamically from all keys used in the current
7961 buffer.
7962 @item
7963 After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
7964 @item
7965 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
7966 @samp{OPTIONS} which set file-specific options for Org mode.  When the
7967 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
7968 will insert example settings for this keyword.
7969 @item
7970 In the line after @samp{#+STARTUP: }, complete startup keywords,
7971 i.e. valid keys for this line.
7972 @item
7973 Elsewhere, complete dictionary words using Ispell.
7974 @end itemize
7975 @end table
7977 @node Customization, In-buffer settings, Completion, Miscellaneous
7978 @section Customization
7979 @cindex customization
7980 @cindex options, for customization
7981 @cindex variables, for customization
7983 There are more than 180 variables that can be used to customize
7984 Org.  For the sake of compactness of the manual, I am not
7985 describing the variables here.  A structured overview of customization
7986 variables is available with @kbd{M-x org-customize}.  Or select
7987 @code{Browse Org Group} from the @code{Org->Customization} menu.  Many
7988 settings can also be activated on a per-file basis, by putting special
7989 lines into the buffer (@pxref{In-buffer settings}).
7991 @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
7992 @section Summary of in-buffer settings
7993 @cindex in-buffer settings
7994 @cindex special keywords
7996 Org mode uses special lines in the buffer to define settings on a
7997 per-file basis.  These lines start with a @samp{#+} followed by a
7998 keyword, a colon, and then individual words defining a setting.  Several
7999 setting words can be in the same line, but you can also have multiple
8000 lines for the keyword.  While these settings are described throughout
8001 the manual, here is a summary.  After changing any of those lines in the
8002 buffer, press @kbd{C-c C-c} with the cursor still in the line to
8003 activate the changes immediately.  Otherwise they become effective only
8004 when the file is visited again in a new Emacs session.
8006 @table @kbd
8007 @item #+ARCHIVE: %s_done::
8008 This line sets the archive location for the agenda file.  It applies for
8009 all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
8010 of the file.  The first such line also applies to any entries before it.
8011 The corresponding variable is @code{org-archive-location}.
8012 @item #+CATEGORY:
8013 This line sets the category for the agenda file.  The category applies
8014 for all subsequent lines until the next @samp{#+CATEGORY} line, or the
8015 end of the file.  The first such line also applies to any entries before it.
8016 @item #+COLUMNS: %25ITEM .....
8017 Set the default format for columns view.  This format applies when
8018 columns view is invoked in location where no @code{COLUMNS} property
8019 applies.
8020 @item #+CONSTANTS: name1=value1 ...
8021 Set file-local values for constants to be used in table formulas.  This
8022 line set the local variable @code{org-table-formula-constants-local}.
8023 The global version of this variable is
8024 @code{org-table-formula-constants}.
8025 @item #+FILETAGS: :tag1:tag2:tag3:
8026 Set tags that can be inherited by any entry in the file, including the
8027 top-level entries.
8028 @item #+DRAWERS: NAME1 .....
8029 Set the file-local set of drawers.  The corresponding global variable is
8030 @code{org-drawers}.
8031 @item #+LINK:  linkword replace
8032 These lines (several are allowed) specify link abbreviations.
8033 @xref{Link abbreviations}.  The corresponding variable is
8034 @code{org-link-abbrev-alist}.
8035 @item #+PRIORITIES: highest lowest default
8036 This line sets the limits and the default for the priorities.  All three
8037 must be either letters A-Z or numbers 0-9.  The highest priority must
8038 have a lower ASCII number that the lowest priority.
8039 @item #+PROPERTY: Property_Name Value
8040 This line sets a default inheritance value for entries in the current
8041 buffer, most useful for specifying the allowed values of a property.
8042 @item #+SETUPFILE: file
8043 This line defines a file that holds more in-buffer setup.  Normally this is
8044 entirely ignored.  Only when the buffer is parsed for option-setting lines
8045 (i.e. when starting Org mode for a file, when pressing @kbd{C-c C-c} in a
8046 settings line, or when exporting), then the contents of this file are parsed
8047 as if they had been included in the buffer.  In particlar, the file can be
8048 any other Org mode file with internal setup.  You can visit the file the
8049 cursor is in the line with @kbd{C-c '}.
8050 @item #+STARTUP:
8051 This line sets options to be used at startup of Org mode, when an
8052 Org file is being visited.  The first set of options deals with the
8053 initial visibility of the outline tree.  The corresponding variable for
8054 global default settings is @code{org-startup-folded}, with a default
8055 value @code{t}, which means @code{overview}.
8056 @cindex @code{overview}, STARTUP keyword
8057 @cindex @code{content}, STARTUP keyword
8058 @cindex @code{showall}, STARTUP keyword
8059 @example
8060 overview   @r{top-level headlines only}
8061 content    @r{all headlines}
8062 showall    @r{no folding at all, show everything}
8063 @end example
8064 Then there are options for aligning tables upon visiting a file.  This
8065 is useful in files containing narrowed table columns.  The corresponding
8066 variable is @code{org-startup-align-all-tables}, with a default value
8067 @code{nil}.
8068 @cindex @code{align}, STARTUP keyword
8069 @cindex @code{noalign}, STARTUP keyword
8070 @example
8071 align      @r{align all tables}
8072 noalign    @r{don't align tables on startup}
8073 @end example
8074 Logging closing and reinstating TODO items, and clock intervals
8075 (variables @code{org-log-done}, @code{org-log-note-clock-out}, and
8076 @code{org-log-repeat}) can be configured using these options.
8077 @cindex @code{logdone}, STARTUP keyword
8078 @cindex @code{lognotedone}, STARTUP keyword
8079 @cindex @code{nologdone}, STARTUP keyword
8080 @cindex @code{lognoteclock-out}, STARTUP keyword
8081 @cindex @code{nolognoteclock-out}, STARTUP keyword
8082 @cindex @code{logrepeat}, STARTUP keyword
8083 @cindex @code{lognoterepeat}, STARTUP keyword
8084 @cindex @code{nologrepeat}, STARTUP keyword
8085 @example
8086 logdone            @r{record a timestamp when an item is marked DONE}
8087 lognotedone        @r{record timestamp and a note when DONE}
8088 nologdone          @r{don't record when items are marked DONE}
8089 logrepeat          @r{record a time when reinstating a repeating item}
8090 lognoterepeat      @r{record a note when reinstating a repeating item}
8091 nologrepeat        @r{do not record when reinstating repeating item}
8092 lognoteclock-out   @r{record a note when clocking out}
8093 nolognoteclock-out @r{don't record a note when clocking out}
8094 @end example
8095 Here are the options for hiding leading stars in outline headings, and for
8096 indenting outlines.  The corresponding variables are
8097 @code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with a
8098 default setting @code{nil} (meaning @code{showstars} and @code{oddeven}).
8099 @cindex @code{hidestars}, STARTUP keyword
8100 @cindex @code{showstars}, STARTUP keyword
8101 @cindex @code{odd}, STARTUP keyword
8102 @cindex @code{even}, STARTUP keyword
8103 @example
8104 hidestars  @r{make all but one of the stars starting a headline invisible.}
8105 showstars  @r{show all stars starting a headline}
8106 indent     @r{virtual indentation according to outline level}
8107 noindent   @r{no virtual indentation according to outline level}
8108 odd        @r{allow only odd outline levels (1,3,...)}
8109 oddeven    @r{allow all outline levels}
8110 @end example
8111 To turn on custom format overlays over time stamps (variables
8112 @code{org-put-time-stamp-overlays} and
8113 @code{org-time-stamp-overlay-formats}), use
8114 @cindex @code{customtime}, STARTUP keyword
8115 @example
8116 customtime @r{overlay custom time format}
8117 @end example
8118 The following options influence the table spreadsheet (variable
8119 @code{constants-unit-system}).
8120 @cindex @code{constcgs}, STARTUP keyword
8121 @cindex @code{constSI}, STARTUP keyword
8122 @example
8123 constcgs   @r{@file{constants.el} should use the c-g-s unit system}
8124 constSI    @r{@file{constants.el} should use the SI unit system}
8125 @end example
8126 @item #+TAGS:  TAG1(c1) TAG2(c2)
8127 These lines (several such lines are allowed) specify the valid tags in
8128 this file, and (potentially) the corresponding @emph{fast tag selection}
8129 keys.  The corresponding variable is @code{org-tag-alist}.
8130 @item #+TBLFM:
8131 This line contains the formulas for the table directly above the line.
8132 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:
8133 These lines provide settings for exporting files.  For more details see
8134 @ref{Export options}.
8135 @item #+SEQ_TODO:   #+TYP_TODO:
8136 These lines set the TODO keywords and their interpretation in the
8137 current file.  The corresponding variables are @code{org-todo-keywords}
8138 and @code{org-todo-interpretation}.
8139 @end table
8141 @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
8142 @section The very busy C-c C-c key
8143 @kindex C-c C-c
8144 @cindex C-c C-c, overview
8146 The key @kbd{C-c C-c} has many purposes in Org, which are all
8147 mentioned scattered throughout this manual.  One specific function of
8148 this key is to add @emph{tags} to a headline (@pxref{Tags}).  In many
8149 other circumstances it means something like @emph{Hey Org, look
8150 here and update according to what you see here}.  Here is a summary of
8151 what this means in different contexts.
8153 @itemize @minus
8154 @item
8155 If there are highlights in the buffer from the creation of a sparse
8156 tree, or from clock display, remove these highlights.
8157 @item
8158 If the cursor is in one of the special @code{#+KEYWORD} lines, this
8159 triggers scanning the buffer for these lines and updating the
8160 information.
8161 @item
8162 If the cursor is inside a table, realign the table.  This command
8163 works even if the automatic table editor has been turned off.
8164 @item
8165 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
8166 the entire table.
8167 @item
8168 If the cursor is inside a table created by the @file{table.el} package,
8169 activate that table.
8170 @item
8171 If the current buffer is a remember buffer, close the note and file it.
8172 With a prefix argument, file it, without further interaction, to the
8173 default location.
8174 @item
8175 If the cursor is on a @code{<<<target>>>}, update radio targets and
8176 corresponding links in this buffer.
8177 @item
8178 If the cursor is in a property line or at the start or end of a property
8179 drawer, offer property commands.
8180 @item
8181 If the cursor is in a plain list item with a checkbox, toggle the status
8182 of the checkbox.
8183 @item
8184 If the cursor is on a numbered item in a plain list, renumber the
8185 ordered list.
8186 @item
8187 If the cursor is on the @code{#+BEGIN} line of a dynamical block, the
8188 block is updated.
8189 @end itemize
8191 @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
8192 @section A cleaner outline view
8193 @cindex hiding leading stars
8194 @cindex dynamic indentation
8195 @cindex odd-levels-only outlines
8196 @cindex clean outline view
8198 Some people find it noisy and distracting that the Org headlines are starting
8199 with a potentially large number of stars, and that text below the headlines
8200 is not indented.  This is not really a problem when you are writing a book
8201 where the outline headings are really section headlines.  However, in a more
8202 list-oriented outline, it is clear that an indented structure is a lot
8203 cleaner, as can be seen by comparing the two columns in the following
8204 example: 
8206 @example
8207 @group
8208 * Top level headline             |    * Top level headline
8209 ** Second level                  |      * Second level
8210 *** 3rd level                    |        * 3rd level
8211 some text                        |          some text
8212 *** 3rd level                    |        * 3rd level
8213 more text                        |          more text
8214 * Another top level headline     |    * Another top level headline
8215 @end group
8216 @end example
8218 @noindent
8219 It is non-trivial to make such a look work in Emacs, but Org contains three
8220 separate features that, combined, achieve just that.
8222 @enumerate
8223 @item 
8224 @emph{Indentation of text below headlines}@*
8225 You may indent text below each headline to make the left boundary line up
8226 with the headline, like
8228 @example
8229 *** 3rd level
8230     more text, now indented
8231 @end example
8233 A good way to get this indentation is by hand, and Org supports this with
8234 paragraph filling, line wrapping, and structure editing@footnote{See also the
8235 variable @code{org-adapt-indentation}.} preserving or adapting the
8236 indentation appropriate.  A different approach would be to have a way to
8237 automatically indent lines according to outline structure by adding overlays
8238 or text properties.  But I have not yet found a robust and efficient way to
8239 do this in large files.
8241 @item
8242 @emph{Hiding leading stars}@* You can modify the display in such a way that
8243 all leading stars become invisible.  To do this in a global way, configure
8244 the variable @code{org-hide-leading-stars} or change this on a per-file basis
8245 with
8247 @example
8248 #+STARTUP: showstars
8249 #+STARTUP: hidestars
8250 @end example
8252 With hidden stars, the tree becomes:
8254 @example
8255 @group
8256 * Top level headline
8257  * Second level
8258   * 3rd level
8259   ...
8260 @end group
8261 @end example
8263 @noindent
8264 Note that the leading stars are not truly replaced by whitespace, they
8265 are only fontified with the face @code{org-hide} that uses the
8266 background color as font color.  If you are not using either white or
8267 black background, you may have to customize this face to get the wanted
8268 effect.  Another possibility is to set this font such that the extra
8269 stars are @i{almost} invisible, for example using the color
8270 @code{grey90} on a white background.
8272 @item
8273 Things become cleaner still if you skip all the even levels and use only odd
8274 levels 1, 3, 5..., effectively adding two stars to go from one outline level
8275 to the next.  In this way we get the outline view shown at the beginning of
8276 this section.  In order to make the structure editing and export commands
8277 handle this convention correctly, configure the variable
8278 @code{org-odd-levels-only}, or set this on a per-file basis with one of the
8279 following lines:
8281 @example
8282 #+STARTUP: odd
8283 #+STARTUP: oddeven
8284 @end example
8286 You can convert an Org file from single-star-per-level to the
8287 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
8288 RET} in that file.  The reverse operation is @kbd{M-x
8289 org-convert-to-oddeven-levels}.
8290 @end enumerate
8292 @node TTY keys, Interaction, Clean view, Miscellaneous
8293 @section Using Org on a tty
8294 @cindex tty key bindings
8296 Because Org contains a large number of commands, by default much of
8297 Org's core commands are bound to keys that are generally not
8298 accessible on a tty, such as the cursor keys (@key{left}, @key{right},
8299 @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
8300 together with modifiers like @key{Meta} and/or @key{Shift}.  To access
8301 these commands on a tty when special keys are unavailable, the following
8302 alternative bindings can be used.  The tty bindings below will likely be
8303 more cumbersome; you may find for some of the bindings below that a
8304 customized work-around suits you better.  For example, changing a time
8305 stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
8306 tty you would rather use @kbd{C-c .} to re-insert the timestamp.
8308 @multitable @columnfractions 0.15 0.2 0.2
8309 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
8310 @item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
8311 @item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
8312 @item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
8313 @item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
8314 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
8315 @item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
8316 @item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
8317 @item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
8318 @item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
8319 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
8320 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
8321 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
8322 @item @kbd{S-@key{left}}    @tab @kbd{C-c @key{left}}      @tab
8323 @item @kbd{S-@key{right}}   @tab @kbd{C-c @key{right}}     @tab
8324 @item @kbd{S-@key{up}}      @tab @kbd{C-c @key{up}}        @tab
8325 @item @kbd{S-@key{down}}    @tab @kbd{C-c @key{down}}      @tab
8326 @item @kbd{C-S-@key{left}}  @tab @kbd{C-c C-x @key{left}}  @tab
8327 @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
8328 @end multitable
8330 @node Interaction, Bugs, TTY keys, Miscellaneous
8331 @section Interaction with other packages
8332 @cindex packages, interaction with other
8333 Org lives in the world of GNU Emacs and interacts in various ways
8334 with other code out there.
8336 @menu
8337 * Cooperation::                 Packages Org cooperates with
8338 * Conflicts::                   Packages that lead to conflicts
8339 @end menu
8341 @node Cooperation, Conflicts, Interaction, Interaction
8342 @subsection Packages that Org cooperates with
8344 @table @asis
8345 @cindex @file{calc.el}
8346 @item @file{calc.el} by Dave Gillespie
8347 Org uses the Calc package for implementing spreadsheet
8348 functionality in its tables (@pxref{The spreadsheet}).  Org
8349 checks for the availability of Calc by looking for the function
8350 @code{calc-eval} which should be autoloaded in your setup if Calc has
8351 been installed properly.  As of Emacs 22, Calc is part of the Emacs
8352 distribution.  Another possibility for interaction between the two
8353 packages is using Calc for embedded calculations. @xref{Embedded Mode,
8354 , Embedded Mode, Calc, GNU Emacs Calc Manual}.
8355 @cindex @file{constants.el}
8356 @item @file{constants.el} by Carsten Dominik
8357 In a table formula (@pxref{The spreadsheet}), it is possible to use
8358 names for natural constants or units.  Instead of defining your own
8359 constants in the variable @code{org-table-formula-constants}, install
8360 the @file{constants} package which defines a large number of constants
8361 and units, and lets you use unit prefixes like @samp{M} for
8362 @samp{Mega} etc.  You will need version 2.0 of this package, available
8363 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
8364 the function @code{constants-get}, which has to be autoloaded in your
8365 setup.  See the installation instructions in the file
8366 @file{constants.el}.
8367 @item @file{cdlatex.el} by Carsten Dominik
8368 @cindex @file{cdlatex.el}
8369 Org mode can make use of the CDLaTeX package to efficiently enter
8370 La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
8371 @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
8372 @cindex @file{imenu.el}
8373 Imenu allows menu access to an index of items in a file.  Org mode
8374 supports Imenu - all you need to do to get the index is the following:
8375 @lisp
8376 (add-hook 'org-mode-hook
8377           (lambda () (imenu-add-to-menubar "Imenu")))
8378 @end lisp
8379 By default the index is two levels deep - you can modify the depth using
8380 the option @code{org-imenu-depth}.
8381 @item @file{remember.el} by John Wiegley
8382 @cindex @file{remember.el}
8383 Org cooperates with remember, see @ref{Remember}.
8384 @file{Remember.el} is not part of Emacs, find it on the web.
8385 @item @file{speedbar.el} by Eric M. Ludlam
8386 @cindex @file{speedbar.el}
8387 Speedbar is a package that creates a special frame displaying files and
8388 index items in files.  Org mode supports Speedbar and allows you to
8389 drill into Org files directly from the Speedbar.  It also allows to
8390 restrict the scope of agenda commands to a file or a subtree by using
8391 the command @kbd{<} in the Speedbar frame.
8392 @cindex @file{table.el}
8393 @item @file{table.el} by Takaaki Ota
8394 @kindex C-c C-c
8395 @cindex table editor, @file{table.el}
8396 @cindex @file{table.el}
8398 Complex ASCII tables with automatic line wrapping, column- and
8399 row-spanning, and alignment can be created using the Emacs table
8400 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
8401 and also part of Emacs 22).
8402 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
8403 will call @command{table-recognize-table} and move the cursor into the
8404 table.  Inside a table, the keymap of Org mode is inactive.  In order
8405 to execute Org mode-related commands, leave the table.
8407 @table @kbd
8408 @kindex C-c C-c
8409 @item C-c C-c
8410 Recognize @file{table.el} table.  Works when the cursor is in a
8411 table.el table.
8413 @kindex C-c ~
8414 @item C-c ~
8415 Insert a table.el table.  If there is already a table at point, this
8416 command converts it between the table.el format and the Org mode
8417 format.  See the documentation string of the command
8418 @code{org-convert-table} for the restrictions under which this is
8419 possible.
8420 @end table
8421 @file{table.el} is part of Emacs 22.
8422 @cindex @file{footnote.el}
8423 @item @file{footnote.el} by Steven L. Baur
8424 Org mode recognizes numerical footnotes as provided by this package
8425 (@pxref{Footnotes}).
8426 @end table
8428 @node Conflicts,  , Cooperation, Interaction
8429 @subsection Packages that lead to conflicts with Org mode
8431 @table @asis
8433 @cindex @file{allout.el}
8434 @item @file{allout.el} by Ken Manheimer
8435 Startup of Org may fail with the error message
8436 @code{(wrong-type-argument keymapp nil)} when there is an outdated
8437 version @file{allout.el} on the load path, for example the version
8438 distributed with Emacs 21.x.  Upgrade to Emacs 22 and this problem will
8439 disappear.  If for some reason you cannot do this, make sure that org.el
8440 is loaded @emph{before} @file{allout.el}, for example by putting
8441 @code{(require 'org)} early enough into your @file{.emacs} file.
8443 @cindex @file{CUA.el}
8444 @item @file{CUA.el} by Kim. F. Storm
8445 Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by
8446 CUA mode (as well as pc-select-mode and s-region-mode) to select and
8447 extend the region.  If you want to use one of these packages along with
8448 Org, configure the variable @code{org-replace-disputed-keys}.  When
8449 set, Org will move the following key bindings in Org files, and
8450 in the agenda buffer (but not during date selection).
8452 @example
8453 S-UP    -> M-p             S-DOWN  -> M-n
8454 S-LEFT  -> M--             S-RIGHT -> M-+
8455 @end example
8457 Yes, these are unfortunately more difficult to remember.  If you want
8458 to have other replacement keys, look at the variable
8459 @code{org-disputed-keys}.
8460 @item @file{windmove.el} by Hovav Shacham
8461 @cindex @file{windmove.el}
8462 Also this package uses the @kbd{S-<cursor>} keys, so everything written
8463 in the paragraph above about CUA mode also applies here.
8465 @cindex @file{footnote.el}
8466 @item @file{footnote.el} by Steven L. Baur
8467 Org supports the syntax of the footnote package, but only the
8468 numerical footnote markers.  Also, the default key for footnote
8469 commands, @kbd{C-c !} is already used by Org.  You could use the
8470 variable @code{footnote-prefix} to switch footnotes commands to another
8471 key.  Or, you could use @code{org-replace-disputed-keys} and
8472 @code{org-disputed-keys} to change the settings in Org.
8474 @end table
8477 @node Bugs,  , Interaction, Miscellaneous
8478 @section Bugs
8479 @cindex bugs
8481 Here is a list of things that should work differently, but which I
8482 have found too hard to fix.
8484 @itemize @bullet
8485 @item
8486 If a table field starts with a link, and if the corresponding table
8487 column is narrowed (@pxref{Narrow columns}) to a width too small to
8488 display the link, the field would look entirely empty even though it is
8489 not.  To prevent this, Org throws an error.  The work-around is to
8490 make the column wide enough to fit the link, or to add some text (at
8491 least 2 characters) before the link in the same field.
8492 @item
8493 Narrowing table columns does not work on XEmacs, because the
8494 @code{format} function does not transport text properties.
8495 @item
8496 Text in an entry protected with the @samp{QUOTE} keyword should not
8497 autowrap.
8498 @item
8499 When the application called by @kbd{C-c C-o} to open a file link fails
8500 (for example because the application does not exist or refuses to open
8501 the file), it does so silently.  No error message is displayed.
8502 @item
8503 Recalculating a table line applies the formulas from left to right.
8504 If a formula uses @emph{calculated} fields further down the row,
8505 multiple recalculation may be needed to get all fields consistent.  You
8506 may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
8507 recalculate until convergence.
8508 @item
8509 The exporters work well, but could be made more efficient.
8510 @end itemize
8513 @node Extensions, Hacking, Miscellaneous, Top
8514 @appendix Extensions
8516 This appendix lists the extension modules that have been written for Org.
8517 Many of these extensions live in the @file{contrib} directory of the Org
8518 distribution, others are available somewhere on the web.
8520 @menu
8521 * Extensions in the contrib directory::  These come with the Org distro
8522 * Other extensions::            These you have to find on the web.
8523 @end menu
8525 @node Extensions in the contrib directory, Other extensions, Extensions, Extensions
8526 @section Extensions in the @file{contrib} directory
8528 @table @asis
8529 @item @file{org-annotate-file.el} by @i{Philip Jackson}
8530       Annotate a file with org syntax, in a separate file, with links back to
8531       the annotated file.
8532 @item @file{org-annotation-helper.el} by @i{Bastien Guerry and Daniel E. German} 
8533       Call @i{remember} directly from Firefox/Opera, or from Adobe Reader.
8534       When activating a special link or bookmark, Emacs receives a trigger to
8535       create a note with a link back to the website.  Requires some setup, a
8536       detailes description is in
8537       @file{contrib/packages/org-annotation-helper}.
8538 @item @file{org-bookmark.el} by @i{Tokuya Kameshima}
8539       Support for links to Emacs bookmarks.
8540 @item @file{org-depend.el} by @i{Carsten Dominik}
8541       TODO dependencies for Org-mode.  Make TODO state changes in one entry
8542       trigger changes in another, or be blocked by the state of another
8543       entry.  Also, easily create chains of TODO items with exactly one
8544       active item at any time.
8545 @item @file{org-elisp-symbol.el} by @i{Bastien Guerry}
8546       Org links to emacs-lisp symbols.  This can create annotated links that
8547       exactly point to the definition location of a variable of function.
8548 @item @file{org-eval.el} by @i{Carsten Dominik}
8549       The @code{<lisp>} tag, adapted from Emacs Wiki and Emacs Muse, allows
8550       to include text in a document that is the result of evaluating some
8551       code.  Other scripting languages like @code{perl} can be supported with
8552       this package as well.
8553 @item @file{org-expiry.el} by @i{Bastien Guerry}
8554       Expiry mechanism for Org entries.
8555 @item @file{org-indent.el} by @i{Carsten Dominik}
8556       Dynamic indentation of Org outlines.  The plan is to indent an outline
8557       according to level, but so far this is too hard for a proper and stable
8558       implementation.  Still, it works somewhat.
8559 @item @file{org-interactive-query.el} by @i{Christopher League}
8560       Interactive modification of tags queries.  After running a general
8561       query in Org, this package allows to narrow down the results by adding
8562       more tags or keywords.
8563 @item @file{org-mairix.el} by @i{Georg C. F. Greve}
8564       Hook mairix search into Org for different MUAs.
8565 @item @file{org-man.el} by @i{Carsten Dominik}
8566       Support for links to manpages in Org-mode.
8567 @item @file{org-mtags.el} by @i{Carsten Dominik}
8568       Support for some Muse-like tags in Org-mode.  This package allows you
8569       to write @code{<example>} and @code{<src>} and other syntax copied from
8570       Emacs Muse, right inside an Org file.  The goal here is to make it easy
8571       to publish the same file using either org-publish or Muse.
8572 @item @file{org-panel.el} by @i{Lennard Borgman}
8573       Simplified and display-aided access to some Org commands.
8574 @item @file{org-registry.el} by @i{Bastien Guerry}
8575       A registry for Org links, to find out from where links point to a given
8576       file or location.
8577 @item @file{org2rem.el} by @i{Bastien Guerry}
8578       Convert org appointments into reminders for the @file{remind} program.
8579 @item @file{org-screen.el} by @i{Andrew Hyatt}
8580       Visit screen sessions through Org-mode links.
8581 @item @file{org-toc.el} by @i{Bastien Guerry}
8582       Table of contents in a separate buffer, with fast access to sections
8583       and easy visibility cycling.
8584 @item @file{orgtbl-sqlinsert.el} by @i{Jason Riedy}
8585       Convert Org-mode tables to SQL insertions.  Documentation for this can
8586       be found on the Worg pages.
8587 @end table
8590 @node Other extensions,  , Extensions in the contrib directory, Extensions
8591 @section Other extensions
8593 @i{TO BE DONE}
8595 @node Hacking, History and Acknowledgments, Extensions, Top
8596 @appendix Hacking
8598 This appendix covers some aspects where users can extend the functionality of
8599 Org.
8601 @menu
8602 * Adding hyperlink types::      New custom link types
8603 * Tables in arbitrary syntax::  Orgtbl for LaTeX and other programs
8604 * Dynamic blocks::              Automatically filled blocks
8605 * Special agenda views::        Customized views
8606 * Using the property API::      Writing programs that use entry properties
8607 * Using the mapping API::       Mapping over all or selected entries
8608 @end menu
8610 @node Adding hyperlink types, Tables in arbitrary syntax, Hacking, Hacking
8611 @section Adding hyperlink types
8612 @cindex hyperlinks, adding new types
8614 Org has a large number of hyperlink types built-in
8615 (@pxref{Hyperlinks}).  If you would like to add new link types, it
8616 provides an interface for doing so.  Lets look at an example file
8617 @file{org-man.el} that will add support for creating links like
8618 @samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
8619 emacs:
8621 @lisp
8622 ;;; org-man.el - Support for links to manpages in Org
8624 (require 'org)
8626 (org-add-link-type "man" 'org-man-open)
8627 (add-hook 'org-store-link-functions 'org-man-store-link)
8629 (defcustom org-man-command 'man
8630   "The Emacs command to be used to display a man page."
8631   :group 'org-link
8632   :type '(choice (const man) (const woman)))
8634 (defun org-man-open (path)
8635   "Visit the manpage on PATH.
8636 PATH should be a topic that can be thrown at the man command."
8637   (funcall org-man-command path))
8639 (defun org-man-store-link ()
8640   "Store a link to a manpage."
8641   (when (memq major-mode '(Man-mode woman-mode))
8642     ;; This is a man page, we do make this link
8643     (let* ((page (org-man-get-page-name))
8644            (link (concat "man:" page))
8645            (description (format "Manpage for %s" page)))
8646       (org-store-link-props
8647        :type "man"
8648        :link link
8649        :description description))))
8651 (defun org-man-get-page-name ()
8652   "Extract the page name from the buffer name."
8653   ;; This works for both `Man-mode' and `woman-mode'.
8654   (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
8655       (match-string 1 (buffer-name))
8656     (error "Cannot create link to this man page")))
8658 (provide 'org-man)
8660 ;;; org-man.el ends here
8661 @end lisp
8663 @noindent
8664 You would activate this new link type in @file{.emacs} with
8666 @lisp
8667 (require 'org-man)
8668 @end lisp
8670 @noindent
8671 Lets go through the file and see what it does.
8672 @enumerate
8673 @item
8674 It does @code{(require 'org)} to make sure that @file{org.el} has been
8675 loaded.
8676 @item
8677 The next line calls @code{org-add-link-type} to define a new link type
8678 with prefix @samp{man}.  The call also contains the name of a function
8679 that will be called to follow such a link.
8680 @item
8681 The next line adds a function to @code{org-store-link-functions}, in
8682 order to allow the command @kbd{C-c l} to record a useful link in a
8683 buffer displaying a man page.
8684 @end enumerate
8686 The rest of the file defines the necessary variables and functions.
8687 First there is a customization variable that determines which emacs
8688 command should be used to display man pages.  There are two options,
8689 @code{man} and @code{woman}.  Then the function to follow a link is
8690 defined.  It gets the link path as an argument - in this case the link
8691 path is just a topic for the manual command.  The function calls the
8692 value of @code{org-man-command} to display the man page.
8694 Finally the function @code{org-man-store-link} is defined.  When you try
8695 to store a link with @kbd{C-c l}, also this function will be called to
8696 try to make a link.  The function must first decide if it is supposed to
8697 create the link for this buffer type, we do this by checking the value
8698 of the variable @code{major-mode}.  If not, the function must exit and
8699 return the value @code{nil}.  If yes, the link is created by getting the
8700 manual topic from the buffer name and prefixing it with the string
8701 @samp{man:}.  Then it must call the command @code{org-store-link-props}
8702 and set the @code{:type} and @code{:link} properties.  Optionally you
8703 can also set the @code{:description} property to provide a default for
8704 the link description when the link is later inserted into an Org
8705 buffer with @kbd{C-c C-l}.
8707 @node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Hacking
8708 @section Tables and lists in arbitrary syntax
8709 @cindex tables, in other modes
8710 @cindex lists, in other modes
8711 @cindex Orgtbl mode
8713 Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
8714 frequent feature request has been to make it work with native tables in
8715 specific languages, for example La@TeX{}.  However, this is extremely
8716 hard to do in a general way, would lead to a customization nightmare,
8717 and would take away much of the simplicity of the Orgtbl mode table
8718 editor.
8721 This appendix describes a different approach.  We keep the Orgtbl mode
8722 table in its native format (the @i{source table}), and use a custom
8723 function to @i{translate} the table to the correct syntax, and to
8724 @i{install} it in the right location (the @i{target table}).  This puts
8725 the burden of writing conversion functions on the user, but it allows
8726 for a very flexible system.
8728 Bastien added the ability to do the same with lists.  You can use Org's
8729 facilities to edit and structure lists by turning @code{orgstruct-mode}
8730 on, then locally exporting such lists in another format (HTML, La@TeX{}
8731 or Texinfo.)
8734 @menu
8735 * Radio tables::                Sending and receiving
8736 * A LaTeX example::             Step by step, almost a tutorial
8737 * Translator functions::        Copy and modify
8738 * Radio lists::                 Doing the same for lists
8739 @end menu
8741 @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
8742 @subsection Radio tables
8743 @cindex radio tables
8745 To define the location of the target table, you first need to create two
8746 lines that are comments in the current mode, but contain magic words for
8747 Orgtbl mode to find.  Orgtbl mode will insert the translated table
8748 between these lines, replacing whatever was there before.  For example:
8750 @example
8751 /* BEGIN RECEIVE ORGTBL table_name */
8752 /* END RECEIVE ORGTBL table_name */
8753 @end example
8755 @noindent
8756 Just above the source table, we put a special line that tells
8757 Orgtbl mode how to translate this table and where to install it.  For
8758 example:
8759 @example
8760 #+ORGTBL: SEND table_name translation_function arguments....
8761 @end example
8763 @noindent
8764 @code{table_name} is the reference name for the table that is also used
8765 in the receiver lines. @code{translation_function} is the Lisp function
8766 that does the translation.  Furthermore, the line can contain a list of
8767 arguments (alternating key and value) at the end.  The arguments will be
8768 passed as a property list to the translation function for
8769 interpretation.  A few standard parameters are already recognized and
8770 acted upon before the translation function is called:
8772 @table @code
8773 @item :skip N
8774 Skip the first N lines of the table.  Hlines do count as separate lines for
8775 this parameter!
8777 @item :skipcols (n1 n2 ...)
8778 List of columns that should be skipped.  If the table has a column with
8779 calculation marks, that column is automatically discarded as well.
8780 Please note that the translator function sees the table @emph{after} the
8781 removal of these columns, the function never knows that there have been
8782 additional columns.
8783 @end table
8785 @noindent
8786 The one problem remaining is how to keep the source table in the buffer
8787 without disturbing the normal workings of the file, for example during
8788 compilation of a C file or processing of a La@TeX{} file.  There are a
8789 number of different solutions:
8791 @itemize @bullet
8792 @item
8793 The table could be placed in a block comment if that is supported by the
8794 language.  For example, in C mode you could wrap the table between
8795 @samp{/*} and @samp{*/} lines.
8796 @item
8797 Sometimes it is possible to put the table after some kind of @i{END}
8798 statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
8799 in La@TeX{}.
8800 @item
8801 You can just comment the table line by line whenever you want to process
8802 the file, and uncomment it whenever you need to edit the table.  This
8803 only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
8804 make this comment-toggling very easy, in particular if you bind it to a
8805 key.
8806 @end itemize
8808 @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
8809 @subsection A LaTeX example of radio tables
8810 @cindex LaTeX, and Orgtbl mode
8812 The best way to wrap the source table in La@TeX{} is to use the
8813 @code{comment} environment provided by @file{comment.sty}.  It has to be
8814 activated by placing @code{\usepackage@{comment@}} into the document
8815 header.  Orgtbl mode can insert a radio table skeleton@footnote{By
8816 default this works only for La@TeX{}, HTML, and Texinfo.  Configure the
8817 variable @code{orgtbl-radio-tables} to install templates for other
8818 modes.}  with the command @kbd{M-x orgtbl-insert-radio-table}.  You will
8819 be prompted for a table name, lets say we use @samp{salesfigures}.  You
8820 will then get the following template:
8822 @cindex #+ORGTBL: SEND
8823 @example
8824 % BEGIN RECEIVE ORGTBL salesfigures
8825 % END RECEIVE ORGTBL salesfigures
8826 \begin@{comment@}
8827 #+ORGTBL: SEND salesfigures orgtbl-to-latex
8828 | | |
8829 \end@{comment@}
8830 @end example
8832 @noindent
8833 The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
8834 @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
8835 into the receiver location with name @code{salesfigures}.  You may now
8836 fill in the table, feel free to use the spreadsheet features@footnote{If
8837 the @samp{#+TBLFM} line contains an odd number of dollar characters,
8838 this may cause problems with font-lock in LaTeX mode.  As shown in the
8839 example you can fix this by adding an extra line inside the
8840 @code{comment} environment that is used to balance the dollar
8841 expressions.  If you are using AUCTeX with the font-latex library, a
8842 much better solution is to add the @code{comment} environment to the
8843 variable @code{LaTeX-verbatim-environments}.}:
8845 @example
8846 % BEGIN RECEIVE ORGTBL salesfigures
8847 % END RECEIVE ORGTBL salesfigures
8848 \begin@{comment@}
8849 #+ORGTBL: SEND salesfigures orgtbl-to-latex
8850 | Month | Days | Nr sold | per day |
8851 |-------+------+---------+---------|
8852 | Jan   |   23 |      55 |     2.4 |
8853 | Feb   |   21 |      16 |     0.8 |
8854 | March |   22 |     278 |    12.6 |
8855 #+TBLFM: $4=$3/$2;%.1f
8856 % $ (optional extra dollar to keep font-lock happy, see footnote)
8857 \end@{comment@}
8858 @end example
8860 @noindent
8861 When you are done, press @kbd{C-c C-c} in the table to get the converted
8862 table inserted between the two marker lines.
8864 Now lets assume you want to make the table header by hand, because you
8865 want to control how columns are aligned etc.  In this case we make sure
8866 that the table translator does skip the first 2 lines of the source
8867 table, and tell the command to work as a @i{splice}, i.e. to not produce
8868 header and footer commands of the target table:
8870 @example
8871 \begin@{tabular@}@{lrrr@}
8872 Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
8873 % BEGIN RECEIVE ORGTBL salesfigures
8874 % END RECEIVE ORGTBL salesfigures
8875 \end@{tabular@}
8877 \begin@{comment@}
8878 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
8879 | Month | Days | Nr sold | per day |
8880 |-------+------+---------+---------|
8881 | Jan   |   23 |      55 |     2.4 |
8882 | Feb   |   21 |      16 |     0.8 |
8883 | March |   22 |     278 |    12.6 |
8884 #+TBLFM: $4=$3/$2;%.1f
8885 \end@{comment@}
8886 @end example
8888 The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
8889 Orgtbl mode.  It uses a @code{tabular} environment to typeset the table
8890 and marks horizontal lines with @code{\hline}.  Furthermore, it
8891 interprets the following parameters (see also @ref{Translator functions}):
8893 @table @code
8894 @item :splice nil/t
8895 When set to t, return only table body lines, don't wrap them into a
8896 tabular environment.  Default is nil.
8898 @item :fmt fmt
8899 A format to be used to wrap each field, should contain @code{%s} for the
8900 original field value.  For example, to wrap each field value in dollars,
8901 you could use @code{:fmt "$%s$"}.  This may also be a property list with
8902 column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
8903 A function of one argument can be used in place of the strings; the
8904 function must return a formatted string.
8906 @item :efmt efmt
8907 Use this format to print numbers with exponentials.  The format should
8908 have @code{%s} twice for inserting mantissa and exponent, for example
8909 @code{"%s\\times10^@{%s@}"}.  The default is @code{"%s\\,(%s)"}.  This
8910 may also be a property list with column numbers and formats, for example
8911 @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}.  After
8912 @code{efmt} has been applied to a value, @code{fmt} will also be
8913 applied.  Similar to @code{fmt}, functions of two arguments can be
8914 supplied instead of strings.
8915 @end table
8917 @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
8918 @subsection Translator functions
8919 @cindex HTML, and Orgtbl mode
8920 @cindex translator function
8922 Orgtbl mode has several translator functions built-in: @code{orgtbl-to-csv}
8923 (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values)
8924 @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and @code{orgtbl-to-texinfo}.
8925 Except for @code{orgtbl-to-html}@footnote{The HTML translator uses the same
8926 code that produces tables during HTML export.}, these all use a generic
8927 translator, @code{orgtbl-to-generic}.  For example, @code{orgtbl-to-latex}
8928 itself is a very short function that computes the column definitions for the
8929 @code{tabular} environment, defines a few field and line separators and then
8930 hands over to the generic translator.  Here is the entire code:
8932 @lisp
8933 @group
8934 (defun orgtbl-to-latex (table params)
8935   "Convert the Orgtbl mode TABLE to LaTeX."
8936   (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
8937                                org-table-last-alignment ""))
8938          (params2
8939           (list
8940            :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
8941            :tend "\\end@{tabular@}"
8942            :lstart "" :lend " \\\\" :sep " & "
8943            :efmt "%s\\,(%s)" :hline "\\hline")))
8944     (orgtbl-to-generic table (org-combine-plists params2 params))))
8945 @end group
8946 @end lisp
8948 As you can see, the properties passed into the function (variable
8949 @var{PARAMS}) are combined with the ones newly defined in the function
8950 (variable @var{PARAMS2}).  The ones passed into the function (i.e. the
8951 ones set by the @samp{ORGTBL SEND} line) take precedence.  So if you
8952 would like to use the La@TeX{} translator, but wanted the line endings to
8953 be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
8954 overrule the default with
8956 @example
8957 #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
8958 @end example
8960 For a new language, you can either write your own converter function in
8961 analogy with the La@TeX{} translator, or you can use the generic function
8962 directly.  For example, if you have a language where a table is started
8963 with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
8964 started with @samp{!BL!}, ended with @samp{!EL!} and where the field
8965 separator is a TAB, you could call the generic translator like this (on
8966 a single line!):
8968 @example
8969 #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
8970                               :lstart "!BL! " :lend " !EL!" :sep "\t"
8971 @end example
8973 @noindent
8974 Please check the documentation string of the function
8975 @code{orgtbl-to-generic} for a full list of parameters understood by
8976 that function and remember that you can pass each of them into
8977 @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
8978 using the generic function.
8980 Of course you can also write a completely new function doing complicated
8981 things the generic translator cannot do.  A translator function takes
8982 two arguments.  The first argument is the table, a list of lines, each
8983 line either the symbol @code{hline} or a list of fields.  The second
8984 argument is the property list containing all parameters specified in the
8985 @samp{#+ORGTBL: SEND} line.  The function must return a single string
8986 containing the formatted table.  If you write a generally useful
8987 translator, please post it on @code{emacs-orgmode@@gnu.org} so that
8988 others can benefit from your work.
8990 @node  Radio lists,  , Translator functions, Tables in arbitrary syntax
8991 @subsection Radio lists
8992 @cindex radio lists
8993 @cindex org-list-insert-radio-list
8995 Sending and receiving radio lists works exactly the same way than
8996 sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
8997 need to load the @code{org-export-latex.el} package to use radio lists
8998 since the relevant code is there for now.}.  As for radio tables, you
8999 can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
9000 calling @code{org-list-insert-radio-list}.
9002 Here are the differences with radio tables:
9004 @itemize @minus
9005 @item
9006 Use @code{ORGLST} instead of @code{ORGTBL}.
9007 @item
9008 The available translation functions for radio lists don't take
9009 parameters.
9010 @item
9011 `C-c C-c' will work when pressed on the first item of the list.
9012 @end itemize
9014 Here is a La@TeX{} example.  Let's say that you have this in your
9015 La@TeX{} file:
9017 @example
9018 % BEGIN RECEIVE ORGLST to-buy
9019 % END RECEIVE ORGLST to-buy
9020 \begin@{comment@}
9021 #+ORGLIST: SEND to-buy orgtbl-to-latex
9022 - a new house
9023 - a new computer
9024   + a new keyboard
9025   + a new mouse
9026 - a new life
9027 \end@{comment@}
9028 @end example
9030 Pressing `C-c C-c' on @code{a new house} and will insert the converted
9031 La@TeX{} list between the two marker lines.
9033 @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Hacking
9034 @section Dynamic blocks
9035 @cindex dynamic blocks
9037 Org documents can contain @emph{dynamic blocks}.  These are
9038 specially marked regions that are updated by some user-written function.
9039 A good example for such a block is the clock table inserted by the
9040 command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
9042 Dynamic block are enclosed by a BEGIN-END structure that assigns a name
9043 to the block and can also specify parameters for the function producing
9044 the content of the block.
9046 #+BEGIN:dynamic block
9047 @example
9048 #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
9050 #+END:
9051 @end example
9053 Dynamic blocks are updated with the following commands
9055 @table @kbd
9056 @kindex C-c C-x C-u
9057 @item C-c C-x C-u
9058 Update dynamic block at point.
9059 @kindex C-u C-c C-x C-u
9060 @item C-u C-c C-x C-u
9061 Update all dynamic blocks in the current file.
9062 @end table
9064 Updating a dynamic block means to remove all the text between BEGIN and
9065 END, parse the BEGIN line for parameters and then call the specific
9066 writer function for this block to insert the new content.  If you want
9067 to use the original content in the writer function, you can use the
9068 extra parameter @code{:content}.
9070 For a block with name @code{myblock}, the writer function is
9071 @code{org-dblock-write:myblock} with as only parameter a property list
9072 with the parameters given in the begin line.  Here is a trivial example
9073 of a block that keeps track of when the block update function was last
9074 run:
9076 @example
9077 #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
9079 #+END:
9080 @end example
9082 @noindent
9083 The corresponding block writer function could look like this:
9085 @lisp
9086 (defun org-dblock-write:block-update-time (params)
9087    (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
9088      (insert "Last block update at: "
9089              (format-time-string fmt (current-time)))))
9090 @end lisp
9092 If you want to make sure that all dynamic blocks are always up-to-date,
9093 you could add the function @code{org-update-all-dblocks} to a hook, for
9094 example @code{before-save-hook}.  @code{org-update-all-dblocks} is
9095 written in a way that is does nothing in buffers that are not in
9096 @code{org-mode}.
9098 @node Special agenda views, Using the property API, Dynamic blocks, Hacking
9099 @section Special agenda views
9100 @cindex agenda views, user-defined
9102 Org provides a special hook that can be used to narrow down the
9103 selection made by any of the agenda views.  You may specify a function
9104 that is used at each match to verify if the match should indeed be part
9105 of the agenda view, and if not, how much should be skipped.
9107 Let's say you want to produce a list of projects that contain a WAITING
9108 tag anywhere in the project tree.  Let's further assume that you have
9109 marked all tree headings that define a project with the TODO keyword
9110 PROJECT.  In this case you would run a TODO search for the keyword
9111 PROJECT, but skip the match unless there is a WAITING tag anywhere in
9112 the subtree belonging to the project line.
9114 To achieve this, you must write a function that searches the subtree for
9115 the tag.  If the tag is found, the function must return @code{nil} to
9116 indicate that this match should not be skipped.  If there is no such
9117 tag, return the location of the end of the subtree, to indicate that
9118 search should continue from there.
9120 @lisp
9121 (defun my-skip-unless-waiting ()
9122   "Skip trees that are not waiting"
9123   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
9124     (if (re-search-forward ":waiting:" subtree-end t)
9125         nil          ; tag found, do not skip
9126       subtree-end))) ; tag not found, continue after end of subtree
9127 @end lisp
9129 Now you may use this function in an agenda custom command, for example
9130 like this:
9132 @lisp
9133 (org-add-agenda-custom-command
9134  '("b" todo "PROJECT"
9135    ((org-agenda-skip-function 'my-org-waiting-projects)
9136     (org-agenda-overriding-header "Projects waiting for something: "))))
9137 @end lisp
9139 Note that this also binds @code{org-agenda-overriding-header} to get a
9140 meaningful header in the agenda view.
9142 A general way to create custom searches is to base them on a search for
9143 entries with a certain level limit.  If you want to study all entries with
9144 your custom search function, simply do a search for @samp{LEVEL>0}, and then
9145 use @code{org-agenda-skip-function} to select the entries you really want to
9146 have.
9148 You may also put a Lisp form into @code{org-agenda-skip-function}.  In
9149 particular, you may use the functions @code{org-agenda-skip-entry-if}
9150 and @code{org-agenda-skip-subtree-if} in this form, for example:
9152 @table @code
9153 @item '(org-agenda-skip-entry-if 'scheduled)
9154 Skip current entry if it has been scheduled.
9155 @item '(org-agenda-skip-entry-if 'notscheduled)
9156 Skip current entry if it has not been scheduled.
9157 @item '(org-agenda-skip-entry-if 'deadline)
9158 Skip current entry if it has a deadline.
9159 @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
9160 Skip current entry if it has a deadline, or if it is scheduled.
9161 @item '(org-agenda-skip-entry 'regexp "regular expression")
9162 Skip current entry if the regular expression matches in the entry.
9163 @item '(org-agenda-skip-entry 'notregexp "regular expression")
9164 Skip current entry unless the regular expression matches.
9165 @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
9166 Same as above, but check and skip the entire subtree.
9167 @end table
9169 Therefore we could also have written the search for WAITING projects
9170 like this, even without defining a special function:
9172 @lisp
9173 (org-add-agenda-custom-command
9174  '("b" todo "PROJECT"
9175    ((org-agenda-skip-function '(org-agenda-skip-subtree-if
9176                                 'regexp ":waiting:"))
9177     (org-agenda-overriding-header "Projects waiting for something: "))))
9178 @end lisp
9180 @node Using the property API, Using the mapping API, Special agenda views, Hacking
9181 @section Using the property API
9182 @cindex API, for properties
9183 @cindex properties, API
9185 Here is a description of the functions that can be used to work with
9186 properties.
9188 @defun org-entry-properties &optional pom which
9189 Get all properties of the entry at point-or-marker POM.
9190 This includes the TODO keyword, the tags, time strings for deadline,
9191 scheduled, and clocking, and any additional properties defined in the
9192 entry.  The return value is an alist, keys may occur multiple times
9193 if the property key was used several times.
9194 POM may also be nil, in which case the current entry is used.
9195 If WHICH is nil or `all', get all properties.  If WHICH is
9196 `special' or `standard', only get that subclass.
9197 @end defun
9198 @defun org-entry-get pom property &optional inherit
9199 Get value of PROPERTY for entry at point-or-marker POM.  By default,
9200 this only looks at properties defined locally in the entry.  If INHERIT
9201 is non-nil and the entry does not have the property, then also check
9202 higher levels of the hierarchy.  If INHERIT is the symbol
9203 @code{selective}, use inheritance if and only if the setting of
9204 @code{org-use-property-inheritance} selects PROPERTY for inheritance.
9205 @end defun
9207 @defun org-entry-delete pom property
9208 Delete the property PROPERTY from entry at point-or-marker POM.
9209 @end defun
9211 @defun org-entry-put pom property value
9212 Set PROPERTY to VALUE for entry at point-or-marker POM.
9213 @end defun
9215 @defun org-buffer-property-keys &optional include-specials
9216 Get all property keys in the current buffer.
9217 @end defun
9219 @defun org-insert-property-drawer
9220 Insert a property drawer at point.
9221 @end defun
9223 @defun org-entry-add-to-multivalued-property pom property value
9224 Treat the value of the property PROPERTY as a whitespace-separated list of
9225 values and make sure that VALUE is in this list.
9226 @end defun
9228 @defun org-entry-remove-from-multivalued-property pom property value
9229 Treat the value of the property PROPERTY as a whitespace-separated list of
9230 values and make sure that VALUE is @emph{not} in this list.
9231 @end defun
9233 @defun org-entry-member-in-multivalued-property pom property value
9234 Treat the value of the property PROPERTY as a whitespace-separated list of
9235 values and check if VALUE is in this list.
9236 @end defun
9238 @node Using the mapping API,  , Using the property API, Hacking
9239 @section Using the mapping API
9240 @cindex API, for mapping
9241 @cindex mapping entries, API
9243 Org has sophisticated mapping capabilities to find all entries satisfying
9244 certain criteria.  Internally, this functionality is used to produce agenda
9245 views, but there is also an API that can be used to execute arbitrary
9246 functions for each or selected entries.  The main entry point for this API
9247 is: 
9249 @defun org-map-entries func &optional match scope &rest skip
9250 Call FUNC at each headline selected by MATCH in SCOPE.
9252 FUNC is a function or a lisp form.  The function will be called without
9253 arguments, with the cursor positioned at the beginning of the headline.
9254 The return values of all calls to the function will be collected and
9255 returned as a list.
9257 MATCH is a tags/property/todo match as it is used in the agenda tags view.
9258 Only headlines that are matched by this query will be considered during
9259 the iteration.  When MATCH is nil or t, all headlines will be
9260 visited by the iteration.
9262 SCOPE determines the scope of this command.  It can be any of:
9264 @example
9265 nil     @r{the current buffer, respecting the restriction if any}
9266 tree    @r{the subtree started with the entry at point}
9267 file    @r{the current buffer, without restriction}
9268 file-with-archives
9269         @r{the current buffer, and any archives associated with it}
9270 agenda  @r{all agenda files}
9271 agenda-with-archives
9272         @r{all agenda files with any archive files associated with them}
9273 (file1 file2 ...)
9274         @r{if this is a list, all files in the list will be scanned}
9275 @end example
9277 The remaining args are treated as settings for the skipping facilities of
9278 the scanner.  The following items can be given here:
9280 @example
9281 archive   @r{skip trees with the archive tag}
9282 comment   @r{skip trees with the COMMENT keyword}
9283 function or Lisp form
9284           @r{will be used as value for @code{org-agenda-skip-function},}
9285           @r{so whenever the the function returns t, FUNC}
9286           @r{will not be called for that entry and search will}
9287           @r{continue from the point where the function leaves it}
9288 @end example
9289 @end defun
9291 The function given to that mapping routine can really do anything you like.
9292 It can uce the property API (@pxref{Using the property API}) to gather more
9293 information about the entry, or in order to change metadate in the entry.
9294 Here are a couple of functions that might be handy:
9296 @defun org-todo &optional arg
9297 Change the TODO state of the entry, see the docstring of the functions for
9298 the many possible values for the argument ARG.
9299 @end defun
9301 @defun org-priority &optional action
9302 Change the priority of the entry, see the docstring of this function for the
9303 possible values for ACTION.
9304 @end defun
9306 @defun org-toggle-tag tag &optional onoff
9307 Toggle the tag TAG in the current entry.  Setting ONOFF to either @code{on}
9308 or @code{off} will not toggle tag, but ensure that it is either on or off.
9309 @end defun
9311 @defun org-promote
9312 Promote the current entry.
9313 @end defun
9315 @defun org-demote
9316 Demote the current entry.
9317 @end defun
9319 Here is a simple example that will turn all entries in the current file with
9320 a tag @code{TOMORROW} into TODO entries with the keyword @code{UPCOMING}.
9321 Entries in comment trees and in archive trees will be ignored.
9323 @lisp
9324 (org-map-entries
9325    '(org-todo "UPCOMING")
9326    "+TOMORROW" 'file 'archive 'comment)
9327 @end lisp
9329 The following example counts the number of entries with TODO keyword
9330 @code{WAITING}, in all agenda files.
9332 @lisp
9333 (length (org-map-entries t "/+WAITING" nil 'agenda))
9334 @end lisp
9336 @node History and Acknowledgments, Main Index, Hacking, Top
9337 @appendix History and Acknowledgments
9338 @cindex acknowledgments
9339 @cindex history
9340 @cindex thanks
9342 Org was borne in 2003, out of frustration over the user interface
9343 of the Emacs Outline mode.  I was trying to organize my notes and
9344 projects, and using Emacs seemed to be the natural way to go.  However,
9345 having to remember eleven different commands with two or three keys per
9346 command, only to hide and show parts of the outline tree, that seemed
9347 entirely unacceptable to me.  Also, when using outlines to take notes, I
9348 constantly want to restructure the tree, organizing it parallel to my
9349 thoughts and plans.  @emph{Visibility cycling} and @emph{structure
9350 editing} were originally implemented in the package
9351 @file{outline-magic.el}, but quickly moved to the more general
9352 @file{org.el}.  As this environment became comfortable for project
9353 planning, the next step was adding @emph{TODO entries}, basic @emph{time
9354 stamps}, and @emph{table support}.  These areas highlight the two main
9355 goals that Org still has today: To create a new, outline-based,
9356 plain text mode with innovative and intuitive editing features, and to
9357 incorporate project planning functionality directly into a notes file.
9359 A special thanks goes to @i{Bastien Guerry} who has not only writen a large
9360 number of extensions to Org (most of them integrated into the core by now),
9361 but has also helped the development and maintenance of Org so much that he
9362 should be considered co-author of this package.
9364 Since the first release, literally thousands of emails to me or on
9365 @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
9366 reports, feedback, new ideas, and sometimes patches and add-on code.
9367 Many thanks to everyone who has helped to improve this package.  I am
9368 trying to keep here a list of the people who had significant influence
9369 in shaping one or more aspects of Org.  The list may not be
9370 complete, if I have forgotten someone, please accept my apologies and
9371 let me know.
9373 @itemize @bullet
9375 @item
9376 @i{Russel Adams} came up with the idea for drawers.
9377 @item
9378 @i{Thomas Baumann} wrote @file{org-bbdb.el} and @file{org-mhe.el}.
9379 @item
9380 @i{Alex Bochannek} provided a patch for rounding time stamps.
9381 @item
9382 @i{Charles Cave}'s suggestion sparked the implementation of templates
9383 for Remember.
9384 @item
9385 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
9386 specified time.
9387 @item
9388 @i{Gregory Chernov} patched support for lisp forms into table
9389 calculations and improved XEmacs compatibility, in particular by porting
9390 @file{nouline.el} to XEmacs.
9391 @item
9392 @i{Sacha Chua} suggested to copy some linking code from Planner.
9393 @item
9394 @i{Eddward DeVilla} proposed and tested checkbox statistics.  He also
9395 came up with the idea of properties, and that there should be an API for
9396 them.
9397 @item
9398 @i{Kees Dullemond} used to edit projects lists directly in HTML and so
9399 inspired some of the early development, including HTML export.  He also
9400 asked for a way to narrow wide table columns.
9401 @item
9402 @i{Christian Egli} converted the documentation into Texinfo format,
9403 patched CSS formatting into the HTML exporter, and inspired the agenda.
9404 @item
9405 @i{David Emery} provided a patch for custom CSS support in exported
9406 HTML agendas.
9407 @item
9408 @i{Nic Ferrier} contributed mailcap and XOXO support.
9409 @item
9410 @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
9411 @item
9412 @i{John Foerch} figured out how to make incremental search show context
9413 around a match in a hidden outline tree.
9414 @item
9415 @i{Niels Giesen} had the idea to automatically archive DONE trees.
9416 @item
9417 @i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and
9418 has been prolific with patches, ideas, and bug reports.
9419 @item
9420 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
9421 @item
9422 @i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
9423 task state change logging, and the clocktable.  His clear explanations have
9424 been critical when we started to adopt the GIT version control system.
9425 @item
9426 @i{Phil Jackson} wrote @file{org-irc.el}.
9427 @item
9428 @i{Scott Jaderholm} proposed footnotes, control over whitespace between
9429 folded entries, and column view for properties.
9430 @item
9431 @i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}.
9432 @item
9433 @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it.  He also
9434 provided frequent feedback and some patches.
9435 @item
9436 @i{Jason F. McBrayer} suggested agenda export to CSV format.
9437 @item
9438 @i{Max Mikhanosha} came up with the idea of refiling.
9439 @item
9440 @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
9441 basis.
9442 @item
9443 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
9444 happy.
9445 @item
9446 @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file
9447 and to be able to quickly restrict the agenda to a subtree.
9448 @item
9449 @i{Todd Neal} provided patches for links to Info files and elisp forms.
9450 @item
9451 @i{Tim O'Callaghan} suggested in-file links, search options for general
9452 file links, and TAGS.
9453 @item
9454 @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
9455 into Japanese.
9456 @item
9457 @i{Oliver Oppitz} suggested multi-state TODO items.
9458 @item
9459 @i{Scott Otterson} sparked the introduction of descriptive text for
9460 links, among other things.
9461 @item
9462 @i{Pete Phillips} helped during the development of the TAGS feature, and
9463 provided frequent feedback.
9464 @item
9465 @i{T.V. Raman} reported bugs and suggested improvements.
9466 @item
9467 @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
9468 control.
9469 @item
9470 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
9471 @item
9472 @i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
9473 webpages derived from Org using an Info-like, or a folding interface with
9474 single key navigation.
9475 @item
9476 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
9477 conflict with @file{allout.el}.
9478 @item
9479 @i{Jason Riedy} generalized the send-receive mechanism for orgtbl tables with
9480 extensive patches.
9481 @item
9482 @i{Philip Rooke} created the Org reference card, provided lots
9483 of feedback, developed and applied standards to the Org documentation and
9484 wrote the manual for the contributed packages.
9485 @item
9486 @i{Christian Schlauer} proposed angular brackets around links, among
9487 other things.
9488 @item
9489 Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s
9490 @file{organizer-mode.el}.
9491 @item
9492 @i{Ilya Shlyakhter} proposed the Archive Sibling.
9493 @item
9494 @i{Daniel Sinder} came up with the idea of internal archiving by locking
9495 subtrees.
9496 @item
9497 @i{Dale Smith} proposed link abbreviations.
9498 @item
9499 @i{Adam Spiers} asked for global linking commands, inspired the link
9500 extension system, added support for mairix, and proposed the mapping API.
9501 @item
9502 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
9503 chapter about publishing.
9504 @item
9505 @i{J@"urgen Vollmer} contributed code generating the table of contents
9506 in HTML output.
9507 @item
9508 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
9509 keyword.
9510 @item
9511 @i{David Wainberg} suggested archiving, and improvements to the linking
9512 system.
9513 @item
9514 @i{John Wiegley} wrote @file{emacs-wiki.el}, @file{planner.el}, and
9515 @file{muse.el}, which have similar goals as Org.  Initially the development
9516 of Org was fully independent because I was not aware of the existence of
9517 these packages.  But with time I have accasionally looked at John's code and
9518 learned a lot from it.  John has also contributed a number of great ideas and
9519 patches directly to Org, including the file @code{org-mac-message.el}'
9520 @item
9521 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
9522 linking to Gnus.
9523 @item
9524 @i{Roland Winkler} requested additional key bindings to make Org
9525 work on a tty.
9526 @item
9527 @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
9528 and contributed various ideas and code snippets.
9529 @end itemize
9532 @node Main Index, Key Index, History and Acknowledgments, Top
9533 @unnumbered The Main Index
9535 @printindex cp
9537 @node Key Index,  , Main Index, Top
9538 @unnumbered Key Index
9540 @printindex ky
9542 @bye
9544 @ignore
9545         arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
9546 @end ignore
9548 @c Local variables:
9549 @c ispell-local-dictionary: "en_US-w_accents"
9550 @c ispell-local-pdict: "./.aspell.org.pws"
9551 @c fill-column: 77
9552 @c End: