Implement actions tied to cursor date in agenda.
[org-mode.git] / doc / org.texi
blob9f5c6b0ff801b07f3d38fe626c9e71194bd2cd7d
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.  You should have received a
46 copy of the ``GNU Free Documentation License'' with GNU Emacs.  If not, see
47 @url{http://www.gnu.org/licenses/}.
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.
4506 @kindex C-c C-x C-k
4507 @kindex k a
4508 @kindex k s
4509 @item C-c C-x C-k
4510 Mark the current entry for agenda action.  After you have marked the entry
4511 like this, you can open the agenda or the calendar to find an appropriate
4512 date.  With the cursor on the selected date, press @kbd{k s} or @kbd{k d} to
4513 schedule the marked item.
4514 @end table
4516 @node Repeated tasks,  , Inserting deadline/schedule, Deadlines and scheduling
4517 @subsection Repeated tasks
4519 Some tasks need to be repeated again and again.  Org mode helps to
4520 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
4521 or plain time stamp.  In the following example
4522 @example
4523 ** TODO Pay the rent
4524    DEADLINE: <2005-10-01 Sat +1m>
4525 @end example
4526 the @code{+1m} is a repeater; the intended interpretation is that the
4527 task has a deadline on <2005-10-01> and repeats itself every (one) month
4528 starting from that time.  If you need both a repeater and a special
4529 warning period in a deadline entry, the repeater comes first and the
4530 warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
4532 Deadlines and scheduled items produce entries in the agenda when they
4533 are over-due, so it is important to be able to mark such an entry as
4534 completed once you have done so.  When you mark a DEADLINE or a SCHEDULE
4535 with the TODO keyword DONE, it will no longer produce entries in the
4536 agenda.  The problem with this is, however, that then also the
4537 @emph{next} instance of the repeated entry will not be active.  Org mode
4538 deals with this in the following way: When you try to mark such an entry
4539 DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
4540 time stamp by the repeater interval, and immediately set the entry state
4541 back to TODO.  In the example above, setting the state to DONE would
4542 actually switch the date like this:
4544 @example
4545 ** TODO Pay the rent
4546    DEADLINE: <2005-11-01 Tue +1m>
4547 @end example
4549 A timestamp@footnote{You can change this using the option
4550 @code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
4551 @code{lognoterepeat}, and @code{nologrepeat}.  With @code{lognoterepeat}, you
4552 will aslo be prompted for a note.} will be added under the deadline, to keep
4553 a record that you actually acted on the previous instance of this deadline.
4555 As a consequence of shifting the base date, this entry will no longer be
4556 visible in the agenda when checking past dates, but all future instances
4557 will be visible.
4559 With the @samp{+1m} cookie, the date shift will always be exactly one
4560 month.  So if you have not payed the rent for three months, marking this
4561 entry DONE will still keep it as an overdue deadline.  Depending on the
4562 task, this may not be the best way to handle it.  For example, if you
4563 forgot to call you father for 3 weeks, it does not make sense to call
4564 him 3 times in a single day to make up for it.  Finally, there are tasks
4565 like changing batteries which should always repeat a certain time
4566 @i{after} the last time you did it.  For these tasks, Org mode has
4567 special repeaters markers with @samp{++} and @samp{.+}.  For example:
4569 @example
4570 ** TODO Call Father
4571    DEADLINE: <2008-02-10 Sun ++1w>
4572    Marking this DONE will shift the date by at least one week,
4573    but also by as many weeks as it takes to get this date into
4574    the future.  However, it stays on a Sunday, even if you called
4575    and marked it done on Saturday.
4576 ** TODO Check the batteries in the smoke detectors
4577    DEADLINE: <2005-11-01 Tue .+1m>
4578    Marking this DONE will shift the date to one month after
4579    today.
4580 @end example
4582 You may have both scheduling and deadline information for a specific
4583 task - just make sure that the repeater intervals on both are the same.
4585 @node Clocking work time, Effort estimates, Deadlines and scheduling, Dates and Times
4586 @section Clocking work time
4588 Org mode allows you to clock the time you spent on specific tasks in a
4589 project.  When you start working on an item, you can start the clock.
4590 When you stop working on that task, or when you mark the task done, the
4591 clock is stopped and the corresponding time interval is recorded.  It
4592 also computes the total time spent on each subtree of a project.
4594 @table @kbd
4595 @kindex C-c C-x C-i
4596 @item C-c C-x C-i
4597 Start the clock on the current item (clock-in).  This inserts the CLOCK
4598 keyword together with a timestamp.  If this is not the first clocking of
4599 this item, the multiple CLOCK lines will be wrapped into a
4600 @code{:CLOCK:} drawer (see also the variable
4601 @code{org-clock-into-drawer}).  When called with a @kbd{C-u} prefix argument,
4602 select the task from a list of recently clocked tasks.  With two @kbd{C-u
4603 C-u} prefixes, clock into the task at point and mark it as the default task.
4604 The default task will always be available when selecting a clocking task,
4605 with letter @kbd{d}.
4606 @kindex C-c C-x C-o
4607 @item C-c C-x C-o
4608 Stop the clock (clock-out).  The inserts another timestamp at the same
4609 location where the clock was last started.  It also directly computes
4610 the resulting time in inserts it after the time range as @samp{=>
4611 HH:MM}.  See the variable @code{org-log-note-clock-out} for the
4612 possibility to record an additional note together with the clock-out
4613 time stamp@footnote{The corresponding in-buffer setting is:
4614 @code{#+STARTUP: lognoteclock-out}}.
4615 @kindex C-c C-y
4616 @item C-c C-y
4617 Recompute the time interval after changing one of the time stamps.  This
4618 is only necessary if you edit the time stamps directly.  If you change
4619 them with @kbd{S-@key{cursor}} keys, the update is automatic.
4620 @kindex C-c C-t
4621 @item C-c C-t
4622 Changing the TODO state of an item to DONE automatically stops the clock
4623 if it is running in this same item.
4624 @kindex C-c C-x C-x
4625 @item C-c C-x C-x
4626 Cancel the current clock.  This is useful if a clock was started by
4627 mistake, or if you ended up working on something else.
4628 @kindex C-c C-x C-j
4629 @item C-c C-x C-j
4630 Jump to the entry that contains the currently running clock.  With a
4631 @kbd{C-u} prefix arg, select the target task from a list of recently clocked
4632 tasks.
4633 @kindex C-c C-x C-d
4634 @item C-c C-x C-d
4635 Display time summaries for each subtree in the current buffer.  This
4636 puts overlays at the end of each headline, showing the total time
4637 recorded under that heading, including the time of any subheadings. You
4638 can use visibility cycling to study the tree, but the overlays disappear
4639 when you change the buffer (see variable
4640 @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
4641 @kindex C-c C-x C-r
4642 @item C-c C-x C-r
4643 Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
4644 report as an Org mode table into the current file.  When the cursor is
4645 at an existing clock table, just update it.  When called with a prefix
4646 argument, jump to the first clock report in the current document and
4647 update it.
4648 @cindex #+BEGIN: clocktable
4649 @example
4650 #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
4651 #+END: clocktable
4652 @end example
4653 @noindent
4654 If such a block already exists at point, its content is replaced by the
4655 new table.  The @samp{BEGIN} line can specify options:
4656 @example
4657 :maxlevel    @r{Maximum level depth to which times are listed in the table.}
4658 :emphasize   @r{When @code{t}, emphasize level one and level two items}
4659 :scope       @r{The scope to consider.  This can be any of the following:}
4660              nil        @r{the current buffer or narrowed region}
4661              file       @r{the full current buffer}
4662              subtree    @r{the subtree where the clocktable is located}
4663              treeN      @r{the surrounding level N tree, for example @code{tree3}}
4664              tree       @r{the surrounding level 1 tree}
4665              agenda     @r{all agenda files}
4666              ("file"..) @r{scan these files}
4667              file-with-archives    @r{current file and its archives}
4668              agenda-with-archives  @r{all agenda files, including archives}
4669 :block       @r{The time block to consider.  This block is specified either}
4670              @r{absolute, or relative to the current time and may be any of}
4671              @r{these formats:}
4672              2007-12-31    @r{New year eve 2007}
4673              2007-12       @r{December 2007}
4674              2007-W50      @r{ISO-week 50 in 2007}
4675              2007          @r{the year 2007}
4676              today, yesterday, today-N          @r{a relative day}
4677              thisweek, lastweek, thisweek-N     @r{a relative week}
4678              thismonth, lastmonth, thismonth-N  @r{a relative month}
4679              thisyear, lastyear, thisyear-N     @r{a relative year}
4680              @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
4681 :tstart      @r{A time string specifying when to start considering times}
4682 :tend        @r{A time string specifying when to stop considering times}
4683 :step        @r{@code{week} or @code{day}, to split the table into chunks.}
4684              @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
4685 :link        @r{Link the item headlines in the table to their origins}
4686 @end example
4687 So to get a clock summary of the current level 1 tree, for the current
4688 day, you could write
4689 @example
4690 #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
4691 #+END: clocktable
4692 @end example
4693 and to use a specific time range you could write@footnote{Note that all
4694 parameters must be specified in a single line - the line is broken here
4695 only to fit it onto the manual.}
4696 @example
4697 #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
4698                     :tend "<2006-08-10 Thu 12:00>"
4699 #+END: clocktable
4700 @end example
4701 @kindex C-c C-c
4702 @item C-c C-c
4703 @kindex C-c C-x C-u
4704 @itemx C-c C-x C-u
4705 Update dynamical block at point.  The cursor needs to be in the
4706 @code{#+BEGIN} line of the dynamic block.
4707 @kindex C-u C-c C-x C-u
4708 @item C-u C-c C-x C-u
4709 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
4710 you have several clock table blocks in a buffer.
4711 @kindex S-@key{left}
4712 @kindex S-@key{right}
4713 @item S-@key{left}
4714 @itemx S-@key{right}
4715 Shift the current @code{:block} interval and update the table.  The cursor
4716 needs to be in the @code{#+BEGIN: clocktable} line for this command.  If
4717 @code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
4718 @end table
4720 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
4721 the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
4722 worked on or closed during a day.
4724 @node Effort estimates,  , Clocking work time, Dates and Times
4725 @section Effort estimates
4726 @cindex Effort estimates
4728 If you want to plan your work in a very detailed way, or if you need to
4729 produce offers with quotations of the estimated work effort, you may want to
4730 assign effort estimates to entries.  If you are also clocking your work, you
4731 may later want to compare the planned effort with the actual working time, a
4732 great way to improve planning estimates.  Effort estimates are stored in a
4733 special property @samp{Effort}@footnote{You may change the property being
4734 used with the variable @code{org-effort-property}.}.  Clearly the best way to
4735 work with effort estimates is through column view (@pxref{Column view}).  You
4736 should start by setting up discrete values for effort estimates, and a
4737 @code{COLUMNS} format that displays these values together with clock sums (if
4738 you want to clock your time).  For a specific buffer you can use
4740 @example
4741 #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00
4742 #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
4743 @end example
4745 @noindent
4746 or you can set up these values globally by customizing the variables
4747 @code{org-global-properties} and @code{org-columns-default-format}.  In
4748 particular if you want to use this setup also in the agenda, a global setup
4749 may be advised.
4751 The way to assign estimates to individual items is then to switch to column
4752 mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the
4753 value.  The values you enter will immediately be summed up in the hierarchy.
4754 In the column next to it, any clocked time will be displayed.
4756 If you switch to column view in the daily/weekly agenda, the effort column
4757 will summarize the estimated work effort for each day@footnote{Please note
4758 the pitfalls of summing hierarchical data in a flat list (@pxref{Agenda
4759 column view}).}, and you can use this to find space in your schedule.  To get
4760 an overview of the entire part of the day that is committed, you can set the
4761 option @code{org-agenda-columns-add-appointments-to-effort-sum}.  The
4762 appointments on a day that take place over a specified time interval will
4763 then also be added to the load estimate of the day.
4765 @node Remember, Agenda Views, Dates and Times, Top
4766 @chapter Remember
4767 @cindex @file{remember.el}
4769 The @i{Remember} package by John Wiegley lets you store quick notes with
4770 little interruption of your work flow.  See
4771 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
4772 information.  It is an excellent way to add new notes and tasks to
4773 Org files.  Org significantly expands the possibilities of
4774 @i{remember}: You may define templates for different note types, and
4775 associate target files and headlines with specific templates.  It also
4776 allows you to select the location where a note should be stored
4777 interactively, on the fly.
4779 @menu
4780 * Setting up Remember::         Some code for .emacs to get things going
4781 * Remember templates::          Define the outline of different note types
4782 * Storing notes::               Directly get the note to where it belongs
4783 * Refiling notes::              Moving a note or task to a project
4784 @end menu
4786 @node Setting up Remember, Remember templates, Remember, Remember
4787 @section Setting up Remember
4789 The following customization will tell @i{remember} to use org files as
4790 target, and to create annotations compatible with Org links.
4792 @example
4793 (org-remember-insinuate)
4794 (setq org-directory "~/path/to/my/orgfiles/")
4795 (setq org-default-notes-file (concat org-directory "/notes.org"))
4796 (define-key global-map "\C-cr" 'org-remember)
4797 @end example
4799 The last line binds the command @code{org-remember} to a global
4800 key@footnote{Please select your own key, @kbd{C-c r} is only a
4801 suggestion.}.  @code{org-remember} basically just calls @code{remember},
4802 but it makes a few things easier: If there is an active region, it will
4803 automatically copy the region into the remember buffer.  It also allows
4804 to jump to the buffer and location where remember notes are being
4805 stored: Just call @code{org-remember} with a prefix argument.  If you
4806 use two prefix arguments, Org jumps to the location where the last
4807 remember note was stored.
4809 You can also call @code{org-remember} in a special way from the agenda,
4810 using the @kbd{k r} key combination.  With this access, any time stamps
4811 inserted by the selected remember template (see below) will default to
4812 the cursor date in the agenda, rather than to the current date.
4814 @node Remember templates, Storing notes, Setting up Remember, Remember
4815 @section Remember templates
4816 @cindex templates, for remember
4818 In combination with Org, you can use templates to generate
4819 different types of @i{remember} notes.  For example, if you would like
4820 to use one template to create general TODO entries, another one for
4821 journal entries, and a third one for collecting random ideas, you could
4822 use:
4824 @example
4825 (setq org-remember-templates
4826  '(("Todo" ?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org" "Tasks")
4827    ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")
4828    ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
4829 @end example
4831 @noindent In these entries, the first string is just a name, and the
4832 character specifies how to select the template.  It is useful if the
4833 character is also the first letter of the name.  The next string specifies
4834 the template.  Two more (optional) strings give the file in which, and the
4835 headline under which the new note should be stored.  The file (if not present
4836 or @code{nil}) defaults to @code{org-default-notes-file}, the heading to
4837 @code{org-remember-default-headline}.  If the file name is not an absolute
4838 path, it will be interpreted relative to @code{org-directory}.  The heading
4839 can also be the symbols @code{top} or @code{bottom} to send note as level 1
4840 entries to the beginning or end of the file, respectively.
4842 An optional sixth element specifies the contexts in which the user can select
4843 the template.  This element can be a list of major modes or a function.
4844 @code{org-remember} will first check whether the function returns @code{t} or
4845 if we are in any of the listed major mode, and exclude templates fo which
4846 this condition is not fulfilled.  Templates that do not specify this element
4847 at all, or that use @code{nil} or @code{t} as a value will always be
4848 selectable.
4850 So for example:
4852 @example
4853 (setq org-remember-templates
4854  '(("Bug" ?b "* BUG %?\n  %i\n  %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
4855    ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org" "X" my-check)
4856    ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
4857 @end example
4859 The first template will only be available when invoking @code{org-remember}
4860 from an buffer in @code{emacs-lisp-mode}.  The second template will only be
4861 available when the function @code{my-check} returns @code{t}.  The third
4862 template will be proposed in any context.
4864 When you call @kbd{M-x org-remember} (or @kbd{M-x remember}) to remember
4865 something, Org will prompt for a key to select the template (if you have
4866 more than one template) and then prepare the buffer like
4867 @example
4868 * TODO
4869   [[file:link to where you called remember]]
4870 @end example
4872 @noindent
4873 During expansion of the template, special @kbd{%}-escapes allow dynamic
4874 insertion of content:
4875 @example
4876 %^@{prompt@}  @r{prompt the user for a string and replace this sequence with it.}
4877             @r{You may specify a default value and a completion table with}
4878             @r{%^@{prompt|default|completion2|completion3...@}}
4879             @r{The arrow keys access a prompt-specific history.}
4880 %a          @r{annotation, normally the link created with @code{org-store-link}}
4881 %A          @r{like @code{%a}, but prompt for the description part}
4882 %i          @r{initial content, the region when remember is called with C-u.}
4883             @r{The entire text will be indented like @code{%i} itself.}
4884 %t          @r{time stamp, date only}
4885 %T          @r{time stamp with date and time}
4886 %u, %U      @r{like the above, but inactive time stamps}
4887 %^t         @r{like @code{%t}, but prompt for date.  Similarly @code{%^T}, @code{%^u}, @code{%^U}}
4888             @r{You may define a prompt like @code{%^@{Birthday@}t}}
4889 %n          @r{user name (taken from @code{user-full-name})}
4890 %c          @r{Current kill ring head.}
4891 %x          @r{Content of the X clipboard.}
4892 %^C         @r{Interactive selection of which kill or clip to use.}
4893 %^L         @r{Like @code{%^C}, but insert as link.}
4894 %^g         @r{prompt for tags, with completion on tags in target file.}
4895 %^G         @r{prompt for tags, with completion all tags in all agenda files.}
4896 %:keyword   @r{specific information for certain link types, see below}
4897 %[pathname] @r{insert the contents of the file given by @code{pathname}}
4898 %(sexp)     @r{evaluate elisp @code{(sexp)} and replace with the result}
4899 %!          @r{immediately store note after completing the template}
4900             @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
4901 %&          @r{jump to target location immediately after storing note}
4902 @end example
4904 @noindent
4905 For specific link types, the following keywords will be
4906 defined@footnote{If you define your own link types (@pxref{Adding
4907 hyperlink types}), any property you store with
4908 @code{org-store-link-props} can be accessed in remember templates in a
4909 similar way.}:
4911 @example
4912 Link type          |  Available keywords
4913 -------------------+----------------------------------------------
4914 bbdb               |  %:name %:company
4915 bbdb               |  %::server %:port %:nick
4916 vm, wl, mh, rmail  |  %:type %:subject %:message-id
4917                    |  %:from %:fromname %:fromaddress
4918                    |  %:to   %:toname   %:toaddress
4919                    |  %: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}.}}
4920 gnus               |  %:group, @r{for messages also all email fields}
4921 w3, w3m            |  %:url
4922 info               |  %:file %:node
4923 calendar           |  %:date"
4924 @end example
4926 @noindent
4927 To place the cursor after template expansion use:
4929 @example
4930 %?          @r{After completing the template, position cursor here.}
4931 @end example
4933 @noindent
4934 If you change your mind about which template to use, call
4935 @code{org-remember} in the remember buffer.  You may then select a new
4936 template that will be filled with the previous context information.
4938 @node Storing notes, Refiling notes, Remember templates, Remember
4939 @section Storing notes
4941 When you are finished preparing a note with @i{remember}, you have to press
4942 @kbd{C-c C-c} to file the note away.  If you have started the clock in the
4943 remember buffer, you will first be asked if you want to clock out
4944 now@footnote{To avoid this query, configure the variable
4945 @code{org-remember-clock-out-on-exit}.}.  If you answer @kbd{n}, the clock
4946 will continue to run after the note is filed away.
4948 The handler will then store the note in the file and under the headline
4949 specified in the template, or it will use the default file and headlines.
4950 The window configuration will be restored, sending you back to the working
4951 context before the call to @code{remember}.  To re-use the location found
4952 during the last call to @code{remember}, exit the remember buffer with
4953 @kbd{C-u C-u C-c C-c}, i.e. specify a double prefix argument to @kbd{C-c
4954 C-c}.
4956 If you want to store the note directly to a different place, use
4957 @kbd{C-u C-c C-c} instead to exit remember@footnote{Configure the
4958 variable @code{org-remember-store-without-prompt} to make this behavior
4959 the default.}.  The handler will then first prompt for a target file -
4960 if you press @key{RET}, the value specified for the template is used.
4961 Then the command offers the headings tree of the selected file, with the
4962 cursor position at the default headline (if you had specified one in the
4963 template).  You can either immediately press @key{RET} to get the note
4964 placed there.  Or you can use the following keys to find a different
4965 location:
4966 @example
4967 @key{TAB}         @r{Cycle visibility.}
4968 @key{down} / @key{up}   @r{Next/previous visible headline.}
4969 n / p        @r{Next/previous visible headline.}
4970 f / b        @r{Next/previous headline same level.}
4971 u            @r{One level up.}
4972 @c 0-9          @r{Digit argument.}
4973 @end example
4974 @noindent
4975 Pressing @key{RET} or @key{left} or @key{right}
4976 then leads to the following result.
4978 @multitable @columnfractions 0.2 0.15 0.65
4979 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
4980 @item on headline     @tab @key{RET}              @tab as sublevel of the heading at cursor, first or last
4981 @item                 @tab                        @tab depending on @code{org-reverse-note-order}.
4982 @item                 @tab @key{left}/@key{right} @tab as same level, before/after current heading
4983 @item buffer-start    @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
4984 @item                 @tab @tab depending on @code{org-reverse-note-order}.
4985 @item not on headline @tab @key{RET}
4986       @tab at cursor position, level taken from context.
4987 @end multitable
4989 Before inserting the text into a tree, the function ensures that the
4990 text has a headline, i.e. a first line that starts with a @samp{*}.  If
4991 not, a headline is constructed from the current date and some additional
4992 data.  If you have indented the text of the note below the headline, the
4993 indentation will be adapted if inserting the note into the tree requires
4994 demotion from level 1.
4996 @node Refiling notes,  , Storing notes, Remember
4997 @section Refiling notes
4998 @cindex refiling notes
5000 Remember is usually used to quickly capture notes and tasks into one or
5001 a few capture lists.  When reviewing the captured data, you may want to
5002 refile some of the entries into a different list, for example into a
5003 project.  Cutting, finding the right location and then pasting the note
5004 is cumbersome.  To simplify this process, you can use the following
5005 special command:
5007 @table @kbd
5008 @kindex C-c C-w
5009 @item C-c C-w
5010 Refile the entry at point.  This command offers possible locations for
5011 refiling the entry and lets you select one with completion.  The item is
5012 filed below the target heading as a subitem.  Depending on
5013 @code{org-reverse-note-order}, it will be either the first of last
5014 subitem.@* By default, all level 1 headlines in the current buffer are
5015 considered to be targets, but you can have more complex definitions
5016 across a number of files.  See the variable @code{org-refile-targets}
5017 for details.  If you would like to select a location via a file-pathlike
5018 completion along the outline path, see the variable
5019 @code{org-refile-use-outline-path}.
5020 @kindex C-u C-c C-w
5021 @item C-u C-c C-w
5022 Use the refile interface to jump to a heading.
5023 @kindex C-u C-u C-c C-w
5024 @item C-u C-u C-c C-w
5025 Jump to the location where @code{org-refile} last moved a tree to.
5026 @end table
5028 @node Agenda Views, Embedded LaTeX, Remember, Top
5029 @chapter Agenda Views
5030 @cindex agenda views
5032 Due to the way Org works, TODO items, time-stamped items, and
5033 tagged headlines can be scattered throughout a file or even a number of
5034 files.  To get an overview of open action items, or of events that are
5035 important for a particular date, this information must be collected,
5036 sorted and displayed in an organized way.
5038 Org can select items based on various criteria, and display them
5039 in a separate buffer.  Seven different view types are provided:
5041 @itemize @bullet
5042 @item
5043 an @emph{agenda} that is like a calendar and shows information
5044 for specific dates,
5045 @item
5046 a @emph{TODO list} that covers all unfinished
5047 action items,
5048 @item
5049 a @emph{tags view}, showings headlines based on
5050 the tags associated with them,
5051 @item
5052 a @emph{timeline view} that shows all events in a single Org file,
5053 in time-sorted view,
5054 @item
5055 a @emph{keyword search view} that shows all entries from multiple files
5056 that contain specified keywords.
5057 @item
5058 a @emph{stuck projects view} showing projects that currently don't move
5059 along, and
5060 @item
5061 @emph{custom views} that are special tag/keyword searches and
5062 combinations of different views.
5063 @end itemize
5065 @noindent
5066 The extracted information is displayed in a special @emph{agenda
5067 buffer}.  This buffer is read-only, but provides commands to visit the
5068 corresponding locations in the original Org files, and even to
5069 edit these files remotely.
5071 Two variables control how the agenda buffer is displayed and whether the
5072 window configuration is restored when the agenda exits:
5073 @code{org-agenda-window-setup} and
5074 @code{org-agenda-restore-windows-after-quit}.
5076 @menu
5077 * Agenda files::                Files being searched for agenda information
5078 * Agenda dispatcher::           Keyboard access to agenda views
5079 * Built-in agenda views::       What is available out of the box?
5080 * Presentation and sorting::    How agenda items are prepared for display
5081 * Agenda commands::             Remote editing of Org trees
5082 * Custom agenda views::         Defining special searches and views
5083 * Agenda column view::          Using column view for collected entries
5084 @end menu
5086 @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
5087 @section Agenda files
5088 @cindex agenda files
5089 @cindex files for agenda
5091 The information to be shown is normally collected from all @emph{agenda
5092 files}, the files listed in the variable
5093 @code{org-agenda-files}@footnote{If the value of that variable is not a
5094 list, but a single file name, then the list of agenda files will be
5095 maintained in that external file.}. If a directory is part of this list,
5096 all files with the extension @file{.org} in this directory will be part
5097 of the list.
5099 Thus even if you only work with a single Org file, this file should
5100 be put into that list@footnote{When using the dispatcher, pressing
5101 @kbd{<} before selecting a command will actually limit the command to
5102 the current file, and ignore @code{org-agenda-files} until the next
5103 dispatcher command.}.  You can customize @code{org-agenda-files}, but
5104 the easiest way to maintain it is through the following commands
5106 @cindex files, adding to agenda list
5107 @table @kbd
5108 @kindex C-c [
5109 @item C-c [
5110 Add current file to the list of agenda files.  The file is added to
5111 the front of the list.  If it was already in the list, it is moved to
5112 the front.  With a prefix argument, file is added/moved to the end.
5113 @kindex C-c ]
5114 @item C-c ]
5115 Remove current file from the list of agenda files.
5116 @kindex C-,
5117 @kindex C-'
5118 @item C-,
5119 @itemx C-'
5120 Cycle through agenda file list, visiting one file after the other.
5121 @kindex M-x org-iswitchb
5122 @item M-x org-iswitchb
5123 Command to use an @code{iswitchb}-like interface to switch to and between Org
5124 buffers.
5125 @end table
5127 @noindent
5128 The Org menu contains the current list of files and can be used
5129 to visit any of them.
5131 If you would like to focus the agenda temporarily onto a file not in
5132 this list, or onto just one file in the list or even only a subtree in a
5133 file, this can be done in different ways.  For a single agenda command,
5134 you may press @kbd{<} once or several times in the dispatcher
5135 (@pxref{Agenda dispatcher}).  To restrict the agenda scope for an
5136 extended period, use the following commands:
5138 @table @kbd
5139 @kindex C-c C-x <
5140 @item C-c C-x <
5141 Permanently restrict the agenda to the current subtree.  When with a
5142 prefix argument, or with the cursor before the first headline in a file,
5143 the agenda scope is set to the entire file.  This restriction remains in
5144 effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
5145 or @kbd{>} in the agenda dispatcher.  If there is a window displaying an
5146 agenda view, the new restriction takes effect immediately.
5147 @kindex C-c C-x <
5148 @item C-c C-x <
5149 Remove the permanent restriction created by @kbd{C-c C-x <}.
5150 @end table
5152 @noindent
5153 When working with @file{Speedbar}, you can use the following commands in
5154 the Speedbar frame:
5155 @table @kbd
5156 @kindex <
5157 @item < @r{in the speedbar frame}
5158 Permanently restrict the agenda to the item at the cursor in the
5159 Speedbar frame, either an Org file or a subtree in such a file.
5160 If there is a window displaying an agenda view, the new restriction takes
5161 effect immediately.
5162 @kindex <
5163 @item > @r{in the speedbar frame}
5164 Lift the restriction again.
5165 @end table
5167 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
5168 @section The agenda dispatcher
5169 @cindex agenda dispatcher
5170 @cindex dispatching agenda commands
5171 The views are created through a dispatcher that should be bound to a
5172 global key, for example @kbd{C-c a} (@pxref{Installation}).  In the
5173 following we will assume that @kbd{C-c a} is indeed how the dispatcher
5174 is accessed and list keyboard access to commands accordingly.  After
5175 pressing @kbd{C-c a}, an additional letter is required to execute a
5176 command.  The dispatcher offers the following default commands:
5177 @table @kbd
5178 @item a
5179 Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
5180 @item t @r{/} T
5181 Create a list of all TODO items (@pxref{Global TODO list}).
5182 @item m @r{/} M
5183 Create a list of headlines matching a TAGS expression (@pxref{Matching
5184 tags and properties}).
5185 @item L
5186 Create the timeline view for the current buffer (@pxref{Timeline}).
5187 @item s
5188 Create a list of entries selected by a boolean expression of keywords
5189 and/or regular expressions that must or must not occur in the entry.
5190 @item /
5191 Search for a regular expression in all agenda files and additionally in
5192 the files listed in @code{org-agenda-multi-occur-extra-files}.  This
5193 uses the Emacs command @code{multi-occur}.  A prefix argument can be
5194 used to specify the number of context lines for each match, default is
5196 @item # @r{/} !
5197 Create a list of stuck projects (@pxref{Stuck projects}).
5198 @item <
5199 Restrict an agenda command to the current buffer@footnote{For backward
5200 compatibility, you can also press @kbd{1} to restrict to the current
5201 buffer.}.  After pressing @kbd{<}, you still need to press the character
5202 selecting the command.
5203 @item < <
5204 If there is an active region, restrict the following agenda command to
5205 the region.  Otherwise, restrict it to the current subtree@footnote{For
5206 backward compatibility, you can also press @kbd{0} to restrict to the
5207 current buffer.}.  After pressing @kbd{< <}, you still need to press the
5208 character selecting the command.
5209 @end table
5211 You can also define custom commands that will be accessible through the
5212 dispatcher, just like the default commands.  This includes the
5213 possibility to create extended agenda buffers that contain several
5214 blocks together, for example the weekly agenda, the global TODO list and
5215 a number of special tags matches.  @xref{Custom agenda views}.
5217 @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
5218 @section The built-in agenda views
5220 In this section we describe the built-in views.
5222 @menu
5223 * Weekly/daily agenda::         The calendar page with current tasks
5224 * Global TODO list::            All unfinished action items
5225 * Matching tags and properties::  Structured information with fine-tuned search
5226 * Timeline::                    Time-sorted view for single file
5227 * Keyword search::              Finding entries by keyword
5228 * Stuck projects::              Find projects you need to review
5229 @end menu
5231 @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
5232 @subsection The weekly/daily agenda
5233 @cindex agenda
5234 @cindex weekly agenda
5235 @cindex daily agenda
5237 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
5238 paper agenda, showing all the tasks for the current week or day.
5240 @table @kbd
5241 @cindex org-agenda, command
5242 @kindex C-c a a
5243 @item C-c a a
5244 Compile an agenda for the current week from a list of org files.  The
5245 agenda shows the entries for each day.  With a numeric
5246 prefix@footnote{For backward compatibility, the universal prefix
5247 @kbd{C-u} causes all TODO entries to be listed before the agenda.  This
5248 feature is deprecated, use the dedicated TODO list, or a block agenda
5249 instead.}  (like @kbd{C-u 2 1 C-c a a}) you may set the number of days
5250 to be displayed (see also the variable @code{org-agenda-ndays})
5251 @end table
5253 Remote editing from the agenda buffer means, for example, that you can
5254 change the dates of deadlines and appointments from the agenda buffer.
5255 The commands available in the Agenda buffer are listed in @ref{Agenda
5256 commands}.
5258 @subsubheading Calendar/Diary integration
5259 @cindex calendar integration
5260 @cindex diary integration
5262 Emacs contains the calendar and diary by Edward M. Reingold.  The
5263 calendar displays a three-month calendar with holidays from different
5264 countries and cultures.  The diary allows you to keep track of
5265 anniversaries, lunar phases, sunrise/set, recurrent appointments
5266 (weekly, monthly) and more.  In this way, it is quite complementary to
5267 Org.  It can be very useful to combine output from Org with
5268 the diary.
5270 In order to include entries from the Emacs diary into Org mode's
5271 agenda, you only need to customize the variable
5273 @lisp
5274 (setq org-agenda-include-diary t)
5275 @end lisp
5277 @noindent After that, everything will happen automatically.  All diary
5278 entries including holidays, anniversaries etc will be included in the
5279 agenda buffer created by Org mode.  @key{SPC}, @key{TAB}, and
5280 @key{RET} can be used from the agenda buffer to jump to the diary
5281 file in order to edit existing diary entries.  The @kbd{i} command to
5282 insert new entries for the current date works in the agenda buffer, as
5283 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
5284 Sunrise/Sunset times, show lunar phases and to convert to other
5285 calendars, respectively.  @kbd{c} can be used to switch back and forth
5286 between calendar and agenda.
5288 If you are using the diary only for sexp entries and holidays, it is
5289 faster to not use the above setting, but instead to copy or even move
5290 the entries into an Org file. Org mode evaluates diary-style sexp
5291 entries, and does it faster because there is no overhead for first
5292 creating the diary display.  Note that the sexp entries must start at
5293 the left margin, no white space is allowed before them.  For example,
5294 the following segment of an Org file will be processed and entries
5295 will be made in the agenda:
5297 @example
5298 * Birthdays and similar stuff
5299 #+CATEGORY: Holiday
5300 %%(org-calendar-holiday)   ; special function for holiday names
5301 #+CATEGORY: Ann
5302 %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
5303 %%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d years old
5304 @end example
5306 @subsubheading Appointment reminders
5307 @cindex @file{appt.el}
5308 @cindex appointment reminders
5310 Org can interact with Emacs appointments notification facility.
5312 To add all the appointments of your agenda files, use the command
5313 @code{org-agenda-to-appt}.  This commands also lets you filter through
5314 the list of your appointments and add only those belonging to a specific
5315 category or matching a regular expression. See the docstring for
5316 details.
5318 @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
5319 @subsection The global TODO list
5320 @cindex global TODO list
5321 @cindex TODO list, global
5323 The global TODO list contains all unfinished TODO items, formatted and
5324 collected into a single place.
5326 @table @kbd
5327 @kindex C-c a t
5328 @item C-c a t
5329 Show the global TODO list.  This collects the TODO items from all
5330 agenda files (@pxref{Agenda Views}) into a single buffer.  The buffer is in
5331 @code{agenda-mode}, so there are commands to examine and manipulate
5332 the TODO entries directly from that buffer (@pxref{Agenda commands}).
5333 @kindex C-c a T
5334 @item C-c a T
5335 @cindex TODO keyword matching
5336 Like the above, but allows selection of a specific TODO keyword.  You
5337 can also do this by specifying a prefix argument to @kbd{C-c a t}.  With
5338 a @kbd{C-u} prefix you are prompted for a keyword, and you may also
5339 specify several keywords by separating them with @samp{|} as boolean OR
5340 operator.  With a numeric prefix, the Nth keyword in
5341 @code{org-todo-keywords} is selected.
5342 @kindex r
5343 The @kbd{r} key in the agenda buffer regenerates it, and you can give
5344 a prefix argument to this command to change the selected TODO keyword,
5345 for example @kbd{3 r}.  If you often need a search for a specific
5346 keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
5347 Matching specific TODO keywords can also be done as part of a tags
5348 search (@pxref{Tag searches}).
5349 @end table
5351 Remote editing of TODO items means that you can change the state of a
5352 TODO entry with a single key press.  The commands available in the
5353 TODO list are described in @ref{Agenda commands}.
5355 @cindex sublevels, inclusion into TODO list
5356 Normally the global TODO list simply shows all headlines with TODO
5357 keywords.  This list can become very long.  There are two ways to keep
5358 it more compact:
5359 @itemize @minus
5360 @item
5361 Some people view a TODO item that has been @emph{scheduled} for
5362 execution (@pxref{Timestamps}) as no longer @emph{open}.  Configure the
5363 variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
5364 items from the global TODO list.
5365 @item
5366 TODO items may have sublevels to break up the task into subtasks.  In
5367 such cases it may be enough to list only the highest level TODO headline
5368 and omit the sublevels from the global list.  Configure the variable
5369 @code{org-agenda-todo-list-sublevels} to get this behavior.
5370 @end itemize
5372 @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
5373 @subsection Matching tags and properties
5374 @cindex matching, of tags
5375 @cindex matching, of properties
5376 @cindex tags view
5378 If headlines in the agenda files are marked with @emph{tags}
5379 (@pxref{Tags}), you can select headlines based on the tags that apply
5380 to them and collect them into an agenda buffer.
5382 @table @kbd
5383 @kindex C-c a m
5384 @item C-c a m
5385 Produce a list of all headlines that match a given set of tags.  The
5386 command prompts for a selection criterion, which is a boolean logic
5387 expression with tags, like @samp{+work+urgent-withboss} or
5388 @samp{work|home} (@pxref{Tags}).  If you often need a specific search,
5389 define a custom command for it (@pxref{Agenda dispatcher}).
5390 @kindex C-c a M
5391 @item C-c a M
5392 Like @kbd{C-c a m}, but only select headlines that are also TODO items
5393 and force checking subitems (see variable
5394 @code{org-tags-match-list-sublevels}).  Matching specific TODO keywords
5395 together with a tags match is also possible, see @ref{Tag searches}.
5396 @end table
5398 The commands available in the tags list are described in @ref{Agenda
5399 commands}.
5401 @node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
5402 @subsection Timeline for a single file
5403 @cindex timeline, single file
5404 @cindex time-sorted view
5406 The timeline summarizes all time-stamped items from a single Org mode
5407 file in a @emph{time-sorted view}.  The main purpose of this command is
5408 to give an overview over events in a project.
5410 @table @kbd
5411 @kindex C-c a L
5412 @item C-c a L
5413 Show a time-sorted view of the org file, with all time-stamped items.
5414 When called with a @kbd{C-u} prefix, all unfinished TODO entries
5415 (scheduled or not) are also listed under the current date.
5416 @end table
5418 @noindent
5419 The commands available in the timeline buffer are listed in
5420 @ref{Agenda commands}.
5422 @node Keyword search, Stuck projects, Timeline, Built-in agenda views
5423 @subsection Keyword search
5424 @cindex keyword search
5425 @cindex searching, for keywords
5427 This agenda view is a general text search facility for Org mode entries.
5428 It is particularly useful to find notes.
5430 @table @kbd
5431 @kindex C-c a s
5432 @item C-c a s
5433 This is a special search that lets you select entries by keywords or
5434 regular expression, using a boolean logic.  For example, the search
5435 string
5437 @example
5438 +computer +wifi -ethernet -@{8\.11[bg]@}
5439 @end example
5441 @noindent
5442 will search for note entries that contain the keywords @code{computer}
5443 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
5444 not matched by the regular expression @code{8\.11[bg]}, meaning to
5445 exclude both 8.11b and 8.11g.
5447 Note that in addition to the agenda files, this command will also search
5448 the files listed in @code{org-agenda-text-search-extra-files}.
5449 @end table
5451 @node Stuck projects,  , Keyword search, Built-in agenda views
5452 @subsection Stuck projects
5454 If you are following a system like David Allen's GTD to organize your
5455 work, one of the ``duties'' you have is a regular review to make sure
5456 that all projects move along.  A @emph{stuck} project is a project that
5457 has no defined next actions, so it will never show up in the TODO lists
5458 Org mode produces.  During the review, you need to identify such
5459 projects and define next actions for them.
5461 @table @kbd
5462 @kindex C-c a #
5463 @item C-c a #
5464 List projects that are stuck.
5465 @kindex C-c a !
5466 @item C-c a !
5467 Customize the variable @code{org-stuck-projects} to define what a stuck
5468 project is and how to find it.
5469 @end table
5471 You almost certainly will have to configure this view before it will
5472 work for you.  The built-in default assumes that all your projects are
5473 level-2 headlines, and that a project is not stuck if it has at least
5474 one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
5476 Lets assume that you, in your own way of using Org mode, identify
5477 projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
5478 indicate a project that should not be considered yet.  Lets further
5479 assume that the TODO keyword DONE marks finished projects, and that NEXT
5480 and TODO indicate next actions.  The tag @@SHOP indicates shopping and
5481 is a next action even without the NEXT tag.  Finally, if the project
5482 contains the special word IGNORE anywhere, it should not be listed
5483 either.  In this case you would start by identifying eligible projects
5484 with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
5485 TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
5486 are not stuck.  The correct customization for this is
5488 @lisp
5489 (setq org-stuck-projects
5490       '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
5491                                "\\<IGNORE\\>"))
5492 @end lisp
5495 @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
5496 @section Presentation and sorting
5497 @cindex presentation, of agenda items
5499 Before displaying items in an agenda view, Org mode visually prepares
5500 the items and sorts them.  Each item occupies a single line.  The line
5501 starts with a @emph{prefix} that contains the @emph{category}
5502 (@pxref{Categories}) of the item and other important information.  You can
5503 customize the prefix using the option @code{org-agenda-prefix-format}.
5504 The prefix is followed by a cleaned-up version of the outline headline
5505 associated with the item.
5507 @menu
5508 * Categories::                  Not all tasks are equal
5509 * Time-of-day specifications::  How the agenda knows the time
5510 * Sorting of agenda items::     The order of things
5511 @end menu
5513 @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
5514 @subsection Categories
5516 @cindex category
5517 The category is a broad label assigned to each agenda item.  By default,
5518 the category is simply derived from the file name, but you can also
5519 specify it with a special line in the buffer, like this@footnote{For
5520 backward compatibility, the following also works: If there are several
5521 such lines in a file, each specifies the category for the text below it.
5522 The first category also applies to any text before the first CATEGORY
5523 line.  However, using this method is @emph{strongly} deprecated as it is
5524 incompatible with the outline structure of the document.  The correct
5525 method for setting multiple categories in a buffer is using a
5526 property.}:
5528 @example
5529 #+CATEGORY: Thesis
5530 @end example
5532 @noindent
5533 If you would like to have a special CATEGORY for a single entry or a
5534 (sub)tree, give the entry a @code{:CATEGORY:} property with the location
5535 as the value (@pxref{Properties and Columns}).
5537 @noindent
5538 The display in the agenda buffer looks best if the category is not
5539 longer than 10 characters.
5541 @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
5542 @subsection Time-of-day specifications
5543 @cindex time-of-day specification
5545 Org mode checks each agenda item for a time-of-day specification.  The
5546 time can be part of the time stamp that triggered inclusion into the
5547 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}.  Time
5548 ranges can be specified with two time stamps, like
5550 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
5552 In the headline of the entry itself, a time(range) may also appear as
5553 plain text (like @samp{12:45} or a @samp{8:30-1pm}.  If the agenda
5554 integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
5555 specifications in diary entries are recognized as well.
5557 For agenda display, Org mode extracts the time and displays it in a
5558 standard 24 hour format as part of the prefix.  The example times in
5559 the previous paragraphs would end up in the agenda like this:
5561 @example
5562     8:30-13:00 Arthur Dent lies in front of the bulldozer
5563    12:45...... Ford Prefect arrives and takes Arthur to the pub
5564    19:00...... The Vogon reads his poem
5565    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5566 @end example
5568 @cindex time grid
5569 If the agenda is in single-day mode, or for the display of today, the
5570 timed entries are embedded in a time grid, like
5572 @example
5573     8:00...... ------------------
5574     8:30-13:00 Arthur Dent lies in front of the bulldozer
5575    10:00...... ------------------
5576    12:00...... ------------------
5577    12:45...... Ford Prefect arrives and takes Arthur to the pub
5578    14:00...... ------------------
5579    16:00...... ------------------
5580    18:00...... ------------------
5581    19:00...... The Vogon reads his poem
5582    20:00...... ------------------
5583    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5584 @end example
5586 The time grid can be turned on and off with the variable
5587 @code{org-agenda-use-time-grid}, and can be configured with
5588 @code{org-agenda-time-grid}.
5590 @node Sorting of agenda items,  , Time-of-day specifications, Presentation and sorting
5591 @subsection Sorting of agenda items
5592 @cindex sorting, of agenda items
5593 @cindex priorities, of agenda items
5594 Before being inserted into a view, the items are sorted.  How this is
5595 done depends on the type of view.
5596 @itemize @bullet
5597 @item
5598 For the daily/weekly agenda, the items for each day are sorted.  The
5599 default order is to first collect all items containing an explicit
5600 time-of-day specification.  These entries will be shown at the beginning
5601 of the list, as a @emph{schedule} for the day.  After that, items remain
5602 grouped in categories, in the sequence given by @code{org-agenda-files}.
5603 Within each category, items are sorted by priority (@pxref{Priorities}),
5604 which is composed of the base priority (2000 for priority @samp{A}, 1000
5605 for @samp{B}, and 0 for @samp{C}), plus additional increments for
5606 overdue scheduled or deadline items.
5607 @item
5608 For the TODO list, items remain in the order of categories, but within
5609 each category, sorting takes place according to priority
5610 (@pxref{Priorities}).
5611 @item
5612 For tags matches, items are not sorted at all, but just appear in the
5613 sequence in which they are found in the agenda files.
5614 @end itemize
5616 Sorting can be customized using the variable
5617 @code{org-agenda-sorting-strategy}, and may also include criteria based on
5618 the estimated effort of an entry.
5619 @c FIXME: link!!!!!!!!
5622 @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
5623 @section Commands in the agenda buffer
5624 @cindex commands, in agenda buffer
5626 Entries in the agenda buffer are linked back to the org file or diary
5627 file where they originate.  You are not allowed to edit the agenda
5628 buffer itself, but commands are provided to show and jump to the
5629 original entry location, and to edit the org-files ``remotely'' from
5630 the agenda buffer.  In this way, all information is stored only once,
5631 removing the risk that your agenda and note files may diverge.
5633 Some commands can be executed with mouse clicks on agenda lines.  For
5634 the other commands, the cursor needs to be in the desired line.
5636 @table @kbd
5637 @tsubheading{Motion}
5638 @cindex motion commands in agenda
5639 @kindex n
5640 @item n
5641 Next line (same as @key{up} and @kbd{C-p}).
5642 @kindex p
5643 @item p
5644 Previous line (same as @key{down} and @kbd{C-n}).
5645 @tsubheading{View/Go to org file}
5646 @kindex mouse-3
5647 @kindex @key{SPC}
5648 @item mouse-3
5649 @itemx @key{SPC}
5650 Display the original location of the item in another window.
5652 @kindex L
5653 @item L
5654 Display original location and recenter that window.
5656 @kindex mouse-2
5657 @kindex mouse-1
5658 @kindex @key{TAB}
5659 @item mouse-2
5660 @itemx mouse-1
5661 @itemx @key{TAB}
5662 Go to the original location of the item in another window.  Under Emacs
5663 22, @kbd{mouse-1} will also works for this.
5665 @kindex @key{RET}
5666 @itemx @key{RET}
5667 Go to the original location of the item and delete other windows.
5669 @kindex f
5670 @item f
5671 Toggle Follow mode.  In Follow mode, as you move the cursor through
5672 the agenda buffer, the other window always shows the corresponding
5673 location in the org file.  The initial setting for this mode in new
5674 agenda buffers can be set with the variable
5675 @code{org-agenda-start-with-follow-mode}.
5677 @kindex b
5678 @item b
5679 Display the entire subtree of the current item in an indirect buffer.  With a
5680 numeric prefix argument N, go up to level N and then take that tree.  If N is
5681 negative, go up that many levels.  With a @kbd{C-u} prefix, do not remove the
5682 previously used indirect buffer.
5684 @kindex l
5685 @item l
5686 Toggle Logbook mode.  In Logbook mode, entries that where marked DONE while
5687 logging was on (variable @code{org-log-done}) are shown in the agenda,
5688 as are entries that have been clocked on that day.
5690 @kindex R
5691 @item R
5692 Toggle Clockreport mode.  In clockreport mode, the daily/weekly agenda will
5693 always show a table with the clocked times for the timespan and file scope
5694 covered by the current agenda view.  The initial setting for this mode in new
5695 agenda buffers can be set with the variable
5696 @code{org-agenda-start-with-clockreport-mode}.
5698 @tsubheading{Change display}
5699 @cindex display changing, in agenda
5700 @kindex o
5701 @item o
5702 Delete other windows.
5704 @kindex d
5705 @kindex w
5706 @kindex m
5707 @kindex y
5708 @item d w m y
5709 Switch to day/week/month/year view.  When switching to day or week view,
5710 this setting becomes the default for subsequent agenda commands.  Since
5711 month and year views are slow to create, they do not become the default.
5712 A numeric prefix argument may be used to jump directly to a specific day
5713 of the year, ISO week, month, or year, respectively.  For example,
5714 @kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9.  When
5715 setting day, week, or month view, a year may be encoded in the prefix
5716 argument as well.  For example, @kbd{200712 w} will jump to week 12 in
5717 2007.  If such a year specification has only one or two digits, it will
5718 be mapped to the interval 1938-2037.
5720 @kindex D
5721 @item D
5722 Toggle the inclusion of diary entries.  See @ref{Weekly/daily agenda}.
5724 @kindex G
5725 @item G
5726 Toggle the time grid on and off.  See also the variables
5727 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
5729 @kindex r
5730 @item r
5731 Recreate the agenda buffer, for example to reflect the changes
5732 after modification of the time stamps of items with S-@key{left} and
5733 S-@key{right}.  When the buffer is the global TODO list, a prefix
5734 argument is interpreted to create a selective list for a specific TODO
5735 keyword.
5736 @kindex g
5737 @item g
5738 Same as @kbd{r}.
5740 @kindex s
5741 @kindex C-x C-s
5742 @item s
5743 @itemx C-x C-s
5744 Save all Org buffers in the current Emacs session.
5746 @kindex @key{right}
5747 @item @key{right}
5748 Display the following @code{org-agenda-ndays} days.  For example, if
5749 the display covers a week, switch to the following week.  With prefix
5750 arg, go forward that many times @code{org-agenda-ndays} days.
5752 @kindex @key{left}
5753 @item @key{left}
5754 Display the previous dates.
5756 @kindex .
5757 @item .
5758 Go to today.
5760 @kindex C-c C-x C-c
5761 @item C-c C-x C-c
5762 Invoke column view (@pxref{Column view}) in the agenda buffer.  The column
5763 view format is taken from the entry at point, or (if there is no entry at
5764 point), from the first entry in the agenda view.  So whatever the format for
5765 that entry would be in the original buffer (taken from a property, from a
5766 @code{#+COLUMNS} line, or from the default variable
5767 @code{org-columns-default-format}), will be used in the agenda.
5769 @tsubheading{Query editing}
5770 @cindex query editing, in agenda
5772 @kindex [
5773 @kindex ]
5774 @kindex @{
5775 @kindex @}
5776 @item [ ] @{ @}
5777 In the @i{search view} (@pxref{Keyword search}), these keys add new
5778 search words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{}
5779 and @kbd{@}}) to the query string.  The opening bracket/brace will add a
5780 positive search term prefixed by @samp{+}, indicating that this search
5781 term @i{must} occur/match in the entry.  Closing bracket/brace add a
5782 negative search term which @i{must not} occur/match in the entry for it
5783 to be selected.
5786 @tsubheading{Remote editing}
5787 @cindex remote editing, from agenda
5789 @item 0-9
5790 Digit argument.
5792 @cindex undoing remote-editing events
5793 @cindex remote editing, undo
5794 @kindex C-_
5795 @item C-_
5796 Undo a change due to a remote editing command.  The change is undone
5797 both in the agenda buffer and in the remote buffer.
5799 @kindex t
5800 @item t
5801 Change the TODO state of the item, both in the agenda and in the
5802 original org file.
5804 @kindex C-k
5805 @item C-k
5806 Delete the current agenda item along with the entire subtree belonging
5807 to it in the original Org file.  If the text to be deleted remotely
5808 is longer than one line, the kill needs to be confirmed by the user.  See
5809 variable @code{org-agenda-confirm-kill}.
5811 @kindex a
5812 @item a
5813 Toggle the ARCHIVE tag for the current headline.
5815 @kindex A
5816 @item A
5817 Move the subtree corresponding to the current entry to its @emph{Archive
5818 Sibling}.
5820 @kindex $
5821 @item $
5822 Archive the subtree corresponding to the current headline.  This means the
5823 entry will be moved to the configured archive location, most likely a
5824 different file.
5826 @kindex T
5827 @item T
5828 Show all tags associated with the current item.  Because of
5829 inheritance, this may be more than the tags listed in the line itself.
5831 @kindex :
5832 @item :
5833 Set tags for the current headline.  If there is an active region in the
5834 agenda, change a tag for all headings in the region.
5836 @kindex ,
5837 @item ,
5838 Set the priority for the current item.  Org mode prompts for the
5839 priority character. If you reply with @key{SPC}, the priority cookie
5840 is removed from the entry.
5842 @kindex P
5843 @item P
5844 Display weighted priority of current item.
5846 @kindex +
5847 @kindex S-@key{up}
5848 @item +
5849 @itemx S-@key{up}
5850 Increase the priority of the current item.  The priority is changed in
5851 the original buffer, but the agenda is not resorted.  Use the @kbd{r}
5852 key for this.
5854 @kindex -
5855 @kindex S-@key{down}
5856 @item -
5857 @itemx S-@key{down}
5858 Decrease the priority of the current item.
5860 @kindex C-c C-s
5861 @item C-c C-s
5862 Schedule this item
5864 @kindex C-c C-d
5865 @item C-c C-d
5866 Set a deadline for this item.
5868 @kindex k
5869 @item k
5870 Agenda actions, to set dates for selected items to the cursor date.
5871 This command also works in the calendar!  The command prompts for an
5872 additonal key:
5873 @example
5874 m   @r{Mark the entry at point for action.  You can also make entries}
5875     @r{in Org files with @kbd{C-c C-x C-k}.}
5876 d   @r{Set the deadline of the marked entry to the date at point.}
5877 s   @r{Schedule the marked entry at the date at point.}
5878 r   @r{Call @code{org-remember} with the cursor date as default date.}
5879 @end example
5880 Press @kbd{r} afterwards to refresh the agenda and see the effect of the
5881 command.
5883 @kindex S-@key{right}
5884 @item S-@key{right}
5885 Change the time stamp associated with the current line by one day into the
5886 future.  With a numeric prefix argument, change it by that many days.  For
5887 example, @kbd{3 6 5 S-@key{right}} will change it by a year.  The stamp is
5888 changed in the original org file, but the change is not directly reflected in
5889 the agenda buffer.  Use the @kbd{r} key to update the buffer.
5891 @kindex S-@key{left}
5892 @item S-@key{left}
5893 Change the time stamp associated with the current line by one day
5894 into the past.
5896 @kindex >
5897 @item >
5898 Change the time stamp associated with the current line to today.
5899 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
5900 on my keyboard.
5902 @kindex I
5903 @item I
5904 Start the clock on the current item.  If a clock is running already, it
5905 is stopped first.
5907 @kindex O
5908 @item O
5909 Stop the previously started clock.
5911 @kindex X
5912 @item X
5913 Cancel the currently running clock.
5915 @kindex J
5916 @item J
5917 Jump to the running clock in another window.
5919 @tsubheading{Calendar commands}
5920 @cindex calendar commands, from agenda
5921 @kindex c
5922 @item c
5923 Open the Emacs calendar and move to the date at the agenda cursor.
5925 @item c
5926 When in the calendar, compute and show the Org mode agenda for the
5927 date at the cursor.
5929 @cindex diary entries, creating from agenda
5930 @kindex i
5931 @item i
5932 Insert a new entry into the diary.  Prompts for the type of entry
5933 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
5934 entry in the diary, just as @kbd{i d} etc. would do in the calendar.
5935 The date is taken from the cursor position.
5937 @kindex M
5938 @item M
5939 Show the phases of the moon for the three months around current date.
5941 @kindex S
5942 @item S
5943 Show sunrise and sunset times.  The geographical location must be set
5944 with calendar variables, see documentation of the Emacs calendar.
5946 @kindex C
5947 @item C
5948 Convert the date at cursor into many other cultural and historic
5949 calendars.
5951 @kindex H
5952 @item H
5953 Show holidays for three month around the cursor date.
5955 @item M-x org-export-icalendar-combine-agenda-files
5956 Export a single iCalendar file containing entries from all agenda files.
5957 This is a globally available command, and also available in the agenda menu.
5959 @tsubheading{Exporting to a file}
5960 @kindex C-x C-w
5961 @item C-x C-w
5962 @cindex exporting agenda views
5963 @cindex agenda views, exporting
5964 Write the agenda view to a file.  Depending on the extension of the
5965 selected file name, the view will be exported as HTML (extension
5966 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
5967 plain text (any other extension).  Use the variable
5968 @code{org-agenda-exporter-settings} to set options for @file{ps-print}
5969 and for @file{htmlize} to be used during export.
5971 @tsubheading{Quit and Exit}
5972 @kindex q
5973 @item q
5974 Quit agenda, remove the agenda buffer.
5976 @kindex x
5977 @cindex agenda files, removing buffers
5978 @item x
5979 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
5980 for the compilation of the agenda.  Buffers created by the user to
5981 visit org files will not be removed.
5982 @end table
5985 @node Custom agenda views, Agenda column view, Agenda commands, Agenda Views
5986 @section Custom agenda views
5987 @cindex custom agenda views
5988 @cindex agenda views, custom
5990 Custom agenda commands serve two purposes: to store and quickly access
5991 frequently used TODO and tags searches, and to create special composite
5992 agenda buffers.  Custom agenda commands will be accessible through the
5993 dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
5995 @menu
5996 * Storing searches::            Type once, use often
5997 * Block agenda::                All the stuff you need in a single buffer
5998 * Setting Options::             Changing the rules
5999 * Exporting Agenda Views::      Writing agendas to files
6000 * Using the agenda elsewhere::  Using agenda information in other programs
6001 @end menu
6003 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
6004 @subsection Storing searches
6006 The first application of custom searches is the definition of keyboard
6007 shortcuts for frequently used searches, either creating an agenda
6008 buffer, or a sparse tree (the latter covering of course only the current
6009 buffer).
6010 @kindex C-c a C
6011 Custom commands are configured in the variable
6012 @code{org-agenda-custom-commands}.  You can customize this variable, for
6013 example by pressing @kbd{C-c a C}.  You can also directly set it with
6014 Emacs Lisp in @file{.emacs}.  The following example contains all valid
6015 search types:
6017 @lisp
6018 @group
6019 (setq org-agenda-custom-commands
6020       '(("w" todo "WAITING")
6021         ("W" todo-tree "WAITING")
6022         ("u" tags "+boss-urgent")
6023         ("v" tags-todo "+boss-urgent")
6024         ("U" tags-tree "+boss-urgent")
6025         ("f" occur-tree "\\<FIXME\\>")
6026         ("h" . "HOME+Name tags searches") ; description for "h" prefix
6027         ("hl" tags "+home+Lisa")
6028         ("hp" tags "+home+Peter")
6029         ("hk" tags "+home+Kim")))
6030 @end group
6031 @end lisp
6033 @noindent
6034 The initial string in each entry defines the keys you have to press
6035 after the dispatcher command @kbd{C-c a} in order to access the command.
6036 Usually this will be just a single character, but if you have many
6037 similar commands, you can also define two-letter combinations where the
6038 first character is the same in several combinations and serves as a
6039 prefix key@footnote{You can provide a description for a prefix key by
6040 inserting a cons cell with the prefix and the description.}.  The second
6041 parameter is the search type, followed by the string or regular
6042 expression to be used for the matching.  The example above will
6043 therefore define:
6045 @table @kbd
6046 @item C-c a w
6047 as a global search for TODO entries with @samp{WAITING} as the TODO
6048 keyword
6049 @item C-c a W
6050 as the same search, but only in the current buffer and displaying the
6051 results as a sparse tree
6052 @item C-c a u
6053 as a global tags search for headlines marked @samp{:boss:} but not
6054 @samp{:urgent:}
6055 @item C-c a v
6056 as the same search as @kbd{C-c a u}, but limiting the search to
6057 headlines that are also TODO items
6058 @item C-c a U
6059 as the same search as @kbd{C-c a u}, but only in the current buffer and
6060 displaying the result as a sparse tree
6061 @item C-c a f
6062 to create a sparse tree (again: current buffer only) with all entries
6063 containing the word @samp{FIXME}
6064 @item C-c a h
6065 as a prefix command for a HOME tags search where you have to press an
6066 additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
6067 Peter, or Kim) as additional tag to match.
6068 @end table
6070 @node Block agenda, Setting Options, Storing searches, Custom agenda views
6071 @subsection Block agenda
6072 @cindex block agenda
6073 @cindex agenda, with block views
6075 Another possibility is the construction of agenda views that comprise
6076 the results of @emph{several} commands, each of which creates a block in
6077 the agenda buffer.  The available commands include @code{agenda} for the
6078 daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
6079 for the global TODO list (as constructed with @kbd{C-c a t}), and the
6080 matching commands discussed above: @code{todo}, @code{tags}, and
6081 @code{tags-todo}.  Here are two examples:
6083 @lisp
6084 @group
6085 (setq org-agenda-custom-commands
6086       '(("h" "Agenda and Home-related tasks"
6087          ((agenda "")
6088           (tags-todo "home")
6089           (tags "garden")))
6090         ("o" "Agenda and Office-related tasks"
6091          ((agenda "")
6092           (tags-todo "work")
6093           (tags "office")))))
6094 @end group
6095 @end lisp
6097 @noindent
6098 This will define @kbd{C-c a h} to create a multi-block view for stuff
6099 you need to attend to at home.  The resulting agenda buffer will contain
6100 your agenda for the current week, all TODO items that carry the tag
6101 @samp{home}, and also all lines tagged with @samp{garden}.  Finally the
6102 command @kbd{C-c a o} provides a similar view for office tasks.
6104 @node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
6105 @subsection Setting options for custom commands
6106 @cindex options, for custom agenda views
6108 Org mode contains a number of variables regulating agenda construction
6109 and display.  The global variables define the behavior for all agenda
6110 commands, including the custom commands.  However, if you want to change
6111 some settings just for a single custom view, you can do so.  Setting
6112 options requires inserting a list of variable names and values at the
6113 right spot in @code{org-agenda-custom-commands}.  For example:
6115 @lisp
6116 @group
6117 (setq org-agenda-custom-commands
6118       '(("w" todo "WAITING"
6119          ((org-agenda-sorting-strategy '(priority-down))
6120           (org-agenda-prefix-format "  Mixed: ")))
6121         ("U" tags-tree "+boss-urgent"
6122          ((org-show-following-heading nil)
6123           (org-show-hierarchy-above nil)))
6124         ("N" search ""
6125          ((org-agenda-files '("~org/notes.org"))
6126           (org-agenda-text-search-extra-files nil)))))
6127 @end group
6128 @end lisp
6130 @noindent
6131 Now the @kbd{C-c a w} command will sort the collected entries only by
6132 priority, and the prefix format is modified to just say @samp{  Mixed: }
6133 instead of giving the category of the entry.  The sparse tags tree of
6134 @kbd{C-c a U} will now turn out ultra-compact, because neither the
6135 headline hierarchy above the match, nor the headline following the match
6136 will be shown.  The command @kbd{C-c a N} will do a text search limited
6137 to only a single file.
6139 For command sets creating a block agenda,
6140 @code{org-agenda-custom-commands} has two separate spots for setting
6141 options.  You can add options that should be valid for just a single
6142 command in the set, and options that should be valid for all commands in
6143 the set.  The former are just added to the command entry, the latter
6144 must come after the list of command entries.  Going back to the block
6145 agenda example (@pxref{Block agenda}), let's change the sorting strategy
6146 for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
6147 the results for GARDEN tags query in the opposite order,
6148 @code{priority-up}.  This would look like this:
6150 @lisp
6151 @group
6152 (setq org-agenda-custom-commands
6153       '(("h" "Agenda and Home-related tasks"
6154          ((agenda)
6155           (tags-todo "home")
6156           (tags "garden"
6157                 ((org-agenda-sorting-strategy '(priority-up)))))
6158          ((org-agenda-sorting-strategy '(priority-down))))
6159         ("o" "Agenda and Office-related tasks"
6160          ((agenda)
6161           (tags-todo "work")
6162           (tags "office")))))
6163 @end group
6164 @end lisp
6166 As you see, the values and parenthesis setting is a little complex.
6167 When in doubt, use the customize interface to set this variable - it
6168 fully supports its structure.  Just one caveat: When setting options in
6169 this interface, the @emph{values} are just lisp expressions.  So if the
6170 value is a string, you need to add the double quotes around the value
6171 yourself.
6174 @node Exporting Agenda Views, Using the agenda elsewhere, Setting Options, Custom agenda views
6175 @subsection Exporting Agenda Views
6176 @cindex agenda views, exporting
6178 If you are away from your computer, it can be very useful to have a
6179 printed version of some agenda views to carry around.  Org mode can
6180 export custom agenda views as plain text, HTML@footnote{You need to
6181 install Hrvoje Niksic' @file{htmlize.el}.} postscript, and iCalendar
6182 files.  If you want to do this only occasionally, use the command
6184 @table @kbd
6185 @kindex C-x C-w
6186 @item C-x C-w
6187 @cindex exporting agenda views
6188 @cindex agenda views, exporting
6189 Write the agenda view to a file.  Depending on the extension of the
6190 selected file name, the view will be exported as HTML (extension
6191 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
6192 iCalendar (extension @file{.ics}), or plain text (any other extension).
6193 Use the variable @code{org-agenda-exporter-settings} to
6194 set options for @file{ps-print} and for @file{htmlize} to be used during
6195 export, for example
6197 @lisp
6198 (setq org-agenda-exporter-settings
6199       '((ps-number-of-columns 2)
6200         (ps-landscape-mode t)
6201         (htmlize-output-type 'css)))
6202 @end lisp
6203 @end table
6205 If you need to export certain agenda views frequently, you can associate
6206 any custom agenda command with a list of output file names
6207 @footnote{If you want to store standard views like the weekly agenda
6208 or the global TODO list as well, you need to define custom commands for
6209 them in order to be able to specify file names.}.  Here is an example
6210 that first does define custom commands for the agenda and the global
6211 todo list, together with a number of files to which to export them.
6212 Then we define two block agenda commands and specify file names for them
6213 as well.  File names can be relative to the current working directory,
6214 or absolute.
6216 @lisp
6217 @group
6218 (setq org-agenda-custom-commands
6219       '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
6220         ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
6221         ("h" "Agenda and Home-related tasks"
6222          ((agenda "")
6223           (tags-todo "home")
6224           (tags "garden"))
6225          nil
6226          ("~/views/home.html"))
6227         ("o" "Agenda and Office-related tasks"
6228          ((agenda)
6229           (tags-todo "work")
6230           (tags "office"))
6231          nil
6232          ("~/views/office.ps" "~/calendars/office.ics"))))
6233 @end group
6234 @end lisp
6236 The extension of the file name determines the type of export.  If it is
6237 @file{.html}, Org mode will use the @file{htmlize.el} package to convert
6238 the buffer to HTML and save it to this file name.  If the extension is
6239 @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
6240 postscript output.  If the extension is @file{.ics}, iCalendar export is
6241 run export over all files that were used to construct the agenda, and
6242 limit the export to entries listed in the agenda now.  Any other
6243 extension produces a plain ASCII file.
6245 The export files are @emph{not} created when you use one of those
6246 commands interactively because this might use too much overhead.
6247 Instead, there is a special command to produce @emph{all} specified
6248 files in one step:
6250 @table @kbd
6251 @kindex C-c a e
6252 @item C-c a e
6253 Export all agenda views that have export file names associated with
6254 them.
6255 @end table
6257 You can use the options section of the custom agenda commands to also
6258 set options for the export commands.  For example:
6260 @lisp
6261 (setq org-agenda-custom-commands
6262       '(("X" agenda ""
6263          ((ps-number-of-columns 2)
6264           (ps-landscape-mode t)
6265           (org-agenda-prefix-format " [ ] ")
6266           (org-agenda-with-colors nil)
6267           (org-agenda-remove-tags t))
6268          ("theagenda.ps"))))
6269 @end lisp
6271 @noindent
6272 This command sets two options for the postscript exporter, to make it
6273 print in two columns in landscape format - the resulting page can be cut
6274 in two and then used in a paper agenda.  The remaining settings modify
6275 the agenda prefix to omit category and scheduling information, and
6276 instead include a checkbox to check off items.  We also remove the tags
6277 to make the lines compact, and we don't want to use colors for the
6278 black-and-white printer.  Settings specified in
6279 @code{org-agenda-exporter-settings} will also apply, but the settings
6280 in @code{org-agenda-custom-commands} take precedence.
6282 @noindent
6283 From the command line you may also use
6284 @example
6285 emacs -f org-batch-store-agenda-views -kill
6286 @end example
6287 @noindent
6288 or, if you need to modify some parameters
6289 @example
6290 emacs -eval '(org-batch-store-agenda-views                      \
6291               org-agenda-ndays 30                               \
6292               org-agenda-start-day "2007-11-01"                 \
6293               org-agenda-include-diary nil                      \
6294               org-agenda-files (quote ("~/org/project.org")))'  \
6295       -kill
6296 @end example
6297 @noindent
6298 which will create the agenda views restricted to the file
6299 @file{~/org/project.org}, without diary entries and with 30 days
6300 extent.
6302 @node Using the agenda elsewhere,  , Exporting Agenda Views, Custom agenda views
6303 @subsection Using agenda information outside of Org
6304 @cindex agenda, pipe
6305 @cindex Scripts, for agenda processing
6307 Org provides commands to access agenda information for the command
6308 line in emacs batch mode.  This extracted information can be sent
6309 directly to a printer, or it can be read by a program that does further
6310 processing of the data.  The first of these commands is the function
6311 @code{org-batch-agenda}, that produces an agenda view and sends it as
6312 ASCII text to STDOUT.  The command takes a single string as parameter.
6313 If the string has length 1, it is used as a key to one of the commands
6314 you have configured in @code{org-agenda-custom-commands}, basically any
6315 key you can use after @kbd{C-c a}.  For example, to directly print the
6316 current TODO list, you could use
6318 @example
6319 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
6320 @end example
6322 If the parameter is a string with 2 or more characters, it is used as a
6323 tags/todo match string.  For example, to print your local shopping list
6324 (all items with the tag @samp{shop}, but excluding the tag
6325 @samp{NewYork}), you could use
6327 @example
6328 emacs -batch -l ~/.emacs                                      \
6329       -eval '(org-batch-agenda "+shop-NewYork")' | lpr
6330 @end example
6332 @noindent
6333 You may also modify parameters on the fly like this:
6335 @example
6336 emacs -batch -l ~/.emacs                                      \
6337    -eval '(org-batch-agenda "a"                               \
6338             org-agenda-ndays 30                               \
6339             org-agenda-include-diary nil                      \
6340             org-agenda-files (quote ("~/org/project.org")))'  \
6341    | lpr
6342 @end example
6344 @noindent
6345 which will produce a 30 day agenda, fully restricted to the Org file
6346 @file{~/org/projects.org}, not even including the diary.
6348 If you want to process the agenda data in more sophisticated ways, you
6349 can use the command @code{org-batch-agenda-csv} to get a comma-separated
6350 list of values for each agenda item.  Each line in the output will
6351 contain a number of fields separated by commas.  The fields in a line
6352 are:
6354 @example
6355 category     @r{The category of the item}
6356 head         @r{The headline, without TODO kwd, TAGS and PRIORITY}
6357 type         @r{The type of the agenda entry, can be}
6358                 todo               @r{selected in TODO match}
6359                 tagsmatch          @r{selected in tags match}
6360                 diary              @r{imported from diary}
6361                 deadline           @r{a deadline}
6362                 scheduled          @r{scheduled}
6363                 timestamp          @r{appointment, selected by timestamp}
6364                 closed             @r{entry was closed on date}
6365                 upcoming-deadline  @r{warning about nearing deadline}
6366                 past-scheduled     @r{forwarded scheduled item}
6367                 block              @r{entry has date block including date}
6368 todo         @r{The TODO keyword, if any}
6369 tags         @r{All tags including inherited ones, separated by colons}
6370 date         @r{The relevant date, like 2007-2-14}
6371 time         @r{The time, like 15:00-16:50}
6372 extra        @r{String with extra planning info}
6373 priority-l   @r{The priority letter if any was given}
6374 priority-n   @r{The computed numerical priority}
6375 @end example
6377 @noindent
6378 Time and date will only be given if a timestamp (or deadline/scheduled)
6379 lead to the selection of the item.
6381 A CSV list like this is very easy to use in a post processing script.
6382 For example, here is a Perl program that gets the TODO list from
6383 Emacs/Org and prints all the items, preceded by a checkbox:
6385 @example
6386 @group
6387 #!/usr/bin/perl
6389 # define the Emacs command to run
6390 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
6392 # run it and capture the output
6393 $agenda = qx@{$cmd 2>/dev/null@};
6395 # loop over all lines
6396 foreach $line (split(/\n/,$agenda)) @{
6398   # get the individual values
6399   ($category,$head,$type,$todo,$tags,$date,$time,$extra,
6400    $priority_l,$priority_n) = split(/,/,$line);
6402   # proccess and print
6403   print "[ ] $head\n";
6405 @end group
6406 @end example
6408 @node Agenda column view,  , Custom agenda views, Agenda Views
6409 @section Using column view in the agenda
6410 @cindex column view, in agenda
6411 @cindex agenda, column view
6413 Column view (@pxref{Column view}) is normally used to view and edit
6414 properties embedded in the hierarchical structure of an Org file.  It can be
6415 quite useful to use column view also from the agenda, where entries are
6416 collected by certain criteria.
6418 @table @kbd
6419 @kindex C-c C-x C-c
6420 @item C-c C-x C-c
6421 Turn on column view in the agenda.
6422 @end table
6424 To understand how to use this properly, it is important to realize that the
6425 entries in the agenda are no longer in their proper outline environment.
6426 This causes the following issues:
6428 @enumerate
6429 @item
6430 Org needs to make a decision which @code{COLUMNS} format to use.  Since the
6431 entries in the agenda are collected from different files, and different files
6432 may have different @code{COLUMNS} formats, this is a non-trivial problem.
6433 Org first checks if the variable @code{org-overriding-columns-format} is
6434 currently set, and if yes takes the format from there.  Otherwise it takes
6435 the format associated with the first item in the agenda, or, if that item
6436 does not have a specific format (defined in a property, or in it's file), it
6437 uses @code{org-columns-default-format}.
6438 @item
6439 If any of the columns has a summary type defined (@pxref{Column attributes}),
6440 turning on column view in the agenda will visit all relevant agenda files and
6441 make sure that the computations of this property are up to date.  This is
6442 also true for the special @code{CLOCKSUM} property.  Org will then sum the
6443 values displayed in the agenda.  In the daily/weekly agenda, the sums will
6444 cover a single day, in all other views they cover the entire block.  It is
6445 vital to realize that the agenda may show the same entry @emph{twice} (for
6446 example as scheduled and as a deadline), and it may show two entries from the
6447 same hierarchy (for example a @emph{parent} and it's @emph{child}).  In these
6448 cases, the summation in the agenda will lead to incorrect results because
6449 some values will count double.
6450 @item
6451 When the column view in the agenda shows the @code{CLOCKSUM}, that is always
6452 the entire clocked time for this item.  So even in the daily/weekly agenda,
6453 the clocksum listed in column view may originate from times outside the
6454 current view.  This has the advantage that you can compare these values with
6455 a column listing the planned total effort for a task - one of the major
6456 applications for column view in the agenda.  If you want information about
6457 clocked time in the displayed period use clock table mode (press @kbd{R} in
6458 the agenda).
6459 @end enumerate
6462 @node Embedded LaTeX, Exporting, Agenda Views, Top
6463 @chapter Embedded LaTeX
6464 @cindex @TeX{} interpretation
6465 @cindex La@TeX{} interpretation
6467 Plain ASCII is normally sufficient for almost all note taking.  One
6468 exception, however, are scientific notes which need to be able to contain
6469 mathematical symbols and the occasional formula.  La@TeX{}@footnote{La@TeX{}
6470 is a macro system based on Donald E. Knuth's @TeX{} system.  Many of the
6471 features described here as ``La@TeX{}'' are really from @TeX{}, but for
6472 simplicity I am blurring this distinction.}  is widely used to typeset
6473 scientific documents. Org mode supports embedding La@TeX{} code into its
6474 files, because many academics are used to reading La@TeX{} source code, and
6475 because it can be readily processed into images for HTML production.
6477 It is not necessary to mark La@TeX{} macros and code in any special way.
6478 If you observe a few conventions, Org mode knows how to find it and what
6479 to do with it.
6481 @menu
6482 * Math symbols::                TeX macros for symbols and Greek letters
6483 * Subscripts and superscripts::  Simple syntax for raising/lowering text
6484 * LaTeX fragments::             Complex formulas made easy
6485 * Processing LaTeX fragments::  Previewing LaTeX processing
6486 * CDLaTeX mode::                Speed up entering of formulas
6487 @end menu
6489 @node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
6490 @section Math symbols
6491 @cindex math symbols
6492 @cindex TeX macros
6494 You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
6495 to indicate the Greek letter, or @samp{\to} to indicate an arrow.
6496 Completion for these macros is available, just type @samp{\} and maybe a
6497 few letters, and press @kbd{M-@key{TAB}} to see possible completions.
6498 Unlike La@TeX{} code, Org mode allows these macros to be present
6499 without surrounding math delimiters, for example:
6501 @example
6502 Angles are written as Greek letters \alpha, \beta and \gamma.
6503 @end example
6505 During HTML export (@pxref{HTML export}), these symbols are translated
6506 into the proper syntax for HTML, for the above examples this is
6507 @samp{&alpha;} and @samp{&rarr;}, respectively.
6509 @node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
6510 @section Subscripts and superscripts
6511 @cindex subscript
6512 @cindex superscript
6514 Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
6515 and subscripts.  Again, these can be used without embedding them in
6516 math-mode delimiters.  To increase the readability of ASCII text, it is
6517 not necessary (but OK) to surround multi-character sub- and superscripts
6518 with curly braces.  For example
6520 @example
6521 The mass if the sun is M_sun = 1.989 x 10^30 kg.  The radius of
6522 the sun is R_@{sun@} = 6.96 x 10^8 m.
6523 @end example
6525 To avoid interpretation as raised or lowered text, you can quote
6526 @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
6528 During HTML export (@pxref{HTML export}), subscript and superscripts
6529 are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
6531 @node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
6532 @section LaTeX fragments
6533 @cindex LaTeX fragments
6535 With symbols, sub- and superscripts, HTML is pretty much at its end when
6536 it comes to representing mathematical formulas@footnote{Yes, there is
6537 MathML, but that is not yet fully supported by many browsers, and there
6538 is no decent converter for turning La@TeX{} or ASCII representations of
6539 formulas into MathML. So for the time being, converting formulas into
6540 images seems the way to go.}. More complex expressions need a dedicated
6541 formula processor. To this end, Org mode can contain arbitrary La@TeX{}
6542 fragments. It provides commands to preview the typeset result of these
6543 fragments, and upon export to HTML, all fragments will be converted to
6544 images and inlined into the HTML document@footnote{The La@TeX{} export
6545 will not use images for displaying La@TeX{} fragments but include these
6546 fragments directly into the La@TeX{} code.}. For this to work you
6547 need to be on a system with a working La@TeX{} installation. You also
6548 need the @file{dvipng} program, available at
6549 @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
6550 will be used when processing a fragment can be configured with the
6551 variable @code{org-format-latex-header}.
6553 La@TeX{} fragments don't need any special marking at all.  The following
6554 snippets will be identified as La@TeX{} source code:
6555 @itemize @bullet
6556 @item
6557 Environments of any kind.  The only requirement is that the
6558 @code{\begin} statement appears on a new line, preceded by only
6559 whitespace.
6560 @item
6561 Text within the usual La@TeX{} math delimiters.  To avoid conflicts with
6562 currency specifications, single @samp{$} characters are only recognized
6563 as math delimiters if the enclosed text contains at most two line breaks,
6564 is directly attached to the @samp{$} characters with no whitespace in
6565 between, and if the closing @samp{$} is followed by whitespace or
6566 punctuation.  For the other delimiters, there is no such restriction, so
6567 when in doubt, use @samp{\(...\)} as inline math delimiters.
6568 @end itemize
6570 @noindent For example:
6572 @example
6573 \begin@{equation@}                          % arbitrary environments,
6574 x=\sqrt@{b@}                                % even tables, figures
6575 \end@{equation@}                            % etc
6577 If $a^2=b$ and \( b=2 \), then the solution must be
6578 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
6579 @end example
6581 @noindent
6582 If you need any of the delimiter ASCII sequences for other purposes, you
6583 can configure the option @code{org-format-latex-options} to deselect the
6584 ones you do not wish to have interpreted by the La@TeX{} converter.
6586 @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
6587 @section Processing LaTeX fragments
6588 @cindex LaTeX fragments, preview
6590 La@TeX{} fragments can be processed to produce a preview images of the
6591 typeset expressions:
6593 @table @kbd
6594 @kindex C-c C-x C-l
6595 @item C-c C-x C-l
6596 Produce a preview image of the La@TeX{} fragment at point and overlay it
6597 over the source code.  If there is no fragment at point, process all
6598 fragments in the current entry (between two headlines).  When called
6599 with a prefix argument, process the entire subtree.  When called with
6600 two prefix arguments, or when the cursor is before the first headline,
6601 process the entire buffer.
6602 @kindex C-c C-c
6603 @item C-c C-c
6604 Remove the overlay preview images.
6605 @end table
6607 During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
6608 converted into images and inlined into the document if the following
6609 setting is active:
6611 @lisp
6612 (setq org-export-with-LaTeX-fragments t)
6613 @end lisp
6615 @node CDLaTeX mode,  , Processing LaTeX fragments, Embedded LaTeX
6616 @section Using CDLaTeX to enter math
6617 @cindex CDLaTeX
6619 CDLaTeX mode is a minor mode that is normally used in combination with a
6620 major La@TeX{} mode like AUCTeX in order to speed-up insertion of
6621 environments and math templates.  Inside Org mode, you can make use of
6622 some of the features of CDLaTeX mode.  You need to install
6623 @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
6624 AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
6625 Don't use CDLaTeX mode itself under Org mode, but use the light
6626 version @code{org-cdlatex-mode} that comes as part of Org mode.  Turn it
6627 on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
6628 Org files with
6630 @lisp
6631 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
6632 @end lisp
6634 When this mode is enabled, the following features are present (for more
6635 details see the documentation of CDLaTeX mode):
6636 @itemize @bullet
6637 @kindex C-c @{
6638 @item
6639 Environment templates can be inserted with @kbd{C-c @{}.
6640 @item
6641 @kindex @key{TAB}
6642 The @key{TAB} key will do template expansion if the cursor is inside a
6643 La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
6644 inside such a fragment, see the documentation of the function
6645 @code{org-inside-LaTeX-fragment-p}.}.  For example, @key{TAB} will
6646 expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
6647 correctly inside the first brace.  Another @key{TAB} will get you into
6648 the second brace.  Even outside fragments, @key{TAB} will expand
6649 environment abbreviations at the beginning of a line.  For example, if
6650 you write @samp{equ} at the beginning of a line and press @key{TAB},
6651 this abbreviation will be expanded to an @code{equation} environment.
6652 To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
6653 @item
6654 @kindex _
6655 @kindex ^
6656 Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
6657 characters together with a pair of braces.  If you use @key{TAB} to move
6658 out of the braces, and if the braces surround only a single character or
6659 macro, they are removed again (depending on the variable
6660 @code{cdlatex-simplify-sub-super-scripts}).
6661 @item
6662 @kindex `
6663 Pressing the backquote @kbd{`} followed by a character inserts math
6664 macros, also outside La@TeX{} fragments.  If you wait more than 1.5 seconds
6665 after the backquote, a help window will pop up.
6666 @item
6667 @kindex '
6668 Pressing the normal quote @kbd{'} followed by another character modifies
6669 the symbol before point with an accent or a font.  If you wait more than
6670 1.5 seconds after the backquote, a help window will pop up.  Character
6671 modification will work only inside La@TeX{} fragments, outside the quote
6672 is normal.
6673 @end itemize
6675 @node Exporting, Publishing, Embedded LaTeX, Top
6676 @chapter Exporting
6677 @cindex exporting
6679 Org mode documents can be exported into a variety of other formats.  For
6680 printing and sharing of notes, ASCII export produces a readable and
6681 simple version of an Org file.  HTML export allows you to publish a
6682 notes file on the web, while the XOXO format provides a solid base for
6683 exchange with a broad range of other applications. La@TeX{} export lets
6684 you use Org mode and its structured editing functions to easily create
6685 La@TeX{} files.  To incorporate entries with associated times like
6686 deadlines or appointments into a desktop calendar program like iCal,
6687 Org mode can also produce extracts in the iCalendar format.  Currently
6688 Org mode only supports export, not import of these different formats.
6690 @menu
6691 * Markup rules::                Which structures are recognized?
6692 * Export options::              Per-file export settings
6693 * The export dispatcher::       How to access exporter commands
6694 * ASCII export::                Exporting to plain ASCII
6695 * HTML export::                 Exporting to HTML
6696 * LaTeX export::                Exporting to LaTeX
6697 * XOXO export::                 Exporting to XOXO
6698 * iCalendar export::            Exporting in iCalendar format
6699 @end menu
6701 @node Markup rules, Export options, Exporting, Exporting
6702 @section Markup rules
6704 When exporting Org mode documents,  the exporter tries to reflect the
6705 structure of the document as accurately as possible in the back-end.  Since
6706 export targets like HTML or La@TeX{} allow much richer formatting, Org mode
6707 has rules how to prepare text for rich export.  This section summarizes the
6708 markup rule used in an Org mode buffer.
6710 @menu
6711 * Document title::              How the document title is determined
6712 * Headings and sections::       The main structure of the exported document
6713 * Table of contents::           If, where, how to create a table of contents
6714 * Initial text::                Text before the first headline
6715 * Lists::                       Plain lists are exported
6716 * Paragraphs::                  What determines beginning and ending
6717 * Literal examples::            Source code and other examples
6718 * Include files::               Include the contents of a file during export
6719 * Tables exported::             Tables are exported richly
6720 * Footnotes::                   Numbers like [1]
6721 * Emphasis and monospace::      To bold or not to bold
6722 * TeX macros and LaTeX fragments::  Create special, rich export.
6723 * Horizontal rules::            A line across the page
6724 * Comment lines::               Some lines will not be exported
6725 @end menu
6727 @node Document title, Headings and sections, Markup rules, Markup rules
6728 @subheading Document title
6729 @cindex document title, markup rules
6731 @noindent
6732 The title of the exported document is taken from the special line
6734 @example
6735 #+TITLE: This is the title of the document
6736 @end example
6738 @noindent
6739 If this line does not exist, the title is derived from the first non-empty,
6740 non-comment line in the buffer.  If no such line exists, or if you have
6741 turned off exporting of the text before the first headline (see below), the
6742 title will be the file name without extension.
6744 If you are exporting only a subtree by marking is as the region, the heading
6745 of the subtree will become the title of the document.  If the subtree has a
6746 property @code{EXPORT_TITLE}, that will take precedence.
6748 @node Headings and sections, Table of contents, Document title, Markup rules
6749 @subheading Headings and sections
6750 @cindex headings and sections, markup rules
6752 The outline structure of the document as described in @ref{Document
6753 Structure} forms the basis for defining sections of the exported document.
6754 However, since the outline structure is also used for (for example) lists of
6755 tasks, only the first three outline levels will be used as headings.  Deeper
6756 levels will become itemized lists.  You can change the location of this
6757 switch, globally by setting the variable @code{org-headline-levels}, or on a
6758 per file basis with a line
6760 @example
6761 #+OPTIONS: H:4
6762 @end example
6764 @node Table of contents, Initial text, Headings and sections, Markup rules
6765 @subheading Table of contents
6766 @cindex table of contents, markup rules
6768 The table of contents is normally inserted directly before the first headline
6769 of the file.  If you would like to get it to a different location, insert the
6770 string @code{[TABLE-OF-CONTENTS]} on a line by itself at the desired
6771 location.  The depth of the table of contents is by default the same as the
6772 number of headline levels, but you can choose a smaller number or turn off
6773 the table of contents entirely by configuring the variable
6774 @code{org-export-with-toc}, or on a per-file basis with a line like
6776 @example
6777 #+OPTIONS: toc:2          (only to two levels in TOC)
6778 #+OPTIONS: toc:nil        (no TOC at all)
6779 @end example
6781 @node Initial text, Lists, Table of contents, Markup rules
6782 @subheading Text before the first headline
6783 @cindex text before first headline, markup rules
6784 @cindex #+TEXT
6786 Org mode normally exports the text before the first headline, and even uses
6787 the first line as the document title.  The text will be fully marked up.  If
6788 you need to include literal HTML or La@TeX{} code, use the special constructs
6789 described below in the sections for the individual exporters.
6791 Some people like to use the space before the first headline for setup and
6792 internal links and therefore would like to control the exported text before
6793 the first headline in a different way.  You can do so by setting the variable
6794 @code{org-export-skip-text-before-1st-heading} to @code{t}.  On a per-file
6795 basis, you can get the same effect with @samp{#+OPTIONS: skip:t}.
6797 @noindent
6798 If you still want to have some text before the first headline, use the
6799 @code{#+TEXT} construct:
6801 @example
6802 #+OPTIONS: skip:t
6803 #+TEXT: This text will go before the *first* headline.
6804 #+TEXT: [TABLE-OF-CONTENTS]
6805 #+TEXT: This goes between the table of contents and the first headline
6806 @end example
6808 @node Lists, Paragraphs, Initial text, Markup rules
6809 @subheading Lists
6810 @cindex lists, markup rules
6812 Plain lists as described in @ref{Plain lists} are translated to the back-ends
6813 syntax for such lists.  Most back-ends support unordered, ordered, and
6814 description lists.
6816 @node Paragraphs, Literal examples, Lists, Markup rules
6817 @subheading Paragraphs, line breaks, and quoting
6818 @cindex paragraphs, markup rules
6820 Paragraphs are separated by at least one empty line.  If you need to enforce
6821 a line break within a paragraph, use @samp{\\} at the end of a line.
6823 To keep the line breaks in a region, but otherwise use normal formatting, you
6824 can use this construct, which can also be used to format poetry.
6826 @example
6827 #+BEGIN_VERSE
6828 Everything should be made as simple as possible,
6829 but not any simpler -- Albert Einstein
6830 #+END_VERSE
6831 @end example
6833 When quoting a passage from another document, it is customary to format this
6834 as a paragraph that is indented on both the left and the right margin.  You
6835 can include quotations in Org mode documents like this:
6837 @example
6838 #+BEGIN_QUOTE
6839 Everything should be made as simple as possible,
6840 but not any simpler -- Albert Einstein
6841 #+END_QUOTE
6842 @end example
6845 @node Literal examples, Include files, Paragraphs, Markup rules
6846 @subheading Literal examples
6847 @cindex literal examples, markup rules
6849 You can include literal examples that should not be subjected to
6850 markup.  Such examples will be typeset in monospace, so this is well suited
6851 for source code and similar examples.
6852 @cindex #+BEGIN_EXAMPLE
6854 @example
6855 #+BEGIN_EXAMPLE
6856 Some example from a text file.
6857 #+END_EXAMPLE
6858 @end example
6860 For simplicity when using small examples, you can also start the example
6861 lines with a colon:
6863 @example
6864 : Some example from a text file.
6865 @end example
6867 @cindex formatting source code, markup rules
6868 If the example is source code from a programming language, or any other text
6869 that can be marked up by font-lock in Emacs, you can ask for the example to
6870 look like the fontified Emacs buffer@footnote{Currently this works only for
6871 the HTML back-end, and requires the @file{htmlize.el} package version 1.34 or
6872 later.}.  This is done with the @samp{src} block, where you also need to
6873 specify the name of the major mode that should be used to fontify the
6874 example:
6875 @cindex #+BEGIN_SRC
6877 @example
6878 #+BEGIN_SRC emacs-lisp
6879 (defun org-xor (a b)
6880    "Exclusive or."
6881    (if a (not b) b))
6882 #+END_SRC
6883 @end example
6885 @table @kbd
6886 @kindex C-c '
6887 @item C-c '
6888 Edit the source code example at point in its native mode.  This works by
6889 switching to an indirect buffer, narrowing the buffer and switching to the
6890 other mode.  You need to exit by pressing @kbd{C-c '} again.
6891 @end table
6894 @node Include files, Tables exported, Literal examples, Markup rules
6895 @subheading Include files
6896 @cindex include files, markup rules
6898 During export, you can include the content of another file.  For example, to
6899 include your .emacs file, you could use:
6900 @cindex #+INCLUDE
6902 @example
6903 #+INCLUDE: "~/.emacs" src emacs-lisp
6904 @end example
6906 The optional second and third parameter are the markup (@samp{quote},
6907 @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
6908 language for formatting the contents.  The markup is optional, if it is not
6909 given, the text will be assumed to be in Org mode format and will be
6910 processed normally.
6912 @table @kbd
6913 @kindex C-c '
6914 @item C-c '
6915 Visit the include file at point.
6916 @end table
6918 @node Tables exported, Footnotes, Include files, Markup rules
6919 @subheading Tables
6920 @cindex tables, markup rules
6922 Both the native Org mode tables (@pxref{Tables}) and tables formatted with
6923 the @file{table.el} package will be exported properly.  For Org mode tables,
6924 the lines before the first horizontal separator line will become table header
6925 lines.
6927 @node Footnotes, Emphasis and monospace, Tables exported, Markup rules
6928 @subheading Footnotes
6929 @cindex footnotes, markup rules
6930 @cindex @file{footnote.el}
6932 @kindex C-c !
6933 Numbers in square brackets are treated as footnote markers, and lines
6934 starting with such a marker are interpreted as the footnote itself.  You can
6935 use the Emacs package @file{footnote.el} to create footnotes@footnote{The
6936 @file{footnote} package uses @kbd{C-c !} to invoke its commands.  This
6937 binding conflicts with the Org mode command for inserting inactive time
6938 stamps.  You could use the variable @code{footnote-prefix} to switch
6939 footnotes commands to another key.  Or, if you are too used to this binding,
6940 you could use @code{org-replace-disputed-keys} and @code{org-disputed-keys}
6941 to change the settings in Org.}.  For example:
6943 @example
6944 The Org homepage[1] now looks a lot better than it used to.
6946 [1] The link is: http://orgmode.org
6947 @end example
6949 @node Emphasis and monospace, TeX macros and LaTeX fragments, Footnotes, Markup rules
6950 @subheading Emphasis and monospace
6952 @cindex underlined text, markup rules
6953 @cindex bold text, markup rules
6954 @cindex italic text, markup rules
6955 @cindex verbatim text, markup rules
6956 @cindex code text, markup rules
6957 @cindex strike-through text, markup rules
6958 You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
6959 and @code{~verbatim~}, and, if you must, @samp{+strike-through+}.  Text
6960 in the code and verbatim string is not processed for Org mode specific
6961 syntax, it is exported verbatim.
6963 @node TeX macros and LaTeX fragments, Horizontal rules, Emphasis and monospace, Markup rules
6964 @subheading @TeX{} macros and La@TeX{} fragments
6965 @cindex LaTeX fragments, markup rules
6966 @cindex TeX macros, markup rules
6967 @cindex HTML entities
6968 @cindex LaTeX entities
6970 A @TeX{}-like syntax is used to specify special characters.  Where possible,
6971 these will be transformed into the native format of the exporter back-end.
6972 Strings like @code{\alpha} will be exported as @code{&alpha;} in the HTML
6973 output, and as @code{$\alpha$} in the La@TeX{} output.  Similarly,
6974 @code{\nbsp} will become @code{&nbsp;} in HTML and @code{~} in La@TeX{}.
6975 This applies for a large number of entities, with names taken from both HTML
6976 and La@TeX{}, see the variable @code{org-html-entities} for the complete
6977 list.  If you are unsure about a name, use @kbd{M-@key{TAB}} for completion
6978 after having types the backslash and maybe a few characters
6979 (@pxref{Completion}).
6981 La@TeX{} fragments are converted into images for HTML export, and they are
6982 written literally into the La@TeX{} export.  See also @ref{Embedded LaTeX}.
6984 Finally, @samp{\-} is treated as a shy hyphen, and @samp{--}, @samp{---}, and
6985 @samp{...} are all converted into special commands creating hyphens of
6986 different lengths or a compact set of dots.
6988 @node Horizontal rules, Comment lines, TeX macros and LaTeX fragments, Markup rules
6989 @subheading  Horizontal rules
6990 @cindex horizontal rules, markup rules
6991 A line consisting of only dashes, and at least 5 of them, will be
6992 exported as a horizontal line (@samp{<hr/>} in HTML).
6994 @node Comment lines,  , Horizontal rules, Markup rules
6995 @subheading Comment lines
6996 @cindex comment lines
6997 @cindex exporting, not
6999 Lines starting with @samp{#} in column zero are treated as comments and will
7000 never be exported.  Also entire subtrees starting with the word
7001 @samp{COMMENT} will never be exported.  Finally, regions surrounded by
7002 @samp{#+BEGIN_COMMENT} ... @samp{#+END_COMMENT} will not be exported.
7004 @table @kbd
7005 @kindex C-c ;
7006 @item C-c ;
7007 Toggle the COMMENT keyword at the beginning of an entry.
7008 @end table
7010 @node Export options, The export dispatcher, Markup rules, Exporting
7011 @section Export options
7012 @cindex options, for export
7014 @cindex completion, of option keywords
7015 The exporter recognizes special lines in the buffer which provide
7016 additional information.  These lines may be put anywhere in the file.
7017 The whole set of lines can be inserted into the buffer with @kbd{C-c
7018 C-e t}.  For individual lines, a good way to make sure the keyword is
7019 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
7020 (@pxref{Completion}).
7022 @table @kbd
7023 @kindex C-c C-e t
7024 @item C-c C-e t
7025 Insert template with export options, see example below.
7026 @end table
7028 @cindex #+TITLE:
7029 @cindex #+AUTHOR:
7030 @cindex #+DATE:
7031 @cindex #+EMAIL:
7032 @cindex #+LANGUAGE:
7033 @cindex #+TEXT:
7034 @cindex #+OPTIONS:
7035 @cindex #+LINK_UP:
7036 @cindex #+LINK_HOME:
7037 @example
7038 #+TITLE:     the title to be shown (default is the buffer name)
7039 #+AUTHOR:    the author (default taken from @code{user-full-name})
7040 #+DATE:      A date, fixed, of a format string for @code{format-time-string}
7041 #+EMAIL:     his/her email address (default from @code{user-mail-address})
7042 #+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
7043 #+TEXT:      Some descriptive text to be inserted at the beginning.
7044 #+TEXT:      Several lines may be given.
7045 #+OPTIONS:   H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
7046 #+LINK_UP:   the ``up'' link of an exported page
7047 #+LINK_HOME: the ``home'' link of an exported page
7048 @end example
7050 @noindent
7051 The OPTIONS line is a compact@footnote{If you want to configure many options
7052 this way, you can use several OPTIONS lines.} form to specify export settings.  Here
7053 you can:
7054 @cindex headline levels
7055 @cindex section-numbers
7056 @cindex table of contents
7057 @cindex line-break preservation
7058 @cindex quoted HTML tags
7059 @cindex fixed-width sections
7060 @cindex tables
7061 @cindex @TeX{}-like syntax for sub- and superscripts
7062 @cindex footnotes
7063 @cindex special strings
7064 @cindex emphasized text
7065 @cindex @TeX{} macros
7066 @cindex La@TeX{} fragments
7067 @cindex author info, in export
7068 @cindex time info, in export
7069 @example
7070 H:         @r{set the number of headline levels for export}
7071 num:       @r{turn on/off section-numbers}
7072 toc:       @r{turn on/off table of contents, or set level limit (integer)}
7073 \n:        @r{turn on/off line-break-preservation}
7074 @@:         @r{turn on/off quoted HTML tags}
7075 ::         @r{turn on/off fixed-width sections}
7076 |:         @r{turn on/off tables}
7077 ^:         @r{turn on/off @TeX{}-like syntax for sub- and superscripts.  If}
7078            @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
7079            @r{the simple @code{a_b} will be left as it is.}
7080 -:         @r{turn on/off conversion of special strings.}
7081 f:         @r{turn on/off footnotes like this[1].}
7082 *:         @r{turn on/off emphasized text (bold, italic, underlined)}
7083 TeX:       @r{turn on/off simple @TeX{} macros in plain text}
7084 LaTeX:     @r{turn on/off La@TeX{} fragments}
7085 skip:      @r{turn on/off skipping the text before the first heading}
7086 author:    @r{turn on/off inclusion of author name/email into exported file}
7087 timestamp: @r{turn on/off inclusion creation time into exported file}
7088 d:         @r{turn on/off inclusion of drawers}
7089 @end example
7091 These options take effect in both the HTML and La@TeX{} export, except
7092 for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
7093 @code{nil} for the La@TeX{} export.
7095 When exporting only a single subtree by selecting it with @kbd{C-c @@} before
7096 calling an export command, the subtree can overrule some of the file's export
7097 settings with properties @code{EXPORT_FILE_NAME}, @code{EXPORT_TITLE},
7098 @code{EXPORT_TEXT}, and @code{EXPORT_OPTIONS}.
7100 @node The export dispatcher, ASCII export, Export options, Exporting
7101 @section The export dispatcher
7102 @cindex dispatcher, for export commands
7104 All export commands can be reached using the export dispatcher, which is a
7105 prefix key that prompts for an additional key specifying the command.
7106 Normally the entire file is exported, but if there is an active region that
7107 contains one outline tree, the first heading is used as document title and
7108 the subtrees are exported.
7110 @table @kbd
7111 @kindex C-c C-e
7112 @item C-c C-e
7113 Dispatcher for export and publishing commands.  Displays a help-window
7114 listing the additional key(s) needed to launch an export or publishing
7115 command.  The prefix arg is passed through to the exporter.  If the option
7116 @code{org-export-run-in-background} is set, Org will run the command in the
7117 background if that seems useful for the specific command (i.e. commands that
7118 write to a file).
7119 @kindex C-c C-e v
7120 @item C-c C-e v
7121 Like @kbd{C-c C-e}, but only export the text that is currently visible
7122 (i.e. not hidden by outline visibility).
7123 @kindex C-u C-u C-c C-e
7124 @item C-u C-u C-c C-e
7125 Call an the exporter, but reverse the setting of
7126 @code{org-export-run-in-background}, i.e. request background processing if
7127 not set, or force processing in the current Emacs process if st.
7128 @end table
7130 @node ASCII export, HTML export, The export dispatcher, Exporting
7131 @section ASCII export
7132 @cindex ASCII export
7134 ASCII export produces a simple and very readable version of an Org mode
7135 file.
7137 @cindex region, active
7138 @cindex active region
7139 @cindex Transient mark mode
7140 @table @kbd
7141 @kindex C-c C-e a
7142 @item C-c C-e a
7143 Export as ASCII file.  For an org file @file{myfile.org}, the ASCII file
7144 will be @file{myfile.txt}.  The file will be overwritten without
7145 warning.  If there is an active region, only the region will be
7146 exported. If the selected region is a single tree@footnote{To select the
7147 current subtree, use @kbd{C-c @@}.}, the tree head will
7148 become the document title.  If the tree head entry has or inherits an
7149 @code{EXPORT_FILE_NAME} property, that name will be used for the
7150 export.
7151 @kindex C-c C-e v a
7152 @item C-c C-e v a
7153 Export only the visible part of the document.
7154 @end table
7156 @cindex headline levels, for exporting
7157 In the exported version, the first 3 outline levels will become
7158 headlines, defining a general document structure.  Additional levels
7159 will be exported as itemized lists.  If you want that transition to occur
7160 at a different level, specify it with a prefix argument.  For example,
7162 @example
7163 @kbd{C-1 C-c C-e a}
7164 @end example
7166 @noindent
7167 creates only top level headlines and does the rest as items.  When
7168 headlines are converted to items, the indentation of the text following
7169 the headline is changed to fit nicely under the item.  This is done with
7170 the assumption that the first body line indicates the base indentation of
7171 the body text.  Any indentation larger than this is adjusted to preserve
7172 the layout relative to the first line.  Should there be lines with less
7173 indentation than the first, these are left alone.
7175 @node HTML export, LaTeX export, ASCII export, Exporting
7176 @section HTML export
7177 @cindex HTML export
7179 Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
7180 HTML formatting, in ways similar to John Grubers @emph{markdown}
7181 language, but with additional support for tables.
7183 @menu
7184 * HTML Export commands::        How to invoke HTML export
7185 * Quoting HTML tags::           Using direct HTML in Org mode
7186 * Links::                       Transformation of links for HTML
7187 * Images::                      How to include images
7188 * CSS support::                 Changing the appearance of the output
7189 * Javascript support::          Info and Folding in a web browser
7190 @end menu
7192 @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
7193 @subsection HTML export commands
7195 @cindex region, active
7196 @cindex active region
7197 @cindex Transient mark mode
7198 @table @kbd
7199 @kindex C-c C-e h
7200 @item C-c C-e h
7201 Export as HTML file @file{myfile.html}.  For an org file @file{myfile.org},
7202 the ASCII file will be @file{myfile.html}.  The file will be overwritten
7203 without warning.  If there is an active region, only the region will be
7204 exported. If the selected region is a single tree@footnote{To select the
7205 current subtree, use @kbd{C-c @@}.}, the tree head will become the document
7206 title.  If the tree head entry has or inherits an @code{EXPORT_FILE_NAME}
7207 property, that name will be used for the export.
7208 @kindex C-c C-e b
7209 @item C-c C-e b
7210 Export as HTML file and immediately open it with a browser.
7211 @kindex C-c C-e H
7212 @item C-c C-e H
7213 Export to a temporary buffer, do not create a file.
7214 @kindex C-c C-e R
7215 @item C-c C-e R
7216 Export the active region to a temporary buffer.  With a prefix argument, do
7217 not produce the file header and footer, but just the plain HTML section for
7218 the region.  This is good for cut-and-paste operations.
7219 @kindex C-c C-e v h
7220 @kindex C-c C-e v b
7221 @kindex C-c C-e v H
7222 @kindex C-c C-e v R
7223 @item C-c C-e v h
7224 @item C-c C-e v b
7225 @item C-c C-e v H
7226 @item C-c C-e v R
7227 Export only the visible part of the document.
7228 @item M-x org-export-region-as-html
7229 Convert the region to HTML under the assumption that it was Org mode
7230 syntax before.  This is a global command that can be invoked in any
7231 buffer.
7232 @item M-x org-replace-region-by-HTML
7233 Replace the active region (assumed to be in Org mode syntax) by HTML
7234 code.
7235 @end table
7237 @cindex headline levels, for exporting
7238 In the exported version, the first 3 outline levels will become headlines,
7239 defining a general document structure.  Additional levels will be exported as
7240 itemized lists.  If you want that transition to occur at a different level,
7241 specify it with a numeric prefix argument.  For example,
7243 @example
7244 @kbd{C-2 C-c C-e b}
7245 @end example
7247 @noindent
7248 creates two levels of headings and does the rest as items.
7250 @node Quoting HTML tags, Links, HTML Export commands, HTML export
7251 @subsection Quoting HTML tags
7253 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
7254 @samp{&gt;} in HTML export.  If you want to include simple HTML tags
7255 which should be interpreted as such, mark them with @samp{@@} as in
7256 @samp{@@<b>bold text@@</b>}.  Note that this really works only for
7257 simple tags.  For more extensive HTML that should be copied verbatim to
7258 the exported file use either
7260 @example
7261 #+HTML: Literal HTML code for export
7262 @end example
7264 @noindent or
7265 @cindex #+BEGIN_HTML
7267 @example
7268 #+BEGIN_HTML
7269 All lines between these markers are exported literally
7270 #+END_HTML
7271 @end example
7274 @node Links, Images, Quoting HTML tags, HTML export
7275 @subsection Links
7277 @cindex links, in HTML export
7278 @cindex internal links, in HTML export
7279 @cindex external links, in HTML export
7280 Internal links (@pxref{Internal links}) will continue to work in HTML
7281 files only if they match a dedicated @samp{<<target>>}.  Automatic links
7282 created by radio targets (@pxref{Radio targets}) will also work in the
7283 HTML file.  Links to external files will still work if the HTML file is
7284 in the same directory as the Org file.  Links to other @file{.org}
7285 files will be translated into HTML links under the assumption that an
7286 HTML version also exists of the linked file.  For information related to
7287 linking files while publishing them to a publishing directory see
7288 @ref{Publishing links}.
7290 @node Images, CSS support, Links, HTML export
7291 @subsection Images
7293 @cindex images, inline in HTML
7294 @cindex inlining images in HTML
7295 HTML export can inline images given as links in the Org file, and
7296 it can make an image the clickable part of a link.  By
7297 default@footnote{but see the variable
7298 @code{org-export-html-inline-images}}, images are inlined if a link does
7299 not have a description.  So @samp{[[file:myimg.jpg]]} will be inlined,
7300 while @samp{[[file:myimg.jpg][the image]]} will just produce a link
7301 @samp{the image} that points to the image.  If the description part
7302 itself is a @code{file:} link or a @code{http:} URL pointing to an
7303 image, this image will be inlined and activated so that clicking on the
7304 image will activate the link.  For example, to include a thumbnail that
7305 will link to a high resolution version of the image, you could use:
7307 @example
7308 [[file:highres.jpg][file:thumb.jpg]]
7309 @end example
7311 @noindent
7312 and you could use @code{http} addresses just as well.
7314 @node CSS support, Javascript support, Images, HTML export
7315 @subsection CSS support
7316 @cindex CSS, for HTML export
7317 @cindex HTML export, CSS
7319 You can also give style information for the exported file.  The HTML
7320 exporter assigns the following CSS classes to appropriate parts of the
7321 document - your style specifications may change these:
7322 @example
7323 .todo           @r{TODO keywords}
7324 .done           @r{the DONE keyword}
7325 .timestamp      @r{time stamp}
7326 .timestamp-kwd  @r{keyword associated with a time stamp, like SCHEDULED}
7327 .tag            @r{tag in a headline}
7328 .target         @r{target for links}
7329 @end example
7331 The default style specification can be configured through the option
7332 @code{org-export-html-style}.  If you want to use a file-local style,
7333 you may use file variables, best wrapped into a COMMENT section at the
7334 end of the outline tree.  For example@footnote{Under Emacs 21, the
7335 continuation lines for a variable value should have no @samp{#} at the
7336 start of the line.}:
7338 @example
7339 * COMMENT html style specifications
7341 # Local Variables:
7342 # org-export-html-style: "   <style type=\"text/css\">
7343 #       p @{font-weight: normal; color: gray; @}
7344 #       h1 @{color: black; @}
7345 #   </style>"
7346 # End:
7347 @end example
7349 Remember to execute @kbd{M-x normal-mode} after changing this to make
7350 the new style visible to Emacs.  This command restarts Org mode for the
7351 current buffer and forces Emacs to re-evaluate the local variables
7352 section in the buffer.
7354 @c FIXME: More about header and footer styles
7355 @c FIXME: Talk about links and targets.
7357 @node Javascript support,  , CSS support, HTML export
7358 @subsection Javascript supported display of web pages
7360 @emph{Sebastian Rose} has written a JavaScript program especially designed to
7361 enhance the web viewing experience of HTML files created with Org.  This
7362 program allows to view large files in two different ways.  The first one is
7363 an @emph{Info}-like mode where each section is displayed separately and
7364 navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
7365 as well, press @kbd{?} for an overview of the available keys).  The second
7366 view type is a @emph{folding} view much like Org provides it inside Emacs.
7367 The script is available at @url{http://orgmode.org/org-info.js} and you can
7368 find the documentation for it at
7369 @url{http://orgmode.org/worg/code/org-info-js/org-info.js.html}.  We are
7370 serving the script from our site, but if you use it a lot, you might not want
7371 to be dependent on @url{orgmode.org} and prefer to install a local copy on
7372 your own web server.
7374 To use the script, you need to make sure that the @file{org-jsinfo.el} module
7375 gets loaded.  It should be loaded by default, try @kbd{M-x customize-variable
7376 @key{RET} org-modules @key{RET}} to convince yourself that this is indeed the
7377 case.  All it then takes to make use of the program is adding a single line
7378 to the Org file:
7380 @example
7381 #+INFOJS_OPT: view:info toc:nil
7382 @end example
7384 @noindent
7385 If this line is found, the HTML header will automatically contain the code
7386 needed to invoke the script.  Using the line above, you can set the following
7387 viewing options:
7389 @example
7390 path:    @r{The path to the script.  The default is to grab the script from}
7391          @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
7392          @r{a local copy and use a path like @samp{../scripts/org-info.js}.}
7393 view:    @r{Initial view when website is first shown.  Possible values are:}
7394          info      @r{Info-like interface with one section per page.}
7395          overview  @r{Folding interface, initially showing only top-level.}
7396          content   @r{Folding interface, starting with all headlines visible.}
7397          showall   @r{Folding interface, all headlines and text visible.}
7398 sdepth:  @r{Maximum headline level that will still become an independent}
7399          @r{section for info and folding modes.  The default is taken from}
7400          @r{@code{org-headline-levels} (= the @code{H} switch in @code{#+OPTIONS}).}
7401          @r{If this is smaller than in @code{org-headline-levels}, each}
7402          @r{info/folding section can still contain children headlines.}
7403 toc:     @r{Should the table of content @emph{initially} be visible?}
7404          @r{Even when @code{nil}, you can always get to the toc with @kbd{i}.}
7405 tdepth:  @r{The depth of the table of contents.  The defaults are taken from}
7406          @r{the variables @code{org-headline-levels} and @code{org-export-with-toc}.}
7407 ftoc:    @r{Does the css of the page specify a fixed position for the toc?}
7408          @r{If yes, the toc will never be displayed as a section.}
7409 ltoc:    @r{Should there be short contents (children) in each section?}
7410 mouse:   @r{Headings are highlighted when the mouse is over them.  Should be}
7411          @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
7412 buttons: @r{Should view-toggle buttons be everywhere?  When @code{nil} (the}
7413          @r{default), only one such button will be present.}
7414 @end example
7416 You can choose default values for these options by customizing the variable
7417 @code{org-infojs-options}.  If you always want to apply the script to your
7418 pages, configure the variable @code{org-export-html-use-infojs}.
7420 @node LaTeX export, XOXO export, HTML export, Exporting
7421 @section LaTeX export
7422 @cindex LaTeX export
7424 Org mode contains a La@TeX{} exporter written by Bastien Guerry.
7426 @menu
7427 * LaTeX export commands::       How to invoke LaTeX export
7428 * Quoting LaTeX code::          Incorporating literal LaTeX code
7429 * Sectioning structure::        Changing sectioning in LaTeX output
7430 @end menu
7432 @node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
7433 @subsection LaTeX export commands
7435 @table @kbd
7436 @kindex C-c C-e l
7437 @item C-c C-e l
7438 Export as La@TeX{} file @file{myfile.tex}.  For an org file
7439 @file{myfile.org}, the ASCII file will be @file{myfile.tex}.  The file will
7440 be overwritten without warning.  If there is an active region, only the
7441 region will be exported. If the selected region is a single tree@footnote{To
7442 select the current subtree, use @kbd{C-c @@}.}, the tree head will become the
7443 document title.  If the tree head entry has or inherits an
7444 @code{EXPORT_FILE_NAME} property, that name will be used for the export.
7445 @kindex C-c C-e L
7446 @item C-c C-e L
7447 Export to a temporary buffer, do not create a file.
7448 @kindex C-c C-e v l
7449 @kindex C-c C-e v L
7450 @item C-c C-e v l
7451 @item C-c C-e v L
7452 Export only the visible part of the document.
7453 @item M-x org-export-region-as-latex
7454 Convert the region to La@TeX{} under the assumption that it was Org mode
7455 syntax before.  This is a global command that can be invoked in any
7456 buffer.
7457 @item M-x org-replace-region-by-latex
7458 Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
7459 code.
7460 @end table
7462 @cindex headline levels, for exporting
7463 In the exported version, the first 3 outline levels will become
7464 headlines, defining a general document structure.  Additional levels
7465 will be exported as description lists.  The exporter can ignore them or
7466 convert them to a custom string depending on
7467 @code{org-latex-low-levels}.
7469 If you want that transition to occur at a different level, specify it
7470 with a numeric prefix argument. For example,
7472 @example
7473 @kbd{C-2 C-c C-e l}
7474 @end example
7476 @noindent
7477 creates two levels of headings and does the rest as items.
7479 @node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export
7480 @subsection Quoting LaTeX code
7482 Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
7483 inserted into the La@TeX{} file.  Furthermore, you can add special code
7484 that should only be present in La@TeX{} export with the following
7485 constructs:
7487 @example
7488 #+LaTeX: Literal LaTeX code for export
7489 @end example
7491 @noindent or
7492 @cindex #+BEGIN_LaTeX
7494 @example
7495 #+BEGIN_LaTeX
7496 All lines between these markers are exported literally
7497 #+END_LaTeX
7498 @end example
7500 @node   Sectioning structure,  , Quoting LaTeX code, LaTeX export
7501 @subsection Sectioning structure
7502 @cindex LaTeX class
7503 @cindex LaTeX sectioning structure
7505 By default, the La@TeX{} output uses the class @code{article}.
7507 You can change this globally by setting a different value for
7508 @code{org-export-latex-default-class} or locally by adding an option
7509 like @code{#+LaTeX_CLASS: myclass} in your file.  The class should be
7510 listed in @code{org-export-latex-classes}, where you can also define the
7511 sectioning structure for each class.
7514 @node XOXO export, iCalendar export, LaTeX export, Exporting
7515 @section XOXO export
7516 @cindex XOXO export
7518 Org mode contains an exporter that produces XOXO-style output.
7519 Currently, this exporter only handles the general outline structure and
7520 does not interpret any additional Org mode features.
7522 @table @kbd
7523 @kindex C-c C-e x
7524 @item C-c C-e x
7525 Export as XOXO file @file{myfile.html}.
7526 @kindex C-c C-e v
7527 @item C-c C-e v x
7528 Export only the visible part of the document.
7529 @end table
7531 @node iCalendar export,  , XOXO export, Exporting
7532 @section iCalendar export
7533 @cindex iCalendar export
7535 Some people like to use Org mode for keeping track of projects, but
7536 still prefer a standard calendar application for anniversaries and
7537 appointments.  In this case it can be useful to have deadlines and
7538 other time-stamped items in Org files show up in the calendar
7539 application.  Org mode can export calendar information in the standard
7540 iCalendar format.  If you also want to have TODO entries included in the
7541 export, configure the variable @code{org-icalendar-include-todo}.
7543 The iCalendar standard requires each entry to have a globally unique
7544 identifier (UID).  Org creates these identifiers during export.  If you set
7545 the variable @code{org-icalendar-store-UID}, the UID will be stored in the
7546 @code{:ID:} property of the entry and re-used next time you report this
7547 entry.  Since a single entry can give rise to multiple iCalendar entries (as
7548 a timestamp, a deadline, a scheduled item, and as a TODO item), Org adds
7549 prefixes to the UID, depending on what triggered the inclusion of the entry.
7550 In this way the UID remains unique, but a synchronization program can still
7551 figure out from which entry all the different instances originate.
7553 @table @kbd
7554 @kindex C-c C-e i
7555 @item C-c C-e i
7556 Create iCalendar entries for the current file and store them in the same
7557 directory, using a file extension @file{.ics}.
7558 @kindex C-c C-e I
7559 @item C-c C-e I
7560 Like @kbd{C-c C-e i}, but do this for all files in
7561 @code{org-agenda-files}.  For each of these files, a separate iCalendar
7562 file will be written.
7563 @kindex C-c C-e c
7564 @item C-c C-e c
7565 Create a single large iCalendar file from all files in
7566 @code{org-agenda-files} and write it to the file given by
7567 @code{org-combined-agenda-icalendar-file}.
7568 @end table
7570 The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
7571 the selected entries have them.  If not, the summary will be derived
7572 from the headline, and the description from the body (limited to
7573 @code{org-icalendar-include-body} characters).
7575 How this calendar is best read and updated, depends on the application
7576 you are using.  The FAQ covers this issue.
7578 @node Publishing, Miscellaneous, Exporting, Top
7579 @chapter Publishing
7580 @cindex publishing
7582 Org includes@footnote{@file{org-publish.el} is not distributed with
7583 Emacs 21, if you are still using Emacs 21, you need you need to download
7584 this file separately.} a publishing management system that allows you to
7585 configure automatic HTML conversion of @emph{projects} composed of
7586 interlinked org files.  This system is called @emph{org-publish}.  You can
7587 also configure org-publish to automatically upload your exported HTML
7588 pages and related attachments, such as images and source code files, to
7589 a web server. Org-publish turns Org into a web-site authoring tool.
7591 You can also use Org-publish to convert files into La@TeX{}, or even
7592 combine HTML and La@TeX{} conversion so that files are available in both
7593 formats on the server@footnote{Since La@TeX{} files on a server are not
7594 that helpful, you surely want to perform further conversion on them --
7595 e.g. convert them to @code{PDF} format.}.
7597 Org-publish has been contributed to Org by David O'Toole.
7599 @menu
7600 * Configuration::               Defining projects
7601 * Sample configuration::        Example projects
7602 * Triggering publication::      Publication commands
7603 @end menu
7605 @node Configuration, Sample configuration, Publishing, Publishing
7606 @section Configuration
7608 Publishing needs significant configuration to specify files, destination
7609 and many other properties of a project.
7611 @menu
7612 * Project alist::               The central configuration variable
7613 * Sources and destinations::    From here to there
7614 * Selecting files::             What files are part of the project?
7615 * Publishing action::           Setting the function doing the publishing
7616 * Publishing options::          Tweaking HTML export
7617 * Publishing links::            Which links keep working after publishing?
7618 * Project page index::          Publishing a list of project files
7619 @end menu
7621 @node Project alist, Sources and destinations, Configuration, Configuration
7622 @subsection The variable @code{org-publish-project-alist}
7623 @cindex org-publish-project-alist
7624 @cindex projects, for publishing
7626 Org-publish is configured almost entirely through setting the value of
7627 one variable, called @code{org-publish-project-alist}.
7628 Each element of the list configures one project, and may be in one of
7629 the two following forms:
7631 @lisp
7632 ("project-name" :property value :property value ...)
7634 @r{or}
7636 ("project-name" :components ("project-name" "project-name" ...))
7638 @end lisp
7640 In both cases, projects are configured by specifying property values.
7641 A project defines the set of files that will be published, as well as
7642 the publishing configuration to use when publishing those files.  When
7643 a project takes the second form listed above, the individual members
7644 of the ``components'' property are taken to be components of the
7645 project, which group together files requiring different publishing
7646 options. When you publish such a ``meta-project'' all the components
7647 will also publish.
7649 @node Sources and destinations, Selecting files, Project alist, Configuration
7650 @subsection Sources and destinations for files
7651 @cindex directories, for publishing
7653 Most properties are optional, but some should always be set. In
7654 particular, org-publish needs to know where to look for source files,
7655 and where to put published files.
7657 @multitable @columnfractions 0.3 0.7
7658 @item @code{:base-directory}
7659 @tab Directory containing publishing source files
7660 @item @code{:publishing-directory}
7661 @tab Directory (possibly remote) where output files will be published.
7662 @item @code{:preparation-function}
7663 @tab Function called before starting the publishing process, for example to
7664 run @code{make} for updating files to be published.
7665 @item @code{:completion-function}
7666 @tab Function called after finishing the publishing process, for example to
7667 change permissions of the resulting files.
7668 @end multitable
7669 @noindent
7671 @node Selecting files, Publishing action, Sources and destinations, Configuration
7672 @subsection Selecting files
7673 @cindex files, selecting for publishing
7675 By default, all files with extension @file{.org} in the base directory
7676 are considered part of the project.  This can be modified by setting the
7677 properties
7678 @multitable @columnfractions 0.25 0.75
7679 @item @code{:base-extension}
7680 @tab Extension (without the dot!) of source files.  This actually is a
7681 regular expression.
7683 @item @code{:exclude}
7684 @tab Regular expression to match file names that should not be
7685 published, even though they have been selected on the basis of their
7686 extension.
7688 @item @code{:include}
7689 @tab List of files to be included regardless of @code{:base-extension}
7690 and @code{:exclude}.
7691 @end multitable
7693 @node Publishing action, Publishing options, Selecting files, Configuration
7694 @subsection Publishing action
7695 @cindex action, for publishing
7697 Publishing means that a file is copied to the destination directory and
7698 possibly transformed in the process.  The default transformation is to
7699 export Org files as HTML files, and this is done by the function
7700 @code{org-publish-org-to-html} which calls the HTML exporter
7701 (@pxref{HTML export}). But you also can publish your files in La@TeX{} by
7702 using the function @code{org-publish-org-to-latex} instead. Other files
7703 like images only need to be copied to the publishing destination. For
7704 non-Org files, you need to specify the publishing function.
7707 @multitable @columnfractions 0.3 0.7
7708 @item @code{:publishing-function}
7709 @tab Function executing the publication of a file.  This may also be a
7710 list of functions, which will all be called in turn.
7711 @end multitable
7713 The function must accept two arguments: a property list containing at
7714 least a @code{:publishing-directory} property, and the name of the file
7715 to be published.  It should take the specified file, make the necessary
7716 transformation (if any) and place the result into the destination folder.
7717 You can write your own publishing function, but @code{org-publish}
7718 provides one for attachments (files that only need to be copied):
7719 @code{org-publish-attachment}.
7721 @node Publishing options, Publishing links, Publishing action, Configuration
7722 @subsection Options for the HTML/LaTeX exporters
7723 @cindex options, for publishing
7725 The property list can be used to set many export options for the HTML
7726 and La@TeX{} exporters.  In most cases, these properties correspond to user
7727 variables in Org.  The table below lists these properties along
7728 with the variable they belong to.  See the documentation string for the
7729 respective variable for details.
7731 @multitable @columnfractions 0.3 0.7
7732 @item @code{:language}              @tab @code{org-export-default-language}
7733 @item @code{:headline-levels}       @tab @code{org-export-headline-levels}
7734 @item @code{:section-numbers}       @tab @code{org-export-with-section-numbers}
7735 @item @code{:table-of-contents}     @tab @code{org-export-with-toc}
7736 @item @code{:archived-trees}        @tab @code{org-export-with-archived-trees}
7737 @item @code{:emphasize}             @tab @code{org-export-with-emphasize}
7738 @item @code{:sub-superscript}       @tab @code{org-export-with-sub-superscripts}
7739 @item @code{:special-strings}       @tab @code{org-export-with-special-strings}
7740 @item @code{:TeX-macros}            @tab @code{org-export-with-TeX-macros}
7741 @item @code{:LaTeX-fragments}       @tab @code{org-export-with-LaTeX-fragments}
7742 @item @code{:fixed-width}           @tab @code{org-export-with-fixed-width}
7743 @item @code{:timestamps}           .@tab @code{org-export-with-timestamps}
7744 @item @code{:tags}                 .@tab @code{org-export-with-tags}
7745 @item @code{:tables}                @tab @code{org-export-with-tables}
7746 @item @code{:table-auto-headline}   @tab @code{org-export-highlight-first-table-line}
7747 @item @code{:style}                 @tab @code{org-export-html-style}
7748 @item @code{:convert-org-links}     @tab @code{org-export-html-link-org-files-as-html}
7749 @item @code{:inline-images}         @tab @code{org-export-html-inline-images}
7750 @item @code{:expand-quoted-html}    @tab @code{org-export-html-expand}
7751 @item @code{:timestamp}             @tab @code{org-export-html-with-timestamp}
7752 @item @code{:publishing-directory}  @tab @code{org-export-publishing-directory}
7753 @item @code{:preamble}              @tab @code{org-export-html-preamble}
7754 @item @code{:postamble}             @tab @code{org-export-html-postamble}
7755 @item @code{:auto-preamble}         @tab @code{org-export-html-auto-preamble}
7756 @item @code{:auto-postamble}        @tab @code{org-export-html-auto-postamble}
7757 @item @code{:author}                @tab @code{user-full-name}
7758 @item @code{:email}                 @tab @code{user-mail-address}
7759 @end multitable
7761 If you use several email addresses, separate them by a semi-column.
7763 Most of the @code{org-export-with-*} variables have the same effect in
7764 both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
7765 @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
7766 La@TeX{} export.
7768 When a property is given a value in @code{org-publish-project-alist},
7769 its setting overrides the value of the corresponding user variable (if
7770 any) during publishing.  Options set within a file (@pxref{Export
7771 options}), however, override everything.
7773 @node Publishing links, Project page index, Publishing options, Configuration
7774 @subsection Links between published files
7775 @cindex links, publishing
7777 To create a link from one Org file to another, you would use
7778 something like @samp{[[file:foo.org][The foo]]} or simply
7779 @samp{file:foo.org.} (@pxref{Hyperlinks}).  Upon publishing this link
7780 becomes a link to @file{foo.html}.  In this way, you can interlink the
7781 pages of your "org web" project and the links will work as expected when
7782 you publish them to HTML.
7784 You may also link to related files, such as images. Provided you are
7785 careful with relative pathnames, and provided you have also configured
7786 @code{org-publish} to upload the related files, these links will work
7787 too. @ref{Complex example} for an example of this usage.
7789 Sometime an Org file to be published may contain links that are
7790 only valid in your production environment, but not in the publishing
7791 location.  In this case, use the property
7793 @multitable @columnfractions 0.4 0.6
7794 @item @code{:link-validation-function}
7795 @tab Function to validate links
7796 @end multitable
7798 @noindent
7799 to define a function for checking link validity.  This function must
7800 accept two arguments, the file name and a directory relative to which
7801 the file name is interpreted in the production environment.  If this
7802 function returns @code{nil}, then the HTML generator will only insert a
7803 description into the HTML file, but no link.  One option for this
7804 function is @code{org-publish-validate-link} which checks if the given
7805 file is part of any project in @code{org-publish-project-alist}.
7807 @node Project page index,  , Publishing links, Configuration
7808 @subsection Project page index
7809 @cindex index, of published pages
7811 The following properties may be used to control publishing of an
7812 index of files or summary page for a given project.
7814 @multitable @columnfractions 0.25 0.75
7815 @item @code{:auto-index}
7816 @tab When non-nil, publish an index during org-publish-current-project or
7817 org-publish-all.
7819 @item @code{:index-filename}
7820 @tab Filename for output of index. Defaults to @file{index.org} (which
7821 becomes @file{index.html}).
7823 @item @code{:index-title}
7824 @tab Title of index page. Defaults to name of file.
7826 @item @code{:index-function}
7827 @tab Plug-in function to use for generation of index.
7828 Defaults to @code{org-publish-org-index}, which generates a plain list
7829 of links to all files in the project.
7830 @end multitable
7832 @node Sample configuration, Triggering publication, Configuration, Publishing
7833 @section Sample configuration
7835 Below we provide two example configurations.  The first one is a simple
7836 project publishing only a set of Org files.  The second example is
7837 more complex, with a multi-component project.
7839 @menu
7840 * Simple example::              One-component publishing
7841 * Complex example::             A multi-component publishing example
7842 @end menu
7844 @node Simple example, Complex example, Sample configuration, Sample configuration
7845 @subsection Example: simple publishing configuration
7847 This example publishes a set of Org files to the @file{public_html}
7848 directory on the local machine.
7850 @lisp
7851 (setq org-publish-project-alist
7852       '(("org"
7853          :base-directory "~/org/"
7854          :publishing-directory "~/public_html"
7855          :section-numbers nil
7856          :table-of-contents nil
7857          :style "<link rel=stylesheet
7858                 href=\"../other/mystyle.css\"
7859                 type=\"text/css\">")))
7860 @end lisp
7862 @node Complex example,  , Simple example, Sample configuration
7863 @subsection Example: complex publishing configuration
7865 This more complicated example publishes an entire website, including
7866 org files converted to HTML, image files, emacs lisp source code, and
7867 style sheets. The publishing-directory is remote and private files are
7868 excluded.
7870 To ensure that links are preserved, care should be taken to replicate
7871 your directory structure on the web server, and to use relative file
7872 paths. For example, if your org files are kept in @file{~/org} and your
7873 publishable images in @file{~/images}, you'd link to an image with
7875 @example
7876 file:../images/myimage.png
7877 @end example
7879 On the web server, the relative path to the image should be the
7880 same. You can accomplish this by setting up an "images" folder in the
7881 right place on the web server, and publishing images to it.
7883 @lisp
7884 (setq org-publish-project-alist
7885       '(("orgfiles"
7886           :base-directory "~/org/"
7887           :base-extension "org"
7888           :publishing-directory "/ssh:user@@host:~/html/notebook/"
7889           :publishing-function org-publish-org-to-html
7890           :exclude "PrivatePage.org"   ;; regexp
7891           :headline-levels 3
7892           :section-numbers nil
7893           :table-of-contents nil
7894           :style "<link rel=stylesheet
7895                   href=\"../other/mystyle.css\" type=\"text/css\">"
7896           :auto-preamble t
7897           :auto-postamble nil)
7899          ("images"
7900           :base-directory "~/images/"
7901           :base-extension "jpg\\|gif\\|png"
7902           :publishing-directory "/ssh:user@@host:~/html/images/"
7903           :publishing-function org-publish-attachment)
7905          ("other"
7906           :base-directory "~/other/"
7907           :base-extension "css\\|el"
7908           :publishing-directory "/ssh:user@@host:~/html/other/"
7909           :publishing-function org-publish-attachment)
7910          ("website" :components ("orgfiles" "images" "other"))))
7911 @end lisp
7913 @node Triggering publication,  , Sample configuration, Publishing
7914 @section Triggering publication
7916 Once org-publish is properly configured, you can publish with the
7917 following functions:
7919 @table @kbd
7920 @item C-c C-e C
7921 Prompt for a specific project and publish all files that belong to it.
7922 @item C-c C-e P
7923 Publish the project containing the current file.
7924 @item C-c C-e F
7925 Publish only the current file.
7926 @item C-c C-e A
7927 Publish all projects.
7928 @end table
7930 Org uses timestamps to track when a file has changed. The above
7931 functions normally only publish changed files. You can override this and
7932 force publishing of all files by giving a prefix argument.
7934 @node Miscellaneous, Extensions, Publishing, Top
7935 @chapter Miscellaneous
7937 @menu
7938 * Completion::                  M-TAB knows what you need
7939 * Customization::               Adapting Org to your taste
7940 * In-buffer settings::          Overview of the #+KEYWORDS
7941 * The very busy C-c C-c key::   When in doubt, press C-c C-c
7942 * Clean view::                  Getting rid of leading stars in the outline
7943 * TTY keys::                    Using Org on a tty
7944 * Interaction::                 Other Emacs packages
7945 * Bugs::                        Things which do not work perfectly
7946 @end menu
7948 @node Completion, Customization, Miscellaneous, Miscellaneous
7949 @section Completion
7950 @cindex completion, of @TeX{} symbols
7951 @cindex completion, of TODO keywords
7952 @cindex completion, of dictionary words
7953 @cindex completion, of option keywords
7954 @cindex completion, of tags
7955 @cindex completion, of property keys
7956 @cindex completion, of link abbreviations
7957 @cindex @TeX{} symbol completion
7958 @cindex TODO keywords completion
7959 @cindex dictionary word completion
7960 @cindex option keyword completion
7961 @cindex tag completion
7962 @cindex link abbreviations, completion of
7964 Org supports in-buffer completion.  This type of completion does
7965 not make use of the minibuffer.  You simply type a few letters into
7966 the buffer and use the key to complete text right there.
7968 @table @kbd
7969 @kindex M-@key{TAB}
7970 @item M-@key{TAB}
7971 Complete word at point
7972 @itemize @bullet
7973 @item
7974 At the beginning of a headline, complete TODO keywords.
7975 @item
7976 After @samp{\}, complete @TeX{} symbols supported by the exporter.
7977 @item
7978 After @samp{*}, complete headlines in the current buffer so that they
7979 can be used in search links like @samp{[[*find this headline]]}.
7980 @item
7981 After @samp{:} in a headline, complete tags.  The list of tags is taken
7982 from the variable @code{org-tag-alist} (possibly set through the
7983 @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
7984 dynamically from all tags used in the current buffer.
7985 @item
7986 After @samp{:} and not in a headline, complete property keys.  The list
7987 of keys is constructed dynamically from all keys used in the current
7988 buffer.
7989 @item
7990 After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
7991 @item
7992 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
7993 @samp{OPTIONS} which set file-specific options for Org mode.  When the
7994 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
7995 will insert example settings for this keyword.
7996 @item
7997 In the line after @samp{#+STARTUP: }, complete startup keywords,
7998 i.e. valid keys for this line.
7999 @item
8000 Elsewhere, complete dictionary words using Ispell.
8001 @end itemize
8002 @end table
8004 @node Customization, In-buffer settings, Completion, Miscellaneous
8005 @section Customization
8006 @cindex customization
8007 @cindex options, for customization
8008 @cindex variables, for customization
8010 There are more than 180 variables that can be used to customize
8011 Org.  For the sake of compactness of the manual, I am not
8012 describing the variables here.  A structured overview of customization
8013 variables is available with @kbd{M-x org-customize}.  Or select
8014 @code{Browse Org Group} from the @code{Org->Customization} menu.  Many
8015 settings can also be activated on a per-file basis, by putting special
8016 lines into the buffer (@pxref{In-buffer settings}).
8018 @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
8019 @section Summary of in-buffer settings
8020 @cindex in-buffer settings
8021 @cindex special keywords
8023 Org mode uses special lines in the buffer to define settings on a
8024 per-file basis.  These lines start with a @samp{#+} followed by a
8025 keyword, a colon, and then individual words defining a setting.  Several
8026 setting words can be in the same line, but you can also have multiple
8027 lines for the keyword.  While these settings are described throughout
8028 the manual, here is a summary.  After changing any of those lines in the
8029 buffer, press @kbd{C-c C-c} with the cursor still in the line to
8030 activate the changes immediately.  Otherwise they become effective only
8031 when the file is visited again in a new Emacs session.
8033 @table @kbd
8034 @item #+ARCHIVE: %s_done::
8035 This line sets the archive location for the agenda file.  It applies for
8036 all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
8037 of the file.  The first such line also applies to any entries before it.
8038 The corresponding variable is @code{org-archive-location}.
8039 @item #+CATEGORY:
8040 This line sets the category for the agenda file.  The category applies
8041 for all subsequent lines until the next @samp{#+CATEGORY} line, or the
8042 end of the file.  The first such line also applies to any entries before it.
8043 @item #+COLUMNS: %25ITEM .....
8044 Set the default format for columns view.  This format applies when
8045 columns view is invoked in location where no @code{COLUMNS} property
8046 applies.
8047 @item #+CONSTANTS: name1=value1 ...
8048 Set file-local values for constants to be used in table formulas.  This
8049 line set the local variable @code{org-table-formula-constants-local}.
8050 The global version of this variable is
8051 @code{org-table-formula-constants}.
8052 @item #+FILETAGS: :tag1:tag2:tag3:
8053 Set tags that can be inherited by any entry in the file, including the
8054 top-level entries.
8055 @item #+DRAWERS: NAME1 .....
8056 Set the file-local set of drawers.  The corresponding global variable is
8057 @code{org-drawers}.
8058 @item #+LINK:  linkword replace
8059 These lines (several are allowed) specify link abbreviations.
8060 @xref{Link abbreviations}.  The corresponding variable is
8061 @code{org-link-abbrev-alist}.
8062 @item #+PRIORITIES: highest lowest default
8063 This line sets the limits and the default for the priorities.  All three
8064 must be either letters A-Z or numbers 0-9.  The highest priority must
8065 have a lower ASCII number that the lowest priority.
8066 @item #+PROPERTY: Property_Name Value
8067 This line sets a default inheritance value for entries in the current
8068 buffer, most useful for specifying the allowed values of a property.
8069 @item #+SETUPFILE: file
8070 This line defines a file that holds more in-buffer setup.  Normally this is
8071 entirely ignored.  Only when the buffer is parsed for option-setting lines
8072 (i.e. when starting Org mode for a file, when pressing @kbd{C-c C-c} in a
8073 settings line, or when exporting), then the contents of this file are parsed
8074 as if they had been included in the buffer.  In particlar, the file can be
8075 any other Org mode file with internal setup.  You can visit the file the
8076 cursor is in the line with @kbd{C-c '}.
8077 @item #+STARTUP:
8078 This line sets options to be used at startup of Org mode, when an
8079 Org file is being visited.  The first set of options deals with the
8080 initial visibility of the outline tree.  The corresponding variable for
8081 global default settings is @code{org-startup-folded}, with a default
8082 value @code{t}, which means @code{overview}.
8083 @cindex @code{overview}, STARTUP keyword
8084 @cindex @code{content}, STARTUP keyword
8085 @cindex @code{showall}, STARTUP keyword
8086 @example
8087 overview   @r{top-level headlines only}
8088 content    @r{all headlines}
8089 showall    @r{no folding at all, show everything}
8090 @end example
8091 Then there are options for aligning tables upon visiting a file.  This
8092 is useful in files containing narrowed table columns.  The corresponding
8093 variable is @code{org-startup-align-all-tables}, with a default value
8094 @code{nil}.
8095 @cindex @code{align}, STARTUP keyword
8096 @cindex @code{noalign}, STARTUP keyword
8097 @example
8098 align      @r{align all tables}
8099 noalign    @r{don't align tables on startup}
8100 @end example
8101 Logging closing and reinstating TODO items, and clock intervals
8102 (variables @code{org-log-done}, @code{org-log-note-clock-out}, and
8103 @code{org-log-repeat}) can be configured using these options.
8104 @cindex @code{logdone}, STARTUP keyword
8105 @cindex @code{lognotedone}, STARTUP keyword
8106 @cindex @code{nologdone}, STARTUP keyword
8107 @cindex @code{lognoteclock-out}, STARTUP keyword
8108 @cindex @code{nolognoteclock-out}, STARTUP keyword
8109 @cindex @code{logrepeat}, STARTUP keyword
8110 @cindex @code{lognoterepeat}, STARTUP keyword
8111 @cindex @code{nologrepeat}, STARTUP keyword
8112 @example
8113 logdone            @r{record a timestamp when an item is marked DONE}
8114 lognotedone        @r{record timestamp and a note when DONE}
8115 nologdone          @r{don't record when items are marked DONE}
8116 logrepeat          @r{record a time when reinstating a repeating item}
8117 lognoterepeat      @r{record a note when reinstating a repeating item}
8118 nologrepeat        @r{do not record when reinstating repeating item}
8119 lognoteclock-out   @r{record a note when clocking out}
8120 nolognoteclock-out @r{don't record a note when clocking out}
8121 @end example
8122 Here are the options for hiding leading stars in outline headings, and for
8123 indenting outlines.  The corresponding variables are
8124 @code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with a
8125 default setting @code{nil} (meaning @code{showstars} and @code{oddeven}).
8126 @cindex @code{hidestars}, STARTUP keyword
8127 @cindex @code{showstars}, STARTUP keyword
8128 @cindex @code{odd}, STARTUP keyword
8129 @cindex @code{even}, STARTUP keyword
8130 @example
8131 hidestars  @r{make all but one of the stars starting a headline invisible.}
8132 showstars  @r{show all stars starting a headline}
8133 indent     @r{virtual indentation according to outline level}
8134 noindent   @r{no virtual indentation according to outline level}
8135 odd        @r{allow only odd outline levels (1,3,...)}
8136 oddeven    @r{allow all outline levels}
8137 @end example
8138 To turn on custom format overlays over time stamps (variables
8139 @code{org-put-time-stamp-overlays} and
8140 @code{org-time-stamp-overlay-formats}), use
8141 @cindex @code{customtime}, STARTUP keyword
8142 @example
8143 customtime @r{overlay custom time format}
8144 @end example
8145 The following options influence the table spreadsheet (variable
8146 @code{constants-unit-system}).
8147 @cindex @code{constcgs}, STARTUP keyword
8148 @cindex @code{constSI}, STARTUP keyword
8149 @example
8150 constcgs   @r{@file{constants.el} should use the c-g-s unit system}
8151 constSI    @r{@file{constants.el} should use the SI unit system}
8152 @end example
8153 @item #+TAGS:  TAG1(c1) TAG2(c2)
8154 These lines (several such lines are allowed) specify the valid tags in
8155 this file, and (potentially) the corresponding @emph{fast tag selection}
8156 keys.  The corresponding variable is @code{org-tag-alist}.
8157 @item #+TBLFM:
8158 This line contains the formulas for the table directly above the line.
8159 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:
8160 These lines provide settings for exporting files.  For more details see
8161 @ref{Export options}.
8162 @item #+SEQ_TODO:   #+TYP_TODO:
8163 These lines set the TODO keywords and their interpretation in the
8164 current file.  The corresponding variables are @code{org-todo-keywords}
8165 and @code{org-todo-interpretation}.
8166 @end table
8168 @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
8169 @section The very busy C-c C-c key
8170 @kindex C-c C-c
8171 @cindex C-c C-c, overview
8173 The key @kbd{C-c C-c} has many purposes in Org, which are all
8174 mentioned scattered throughout this manual.  One specific function of
8175 this key is to add @emph{tags} to a headline (@pxref{Tags}).  In many
8176 other circumstances it means something like @emph{Hey Org, look
8177 here and update according to what you see here}.  Here is a summary of
8178 what this means in different contexts.
8180 @itemize @minus
8181 @item
8182 If there are highlights in the buffer from the creation of a sparse
8183 tree, or from clock display, remove these highlights.
8184 @item
8185 If the cursor is in one of the special @code{#+KEYWORD} lines, this
8186 triggers scanning the buffer for these lines and updating the
8187 information.
8188 @item
8189 If the cursor is inside a table, realign the table.  This command
8190 works even if the automatic table editor has been turned off.
8191 @item
8192 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
8193 the entire table.
8194 @item
8195 If the cursor is inside a table created by the @file{table.el} package,
8196 activate that table.
8197 @item
8198 If the current buffer is a remember buffer, close the note and file it.
8199 With a prefix argument, file it, without further interaction, to the
8200 default location.
8201 @item
8202 If the cursor is on a @code{<<<target>>>}, update radio targets and
8203 corresponding links in this buffer.
8204 @item
8205 If the cursor is in a property line or at the start or end of a property
8206 drawer, offer property commands.
8207 @item
8208 If the cursor is in a plain list item with a checkbox, toggle the status
8209 of the checkbox.
8210 @item
8211 If the cursor is on a numbered item in a plain list, renumber the
8212 ordered list.
8213 @item
8214 If the cursor is on the @code{#+BEGIN} line of a dynamical block, the
8215 block is updated.
8216 @end itemize
8218 @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
8219 @section A cleaner outline view
8220 @cindex hiding leading stars
8221 @cindex dynamic indentation
8222 @cindex odd-levels-only outlines
8223 @cindex clean outline view
8225 Some people find it noisy and distracting that the Org headlines are starting
8226 with a potentially large number of stars, and that text below the headlines
8227 is not indented.  This is not really a problem when you are writing a book
8228 where the outline headings are really section headlines.  However, in a more
8229 list-oriented outline, it is clear that an indented structure is a lot
8230 cleaner, as can be seen by comparing the two columns in the following
8231 example: 
8233 @example
8234 @group
8235 * Top level headline             |    * Top level headline
8236 ** Second level                  |      * Second level
8237 *** 3rd level                    |        * 3rd level
8238 some text                        |          some text
8239 *** 3rd level                    |        * 3rd level
8240 more text                        |          more text
8241 * Another top level headline     |    * Another top level headline
8242 @end group
8243 @end example
8245 @noindent
8246 It is non-trivial to make such a look work in Emacs, but Org contains three
8247 separate features that, combined, achieve just that.
8249 @enumerate
8250 @item 
8251 @emph{Indentation of text below headlines}@*
8252 You may indent text below each headline to make the left boundary line up
8253 with the headline, like
8255 @example
8256 *** 3rd level
8257     more text, now indented
8258 @end example
8260 A good way to get this indentation is by hand, and Org supports this with
8261 paragraph filling, line wrapping, and structure editing@footnote{See also the
8262 variable @code{org-adapt-indentation}.} preserving or adapting the
8263 indentation appropriate.  A different approach would be to have a way to
8264 automatically indent lines according to outline structure by adding overlays
8265 or text properties.  But I have not yet found a robust and efficient way to
8266 do this in large files.
8268 @item
8269 @emph{Hiding leading stars}@* You can modify the display in such a way that
8270 all leading stars become invisible.  To do this in a global way, configure
8271 the variable @code{org-hide-leading-stars} or change this on a per-file basis
8272 with
8274 @example
8275 #+STARTUP: showstars
8276 #+STARTUP: hidestars
8277 @end example
8279 With hidden stars, the tree becomes:
8281 @example
8282 @group
8283 * Top level headline
8284  * Second level
8285   * 3rd level
8286   ...
8287 @end group
8288 @end example
8290 @noindent
8291 Note that the leading stars are not truly replaced by whitespace, they
8292 are only fontified with the face @code{org-hide} that uses the
8293 background color as font color.  If you are not using either white or
8294 black background, you may have to customize this face to get the wanted
8295 effect.  Another possibility is to set this font such that the extra
8296 stars are @i{almost} invisible, for example using the color
8297 @code{grey90} on a white background.
8299 @item
8300 Things become cleaner still if you skip all the even levels and use only odd
8301 levels 1, 3, 5..., effectively adding two stars to go from one outline level
8302 to the next.  In this way we get the outline view shown at the beginning of
8303 this section.  In order to make the structure editing and export commands
8304 handle this convention correctly, configure the variable
8305 @code{org-odd-levels-only}, or set this on a per-file basis with one of the
8306 following lines:
8308 @example
8309 #+STARTUP: odd
8310 #+STARTUP: oddeven
8311 @end example
8313 You can convert an Org file from single-star-per-level to the
8314 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
8315 RET} in that file.  The reverse operation is @kbd{M-x
8316 org-convert-to-oddeven-levels}.
8317 @end enumerate
8319 @node TTY keys, Interaction, Clean view, Miscellaneous
8320 @section Using Org on a tty
8321 @cindex tty key bindings
8323 Because Org contains a large number of commands, by default much of
8324 Org's core commands are bound to keys that are generally not
8325 accessible on a tty, such as the cursor keys (@key{left}, @key{right},
8326 @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
8327 together with modifiers like @key{Meta} and/or @key{Shift}.  To access
8328 these commands on a tty when special keys are unavailable, the following
8329 alternative bindings can be used.  The tty bindings below will likely be
8330 more cumbersome; you may find for some of the bindings below that a
8331 customized work-around suits you better.  For example, changing a time
8332 stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
8333 tty you would rather use @kbd{C-c .} to re-insert the timestamp.
8335 @multitable @columnfractions 0.15 0.2 0.2
8336 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
8337 @item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
8338 @item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
8339 @item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
8340 @item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
8341 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
8342 @item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
8343 @item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
8344 @item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
8345 @item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
8346 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
8347 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
8348 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
8349 @item @kbd{S-@key{left}}    @tab @kbd{C-c @key{left}}      @tab
8350 @item @kbd{S-@key{right}}   @tab @kbd{C-c @key{right}}     @tab
8351 @item @kbd{S-@key{up}}      @tab @kbd{C-c @key{up}}        @tab
8352 @item @kbd{S-@key{down}}    @tab @kbd{C-c @key{down}}      @tab
8353 @item @kbd{C-S-@key{left}}  @tab @kbd{C-c C-x @key{left}}  @tab
8354 @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
8355 @end multitable
8357 @node Interaction, Bugs, TTY keys, Miscellaneous
8358 @section Interaction with other packages
8359 @cindex packages, interaction with other
8360 Org lives in the world of GNU Emacs and interacts in various ways
8361 with other code out there.
8363 @menu
8364 * Cooperation::                 Packages Org cooperates with
8365 * Conflicts::                   Packages that lead to conflicts
8366 @end menu
8368 @node Cooperation, Conflicts, Interaction, Interaction
8369 @subsection Packages that Org cooperates with
8371 @table @asis
8372 @cindex @file{calc.el}
8373 @item @file{calc.el} by Dave Gillespie
8374 Org uses the Calc package for implementing spreadsheet
8375 functionality in its tables (@pxref{The spreadsheet}).  Org
8376 checks for the availability of Calc by looking for the function
8377 @code{calc-eval} which should be autoloaded in your setup if Calc has
8378 been installed properly.  As of Emacs 22, Calc is part of the Emacs
8379 distribution.  Another possibility for interaction between the two
8380 packages is using Calc for embedded calculations. @xref{Embedded Mode,
8381 , Embedded Mode, Calc, GNU Emacs Calc Manual}.
8382 @cindex @file{constants.el}
8383 @item @file{constants.el} by Carsten Dominik
8384 In a table formula (@pxref{The spreadsheet}), it is possible to use
8385 names for natural constants or units.  Instead of defining your own
8386 constants in the variable @code{org-table-formula-constants}, install
8387 the @file{constants} package which defines a large number of constants
8388 and units, and lets you use unit prefixes like @samp{M} for
8389 @samp{Mega} etc.  You will need version 2.0 of this package, available
8390 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
8391 the function @code{constants-get}, which has to be autoloaded in your
8392 setup.  See the installation instructions in the file
8393 @file{constants.el}.
8394 @item @file{cdlatex.el} by Carsten Dominik
8395 @cindex @file{cdlatex.el}
8396 Org mode can make use of the CDLaTeX package to efficiently enter
8397 La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
8398 @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
8399 @cindex @file{imenu.el}
8400 Imenu allows menu access to an index of items in a file.  Org mode
8401 supports Imenu - all you need to do to get the index is the following:
8402 @lisp
8403 (add-hook 'org-mode-hook
8404           (lambda () (imenu-add-to-menubar "Imenu")))
8405 @end lisp
8406 By default the index is two levels deep - you can modify the depth using
8407 the option @code{org-imenu-depth}.
8408 @item @file{remember.el} by John Wiegley
8409 @cindex @file{remember.el}
8410 Org cooperates with remember, see @ref{Remember}.
8411 @file{Remember.el} is not part of Emacs, find it on the web.
8412 @item @file{speedbar.el} by Eric M. Ludlam
8413 @cindex @file{speedbar.el}
8414 Speedbar is a package that creates a special frame displaying files and
8415 index items in files.  Org mode supports Speedbar and allows you to
8416 drill into Org files directly from the Speedbar.  It also allows to
8417 restrict the scope of agenda commands to a file or a subtree by using
8418 the command @kbd{<} in the Speedbar frame.
8419 @cindex @file{table.el}
8420 @item @file{table.el} by Takaaki Ota
8421 @kindex C-c C-c
8422 @cindex table editor, @file{table.el}
8423 @cindex @file{table.el}
8425 Complex ASCII tables with automatic line wrapping, column- and
8426 row-spanning, and alignment can be created using the Emacs table
8427 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
8428 and also part of Emacs 22).
8429 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
8430 will call @command{table-recognize-table} and move the cursor into the
8431 table.  Inside a table, the keymap of Org mode is inactive.  In order
8432 to execute Org mode-related commands, leave the table.
8434 @table @kbd
8435 @kindex C-c C-c
8436 @item C-c C-c
8437 Recognize @file{table.el} table.  Works when the cursor is in a
8438 table.el table.
8440 @kindex C-c ~
8441 @item C-c ~
8442 Insert a table.el table.  If there is already a table at point, this
8443 command converts it between the table.el format and the Org mode
8444 format.  See the documentation string of the command
8445 @code{org-convert-table} for the restrictions under which this is
8446 possible.
8447 @end table
8448 @file{table.el} is part of Emacs 22.
8449 @cindex @file{footnote.el}
8450 @item @file{footnote.el} by Steven L. Baur
8451 Org mode recognizes numerical footnotes as provided by this package
8452 (@pxref{Footnotes}).
8453 @end table
8455 @node Conflicts,  , Cooperation, Interaction
8456 @subsection Packages that lead to conflicts with Org mode
8458 @table @asis
8460 @cindex @file{allout.el}
8461 @item @file{allout.el} by Ken Manheimer
8462 Startup of Org may fail with the error message
8463 @code{(wrong-type-argument keymapp nil)} when there is an outdated
8464 version @file{allout.el} on the load path, for example the version
8465 distributed with Emacs 21.x.  Upgrade to Emacs 22 and this problem will
8466 disappear.  If for some reason you cannot do this, make sure that org.el
8467 is loaded @emph{before} @file{allout.el}, for example by putting
8468 @code{(require 'org)} early enough into your @file{.emacs} file.
8470 @cindex @file{CUA.el}
8471 @item @file{CUA.el} by Kim. F. Storm
8472 Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by
8473 CUA mode (as well as pc-select-mode and s-region-mode) to select and
8474 extend the region.  If you want to use one of these packages along with
8475 Org, configure the variable @code{org-replace-disputed-keys}.  When
8476 set, Org will move the following key bindings in Org files, and
8477 in the agenda buffer (but not during date selection).
8479 @example
8480 S-UP    -> M-p             S-DOWN  -> M-n
8481 S-LEFT  -> M--             S-RIGHT -> M-+
8482 @end example
8484 Yes, these are unfortunately more difficult to remember.  If you want
8485 to have other replacement keys, look at the variable
8486 @code{org-disputed-keys}.
8487 @item @file{windmove.el} by Hovav Shacham
8488 @cindex @file{windmove.el}
8489 Also this package uses the @kbd{S-<cursor>} keys, so everything written
8490 in the paragraph above about CUA mode also applies here.
8492 @cindex @file{footnote.el}
8493 @item @file{footnote.el} by Steven L. Baur
8494 Org supports the syntax of the footnote package, but only the
8495 numerical footnote markers.  Also, the default key for footnote
8496 commands, @kbd{C-c !} is already used by Org.  You could use the
8497 variable @code{footnote-prefix} to switch footnotes commands to another
8498 key.  Or, you could use @code{org-replace-disputed-keys} and
8499 @code{org-disputed-keys} to change the settings in Org.
8501 @end table
8504 @node Bugs,  , Interaction, Miscellaneous
8505 @section Bugs
8506 @cindex bugs
8508 Here is a list of things that should work differently, but which I
8509 have found too hard to fix.
8511 @itemize @bullet
8512 @item
8513 If a table field starts with a link, and if the corresponding table
8514 column is narrowed (@pxref{Narrow columns}) to a width too small to
8515 display the link, the field would look entirely empty even though it is
8516 not.  To prevent this, Org throws an error.  The work-around is to
8517 make the column wide enough to fit the link, or to add some text (at
8518 least 2 characters) before the link in the same field.
8519 @item
8520 Narrowing table columns does not work on XEmacs, because the
8521 @code{format} function does not transport text properties.
8522 @item
8523 Text in an entry protected with the @samp{QUOTE} keyword should not
8524 autowrap.
8525 @item
8526 When the application called by @kbd{C-c C-o} to open a file link fails
8527 (for example because the application does not exist or refuses to open
8528 the file), it does so silently.  No error message is displayed.
8529 @item
8530 Recalculating a table line applies the formulas from left to right.
8531 If a formula uses @emph{calculated} fields further down the row,
8532 multiple recalculation may be needed to get all fields consistent.  You
8533 may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
8534 recalculate until convergence.
8535 @item
8536 The exporters work well, but could be made more efficient.
8537 @end itemize
8540 @node Extensions, Hacking, Miscellaneous, Top
8541 @appendix Extensions
8543 This appendix lists the extension modules that have been written for Org.
8544 Many of these extensions live in the @file{contrib} directory of the Org
8545 distribution, others are available somewhere on the web.
8547 @menu
8548 * Extensions in the contrib directory::  These come with the Org distro
8549 * Other extensions::            These you have to find on the web.
8550 @end menu
8552 @node Extensions in the contrib directory, Other extensions, Extensions, Extensions
8553 @section Extensions in the @file{contrib} directory
8555 @table @asis
8556 @item @file{org-annotate-file.el} by @i{Philip Jackson}
8557       Annotate a file with org syntax, in a separate file, with links back to
8558       the annotated file.
8559 @item @file{org-annotation-helper.el} by @i{Bastien Guerry and Daniel E. German} 
8560       Call @i{remember} directly from Firefox/Opera, or from Adobe Reader.
8561       When activating a special link or bookmark, Emacs receives a trigger to
8562       create a note with a link back to the website.  Requires some setup, a
8563       detailes description is in
8564       @file{contrib/packages/org-annotation-helper}.
8565 @item @file{org-bookmark.el} by @i{Tokuya Kameshima}
8566       Support for links to Emacs bookmarks.
8567 @item @file{org-depend.el} by @i{Carsten Dominik}
8568       TODO dependencies for Org-mode.  Make TODO state changes in one entry
8569       trigger changes in another, or be blocked by the state of another
8570       entry.  Also, easily create chains of TODO items with exactly one
8571       active item at any time.
8572 @item @file{org-elisp-symbol.el} by @i{Bastien Guerry}
8573       Org links to emacs-lisp symbols.  This can create annotated links that
8574       exactly point to the definition location of a variable of function.
8575 @item @file{org-eval.el} by @i{Carsten Dominik}
8576       The @code{<lisp>} tag, adapted from Emacs Wiki and Emacs Muse, allows
8577       to include text in a document that is the result of evaluating some
8578       code.  Other scripting languages like @code{perl} can be supported with
8579       this package as well.
8580 @item @file{org-expiry.el} by @i{Bastien Guerry}
8581       Expiry mechanism for Org entries.
8582 @item @file{org-indent.el} by @i{Carsten Dominik}
8583       Dynamic indentation of Org outlines.  The plan is to indent an outline
8584       according to level, but so far this is too hard for a proper and stable
8585       implementation.  Still, it works somewhat.
8586 @item @file{org-interactive-query.el} by @i{Christopher League}
8587       Interactive modification of tags queries.  After running a general
8588       query in Org, this package allows to narrow down the results by adding
8589       more tags or keywords.
8590 @item @file{org-mairix.el} by @i{Georg C. F. Greve}
8591       Hook mairix search into Org for different MUAs.
8592 @item @file{org-man.el} by @i{Carsten Dominik}
8593       Support for links to manpages in Org-mode.
8594 @item @file{org-mtags.el} by @i{Carsten Dominik}
8595       Support for some Muse-like tags in Org-mode.  This package allows you
8596       to write @code{<example>} and @code{<src>} and other syntax copied from
8597       Emacs Muse, right inside an Org file.  The goal here is to make it easy
8598       to publish the same file using either org-publish or Muse.
8599 @item @file{org-panel.el} by @i{Lennard Borgman}
8600       Simplified and display-aided access to some Org commands.
8601 @item @file{org-registry.el} by @i{Bastien Guerry}
8602       A registry for Org links, to find out from where links point to a given
8603       file or location.
8604 @item @file{org2rem.el} by @i{Bastien Guerry}
8605       Convert org appointments into reminders for the @file{remind} program.
8606 @item @file{org-screen.el} by @i{Andrew Hyatt}
8607       Visit screen sessions through Org-mode links.
8608 @item @file{org-toc.el} by @i{Bastien Guerry}
8609       Table of contents in a separate buffer, with fast access to sections
8610       and easy visibility cycling.
8611 @item @file{orgtbl-sqlinsert.el} by @i{Jason Riedy}
8612       Convert Org-mode tables to SQL insertions.  Documentation for this can
8613       be found on the Worg pages.
8614 @end table
8617 @node Other extensions,  , Extensions in the contrib directory, Extensions
8618 @section Other extensions
8620 @i{TO BE DONE}
8622 @node Hacking, History and Acknowledgments, Extensions, Top
8623 @appendix Hacking
8625 This appendix covers some aspects where users can extend the functionality of
8626 Org.
8628 @menu
8629 * Adding hyperlink types::      New custom link types
8630 * Tables in arbitrary syntax::  Orgtbl for LaTeX and other programs
8631 * Dynamic blocks::              Automatically filled blocks
8632 * Special agenda views::        Customized views
8633 * Using the property API::      Writing programs that use entry properties
8634 * Using the mapping API::       Mapping over all or selected entries
8635 @end menu
8637 @node Adding hyperlink types, Tables in arbitrary syntax, Hacking, Hacking
8638 @section Adding hyperlink types
8639 @cindex hyperlinks, adding new types
8641 Org has a large number of hyperlink types built-in
8642 (@pxref{Hyperlinks}).  If you would like to add new link types, it
8643 provides an interface for doing so.  Lets look at an example file
8644 @file{org-man.el} that will add support for creating links like
8645 @samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
8646 emacs:
8648 @lisp
8649 ;;; org-man.el - Support for links to manpages in Org
8651 (require 'org)
8653 (org-add-link-type "man" 'org-man-open)
8654 (add-hook 'org-store-link-functions 'org-man-store-link)
8656 (defcustom org-man-command 'man
8657   "The Emacs command to be used to display a man page."
8658   :group 'org-link
8659   :type '(choice (const man) (const woman)))
8661 (defun org-man-open (path)
8662   "Visit the manpage on PATH.
8663 PATH should be a topic that can be thrown at the man command."
8664   (funcall org-man-command path))
8666 (defun org-man-store-link ()
8667   "Store a link to a manpage."
8668   (when (memq major-mode '(Man-mode woman-mode))
8669     ;; This is a man page, we do make this link
8670     (let* ((page (org-man-get-page-name))
8671            (link (concat "man:" page))
8672            (description (format "Manpage for %s" page)))
8673       (org-store-link-props
8674        :type "man"
8675        :link link
8676        :description description))))
8678 (defun org-man-get-page-name ()
8679   "Extract the page name from the buffer name."
8680   ;; This works for both `Man-mode' and `woman-mode'.
8681   (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
8682       (match-string 1 (buffer-name))
8683     (error "Cannot create link to this man page")))
8685 (provide 'org-man)
8687 ;;; org-man.el ends here
8688 @end lisp
8690 @noindent
8691 You would activate this new link type in @file{.emacs} with
8693 @lisp
8694 (require 'org-man)
8695 @end lisp
8697 @noindent
8698 Lets go through the file and see what it does.
8699 @enumerate
8700 @item
8701 It does @code{(require 'org)} to make sure that @file{org.el} has been
8702 loaded.
8703 @item
8704 The next line calls @code{org-add-link-type} to define a new link type
8705 with prefix @samp{man}.  The call also contains the name of a function
8706 that will be called to follow such a link.
8707 @item
8708 The next line adds a function to @code{org-store-link-functions}, in
8709 order to allow the command @kbd{C-c l} to record a useful link in a
8710 buffer displaying a man page.
8711 @end enumerate
8713 The rest of the file defines the necessary variables and functions.
8714 First there is a customization variable that determines which emacs
8715 command should be used to display man pages.  There are two options,
8716 @code{man} and @code{woman}.  Then the function to follow a link is
8717 defined.  It gets the link path as an argument - in this case the link
8718 path is just a topic for the manual command.  The function calls the
8719 value of @code{org-man-command} to display the man page.
8721 Finally the function @code{org-man-store-link} is defined.  When you try
8722 to store a link with @kbd{C-c l}, also this function will be called to
8723 try to make a link.  The function must first decide if it is supposed to
8724 create the link for this buffer type, we do this by checking the value
8725 of the variable @code{major-mode}.  If not, the function must exit and
8726 return the value @code{nil}.  If yes, the link is created by getting the
8727 manual topic from the buffer name and prefixing it with the string
8728 @samp{man:}.  Then it must call the command @code{org-store-link-props}
8729 and set the @code{:type} and @code{:link} properties.  Optionally you
8730 can also set the @code{:description} property to provide a default for
8731 the link description when the link is later inserted into an Org
8732 buffer with @kbd{C-c C-l}.
8734 @node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Hacking
8735 @section Tables and lists in arbitrary syntax
8736 @cindex tables, in other modes
8737 @cindex lists, in other modes
8738 @cindex Orgtbl mode
8740 Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
8741 frequent feature request has been to make it work with native tables in
8742 specific languages, for example La@TeX{}.  However, this is extremely
8743 hard to do in a general way, would lead to a customization nightmare,
8744 and would take away much of the simplicity of the Orgtbl mode table
8745 editor.
8748 This appendix describes a different approach.  We keep the Orgtbl mode
8749 table in its native format (the @i{source table}), and use a custom
8750 function to @i{translate} the table to the correct syntax, and to
8751 @i{install} it in the right location (the @i{target table}).  This puts
8752 the burden of writing conversion functions on the user, but it allows
8753 for a very flexible system.
8755 Bastien added the ability to do the same with lists.  You can use Org's
8756 facilities to edit and structure lists by turning @code{orgstruct-mode}
8757 on, then locally exporting such lists in another format (HTML, La@TeX{}
8758 or Texinfo.)
8761 @menu
8762 * Radio tables::                Sending and receiving
8763 * A LaTeX example::             Step by step, almost a tutorial
8764 * Translator functions::        Copy and modify
8765 * Radio lists::                 Doing the same for lists
8766 @end menu
8768 @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
8769 @subsection Radio tables
8770 @cindex radio tables
8772 To define the location of the target table, you first need to create two
8773 lines that are comments in the current mode, but contain magic words for
8774 Orgtbl mode to find.  Orgtbl mode will insert the translated table
8775 between these lines, replacing whatever was there before.  For example:
8777 @example
8778 /* BEGIN RECEIVE ORGTBL table_name */
8779 /* END RECEIVE ORGTBL table_name */
8780 @end example
8782 @noindent
8783 Just above the source table, we put a special line that tells
8784 Orgtbl mode how to translate this table and where to install it.  For
8785 example:
8786 @example
8787 #+ORGTBL: SEND table_name translation_function arguments....
8788 @end example
8790 @noindent
8791 @code{table_name} is the reference name for the table that is also used
8792 in the receiver lines. @code{translation_function} is the Lisp function
8793 that does the translation.  Furthermore, the line can contain a list of
8794 arguments (alternating key and value) at the end.  The arguments will be
8795 passed as a property list to the translation function for
8796 interpretation.  A few standard parameters are already recognized and
8797 acted upon before the translation function is called:
8799 @table @code
8800 @item :skip N
8801 Skip the first N lines of the table.  Hlines do count as separate lines for
8802 this parameter!
8804 @item :skipcols (n1 n2 ...)
8805 List of columns that should be skipped.  If the table has a column with
8806 calculation marks, that column is automatically discarded as well.
8807 Please note that the translator function sees the table @emph{after} the
8808 removal of these columns, the function never knows that there have been
8809 additional columns.
8810 @end table
8812 @noindent
8813 The one problem remaining is how to keep the source table in the buffer
8814 without disturbing the normal workings of the file, for example during
8815 compilation of a C file or processing of a La@TeX{} file.  There are a
8816 number of different solutions:
8818 @itemize @bullet
8819 @item
8820 The table could be placed in a block comment if that is supported by the
8821 language.  For example, in C mode you could wrap the table between
8822 @samp{/*} and @samp{*/} lines.
8823 @item
8824 Sometimes it is possible to put the table after some kind of @i{END}
8825 statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
8826 in La@TeX{}.
8827 @item
8828 You can just comment the table line by line whenever you want to process
8829 the file, and uncomment it whenever you need to edit the table.  This
8830 only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
8831 make this comment-toggling very easy, in particular if you bind it to a
8832 key.
8833 @end itemize
8835 @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
8836 @subsection A LaTeX example of radio tables
8837 @cindex LaTeX, and Orgtbl mode
8839 The best way to wrap the source table in La@TeX{} is to use the
8840 @code{comment} environment provided by @file{comment.sty}.  It has to be
8841 activated by placing @code{\usepackage@{comment@}} into the document
8842 header.  Orgtbl mode can insert a radio table skeleton@footnote{By
8843 default this works only for La@TeX{}, HTML, and Texinfo.  Configure the
8844 variable @code{orgtbl-radio-tables} to install templates for other
8845 modes.}  with the command @kbd{M-x orgtbl-insert-radio-table}.  You will
8846 be prompted for a table name, lets say we use @samp{salesfigures}.  You
8847 will then get the following template:
8849 @cindex #+ORGTBL: SEND
8850 @example
8851 % BEGIN RECEIVE ORGTBL salesfigures
8852 % END RECEIVE ORGTBL salesfigures
8853 \begin@{comment@}
8854 #+ORGTBL: SEND salesfigures orgtbl-to-latex
8855 | | |
8856 \end@{comment@}
8857 @end example
8859 @noindent
8860 The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
8861 @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
8862 into the receiver location with name @code{salesfigures}.  You may now
8863 fill in the table, feel free to use the spreadsheet features@footnote{If
8864 the @samp{#+TBLFM} line contains an odd number of dollar characters,
8865 this may cause problems with font-lock in LaTeX mode.  As shown in the
8866 example you can fix this by adding an extra line inside the
8867 @code{comment} environment that is used to balance the dollar
8868 expressions.  If you are using AUCTeX with the font-latex library, a
8869 much better solution is to add the @code{comment} environment to the
8870 variable @code{LaTeX-verbatim-environments}.}:
8872 @example
8873 % BEGIN RECEIVE ORGTBL salesfigures
8874 % END RECEIVE ORGTBL salesfigures
8875 \begin@{comment@}
8876 #+ORGTBL: SEND salesfigures orgtbl-to-latex
8877 | Month | Days | Nr sold | per day |
8878 |-------+------+---------+---------|
8879 | Jan   |   23 |      55 |     2.4 |
8880 | Feb   |   21 |      16 |     0.8 |
8881 | March |   22 |     278 |    12.6 |
8882 #+TBLFM: $4=$3/$2;%.1f
8883 % $ (optional extra dollar to keep font-lock happy, see footnote)
8884 \end@{comment@}
8885 @end example
8887 @noindent
8888 When you are done, press @kbd{C-c C-c} in the table to get the converted
8889 table inserted between the two marker lines.
8891 Now lets assume you want to make the table header by hand, because you
8892 want to control how columns are aligned etc.  In this case we make sure
8893 that the table translator does skip the first 2 lines of the source
8894 table, and tell the command to work as a @i{splice}, i.e. to not produce
8895 header and footer commands of the target table:
8897 @example
8898 \begin@{tabular@}@{lrrr@}
8899 Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
8900 % BEGIN RECEIVE ORGTBL salesfigures
8901 % END RECEIVE ORGTBL salesfigures
8902 \end@{tabular@}
8904 \begin@{comment@}
8905 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
8906 | Month | Days | Nr sold | per day |
8907 |-------+------+---------+---------|
8908 | Jan   |   23 |      55 |     2.4 |
8909 | Feb   |   21 |      16 |     0.8 |
8910 | March |   22 |     278 |    12.6 |
8911 #+TBLFM: $4=$3/$2;%.1f
8912 \end@{comment@}
8913 @end example
8915 The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
8916 Orgtbl mode.  It uses a @code{tabular} environment to typeset the table
8917 and marks horizontal lines with @code{\hline}.  Furthermore, it
8918 interprets the following parameters (see also @ref{Translator functions}):
8920 @table @code
8921 @item :splice nil/t
8922 When set to t, return only table body lines, don't wrap them into a
8923 tabular environment.  Default is nil.
8925 @item :fmt fmt
8926 A format to be used to wrap each field, should contain @code{%s} for the
8927 original field value.  For example, to wrap each field value in dollars,
8928 you could use @code{:fmt "$%s$"}.  This may also be a property list with
8929 column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
8930 A function of one argument can be used in place of the strings; the
8931 function must return a formatted string.
8933 @item :efmt efmt
8934 Use this format to print numbers with exponentials.  The format should
8935 have @code{%s} twice for inserting mantissa and exponent, for example
8936 @code{"%s\\times10^@{%s@}"}.  The default is @code{"%s\\,(%s)"}.  This
8937 may also be a property list with column numbers and formats, for example
8938 @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}.  After
8939 @code{efmt} has been applied to a value, @code{fmt} will also be
8940 applied.  Similar to @code{fmt}, functions of two arguments can be
8941 supplied instead of strings.
8942 @end table
8944 @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
8945 @subsection Translator functions
8946 @cindex HTML, and Orgtbl mode
8947 @cindex translator function
8949 Orgtbl mode has several translator functions built-in: @code{orgtbl-to-csv}
8950 (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values)
8951 @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and @code{orgtbl-to-texinfo}.
8952 Except for @code{orgtbl-to-html}@footnote{The HTML translator uses the same
8953 code that produces tables during HTML export.}, these all use a generic
8954 translator, @code{orgtbl-to-generic}.  For example, @code{orgtbl-to-latex}
8955 itself is a very short function that computes the column definitions for the
8956 @code{tabular} environment, defines a few field and line separators and then
8957 hands over to the generic translator.  Here is the entire code:
8959 @lisp
8960 @group
8961 (defun orgtbl-to-latex (table params)
8962   "Convert the Orgtbl mode TABLE to LaTeX."
8963   (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
8964                                org-table-last-alignment ""))
8965          (params2
8966           (list
8967            :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
8968            :tend "\\end@{tabular@}"
8969            :lstart "" :lend " \\\\" :sep " & "
8970            :efmt "%s\\,(%s)" :hline "\\hline")))
8971     (orgtbl-to-generic table (org-combine-plists params2 params))))
8972 @end group
8973 @end lisp
8975 As you can see, the properties passed into the function (variable
8976 @var{PARAMS}) are combined with the ones newly defined in the function
8977 (variable @var{PARAMS2}).  The ones passed into the function (i.e. the
8978 ones set by the @samp{ORGTBL SEND} line) take precedence.  So if you
8979 would like to use the La@TeX{} translator, but wanted the line endings to
8980 be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
8981 overrule the default with
8983 @example
8984 #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
8985 @end example
8987 For a new language, you can either write your own converter function in
8988 analogy with the La@TeX{} translator, or you can use the generic function
8989 directly.  For example, if you have a language where a table is started
8990 with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
8991 started with @samp{!BL!}, ended with @samp{!EL!} and where the field
8992 separator is a TAB, you could call the generic translator like this (on
8993 a single line!):
8995 @example
8996 #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
8997                               :lstart "!BL! " :lend " !EL!" :sep "\t"
8998 @end example
9000 @noindent
9001 Please check the documentation string of the function
9002 @code{orgtbl-to-generic} for a full list of parameters understood by
9003 that function and remember that you can pass each of them into
9004 @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
9005 using the generic function.
9007 Of course you can also write a completely new function doing complicated
9008 things the generic translator cannot do.  A translator function takes
9009 two arguments.  The first argument is the table, a list of lines, each
9010 line either the symbol @code{hline} or a list of fields.  The second
9011 argument is the property list containing all parameters specified in the
9012 @samp{#+ORGTBL: SEND} line.  The function must return a single string
9013 containing the formatted table.  If you write a generally useful
9014 translator, please post it on @code{emacs-orgmode@@gnu.org} so that
9015 others can benefit from your work.
9017 @node  Radio lists,  , Translator functions, Tables in arbitrary syntax
9018 @subsection Radio lists
9019 @cindex radio lists
9020 @cindex org-list-insert-radio-list
9022 Sending and receiving radio lists works exactly the same way than
9023 sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
9024 need to load the @code{org-export-latex.el} package to use radio lists
9025 since the relevant code is there for now.}.  As for radio tables, you
9026 can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
9027 calling @code{org-list-insert-radio-list}.
9029 Here are the differences with radio tables:
9031 @itemize @minus
9032 @item
9033 Use @code{ORGLST} instead of @code{ORGTBL}.
9034 @item
9035 The available translation functions for radio lists don't take
9036 parameters.
9037 @item
9038 `C-c C-c' will work when pressed on the first item of the list.
9039 @end itemize
9041 Here is a La@TeX{} example.  Let's say that you have this in your
9042 La@TeX{} file:
9044 @example
9045 % BEGIN RECEIVE ORGLST to-buy
9046 % END RECEIVE ORGLST to-buy
9047 \begin@{comment@}
9048 #+ORGLIST: SEND to-buy orgtbl-to-latex
9049 - a new house
9050 - a new computer
9051   + a new keyboard
9052   + a new mouse
9053 - a new life
9054 \end@{comment@}
9055 @end example
9057 Pressing `C-c C-c' on @code{a new house} and will insert the converted
9058 La@TeX{} list between the two marker lines.
9060 @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Hacking
9061 @section Dynamic blocks
9062 @cindex dynamic blocks
9064 Org documents can contain @emph{dynamic blocks}.  These are
9065 specially marked regions that are updated by some user-written function.
9066 A good example for such a block is the clock table inserted by the
9067 command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
9069 Dynamic block are enclosed by a BEGIN-END structure that assigns a name
9070 to the block and can also specify parameters for the function producing
9071 the content of the block.
9073 #+BEGIN:dynamic block
9074 @example
9075 #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
9077 #+END:
9078 @end example
9080 Dynamic blocks are updated with the following commands
9082 @table @kbd
9083 @kindex C-c C-x C-u
9084 @item C-c C-x C-u
9085 Update dynamic block at point.
9086 @kindex C-u C-c C-x C-u
9087 @item C-u C-c C-x C-u
9088 Update all dynamic blocks in the current file.
9089 @end table
9091 Updating a dynamic block means to remove all the text between BEGIN and
9092 END, parse the BEGIN line for parameters and then call the specific
9093 writer function for this block to insert the new content.  If you want
9094 to use the original content in the writer function, you can use the
9095 extra parameter @code{:content}.
9097 For a block with name @code{myblock}, the writer function is
9098 @code{org-dblock-write:myblock} with as only parameter a property list
9099 with the parameters given in the begin line.  Here is a trivial example
9100 of a block that keeps track of when the block update function was last
9101 run:
9103 @example
9104 #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
9106 #+END:
9107 @end example
9109 @noindent
9110 The corresponding block writer function could look like this:
9112 @lisp
9113 (defun org-dblock-write:block-update-time (params)
9114    (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
9115      (insert "Last block update at: "
9116              (format-time-string fmt (current-time)))))
9117 @end lisp
9119 If you want to make sure that all dynamic blocks are always up-to-date,
9120 you could add the function @code{org-update-all-dblocks} to a hook, for
9121 example @code{before-save-hook}.  @code{org-update-all-dblocks} is
9122 written in a way that is does nothing in buffers that are not in
9123 @code{org-mode}.
9125 @node Special agenda views, Using the property API, Dynamic blocks, Hacking
9126 @section Special agenda views
9127 @cindex agenda views, user-defined
9129 Org provides a special hook that can be used to narrow down the
9130 selection made by any of the agenda views.  You may specify a function
9131 that is used at each match to verify if the match should indeed be part
9132 of the agenda view, and if not, how much should be skipped.
9134 Let's say you want to produce a list of projects that contain a WAITING
9135 tag anywhere in the project tree.  Let's further assume that you have
9136 marked all tree headings that define a project with the TODO keyword
9137 PROJECT.  In this case you would run a TODO search for the keyword
9138 PROJECT, but skip the match unless there is a WAITING tag anywhere in
9139 the subtree belonging to the project line.
9141 To achieve this, you must write a function that searches the subtree for
9142 the tag.  If the tag is found, the function must return @code{nil} to
9143 indicate that this match should not be skipped.  If there is no such
9144 tag, return the location of the end of the subtree, to indicate that
9145 search should continue from there.
9147 @lisp
9148 (defun my-skip-unless-waiting ()
9149   "Skip trees that are not waiting"
9150   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
9151     (if (re-search-forward ":waiting:" subtree-end t)
9152         nil          ; tag found, do not skip
9153       subtree-end))) ; tag not found, continue after end of subtree
9154 @end lisp
9156 Now you may use this function in an agenda custom command, for example
9157 like this:
9159 @lisp
9160 (org-add-agenda-custom-command
9161  '("b" todo "PROJECT"
9162    ((org-agenda-skip-function 'my-org-waiting-projects)
9163     (org-agenda-overriding-header "Projects waiting for something: "))))
9164 @end lisp
9166 Note that this also binds @code{org-agenda-overriding-header} to get a
9167 meaningful header in the agenda view.
9169 A general way to create custom searches is to base them on a search for
9170 entries with a certain level limit.  If you want to study all entries with
9171 your custom search function, simply do a search for @samp{LEVEL>0}, and then
9172 use @code{org-agenda-skip-function} to select the entries you really want to
9173 have.
9175 You may also put a Lisp form into @code{org-agenda-skip-function}.  In
9176 particular, you may use the functions @code{org-agenda-skip-entry-if}
9177 and @code{org-agenda-skip-subtree-if} in this form, for example:
9179 @table @code
9180 @item '(org-agenda-skip-entry-if 'scheduled)
9181 Skip current entry if it has been scheduled.
9182 @item '(org-agenda-skip-entry-if 'notscheduled)
9183 Skip current entry if it has not been scheduled.
9184 @item '(org-agenda-skip-entry-if 'deadline)
9185 Skip current entry if it has a deadline.
9186 @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
9187 Skip current entry if it has a deadline, or if it is scheduled.
9188 @item '(org-agenda-skip-entry 'regexp "regular expression")
9189 Skip current entry if the regular expression matches in the entry.
9190 @item '(org-agenda-skip-entry 'notregexp "regular expression")
9191 Skip current entry unless the regular expression matches.
9192 @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
9193 Same as above, but check and skip the entire subtree.
9194 @end table
9196 Therefore we could also have written the search for WAITING projects
9197 like this, even without defining a special function:
9199 @lisp
9200 (org-add-agenda-custom-command
9201  '("b" todo "PROJECT"
9202    ((org-agenda-skip-function '(org-agenda-skip-subtree-if
9203                                 'regexp ":waiting:"))
9204     (org-agenda-overriding-header "Projects waiting for something: "))))
9205 @end lisp
9207 @node Using the property API, Using the mapping API, Special agenda views, Hacking
9208 @section Using the property API
9209 @cindex API, for properties
9210 @cindex properties, API
9212 Here is a description of the functions that can be used to work with
9213 properties.
9215 @defun org-entry-properties &optional pom which
9216 Get all properties of the entry at point-or-marker POM.
9217 This includes the TODO keyword, the tags, time strings for deadline,
9218 scheduled, and clocking, and any additional properties defined in the
9219 entry.  The return value is an alist, keys may occur multiple times
9220 if the property key was used several times.
9221 POM may also be nil, in which case the current entry is used.
9222 If WHICH is nil or `all', get all properties.  If WHICH is
9223 `special' or `standard', only get that subclass.
9224 @end defun
9225 @defun org-entry-get pom property &optional inherit
9226 Get value of PROPERTY for entry at point-or-marker POM.  By default,
9227 this only looks at properties defined locally in the entry.  If INHERIT
9228 is non-nil and the entry does not have the property, then also check
9229 higher levels of the hierarchy.  If INHERIT is the symbol
9230 @code{selective}, use inheritance if and only if the setting of
9231 @code{org-use-property-inheritance} selects PROPERTY for inheritance.
9232 @end defun
9234 @defun org-entry-delete pom property
9235 Delete the property PROPERTY from entry at point-or-marker POM.
9236 @end defun
9238 @defun org-entry-put pom property value
9239 Set PROPERTY to VALUE for entry at point-or-marker POM.
9240 @end defun
9242 @defun org-buffer-property-keys &optional include-specials
9243 Get all property keys in the current buffer.
9244 @end defun
9246 @defun org-insert-property-drawer
9247 Insert a property drawer at point.
9248 @end defun
9250 @defun org-entry-add-to-multivalued-property pom property value
9251 Treat the value of the property PROPERTY as a whitespace-separated list of
9252 values and make sure that VALUE is in this list.
9253 @end defun
9255 @defun org-entry-remove-from-multivalued-property pom property value
9256 Treat the value of the property PROPERTY as a whitespace-separated list of
9257 values and make sure that VALUE is @emph{not} in this list.
9258 @end defun
9260 @defun org-entry-member-in-multivalued-property pom property value
9261 Treat the value of the property PROPERTY as a whitespace-separated list of
9262 values and check if VALUE is in this list.
9263 @end defun
9265 @node Using the mapping API,  , Using the property API, Hacking
9266 @section Using the mapping API
9267 @cindex API, for mapping
9268 @cindex mapping entries, API
9270 Org has sophisticated mapping capabilities to find all entries satisfying
9271 certain criteria.  Internally, this functionality is used to produce agenda
9272 views, but there is also an API that can be used to execute arbitrary
9273 functions for each or selected entries.  The main entry point for this API
9274 is: 
9276 @defun org-map-entries func &optional match scope &rest skip
9277 Call FUNC at each headline selected by MATCH in SCOPE.
9279 FUNC is a function or a lisp form.  The function will be called without
9280 arguments, with the cursor positioned at the beginning of the headline.
9281 The return values of all calls to the function will be collected and
9282 returned as a list.
9284 MATCH is a tags/property/todo match as it is used in the agenda tags view.
9285 Only headlines that are matched by this query will be considered during
9286 the iteration.  When MATCH is nil or t, all headlines will be
9287 visited by the iteration.
9289 SCOPE determines the scope of this command.  It can be any of:
9291 @example
9292 nil     @r{the current buffer, respecting the restriction if any}
9293 tree    @r{the subtree started with the entry at point}
9294 file    @r{the current buffer, without restriction}
9295 file-with-archives
9296         @r{the current buffer, and any archives associated with it}
9297 agenda  @r{all agenda files}
9298 agenda-with-archives
9299         @r{all agenda files with any archive files associated with them}
9300 (file1 file2 ...)
9301         @r{if this is a list, all files in the list will be scanned}
9302 @end example
9304 The remaining args are treated as settings for the skipping facilities of
9305 the scanner.  The following items can be given here:
9307 @example
9308 archive   @r{skip trees with the archive tag}
9309 comment   @r{skip trees with the COMMENT keyword}
9310 function or Lisp form
9311           @r{will be used as value for @code{org-agenda-skip-function},}
9312           @r{so whenever the the function returns t, FUNC}
9313           @r{will not be called for that entry and search will}
9314           @r{continue from the point where the function leaves it}
9315 @end example
9316 @end defun
9318 The function given to that mapping routine can really do anything you like.
9319 It can uce the property API (@pxref{Using the property API}) to gather more
9320 information about the entry, or in order to change metadate in the entry.
9321 Here are a couple of functions that might be handy:
9323 @defun org-todo &optional arg
9324 Change the TODO state of the entry, see the docstring of the functions for
9325 the many possible values for the argument ARG.
9326 @end defun
9328 @defun org-priority &optional action
9329 Change the priority of the entry, see the docstring of this function for the
9330 possible values for ACTION.
9331 @end defun
9333 @defun org-toggle-tag tag &optional onoff
9334 Toggle the tag TAG in the current entry.  Setting ONOFF to either @code{on}
9335 or @code{off} will not toggle tag, but ensure that it is either on or off.
9336 @end defun
9338 @defun org-promote
9339 Promote the current entry.
9340 @end defun
9342 @defun org-demote
9343 Demote the current entry.
9344 @end defun
9346 Here is a simple example that will turn all entries in the current file with
9347 a tag @code{TOMORROW} into TODO entries with the keyword @code{UPCOMING}.
9348 Entries in comment trees and in archive trees will be ignored.
9350 @lisp
9351 (org-map-entries
9352    '(org-todo "UPCOMING")
9353    "+TOMORROW" 'file 'archive 'comment)
9354 @end lisp
9356 The following example counts the number of entries with TODO keyword
9357 @code{WAITING}, in all agenda files.
9359 @lisp
9360 (length (org-map-entries t "/+WAITING" nil 'agenda))
9361 @end lisp
9363 @node History and Acknowledgments, Main Index, Hacking, Top
9364 @appendix History and Acknowledgments
9365 @cindex acknowledgments
9366 @cindex history
9367 @cindex thanks
9369 Org was borne in 2003, out of frustration over the user interface
9370 of the Emacs Outline mode.  I was trying to organize my notes and
9371 projects, and using Emacs seemed to be the natural way to go.  However,
9372 having to remember eleven different commands with two or three keys per
9373 command, only to hide and show parts of the outline tree, that seemed
9374 entirely unacceptable to me.  Also, when using outlines to take notes, I
9375 constantly want to restructure the tree, organizing it parallel to my
9376 thoughts and plans.  @emph{Visibility cycling} and @emph{structure
9377 editing} were originally implemented in the package
9378 @file{outline-magic.el}, but quickly moved to the more general
9379 @file{org.el}.  As this environment became comfortable for project
9380 planning, the next step was adding @emph{TODO entries}, basic @emph{time
9381 stamps}, and @emph{table support}.  These areas highlight the two main
9382 goals that Org still has today: To create a new, outline-based,
9383 plain text mode with innovative and intuitive editing features, and to
9384 incorporate project planning functionality directly into a notes file.
9386 A special thanks goes to @i{Bastien Guerry} who has not only writen a large
9387 number of extensions to Org (most of them integrated into the core by now),
9388 but has also helped the development and maintenance of Org so much that he
9389 should be considered co-author of this package.
9391 Since the first release, literally thousands of emails to me or on
9392 @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
9393 reports, feedback, new ideas, and sometimes patches and add-on code.
9394 Many thanks to everyone who has helped to improve this package.  I am
9395 trying to keep here a list of the people who had significant influence
9396 in shaping one or more aspects of Org.  The list may not be
9397 complete, if I have forgotten someone, please accept my apologies and
9398 let me know.
9400 @itemize @bullet
9402 @item
9403 @i{Russel Adams} came up with the idea for drawers.
9404 @item
9405 @i{Thomas Baumann} wrote @file{org-bbdb.el} and @file{org-mhe.el}.
9406 @item
9407 @i{Christophe Bataillon} created the great unicorn logo that we use on the
9408 Org-mode website.
9409 @item
9410 @i{Alex Bochannek} provided a patch for rounding time stamps.
9411 @item
9412 @i{Charles Cave}'s suggestion sparked the implementation of templates
9413 for Remember.
9414 @item
9415 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
9416 specified time.
9417 @item
9418 @i{Gregory Chernov} patched support for lisp forms into table
9419 calculations and improved XEmacs compatibility, in particular by porting
9420 @file{nouline.el} to XEmacs.
9421 @item
9422 @i{Sacha Chua} suggested to copy some linking code from Planner.
9423 @item
9424 @i{Eddward DeVilla} proposed and tested checkbox statistics.  He also
9425 came up with the idea of properties, and that there should be an API for
9426 them.
9427 @item
9428 @i{Kees Dullemond} used to edit projects lists directly in HTML and so
9429 inspired some of the early development, including HTML export.  He also
9430 asked for a way to narrow wide table columns.
9431 @item
9432 @i{Christian Egli} converted the documentation into Texinfo format,
9433 patched CSS formatting into the HTML exporter, and inspired the agenda.
9434 @item
9435 @i{David Emery} provided a patch for custom CSS support in exported
9436 HTML agendas.
9437 @item
9438 @i{Nic Ferrier} contributed mailcap and XOXO support.
9439 @item
9440 @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
9441 @item
9442 @i{John Foerch} figured out how to make incremental search show context
9443 around a match in a hidden outline tree.
9444 @item
9445 @i{Niels Giesen} had the idea to automatically archive DONE trees.
9446 @item
9447 @i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and
9448 has been prolific with patches, ideas, and bug reports.
9449 @item
9450 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
9451 @item
9452 @i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
9453 task state change logging, and the clocktable.  His clear explanations have
9454 been critical when we started to adopt the GIT version control system.
9455 @item
9456 @i{Phil Jackson} wrote @file{org-irc.el}.
9457 @item
9458 @i{Scott Jaderholm} proposed footnotes, control over whitespace between
9459 folded entries, and column view for properties.
9460 @item
9461 @i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}.
9462 @item
9463 @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it.  He also
9464 provided frequent feedback and some patches.
9465 @item
9466 @i{Jason F. McBrayer} suggested agenda export to CSV format.
9467 @item
9468 @i{Max Mikhanosha} came up with the idea of refiling.
9469 @item
9470 @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
9471 basis.
9472 @item
9473 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
9474 happy.
9475 @item
9476 @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file
9477 and to be able to quickly restrict the agenda to a subtree.
9478 @item
9479 @i{Todd Neal} provided patches for links to Info files and elisp forms.
9480 @item
9481 @i{Tim O'Callaghan} suggested in-file links, search options for general
9482 file links, and TAGS.
9483 @item
9484 @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
9485 into Japanese.
9486 @item
9487 @i{Oliver Oppitz} suggested multi-state TODO items.
9488 @item
9489 @i{Scott Otterson} sparked the introduction of descriptive text for
9490 links, among other things.
9491 @item
9492 @i{Pete Phillips} helped during the development of the TAGS feature, and
9493 provided frequent feedback.
9494 @item
9495 @i{T.V. Raman} reported bugs and suggested improvements.
9496 @item
9497 @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
9498 control.
9499 @item
9500 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
9501 @item
9502 @i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
9503 webpages derived from Org using an Info-like, or a folding interface with
9504 single key navigation.
9505 @item
9506 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
9507 conflict with @file{allout.el}.
9508 @item
9509 @i{Jason Riedy} generalized the send-receive mechanism for orgtbl tables with
9510 extensive patches.
9511 @item
9512 @i{Philip Rooke} created the Org reference card, provided lots
9513 of feedback, developed and applied standards to the Org documentation and
9514 wrote the manual for the contributed packages.
9515 @item
9516 @i{Christian Schlauer} proposed angular brackets around links, among
9517 other things.
9518 @item
9519 Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s
9520 @file{organizer-mode.el}.
9521 @item
9522 @i{Ilya Shlyakhter} proposed the Archive Sibling.
9523 @item
9524 @i{Daniel Sinder} came up with the idea of internal archiving by locking
9525 subtrees.
9526 @item
9527 @i{Dale Smith} proposed link abbreviations.
9528 @item
9529 @i{Adam Spiers} asked for global linking commands, inspired the link
9530 extension system, added support for mairix, and proposed the mapping API.
9531 @item
9532 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
9533 chapter about publishing.
9534 @item
9535 @i{J@"urgen Vollmer} contributed code generating the table of contents
9536 in HTML output.
9537 @item
9538 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
9539 keyword.
9540 @item
9541 @i{David Wainberg} suggested archiving, and improvements to the linking
9542 system.
9543 @item
9544 @i{John Wiegley} wrote @file{emacs-wiki.el}, @file{planner.el}, and
9545 @file{muse.el}, which have similar goals as Org.  Initially the
9546 development of Org was fully independent because I was not aware of the
9547 existence of these packages.  But with time I have accasionally looked
9548 at John's code and learned a lot from it.  John has also contributed a
9549 number of great ideas and patches directly to Org, including the file
9550 @code{org-mac-message.el}'
9551 @item
9552 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
9553 linking to Gnus.
9554 @item
9555 @i{Roland Winkler} requested additional key bindings to make Org
9556 work on a tty.
9557 @item
9558 @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
9559 and contributed various ideas and code snippets.
9560 @end itemize
9563 @node Main Index, Key Index, History and Acknowledgments, Top
9564 @unnumbered The Main Index
9566 @printindex cp
9568 @node Key Index,  , Main Index, Top
9569 @unnumbered Key Index
9571 @printindex ky
9573 @bye
9575 @ignore
9576         arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
9577 @end ignore
9579 @c Local variables:
9580 @c ispell-local-dictionary: "en_US-w_accents"
9581 @c ispell-local-pdict: "./.aspell.org.pws"
9582 @c fill-column: 77
9583 @c End: