Publishing: Clean out timestamp directory with `C-u C-c C-e E'
[org-mode.git] / doc / org.texi
bloba83cf4c21d07b0d6c93025d32e66fc12a2c87743
1 \input texinfo
2 @c %**start of header
3 @setfilename ../../info/org
4 @settitle The Org Manual
6 @set VERSION 6.28trans
7 @set DATE June 2009
9 @c Version and Contact Info
10 @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
11 @set AUTHOR Carsten Dominik
12 @set MAINTAINER Carsten Dominik
13 @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
14 @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
15 @c %**end of header
16 @finalout
18 @c Macro definitions
19 @iftex
20 @c @hyphenation{time-stamp time-stamps time-stamp-ing time-stamp-ed}
21 @end iftex
22 @macro Ie {}
23 I.e.,
24 @end macro
25 @macro ie {}
26 i.e.,
27 @end macro
28 @macro Eg {}
29 E.g.,
30 @end macro
31 @macro eg {}
32 e.g.,
33 @end macro
35 @c Subheadings inside a table.
36 @macro tsubheading{text}
37 @ifinfo
38 @subsubheading \text\
39 @end ifinfo
40 @ifnotinfo
41 @item @b{\text\}
42 @end ifnotinfo
43 @end macro
45 @copying
46 This manual is for Org version @value{VERSION}.
48 Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
50 @quotation
51 Permission is granted to copy, distribute and/or modify this document
52 under the terms of the GNU Free Documentation License, Version 1.3 or
53 any later version published by the Free Software Foundation; with no
54 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
55 and with the Back-Cover Texts as in (a) below.  A copy of the license
56 is included in the section entitled ``GNU Free Documentation License.''
58 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
59 modify this GNU manual.  Buying copies from the FSF supports it in
60 developing GNU and promoting software freedom.''
62 This document is part of a collection distributed under the GNU Free
63 Documentation License.  If you want to distribute this document
64 separately from the collection, you can do so by adding a copy of the
65 license to the document, as described in section 6 of the license.
66 @end quotation
67 @end copying
69 @dircategory Emacs
70 @direntry
71 * Org Mode: (org).      Outline-based notes management and organizer
72 @end direntry
74 @titlepage
75 @title The Org Manual
77 @subtitle Release @value{VERSION}
78 @author by Carsten Dominik
80 @c The following two commands start the copyright page.
81 @page
82 @vskip 0pt plus 1filll
83 @insertcopying
84 @end titlepage
86 @c Output the table of contents at the beginning.
87 @contents
89 @ifnottex
90 @node Top, Introduction, (dir), (dir)
91 @top Org Mode Manual
93 @insertcopying
94 @end ifnottex
96 @menu
97 * Introduction::                Getting started
98 * Document Structure::          A tree works like your brain
99 * Tables::                      Pure magic for quick formatting
100 * Hyperlinks::                  Notes in context
101 * TODO Items::                  Every tree branch can be a TODO item
102 * Tags::                        Tagging headlines and matching sets of tags
103 * Properties and Columns::      Storing information about an entry
104 * Dates and Times::             Making items useful for planning
105 * Capture::                     Creating tasks and attaching files
106 * Agenda Views::                Collecting information into views
107 * Embedded LaTeX::              LaTeX fragments and formulas
108 * Exporting::                   Sharing and publishing of notes
109 * Publishing::                  Create a web site of linked Org files
110 * Miscellaneous::               All the rest which did not fit elsewhere
111 * Hacking::                     How to hack your way around
112 * History and Acknowledgments::  How Org came into being
113 * Main Index::                  An index of Org's concepts and features
114 * Key Index::                   Key bindings and where they are described
115 * Variable Index::              Variables mentiond in the manual
117 @detailmenu
118  --- The Detailed Node Listing ---
120 Introduction
122 * Summary::                     Brief summary of what Org does
123 * Installation::                How to install a downloaded version of Org
124 * Activation::                  How to activate Org for certain buffers
125 * Feedback::                    Bug reports, ideas, patches etc.
126 * Conventions::                 Type-setting conventions in the manual
128 Document Structure
130 * Outlines::                    Org is based on Outline mode
131 * Headlines::                   How to typeset Org tree headlines
132 * Visibility cycling::          Show and hide, much simplified
133 * Motion::                      Jumping to other headlines
134 * Structure editing::           Changing sequence and level of headlines
135 * Archiving::                   Move done task trees to a different place
136 * Sparse trees::                Matches embedded in context
137 * Plain lists::                 Additional structure within an entry
138 * Drawers::                     Tucking stuff away
139 * Blocks::                      Folding blocks
140 * Footnotes::                   How footnotes are defined in Org's syntax
141 * Orgstruct mode::              Structure editing outside Org
143 Archiving
145 * ARCHIVE tag::                 Marking a tree as inactive
146 * Moving subtrees::             Moving a tree to an archive file
148 Tables
150 * Built-in table editor::       Simple tables
151 * Column width and alignment::  Overrule the automatic settings
152 * Column groups::               Grouping to trigger vertical lines
153 * Orgtbl mode::                 The table editor as minor mode
154 * The spreadsheet::             The table editor has spreadsheet capabilities
155 * Org-Plot::                    Plotting from org tables
157 The spreadsheet
159 * References::                  How to refer to another field or range
160 * Formula syntax for Calc::     Using Calc to compute stuff
161 * Formula syntax for Lisp::     Writing formulas in Emacs Lisp
162 * Field formulas::              Formulas valid for a single field
163 * Column formulas::             Formulas valid for an entire column
164 * Editing and debugging formulas::  Fixing formulas
165 * Updating the table::          Recomputing all dependent fields
166 * Advanced features::           Field names, parameters and automatic recalc
168 Hyperlinks
170 * Link format::                 How links in Org are formatted
171 * Internal links::              Links to other places in the current file
172 * External links::              URL-like links to the world
173 * Handling links::              Creating, inserting and following
174 * Using links outside Org::     Linking from my C source code?
175 * Link abbreviations::          Shortcuts for writing complex links
176 * Search options::              Linking to a specific location
177 * Custom searches::             When the default search is not enough
179 Internal links
181 * Radio targets::               Make targets trigger links in plain text
183 TODO Items
185 * TODO basics::                 Marking and displaying TODO entries
186 * TODO extensions::             Workflow and assignments
187 * Progress logging::            Dates and notes for progress
188 * Priorities::                  Some things are more important than others
189 * Breaking down tasks::         Splitting a task into manageable pieces
190 * Checkboxes::                  Tick-off lists
192 Extended use of TODO keywords
194 * Workflow states::             From TODO to DONE in steps
195 * TODO types::                  I do this, Fred does the rest
196 * Multiple sets in one file::   Mixing it all, and still finding your way
197 * Fast access to TODO states::  Single letter selection of a state
198 * Per-file keywords::           Different files, different requirements
199 * Faces for TODO keywords::     Highlighting states
200 * TODO dependencies::           When one task needs to wait for others
202 Progress logging
204 * Closing items::               When was this entry marked DONE?
205 * Tracking TODO state changes::  When did the status change?
207 Tags
209 * Tag inheritance::             Tags use the tree structure of the outline
210 * Setting tags::                How to assign tags to a headline
211 * Tag searches::                Searching for combinations of tags
213 Properties and Columns
215 * Property syntax::             How properties are spelled out
216 * Special properties::          Access to other Org mode features
217 * Property searches::           Matching property values
218 * Property inheritance::        Passing values down the tree
219 * Column view::                 Tabular viewing and editing
220 * Property API::                Properties for Lisp programmers
222 Column view
224 * Defining columns::            The COLUMNS format property
225 * Using column view::           How to create and use column view
226 * Capturing column view::       A dynamic block for column view
228 Defining columns
230 * Scope of column definitions::  Where defined, where valid?
231 * Column attributes::           Appearance and content of a column
233 Dates and Times
235 * Timestamps::                  Assigning a time to a tree entry
236 * Creating timestamps::         Commands which insert timestamps
237 * Deadlines and scheduling::    Planning your work
238 * Clocking work time::          Tracking how long you spend on a task
239 * Effort estimates::            Planning work effort in advance
240 * Relative timer::              Notes with a running timer
242 Creating timestamps
244 * The date/time prompt::        How Org mode helps you entering date and time
245 * Custom time format::          Making dates look different
247 Deadlines and scheduling
249 * Inserting deadline/schedule::  Planning items
250 * Repeated tasks::              Items that show up again and again
252 Capture
254 * Remember::                    Capture new tasks/ideas with little interruption
255 * Attachments::                 Add files to tasks.
256 * RSS Feeds::                   Getting input from RSS feeds
257 * Protocols::                   External (@eg Browser) access to Emacs and Org
259 Remember
261 * Setting up Remember::         Some code for .emacs to get things going
262 * Remember templates::          Define the outline of different note types
263 * Storing notes::               Directly get the note to where it belongs
264 * Refiling notes::              Moving a note or task to a project
266 Agenda Views
268 * Agenda files::                Files being searched for agenda information
269 * Agenda dispatcher::           Keyboard access to agenda views
270 * Built-in agenda views::       What is available out of the box?
271 * Presentation and sorting::    How agenda items are prepared for display
272 * Agenda commands::             Remote editing of Org trees
273 * Custom agenda views::         Defining special searches and views
274 * Exporting Agenda Views::      
275 * Agenda column view::          Using column view for collected entries
277 The built-in agenda views
279 * Weekly/daily agenda::         The calendar page with current tasks
280 * Global TODO list::            All unfinished action items
281 * Matching tags and properties::  Structured information with fine-tuned search
282 * Timeline::                    Time-sorted view for single file
283 * Keyword search::              Finding entries by keyword
284 * Stuck projects::              Find projects you need to review
286 Presentation and sorting
288 * Categories::                  Not all tasks are equal
289 * Time-of-day specifications::  How the agenda knows the time
290 * Sorting of agenda items::     The order of things
292 Custom agenda views
294 * Storing searches::            Type once, use often
295 * Block agenda::                All the stuff you need in a single buffer
296 * Setting Options::             Changing the rules
298 Embedded La@TeX{}
300 * Math symbols::                @TeX{} macros for symbols and Greek letters
301 * Subscripts and superscripts::  Simple syntax for raising/lowering text
302 * LaTeX fragments::             Complex formulas made easy
303 * Processing LaTeX fragments::  Previewing La@TeX{} processing
304 * CDLaTeX mode::                Speed up entering of formulas
306 Exporting
308 * Markup rules::                Which structures are recognized?
309 * Selective export::            Using tags to select and exclude trees
310 * Export options::              Per-file export settings
311 * The export dispatcher::       How to access exporter commands
312 * ASCII export::                Exporting to plain ASCII
313 * HTML export::                 Exporting to HTML
314 * LaTeX and PDF export::        Exporting to La@TeX{}, and processing to PDF
315 * DocBook export::              Exporting to DocBook
316 * XOXO export::                 Exporting to XOXO
317 * iCalendar export::            Exporting in iCalendar format
319 Markup rules
321 * Document title::              How the document title is determined
322 * Headings and sections::       The main structure of the exported document
323 * Table of contents::           If, where, how to create a table of contents
324 * Initial text::                Text before the first headline
325 * Lists::                       Plain lists are exported
326 * Paragraphs::                  What determines beginning and ending
327 * Literal examples::            Source code and other examples
328 * Include files::               Include the contents of a file during export
329 * Tables exported::             Tables are exported richly
330 * Inlined images::              How to inline images during export
331 * Footnote markup::             ASCII representation of footnotes
332 * Emphasis and monospace::      To bold or not to bold
333 * TeX macros and LaTeX fragments::  Create special, rich export.
334 * Horizontal rules::            A line across the page
335 * Comment lines::               Some lines will not be exported
336 * Macro replacement::           Global replacement of place holdes
338 HTML export
340 * HTML Export commands::        How to invoke HTML export
341 * Quoting HTML tags::           Using direct HTML in Org mode
342 * Links::                       Transformation of links for HTML
343 * Tables in HTML export::       How to modify the formatting of tables
344 * Images in HTML export::       How to insert figures into HTML output
345 * Text areas in HTML export::   An alternative way to show an example
346 * CSS support::                 Changing the appearance of the output
347 * Javascript support::          Info and Folding in a web browser
349 La@TeX{} and PDF export
351 * LaTeX/PDF export commands::   Which key invokes which commands
352 * Quoting LaTeX code::          Incorporating literal La@TeX{} code
353 * Sectioning structure::        Changing sectioning in La@TeX{} output
354 * Tables in LaTeX export::      Options for exporting tables to La@TeX{}
355 * Images in LaTeX export::      How to insert figures into La@TeX{} output
357 DocBook export
359 * DocBook export commands::     How to invoke DocBook export
360 * Quoting DocBook code::        Incorporating DocBook code in Org files
361 * Recursive sections::          Recursive sections in DocBook
362 * Tables in DocBook export::    Tables are exported as HTML tables
363 * Images in DocBook export::    How to insert figures into DocBook output
364 * Special characters::          How to handle special characters
366 Publishing
368 * Configuration::               Defining projects
369 * Uploading files::             How to get files up on the server
370 * Sample configuration::        Example projects
371 * Triggering publication::      Publication commands
373 Configuration
375 * Project alist::               The central configuration variable
376 * Sources and destinations::    From here to there
377 * Selecting files::             What files are part of the project?
378 * Publishing action::           Setting the function doing the publishing
379 * Publishing options::          Tweaking HTML export
380 * Publishing links::            Which links keep working after publishing?
381 * Project page index::          Publishing a list of project files
383 Sample configuration
385 * Simple example::              One-component publishing
386 * Complex example::             A multi-component publishing example
388 Miscellaneous
390 * Completion::                  M-TAB knows what you need
391 * Customization::               Adapting Org to your taste
392 * In-buffer settings::          Overview of the #+KEYWORDS
393 * The very busy C-c C-c key::   When in doubt, press C-c C-c
394 * Clean view::                  Getting rid of leading stars in the outline
395 * TTY keys::                    Using Org on a tty
396 * Interaction::                 Other Emacs packages
398 Interaction with other packages
400 * Cooperation::                 Packages Org cooperates with
401 * Conflicts::                   Packages that lead to conflicts
403 Hacking
405 * Hooks::                       Who to reach into Org's internals
406 * Add-on packages::             Available extensions
407 * Adding hyperlink types::      New custom link types
408 * Context-sensitive commands::  How to add functioality to such commands
409 * Tables in arbitrary syntax::  Orgtbl for La@TeX{} and other programs
410 * Dynamic blocks::              Automatically filled blocks
411 * Special agenda views::        Customized views
412 * Extracting agenda information::  Postprocessing of agenda information
413 * Using the property API::      Writing programs that use entry properties
414 * Using the mapping API::       Mapping over all or selected entries
416 Tables and lists in arbitrary syntax
418 * Radio tables::                Sending and receiving
419 * A LaTeX example::             Step by step, almost a tutorial
420 * Translator functions::        Copy and modify
421 * Radio lists::                 Doing the same for lists
423 @end detailmenu
424 @end menu
426 @node Introduction, Document Structure, Top, Top
427 @chapter Introduction
428 @cindex introduction
430 @menu
431 * Summary::                     Brief summary of what Org does
432 * Installation::                How to install a downloaded version of Org
433 * Activation::                  How to activate Org for certain buffers
434 * Feedback::                    Bug reports, ideas, patches etc.
435 * Conventions::                 Type-setting conventions in the manual
436 @end menu
438 @node Summary, Installation, Introduction, Introduction
439 @section Summary
440 @cindex summary
442 Org is a mode for keeping notes, maintaining TODO lists, and doing
443 project planning with a fast and effective plain-text system.
445 Org develops organizational tasks around NOTES files that contain
446 lists or information about projects as plain text.  Org is
447 implemented on top of Outline mode, which makes it possible to keep the
448 content of large files well structured.  Visibility cycling and
449 structure editing help to work with the tree.  Tables are easily created
450 with a built-in table editor.  Org supports TODO items, deadlines,
451 timestamps, and scheduling.  It dynamically compiles entries into an
452 agenda that utilizes and smoothly integrates much of the Emacs calendar
453 and diary.  Plain text URL-like links connect to websites, emails,
454 Usenet messages, BBDB entries, and any files related to the projects.
455 For printing and sharing of notes, an Org file can be exported as a
456 structured ASCII file, as HTML, or (TODO and agenda items only) as an
457 iCalendar file.  It can also serve as a publishing tool for a set of
458 linked web pages.
460 An important design aspect that distinguishes Org from, for example,
461 Planner/Muse is that it encourages you to store every piece of information
462 only once.  In Planner, you have project pages, day pages and possibly
463 other files, duplicating some information such as tasks.  In Org,
464 you only have notes files.  In your notes you mark entries as tasks, and
465 label them with tags and timestamps.  All necessary lists, like a
466 schedule for the day, the agenda for a meeting, tasks lists selected by
467 tags, etc., are created dynamically when you need them.
469 Org keeps simple things simple.  When first fired up, it should
470 feel like a straightforward, easy to use outliner.  Complexity is not
471 imposed, but a large amount of functionality is available when you need
472 it.  Org is a toolbox and can be used in different ways, for
473 example as:
475 @example
476 @r{@bullet{} an outline extension with visibility cycling and structure editing}
477 @r{@bullet{} an ASCII system and table editor for taking structured notes}
478 @r{@bullet{} an ASCII table editor with spreadsheet-like capabilities}
479 @r{@bullet{} a TODO list editor}
480 @r{@bullet{} a full agenda and planner with deadlines and work scheduling}
481 @pindex GTD, Getting Things Done
482 @r{@bullet{} an environment to implement David Allen's GTD system}
483 @r{@bullet{} a basic database application}
484 @r{@bullet{} a simple hypertext system, with HTML and La@TeX{} export}
485 @r{@bullet{} a publishing tool to create a set of interlinked webpages}
486 @end example
488 Org's automatic, context-sensitive table editor with spreadsheet
489 capabilities can be integrated into any major mode by activating the
490 minor Orgtbl mode.  Using a translation step, it can be used to maintain
491 tables in arbitrary file types, for example in La@TeX{}.  The structure
492 editing and list creation capabilities can be used outside Org with
493 the minor Orgstruct mode.
495 @cindex FAQ
496 There is a website for Org which provides links to the newest
497 version of Org, as well as additional information, frequently asked
498 questions (FAQ), links to tutorials, etc@.  This page is located at
499 @uref{http://orgmode.org}.
501 @page
504 @node Installation, Activation, Summary, Introduction
505 @section Installation
506 @cindex installation
507 @cindex XEmacs
509 @b{Important:} @i{If Org is part of the Emacs distribution or an
510 XEmacs package, please skip this section and go directly to
511 @ref{Activation}.}
513 If you have downloaded Org from the Web, either as a distribution @file{.zip}
514 or @file{.tar} file, or as a Git archive, you must take the following steps
515 to install it: Go into the unpacked Org distribution directory and edit the
516 top section of the file @file{Makefile}.  You must set the name of the Emacs
517 binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
518 directories where local Lisp and Info files are kept.  If you don't have
519 access to the system-wide directories, you can simply run Org directly from
520 the distribution directory by adding the @file{lisp} subdirectory to the
521 Emacs load path.  To do this, add the following line to @file{.emacs}:
523 @example
524 (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
525 @end example
527 @noindent
528 If you plan to use code from the @file{contrib} subdirectory, do a similar
529 step for this directory:
531 @example
532 (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
533 @end example
535 @b{XEmacs users now need to install the file @file{noutline.el} from
536 the @file{xemacs} sub-directory of the Org distribution.  Use the
537 command:}
539 @example
540 @b{make install-noutline}
541 @end example
543 @noindent Now byte-compile the Lisp files with the shell command:
545 @example
546 make
547 @end example
549 @noindent If you are running Org from the distribution directory, this is
550 all.  If you want to install into the system directories, use (as
551 administrator)
552 @example
553 make install
554 @end example
556 Installing Info files is system dependent, because of differences in the
557 @file{install-info} program.  In Debian it copies the info files into the
558 correct directory and modifies the info directory file.  In many other
559 systems, the files need to be copied to the correct directory separately, and
560 @file{install-info} then only modifies the directory file.  Check your system
561 documentation to find out which of the following commands you need:
563 @example
564 make install-info
565 make install-info-debian
566 @end example
568 @noindent Then add to @file{.emacs}:
570 @lisp
571 ;; This line only if Org is not part of the X/Emacs distribution.
572 (require 'org-install)
573 @end lisp
575 Do not forget to activate Org as described in the following section.
577 @node Activation, Feedback, Installation, Introduction
578 @section Activation
579 @cindex activation
580 @cindex autoload
581 @cindex global key bindings
582 @cindex key bindings, global
584 @iftex
585 @b{Important:} @i{If you use copy-and-paste to copy Lisp code from the
586 PDF documentation as viewed by some PDF viewers to your @file{.emacs} file, the
587 single-quote character comes out incorrectly and the code will not work.
588 You need to fix the single-quotes by hand, or copy from Info
589 documentation.}
590 @end iftex
592 Add the following lines to your @file{.emacs} file.  The last three lines
593 define @emph{global} keys for the commands @command{org-store-link},
594 @command{org-agenda}, and @command{org-iswitchb}---please choose suitable
595 keys yourself.
597 @lisp
598 ;; The following lines are always needed.  Choose your own keys.
599 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
600 (global-set-key "\C-cl" 'org-store-link)
601 (global-set-key "\C-ca" 'org-agenda)
602 (global-set-key "\C-cb" 'org-iswitchb)
603 @end lisp
605 Furthermore, you must activate @code{font-lock-mode} in Org
606 buffers, because significant functionality depends on font-locking being
607 active.  You can do this with either one of the following two lines
608 (XEmacs users must use the second option):
609 @lisp
610 (global-font-lock-mode 1)                     ; for all buffers
611 (add-hook 'org-mode-hook 'turn-on-font-lock)  ; Org buffers only
612 @end lisp
614 @cindex Org mode, turning on
615 With this setup, all files with extension @samp{.org} will be put
616 into Org mode.  As an alternative, make the first line of a file look
617 like this:
619 @example
620 MY PROJECTS    -*- mode: org; -*-
621 @end example
623 @vindex org-insert-mode-line-in-empty-file
624 @noindent which will select Org mode for this buffer no matter what
625 the file's name is.  See also the variable
626 @code{org-insert-mode-line-in-empty-file}.
628 Many commands in Org work on the region if the region is @i{active}.  To make
629 use of this, you need to have @code{transient-mark-mode}
630 (@code{zmacs-regions} in XEmacs) turned on.  In Emacs 23 this is the default,
631 in Emacs 22 you need to do this yourself with
632 @lisp
633 (transient-mark-mode 1)
634 @end lisp
635 @noindent If you do not like @code{transient-make-mode}, you can create an
636 active region by using the mouse to select a region, or pressing
637 @kbd{C-@key{SPC}} twice before moving the cursor.
639 @node Feedback, Conventions, Activation, Introduction
640 @section Feedback
641 @cindex feedback
642 @cindex bug reports
643 @cindex maintainer
644 @cindex author
646 If you find problems with Org, or if you have questions, remarks, or ideas
647 about it, please mail to the Org mailing list @email{emacs-orgmode@@gnu.org}.
648 If you are not a member of the mailing list, your mail will be reviewed by a
649 moderator and then passed through to the list.
651 For bug reports, please provide as much information as possible,
652 including the version information of Emacs (@kbd{C-h v emacs-version
653 @key{RET}}) and Org (@kbd{C-h v org-version @key{RET}}), as well as
654 the Org related setup in @file{.emacs}.  If an error occurs, a
655 backtrace can be very useful (see below on how to create one).  Often a
656 small example file helps, along with clear information about:
658 @enumerate
659 @item What exactly did you do?
660 @item What did you expect to happen?
661 @item What happened instead?
662 @end enumerate
663 @noindent Thank you for helping to improve this mode.
665 @subsubheading How to create a useful backtrace
667 @cindex backtrace of an error
668 If working with Org produces an error with a message you don't
669 understand, you may have hit a bug.  The best way to report this is by
670 providing, in addition to what was mentioned above, a @emph{backtrace}.
671 This is information from the built-in debugger about where and how the
672 error occurred.  Here is how to produce a useful backtrace:
674 @enumerate
675 @item
676 Reload uncompiled versions of all Org-mode Lisp files.  The backtrace
677 contains much more information if it is produced with uncompiled code.
678 To do this, use
679 @example
680 C-u M-x org-reload RET
681 @end example
682 @noindent
683 or select @code{Org -> Refresh/Reload -> Reload Org uncompiled} from the
684 menu.
685 @item
686 Go to the @code{Options} menu and select @code{Enter Debugger on Error}
687 (XEmacs has this option in the @code{Troubleshooting} sub-menu).
688 @item
689 Do whatever you have to do to hit the error.  Don't forget to
690 document the steps you take.
691 @item
692 When you hit the error, a @file{*Backtrace*} buffer will appear on the
693 screen.  Save this buffer to a file (for example using @kbd{C-x C-w}) and
694 attach it to your bug report.
695 @end enumerate
697 @node Conventions,  , Feedback, Introduction
698 @section Typesetting conventions used in this manual
700 Org uses three types of keywords: TODO keywords, tags, and property
701 names.  In this manual we use the following conventions:
703 @table @code
704 @item TODO
705 @itemx WAITING
706 TODO keywords are written with all capitals, even if they are
707 user-defined.
708 @item boss
709 @itemx ARCHIVE
710 User-defined tags are written in lowercase; built-in tags with special
711 meaning are written with all capitals.
712 @item Release
713 @itemx PRIORITY
714 User-defined properties are capitalized; built-in properties with
715 special meaning are written with all capitals.
716 @end table
718 @node Document Structure, Tables, Introduction, Top
719 @chapter Document Structure
720 @cindex document structure
721 @cindex structure of document
723 Org is based on Outline mode and provides flexible commands to
724 edit the structure of the document.
726 @menu
727 * Outlines::                    Org is based on Outline mode
728 * Headlines::                   How to typeset Org tree headlines
729 * Visibility cycling::          Show and hide, much simplified
730 * Motion::                      Jumping to other headlines
731 * Structure editing::           Changing sequence and level of headlines
732 * Archiving::                   Move done task trees to a different place
733 * Sparse trees::                Matches embedded in context
734 * Plain lists::                 Additional structure within an entry
735 * Drawers::                     Tucking stuff away
736 * Blocks::                      Folding blocks
737 * Footnotes::                   How footnotes are defined in Org's syntax
738 * Orgstruct mode::              Structure editing outside Org
739 @end menu
741 @node Outlines, Headlines, Document Structure, Document Structure
742 @section Outlines
743 @cindex outlines
744 @cindex Outline mode
746 Org is implemented on top of Outline mode.  Outlines allow a
747 document to be organized in a hierarchical structure, which (at least
748 for me) is the best representation of notes and thoughts.  An overview
749 of this structure is achieved by folding (hiding) large parts of the
750 document to show only the general document structure and the parts
751 currently being worked on.  Org greatly simplifies the use of
752 outlines by compressing the entire show/hide functionality into a single
753 command, @command{org-cycle}, which is bound to the @key{TAB} key.
755 @node Headlines, Visibility cycling, Outlines, Document Structure
756 @section Headlines
757 @cindex headlines
758 @cindex outline tree
759 @vindex org-special-ctrl-a/e
761 Headlines define the structure of an outline tree.  The headlines in
762 Org start with one or more stars, on the left margin@footnote{See
763 the variable @code{org-special-ctrl-a/e} to configure special behavior
764 of @kbd{C-a} and @kbd{C-e} in headlines.}.  For example:
766 @example
767 * Top level headline
768 ** Second level
769 *** 3rd level
770     some text
771 *** 3rd level
772     more text
774 * Another top level headline
775 @end example
777 @noindent Some people find the many stars too noisy and would prefer an
778 outline that has whitespace followed by a single star as headline
779 starters.  @ref{Clean view}, describes a setup to realize this.
781 @vindex org-cycle-separator-lines
782 An empty line after the end of a subtree is considered part of it and
783 will be hidden when the subtree is folded.  However, if you leave at
784 least two empty lines, one empty line will remain visible after folding
785 the subtree, in order to structure the collapsed view.  See the
786 variable @code{org-cycle-separator-lines} to modify this behavior.
788 @node Visibility cycling, Motion, Headlines, Document Structure
789 @section Visibility cycling
790 @cindex cycling, visibility
791 @cindex visibility cycling
792 @cindex trees, visibility
793 @cindex show hidden text
794 @cindex hide text
796 Outlines make it possible to hide parts of the text in the buffer.
797 Org uses just two commands, bound to @key{TAB} and
798 @kbd{S-@key{TAB}} to change the visibility in the buffer.
800 @cindex subtree visibility states
801 @cindex subtree cycling
802 @cindex folded, subtree visibility state
803 @cindex children, subtree visibility state
804 @cindex subtree, subtree visibility state
805 @table @kbd
806 @kindex @key{TAB}
807 @item @key{TAB}
808 @emph{Subtree cycling}: Rotate current subtree among the states
810 @example
811 ,-> FOLDED -> CHILDREN -> SUBTREE --.
812 '-----------------------------------'
813 @end example
815 @vindex org-cycle-emulate-tab
816 @vindex org-cycle-global-at-bob
817 The cursor must be on a headline for this to work@footnote{see, however,
818 the option @code{org-cycle-emulate-tab}.}.  When the cursor is at the
819 beginning of the buffer and the first line is not a headline, then
820 @key{TAB} actually runs global cycling (see below)@footnote{see the
821 option @code{org-cycle-global-at-bob}.}.  Also when called with a prefix
822 argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
824 @cindex global visibility states
825 @cindex global cycling
826 @cindex overview, global visibility state
827 @cindex contents, global visibility state
828 @cindex show all, global visibility state
829 @kindex S-@key{TAB}
830 @item S-@key{TAB}
831 @itemx C-u @key{TAB}
832 @emph{Global cycling}: Rotate the entire buffer among the states
834 @example
835 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
836 '--------------------------------------'
837 @end example
839 When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
840 CONTENTS view up to headlines of level N will be shown.  Note that inside
841 tables, @kbd{S-@key{TAB}} jumps to the previous field.
843 @cindex show all, command
844 @kindex C-u C-u C-u @key{TAB}
845 @item C-u C-u C-u @key{TAB}
846 Show all, including drawers.
847 @kindex C-c C-r
848 @item C-c C-r
849 Reveal context around point, showing the current entry, the following heading
850 and the hierarchy above.  Useful for working near a location that has been
851 exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
852 (@pxref{Agenda commands}).  With a prefix argument show, on each
853 level, all sibling headings.
854 @kindex C-c C-x b
855 @item C-c C-x b
856 Show the current subtree in an indirect buffer@footnote{The indirect
857 buffer
858 @ifinfo
859 (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
860 @end ifinfo
861 @ifnotinfo
862 (see the Emacs manual for more information about indirect buffers)
863 @end ifnotinfo
864 will contain the entire buffer, but will be narrowed to the current
865 tree.  Editing the indirect buffer will also change the original buffer,
866 but without affecting visibility in that buffer.}.  With a numeric
867 prefix argument N, go up to level N and then take that tree.  If N is
868 negative then go up that many levels.  With a @kbd{C-u} prefix, do not remove
869 the previously used indirect buffer.
870 @end table
872 @vindex org-startup-folded
873 When Emacs first visits an Org file, the global state is set to
874 OVERVIEW, @ie only the top level headlines are visible.  This can be
875 configured through the variable @code{org-startup-folded}, or on a
876 per-file basis by adding one of the following lines anywhere in the
877 buffer:
879 @example
880 #+STARTUP: overview
881 #+STARTUP: content
882 #+STARTUP: showall
883 @end example
885 @cindex property, VISIBILITY
886 @noindent
887 Furthermore, any entries with a @samp{VISIBILITY} property (@pxref{Properties
888 and Columns}) will get their visibility adapted accordingly.  Allowed values
889 for this property are @code{folded}, @code{children}, @code{content}, and
890 @code{all}.
891 @table @kbd
892 @kindex C-u C-u @key{TAB}
893 @item C-u C-u @key{TAB}
894 Switch back to the startup visibility of the buffer, @ie whatever is
895 requested by startup options and @samp{VISIBILITY} properties in individual
896 entries.
897 @end table
899 @node Motion, Structure editing, Visibility cycling, Document Structure
900 @section Motion
901 @cindex motion, between headlines
902 @cindex jumping, to headlines
903 @cindex headline navigation
904 The following commands jump to other headlines in the buffer.
906 @table @kbd
907 @kindex C-c C-n
908 @item C-c C-n
909 Next heading.
910 @kindex C-c C-p
911 @item C-c C-p
912 Previous heading.
913 @kindex C-c C-f
914 @item C-c C-f
915 Next heading same level.
916 @kindex C-c C-b
917 @item C-c C-b
918 Previous heading same level.
919 @kindex C-c C-u
920 @item C-c C-u
921 Backward to higher level heading.
922 @kindex C-c C-j
923 @item C-c C-j
924 Jump to a different place without changing the current outline
925 visibility.  Shows the document structure in a temporary buffer, where
926 you can use the following keys to find your destination:
927 @vindex org-goto-auto-isearch
928 @example
929 @key{TAB}         @r{Cycle visibility.}
930 @key{down} / @key{up}   @r{Next/previous visible headline.}
931 @key{RET}         @r{Select this location.}
932 @kbd{/}           @r{Do a Sparse-tree search}
933 @r{The following keys work if you turn off @code{org-goto-auto-isearch}}
934 n / p        @r{Next/previous visible headline.}
935 f / b        @r{Next/previous headline same level.}
936 u            @r{One level up.}
937 0-9          @r{Digit argument.}
938 q            @r{Quit}
939 @end example
940 @vindex org-goto-interface
941 @noindent
942 See also the variable @code{org-goto-interface}.
943 @end table
945 @node Structure editing, Archiving, Motion, Document Structure
946 @section Structure editing
947 @cindex structure editing
948 @cindex headline, promotion and demotion
949 @cindex promotion, of subtrees
950 @cindex demotion, of subtrees
951 @cindex subtree, cut and paste
952 @cindex pasting, of subtrees
953 @cindex cutting, of subtrees
954 @cindex copying, of subtrees
955 @cindex subtrees, cut and paste
957 @table @kbd
958 @kindex M-@key{RET}
959 @item M-@key{RET}
960 @vindex org-M-RET-may-split-line
961 Insert new heading with same level as current.  If the cursor is in a
962 plain list item, a new item is created (@pxref{Plain lists}).  To force
963 creation of a new headline, use a prefix argument, or first press @key{RET}
964 to get to the beginning of the next line.  When this command is used in
965 the middle of a line, the line is split and the rest of the line becomes
966 the new headline@footnote{If you do not want the line to be split,
967 customize the variable @code{org-M-RET-may-split-line}.}.  If the
968 command is used at the beginning of a headline, the new headline is
969 created before the current line.  If at the beginning of any other line,
970 the content of that line is made the new heading.  If the command is
971 used at the end of a folded subtree (@ie behind the ellipses at the end
972 of a headline), then a headline like the current one will be inserted
973 after the end of the subtree.
974 @kindex C-@key{RET}
975 @item C-@key{RET}
976 Just like @kbd{M-@key{RET}}, except when adding a new heading below the
977 current heading, the new heading is placed after the body instead of before
978 it.  This command works from anywhere in the entry.
979 @kindex M-S-@key{RET}
980 @item M-S-@key{RET}
981 @vindex org-treat-insert-todo-heading-as-state-change
982 Insert new TODO entry with same level as current heading.  See also the
983 variable @code{org-treat-insert-todo-heading-as-state-change}.
984 @kindex C-S-@key{RET}
985 @item C-S-@key{RET}
986 Insert new TODO entry with same level as current heading.  Like
987 @kbd{C-@key{RET}}, the new headline will be inserted after the current
988 subtree.
989 @kindex M-@key{left}
990 @item M-@key{left}
991 Promote current heading by one level.
992 @kindex M-@key{right}
993 @item M-@key{right}
994 Demote current heading by one level.
995 @kindex M-S-@key{left}
996 @item M-S-@key{left}
997 Promote the current subtree by one level.
998 @kindex M-S-@key{right}
999 @item M-S-@key{right}
1000 Demote the current subtree by one level.
1001 @kindex M-S-@key{up}
1002 @item M-S-@key{up}
1003 Move subtree up (swap with previous subtree of same
1004 level).
1005 @kindex M-S-@key{down}
1006 @item M-S-@key{down}
1007 Move subtree down (swap with next subtree of same level).
1008 @kindex C-c C-x C-w
1009 @item C-c C-x C-w
1010 Kill subtree, @ie remove it from buffer but save in kill ring.
1011 With a numeric prefix argument N, kill N sequential subtrees.
1012 @kindex C-c C-x M-w
1013 @item C-c C-x M-w
1014 Copy subtree to kill ring.  With a numeric prefix argument N, copy the N
1015 sequential subtrees.
1016 @kindex C-c C-x C-y
1017 @item C-c C-x C-y
1018 Yank subtree from kill ring.  This does modify the level of the subtree to
1019 make sure the tree fits in nicely at the yank position.  The yank level can
1020 also be specified with a numeric prefix argument, or by yanking after a
1021 headline marker like @samp{****}.
1022 @kindex C-y
1023 @item C-y
1024 @vindex org-yank-adjusted-subtrees
1025 @vindex org-yank-folded-subtrees
1026 Depending on the variables @code{org-yank-adjusted-subtrees} and
1027 @code{org-yank-folded-subtrees}, Org's internal @code{yank} command will
1028 paste subtrees folded and in a clever way, using the same command as @kbd{C-c
1029 C-x C-y}.  With the default settings, no level adjustment will take place,
1030 but the yanked tree will be folded unless doing so would swallow text
1031 previously visible.  Any prefix argument to this command will force a normal
1032 @code{yank} to be executed, with the prefix passed along.  A good way to
1033 force a normal yank is @kbd{C-u C-y}.  If you use @code{yank-pop} after a
1034 yank, it will yank previous kill items plainly, without adjustment and
1035 folding.
1036 @kindex C-c C-x c
1037 @item C-c C-x c
1038 Clone a subtree by making a number of sibling copies of it.  You will be
1039 prompted for the number of copies to make, and you can also specify if any
1040 timestamps in the entry should be shifted.  This can be useful, for example,
1041 to create a number of tasks related to a series of lectures to prepare.  For
1042 more details, see the docstring of the command
1043 @code{org-clone-subtree-with-time-shift}.
1044 @kindex C-c C-w
1045 @item C-c C-w
1046 Refile entry or region to a different location.  @xref{Refiling notes}.
1047 @kindex C-c ^
1048 @item C-c ^
1049 Sort same-level entries.  When there is an active region, all entries in the
1050 region will be sorted.  Otherwise the children of the current headline are
1051 sorted.  The command prompts for the sorting method, which can be
1052 alphabetically, numerically, by time (first timestamp with active preferred,
1053 creation time, scheduled time, deadline time), by priority, by TODO keyword
1054 (in the sequence the keywords have been defined in the setup) or by the value
1055 of a property.  Reverse sorting is possible as well.  You can also supply
1056 your own function to extract the sorting key.  With a @kbd{C-u} prefix,
1057 sorting will be case-sensitive.  With two @kbd{C-u C-u} prefixes, duplicate
1058 entries will also be removed.
1059 @kindex C-x n s
1060 @item C-x n s
1061 Narrow buffer to current subtree.
1062 @kindex C-x n w
1063 @item C-x n w
1064 Widen buffer to remove narrowing.
1065 @kindex C-c *
1066 @item C-c *
1067 Turn a normal line or plain list item into a headline (so that it becomes a
1068 subheading at its location).  Also turn a headline into a normal line by
1069 removing the stars.  If there is an active region, turn all lines in the
1070 region into headlines.  If the first line in the region was an item, turn
1071 only the item lines into headlines.  Finally, if the first line is a
1072 headline, remove the stars from all headlines in the region.
1073 @end table
1075 @cindex region, active
1076 @cindex active region
1077 @cindex transient mark mode
1078 When there is an active region (Transient Mark mode), promotion and
1079 demotion work on all headlines in the region.  To select a region of
1080 headlines, it is best to place both point and mark at the beginning of a
1081 line, mark at the beginning of the first headline, and point at the line
1082 just after the last headline to change.  Note that when the cursor is
1083 inside a table (@pxref{Tables}), the Meta-Cursor keys have different
1084 functionality.
1086 @node Archiving, Sparse trees, Structure editing, Document Structure
1087 @section Archiving
1088 @cindex archiving
1090 When a project represented by a (sub)tree is finished, you may want
1091 to move the tree out of the way and to stop it from contributing to the
1092 agenda.  Org mode knows two ways of archiving.  You can mark a tree with
1093 the ARCHIVE tag, or you can move an entire (sub)tree to a different
1094 location.
1096 @menu
1097 * ARCHIVE tag::                 Marking a tree as inactive
1098 * Moving subtrees::             Moving a tree to an archive file
1099 @end menu
1101 @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
1102 @subsection The ARCHIVE tag
1103 @cindex internal archiving
1105 A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
1106 its location in the outline tree, but behaves in the following way:
1107 @itemize @minus
1108 @item
1109 @vindex org-cycle-open-archived-trees
1110 It does not open when you attempt to do so with a visibility cycling
1111 command (@pxref{Visibility cycling}).  You can force cycling archived
1112 subtrees with @kbd{C-@key{TAB}}, or by setting the option
1113 @code{org-cycle-open-archived-trees}.  Also normal outline commands like
1114 @code{show-all} will open archived subtrees.
1115 @item
1116 @vindex org-sparse-tree-open-archived-trees
1117 During sparse tree construction (@pxref{Sparse trees}), matches in
1118 archived subtrees are not exposed, unless you configure the option
1119 @code{org-sparse-tree-open-archived-trees}.
1120 @item
1121 @vindex org-agenda-skip-archived-trees
1122 During agenda view construction (@pxref{Agenda Views}), the content of
1123 archived trees is ignored unless you configure the option
1124 @code{org-agenda-skip-archived-trees}, in which case these trees will always
1125 be included.  In the agenda you can press the @kbd{v} key to get archives
1126 temporarily included.
1127 @item
1128 @vindex org-export-with-archived-trees
1129 Archived trees are not exported (@pxref{Exporting}), only the headline
1130 is.  Configure the details using the variable
1131 @code{org-export-with-archived-trees}.
1132 @item
1133 @vindex org-columns-skip-arrchived-trees
1134 Archived trees are excluded from column view unless the variable
1135 @code{org-columns-skip-arrchived-trees} is configured to @code{nil}.
1136 @end itemize
1138 The following commands help managing the ARCHIVE tag:
1140 @table @kbd
1141 @kindex C-c C-x a
1142 @item C-c C-x a
1143 Toggle the ARCHIVE tag for the current headline.  When the tag is set,
1144 the headline changes to a shadowed face, and the subtree below it is
1145 hidden.
1146 @kindex C-u C-c C-x a
1147 @item C-u C-c C-x a
1148 Check if any direct children of the current headline should be archived.
1149 To do this, each subtree is checked for open TODO entries.  If none are
1150 found, the command offers to set the ARCHIVE tag for the child.  If the
1151 cursor is @emph{not} on a headline when this command is invoked, the
1152 level 1 trees will be checked.
1153 @kindex C-@kbd{TAB}
1154 @item C-@kbd{TAB}
1155 Cycle a tree even if it is tagged with ARCHIVE.
1156 @end table
1158 @node Moving subtrees,  , ARCHIVE tag, Archiving
1159 @subsection Moving subtrees
1160 @cindex external archiving
1162 Once an entire project is finished, you may want to move it to a different
1163 location.  Org can move it to an @emph{Archive Sibling} in the same tree, to a
1164 different tree in the current file, or to a different file, the archive file.
1166 @table @kbd
1167 @kindex C-c C-x A
1168 @item C-c C-x A
1169 Move the current entry to the @emph{Archive Sibling}.  This is a sibling of
1170 the entry with the heading @samp{Archive} and the tag @samp{ARCHIVE}
1171 (@pxref{ARCHIVE tag}).  The entry becomes a child of that sibling and in this
1172 way retains a lot of its original context, including inherited tags and
1173 approximate position in the outline.
1174 @kindex C-c $
1175 @kindex C-c C-x C-s
1176 @itemx C-c $
1177 @item C-c C-x C-s
1178 @vindex org-archive-location
1179 Archive the subtree starting at the cursor position to the location
1180 given by @code{org-archive-location}.  Context information that could be
1181 lost, like the file name, the category, inherited tags, and the TODO
1182 state will be stored as properties in the entry.
1183 @kindex C-u C-c C-x C-s
1184 @item C-u C-c C-x C-s
1185 Check if any direct children of the current headline could be moved to
1186 the archive.  To do this, each subtree is checked for open TODO entries.
1187 If none are found, the command offers to move it to the archive
1188 location.  If the cursor is @emph{not} on a headline when this command
1189 is invoked, the level 1 trees will be checked.
1190 @end table
1192 @cindex archive locations
1193 The default archive location is a file in the same directory as the
1194 current file, with the name derived by appending @file{_archive} to the
1195 current file name.  For information and examples on how to change this,
1196 see the documentation string of the variable
1197 @code{org-archive-location}.  There is also an in-buffer option for
1198 setting this variable, for example@footnote{For backward compatibility,
1199 the following also works: If there are several such lines in a file,
1200 each specifies the archive location for the text below it.  The first
1201 such line also applies to any text before its definition.  However,
1202 using this method is @emph{strongly} deprecated as it is incompatible
1203 with the outline structure of the document.  The correct method for
1204 setting multiple archive locations in a buffer is using properties.}:
1206 @cindex #+ARCHIVE
1207 @example
1208 #+ARCHIVE: %s_done::
1209 @end example
1211 @cindex property, ARCHIVE
1212 @noindent
1213 If you would like to have a special ARCHIVE location for a single entry
1214 or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
1215 location as the value (@pxref{Properties and Columns}).
1217 @vindex org-archive-save-context-info
1218 When a subtree is moved, it receives a number of special properties that
1219 record context information like the file from where the entry came, its
1220 outline path the archiving time etc.  Configure the variable
1221 @code{org-archive-save-context-info} to adjust the amount of information
1222 added.
1224 @node Sparse trees, Plain lists, Archiving, Document Structure
1225 @section Sparse trees
1226 @cindex sparse trees
1227 @cindex trees, sparse
1228 @cindex folding, sparse trees
1229 @cindex occur, command
1231 @vindex org-show-hierarchy-above
1232 @vindex org-show-following-heading
1233 @vindex org-show-siblings
1234 @vindex org-show-entry-below
1235 An important feature of Org mode is the ability to construct @emph{sparse
1236 trees} for selected information in an outline tree, so that the entire
1237 document is folded as much as possible, but the selected information is made
1238 visible along with the headline structure above it@footnote{See also the
1239 variables @code{org-show-hierarchy-above}, @code{org-show-following-heading},
1240 @code{org-show-siblings}, and @code{org-show-entry-below} for detailed
1241 control on how much context is shown around each match.}.  Just try it out
1242 and you will see immediately how it works.
1244 Org mode contains several commands creating such trees, all these
1245 commands can be accessed through a dispatcher:
1247 @table @kbd
1248 @kindex C-c /
1249 @item C-c /
1250 This prompts for an extra key to select a sparse-tree creating command.
1251 @kindex C-c / r
1252 @item C-c / r
1253 @vindex org-remove-highlights-with-change
1254 Occur.  Prompts for a regexp and shows a sparse tree with all matches.  If
1255 the match is in a headline, the headline is made visible.  If the match is in
1256 the body of an entry, headline and body are made visible.  In order to
1257 provide minimal context, also the full hierarchy of headlines above the match
1258 is shown, as well as the headline following the match.  Each match is also
1259 highlighted; the highlights disappear when the buffer is changed by an
1260 editing command@footnote{This depends on the option
1261 @code{org-remove-highlights-with-change}}, or by pressing @kbd{C-c C-c}.
1262 When called with a @kbd{C-u} prefix argument, previous highlights are kept,
1263 so several calls to this command can be stacked.
1264 @end table
1266 @noindent
1267 @vindex org-agenda-custom-commands
1268 For frequently used sparse trees of specific search strings, you can
1269 use the variable @code{org-agenda-custom-commands} to define fast
1270 keyboard access to specific sparse trees.  These commands will then be
1271 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
1272 For example:
1274 @lisp
1275 (setq org-agenda-custom-commands
1276       '(("f" occur-tree "FIXME")))
1277 @end lisp
1279 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
1280 a sparse tree matching the string @samp{FIXME}.
1282 The other sparse tree commands select headings based on TODO keywords,
1283 tags, or properties and will be discussed later in this manual.
1285 @kindex C-c C-e v
1286 @cindex printing sparse trees
1287 @cindex visible text, printing
1288 To print a sparse tree, you can use the Emacs command
1289 @code{ps-print-buffer-with-faces} which does not print invisible parts
1290 of the document @footnote{This does not work under XEmacs, because
1291 XEmacs uses selective display for outlining, not text properties.}.
1292 Or you can use the command @kbd{C-c C-e v} to export only the visible
1293 part of the document and print the resulting file.
1295 @node Plain lists, Drawers, Sparse trees, Document Structure
1296 @section Plain lists
1297 @cindex plain lists
1298 @cindex lists, plain
1299 @cindex lists, ordered
1300 @cindex ordered lists
1302 Within an entry of the outline tree, hand-formatted lists can provide
1303 additional structure.  They also provide a way to create lists of
1304 checkboxes (@pxref{Checkboxes}).  Org supports editing such lists,
1305 and the HTML exporter (@pxref{Exporting}) parses and formats them.
1307 Org knows ordered lists, unordered lists, and description lists.
1308 @itemize @bullet
1309 @item
1310 @emph{Unordered} list items start with @samp{-}, @samp{+}, or
1311 @samp{*}@footnote{When using @samp{*} as a bullet, lines must be indented or
1312 they will be seen as top-level headlines.  Also, when you are hiding leading
1313 stars to get a clean outline view, plain list items starting with a star are
1314 visually indistinguishable from true headlines.  In short: even though
1315 @samp{*} is supported, it may be better to not use it for plain list items.}
1316 as bullets.
1317 @item
1318 @emph{Ordered} list items start with a numeral followed by either a period or
1319 a right parenthesis, such as @samp{1.} or @samp{1)}.
1320 @item
1321 @emph{Description} list items are like unordered list items, but contain the
1322 separator @samp{ :: } to separate the description @emph{term} from the
1323 description.
1324 @end itemize
1326 @vindex org-empty-line-terminates-plain-lists
1327 Items belonging to the same list must have the same indentation on the first
1328 line.  In particular, if an ordered list reaches number @samp{10.}, then the
1329 2--digit numbers must be written left-aligned with the other numbers in the
1330 list.  Indentation also determines the end of a list item.  It ends before
1331 the next line that is indented like the bullet/number, or less.  Empty lines
1332 are part of the previous item, so you can have several paragraphs in one
1333 item.  If you would like an empty line to terminate all currently open plain
1334 lists, configure the variable @code{org-empty-line-terminates-plain-lists}.
1335 Here is an example:
1337 @example
1338 @group
1339 ** Lord of the Rings
1340    My favorite scenes are (in this order)
1341    1. The attack of the Rohirrim
1342    2. Eowyn's fight with the witch king
1343       + this was already my favorite scene in the book
1344       + I really like Miranda Otto.
1345    3. Peter Jackson being shot by Legolas
1346        - on DVD only
1347       He makes a really funny face when it happens.
1348    But in the end, no individual scenes matter but the film as a whole.
1349    Important actors in this film are:
1350    - @b{Elijah Wood} :: He plays Frodo
1351    - @b{Sean Austin} :: He plays Sam, Frodo's friend.  I still remember
1352      him very well from his role as Mikey Walsh in @i{The Goonies}.
1353 @end group
1354 @end example
1356 Org supports these lists by tuning filling and wrapping commands to deal with
1357 them correctly@footnote{Org only changes the filling settings for Emacs.  For
1358 XEmacs, you should use Kyle E. Jones' @file{filladapt.el}.  To turn this on,
1359 put into @file{.emacs}: @code{(require 'filladapt)}}, and by exporting them
1360 properly (@pxref{Exporting}).  Since indentation is what governs the
1361 structure of these lists, many structural constructs like @code{#+BEGIN_...}
1362 blocks can be indented to signal that they should be part of a list item.
1364 The following commands act on items when the cursor is in the first line
1365 of an item (the line with the bullet or number).
1367 @table @kbd
1368 @kindex @key{TAB}
1369 @item @key{TAB}
1370 @vindex org-cycle-include-plain-lists
1371 Items can be folded just like headline levels.  Normally this works only if
1372 the cursor is on a plain list item.  For more details, see the variable
1373 @code{org-cycle-include-plain-lists}. to @code{integrate}, plain list items
1374 will be treated like low-level.  The level of an item is then given by the
1375 indentation of the bullet/number.  Items are always subordinate to real
1376 headlines, however; the hierarchies remain completely separated.
1378 If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
1379 fixes the indentation of the current line in a heuristic way.
1380 @kindex M-@key{RET}
1381 @item M-@key{RET}
1382 @vindex org-M-RET-may-split-line
1383 Insert new item at current level.  With a prefix argument, force a new
1384 heading (@pxref{Structure editing}).  If this command is used in the middle
1385 of a line, the line is @emph{split} and the rest of the line becomes the new
1386 item@footnote{If you do not want the line to be split, customize the variable
1387 @code{org-M-RET-may-split-line}.}.  If this command is executed in the
1388 @emph{whitespace before a bullet or number}, the new item is created
1389 @emph{before} the current item.  If the command is executed in the white
1390 space before the text that is part of an item but does not contain the
1391 bullet, a bullet is added to the current line.
1392 @kindex M-S-@key{RET}
1393 @item M-S-@key{RET}
1394 Insert a new item with a checkbox (@pxref{Checkboxes}).
1395 @kindex S-@key{up}
1396 @kindex S-@key{down}
1397 @item S-@key{up}
1398 @itemx S-@key{down}
1399 @cindex shift-selection-mode
1400 @vindex org-support-shift-select
1401 Jump to the previous/next item in the current list, but only if
1402 @code{org-support-shift-select} is off.  If not, you can still use paragraph
1403 jumping commands like @kbd{C-@key{up}} and @kbd{C-@key{down}} to quite
1404 similar effect.
1405 @kindex M-S-@key{up}
1406 @kindex M-S-@key{down}
1407 @item M-S-@key{up}
1408 @itemx M-S-@key{down}
1409 Move the item including subitems up/down (swap with previous/next item
1410 of same indentation).  If the list is ordered, renumbering is
1411 automatic.
1412 @kindex M-S-@key{left}
1413 @kindex M-S-@key{right}
1414 @item M-S-@key{left}
1415 @itemx M-S-@key{right}
1416 Decrease/increase the indentation of the item, including subitems.
1417 Initially, the item tree is selected based on current indentation.
1418 When these commands are executed several times in direct succession,
1419 the initially selected region is used, even if the new indentation
1420 would imply a different hierarchy.  To use the new hierarchy, break
1421 the command chain with a cursor motion or so.
1422 @kindex C-c C-c
1423 @item C-c C-c
1424 If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
1425 state of the checkbox.  If not, this command makes sure that all the
1426 items on this list level use the same bullet.  Furthermore, if this is
1427 an ordered list, make sure the numbering is OK.
1428 @kindex C-c -
1429 @item C-c -
1430 Cycle the entire list level through the different itemize/enumerate bullets
1431 (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}).  With a numeric prefix
1432 argument N, select the Nth bullet from this list.  If there is an active
1433 region when calling this, all lines will be converted to list items.  If the
1434 first line already was a list item, any item markers will be removed from the
1435 list.  Finally, even without an active region, a normal line will be
1436 converted into a list item.
1437 @kindex S-@key{left}
1438 @kindex S-@key{right}
1439 @item S-@key{left}/@key{right}
1440 @vindex org-support-shift-select
1441 This command also cycles bullet styles when the cursor in on the bullet or
1442 anywhere in an item line, details depending on
1443 @code{org-support-shift-select}.
1444 @kindex C-c ^
1445 @item C-c ^
1446 Sort the plain list.  You will be prompted for the sorting method:
1447 numerically, alphabetically, by time, or by custom function.
1448 @end table
1450 @node Drawers, Blocks, Plain lists, Document Structure
1451 @section Drawers
1452 @cindex drawers
1453 @cindex #+DRAWERS
1454 @cindex visibility cycling, drawers
1456 @vindex org-drawers
1457 Sometimes you want to keep information associated with an entry, but you
1458 normally don't want to see it.  For this, Org mode has @emph{drawers}.
1459 Drawers need to be configured with the variable
1460 @code{org-drawers}@footnote{You can define drawers on a per-file basis
1461 with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}.  Drawers
1462 look like this:
1464 @example
1465 ** This is a headline
1466    Still outside the drawer
1467    :DRAWERNAME:
1468       This is inside the drawer.
1469    :END:
1470    After the drawer.
1471 @end example
1473 Visibility cycling (@pxref{Visibility cycling}) on the headline will hide and
1474 show the entry, but keep the drawer collapsed to a single line.  In order to
1475 look inside the drawer, you need to move the cursor to the drawer line and
1476 press @key{TAB} there.  Org mode uses the @code{PROPERTIES} drawer for
1477 storing properties (@pxref{Properties and Columns}), and you can also arrange
1478 for state change notes (@pxref{Tracking TODO state changes}) and clock times
1479 (@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}.
1481 @node Blocks, Footnotes, Drawers, Document Structure
1482 @section Blocks
1484 @vindex org-hide-block-startup
1485 @cindex blocks, folding
1486 Org-mode uses begin...end blocks for various purposes from including source
1487 code examples (@pxref{Literal examples}) to capturing time logging
1488 information (@pxref{Clocking work time}).  These blocks can be folded and
1489 unfolded by pressing TAB in the begin line.  You can also get all blocks
1490 folded at startup by configuring the variable @code{org-hide-block-startup}
1491 or on a per-file basis by using
1493 @cindex @code{hideblocks}, STARTUP keyword
1494 @cindex @code{nohideblocks}, STARTUP keyword
1495 @example
1496 #+STARTUP: hideblocks
1497 #+STARTUP: nohideblocks
1498 @end example
1500 @node Footnotes, Orgstruct mode, Blocks, Document Structure
1501 @section Footnotes
1502 @cindex footnotes
1504 Org mode supports the creation of footnotes.  In contrast to the
1505 @file{footnote.el} package, Org mode's footnotes are designed for work on a
1506 larger document, not only for one-off documents like emails.  The basic
1507 syntax is similar to the one used by @file{footnote.el}, @ie a footnote is
1508 defined in a paragraph that is started by a footnote marker in square
1509 brackets in column 0, no indentation allowed.  If you need a paragraph break
1510 inside a footnote, use the La@TeX{} idiom @samp{\par}.  The footnote reference
1511 is simply the marker in square brackets, inside text.  For example:
1513 @example
1514 The Org homepage[fn:1] now looks a lot better than it used to.
1516 [fn:1] The link is: http://orgmode.org
1517 @end example
1519 Org mode extends the number-based syntax to @emph{named} footnotes and
1520 optional inline definition.  Using plain numbers as markers (as
1521 @file{footnote.el} does) is supported for backward compatibility, but not
1522 encouraged because of possible conflicts with La@TeX{} snippets (@pxref{Embedded
1523 LaTeX}).  Here are the valid references:
1525 @table @code
1526 @item [1]
1527 A plain numeric footnote marker.  Compatible with @file{footnote.el}, but not
1528 recommended because somthing like @samp{[1]} could easily be part of a code
1529 snippet.
1530 @item [fn:name]
1531 A named footnote reference, where @code{name} is a unique label word, or, for
1532 simplicity of automatic creation, a number.
1533 @item [fn:: This is the inline definition of this footnote]
1534 A La@TeX{}-like anonymous footnote where the definition is given directly at the
1535 reference point.
1536 @item [fn:name: a definition]
1537 An inline definition of a footnote, which also specifies a name for the note.
1538 Since Org allows multiple references to the same note, you can then use
1539 @code{[fn:name]} to create additional references.
1540 @end table
1542 @vindex org-footnote-auto-label
1543 Footnote labels can be created automatically, or you can create names yourself.
1544 This is handled by the variable @code{org-footnote-auto-label} and its
1545 corresponding @code{#+STARTUP} keywords, see the docstring of that variable
1546 for details.
1548 @noindent The following command handles footnotes:
1550 @table @kbd
1551 @kindex C-c C-x f
1552 @item C-c C-x f
1553 The footnote action command.
1555 When the cursor is on a footnote reference, jump to the definition.  When it
1556 is at a definition, jump to the (first) reference.
1558 @vindex org-footnote-define-inline
1559 @vindex org-footnote-section
1560 @vindex org-footnote-auto-adjust
1561 Otherwise, create a new footnote.  Depending on the variable
1562 @code{org-footnote-define-inline}@footnote{The corresponding in-buffer
1563 setting is: @code{#+STARTUP: fninline} or @code{#+STARTUP: nofninline}}, the
1564 definition will be placed right into the text as part of the reference, or
1565 separately into the location determined by the variable
1566 @code{org-footnote-section}.
1568 When this command is called with a prefix argument, a menu of additional
1569 options is offered:
1570 @example
1571 s   @r{Sort the footnote definitions by reference sequence.  During editing,}
1572     @r{Org makes no effort to sort footnote definitions into a particular}
1573     @r{sequence.  If you want them sorted, use this command, which will}
1574     @r{also move entries according to @code{org-footnote-section}.  Automatic}
1575     @r{sorting after each insertion/deletion can be configured using the}
1576     @r{variable @code{org-footnote-auto-adjust}.}
1577 r   @r{Renumber the simple @code{fn:N} footnotes.  Automatic renumbering}
1578     @r{after each insertion/deletion can be configured using the variable}
1579     @r{@code{org-footnote-auto-adjust}.}
1580 S   @r{Short for first @code{r}, then @code{s} action.}
1581 n   @r{Normalize the footnotes by collecting all definitions (including}
1582     @r{inline definitions) into a special section, and then numbering them}
1583     @r{in sequence.  The references will then also be numbers.  This is}
1584     @r{meant to be the final step before finishing a document (e.g. sending}
1585     @r{off an email).  The exporters do this automatically, and so could}
1586     @r{something like @code{message-send-hook}.}
1587 d   @r{Delete the footnote at point, and all definitions of and references}
1588     @r{to it.}
1589 @end example
1590 Depending on the variable @code{org-footnote-auto-adjust}@footnote{the
1591 corresponding in-buffer options are @code{fnadjust} and @code{nofnadjust}.},
1592 renumbering and sorting footnotes can be automatic after each insertion or
1593 deletion.
1595 @kindex C-c C-c
1596 @item C-c C-c
1597 If the cursor is on a footnote reference, jump to the definition.  If it is a
1598 the definition, jump back to the reference.  When called at a footnote
1599 location with a prefix argument, offer the same menu as @kbd{C-c C-x f}.
1600 @kindex C-c C-o
1601 @kindex mouse-1
1602 @kindex mouse-2
1603 @item C-c C-o  @r{or} mouse-1/2
1604 Footnote labels are also links to the corresponding definition/reference, and
1605 you can use the usual commands to follow these links.
1606 @end table
1608 @node Orgstruct mode,  , Footnotes, Document Structure
1609 @section The Orgstruct minor mode
1610 @cindex Orgstruct mode
1611 @cindex minor mode for structure editing
1613 If you like the intuitive way the Org mode structure editing and list
1614 formatting works, you might want to use these commands in other modes like
1615 Text mode or Mail mode as well.  The minor mode @code{orgstruct-mode} makes
1616 this possible.   Toggle the mode with @kbd{M-x orgstruct-mode}, or
1617 turn it on by default, for example in Mail mode, with one of:
1619 @lisp
1620 (add-hook 'mail-mode-hook 'turn-on-orgstruct)
1621 (add-hook 'mail-mode-hook 'turn-on-orgstruct++)
1622 @end lisp
1624 When this mode is active and the cursor is on a line that looks to Org like a
1625 headline or the first line of a list item, most structure editing commands
1626 will work, even if the same keys normally have different functionality in the
1627 major mode you are using.  If the cursor is not in one of those special
1628 lines, Orgstruct mode lurks silently in the shadow.  When you use
1629 @code{orgstruct++-mode}, Org will also export indentation and autofill
1630 settings into that mode, and detect item context after the first line of an
1631 item.
1633 @node Tables, Hyperlinks, Document Structure, Top
1634 @chapter Tables
1635 @cindex tables
1636 @cindex editing tables
1638 Org comes with a fast and intuitive table editor.  Spreadsheet-like
1639 calculations are supported in connection with the Emacs @file{calc}
1640 package
1641 @ifinfo
1642 (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
1643 @end ifinfo
1644 @ifnotinfo
1645 (see the Emacs Calculator manual for more information about the Emacs
1646 calculator).
1647 @end ifnotinfo
1649 @menu
1650 * Built-in table editor::       Simple tables
1651 * Column width and alignment::  Overrule the automatic settings
1652 * Column groups::               Grouping to trigger vertical lines
1653 * Orgtbl mode::                 The table editor as minor mode
1654 * The spreadsheet::             The table editor has spreadsheet capabilities
1655 * Org-Plot::                    Plotting from org tables
1656 @end menu
1658 @node Built-in table editor, Column width and alignment, Tables, Tables
1659 @section The built-in table editor
1660 @cindex table editor, built-in
1662 Org makes it easy to format tables in plain ASCII.  Any line with
1663 @samp{|} as the first non-whitespace character is considered part of a
1664 table.  @samp{|} is also the column separator.  A table might look like
1665 this:
1667 @example
1668 | Name  | Phone | Age |
1669 |-------+-------+-----|
1670 | Peter |  1234 |  17 |
1671 | Anna  |  4321 |  25 |
1672 @end example
1674 A table is re-aligned automatically each time you press @key{TAB} or
1675 @key{RET} or @kbd{C-c C-c} inside the table.  @key{TAB} also moves to
1676 the next field (@key{RET} to the next row) and creates new table rows
1677 at the end of the table or before horizontal lines.  The indentation
1678 of the table is set by the first line.  Any line starting with
1679 @samp{|-} is considered as a horizontal separator line and will be
1680 expanded on the next re-align to span the whole table width.  So, to
1681 create the above table, you would only type
1683 @example
1684 |Name|Phone|Age|
1686 @end example
1688 @noindent and then press @key{TAB} to align the table and start filling in
1689 fields.  Even faster would be to type @code{|Name|Phone|Age} followed by
1690 @kbd{C-c @key{RET}}.
1692 @vindex org-enable-table-editor
1693 @vindex org-table-auto-blank-field
1694 When typing text into a field, Org treats @key{DEL},
1695 @key{Backspace}, and all character keys in a special way, so that
1696 inserting and deleting avoids shifting other fields.  Also, when
1697 typing @emph{immediately after the cursor was moved into a new field
1698 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
1699 field is automatically made blank.  If this behavior is too
1700 unpredictable for you, configure the variables
1701 @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
1703 @table @kbd
1704 @tsubheading{Creation and conversion}
1705 @kindex C-c |
1706 @item C-c |
1707 Convert the active region to table. If every line contains at least one
1708 TAB character, the function assumes that the material is tab separated.
1709 If every line contains a comma, comma-separated values (CSV) are assumed.
1710 If not, lines are split at whitespace into fields.  You can use a prefix
1711 argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
1712 C-u} forces TAB, and a numeric argument N indicates that at least N
1713 consecutive spaces, or alternatively a TAB will be the separator.
1715 If there is no active region, this command creates an empty Org
1716 table.  But it's easier just to start typing, like
1717 @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
1719 @tsubheading{Re-aligning and field motion}
1720 @kindex C-c C-c
1721 @item C-c C-c
1722 Re-align the table without moving the cursor.
1724 @kindex @key{TAB}
1725 @item @key{TAB}
1726 Re-align the table, move to the next field.  Creates a new row if
1727 necessary.
1729 @kindex S-@key{TAB}
1730 @item S-@key{TAB}
1731 Re-align, move to previous field.
1733 @kindex @key{RET}
1734 @item @key{RET}
1735 Re-align the table and move down to next row.  Creates a new row if
1736 necessary.  At the beginning or end of a line, @key{RET} still does
1737 NEWLINE, so it can be used to split a table.
1739 @kindex M-a
1740 @item M-a
1741 Move to beginning of the current table field, or on to the previous field.
1742 @kindex M-e
1743 @item M-e
1744 Move to end of the current table field, or on to the next field.
1746 @tsubheading{Column and row editing}
1747 @kindex M-@key{left}
1748 @kindex M-@key{right}
1749 @item M-@key{left}
1750 @itemx M-@key{right}
1751 Move the current column left/right.
1753 @kindex M-S-@key{left}
1754 @item M-S-@key{left}
1755 Kill the current column.
1757 @kindex M-S-@key{right}
1758 @item M-S-@key{right}
1759 Insert a new column to the left of the cursor position.
1761 @kindex M-@key{up}
1762 @kindex M-@key{down}
1763 @item M-@key{up}
1764 @itemx M-@key{down}
1765 Move the current row up/down.
1767 @kindex M-S-@key{up}
1768 @item M-S-@key{up}
1769 Kill the current row or horizontal line.
1771 @kindex M-S-@key{down}
1772 @item M-S-@key{down}
1773 Insert a new row above the current row.  With a prefix argument, the line is
1774 created below the current one.
1776 @kindex C-c -
1777 @item C-c -
1778 Insert a horizontal line below current row.  With a prefix argument, the line
1779 is created above the current line.
1781 @kindex C-c @key{RET}
1782 @item C-c @key{RET}
1783 Insert a horizontal line below current row, and move the cursor into the row
1784 below that line.
1786 @kindex C-c ^
1787 @item C-c ^
1788 Sort the table lines in the region.  The position of point indicates the
1789 column to be used for sorting, and the range of lines is the range
1790 between the nearest horizontal separator lines, or the entire table.  If
1791 point is before the first column, you will be prompted for the sorting
1792 column.  If there is an active region, the mark specifies the first line
1793 and the sorting column, while point should be in the last line to be
1794 included into the sorting.  The command prompts for the sorting type
1795 (alphabetically, numerically, or by time).  When called with a prefix
1796 argument, alphabetic sorting will be case-sensitive.
1798 @tsubheading{Regions}
1799 @kindex C-c C-x M-w
1800 @item C-c C-x M-w
1801 Copy a rectangular region from a table to a special clipboard.  Point
1802 and mark determine edge fields of the rectangle.  The process ignores
1803 horizontal separator lines.
1805 @kindex C-c C-x C-w
1806 @item C-c C-x C-w
1807 Copy a rectangular region from a table to a special clipboard, and
1808 blank all fields in the rectangle.  So this is the ``cut'' operation.
1810 @kindex C-c C-x C-y
1811 @item C-c C-x C-y
1812 Paste a rectangular region into a table.
1813 The upper left corner ends up in the current field.  All involved fields
1814 will be overwritten.  If the rectangle does not fit into the present table,
1815 the table is enlarged as needed.  The process ignores horizontal separator
1816 lines.
1818 @kindex M-@key{RET}
1819 @itemx M-@kbd{RET}
1820 Wrap several fields in a column like a paragraph.  If there is an active
1821 region, and both point and mark are in the same column, the text in the
1822 column is wrapped to minimum width for the given number of lines.  A numeric
1823 prefix argument may be used to change the number of desired lines.  If there
1824 is no region, the current field is split at the cursor position and the text
1825 fragment to the right of the cursor is prepended to the field one line
1826 down. If there is no region, but you specify a prefix argument, the current
1827 field is made blank, and the content is appended to the field above.
1829 @tsubheading{Calculations}
1830 @cindex formula, in tables
1831 @cindex calculations, in tables
1832 @cindex region, active
1833 @cindex active region
1834 @cindex transient mark mode
1835 @kindex C-c +
1836 @item C-c +
1837 Sum the numbers in the current column, or in the rectangle defined by
1838 the active region.  The result is shown in the echo area and can
1839 be inserted with @kbd{C-y}.
1841 @kindex S-@key{RET}
1842 @item S-@key{RET}
1843 @vindex org-table-copy-increment
1844 When current field is empty, copy from first non-empty field above.  When not
1845 empty, copy current field down to next row and move cursor along with it.
1846 Depending on the variable @code{org-table-copy-increment}, integer field
1847 values will be incremented during copy.  Integers that are too large will not
1848 be incremented.  Also, a @code{0} prefix argument temporarily disables the
1849 increment.  This key is also used by shift-selection and related modes
1850 (@pxref{Conflicts}).
1852 @tsubheading{Miscellaneous}
1853 @kindex C-c `
1854 @item C-c `
1855 Edit the current field in a separate window.  This is useful for fields that
1856 are not fully visible (@pxref{Column width and alignment}).  When called with
1857 a @kbd{C-u} prefix, just make the full field visible, so that it can be
1858 edited in place.
1860 @item M-x org-table-import
1861 Import a file as a table.  The table should be TAB or whitespace
1862 separated.  Use, for example, to import a spreadsheet table or data
1863 from a database, because these programs generally can write
1864 TAB-separated text files.  This command works by inserting the file into
1865 the buffer and then converting the region to a table.  Any prefix
1866 argument is passed on to the converter, which uses it to determine the
1867 separator.
1868 @item C-c |
1869 Tables can also be imported by pasting tabular text into the Org
1870 buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
1871 @kbd{C-c |} command (see above under @i{Creation and conversion}).
1873 @item M-x org-table-export
1874 @vindex org-table-export-default-format
1875 Export the table, by default as a TAB-separated file.  Use for data
1876 exchange with, for example, spreadsheet or database programs.  The format
1877 used to export the file can be configured in the variable
1878 @code{org-table-export-default-format}.  You may also use properties
1879 @code{TABLE_EXPORT_FILE} and @code{TABLE_EXPORT_FORMAT} to specify the file
1880 name and the format for table export in a subtree.  Org supports quite
1881 general formats for exported tables.  The exporter format is the same as the
1882 format used by Orgtbl radio tables, see @ref{Translator functions}, for a
1883 detailed description.
1884 @end table
1886 If you don't like the automatic table editor because it gets in your
1887 way on lines which you would like to start with @samp{|}, you can turn
1888 it off with
1890 @lisp
1891 (setq org-enable-table-editor nil)
1892 @end lisp
1894 @noindent Then the only table command that still works is
1895 @kbd{C-c C-c} to do a manual re-align.
1897 @node Column width and alignment, Column groups, Built-in table editor, Tables
1898 @section Column width and alignment
1899 @cindex narrow columns in tables
1900 @cindex alignment in tables
1902 The width of columns is automatically determined by the table editor.  And
1903 also the alignment of a column is determined automatically from the fraction
1904 of number-like versus non-number fields in the column.
1906 Sometimes a single field or a few fields need to carry more text,
1907 leading to inconveniently wide columns.  To limit@footnote{This feature
1908 does not work on XEmacs.} the width of a column, one field anywhere in
1909 the column may contain just the string @samp{<N>} where @samp{N} is an
1910 integer specifying the width of the column in characters.  The next
1911 re-align will then set the width of this column to no more than this
1912 value.
1914 @example
1915 @group
1916 |---+------------------------------|               |---+--------|
1917 |   |                              |               |   | <6>    |
1918 | 1 | one                          |               | 1 | one    |
1919 | 2 | two                          |     ----\     | 2 | two    |
1920 | 3 | This is a long chunk of text |     ----/     | 3 | This=> |
1921 | 4 | four                         |               | 4 | four   |
1922 |---+------------------------------|               |---+--------|
1923 @end group
1924 @end example
1926 @noindent
1927 Fields that are wider become clipped and end in the string @samp{=>}.
1928 Note that the full text is still in the buffer, it is only invisible.
1929 To see the full text, hold the mouse over the field---a tool-tip window
1930 will show the full content.  To edit such a field, use the command
1931 @kbd{C-c `} (that is @kbd{C-c} followed by the backquote).  This will
1932 open a new window with the full field.  Edit it and finish with @kbd{C-c
1933 C-c}.
1935 @vindex org-startup-align-all-tables
1936 When visiting a file containing a table with narrowed columns, the
1937 necessary character hiding has not yet happened, and the table needs to
1938 be aligned before it looks nice.  Setting the option
1939 @code{org-startup-align-all-tables} will realign all tables in a file
1940 upon visiting, but also slow down startup.  You can also set this option
1941 on a per-file basis with:
1943 @example
1944 #+STARTUP: align
1945 #+STARTUP: noalign
1946 @end example
1948 If you would like to overrule the automatic alignment of number-rich columns
1949 to the right and of string-rich column to the left, you and use @samp{<r>} or
1950 @samp{<l>} in a similar fashion.  You may also combine alignment and field
1951 width like this: @samp{<l10>}.
1953 @node Column groups, Orgtbl mode, Column width and alignment, Tables
1954 @section Column groups
1955 @cindex grouping columns in tables
1957 When Org exports tables, it does so by default without vertical
1958 lines because that is visually more satisfying in general.  Occasionally
1959 however, vertical lines can be useful to structure a table into groups
1960 of columns, much like horizontal lines can do for groups of rows.  In
1961 order to specify column groups, you can use a special row where the
1962 first field contains only @samp{/}.  The further fields can either
1963 contain @samp{<} to indicate that this column should start a group,
1964 @samp{>} to indicate the end of a column, or @samp{<>} to make a column
1965 a group of its own.  Boundaries between column groups will upon export be
1966 marked with vertical lines.  Here is an example:
1968 @example
1969 |   |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1970 |---+----+-----+-----+-----+---------+------------|
1971 | / | <> |   < |     |   > |       < |          > |
1972 | # |  1 |   1 |   1 |   1 |       1 |          1 |
1973 | # |  2 |   4 |   8 |  16 |  1.4142 |     1.1892 |
1974 | # |  3 |   9 |  27 |  81 |  1.7321 |     1.3161 |
1975 |---+----+-----+-----+-----+---------+------------|
1976 #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2)))
1977 @end example
1979 It is also sufficient to just insert the column group starters after
1980 every vertical line you'd like to have:
1982 @example
1983 |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1984 |----+-----+-----+-----+---------+------------|
1985 | /  | <   |     |     | <       |            |
1986 @end example
1988 @node Orgtbl mode, The spreadsheet, Column groups, Tables
1989 @section The Orgtbl minor mode
1990 @cindex Orgtbl mode
1991 @cindex minor mode for tables
1993 If you like the intuitive way the Org table editor works, you
1994 might also want to use it in other modes like Text mode or Mail mode.
1995 The minor mode Orgtbl mode makes this possible.  You can always toggle
1996 the mode with @kbd{M-x orgtbl-mode}.  To turn it on by default, for
1997 example in mail mode, use
1999 @lisp
2000 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
2001 @end lisp
2003 Furthermore, with some special setup, it is possible to maintain tables
2004 in arbitrary syntax with Orgtbl mode.  For example, it is possible to
2005 construct La@TeX{} tables with the underlying ease and power of
2006 Orgtbl mode, including spreadsheet capabilities.  For details, see
2007 @ref{Tables in arbitrary syntax}.
2009 @node The spreadsheet, Org-Plot, Orgtbl mode, Tables
2010 @section The spreadsheet
2011 @cindex calculations, in tables
2012 @cindex spreadsheet capabilities
2013 @cindex @file{calc} package
2015 The table editor makes use of the Emacs @file{calc} package to implement
2016 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms to
2017 derive fields from other fields.  While fully featured, Org's
2018 implementation is not identical to other spreadsheets.  For example,
2019 Org knows the concept of a @emph{column formula} that will be
2020 applied to all non-header fields in a column without having to copy the
2021 formula to each relevant field.
2023 @menu
2024 * References::                  How to refer to another field or range
2025 * Formula syntax for Calc::     Using Calc to compute stuff
2026 * Formula syntax for Lisp::     Writing formulas in Emacs Lisp
2027 * Field formulas::              Formulas valid for a single field
2028 * Column formulas::             Formulas valid for an entire column
2029 * Editing and debugging formulas::  Fixing formulas
2030 * Updating the table::          Recomputing all dependent fields
2031 * Advanced features::           Field names, parameters and automatic recalc
2032 @end menu
2034 @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
2035 @subsection References
2036 @cindex references
2038 To compute fields in the table from other fields, formulas must
2039 reference other fields or ranges.  In Org, fields can be referenced
2040 by name, by absolute coordinates, and by relative coordinates.  To find
2041 out what the coordinates of a field are, press @kbd{C-c ?} in that
2042 field, or press @kbd{C-c @}} to toggle the display of a grid.
2044 @subsubheading Field references
2045 @cindex field references
2046 @cindex references, to fields
2048 Formulas can reference the value of another field in two ways.  Like in
2049 any other spreadsheet, you may reference fields with a letter/number
2050 combination like @code{B3}, meaning the 2nd field in the 3rd row.
2051 @c Such references are always fixed to that field, they don't change
2052 @c when you copy and paste a formula to a different field.  So
2053 @c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
2055 @noindent
2056 Org also uses another, more general operator that looks like this:
2057 @example
2058 @@@var{row}$@var{column}
2059 @end example
2061 @noindent
2062 Column references can be absolute like @samp{1}, @samp{2},...@samp{@var{N}},
2063 or relative to the current column like @samp{+1} or @samp{-2}.
2065 The row specification only counts data lines and ignores horizontal
2066 separator lines (hlines).  You can use absolute row numbers
2067 @samp{1}...@samp{@var{N}}, and row numbers relative to the current row like
2068 @samp{+3} or @samp{-1}.  Or specify the row relative to one of the
2069 hlines: @samp{I} refers to the first hline@footnote{Note that only
2070 hlines are counted that @emph{separate} table lines.  If the table
2071 starts with a hline above the header, it does not count.}, @samp{II} to
2072 the second, etc@.  @samp{-I} refers to the first such line above the
2073 current line, @samp{+I} to the first such line below the current line.
2074 You can also write @samp{III+2} which is the second data line after the
2075 third hline in the table.  Relative row numbers like @samp{-3} will not
2076 cross hlines if the current line is too close to the hline.  Instead,
2077 the value directly at the hline is used.
2079 @samp{0} refers to the current row and column.  Also, if you omit
2080 either the column or the row part of the reference, the current
2081 row/column is implied.
2083 Org's references with @emph{unsigned} numbers are fixed references
2084 in the sense that if you use the same reference in the formula for two
2085 different fields, the same field will be referenced each time.
2086 Org's references with @emph{signed} numbers are floating
2087 references because the same reference operator can reference different
2088 fields depending on the field being calculated by the formula.
2090 As a special case, references like @samp{$LR5} and @samp{$LR12} can be used to
2091 refer in a stable way to the 5th and 12th field in the last row of the
2092 table.
2094 Here are a few examples:
2096 @example
2097 @@2$3      @r{2nd row, 3rd column}
2098 C2        @r{same as previous}
2099 $5        @r{column 5 in the current row}
2100 E&        @r{same as previous}
2101 @@2        @r{current column, row 2}
2102 @@-1$-3    @r{the field one row up, three columns to the left}
2103 @@-I$2     @r{field just under hline above current row, column 2}
2104 @end example
2106 @subsubheading Range references
2107 @cindex range references
2108 @cindex references, to ranges
2110 You may reference a rectangular range of fields by specifying two field
2111 references connected by two dots @samp{..}.  If both fields are in the
2112 current row, you may simply use @samp{$2..$7}, but if at least one field
2113 is in a different row, you need to use the general @code{@@row$column}
2114 format at least for the first field (i.e the reference must start with
2115 @samp{@@} in order to be interpreted correctly).  Examples:
2117 @example
2118 $1..$3        @r{First three fields in the current row.}
2119 $P..$Q        @r{Range, using column names (see under Advanced)}
2120 @@2$1..@@4$3    @r{6 fields between these two fields.}
2121 A2..C4        @r{Same as above.}
2122 @@-1$-2..@@-1   @r{3 numbers from the column to the left, 2 up to current row}
2123 @end example
2125 @noindent Range references return a vector of values that can be fed
2126 into Calc vector functions.  Empty fields in ranges are normally
2127 suppressed, so that the vector contains only the non-empty fields (but
2128 see the @samp{E} mode switch below).  If there are no non-empty fields,
2129 @samp{[0]} is returned to avoid syntax errors in formulas.
2131 @subsubheading Named references
2132 @cindex named references
2133 @cindex references, named
2134 @cindex name, of column or field
2135 @cindex constants, in calculations
2136 @cindex #+CONSTANTS
2138 @vindex org-table-formula-constants
2139 @samp{$name} is interpreted as the name of a column, parameter or
2140 constant.  Constants are defined globally through the variable
2141 @code{org-table-formula-constants}, and locally (for the file) through a
2142 line like
2144 @example
2145 #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
2146 @end example
2148 @noindent
2149 @vindex constants-unit-system
2150 @pindex constants.el
2151 Also properties (@pxref{Properties and Columns}) can be used as
2152 constants in table formulas: For a property @samp{:Xyz:} use the name
2153 @samp{$PROP_Xyz}, and the property will be searched in the current
2154 outline entry and in the hierarchy above it.  If you have the
2155 @file{constants.el} package, it will also be used to resolve constants,
2156 including natural constants like @samp{$h} for Planck's constant, and
2157 units like @samp{$km} for kilometers@footnote{@file{constants.el} can
2158 supply the values of constants in two different unit systems, @code{SI}
2159 and @code{cgs}.  Which one is used depends on the value of the variable
2160 @code{constants-unit-system}.  You can use the @code{#+STARTUP} options
2161 @code{constSI} and @code{constcgs} to set this value for the current
2162 buffer.}.  Column names and parameters can be specified in special table
2163 lines.  These are described below, see @ref{Advanced features}.  All
2164 names must start with a letter, and further consist of letters and
2165 numbers.
2167 @subsubheading Remote references
2168 @cindex remote references
2169 @cindex references, remote
2170 @cindex references, to a different table
2171 @cindex name, of column or field
2172 @cindex constants, in calculations
2173 @cindex #+TBLNAME
2175 You may also reference constants, fields and ranges from a different table,
2176 either in the current file or even in a different file.  The syntax is
2178 @example
2179 remote(NAME-OR-ID,REF)
2180 @end example
2182 @noindent
2183 where NAME can be the name of a table in the current file as set by a
2184 @code{#+TBLNAME: NAME} line before the table.  It can also be the ID of an
2185 entry, even in a different file, and the reference then refers to the first
2186 table in that entry.  REF is an absolute field or range reference as
2187 described above for example @code{@@3$3} or @code{$somename}, valid in the
2188 referenced table.
2190 @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
2191 @subsection Formula syntax for Calc
2192 @cindex formula syntax, Calc
2193 @cindex syntax, of formulas
2195 A formula can be any algebraic expression understood by the Emacs
2196 @file{Calc} package.  @b{Note that @file{calc} has the
2197 non-standard convention that @samp{/} has lower precedence than
2198 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.}  Before
2199 evaluation by @code{calc-eval} (@pxref{Calling Calc from
2200 Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
2201 Emacs Calc Manual}),
2202 @c FIXME:  The link to the Calc manual in HTML does not work.
2203 variable substitution takes place according to the rules described above.
2204 @cindex vectors, in table calculations
2205 The range vectors can be directly fed into the Calc vector functions
2206 like @samp{vmean} and @samp{vsum}.
2208 @cindex format specifier
2209 @cindex mode, for @file{calc}
2210 @vindex org-calc-default-modes
2211 A formula can contain an optional mode string after a semicolon.  This
2212 string consists of flags to influence Calc and other modes during
2213 execution.  By default, Org uses the standard Calc modes (precision
2214 12, angular units degrees, fraction and symbolic modes off).  The display
2215 format, however, has been changed to @code{(float 8)} to keep tables
2216 compact.  The default settings can be configured using the variable
2217 @code{org-calc-default-modes}.
2219 @example
2220 p20           @r{switch the internal precision to 20 digits}
2221 n3 s3 e2 f4   @r{normal, scientific, engineering, or fixed display format}
2222 D R           @r{angle modes: degrees, radians}
2223 F S           @r{fraction and symbolic modes}
2224 N             @r{interpret all fields as numbers, use 0 for non-numbers}
2225 T             @r{force text interpretation}
2226 E             @r{keep empty fields in ranges}
2227 L             @r{literal}
2228 @end example
2230 @noindent
2231 In addition, you may provide a @code{printf} format specifier to
2232 reformat the final result.  A few examples:
2234 @example
2235 $1+$2                @r{Sum of first and second field}
2236 $1+$2;%.2f           @r{Same, format result to two decimals}
2237 exp($2)+exp($1)      @r{Math functions can be used}
2238 $0;%.1f              @r{Reformat current cell to 1 decimal}
2239 ($3-32)*5/9          @r{Degrees F -> C conversion}
2240 $c/$1/$cm            @r{Hz -> cm conversion, using @file{constants.el}}
2241 tan($1);Dp3s1        @r{Compute in degrees, precision 3, display SCI 1}
2242 sin($1);Dp3%.1e      @r{Same, but use printf specifier for display}
2243 vmean($2..$7)        @r{Compute column range mean, using vector function}
2244 vmean($2..$7);EN     @r{Same, but treat empty fields as 0}
2245 taylor($3,x=7,2)     @r{taylor series of $3, at x=7, second degree}
2246 @end example
2248 Calc also contains a complete set of logical operations.  For example
2250 @example
2251 if($1<20,teen,string(""))  @r{``teen'' if age $1 less than 20, else empty}
2252 @end example
2254 @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
2255 @subsection Emacs Lisp forms as formulas
2256 @cindex Lisp forms, as table formulas
2258 It is also possible to write a formula in Emacs Lisp; this can be useful
2259 for string manipulation and control structures, if Calc's
2260 functionality is not enough.  If a formula starts with a single-quote
2261 followed by an opening parenthesis, then it is evaluated as a Lisp form.
2262 The evaluation should return either a string or a number.  Just as with
2263 @file{calc} formulas, you can specify modes and a printf format after a
2264 semicolon.  With Emacs Lisp forms, you need to be conscious about the way
2265 field references are interpolated into the form.  By default, a
2266 reference will be interpolated as a Lisp string (in double-quotes)
2267 containing the field.  If you provide the @samp{N} mode switch, all
2268 referenced elements will be numbers (non-number fields will be zero) and
2269 interpolated as Lisp numbers, without quotes.  If you provide the
2270 @samp{L} flag, all fields will be interpolated literally, without quotes.
2271 @Ie{}, if you want a reference to be interpreted as a string by the Lisp
2272 form, enclose the reference operator itself in double-quotes, like
2273 @code{"$3"}.  Ranges are inserted as space-separated fields, so you can
2274 embed them in list or vector syntax.  A few examples, note how the
2275 @samp{N} mode is used when we do computations in Lisp.
2277 @example
2278 @r{Swap the first two characters of the content of column 1}
2279   '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
2280 @r{Add columns 1 and 2, equivalent to Calc's @code{$1+$2}}
2281   '(+ $1 $2);N
2282 @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
2283   '(apply '+ '($1..$4));N
2284 @end example
2286 @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
2287 @subsection Field formulas
2288 @cindex field formula
2289 @cindex formula, for individual table field
2291 To assign a formula to a particular field, type it directly into the
2292 field, preceded by @samp{:=}, for example @samp{:=$1+$2}.  When you
2293 press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
2294 the field, the formula will be stored as the formula for this field,
2295 evaluated, and the current field replaced with the result.
2297 @cindex #+TBLFM
2298 Formulas are stored in a special line starting with @samp{#+TBLFM:}
2299 directly below the table.  If you typed the equation in the 4th field of
2300 the 3rd data line in the table, the formula will look like
2301 @samp{@@3$4=$1+$2}.  When inserting/deleting/swapping column and rows
2302 with the appropriate commands, @i{absolute references} (but not relative
2303 ones) in stored formulas are modified in order to still reference the
2304 same field.  Of course this is not true if you edit the table structure
2305 with normal editing commands---then you must fix the equations yourself.
2306 The left-hand side of a formula may also be a named field (@pxref{Advanced
2307 features}), or a last-row reference like @samp{$LR3}.
2309 Instead of typing an equation into the field, you may also use the
2310 following command
2312 @table @kbd
2313 @kindex C-u C-c =
2314 @item C-u C-c =
2315 Install a new formula for the current field.  The command prompts for a
2316 formula with default taken from the @samp{#+TBLFM:} line, applies
2317 it to the current field, and stores it.
2318 @end table
2320 @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
2321 @subsection Column formulas
2322 @cindex column formula
2323 @cindex formula, for table column
2325 Often in a table, the same formula should be used for all fields in a
2326 particular column.  Instead of having to copy the formula to all fields
2327 in that column, Org allows you to assign a single formula to an entire
2328 column.  If the table contains horizontal separator hlines, everything
2329 before the first such line is considered part of the table @emph{header}
2330 and will not be modified by column formulas.
2332 To assign a formula to a column, type it directly into any field in the
2333 column, preceded by an equal sign, like @samp{=$1+$2}.  When you press
2334 @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the field,
2335 the formula will be stored as the formula for the current column, evaluated
2336 and the current field replaced with the result.  If the field contains only
2337 @samp{=}, the previously stored formula for this column is used.  For each
2338 column, Org will only remember the most recently used formula.  In the
2339 @samp{#+TBLFM:} line, column formulas will look like @samp{$4=$1+$2}.  The left-hand 
2340 side of a column formula cannot currently be the name of column, it
2341 must be the numeric column reference.
2343 Instead of typing an equation into the field, you may also use the
2344 following command:
2346 @table @kbd
2347 @kindex C-c =
2348 @item C-c =
2349 Install a new formula for the current column and replace current field with
2350 the result of the formula.  The command prompts for a formula, with default
2351 taken from the @samp{#+TBLFM} line, applies it to the current field and
2352 stores it.  With a numeric prefix argument(@eg @kbd{C-5 C-c =}) the command
2353 will apply it to that many consecutive fields in the current column.
2354 @end table
2356 @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
2357 @subsection Editing and debugging formulas
2358 @cindex formula editing
2359 @cindex editing, of table formulas
2361 @vindex org-table-use-standard-references
2362 You can edit individual formulas in the minibuffer or directly in the
2363 field.  Org can also prepare a special buffer with all active
2364 formulas of a table.  When offering a formula for editing, Org
2365 converts references to the standard format (like @code{B3} or @code{D&})
2366 if possible.  If you prefer to only work with the internal format (like
2367 @code{@@3$2} or @code{$4}), configure the variable
2368 @code{org-table-use-standard-references}.
2370 @table @kbd
2371 @kindex C-c =
2372 @kindex C-u C-c =
2373 @item C-c =
2374 @itemx C-u C-c =
2375 Edit the formula associated with the current column/field in the
2376 minibuffer.  See @ref{Column formulas}, and @ref{Field formulas}.
2377 @kindex C-u C-u C-c =
2378 @item C-u C-u C-c =
2379 Re-insert the active formula (either a
2380 field formula, or a column formula) into the current field, so that you
2381 can edit it directly in the field.  The advantage over editing in the
2382 minibuffer is that you can use the command @kbd{C-c ?}.
2383 @kindex C-c ?
2384 @item C-c ?
2385 While editing a formula in a table field, highlight the field(s)
2386 referenced by the reference at the cursor position in the formula.
2387 @kindex C-c @}
2388 @item C-c @}
2389 Toggle the display of row and column numbers for a table, using
2390 overlays.  These are updated each time the table is aligned; you can
2391 force it with @kbd{C-c C-c}.
2392 @kindex C-c @{
2393 @item C-c @{
2394 Toggle the formula debugger on and off.  See below.
2395 @kindex C-c '
2396 @item C-c '
2397 Edit all formulas for the current table in a special buffer, where the
2398 formulas will be displayed one per line.  If the current field has an
2399 active formula, the cursor in the formula editor will mark it.
2400 While inside the special buffer, Org will automatically highlight
2401 any field or range reference at the cursor position.  You may edit,
2402 remove and add formulas, and use the following commands:
2403 @table @kbd
2404 @kindex C-c C-c
2405 @kindex C-x C-s
2406 @item C-c C-c
2407 @itemx C-x C-s
2408 Exit the formula editor and store the modified formulas.  With @kbd{C-u}
2409 prefix, also apply the new formulas to the entire table.
2410 @kindex C-c C-q
2411 @item C-c C-q
2412 Exit the formula editor without installing changes.
2413 @kindex C-c C-r
2414 @item C-c C-r
2415 Toggle all references in the formula editor between standard (like
2416 @code{B3}) and internal (like @code{@@3$2}).
2417 @kindex @key{TAB}
2418 @item @key{TAB}
2419 Pretty-print or indent Lisp formula at point.  When in a line containing
2420 a Lisp formula, format the formula according to Emacs Lisp rules.
2421 Another @key{TAB} collapses the formula back again.  In the open
2422 formula, @key{TAB} re-indents just like in Emacs Lisp mode.
2423 @kindex M-@key{TAB}
2424 @item M-@key{TAB}
2425 Complete Lisp symbols, just like in Emacs Lisp mode.
2426 @kindex S-@key{up}
2427 @kindex S-@key{down}
2428 @kindex S-@key{left}
2429 @kindex S-@key{right}
2430 @item S-@key{up}/@key{down}/@key{left}/@key{right}
2431 Shift the reference at point.  For example, if the reference is
2432 @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
2433 This also works for relative references and for hline references.
2434 @kindex M-S-@key{up}
2435 @kindex M-S-@key{down}
2436 @item M-S-@key{up}/@key{down}
2437 Move the test line for column formulas in the Org buffer up and
2438 down.
2439 @kindex M-@key{up}
2440 @kindex M-@key{down}
2441 @item M-@key{up}/@key{down}
2442 Scroll the window displaying the table.
2443 @kindex C-c @}
2444 @item C-c @}
2445 Turn the coordinate grid in the table on and off.
2446 @end table
2447 @end table
2449 Making a table field blank does not remove the formula associated with
2450 the field, because that is stored in a different line (the @samp{#+TBLFM}
2451 line)---during the next recalculation the field will be filled again.
2452 To remove a formula from a field, you have to give an empty reply when
2453 prompted for the formula, or to edit the @samp{#+TBLFM} line.
2455 @kindex C-c C-c
2456 You may edit the @samp{#+TBLFM} directly and re-apply the changed
2457 equations with @kbd{C-c C-c} in that line or with the normal
2458 recalculation commands in the table.
2460 @subsubheading Debugging formulas
2461 @cindex formula debugging
2462 @cindex debugging, of table formulas
2463 When the evaluation of a formula leads to an error, the field content
2464 becomes the string @samp{#ERROR}.  If you would like see what is going
2465 on during variable substitution and calculation in order to find a bug,
2466 turn on formula debugging in the @code{Tbl} menu and repeat the
2467 calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
2468 field.  Detailed information will be displayed.
2470 @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
2471 @subsection Updating the table
2472 @cindex recomputing table fields
2473 @cindex updating, table
2475 Recalculation of a table is normally not automatic, but needs to be
2476 triggered by a command.  See @ref{Advanced features}, for a way to make
2477 recalculation at least semi-automatic.
2479 In order to recalculate a line of a table or the entire table, use the
2480 following commands:
2482 @table @kbd
2483 @kindex C-c *
2484 @item C-c *
2485 Recalculate the current row by first applying the stored column formulas
2486 from left to right, and all field formulas in the current row.
2488 @kindex C-u C-c *
2489 @item C-u C-c *
2490 @kindex C-u C-c C-c
2491 @itemx C-u C-c C-c
2492 Recompute the entire table, line by line.  Any lines before the first
2493 hline are left alone, assuming that these are part of the table header.
2495 @kindex C-u C-u C-c *
2496 @kindex C-u C-u C-c C-c
2497 @item C-u C-u C-c *
2498 @itemx C-u C-u C-c C-c
2499 Iterate the table by recomputing it until no further changes occur.
2500 This may be necessary if some computed fields use the value of other
2501 fields that are computed @i{later} in the calculation sequence.
2502 @end table
2504 @node Advanced features,  , Updating the table, The spreadsheet
2505 @subsection Advanced features
2507 If you want the recalculation of fields to happen automatically, or if
2508 you want to be able to assign @i{names} to fields and columns, you need
2509 to reserve the first column of the table for special marking characters.
2510 @table @kbd
2511 @kindex C-#
2512 @item C-#
2513 Rotate the calculation mark in first column through the states @samp{},
2514 @samp{#}, @samp{*}, @samp{!}, @samp{$}.  When there is an active region,
2515 change all marks in the region.
2516 @end table
2518 Here is an example of a table that collects exam results of students and
2519 makes use of these features:
2521 @example
2522 @group
2523 |---+---------+--------+--------+--------+-------+------|
2524 |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2525 |---+---------+--------+--------+--------+-------+------|
2526 | ! |         |     P1 |     P2 |     P3 |   Tot |      |
2527 | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
2528 | ^ |         |     m1 |     m2 |     m3 |    mt |      |
2529 |---+---------+--------+--------+--------+-------+------|
2530 | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
2531 | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
2532 |---+---------+--------+--------+--------+-------+------|
2533 |   | Average |        |        |        |  29.7 |      |
2534 | ^ |         |        |        |        |    at |      |
2535 | $ | max=50  |        |        |        |       |      |
2536 |---+---------+--------+--------+--------+-------+------|
2537 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
2538 @end group
2539 @end example
2541 @noindent @b{Important}: Please note that for these special tables,
2542 recalculating the table with @kbd{C-u C-c *} will only affect rows that
2543 are marked @samp{#} or @samp{*}, and fields that have a formula assigned
2544 to the field itself.  The column formulas are not applied in rows with
2545 empty first field.
2547 @cindex marking characters, tables
2548 The marking characters have the following meaning:
2549 @table @samp
2550 @item !
2551 The fields in this line define names for the columns, so that you may
2552 refer to a column as @samp{$Tot} instead of @samp{$6}.
2553 @item ^
2554 This row defines names for the fields @emph{above} the row.  With such
2555 a definition, any formula in the table may use @samp{$m1} to refer to
2556 the value @samp{10}.  Also, if you assign a formula to a names field, it
2557 will be stored as @samp{$name=...}.
2558 @item _
2559 Similar to @samp{^}, but defines names for the fields in the row
2560 @emph{below}.
2561 @item $
2562 Fields in this row can define @emph{parameters} for formulas.  For
2563 example, if a field in a @samp{$} row contains @samp{max=50}, then
2564 formulas in this table can refer to the value 50 using @samp{$max}.
2565 Parameters work exactly like constants, only that they can be defined on
2566 a per-table basis.
2567 @item #
2568 Fields in this row are automatically recalculated when pressing
2569 @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row.  Also, this row
2570 is selected for a global recalculation with @kbd{C-u C-c *}.  Unmarked
2571 lines will be left alone by this command.
2572 @item *
2573 Selects this line for global recalculation with @kbd{C-u C-c *}, but
2574 not for automatic recalculation.  Use this when automatic
2575 recalculation slows down editing too much.
2576 @item
2577 Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
2578 All lines that should be recalculated should be marked with @samp{#}
2579 or @samp{*}.
2580 @item /
2581 Do not export this line.  Useful for lines that contain the narrowing
2582 @samp{<N>} markers.
2583 @end table
2585 Finally, just to whet your appetite for what can be done with the
2586 fantastic @file{calc.el} package, here is a table that computes the Taylor
2587 series of degree @code{n} at location @code{x} for a couple of
2588 functions.
2590 @example
2591 @group
2592 |---+-------------+---+-----+--------------------------------------|
2593 |   | Func        | n | x   | Result                               |
2594 |---+-------------+---+-----+--------------------------------------|
2595 | # | exp(x)      | 1 | x   | 1 + x                                |
2596 | # | exp(x)      | 2 | x   | 1 + x + x^2 / 2                      |
2597 | # | exp(x)      | 3 | x   | 1 + x + x^2 / 2 + x^3 / 6            |
2598 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2599 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2    |
2600 | * | tan(x)      | 3 | x   | 0.0175 x + 1.77e-6 x^3               |
2601 |---+-------------+---+-----+--------------------------------------|
2602 #+TBLFM: $5=taylor($2,$4,$3);n3
2603 @end group
2604 @end example
2606 @node Org-Plot,  , The spreadsheet, Tables
2607 @section Org-Plot
2608 @cindex graph, in tables
2609 @cindex plot tables using gnuplot
2610 @cindex #+PLOT
2612 Org-Plot can produce 2D and 3D graphs of information stored in org tables
2613 using @file{Gnuplot} @uref{http://www.gnuplot.info/} and @file{gnuplot-mode}
2614 @uref{http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html}.  To see
2615 this in action, ensure that you have both Gnuplot and Gnuplot mode installed
2616 on your system, then call @code{org-plot/gnuplot} on the following table.
2618 @example
2619 @group
2620 #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
2621 | Sede      | Max cites | H-index |
2622 |-----------+-----------+---------|
2623 | Chile     |    257.72 |   21.39 |
2624 | Leeds     |    165.77 |   19.68 |
2625 | Sao Paolo |     71.00 |   11.50 |
2626 | Stockholm |    134.19 |   14.33 |
2627 | Morelia   |    257.56 |   17.67 |
2628 @end group
2629 @end example
2631 Notice that Org Plot is smart enough to apply the table's headers as labels.
2632 Further control over the labels, type, content, and appearance of plots can
2633 be exercised through the @code{#+PLOT:} lines preceding a table.  See below
2634 for a complete list of Org-plot options.  For more information and examples
2635 see the Org-plot tutorial at
2636 @uref{http://orgmode.org/worg/org-tutorials/org-plot.php}.
2638 @subsubheading Plot Options
2640 @table @code
2641 @item set
2642 Specify any @command{gnuplot} option to be set when graphing.
2644 @item title
2645 Specify the title of the plot.
2647 @item ind
2648 Specify which column of the table to use as the @code{x} axis.
2650 @item deps
2651 Specify the columns to graph as a Lisp style list, surrounded by parentheses
2652 and separated by spaces for example @code{dep:(3 4)} to graph the third and
2653 fourth columns (defaults to graphing all other columns aside from the @code{ind}
2654 column).
2656 @item type
2657 Specify whether the plot will be @code{2d}, @code{3d}, or @code{grid}.
2659 @item with
2660 Specify a @code{with} option to be inserted for every col being plotted
2661 (@eg @code{lines}, @code{points}, @code{boxes}, @code{impulses}, etc...).
2662 Defaults to @code{lines}.
2664 @item file
2665 If you want to plot to a file, specify @code{"@var{path/to/desired/output-file}"}.
2667 @item labels
2668 List of labels to be used for the deps (defaults to the column headers if
2669 they exist).
2671 @item line
2672 Specify an entire line to be inserted in the Gnuplot script.
2674 @item map
2675 When plotting @code{3d} or @code{grid} types, set this to @code{t} to graph a
2676 flat mapping rather than a @code{3d} slope.
2678 @item timefmt
2679 Specify format of Org-mode timestamps as they will be parsed by Gnuplot.
2680 Defaults to @samp{%Y-%m-%d-%H:%M:%S}.
2682 @item script
2683 If you want total control, you can specify a script file (place the file name
2684 between double-quotes) which will be used to plot.  Before plotting, every
2685 instance of @code{$datafile} in the specified script will be replaced with
2686 the path to the generated data file.  Note: Even if you set this option, you
2687 may still want to specify the plot type, as that can impact the content of
2688 the data file.
2689 @end table
2691 @node Hyperlinks, TODO Items, Tables, Top
2692 @chapter Hyperlinks
2693 @cindex hyperlinks
2695 Like HTML, Org provides links inside a file, external links to
2696 other files, Usenet articles, emails, and much more.
2698 @menu
2699 * Link format::                 How links in Org are formatted
2700 * Internal links::              Links to other places in the current file
2701 * External links::              URL-like links to the world
2702 * Handling links::              Creating, inserting and following
2703 * Using links outside Org::     Linking from my C source code?
2704 * Link abbreviations::          Shortcuts for writing complex links
2705 * Search options::              Linking to a specific location
2706 * Custom searches::             When the default search is not enough
2707 @end menu
2709 @node Link format, Internal links, Hyperlinks, Hyperlinks
2710 @section Link format
2711 @cindex link format
2712 @cindex format, of links
2714 Org will recognize plain URL-like links and activate them as
2715 clickable links.  The general link format, however, looks like this:
2717 @example
2718 [[link][description]]       @r{or alternatively}           [[link]]
2719 @end example
2721 @noindent
2722 Once a link in the buffer is complete (all brackets present), Org
2723 will change the display so that @samp{description} is displayed instead
2724 of @samp{[[link][description]]} and @samp{link} is displayed instead of
2725 @samp{[[link]]}.  Links will be highlighted in the face @code{org-link},
2726 which by default is an underlined face.  You can directly edit the
2727 visible part of a link.  Note that this can be either the @samp{link}
2728 part (if there is no description) or the @samp{description} part.  To
2729 edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
2730 cursor on the link.
2732 If you place the cursor at the beginning or just behind the end of the
2733 displayed text and press @key{BACKSPACE}, you will remove the
2734 (invisible) bracket at that location.  This makes the link incomplete
2735 and the internals are again displayed as plain text.  Inserting the
2736 missing bracket hides the link internals again.  To show the
2737 internal structure of all links, use the menu entry
2738 @code{Org->Hyperlinks->Literal links}.
2740 @node Internal links, External links, Link format, Hyperlinks
2741 @section Internal links
2742 @cindex internal links
2743 @cindex links, internal
2744 @cindex targets, for links
2746 @cindex property, CUSTOM_ID
2747 If the link does not look like a URL, it is considered to be internal in the
2748 current file.  The most important case is a link like
2749 @samp{[[#my-custom-id]]} which will link to the entry with the
2750 @code{CUSTOM_ID} property @samp{my-custom-id}.  Such custom IDs are very good
2751 for HTML export (@pxref{HTML export}) where they produce pretty section
2752 links.  You are responsible yourself to make sure these custom IDs are unique
2753 in a file.
2755 Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]}
2756 lead to a text search in the current file.
2758 The link can be followed with @kbd{C-c C-o} when the cursor is on the link,
2759 or with a mouse click (@pxref{Handling links}).  Links to custom IDs will
2760 point to the corresponding headline.  The preferred match for a text link is
2761 a @i{dedicated target}: the same string in double angular brackets.  Targets
2762 may be located anywhere; sometimes it is convenient to put them into a
2763 comment line. For example
2765 @example
2766 # <<My Target>>
2767 @end example
2769 @noindent In HTML export (@pxref{HTML export}), such targets will become
2770 named anchors for direct access through @samp{http} links@footnote{Note that
2771 text before the first headline is usually not exported, so the first such
2772 target should be after the first headline, or in the line directly before the
2773 first headline.}.
2775 If no dedicated target exists, Org will search for the words in the link.  In
2776 the above example the search would be for @samp{my target}.  Links starting
2777 with a star like @samp{*My Target} restrict the search to
2778 headlines@footnote{To insert a link targeting a headline, in-buffer
2779 completion can be used.  Just type a star followed by a few optional letters
2780 into the buffer and press @kbd{M-@key{TAB}}.  All headlines in the current
2781 buffer will be offered as completions.  @xref{Handling links}, for more
2782 commands creating links.}.  When searching, Org mode will first try an
2783 exact match, but then move on to more and more lenient searches.  For
2784 example, the link @samp{[[*My Targets]]} will find any of the following:
2786 @example
2787 ** My targets
2788 ** TODO my targets are bright
2789 ** my 20 targets are
2790 @end example
2793 Following a link pushes a mark onto Org's own mark ring.  You can
2794 return to the previous position with @kbd{C-c &}.  Using this command
2795 several times in direct succession goes back to positions recorded
2796 earlier.
2798 @menu
2799 * Radio targets::               Make targets trigger links in plain text
2800 @end menu
2802 @node Radio targets,  , Internal links, Internal links
2803 @subsection Radio targets
2804 @cindex radio targets
2805 @cindex targets, radio
2806 @cindex links, radio targets
2808 Org can automatically turn any occurrences of certain target names
2809 in normal text into a link.  So without explicitly creating a link, the
2810 text connects to the target radioing its position.  Radio targets are
2811 enclosed by triple angular brackets.  For example, a target @samp{<<<My
2812 Target>>>} causes each occurrence of @samp{my target} in normal text to
2813 become activated as a link.  The Org file is scanned automatically
2814 for radio targets only when the file is first loaded into Emacs.  To
2815 update the target list during editing, press @kbd{C-c C-c} with the
2816 cursor on or at a target.
2818 @node External links, Handling links, Internal links, Hyperlinks
2819 @section External links
2820 @cindex links, external
2821 @cindex external links
2822 @cindex links, external
2823 @cindex Gnus links
2824 @cindex BBDB links
2825 @cindex IRC links
2826 @cindex URL links
2827 @cindex file links
2828 @cindex VM links
2829 @cindex RMAIL links
2830 @cindex WANDERLUST links
2831 @cindex MH-E links
2832 @cindex USENET links
2833 @cindex SHELL links
2834 @cindex Info links
2835 @cindex Elisp links
2837 Org supports links to files, websites, Usenet and email messages,
2838 BBDB database entries and links to both IRC conversations and their
2839 logs.  External links are URL-like locators.  They start with a short
2840 identifying string followed by a colon.  There can be no space after
2841 the colon.  The following list shows examples for each link type.
2843 @example
2844 http://www.astro.uva.nl/~dominik          @r{on the web}
2845 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
2846 /home/dominik/images/jupiter.jpg          @r{same as above}
2847 file:papers/last.pdf                      @r{file, relative path}
2848 ./papers/last.pdf                         @r{same as above}
2849 file:projects.org                         @r{another Org file}
2850 file:projects.org::some words             @r{text search in Org file}
2851 file:projects.org::*task title            @r{heading search in Org file}
2852 id:B7423F4D-2E8A-471B-8810-C40F074717E9   @r{Link to heading by ID}
2853 news:comp.emacs                           @r{Usenet link}
2854 mailto:adent@@galaxy.net                   @r{Mail link}
2855 vm:folder                                 @r{VM folder link}
2856 vm:folder#id                              @r{VM message link}
2857 vm://myself@@some.where.org/folder#id      @r{VM on remote machine}
2858 wl:folder                                 @r{WANDERLUST folder link}
2859 wl:folder#id                              @r{WANDERLUST message link}
2860 mhe:folder                                @r{MH-E folder link}
2861 mhe:folder#id                             @r{MH-E message link}
2862 rmail:folder                              @r{RMAIL folder link}
2863 rmail:folder#id                           @r{RMAIL message link}
2864 gnus:group                                @r{Gnus group link}
2865 gnus:group#id                             @r{Gnus article link}
2866 bbdb:R.*Stallman                          @r{BBDB link (with regexp)}
2867 irc:/irc.com/#emacs/bob                   @r{IRC link}
2868 shell:ls *.org                            @r{A shell command}
2869 elisp:org-agenda                          @r{Interactive Elisp command}
2870 elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate}
2871 @end example
2873 A link should be enclosed in double brackets and may contain a
2874 descriptive text to be displayed instead of the URL (@pxref{Link
2875 format}), for example:
2877 @example
2878 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
2879 @end example
2881 @noindent
2882 If the description is a file name or URL that points to an image, HTML
2883 export (@pxref{HTML export}) will inline the image as a clickable
2884 button.  If there is no description at all and the link points to an
2885 image,
2886 that image will be inlined into the exported HTML file.
2888 @cindex square brackets, around links
2889 @cindex plain text external links
2890 Org also finds external links in the normal text and activates them
2891 as links.  If spaces must be part of the link (for example in
2892 @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
2893 about the end of the link, enclose them in square brackets.
2895 @node Handling links, Using links outside Org, External links, Hyperlinks
2896 @section Handling links
2897 @cindex links, handling
2899 Org provides methods to create a link in the correct syntax, to
2900 insert it into an Org file, and to follow the link.
2902 @table @kbd
2903 @kindex C-c l
2904 @cindex storing links
2905 @item C-c l
2906 Store a link to the current location.  This is a @emph{global} command (you
2907 must create the key binding yourself) which can be used in any buffer to
2908 create a link.  The link will be stored for later insertion into an Org
2909 buffer (see below).  What kind of link will be created depends on the current
2910 buffer:
2912 @b{Org-mode buffers}@*
2913 For Org files, if there is a @samp{<<target>>} at the cursor, the link points
2914 to the target.  Otherwise it points to the current headline, which will also
2915 be the description.
2917 @vindex org-link-to-org-use-id
2918 @cindex property, CUSTOM_ID
2919 @cindex property, ID
2920 If the headline has a @code{CUSTOM_ID} property, a link to this custom ID
2921 will be stored.  In addition or alternatively (depending on the value of
2922 @code{org-link-to-org-use-id}), a globally unique @code{ID} property will be
2923 created and/or used to construct a link.  So using this command in Org
2924 buffers will potentially create two links: A human-readable from the custom
2925 ID, and one that is globally unique and works even if the entry is moved from
2926 file to file.  Later, when inserting the link, you need to decide which one
2927 to use.
2929 @b{Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus}@*
2930 Pretty much all Emacs mail clients are supported.  The link will point to the
2931 current article, or, in some GNUS buffers, to the group.  The description is
2932 constructed from the author and the subject.
2934 @b{Web browsers: W3 and W3M}@*
2935 Here the link will be the current URL, with the page title as description.
2937 @b{Contacts: BBDB}@*
2938 Links created in a BBDB buffer will point to the current entry.
2940 @b{Chat: IRC}@*
2941 @vindex org-irc-link-to-logs
2942 For IRC links, if you set the variable @code{org-irc-link-to-logs} to
2943 @code{t}, a @samp{file:/} style link to the relevant point in the logs for
2944 the current conversation is created.  Otherwise an @samp{irc:/} style link to
2945 the user/channel/server under the point will be stored.
2947 @b{Other files}@*
2948 For any other files, the link will point to the file, with a search string
2949 (@pxref{Search options}) pointing to the contents of the current line.  If
2950 there is an active region, the selected words will form the basis of the
2951 search string.  If the automatically created link is not working correctly or
2952 accurately enough, you can write custom functions to select the search string
2953 and to do the search for particular file types---see @ref{Custom searches}.
2954 The key binding @kbd{C-c l} is only a suggestion---see @ref{Installation}.
2956 @kindex C-c C-l
2957 @cindex link completion
2958 @cindex completion, of links
2959 @cindex inserting links
2960 @item C-c C-l
2961 @vindex org-keep-stored-link-after-insertion
2962 Insert a link@footnote{ Note that you don't have to use this command to
2963 insert a link.  Links in Org are plain text, and you can type or paste them
2964 straight into the buffer.  By using this command, the links are automatically
2965 enclosed in double brackets, and you will be asked for the optional
2966 descriptive text.}.  This prompts for a link to be inserted into the buffer.
2967 You can just type a link, using text for an internal link, or one of the link
2968 type prefixes mentioned in the examples above.  The link will be inserted
2969 into the buffer@footnote{After insertion of a stored link, the link will be
2970 removed from the list of stored links.  To keep it in the list later use, use
2971 a triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
2972 @code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
2973 If some text was selected when this command is called, the selected text
2974 becomes the default description.
2976 @b{Inserting stored links}@*
2977 All links stored during the
2978 current session are part of the history for this prompt, so you can access
2979 them with @key{up} and @key{down} (or @kbd{M-p/n}).
2981 @b{Completion support}@* Completion with @key{TAB} will help you to insert
2982 valid link prefixes like @samp{http:} or @samp{ftp:}, including the prefixes
2983 defined through link abbreviations (@pxref{Link abbreviations}).  If you
2984 press @key{RET} after inserting only the @var{prefix}, Org will offer
2985 specific completion support for some link types@footnote{This works by
2986 calling a special function @code{org-PREFIX-complete-link}.}  For
2987 example, if you type @kbd{file @key{RET}}, file name completion (alternative
2988 access: @kbd{C-u C-c C-l}, see below) will be offered, and after @kbd{bbdb
2989 @key{RET}} you can complete contact names.
2990 @kindex C-u C-c C-l
2991 @cindex file name completion
2992 @cindex completion, of file names
2993 @item C-u C-c C-l
2994 When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
2995 a file will be inserted and you may use file name completion to select
2996 the name of the file.  The path to the file is inserted relative to the
2997 directory of the current Org file, if the linked file is in the current
2998 directory or in a sub-directory of it, or if the path is written relative
2999 to the current directory using @samp{../}.  Otherwise an absolute path
3000 is used, if possible with @samp{~/} for your home directory.  You can
3001 force an absolute path with two @kbd{C-u} prefixes.
3003 @item C-c C-l @r{(with cursor on existing link)}
3004 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
3005 link and description parts of the link.
3007 @cindex following links
3008 @kindex C-c C-o
3009 @kindex RET
3010 @item C-c C-o @r{or} @key{RET}
3011 @vindex org-file-apps
3012 Open link at point.  This will launch a web browser for URLs (using
3013 @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for
3014 the corresponding links, and execute the command in a shell link.  When the
3015 cursor is on an internal link, this commands runs the corresponding search.
3016 When the cursor is on a TAG list in a headline, it creates the corresponding
3017 TAGS view.  If the cursor is on a timestamp, it compiles the agenda for that
3018 date.  Furthermore, it will visit text and remote files in @samp{file:} links
3019 with Emacs and select a suitable application for local non-text files.
3020 Classification of files is based on file extension only.  See option
3021 @code{org-file-apps}.  If you want to override the default application and
3022 visit the file with Emacs, use a @kbd{C-u} prefix.  If you want to avoid
3023 opening in Emacs, use a @kbd{C-u C-u} prefix.
3025 @kindex mouse-2
3026 @kindex mouse-1
3027 @item mouse-2
3028 @itemx mouse-1
3029 On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
3030 would.  Under Emacs 22, @kbd{mouse-1} will also follow a link.
3032 @kindex mouse-3
3033 @item mouse-3
3034 @vindex org-display-internal-link-with-indirect-buffer
3035 Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
3036 internal links to be displayed in another window@footnote{See the
3037 variable @code{org-display-internal-link-with-indirect-buffer}}.
3039 @cindex mark ring
3040 @kindex C-c %
3041 @item C-c %
3042 Push the current position onto the mark ring, to be able to return
3043 easily. Commands following an internal link do this automatically.
3045 @cindex links, returning to
3046 @kindex C-c &
3047 @item C-c &
3048 Jump back to a recorded position.  A position is recorded by the
3049 commands following internal links, and by @kbd{C-c %}.  Using this
3050 command several times in direct succession moves through a ring of
3051 previously recorded positions.
3053 @kindex C-c C-x C-n
3054 @kindex C-c C-x C-p
3055 @cindex links, finding next/previous
3056 @item C-c C-x C-n
3057 @itemx C-c C-x C-p
3058 Move forward/backward to the next link in the buffer.  At the limit of
3059 the buffer, the search fails once, and then wraps around.  The key
3060 bindings for this are really too long, you might want to bind this also
3061 to @kbd{C-n} and @kbd{C-p}
3062 @lisp
3063 (add-hook 'org-load-hook
3064   (lambda ()
3065     (define-key 'org-mode-map "\C-n" 'org-next-link)
3066     (define-key 'org-mode-map "\C-p" 'org-previous-link)))
3067 @end lisp
3068 @end table
3070 @node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
3071 @section Using links outside Org
3073 You can insert and follow links that have Org syntax not only in
3074 Org, but in any Emacs buffer.  For this, you should create two
3075 global commands, like this (please select suitable global keys
3076 yourself):
3078 @lisp
3079 (global-set-key "\C-c L" 'org-insert-link-global)
3080 (global-set-key "\C-c o" 'org-open-at-point-global)
3081 @end lisp
3083 @node Link abbreviations, Search options, Using links outside Org, Hyperlinks
3084 @section Link abbreviations
3085 @cindex link abbreviations
3086 @cindex abbreviation, links
3088 Long URLs can be cumbersome to type, and often many similar links are
3089 needed in a document.  For this you can use link abbreviations.  An
3090 abbreviated link looks like this
3092 @example
3093 [[linkword:tag][description]]
3094 @end example
3096 @noindent
3097 @vindex org-link-abbrev-alist
3098 where the tag is optional.  The @i{linkword} must be a word; letter, numbers,
3099 @samp{-}, and @samp{_} are allowed here.  Abbreviations are resolved
3100 according to the information in the variable @code{org-link-abbrev-alist}
3101 that relates the linkwords to replacement text.  Here is an example:
3103 @lisp
3104 @group
3105 (setq org-link-abbrev-alist
3106   '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
3107     ("google"   . "http://www.google.com/search?q=")
3108     ("ads"      . "http://adsabs.harvard.edu/cgi-bin/
3109                    nph-abs_connect?author=%s&db_key=AST")))
3110 @end group
3111 @end lisp
3113 If the replacement text contains the string @samp{%s}, it will be
3114 replaced with the tag.  Otherwise the tag will be appended to the string
3115 in order to create the link.  You may also specify a function that will
3116 be called with the tag as the only argument to create the link.
3118 With the above setting, you could link to a specific bug with
3119 @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
3120 @code{[[google:OrgMode]]} and find out what the Org author is
3121 doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
3123 If you need special abbreviations just for a single Org buffer, you
3124 can define them in the file with
3126 @cindex #+LINK
3127 @example
3128 #+LINK: bugzilla  http://10.1.2.9/bugzilla/show_bug.cgi?id=
3129 #+LINK: google    http://www.google.com/search?q=%s
3130 @end example
3132 @noindent
3133 In-buffer completion (@pxref{Completion}) can be used after @samp{[} to
3134 complete link abbreviations.  You may also define a function
3135 @code{org-PREFIX-complete-link} that implements special (@eg completion)
3136 support for inserting such a link with @kbd{C-c C-l}.  Such a function should
3137 not accept any arguments, and return the full link with prefix.
3139 @node Search options, Custom searches, Link abbreviations, Hyperlinks
3140 @section Search options in file links
3141 @cindex search option in file links
3142 @cindex file links, searching
3144 File links can contain additional information to make Emacs jump to a
3145 particular location in the file when following a link.  This can be a
3146 line number or a search option after a double@footnote{For backward
3147 compatibility, line numbers can also follow a single colon.} colon. For
3148 example, when the command @kbd{C-c l} creates a link (@pxref{Handling
3149 links}) to a file, it encodes the words in the current line as a search
3150 string that can be used to find this line back later when following the
3151 link with @kbd{C-c C-o}.
3153 Here is the syntax of the different ways to attach a search to a file
3154 link, together with an explanation:
3156 @example
3157 [[file:~/code/main.c::255]]
3158 [[file:~/xx.org::My Target]]
3159 [[file:~/xx.org::*My Target]]
3160 [[file:~/xx.org::/regexp/]]
3161 @end example
3163 @table @code
3164 @item 255
3165 Jump to line 255.
3166 @item My Target
3167 Search for a link target @samp{<<My Target>>}, or do a text search for
3168 @samp{my target}, similar to the search in internal links, see
3169 @ref{Internal links}.  In HTML export (@pxref{HTML export}), such a file
3170 link will become an HTML reference to the corresponding named anchor in
3171 the linked file.
3172 @item *My Target
3173 In an Org file, restrict search to headlines.
3174 @item /regexp/
3175 Do a regular expression search for @code{regexp}.  This uses the Emacs
3176 command @code{occur} to list all matches in a separate window.  If the
3177 target file is in Org mode, @code{org-occur} is used to create a
3178 sparse tree with the matches.
3179 @c If the target file is a directory,
3180 @c @code{grep} will be used to search all files in the directory.
3181 @end table
3183 As a degenerate case, a file link with an empty file name can be used
3184 to search the current file.  For example, @code{[[file:::find me]]} does
3185 a search for @samp{find me} in the current file, just as
3186 @samp{[[find me]]} would.
3188 @node Custom searches,  , Search options, Hyperlinks
3189 @section Custom Searches
3190 @cindex custom search strings
3191 @cindex search strings, custom
3193 The default mechanism for creating search strings and for doing the
3194 actual search related to a file link may not work correctly in all
3195 cases.  For example, Bib@TeX{} database files have many entries like
3196 @samp{year="1993"} which would not result in good search strings,
3197 because the only unique identification for a Bib@TeX{} entry is the
3198 citation key.
3200 @vindex org-create-file-search-functions
3201 @vindex org-execute-file-search-functions
3202 If you come across such a problem, you can write custom functions to set
3203 the right search string for a particular file type, and to do the search
3204 for the string in the file.  Using @code{add-hook}, these functions need
3205 to be added to the hook variables
3206 @code{org-create-file-search-functions} and
3207 @code{org-execute-file-search-functions}.  See the docstring for these
3208 variables for more information.  Org actually uses this mechanism
3209 for Bib@TeX{} database files, and you can use the corresponding code as
3210 an implementation example.  See the file @file{org-bibtex.el}.
3212 @node TODO Items, Tags, Hyperlinks, Top
3213 @chapter TODO Items
3214 @cindex TODO items
3216 Org mode does not maintain TODO lists as separate documents@footnote{Of
3217 course, you can make a document that contains only long lists of TODO items,
3218 but this is not required.}.  Instead, TODO items are an integral part of the
3219 notes file, because TODO items usually come up while taking notes!  With Org
3220 mode, simply mark any entry in a tree as being a TODO item.  In this way,
3221 information is not duplicated, and the entire context from which the TODO
3222 item emerged is always present.
3224 Of course, this technique for managing TODO items scatters them
3225 throughout your notes file.  Org mode compensates for this by providing
3226 methods to give you an overview of all the things that you have to do.
3228 @menu
3229 * TODO basics::                 Marking and displaying TODO entries
3230 * TODO extensions::             Workflow and assignments
3231 * Progress logging::            Dates and notes for progress
3232 * Priorities::                  Some things are more important than others
3233 * Breaking down tasks::         Splitting a task into manageable pieces
3234 * Checkboxes::                  Tick-off lists
3235 @end menu
3237 @node TODO basics, TODO extensions, TODO Items, TODO Items
3238 @section Basic TODO functionality
3240 Any headline becomes a TODO item when it starts with the word
3241 @samp{TODO}, for example:
3243 @example
3244 *** TODO Write letter to Sam Fortune
3245 @end example
3247 @noindent
3248 The most important commands to work with TODO entries are:
3250 @table @kbd
3251 @kindex C-c C-t
3252 @cindex cycling, of TODO states
3253 @item C-c C-t
3254 Rotate the TODO state of the current item among
3256 @example
3257 ,-> (unmarked) -> TODO -> DONE --.
3258 '--------------------------------'
3259 @end example
3261 The same rotation can also be done ``remotely'' from the timeline and
3262 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
3264 @kindex C-u C-c C-t
3265 @item C-u C-c C-t
3266 Select a specific keyword using completion or (if it has been set up)
3267 the fast selection interface.  For the latter, you need to assign keys
3268 to TODO states, see @ref{Per-file keywords}, and @ref{Setting tags}, for
3269 more information.
3271 @kindex S-@key{right}
3272 @kindex S-@key{left}
3273 @vindex org-treat-S-cursor-todo-selection-as-state-change
3274 @item S-@key{right}
3275 @itemx S-@key{left}
3276 Select the following/preceding TODO state, similar to cycling.  Useful
3277 mostly if more than two TODO states are possible (@pxref{TODO
3278 extensions}).  See also @ref{Conflicts}, for a discussion of the interaction
3279 with @code{shift-selection-mode}.  See also the variable
3280 @code{org-treat-S-cursor-todo-selection-as-state-change}.
3281 @kindex C-c C-v
3282 @kindex C-c / t
3283 @cindex sparse tree, for TODO
3284 @item C-c C-v
3285 @itemx C-c / t
3286 @vindex org-todo-keywords
3287 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds the
3288 entire buffer, but shows all TODO items and the headings hierarchy above
3289 them.  With a prefix argument, search for a specific TODO.  You will be
3290 prompted for the keyword, and you can also give a list of keywords like
3291 @code{KWD1|KWD2|...} to list entries that match any one of these keywords.
3292 With numeric prefix argument N, show the tree for the Nth keyword in the
3293 variable @code{org-todo-keywords}.  With two prefix arguments, find all TODO
3294 and DONE entries.
3295 @kindex C-c a t
3296 @item C-c a t
3297 Show the global TODO list.  Collects the TODO items from all agenda
3298 files (@pxref{Agenda Views}) into a single buffer.  The new buffer will
3299 be in @code{agenda-mode}, which provides commands to examine and
3300 manipulate the TODO entries from the new buffer (@pxref{Agenda
3301 commands}).  @xref{Global TODO list}, for more information.
3302 @kindex S-M-@key{RET}
3303 @item S-M-@key{RET}
3304 Insert a new TODO entry below the current one.
3305 @end table
3307 @noindent
3308 @vindex org-todo-state-tags-triggers
3309 Changing a TODO state can also trigger tag changes.  See the docstring of the
3310 option @code{org-todo-state-tags-triggers} for details.
3312 @node TODO extensions, Progress logging, TODO basics, TODO Items
3313 @section Extended use of TODO keywords
3314 @cindex extended TODO keywords
3316 @vindex org-todo-keywords
3317 By default, marked TODO entries have one of only two states: TODO and
3318 DONE.  Org mode allows you to classify TODO items in more complex ways
3319 with @emph{TODO keywords} (stored in @code{org-todo-keywords}).  With
3320 special setup, the TODO keyword system can work differently in different
3321 files.
3323 Note that @i{tags} are another way to classify headlines in general and
3324 TODO items in particular (@pxref{Tags}).
3326 @menu
3327 * Workflow states::             From TODO to DONE in steps
3328 * TODO types::                  I do this, Fred does the rest
3329 * Multiple sets in one file::   Mixing it all, and still finding your way
3330 * Fast access to TODO states::  Single letter selection of a state
3331 * Per-file keywords::           Different files, different requirements
3332 * Faces for TODO keywords::     Highlighting states
3333 * TODO dependencies::           When one task needs to wait for others
3334 @end menu
3336 @node Workflow states, TODO types, TODO extensions, TODO extensions
3337 @subsection TODO keywords as workflow states
3338 @cindex TODO workflow
3339 @cindex workflow states as TODO keywords
3341 You can use TODO keywords to indicate different @emph{sequential} states
3342 in the process of working on an item, for example@footnote{Changing
3343 this variable only becomes effective after restarting Org mode in a
3344 buffer.}:
3346 @lisp
3347 (setq org-todo-keywords
3348   '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
3349 @end lisp
3351 The vertical bar separates the TODO keywords (states that @emph{need
3352 action}) from the DONE states (which need @emph{no further action}).  If
3353 you don't provide the separator bar, the last state is used as the DONE
3354 state.
3355 @cindex completion, of TODO keywords
3356 With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
3357 to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED.  You may
3358 also use a numeric prefix argument to quickly select a specific state.  For
3359 example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
3360 Or you can use @kbd{S-@key{left}} to go backward through the sequence.  If you
3361 define many keywords, you can use in-buffer completion
3362 (@pxref{Completion}) or even a special one-key selection scheme
3363 (@pxref{Fast access to TODO states}) to insert these words into the
3364 buffer.  Changing a TODO state can be logged with a timestamp, see
3365 @ref{Tracking TODO state changes}, for more information.
3367 @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
3368 @subsection TODO keywords as types
3369 @cindex TODO types
3370 @cindex names as TODO keywords
3371 @cindex types as TODO keywords
3373 The second possibility is to use TODO keywords to indicate different
3374 @emph{types} of action items.  For example, you might want to indicate
3375 that items are for ``work'' or ``home''.  Or, when you work with several
3376 people on a single project, you might want to assign action items
3377 directly to persons, by using their names as TODO keywords.  This would
3378 be set up like this:
3380 @lisp
3381 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
3382 @end lisp
3384 In this case, different keywords do not indicate a sequence, but rather
3385 different types.  So the normal work flow would be to assign a task to a
3386 person, and later to mark it DONE.  Org mode supports this style by adapting
3387 the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
3388 @kbd{t} command in the timeline and agenda buffers.}.  When used several
3389 times in succession, it will still cycle through all names, in order to first
3390 select the right type for a task.  But when you return to the item after some
3391 time and execute @kbd{C-c C-t} again, it will switch from any name directly
3392 to DONE.  Use prefix arguments or completion to quickly select a specific
3393 name.  You can also review the items of a specific TODO type in a sparse tree
3394 by using a numeric prefix to @kbd{C-c C-v}.  For example, to see all things
3395 Lucy has to do, you would use @kbd{C-3 C-c C-v}.  To collect Lucy's items
3396 from all agenda files into a single buffer, you would use the numeric prefix
3397 argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
3399 @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
3400 @subsection Multiple keyword sets in one file
3401 @cindex TODO keyword sets
3403 Sometimes you may want to use different sets of TODO keywords in
3404 parallel.  For example, you may want to have the basic
3405 @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
3406 separate state indicating that an item has been canceled (so it is not
3407 DONE, but also does not require action).  Your setup would then look
3408 like this:
3410 @lisp
3411 (setq org-todo-keywords
3412       '((sequence "TODO" "|" "DONE")
3413         (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
3414         (sequence "|" "CANCELED")))
3415 @end lisp
3417 The keywords should all be different, this helps Org mode to keep track
3418 of which subsequence should be used for a given entry.  In this setup,
3419 @kbd{C-c C-t} only operates within a subsequence, so it switches from
3420 @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
3421 (nothing) to @code{REPORT}.  Therefore you need a mechanism to initially
3422 select the correct sequence.  Besides the obvious ways like typing a
3423 keyword or using completion, you may also apply the following commands:
3425 @table @kbd
3426 @kindex C-S-@key{right}
3427 @kindex C-S-@key{left}
3428 @kindex C-u C-u C-c C-t
3429 @item C-u C-u C-c C-t
3430 @itemx C-S-@key{right}
3431 @itemx C-S-@key{left}
3432 These keys jump from one TODO subset to the next.  In the above example,
3433 @kbd{C-u C-u C-c C-t} or @kbd{C-S-@key{right}} would jump from @code{TODO} or
3434 @code{DONE} to @code{REPORT}, and any of the words in the second row to
3435 @code{CANCELED}.  Note that the @kbd{C-S-} key binding conflict with
3436 @code{shift-selection-mode} (@pxref{Conflicts}).
3437 @kindex S-@key{right}
3438 @kindex S-@key{left}
3439 @item S-@key{right}
3440 @itemx S-@key{left}
3441 @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through @emph{all}
3442 keywords from all sets, so for example @kbd{S-@key{<right>}} would switch
3443 from @code{DONE} to @code{REPORT} in the example above.  See also
3444 @ref{Conflicts}, for a discussion of the interaction with
3445 @code{shift-selection-mode}.
3446 @end table
3448 @node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
3449 @subsection Fast access to TODO states
3451 If you would like to quickly change an entry to an arbitrary TODO state
3452 instead of cycling through the states, you can set up keys for
3453 single-letter access to the states.  This is done by adding the section
3454 key after each keyword, in parentheses.  For example:
3456 @lisp
3457 (setq org-todo-keywords
3458       '((sequence "TODO(t)" "|" "DONE(d)")
3459         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
3460         (sequence "|" "CANCELED(c)")))
3461 @end lisp
3463 @vindex org-fast-tag-selection-include-todo
3464 If you then press @code{C-c C-t} followed by the selection key, the entry
3465 will be switched to this state.  @key{SPC} can be used to remove any TODO
3466 keyword from an entry.@footnote{Check also the variable
3467 @code{org-fast-tag-selection-include-todo}, it allows you to change the TODO
3468 state through the tags interface (@pxref{Setting tags}), in case you like to
3469 mingle the two concepts.  Note that this means you need to come up with
3470 unique keys across both sets of keywords.}
3472 @node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
3473 @subsection Setting up keywords for individual files
3474 @cindex keyword options
3475 @cindex per-file keywords
3476 @cindex #+TODO
3477 @cindex #+TYP_TODO
3478 @cindex #+SEQ_TODO
3480 It can be very useful to use different aspects of the TODO mechanism in
3481 different files.  For file-local settings, you need to add special lines
3482 to the file which set the keywords and interpretation for that file
3483 only.  For example, to set one of the two examples discussed above, you
3484 need one of the following lines, starting in column zero anywhere in the
3485 file:
3487 @example
3488 #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
3489 @end example
3490 @noindent (you may also write @code{#+SEQ_TODO} to be explicit about the
3491 interpretation, but it means the same as @code{#+TODO}), or
3492 @example
3493 #+TYP_TODO: Fred Sara Lucy Mike | DONE
3494 @end example
3496 A setup for using several sets in parallel would be:
3498 @example
3499 #+TODO: TODO | DONE
3500 #+TODO: REPORT BUG KNOWNCAUSE | FIXED
3501 #+TODO: | CANCELED
3502 @end example
3504 @cindex completion, of option keywords
3505 @kindex M-@key{TAB}
3506 @noindent To make sure you are using the correct keyword, type
3507 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
3509 @cindex DONE, final TODO keyword
3510 Remember that the keywords after the vertical bar (or the last keyword
3511 if no bar is there) must always mean that the item is DONE (although you
3512 may use a different word).  After changing one of these lines, use
3513 @kbd{C-c C-c} with the cursor still in the line to make the changes
3514 known to Org mode@footnote{Org mode parses these lines only when
3515 Org mode is activated after visiting a file.  @kbd{C-c C-c} with the
3516 cursor in a line starting with @samp{#+} is simply restarting Org mode
3517 for the current buffer.}.
3519 @node Faces for TODO keywords, TODO dependencies, Per-file keywords, TODO extensions
3520 @subsection Faces for TODO keywords
3521 @cindex faces, for TODO keywords
3523 @vindex org-todo @r{(face)}
3524 @vindex org-done @r{(face)}
3525 @vindex org-todo-keyword-faces
3526 Org mode highlights TODO keywords with special faces: @code{org-todo}
3527 for keywords indicating that an item still has to be acted upon, and
3528 @code{org-done} for keywords indicating that an item is finished.  If
3529 you are using more than 2 different states, you might want to use
3530 special faces for some of them.  This can be done using the variable
3531 @code{org-todo-keyword-faces}.  For example:
3533 @lisp
3534 @group
3535 (setq org-todo-keyword-faces
3536       '(("TODO"      . org-warning)
3537         ("DEFERRED"  . shadow)
3538         ("CANCELED"  . (:foreground "blue" :weight bold))))
3539 @end group
3540 @end lisp
3542 While using a list with face properties as shown for CANCELED
3543 @emph{should} work, this does not aways seem to be the case.  If
3544 necessary, define a special face and use that.
3546 @node TODO dependencies,  , Faces for TODO keywords, TODO extensions
3547 @subsection TODO dependencies
3548 @cindex TODO dependencies
3549 @cindex dependencies, of TODO states
3551 @vindex org-enforce-todo-dependencies
3552 @cindex property, ORDERED
3553 The structure of Org files (hierarchy and lists) makes it easy to define TODO
3554 dependencies.  Usually, a parent TODO task should not be marked DONE until
3555 all subtasks (defined as children tasks) are marked as DONE.  And sometimes
3556 there is a logical sequence to a number of (sub)tasks, so that one task
3557 cannot be acted upon before all siblings above it are done.  If you customize
3558 the variable @code{org-enforce-todo-dependencies}, Org will block entries
3559 from changing state to DONE while they have children that are not DONE.
3560 Furthermore, if an entry has a property @code{ORDERED}, each of its children
3561 will be blocked until all earlier siblings are marked DONE.  Here is an
3562 example:
3564 @example
3565 * TODO Blocked until (two) is done
3566 ** DONE one
3567 ** TODO two
3569 * Parent
3570   :PROPERTIES:
3571     :ORDERED: t
3572   :END:
3573 ** TODO a
3574 ** TODO b, needs to wait for (a)
3575 ** TODO c, needs to wait for (a) and (b)
3576 @end example
3578 @table @kbd
3579 @kindex C-c C-x o
3580 @item C-c C-x o
3581 @vindex org-track-ordered-property-with-tag
3582 @cindex property, ORDERED
3583 Toggle the @code{ORDERED} property of the current entry.  A property is used
3584 for this behavior because this should be local to the current entry, not
3585 inherited like a tag.  However, if you would like to @i{track} the value of
3586 this property with a tag for better visibility, customize the variable
3587 @code{org-track-ordered-property-with-tag}.
3588 @kindex C-u C-u C-u C-c C-t
3589 @item C-u C-u C-u C-c C-t
3590 Change TODO state, circumventing any state blocking.
3591 @end table
3593 @vindex org-agenda-dim-blocked-tasks
3594 If you set the variable @code{org-agenda-dim-blocked-tasks}, TODO entries
3595 that cannot be closed because of such dependencies will be shown in a dimmed
3596 font or even made invisible in agenda views (@pxref{Agenda Views}).
3598 @cindex checkboxes and TODO dependencies
3599 @vindex org-enforce-todo-dependencies
3600 You can also block changes of TODO states by looking at checkboxes
3601 (@pxref{Checkboxes}).  If you set the variable
3602 @code{org-enforce-todo-checkbox-dependencies}, an entry that has unchecked
3603 checkboxes will be blocked from switching to DONE.
3605 If you need more complex dependency structures, for example dependencies
3606 between entries in different trees or files, check out the contributed
3607 module @file{org-depend.el}.
3609 @page
3610 @node Progress logging, Priorities, TODO extensions, TODO Items
3611 @section Progress logging
3612 @cindex progress logging
3613 @cindex logging, of progress
3615 Org mode can automatically record a timestamp and possibly a note when
3616 you mark a TODO item as DONE, or even each time you change the state of
3617 a TODO item.  This system is highly configurable, settings can be on a
3618 per-keyword basis and can be localized to a file or even a subtree.  For
3619 information on how to clock working time for a task, see @ref{Clocking
3620 work time}.
3622 @menu
3623 * Closing items::               When was this entry marked DONE?
3624 * Tracking TODO state changes::  When did the status change?
3625 @end menu
3627 @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
3628 @subsection Closing items
3630 The most basic logging is to keep track of @emph{when} a certain TODO
3631 item was finished.  This is achieved with@footnote{The corresponding
3632 in-buffer setting is: @code{#+STARTUP: logdone}}.
3634 @lisp
3635 (setq org-log-done 'time)
3636 @end lisp
3638 @noindent
3639 Then each time you turn an entry from a TODO (not-done) state into any
3640 of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
3641 just after the headline.  If you turn the entry back into a TODO item
3642 through further state cycling, that line will be removed again.  If you
3643 want to record a note along with the timestamp, use@footnote{The
3644 corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
3646 @lisp
3647 (setq org-log-done 'note)
3648 @end lisp
3650 @noindent
3651 You will then be prompted for a note, and that note will be stored below
3652 the entry with a @samp{Closing Note} heading.
3654 In the timeline (@pxref{Timeline}) and in the agenda
3655 (@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
3656 display the TODO items with a @samp{CLOSED} timestamp on each day,
3657 giving you an overview of what has been done.
3659 @node Tracking TODO state changes,  , Closing items, Progress logging
3660 @subsection Tracking TODO state changes
3661 @cindex drawer, for state change recording
3663 @vindex org-log-states-order-reversed
3664 @vindex org-log-into-drawer
3665 @cindex property, LOG_INTO_DRAWER
3666 When TODO keywords are used as workflow states (@pxref{Workflow states}), you
3667 might want to keep track of when a state change occurred and maybe take a
3668 note about this change.  You can either record just a timestamp, or a
3669 time-stamped note for a change.  These records will be inserted after the
3670 headline as an itemized list, newest first@footnote{See the variable
3671 @code{org-log-states-order-reversed}}.  When taking a lot of notes, you might
3672 want to get the notes out of the way into a drawer (@pxref{Drawers}).
3673 Customize the variable @code{org-log-into-drawer} to get this
3674 behavior---the recommended drawer for this is called @code{LOGBOOK}.  You can
3675 also overrule the setting of this variable for a subtree by setting a
3676 @code{LOG_INTO_DRAWER} property.
3678 Since it is normally too much to record a note for every state, Org mode
3679 expects configuration on a per-keyword basis for this.  This is achieved by
3680 adding special markers @samp{!} (for a timestamp) and @samp{@@} (for a note)
3681 in parentheses after each keyword.  For example, with the setting
3683 @lisp
3684 (setq org-todo-keywords
3685   '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
3686 @end lisp
3688 @noindent
3689 @vindex org-log-done
3690 you not only define global TODO keywords and fast access keys, but also
3691 request that a time is recorded when the entry is set to
3692 DONE@footnote{It is possible that Org mode will record two timestamps
3693 when you are using both @code{org-log-done} and state change logging.
3694 However, it will never prompt for two notes---if you have configured
3695 both, the state change recording note will take precedence and cancel
3696 the @samp{Closing Note}.}, and that a note is recorded when switching to
3697 WAIT or CANCELED.  The setting for WAIT is even more special: The
3698 @samp{!} after the slash means that in addition to the note taken when
3699 entering the state, a timestamp should be recorded when @i{leaving} the
3700 WAIT state, if and only if the @i{target} state does not configure
3701 logging for entering it.  So it has no effect when switching from WAIT
3702 to DONE, because DONE is configured to record a timestamp only.  But
3703 when switching from WAIT back to TODO, the @samp{/!} in the WAIT
3704 setting now triggers a timestamp even though TODO has no logging
3705 configured.
3707 You can use the exact same syntax for setting logging preferences local
3708 to a buffer:
3709 @example
3710 #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
3711 @end example
3713 @cindex property, LOGGING
3714 In order to define logging settings that are local to a subtree or a
3715 single item, define a LOGGING property in this entry.  Any non-empty
3716 LOGGING property resets all logging settings to nil.  You may then turn
3717 on logging for this specific tree using STARTUP keywords like
3718 @code{lognotedone} or @code{logrepeat}, as well as adding state specific
3719 settings like @code{TODO(!)}.  For example
3721 @example
3722 * TODO Log each state with only a time
3723   :PROPERTIES:
3724   :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
3725   :END:
3726 * TODO Only log when switching to WAIT, and when repeating
3727   :PROPERTIES:
3728   :LOGGING: WAIT(@@) logrepeat
3729   :END:
3730 * TODO No logging at all
3731   :PROPERTIES:
3732   :LOGGING: nil
3733   :END:
3734 @end example
3736 @node Priorities, Breaking down tasks, Progress logging, TODO Items
3737 @section Priorities
3738 @cindex priorities
3740 If you use Org mode extensively, you may end up enough TODO items that
3741 it starts to make sense to prioritize them.  Prioritizing can be done by
3742 placing a @emph{priority cookie} into the headline of a TODO item, like
3743 this
3745 @example
3746 *** TODO [#A] Write letter to Sam Fortune
3747 @end example
3749 @noindent
3750 By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
3751 @samp{C}.  @samp{A} is the highest priority.  An entry without a cookie
3752 is treated as priority @samp{B}.  Priorities make a difference only in
3753 the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
3754 no inherent meaning to Org mode.
3756 Priorities can be attached to any outline tree entries; they do not need
3757 to be TODO items.
3759 @table @kbd
3760 @kindex @kbd{C-c ,}
3761 @item @kbd{C-c ,}
3762 Set the priority of the current headline.  The command prompts for a
3763 priority character @samp{A}, @samp{B} or @samp{C}.  When you press
3764 @key{SPC} instead, the priority cookie is removed from the headline.
3765 The priorities can also be changed ``remotely'' from the timeline and
3766 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
3768 @kindex S-@key{up}
3769 @kindex S-@key{down}
3770 @item S-@key{up}
3771 @itemx S-@key{down}
3772 @vindex org-priority-start-cycle-with-default
3773 Increase/decrease priority of current headline@footnote{See also the option
3774 @code{org-priority-start-cycle-with-default}.}.  Note that these keys are
3775 also used to modify timestamps (@pxref{Creating timestamps}).  See also
3776 @ref{Conflicts}, for a discussion of the interaction with
3777 @code{shift-selection-mode}.
3778 @end table
3780 @vindex org-highest-priority
3781 @vindex org-lowest-priority
3782 @vindex org-default-priority
3783 You can change the range of allowed priorities by setting the variables
3784 @code{org-highest-priority}, @code{org-lowest-priority}, and
3785 @code{org-default-priority}.  For an individual buffer, you may set
3786 these values (highest, lowest, default) like this (please make sure that
3787 the highest priority is earlier in the alphabet than the lowest
3788 priority):
3790 @cindex #+PRIORITIES
3791 @example
3792 #+PRIORITIES: A C B
3793 @end example
3795 @node Breaking down tasks, Checkboxes, Priorities, TODO Items
3796 @section Breaking tasks down into subtasks
3797 @cindex tasks, breaking down
3799 @vindex org-agenda-todo-list-sublevels
3800 It is often advisable to break down large tasks into smaller, manageable
3801 subtasks.  You can do this by creating an outline tree below a TODO item,
3802 with detailed subtasks on the tree@footnote{To keep subtasks out of the
3803 global TODO list, see the @code{org-agenda-todo-list-sublevels}.}.  To keep
3804 the overview over the fraction of subtasks that are already completed, insert
3805 either @samp{[/]} or @samp{[%]} anywhere in the headline.  These cookies will
3806 be updates each time the todo status of a child changes.  For example:
3808 @example
3809 * Organize Party [33%]
3810 ** TODO Call people [1/2]
3811 *** TODO Peter
3812 *** DONE Sarah
3813 ** TODO Buy food
3814 ** DONE Talk to neighbor
3815 @end example
3817 @cindex property, COOKIE_DATA
3818 If a heading has both checkboxes and TODO children below it, the meaning of
3819 the statistics cookie become ambiguous.  Set the property
3820 @code{COOKIE_DATA} to either @samp{checkbox} or @samp{todo} to resolve
3821 this issue.
3823 If you would like a TODO entry to automatically change to DONE
3824 when all children are done, you can use the following setup:
3826 @example
3827 (defun org-summary-todo (n-done n-not-done)
3828   "Switch entry to DONE when all subentries are done, to TODO otherwise."
3829   (let (org-log-done org-log-states)   ; turn off logging
3830     (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
3832 (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
3833 @end example
3836 Another possibility is the use of checkboxes to identify (a hierarchy of) a
3837 large number of subtasks (@pxref{Checkboxes}).
3840 @node Checkboxes,  , Breaking down tasks, TODO Items
3841 @section Checkboxes
3842 @cindex checkboxes
3844 Every item in a plain list (@pxref{Plain lists}) can be made into a
3845 checkbox by starting it with the string @samp{[ ]}.  This feature is
3846 similar to TODO items (@pxref{TODO Items}), but is more lightweight.
3847 Checkboxes are not included into the global TODO list, so they are often
3848 great to split a task into a number of simple steps.  Or you can use
3849 them in a shopping list.  To toggle a checkbox, use @kbd{C-c C-c}, or
3850 use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
3852 Here is an example of a checkbox list.
3854 @example
3855 * TODO Organize party [2/4]
3856   - [-] call people [1/3]
3857     - [ ] Peter
3858     - [X] Sarah
3859     - [ ] Sam
3860   - [X] order food
3861   - [ ] think about what music to play
3862   - [X] talk to the neighbors
3863 @end example
3865 Checkboxes work hierarchically, so if a checkbox item has children that
3866 are checkboxes, toggling one of the children checkboxes will make the
3867 parent checkbox reflect if none, some, or all of the children are
3868 checked.
3870 @cindex statistics, for checkboxes
3871 @cindex checkbox statistics
3872 @cindex property, COOKIE_DATA
3873 The @samp{[2/4]} and @samp{[1/3]} in the first and second line are cookies
3874 indicating how many checkboxes present in this entry have been checked off,
3875 and the total number of checkboxes present.  This can give you an idea on
3876 how many checkboxes remain, even without opening a folded entry.  The cookies
3877 can be placed into a headline or into (the first line of) a plain list item.
3878 Each cookie covers checkboxes of direct children structurally below the
3879 headline/item on which the cookie appears@footnote{Set the variable
3880 @code{org-recursive-checkbox-statistics} if you want such cookes to represent
3881 the all checkboxes below the cookie, not just the direct children.}.  You
3882 have to insert the cookie yourself by typing either @samp{[/]} or @samp{[%]}.
3883 With @samp{[/]} you get an @samp{n out of m} result, as in the examples
3884 above.  With @samp{[%]} you get information about the percentage of
3885 checkboxes checked (in the above example, this would be @samp{[50%]} and
3886 @samp{[33%]}, respectively).  In a headline, a cookie can count either
3887 checkboxes below the heading or TODO states of children, and it will display
3888 whatever was changed last.  Set the property @code{COOKIE_DATA} to either
3889 @samp{checkbox} or @samp{todo} to resolve this issue.
3891 @cindex blocking, of checkboxes
3892 @cindex checkbox blocking
3893 @cindex property, ORDERED
3894 If the current outline node has an @code{ORDERED} property, checkboxes must
3895 be checked off in sequence, and an error will be thrown if you try to check
3896 off a box while there are unchecked boxes bove it.
3898 @noindent The following commands work with checkboxes:
3900 @table @kbd
3901 @kindex C-c C-c
3902 @item C-c C-c
3903 Toggle checkbox status or (with prefix arg) checkbox presence at point.  With
3904 double prefix argument, set it to @samp{[-]}, which is considered to be an
3905 intermediate state.
3906 @kindex C-c C-x C-b
3907 @item C-c C-x C-b
3908 Toggle checkbox status or (with prefix arg) checkbox presence at point.  With
3909 double prefix argument, set it to @samp{[-]}, which is considered to be an
3910 intermediate state.
3911 @itemize @minus
3912 @item
3913 If there is an active region, toggle the first checkbox in the region
3914 and set all remaining boxes to the same status as the first.  With a prefix
3915 arg, add or remove the checkbox for all items in the region.
3916 @item
3917 If the cursor is in a headline, toggle checkboxes in the region between
3918 this headline and the next (so @emph{not} the entire subtree).
3919 @item
3920 If there is no active region, just toggle the checkbox at point.
3921 @end itemize
3922 @kindex M-S-@key{RET}
3923 @item M-S-@key{RET}
3924 Insert a new item with a checkbox.
3925 This works only if the cursor is already in a plain list item
3926 (@pxref{Plain lists}).
3927 @kindex C-c C-x o
3928 @item C-c C-x o
3929 @vindex org-track-ordered-property-with-tag
3930 @cindex property, ORDERED
3931 Toggle the @code{ORDERED} property of the entry, to toggle if checkboxes must
3932 be checked off in sequence.  A property is used for this behavior because
3933 this should be local to the current entry, not inherited like a tag.
3934 However, if you would like to @i{track} the value of this property with a tag
3935 for better visibility, customize the variable
3936 @code{org-track-ordered-property-with-tag}.
3937 @kindex C-c #
3938 @item C-c #
3939 Update the checkbox statistics in the current outline entry.  When
3940 called with a @kbd{C-u} prefix, update the entire file.  Checkbox
3941 statistic cookies are updated automatically if you toggle checkboxes
3942 with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}.  If you
3943 delete boxes or add/change them by hand, use this command to get things
3944 back into sync.  Or simply toggle any checkbox twice with @kbd{C-c C-c}.
3945 @end table
3947 @node Tags, Properties and Columns, TODO Items, Top
3948 @chapter Tags
3949 @cindex tags
3950 @cindex headline tagging
3951 @cindex matching, tags
3952 @cindex sparse tree, tag based
3954 An excellent way to implement labels and contexts for cross-correlating
3955 information is to assign @i{tags} to headlines.  Org mode has extensive
3956 support for tags.
3958 @vindex org-tag-faces
3959 Every headline can contain a list of tags; they occur at the end of the
3960 headline.  Tags are normal words containing letters, numbers, @samp{_}, and
3961 @samp{@@}.  Tags must be preceded and followed by a single colon, @eg{},
3962 @samp{:work:}.  Several tags can be specified, as in @samp{:work:urgent:}.
3963 Tags will by default be in bold face with the same color as the headline.
3964 You may specify special faces for specific tags using the variable
3965 @code{org-tag-faces}, in much the same way as you can for TODO keywords
3966 (@pxref{Faces for TODO keywords}).
3968 @menu
3969 * Tag inheritance::             Tags use the tree structure of the outline
3970 * Setting tags::                How to assign tags to a headline
3971 * Tag searches::                Searching for combinations of tags
3972 @end menu
3974 @node Tag inheritance, Setting tags, Tags, Tags
3975 @section Tag inheritance
3976 @cindex tag inheritance
3977 @cindex inheritance, of tags
3978 @cindex sublevels, inclusion into tags match
3980 @i{Tags} make use of the hierarchical structure of outline trees.  If a
3981 heading has a certain tag, all subheadings will inherit the tag as
3982 well.  For example, in the list
3984 @example
3985 * Meeting with the French group      :work:
3986 ** Summary by Frank                  :boss:notes:
3987 *** TODO Prepare slides for him      :action:
3988 @end example
3990 @noindent
3991 the final heading will have the tags @samp{:work:}, @samp{:boss:},
3992 @samp{:notes:}, and @samp{:action:} even though the final heading is not
3993 explicitly marked with those tags.  You can also set tags that all entries in
3994 a file should inherit just as if these tags were defined in a hypothetical
3995 level zero that surrounds the entire file.
3997 @cindex #+FILETAGS
3998 @example
3999 #+FILETAGS: :Peter:Boss:Secret:
4000 @end example
4002 @noindent
4003 @vindex org-use-tag-inheritance
4004 @vindex org-tags-exclude-from-inheritance
4005 To limit tag inheritance to specific tags, or to turn it off entirely, use
4006 the variables @code{org-use-tag-inheritance} and
4007 @code{org-tags-exclude-from-inheritance}.
4009 @vindex org-tags-match-list-sublevels
4010 When a headline matches during a tags search while tag inheritance is turned
4011 on, all the sublevels in the same tree will (for a simple match form) match
4012 as well@footnote{This is only true if the search does not involve more
4013 complex tests including properties (@pxref{Property searches}).}.  The list
4014 of matches may then become very long.  If you only want to see the first tags
4015 match in a subtree, configure the variable
4016 @code{org-tags-match-list-sublevels} (not recommended).
4018 @node Setting tags, Tag searches, Tag inheritance, Tags
4019 @section Setting tags
4020 @cindex setting tags
4021 @cindex tags, setting
4023 @kindex M-@key{TAB}
4024 Tags can simply be typed into the buffer at the end of a headline.
4025 After a colon, @kbd{M-@key{TAB}} offers completion on tags.  There is
4026 also a special command for inserting tags:
4028 @table @kbd
4029 @kindex C-c C-q
4030 @item C-c C-q
4031 @cindex completion, of tags
4032 @vindex org-tags-column
4033 Enter new tags for the current headline.  Org mode will either offer
4034 completion or a special single-key interface for setting tags, see
4035 below.  After pressing @key{RET}, the tags will be inserted and aligned
4036 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
4037 tags in the current buffer will be aligned to that column, just to make
4038 things look nice.  TAGS are automatically realigned after promotion,
4039 demotion, and TODO state changes (@pxref{TODO basics}).
4040 @kindex C-c C-c
4041 @item C-c C-c
4042 When the cursor is in a headline, this does the same as @kbd{C-c C-q}.
4043 @end table
4045 @vindex org-tag-alist
4046 Org will support tag insertion based on a @emph{list of tags}.  By
4047 default this list is constructed dynamically, containing all tags
4048 currently used in the buffer.  You may also globally specify a hard list
4049 of tags with the variable @code{org-tag-alist}.  Finally you can set
4050 the default tags for a given file with lines like
4052 @cindex #+TAGS
4053 @example
4054 #+TAGS: @@work @@home @@tennisclub
4055 #+TAGS: laptop car pc sailboat
4056 @end example
4058 If you have globally defined your preferred set of tags using the
4059 variable @code{org-tag-alist}, but would like to use a dynamic tag list
4060 in a specific file, add an empty TAGS option line to that file:
4062 @example
4063 #+TAGS:
4064 @end example
4066 @vindex org-tag-persistent-alist
4067 If you have a preferred set of tags that you would like to use in every file,
4068 in addition to those defined on a per-file basis by TAGS option lines, then
4069 you may specify a list of tags with the variable
4070 @code{org-tag-persistent-alist}.  You may turn this off on a per-file basis
4071 by adding a STARTUP option line to that file:
4073 @example
4074 #+STARTUP: noptag
4075 @end example
4077 By default Org mode uses the standard minibuffer completion facilities for
4078 entering tags.  However, it also implements another, quicker, tag selection
4079 method called @emph{fast tag selection}.  This allows you to select and
4080 deselect tags with just a single key press.  For this to work well you should
4081 assign unique letters to most of your commonly used tags.  You can do this
4082 globally by configuring the variable @code{org-tag-alist} in your
4083 @file{.emacs} file.  For example, you may find the need to tag many items in
4084 different files with @samp{:@@home:}.  In this case you can set something
4085 like:
4087 @lisp
4088 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
4089 @end lisp
4091 @noindent If the tag is only relevant to the file you are working on, then you
4092 can instead set the TAGS option line as:
4094 @example
4095 #+TAGS: @@work(w)  @@home(h)  @@tennisclub(t)  laptop(l)  pc(p)
4096 @end example
4098 @noindent The tags interface will show the available tags in a splash
4099 window.  If you want to start a new line after a specific tag, insert
4100 @samp{\n} into the tag list
4102 @example
4103 #+TAGS: @@work(w)  @@home(h)  @@tennisclub(t) \n laptop(l)  pc(p)
4104 @end example
4106 @noindent or write them in two lines:
4108 @example
4109 #+TAGS: @@work(w)  @@home(h)  @@tennisclub(t)
4110 #+TAGS: laptop(l)  pc(p)
4111 @end example
4113 @noindent
4114 You can also group together tags that are mutually exclusive by using
4115 braces, as in:
4117 @example
4118 #+TAGS: @{ @@work(w)  @@home(h)  @@tennisclub(t) @}  laptop(l)  pc(p)
4119 @end example
4121 @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
4122 and @samp{@@tennisclub} should be selected.  Multiple such groups are allowed.
4124 @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
4125 these lines to activate any changes.
4127 @noindent
4128 To set these mutually exclusive groups in the variable @code{org-tags-alist},
4129 you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
4130 of the braces.  Similarly, you can use @code{:newline} to indicate a line
4131 break.  The previous example would be set globally by the following
4132 configuration:
4134 @lisp
4135 (setq org-tag-alist '((:startgroup . nil)
4136                       ("@@work" . ?w) ("@@home" . ?h)
4137                       ("@@tennisclub" . ?t)
4138                       (:endgroup . nil)
4139                       ("laptop" . ?l) ("pc" . ?p)))
4140 @end lisp
4142 If at least one tag has a selection key then pressing @kbd{C-c C-c} will
4143 automatically present you with a special interface, listing inherited tags,
4144 the tags of the current headline, and a list of all valid tags with
4145 corresponding keys@footnote{Keys will automatically be assigned to tags which
4146 have no configured keys.}.  In this interface, you can use the following
4147 keys:
4149 @table @kbd
4150 @item a-z...
4151 Pressing keys assigned to tags will add or remove them from the list of
4152 tags in the current line.  Selecting a tag in a group of mutually
4153 exclusive tags will turn off any other tags from that group.
4154 @kindex @key{TAB}
4155 @item @key{TAB}
4156 Enter a tag in the minibuffer, even if the tag is not in the predefined
4157 list.  You will be able to complete on all tags present in the buffer.
4158 @kindex @key{SPC}
4159 @item @key{SPC}
4160 Clear all tags for this line.
4161 @kindex @key{RET}
4162 @item @key{RET}
4163 Accept the modified set.
4164 @item C-g
4165 Abort without installing changes.
4166 @item q
4167 If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
4168 @item !
4169 Turn off groups of mutually exclusive tags.  Use this to (as an
4170 exception) assign several tags from such a group.
4171 @item C-c
4172 Toggle auto-exit after the next change (see below).
4173 If you are using expert mode, the first @kbd{C-c} will display the
4174 selection window.
4175 @end table
4177 @noindent
4178 This method lets you assign tags to a headline with very few keys.  With
4179 the above setup, you could clear the current tags and set @samp{@@home},
4180 @samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
4181 C-c @key{SPC} h l p @key{RET}}.  Switching from @samp{@@home} to
4182 @samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
4183 alternatively with @kbd{C-c C-c C-c w}.  Adding the non-predefined tag
4184 @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
4185 @key{RET} @key{RET}}.
4187 @vindex org-fast-tag-selection-single-key
4188 If you find that most of the time you need only a single key press to
4189 modify your list of tags, set the variable
4190 @code{org-fast-tag-selection-single-key}.  Then you no longer have to
4191 press @key{RET} to exit fast tag selection---it will immediately exit
4192 after the first change.  If you then occasionally need more keys, press
4193 @kbd{C-c} to turn off auto-exit for the current tag selection process
4194 (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
4195 C-c}).  If you set the variable to the value @code{expert}, the special
4196 window is not even shown for single-key tag selection, it comes up only
4197 when you press an extra @kbd{C-c}.
4199 @node Tag searches,  , Setting tags, Tags
4200 @section Tag searches
4201 @cindex tag searches
4202 @cindex searching for tags
4204 Once a system of tags has been set up, it can be used to collect related
4205 information into special lists.
4207 @table @kbd
4208 @kindex C-c \
4209 @kindex C-c / m
4210 @item C-c \
4211 @itemx C-c / m
4212 Create a sparse tree with all headlines matching a tags search.  With a
4213 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
4214 @kindex C-c a m
4215 @item C-c a m
4216 Create a global list of tag matches from all agenda files.
4217 @xref{Matching tags and properties}.
4218 @kindex C-c a M
4219 @item C-c a M
4220 @vindex org-tags-match-list-sublevels
4221 Create a global list of tag matches from all agenda files, but check
4222 only TODO items and force checking subitems (see variable
4223 @code{org-tags-match-list-sublevels}).
4224 @end table
4226 These commands all prompt for a match string which allows basic Boolean logic
4227 like @samp{+boss+urgent-project1}, to find entries with tags @samp{boss} and
4228 @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find entries
4229 which are tagged, like @samp{Kathy} or @samp{Sally}.  The full syntax of the search
4230 string is rich and allows also matching against TODO keywords, entry levels
4231 and properties.  For a complete description with many examples, see
4232 @ref{Matching tags and properties}.
4235 @node Properties and Columns, Dates and Times, Tags, Top
4236 @chapter Properties and Columns
4237 @cindex properties
4239 Properties are a set of key-value pairs associated with an entry.  There
4240 are two main applications for properties in Org mode.  First, properties
4241 are like tags, but with a value.  Second, you can use properties to
4242 implement (very basic) database capabilities in an Org buffer.  For
4243 an example of the first application, imagine maintaining a file where
4244 you document bugs and plan releases for a piece of software.  Instead of
4245 using tags like @code{:release_1:}, @code{:release_2:}, one can use a
4246 property, say @code{:Release:}, that in different subtrees has different
4247 values, such as @code{1.0} or @code{2.0}.  For an example of the second
4248 application of properties, imagine keeping track of your music CDs,
4249 where properties could be things such as the album, artist, date of
4250 release, number of tracks, and so on.
4252 Properties can be conveniently edited and viewed in column view
4253 (@pxref{Column view}).
4255 @menu
4256 * Property syntax::             How properties are spelled out
4257 * Special properties::          Access to other Org mode features
4258 * Property searches::           Matching property values
4259 * Property inheritance::        Passing values down the tree
4260 * Column view::                 Tabular viewing and editing
4261 * Property API::                Properties for Lisp programmers
4262 @end menu
4264 @node Property syntax, Special properties, Properties and Columns, Properties and Columns
4265 @section Property syntax
4266 @cindex property syntax
4267 @cindex drawer, for properties
4269 Properties are key-value pairs.  They need to be inserted into a special
4270 drawer (@pxref{Drawers}) with the name @code{PROPERTIES}.  Each property
4271 is specified on a single line, with the key (surrounded by colons)
4272 first, and the value after it.  Here is an example:
4274 @example
4275 * CD collection
4276 ** Classic
4277 *** Goldberg Variations
4278     :PROPERTIES:
4279     :Title:     Goldberg Variations
4280     :Composer:  J.S. Bach
4281     :Artist:    Glen Gould
4282     :Publisher: Deutsche Grammophon
4283     :NDisks:    1
4284     :END:
4285 @end example
4287 You may define the allowed values for a particular property @samp{:Xyz:}
4288 by setting a property @samp{:Xyz_ALL:}.  This special property is
4289 @emph{inherited}, so if you set it in a level 1 entry, it will apply to
4290 the entire tree.  When allowed values are defined, setting the
4291 corresponding property becomes easier and is less prone to typing
4292 errors.  For the example with the CD collection, we can predefine
4293 publishers and the number of disks in a box like this:
4295 @example
4296 * CD collection
4297   :PROPERTIES:
4298   :NDisks_ALL:  1 2 3 4
4299   :Publisher_ALL: "Deutsche Grammophon" Philips EMI
4300   :END:
4301 @end example
4303 If you want to set properties that can be inherited by any entry in a
4304 file, use a line like
4305 @cindex property, _ALL
4306 @cindex #+PROPERTY
4307 @example
4308 #+PROPERTY: NDisks_ALL 1 2 3 4
4309 @end example
4311 @vindex org-global-properties
4312 Property values set with the global variable
4313 @code{org-global-properties} can be inherited by all entries in all
4314 Org files.
4316 @noindent
4317 The following commands help to work with properties:
4319 @table @kbd
4320 @kindex M-@key{TAB}
4321 @item M-@key{TAB}
4322 After an initial colon in a line, complete property keys.  All keys used
4323 in the current file will be offered as possible completions.
4324 @kindex C-c C-x p
4325 @item C-c C-x p
4326 Set a property.  This prompts for a property name and a value.  If
4327 necessary, the property drawer is created as well.
4328 @item M-x org-insert-property-drawer
4329 Insert a property drawer into the current entry.  The drawer will be
4330 inserted early in the entry, but after the lines with planning
4331 information like deadlines.
4332 @kindex C-c C-c
4333 @item C-c C-c
4334 With the cursor in a property drawer, this executes property commands.
4335 @item C-c C-c s
4336 Set a property in the current entry.  Both the property and the value
4337 can be inserted using completion.
4338 @kindex S-@key{right}
4339 @kindex S-@key{left}
4340 @item S-@key{left}/@key{right}
4341 Switch property at point to the next/previous allowed value.
4342 @item C-c C-c d
4343 Remove a property from the current entry.
4344 @item C-c C-c D
4345 Globally remove a property, from all entries in the current file.
4346 @item C-c C-c c
4347 Compute the property at point, using the operator and scope from the
4348 nearest column format definition.
4349 @end table
4351 @node Special properties, Property searches, Property syntax, Properties and Columns
4352 @section Special properties
4353 @cindex properties, special
4355 Special properties provide an alternative access method to Org mode
4356 features, like the TODO state or the priority of an entry, discussed in the
4357 previous chapters.  This interface exists so that you can include
4358 these states in a column view (@pxref{Column view}), or to use them in
4359 queries.  The following property names are special and should not be
4360 used as keys in the properties drawer:
4362 @cindex property, special, TODO
4363 @cindex property, special, TAGS
4364 @cindex property, special, ALLTAGS
4365 @cindex property, special, CATEGORY
4366 @cindex property, special, PRIORITY
4367 @cindex property, special, DEADLINE
4368 @cindex property, special, SCHEDULED
4369 @cindex property, special, CLOSED
4370 @cindex property, special, TIMESTAMP
4371 @cindex property, special, TIMESTAMP_IA
4372 @cindex property, special, CLOCKSUM
4373 @c guessing that ITEM is needed in this area; also, should this list be sorted?
4374 @cindex property, special, ITEM
4375 @example
4376 TODO         @r{The TODO keyword of the entry.}
4377 TAGS         @r{The tags defined directly in the headline.}
4378 ALLTAGS      @r{All tags, including inherited ones.}
4379 CATEGORY     @r{The category of an entry.}
4380 PRIORITY     @r{The priority of the entry, a string with a single letter.}
4381 DEADLINE     @r{The deadline time string, without the angular brackets.}
4382 SCHEDULED    @r{The scheduling timestamp, without the angular brackets.}
4383 CLOSED       @r{When was this entry closed?}
4384 TIMESTAMP    @r{The first keyword-less timestamp in the entry.}
4385 TIMESTAMP_IA @r{The first inactive timestamp in the entry.}
4386 CLOCKSUM     @r{The sum of CLOCK intervals in the subtree.  @code{org-clock-sum}}
4387              @r{must be run first to compute the values.}
4388 ITEM         @r{The content of the entry.}
4389 @end example
4391 @node Property searches, Property inheritance, Special properties, Properties and Columns
4392 @section Property searches
4393 @cindex properties, searching
4394 @cindex searching, of properties
4396 To create sparse trees and special lists with selection based on properties,
4397 the same commands are used as for tag searches (@pxref{Tag searches}).
4398 @table @kbd
4399 @kindex C-c \
4400 @kindex C-c / m
4401 @item C-c \
4402 @itemx C-c / m
4403 Create a sparse tree with all matching entries.  With a
4404 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
4405 @kindex C-c a m
4406 @item C-c a m
4407 Create a global list of tag/property  matches from all agenda files.
4408 @xref{Matching tags and properties}.
4409 @kindex C-c a M
4410 @item C-c a M
4411 @vindex org-tags-match-list-sublevels
4412 Create a global list of tag matches from all agenda files, but check
4413 only TODO items and force checking of subitems (see variable
4414 @code{org-tags-match-list-sublevels}).
4415 @end table
4417 The syntax for the search string is described in @ref{Matching tags and
4418 properties}.
4420 There is also a special command for creating sparse trees based on a
4421 single property:
4423 @table @kbd
4424 @kindex C-c / p
4425 @item C-c / p
4426 Create a sparse tree based on the value of a property.  This first
4427 prompts for the name of a property, and then for a value.  A sparse tree
4428 is created with all entries that define this property with the given
4429 value.  If you enclose the value into curly braces, it is interpreted as
4430 a regular expression and matched against the property values.
4431 @end table
4433 @node Property inheritance, Column view, Property searches, Properties and Columns
4434 @section Property Inheritance
4435 @cindex properties, inheritance
4436 @cindex inheritance, of properties
4438 @vindex org-use-property-inheritance
4439 The outline structure of Org-mode documents lends itself for an
4440 inheritance model of properties: If the parent in a tree has a certain
4441 property, the children can inherit this property.  Org mode does not
4442 turn this on by default, because it can slow down property searches
4443 significantly and is often not needed.  However, if you find inheritance
4444 useful, you can turn it on by setting the variable
4445 @code{org-use-property-inheritance}.  It may be set to @code{t} to make
4446 all properties inherited from the parent, to a list of properties
4447 that should be inherited, or to a regular expression that matches
4448 inherited properties.
4450 Org mode has a few properties for which inheritance is hard-coded, at
4451 least for the special applications for which they are used:
4453 @cindex property, COLUMNS
4454 @table @code
4455 @item COLUMNS
4456 The @code{:COLUMNS:} property defines the format of column view
4457 (@pxref{Column view}).  It is inherited in the sense that the level
4458 where a @code{:COLUMNS:} property is defined is used as the starting
4459 point for a column view table, independently of the location in the
4460 subtree from where columns view is turned on.
4461 @item CATEGORY
4462 @cindex property, CATEGORY
4463 For agenda view, a category set through a @code{:CATEGORY:} property
4464 applies to the entire subtree.
4465 @item ARCHIVE
4466 @cindex property, ARCHIVE
4467 For archiving, the @code{:ARCHIVE:} property may define the archive
4468 location for the entire subtree (@pxref{Moving subtrees}).
4469 @item LOGGING
4470 @cindex property, LOGGING
4471 The LOGGING property may define logging settings for an entry or a
4472 subtree (@pxref{Tracking TODO state changes}).
4473 @end table
4475 @node Column view, Property API, Property inheritance, Properties and Columns
4476 @section Column view
4478 A great way to view and edit properties in an outline tree is
4479 @emph{column view}.  In column view, each outline item is turned into a
4480 table row.  Columns in this table provide access to properties of the
4481 entries.  Org mode implements columns by overlaying a tabular structure
4482 over the headline of each item.  While the headlines have been turned
4483 into a table row, you can still change the visibility of the outline
4484 tree.  For example, you get a compact table by switching to CONTENTS
4485 view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
4486 is active), but you can still open, read, and edit the entry below each
4487 headline.  Or, you can switch to column view after executing a sparse
4488 tree command and in this way get a table only for the selected items.
4489 Column view also works in agenda buffers (@pxref{Agenda Views}) where
4490 queries have collected selected items, possibly from a number of files.
4492 @menu
4493 * Defining columns::            The COLUMNS format property
4494 * Using column view::           How to create and use column view
4495 * Capturing column view::       A dynamic block for column view
4496 @end menu
4498 @node Defining columns, Using column view, Column view, Column view
4499 @subsection Defining columns
4500 @cindex column view, for properties
4501 @cindex properties, column view
4503 Setting up a column view first requires defining the columns.  This is
4504 done by defining a column format line.
4506 @menu
4507 * Scope of column definitions::  Where defined, where valid?
4508 * Column attributes::           Appearance and content of a column
4509 @end menu
4511 @node Scope of column definitions, Column attributes, Defining columns, Defining columns
4512 @subsubsection Scope of column definitions
4514 To define a column format for an entire file, use a line like
4516 @cindex #+COLUMNS
4517 @example
4518 #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
4519 @end example
4521 To specify a format that only applies to a specific tree, add a
4522 @code{:COLUMNS:} property to the top node of that tree, for example:
4524 @example
4525 ** Top node for columns view
4526    :PROPERTIES:
4527    :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
4528    :END:
4529 @end example
4531 If a @code{:COLUMNS:} property is present in an entry, it defines columns
4532 for the entry itself, and for the entire subtree below it.  Since the
4533 column definition is part of the hierarchical structure of the document,
4534 you can define columns on level 1 that are general enough for all
4535 sublevels, and more specific columns further down, when you edit a
4536 deeper part of the tree.
4538 @node Column attributes,  , Scope of column definitions, Defining columns
4539 @subsubsection Column attributes
4540 A column definition sets the attributes of a column.  The general
4541 definition looks like this:
4543 @example
4544  %[@var{width}]@var{property}[(@var{title})][@{@var{summary-type}@}]
4545 @end example
4547 @noindent
4548 Except for the percent sign and the property name, all items are
4549 optional.  The individual parts have the following meaning:
4551 @example
4552 @var{width}           @r{An integer specifying the width of the column in characters.}
4553                 @r{If omitted, the width will be determined automatically.}
4554 @var{property}        @r{The property that should be edited in this column.}
4555 (title)         @r{The header text for the column. If omitted, the}
4556                 @r{property name is used.}
4557 @{@var{summary-type}@}  @r{The summary type.  If specified, the column values for}
4558                 @r{parent nodes are computed from the children.}
4559                 @r{Supported summary types are:}
4560                 @{+@}       @r{Sum numbers in this column.}
4561                 @{+;%.1f@}  @r{Like @samp{+}, but format result with @samp{%.1f}.}
4562                 @{$@}       @r{Currency, short for @samp{+;%.2f}.}
4563                 @{:@}       @r{Sum times, HH:MM:SS, plain numbers are hours.}
4564                 @{X@}       @r{Checkbox status, @samp{[X]} if all children are @samp{[X]}.}
4565                 @{X/@}      @r{Checkbox status, @samp{[n/m]}.}
4566                 @{X%@}      @r{Checkbox status, @samp{[n%]}.}
4567                 @{min@}     @r{Smallest number in column.}
4568                 @{max@}     @r{Largest number.}
4569                 @{mean@}    @r{Arithmetic mean of numbers.}
4570                 @{:min@}    @r{Smallest time value in column.}
4571                 @{:max@}    @r{Largest time value.}
4572                 @{:mean@}   @r{Arithmetic mean of time values.}
4573 @end example
4575 @noindent
4576 Here is an example for a complete columns definition, along with allowed
4577 values.
4579 @example
4580 :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.}
4581                    %10Time_Estimate@{:@} %CLOCKSUM
4582 :Owner_ALL:    Tammy Mark Karl Lisa Don
4583 :Status_ALL:   "In progress" "Not started yet" "Finished" ""
4584 :Approved_ALL: "[ ]" "[X]"
4585 @end example
4587 @noindent
4588 The first column, @samp{%25ITEM}, means the first 25 characters of the
4589 item itself, @ie of the headline.  You probably always should start the
4590 column definition with the @samp{ITEM} specifier.  The other specifiers
4591 create columns @samp{Owner} with a list of names as allowed values, for
4592 @samp{Status} with four different possible values, and for a checkbox
4593 field @samp{Approved}.  When no width is given after the @samp{%}
4594 character, the column will be exactly as wide as it needs to be in order
4595 to fully display all values.  The @samp{Approved} column does have a
4596 modified title (@samp{Approved?}, with a question mark).  Summaries will
4597 be created for the @samp{Time_Estimate} column by adding time duration
4598 expressions like HH:MM, and for the @samp{Approved} column, by providing
4599 an @samp{[X]} status if all children have been checked.  The
4600 @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
4601 in the subtree.
4603 @node Using column view, Capturing column view, Defining columns, Column view
4604 @subsection Using column view
4606 @table @kbd
4607 @tsubheading{Turning column view on and off}
4608 @kindex C-c C-x C-c
4609 @item C-c C-x C-c
4610 @vindex org-columns-default-format
4611 Create the column view for the local environment.  This command searches
4612 the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
4613 a format.  When one is found, the column view table is established for
4614 the entire tree, starting from the entry that contains the @code{:COLUMNS:}
4615 property.  If none is found, the format is taken from the @code{#+COLUMNS}
4616 line or from the variable @code{org-columns-default-format}, and column
4617 view is established for the current entry and its subtree.
4618 @kindex r
4619 @item r
4620 Recreate the column view, to include recent changes made in the buffer.
4621 @kindex g
4622 @item g
4623 Same as @kbd{r}.
4624 @kindex q
4625 @item q
4626 Exit column view.
4627 @tsubheading{Editing values}
4628 @item @key{left} @key{right} @key{up} @key{down}
4629 Move through the column view from field to field.
4630 @kindex S-@key{left}
4631 @kindex S-@key{right}
4632 @item  S-@key{left}/@key{right}
4633 Switch to the next/previous allowed value of the field.  For this, you
4634 have to have specified allowed values for a property.
4635 @item 1..9,0
4636 Directly select the nth allowed value, @kbd{0} selects the 10th value.
4637 @kindex n
4638 @kindex p
4639 @itemx  n / p
4640 Same as @kbd{S-@key{left}/@key{right}}
4641 @kindex e
4642 @item e
4643 Edit the property at point.  For the special properties, this will
4644 invoke the same interface that you normally use to change that
4645 property.  For example, when editing a TAGS property, the tag completion
4646 or fast selection interface will pop up.
4647 @kindex C-c C-c
4648 @item C-c C-c
4649 When there is a checkbox at point, toggle it.
4650 @kindex v
4651 @item v
4652 View the full value of this property.  This is useful if the width of
4653 the column is smaller than that of the value.
4654 @kindex a
4655 @item a
4656 Edit the list of allowed values for this property.  If the list is found
4657 in the hierarchy, the modified values is stored there.  If no list is
4658 found, the new value is stored in the first entry that is part of the
4659 current column view.
4660 @tsubheading{Modifying the table structure}
4661 @kindex <
4662 @kindex >
4663 @item < / >
4664 Make the column narrower/wider by one character.
4665 @kindex S-M-@key{right}
4666 @item S-M-@key{right}
4667 Insert a new column, to the left of the current column.
4668 @kindex S-M-@key{left}
4669 @item S-M-@key{left}
4670 Delete the current column.
4671 @end table
4673 @node Capturing column view,  , Using column view, Column view
4674 @subsection Capturing column view
4676 Since column view is just an overlay over a buffer, it cannot be
4677 exported or printed directly.  If you want to capture a column view, use
4678 a @code{columnview} dynamic block (@pxref{Dynamic blocks}).  The frame
4679 of this block looks like this:
4681 @cindex #+BEGIN, columnview
4682 @example
4683 * The column view
4684 #+BEGIN: columnview :hlines 1 :id "label"
4686 #+END:
4687 @end example
4689 @noindent This dynamic block has the following parameters:
4691 @table @code
4692 @item :id
4693 This is the most important parameter.  Column view is a feature that is
4694 often localized to a certain (sub)tree, and the capture block might be
4695 at a different location in the file.  To identify the tree whose view to
4696 capture, you can use 4 values:
4697 @cindex property, ID
4698 @example
4699 local     @r{use the tree in which the capture block is located}
4700 global    @r{make a global view, including all headings in the file}
4701 "file:@var{path-to-file}"
4702           @r{run column view at the top of this file}
4703 "@var{ID}"      @r{call column view in the tree that has an @code{:ID:}}
4704           @r{property with the value @i{label}.  You can use}
4705           @r{@kbd{M-x org-id-copy} to create a globally unique ID for}
4706           @r{the current entry and copy it to the kill-ring.}
4707 @end example
4708 @item :hlines
4709 When @code{t}, insert an hline after every line.  When a number @var{N}, insert
4710 an hline before each headline with level @code{<= @var{N}}.
4711 @item :vlines
4712 When set to @code{t}, force column groups to get vertical lines.
4713 @item :maxlevel
4714 When set to a number, don't capture entries below this level.
4715 @item :skip-empty-rows
4716 When set to @code{t}, skip rows where the only non-empty specifier of the
4717 column view is @code{ITEM}.
4719 @end table
4721 @noindent
4722 The following commands insert or update the dynamic block:
4724 @table @kbd
4725 @kindex C-c C-x i
4726 @item C-c C-x i
4727 Insert a dynamic block capturing a column view.  You will be prompted
4728 for the scope or ID of the view.
4729 @kindex C-c C-c
4730 @item C-c C-c
4731 @kindex C-c C-x C-u
4732 @itemx C-c C-x C-u
4733 Update dynamic block at point.  The cursor needs to be in the
4734 @code{#+BEGIN} line of the dynamic block.
4735 @kindex C-u C-c C-x C-u
4736 @item C-u C-c C-x C-u
4737 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
4738 you have several clock table blocks in a buffer.
4739 @end table
4741 You can add formulas to the column view table and you may add plotting
4742 instructions in front of the table---these will survive an update of the
4743 block.  If there is a @code{#+TBLFM:} after the table, the table will
4744 actually be recalculated automatically after an update.
4746 An alternative way to capture and process property values into a table is
4747 provided by Eric Schulte's @file{org-collector.el} which is a contributed
4748 package@footnote{Contributed packages are not part of Emacs, but are
4749 distributed with the main distribution of Org (visit
4750 @uref{http://orgmode.org}).}.  It provides a general API to collect
4751 properties from entries in a certain scope, and arbitrary Lisp expressions to
4752 process these values before inserting them into a table or a dynamic block.
4754 @node Property API,  , Column view, Properties and Columns
4755 @section The Property API
4756 @cindex properties, API
4757 @cindex API, for properties
4759 There is a full API for accessing and changing properties.  This API can
4760 be used by Emacs Lisp programs to work with properties and to implement
4761 features based on them.  For more information see @ref{Using the
4762 property API}.
4764 @node Dates and Times, Capture, Properties and Columns, Top
4765 @chapter Dates and Times
4766 @cindex dates
4767 @cindex times
4768 @cindex timestamp
4769 @cindex date stamp
4771 To assist project planning, TODO items can be labeled with a date and/or
4772 a time.  The specially formatted string carrying the date and time
4773 information is called a @emph{timestamp} in Org mode.  This may be a
4774 little confusing because timestamp is often used as indicating when
4775 something was created or last changed.  However, in Org mode this term
4776 is used in a much wider sense.
4778 @menu
4779 * Timestamps::                  Assigning a time to a tree entry
4780 * Creating timestamps::         Commands which insert timestamps
4781 * Deadlines and scheduling::    Planning your work
4782 * Clocking work time::          Tracking how long you spend on a task
4783 * Effort estimates::            Planning work effort in advance
4784 * Relative timer::              Notes with a running timer
4785 @end menu
4788 @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
4789 @section Timestamps, deadlines, and scheduling
4790 @cindex timestamps
4791 @cindex ranges, time
4792 @cindex date stamps
4793 @cindex deadlines
4794 @cindex scheduling
4796 A timestamp is a specification of a date (possibly with a time or a range
4797 of times) in a special format, either @samp{<2003-09-16 Tue>} or
4798 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
4799 12:00-12:30>}@footnote{This is the standard ISO date/time format.  To
4800 use an alternative format, see @ref{Custom time format}.}.  A timestamp
4801 can appear anywhere in the headline or body of an Org tree entry.  Its
4802 presence causes entries to be shown on specific dates in the agenda
4803 (@pxref{Weekly/daily agenda}).  We distinguish:
4805 @table @var
4806 @item Plain timestamp; Event; Appointment
4807 @cindex timestamp
4808 A simple timestamp just assigns a date/time to an item.  This is just
4809 like writing down an appointment or event in a paper agenda.  In the
4810 timeline and agenda displays, the headline of an entry associated with a
4811 plain timestamp will be shown exactly on that date.
4813 @example
4814 * Meet Peter at the movies <2006-11-01 Wed 19:15>
4815 * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
4816 @end example
4818 @item Timestamp with repeater interval
4819 @cindex timestamp, with repeater interval
4820 A timestamp may contain a @emph{repeater interval}, indicating that it
4821 applies not only on the given date, but again and again after a certain
4822 interval of N days (d), weeks (w), months (m), or years (y).  The
4823 following will show up in the agenda every Wednesday:
4825 @example
4826 * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
4827 @end example
4829 @item Diary-style sexp entries
4830 For more complex date specifications, Org mode supports using the
4831 special sexp diary entries implemented in the Emacs calendar/diary
4832 package.  For example
4834 @example
4835 * The nerd meeting on every 2nd Thursday of the month
4836   <%%(diary-float t 4 2)>
4837 @end example
4839 @item Time/Date range
4840 @cindex timerange
4841 @cindex date range
4842 Two timestamps connected by @samp{--} denote a range.  The headline
4843 will be shown on the first and last day of the range, and on any dates
4844 that are displayed and fall in the range.  Here is an example:
4846 @example
4847 ** Meeting in Amsterdam
4848    <2004-08-23 Mon>--<2004-08-26 Thu>
4849 @end example
4851 @item Inactive timestamp
4852 @cindex timestamp, inactive
4853 @cindex inactive timestamp
4854 Just like a plain timestamp, but with square brackets instead of
4855 angular ones.  These timestamps are inactive in the sense that they do
4856 @emph{not} trigger an entry to show up in the agenda.
4858 @example
4859 * Gillian comes late for the fifth time [2006-11-01 Wed]
4860 @end example
4862 @end table
4864 @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
4865 @section Creating timestamps
4866 @cindex creating timestamps
4867 @cindex timestamps, creating
4869 For Org mode to recognize timestamps, they need to be in the specific
4870 format.  All commands listed below produce timestamps in the correct
4871 format.
4873 @table @kbd
4874 @kindex C-c .
4875 @item C-c .
4876 Prompt for a date and insert a corresponding timestamp.  When the cursor is
4877 at an existing timestamp in the buffer, the command is used to modify this
4878 timestamp instead of inserting a new one.  When this command is used twice in
4879 succession, a time range is inserted.
4881 @kindex C-c !
4882 @item C-c !
4883 Like @kbd{C-c .}, but insert an inactive timestamp that will not cause
4884 an agenda entry.
4886 @kindex C-u C-c .
4887 @kindex C-u C-c !
4888 @item C-u C-c .
4889 @itemx C-u C-c !
4890 @vindex org-time-stamp-rounding-minutes
4891 Like @kbd{C-c .} and @kbd{C-c !}, but use the alternative format which
4892 contains date and time.  The default time can be rounded to multiples of 5
4893 minutes, see the option @code{org-time-stamp-rounding-minutes}.
4895 @kindex C-c <
4896 @item C-c <
4897 Insert a timestamp corresponding to the cursor date in the Calendar.
4899 @kindex C-c >
4900 @item C-c >
4901 Access the Emacs calendar for the current date.  If there is a
4902 timestamp in the current line, go to the corresponding date
4903 instead.
4905 @kindex C-c C-o
4906 @item C-c C-o
4907 Access the agenda for the date given by the timestamp or -range at
4908 point (@pxref{Weekly/daily agenda}).
4910 @kindex S-@key{left}
4911 @kindex S-@key{right}
4912 @item S-@key{left}
4913 @itemx S-@key{right}
4914 Change date at cursor by one day.  These key bindings conflict with
4915 shift-selection and related modes (@pxref{Conflicts}).
4917 @kindex S-@key{up}
4918 @kindex S-@key{down}
4919 @item S-@key{up}
4920 @itemx S-@key{down}
4921 Change the item under the cursor in a timestamp.  The cursor can be on a
4922 year, month, day, hour or minute.  When the timestamp contains a time range
4923 like @samp{15:30-16:30}, modifying the first time will also shift the second,
4924 shifting the time block with constant length.  To change the length, modify
4925 the second time.  Note that if the cursor is in a headline and not at a
4926 timestamp, these same keys modify the priority of an item.
4927 (@pxref{Priorities}). The key bindings also conflict with shift-selection and
4928 related modes (@pxref{Conflicts}).
4930 @kindex C-c C-y
4931 @cindex evaluate time range
4932 @item C-c C-y
4933 Evaluate a time range by computing the difference between start and end.
4934 With a prefix argument, insert result after the time range (in a table: into
4935 the following column).
4936 @end table
4939 @menu
4940 * The date/time prompt::        How Org mode helps you entering date and time
4941 * Custom time format::          Making dates look different
4942 @end menu
4944 @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
4945 @subsection The date/time prompt
4946 @cindex date, reading in minibuffer
4947 @cindex time, reading in minibuffer
4949 @vindex org-read-date-prefer-future
4950 When Org mode prompts for a date/time, the default is shown as an ISO
4951 date, and the prompt therefore seems to ask for an ISO date.  But it
4952 will in fact accept any string containing some date and/or time
4953 information, and it is really smart about interpreting your input.  You
4954 can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
4955 copied from an email message.  Org mode will find whatever information
4956 is in there and derive anything you have not specified from the
4957 @emph{default date and time}.  The default is usually the current date
4958 and time, but when modifying an existing timestamp, or when entering
4959 the second stamp of a range, it is taken from the stamp in the buffer.
4960 When filling in information, Org mode assumes that most of the time you
4961 will want to enter a date in the future: If you omit the month/year and
4962 the given day/month is @i{before} today, it will assume that you mean a
4963 future date@footnote{See the variable
4964 @code{org-read-date-prefer-future}.}.
4966 For example, let's assume that today is @b{June 13, 2006}.  Here is how
4967 various inputs will be interpreted, the items filled in by Org mode are
4968 in @b{bold}.
4970 @example
4971 3-2-5         --> 2003-02-05
4972 14            --> @b{2006}-@b{06}-14
4973 12            --> @b{2006}-@b{07}-12
4974 Fri           --> nearest Friday (defaultdate or later)
4975 sep 15        --> @b{2006}-09-15
4976 feb 15        --> @b{2007}-02-15
4977 sep 12 9      --> 2009-09-12
4978 12:45         --> @b{2006}-@b{06}-@b{13} 12:45
4979 22 sept 0:34  --> @b{2006}-09-22 0:34
4980 w4            --> ISO week for of the current year @b{2006}
4981 2012 w4 fri   --> Friday of ISO week 4 in 2012
4982 2012-w04-5    --> Same as above
4983 @end example
4985 Furthermore you can specify a relative date by giving, as the
4986 @emph{first} thing in the input: a plus/minus sign, a number and a
4987 letter ([dwmy]) to indicate change in days, weeks, months, or years.  With a
4988 single plus or minus, the date is always relative to today.  With a
4989 double plus or minus, it is relative to the default date.  If instead of
4990 a single letter, you use the abbreviation of day name, the date will be
4991 the nth such day.  @Eg
4993 @example
4994 +0            --> today
4995 .             --> today
4996 +4d           --> four days from today
4997 +4            --> same as above
4998 +2w           --> two weeks from today
4999 ++5           --> five days from default date
5000 +2tue         --> second tuesday from now.
5001 @end example
5003 @vindex parse-time-months
5004 @vindex parse-time-weekdays
5005 The function understands English month and weekday abbreviations.  If
5006 you want to use unabbreviated names and/or other languages, configure
5007 the variables @code{parse-time-months} and @code{parse-time-weekdays}.
5009 @cindex calendar, for selecting date
5010 @vindex org-popup-calendar-for-date-prompt
5011 Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
5012 you don't need/want the calendar, configure the variable
5013 @code{org-popup-calendar-for-date-prompt}.}.  When you exit the date
5014 prompt, either by clicking on a date in the calendar, or by pressing
5015 @key{RET}, the date selected in the calendar will be combined with the
5016 information entered at the prompt.  You can control the calendar fully
5017 from the minibuffer:
5019 @kindex <
5020 @kindex >
5021 @kindex mouse-1
5022 @kindex S-@key{right}
5023 @kindex S-@key{left}
5024 @kindex S-@key{down}
5025 @kindex S-@key{up}
5026 @kindex M-S-@key{right}
5027 @kindex M-S-@key{left}
5028 @kindex @key{RET}
5029 @example
5030 > / <          @r{Scroll calendar forward/backward by one month.}
5031 mouse-1        @r{Select date by clicking on it.}
5032 S-@key{right}/@key{left}     @r{One day forward/backward.}
5033 S-@key{down}/@key{up}     @r{One week forward/backward.}
5034 M-S-@key{right}/@key{left}   @r{One month forward/backward.}
5035 @key{RET}           @r{Choose date in calendar.}
5036 @end example
5038 @vindex org-read-date-display-live
5039 The actions of the date/time prompt may seem complex, but I assure you they
5040 will grow on you, and you will start getting annoyed by pretty much any other
5041 way of entering a date/time out there.  To help you understand what is going
5042 on, the current interpretation of your input will be displayed live in the
5043 minibuffer@footnote{If you find this distracting, turn the display of with
5044 @code{org-read-date-display-live}.}.
5046 @node Custom time format,  , The date/time prompt, Creating timestamps
5047 @subsection Custom time format
5048 @cindex custom date/time format
5049 @cindex time format, custom
5050 @cindex date format, custom
5052 @vindex org-display-custom-times
5053 @vindex org-time-stamp-custom-formats
5054 Org mode uses the standard ISO notation for dates and times as it is
5055 defined in ISO 8601.  If you cannot get used to this and require another
5056 representation of date and time to keep you happy, you can get it by
5057 customizing the variables @code{org-display-custom-times} and
5058 @code{org-time-stamp-custom-formats}.
5060 @table @kbd
5061 @kindex C-c C-x C-t
5062 @item C-c C-x C-t
5063 Toggle the display of custom formats for dates and times.
5064 @end table
5066 @noindent
5067 Org mode needs the default format for scanning, so the custom date/time
5068 format does not @emph{replace} the default format---instead it is put
5069 @emph{over} the default format using text properties.  This has the
5070 following consequences:
5071 @itemize @bullet
5072 @item
5073 You cannot place the cursor onto a timestamp anymore, only before or
5074 after.
5075 @item
5076 The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
5077 each component of a timestamp.  If the cursor is at the beginning of
5078 the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
5079 just like @kbd{S-@key{left}/@key{right}}.  At the end of the stamp, the
5080 time will be changed by one minute.
5081 @item
5082 If the timestamp contains a range of clock times or a repeater, these
5083 will not be overlayed, but remain in the buffer as they were.
5084 @item
5085 When you delete a timestamp character-by-character, it will only
5086 disappear from the buffer after @emph{all} (invisible) characters
5087 belonging to the ISO timestamp have been removed.
5088 @item
5089 If the custom timestamp format is longer than the default and you are
5090 using dates in tables, table alignment will be messed up.  If the custom
5091 format is shorter, things do work as expected.
5092 @end itemize
5095 @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
5096 @section Deadlines and scheduling
5098 A timestamp may be preceded by special keywords to facilitate planning:
5100 @table @var
5101 @item DEADLINE
5102 @cindex DEADLINE keyword
5104 Meaning: the task (most likely a TODO item, though not necessarily) is supposed
5105 to be finished on that date.
5107 @vindex org-deadline-warning-days
5108 On the deadline date, the task will be listed in the agenda.  In
5109 addition, the agenda for @emph{today} will carry a warning about the
5110 approaching or missed deadline, starting
5111 @code{org-deadline-warning-days} before the due date, and continuing
5112 until the entry is marked DONE.  An example:
5114 @example
5115 *** TODO write article about the Earth for the Guide
5116     The editor in charge is [[bbdb:Ford Prefect]]
5117     DEADLINE: <2004-02-29 Sun>
5118 @end example
5120 You can specify a different lead time for warnings for a specific
5121 deadlines using the following syntax.  Here is an example with a warning
5122 period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
5124 @item SCHEDULED
5125 @cindex SCHEDULED keyword
5127 Meaning: you are planning to start working on that task on the given
5128 date.
5130 @vindex org-agenda-skip-scheduled-if-done
5131 The headline will be listed under the given date@footnote{It will still
5132 be listed on that date after it has been marked DONE.  If you don't like
5133 this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
5134 addition, a reminder that the scheduled date has passed will be present
5135 in the compilation for @emph{today}, until the entry is marked DONE.
5136 @Ie the task will automatically be forwarded until completed.
5138 @example
5139 *** TODO Call Trillian for a date on New Years Eve.
5140     SCHEDULED: <2004-12-25 Sat>
5141 @end example
5143 @noindent
5144 @b{Important:} Scheduling an item in Org mode should @i{not} be
5145 understood in the same way that we understand @i{scheduling a meeting}.
5146 Setting a date for a meeting is just a simple appointment, you should
5147 mark this entry with a simple plain timestamp, to get this item shown
5148 on the date where it applies.  This is a frequent misunderstanding by
5149 Org users.  In Org mode, @i{scheduling} means setting a date when you
5150 want to start working on an action item.
5151 @end table
5153 You may use timestamps with repeaters in scheduling and deadline
5154 entries.  Org mode will issue early and late warnings based on the
5155 assumption that the timestamp represents the @i{nearest instance} of
5156 the repeater.  However, the use of diary sexp entries like
5158 @code{<%%(diary-float t 42)>}
5160 in scheduling and deadline timestamps is limited.  Org mode does not
5161 know enough about the internals of each sexp function to issue early and
5162 late warnings.  However, it will show the item on each day where the
5163 sexp entry matches.
5165 @menu
5166 * Inserting deadline/schedule::  Planning items
5167 * Repeated tasks::              Items that show up again and again
5168 @end menu
5170 @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
5171 @subsection Inserting deadlines or schedules
5173 The following commands allow you to quickly insert a deadline or to schedule
5174 an item:
5176 @table @kbd
5178 @kindex C-c C-d
5179 @item C-c C-d
5180 Insert @samp{DEADLINE} keyword along with a stamp.  The insertion will
5181 happen in the line directly following the headline.  When called with a
5182 prefix arg, an existing deadline will be removed from the entry.
5183 @c FIXME Any CLOSED timestamp will be removed.????????
5185 @kindex C-c C-s
5186 @item C-c C-s
5187 Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
5188 happen in the line directly following the headline.  Any CLOSED
5189 timestamp will be removed.  When called with a prefix argument, remove
5190 the scheduling date from the entry.
5192 @kindex C-c C-x C-k
5193 @kindex k a
5194 @kindex k s
5195 @item C-c C-x C-k
5196 Mark the current entry for agenda action.  After you have marked the entry
5197 like this, you can open the agenda or the calendar to find an appropriate
5198 date.  With the cursor on the selected date, press @kbd{k s} or @kbd{k d} to
5199 schedule the marked item.
5201 @kindex C-c / d
5202 @cindex sparse tree, for deadlines
5203 @item C-c / d
5204 @vindex org-deadline-warning-days
5205 Create a sparse tree with all deadlines that are either past-due, or
5206 which will become due within @code{org-deadline-warning-days}.
5207 With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
5208 prefix, check that many days.  For example, @kbd{C-1 C-c / d} shows
5209 all deadlines due tomorrow.
5211 @kindex C-c / b
5212 @item C-c / b
5213 Sparse tree for deadlines and scheduled items before a given date.
5215 @kindex C-c / a
5216 @item C-c / a
5217 Sparse tree for deadlines and scheduled items after a given date.
5218 @end table
5220 @node Repeated tasks,  , Inserting deadline/schedule, Deadlines and scheduling
5221 @subsection Repeated tasks
5222 @cindex tasks, repeated
5223 @cindex repeated tasks
5225 Some tasks need to be repeated again and again.  Org mode helps to
5226 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
5227 or plain timestamp.  In the following example
5228 @example
5229 ** TODO Pay the rent
5230    DEADLINE: <2005-10-01 Sat +1m>
5231 @end example
5232 @noindent
5233 the @code{+1m} is a repeater; the intended interpretation is that the task
5234 has a deadline on <2005-10-01> and repeats itself every (one) month starting
5235 from that time.  If you need both a repeater and a special warning period in
5236 a deadline entry, the repeater should come first and the warning period last:
5237 @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
5239 Deadlines and scheduled items produce entries in the agenda when they
5240 are over-due, so it is important to be able to mark such an entry as
5241 completed once you have done so.  When you mark a DEADLINE or a SCHEDULE
5242 with the TODO keyword DONE, it will no longer produce entries in the
5243 agenda.  The problem with this is, however, that then also the
5244 @emph{next} instance of the repeated entry will not be active.  Org mode
5245 deals with this in the following way: When you try to mark such an entry
5246 DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
5247 timestamp by the repeater interval, and immediately set the entry state
5248 back to TODO.  In the example above, setting the state to DONE would
5249 actually switch the date like this:
5251 @example
5252 ** TODO Pay the rent
5253    DEADLINE: <2005-11-01 Tue +1m>
5254 @end example
5256 @vindex org-log-repeat
5257 A timestamp@footnote{You can change this using the option
5258 @code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
5259 @code{lognoterepeat}, and @code{nologrepeat}.  With @code{lognoterepeat}, you
5260 will also be prompted for a note.} will be added under the deadline, to keep
5261 a record that you actually acted on the previous instance of this deadline.
5263 As a consequence of shifting the base date, this entry will no longer be
5264 visible in the agenda when checking past dates, but all future instances
5265 will be visible.
5267 With the @samp{+1m} cookie, the date shift will always be exactly one
5268 month.  So if you have not paid the rent for three months, marking this
5269 entry DONE will still keep it as an overdue deadline.  Depending on the
5270 task, this may not be the best way to handle it.  For example, if you
5271 forgot to call you father for 3 weeks, it does not make sense to call
5272 him 3 times in a single day to make up for it.  Finally, there are tasks
5273 like changing batteries which should always repeat a certain time
5274 @i{after} the last time you did it.  For these tasks, Org mode has
5275 special repeaters markers with @samp{++} and @samp{.+}.  For example:
5277 @example
5278 ** TODO Call Father
5279    DEADLINE: <2008-02-10 Sun ++1w>
5280    Marking this DONE will shift the date by at least one week,
5281    but also by as many weeks as it takes to get this date into
5282    the future.  However, it stays on a Sunday, even if you called
5283    and marked it done on Saturday.
5284 ** TODO Check the batteries in the smoke detectors
5285    DEADLINE: <2005-11-01 Tue .+1m>
5286    Marking this DONE will shift the date to one month after
5287    today.
5288 @end example
5290 You may have both scheduling and deadline information for a specific
5291 task---just make sure that the repeater intervals on both are the same.
5293 An alternative to using a repeater is to create a number of copies of a task
5294 subtree, with dates shifted in each copy.  The command @kbd{C-c C-x c} was
5295 created for this purpose, it is described in @ref{Structure editing}.
5298 @node Clocking work time, Effort estimates, Deadlines and scheduling, Dates and Times
5299 @section Clocking work time
5301 Org mode allows you to clock the time you spend on specific tasks in a
5302 project.  When you start working on an item, you can start the clock.
5303 When you stop working on that task, or when you mark the task done, the
5304 clock is stopped and the corresponding time interval is recorded.  It
5305 also computes the total time spent on each subtree of a project.
5307 Normally, the clock does not survive exiting and re-entereing Emacs, but you
5308 can arrange for the clock information to persist across Emacs sessions with
5310 @lisp
5311 (setq org-clock-persist t)
5312 (org-clock-persistence-insinuate)
5313 @end lisp
5315 @table @kbd
5316 @kindex C-c C-x C-i
5317 @item C-c C-x C-i
5318 @vindex org-clock-into-drawer
5319 Start the clock on the current item (clock-in).  This inserts the CLOCK
5320 keyword together with a timestamp.  If this is not the first clocking of
5321 this item, the multiple CLOCK lines will be wrapped into a
5322 @code{:LOGBOOK:} drawer (see also the variable
5323 @code{org-clock-into-drawer}).  When called with a @kbd{C-u} prefix argument,
5324 select the task from a list of recently clocked tasks.  With two @kbd{C-u
5325 C-u} prefixes, clock into the task at point and mark it as the default task.
5326 The default task will always be available when selecting a clocking task,
5327 with letter @kbd{d}.@*
5328 @cindex property: CLOCK_MODELINE_TOTAL
5329 @cindex property: LAST_REPEAT
5330 @vindex org-clock-modeline-total
5331 While the clock is running, the current clocking time is shown in the mode
5332 line, along with the title of the task.  The clock time shown will be all
5333 time ever clocked for this task and its children.  If the task is a repeating
5334 one (@pxref{Repeated tasks}), only the time since the last reset of the task
5335 @footnote{as recorded by the @code{LAST_REPEAT} property} will be shown.
5336 More control over what time is shown can be exercised with the
5337 @code{CLOCK_MODELINE_TOTAL} property.  It may have the values @code{current}
5338 to show only the current clocking instance, @code{today} to show all time
5339 clocked on this tasks today (see also the variable
5340 @code{org-extend-today-until}), @code{all} to include all time, or
5341 @code{auto} which is the default@footnote{See also the variable
5342 @code{org-clock-modeline-total}.}.@*
5343 Clicking with @kbd{mouse-1} onto the mode line entry will pop up a menu with
5344 clocking options.
5345 @kindex C-c C-x C-o
5346 @item C-c C-x C-o
5347 @vindex org-log-note-clock-out
5348 Stop the clock (clock-out).  This inserts another timestamp at the same
5349 location where the clock was last started.  It also directly computes
5350 the resulting time in inserts it after the time range as @samp{=>
5351 HH:MM}.  See the variable @code{org-log-note-clock-out} for the
5352 possibility to record an additional note together with the clock-out
5353 timestamp@footnote{The corresponding in-buffer setting is:
5354 @code{#+STARTUP: lognoteclock-out}}.
5355 @kindex C-c C-x C-e
5356 @item C-c C-x C-e
5357 Update the effort estimate for the current clock task.
5358 @kindex C-c C-y
5359 @kindex C-c C-c
5360 @item C-c C-y @ @ @r{or}@ @ C-c C-c
5361 Recompute the time interval after changing one of the timestamps.  This
5362 is only necessary if you edit the timestamps directly.  If you change
5363 them with @kbd{S-@key{cursor}} keys, the update is automatic.
5364 @kindex C-c C-t
5365 @item C-c C-t
5366 Changing the TODO state of an item to DONE automatically stops the clock
5367 if it is running in this same item.
5368 @kindex C-c C-x C-x
5369 @item C-c C-x C-x
5370 Cancel the current clock.  This is useful if a clock was started by
5371 mistake, or if you ended up working on something else.
5372 @kindex C-c C-x C-j
5373 @item C-c C-x C-j
5374 Jump to the entry that contains the currently running clock.  With a
5375 @kbd{C-u} prefix arg, select the target task from a list of recently clocked
5376 tasks.
5377 @kindex C-c C-x C-d
5378 @item C-c C-x C-d
5379 @vindex org-remove-highlights-with-change
5380 Display time summaries for each subtree in the current buffer.  This
5381 puts overlays at the end of each headline, showing the total time
5382 recorded under that heading, including the time of any subheadings. You
5383 can use visibility cycling to study the tree, but the overlays disappear
5384 when you change the buffer (see variable
5385 @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
5386 @kindex C-c C-x C-r
5387 @item C-c C-x C-r
5388 Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
5389 report as an Org-mode table into the current file.  When the cursor is
5390 at an existing clock table, just update it.  When called with a prefix
5391 argument, jump to the first clock report in the current document and
5392 update it.
5393 @cindex #+BEGIN, clocktable
5394 @example
5395 #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
5396 #+END: clocktable
5397 @end example
5398 @noindent
5399 If such a block already exists at point, its content is replaced by the
5400 new table.  The @samp{BEGIN} line can specify options:
5401 @example
5402 :maxlevel    @r{Maximum level depth to which times are listed in the table.}
5403 :emphasize   @r{When @code{t}, emphasize level one and level two items.}
5404 :scope       @r{The scope to consider.  This can be any of the following:}
5405              nil        @r{the current buffer or narrowed region}
5406              file       @r{the full current buffer}
5407              subtree    @r{the subtree where the clocktable is located}
5408              tree@var{N}      @r{the surrounding level @var{N} tree, for example @code{tree3}}
5409              tree       @r{the surrounding level 1 tree}
5410              agenda     @r{all agenda files}
5411              ("file"..) @r{scan these files}
5412              file-with-archives    @r{current file and its archives}
5413              agenda-with-archives  @r{all agenda files, including archives}
5414 :block       @r{The time block to consider.  This block is specified either}
5415              @r{absolute, or relative to the current time and may be any of}
5416              @r{these formats:}
5417              2007-12-31    @r{New year eve 2007}
5418              2007-12       @r{December 2007}
5419              2007-W50      @r{ISO-week 50 in 2007}
5420              2007          @r{the year 2007}
5421              today, yesterday, today-@var{N}          @r{a relative day}
5422              thisweek, lastweek, thisweek-@var{N}     @r{a relative week}
5423              thismonth, lastmonth, thismonth-@var{N}  @r{a relative month}
5424              thisyear, lastyear, thisyear-@var{N}     @r{a relative year}
5425              @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
5426 :tstart      @r{A time string specifying when to start considering times.}
5427 :tend        @r{A time string specifying when to stop considering times.}
5428 :step        @r{@code{week} or @code{day}, to split the table into chunks.}
5429              @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
5430 :link        @r{Link the item headlines in the table to their origins.}
5431 :formula     @r{Content of a @code{#+TBLFM} line to be added and evaluated.}
5432              @r{As a special case, @samp{:formula %} adds a column with % time.}
5433              @r{If you do not specify a formula here, any existing formula.}
5434              @r{below the clock table will survive updates and be evaluated.}
5435 @end example
5436 To get a clock summary of the current level 1 tree, for the current
5437 day, you could write
5438 @example
5439 #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
5440 #+END: clocktable
5441 @end example
5442 @noindent
5443 and to use a specific time range you could write@footnote{Note that all
5444 parameters must be specified in a single line---the line is broken here
5445 only to fit it into the manual.}
5446 @example
5447 #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
5448                     :tend "<2006-08-10 Thu 12:00>"
5449 #+END: clocktable
5450 @end example
5451 A summary of the current subtree with % times would be
5452 @example
5453 #+BEGIN: clocktable :scope subtree :link t :formula %
5454 #+END: clocktable
5455 @end example
5456 @kindex C-c C-c
5457 @item C-c C-c
5458 @kindex C-c C-x C-u
5459 @itemx C-c C-x C-u
5460 Update dynamic block at point.  The cursor needs to be in the
5461 @code{#+BEGIN} line of the dynamic block.
5462 @kindex C-u C-c C-x C-u
5463 @item C-u C-c C-x C-u
5464 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
5465 you have several clock table blocks in a buffer.
5466 @kindex S-@key{left}
5467 @kindex S-@key{right}
5468 @item S-@key{left}
5469 @itemx S-@key{right}
5470 Shift the current @code{:block} interval and update the table.  The cursor
5471 needs to be in the @code{#+BEGIN: clocktable} line for this command.  If
5472 @code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
5473 @end table
5475 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
5476 the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
5477 worked on or closed during a day.
5479 @node Effort estimates, Relative timer, Clocking work time, Dates and Times
5480 @section Effort estimates
5481 @cindex effort estimates
5483 @cindex property, Effort
5484 @vindex org-effort-property
5485 If you want to plan your work in a very detailed way, or if you need to
5486 produce offers with quotations of the estimated work effort, you may want to
5487 assign effort estimates to entries.  If you are also clocking your work, you
5488 may later want to compare the planned effort with the actual working time, a
5489 great way to improve planning estimates.  Effort estimates are stored in a
5490 special property @samp{Effort}@footnote{You may change the property being
5491 used with the variable @code{org-effort-property}.}.  Clearly the best way to
5492 work with effort estimates is through column view (@pxref{Column view}).  You
5493 should start by setting up discrete values for effort estimates, and a
5494 @code{COLUMNS} format that displays these values together with clock sums (if
5495 you want to clock your time).  For a specific buffer you can use
5497 @example
5498 #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00
5499 #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
5500 @end example
5502 @noindent
5503 @vindex org-global-properties
5504 @vindex org-columns-default-format
5505 or, even better, you can set up these values globally by customizing the
5506 variables @code{org-global-properties} and @code{org-columns-default-format}.
5507 In particular if you want to use this setup also in the agenda, a global
5508 setup may be advised.
5510 The way to assign estimates to individual items is then to switch to column
5511 mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the
5512 value.  The values you enter will immediately be summed up in the hierarchy.
5513 In the column next to it, any clocked time will be displayed.
5515 @vindex org-agenda-columns-add-appointments-to-effort-sum
5516 If you switch to column view in the daily/weekly agenda, the effort column
5517 will summarize the estimated work effort for each day@footnote{Please note
5518 the pitfalls of summing hierarchical data in a flat list (@pxref{Agenda
5519 column view}).}, and you can use this to find space in your schedule.  To get
5520 an overview of the entire part of the day that is committed, you can set the
5521 option @code{org-agenda-columns-add-appointments-to-effort-sum}.  The
5522 appointments on a day that take place over a specified time interval will
5523 then also be added to the load estimate of the day.
5525 Effort estimates can be used in secondary agenda filtering that is triggered
5526 with the @kbd{/} key in the agenda (@pxref{Agenda commands}).  If you have
5527 these estimates defined consistently, two or three key presses will narrow
5528 down the list to stuff that fits into an available time slot.
5530 @node Relative timer,  , Effort estimates, Dates and Times
5531 @section Taking notes with a relative timer
5532 @cindex relative timer
5534 When taking notes during, for example, a meeting or a video viewing, it can
5535 be useful to have access to times relative to a starting time.  Org provides
5536 such a relative timer and make it easy to create timed notes.
5538 @table @kbd
5539 @kindex C-c C-x .
5540 @item C-c C-x .
5541 Insert a relative time into the buffer.  The first time you use this, the
5542 timer will be started.  When called with a prefix argument, the timer is
5543 restarted.
5544 @kindex C-c C-x -
5545 @item C-c C-x -
5546 Insert a description list item with the current relative time.  With a prefix
5547 argument, first reset the timer to 0.
5548 @kindex M-@key{RET}
5549 @item M-@key{RET}
5550 Once the timer list is started, you can also use @kbd{M-@key{RET}} to insert
5551 new timer items.
5552 @kindex C-c C-x ,
5553 @item C-c C-x ,
5554 Pause the timer, or continue it if it is already paused.
5555 @c removed the sentence because it is redundant to the following item
5556 @kindex C-u C-c C-x ,
5557 @item C-u C-c C-x ,
5558 Stop the timer.  After this, you can only start a new timer, not continue the
5559 old one.  This command also removes the timer from the mode line.
5560 @kindex C-c C-x 0
5561 @item C-c C-x 0
5562 Reset the timer without inserting anything into the buffer.  By default, the
5563 timer is reset to 0.  When called with a @kbd{C-u} prefix, reset the timer to
5564 specific starting offset.  The user is prompted for the offset, with a
5565 default taken from a timer string at point, if any, So this can be used to
5566 restart taking notes after a break in the process.  When called with a double
5567 prefix argument @kbd{C-c C-u}, change all timer strings in the active region
5568 by a certain amount.  This can be used to fix timer strings if the timer was
5569 not started at exactly the right moment.
5570 @end table
5572 @node Capture, Agenda Views, Dates and Times, Top
5573 @chapter Capture
5574 @cindex capture
5576 An important part of any organization system is the ability to quickly
5577 capture new ideas and tasks, and to associate reference material with them.
5578 Org uses the @file{remember.el} package to create tasks, and stores files
5579 related to a task (@i{attachments}) in a special directory.
5581 @menu
5582 * Remember::                    Capture new tasks/ideas with little interruption
5583 * Attachments::                 Add files to tasks.
5584 * RSS Feeds::                   Getting input from RSS feeds
5585 * Protocols::                   External (@eg Browser) access to Emacs and Org
5586 @end menu
5588 @node Remember, Attachments, Capture, Capture
5589 @section Remember
5590 @cindex @file{remember.el}
5592 The Remember package by John Wiegley lets you store quick notes with
5593 little interruption of your work flow.  See
5594 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
5595 information.  It is an excellent way to add new notes and tasks to
5596 Org files.  Org significantly expands the possibilities of
5597 Remember: You may define templates for different note types, and
5598 associate target files and headlines with specific templates.  It also
5599 allows you to select the location where a note should be stored
5600 interactively, on the fly.
5602 @menu
5603 * Setting up Remember::         Some code for .emacs to get things going
5604 * Remember templates::          Define the outline of different note types
5605 * Storing notes::               Directly get the note to where it belongs
5606 * Refiling notes::              Moving a note or task to a project
5607 @end menu
5609 @node Setting up Remember, Remember templates, Remember, Remember
5610 @subsection Setting up Remember
5612 The following customization will tell Remember to use Org files as
5613 target, and to create annotations compatible with Org links.
5615 @example
5616 (org-remember-insinuate)
5617 (setq org-directory "~/path/to/my/orgfiles/")
5618 (setq org-default-notes-file (concat org-directory "/notes.org"))
5619 (define-key global-map "\C-cr" 'org-remember)
5620 @end example
5622 @noindent
5623 The last line binds the command @code{org-remember} to a global
5624 key@footnote{Please select your own key, @kbd{C-c r} is only a
5625 suggestion.}.  @code{org-remember} basically just calls Remember,
5626 but it makes a few things easier: If there is an active region, it will
5627 automatically copy the region into the Remember buffer.  It also allows
5628 to jump to the buffer and location where Remember notes are being
5629 stored: Just call @code{org-remember} with a prefix argument.  If you
5630 use two prefix arguments, Org jumps to the location where the last
5631 remember note was stored.
5633 The Remember buffer will actually use @code{org-mode} as its major mode, so
5634 that all editing features of Org mode are available.  In addition to this, a
5635 minor mode @code{org-remember-mode} is turned on, for the single purpose that
5636 you can use its keymap @code{org-remember-mode-map} to overwrite some of
5637 Org mode's key bindings.
5639 You can also call @code{org-remember} in a special way from the agenda,
5640 using the @kbd{k r} key combination.  With this access, any timestamps
5641 inserted by the selected Remember template (see below) will default to
5642 the cursor date in the agenda, rather than to the current date.
5644 @node Remember templates, Storing notes, Setting up Remember, Remember
5645 @subsection Remember templates
5646 @cindex templates, for Remember
5648 In combination with Org, you can use templates to generate
5649 different types of Remember notes.  For example, if you would like
5650 to use one template to create general TODO entries, another one for
5651 journal entries, and a third one for collecting random ideas, you could
5652 use:
5654 @example
5655 (setq org-remember-templates
5656  '(("Todo" ?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org" "Tasks")
5657    ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")
5658    ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
5659 @end example
5661 @vindex org-remember-default-headline
5662 @vindex org-directory
5663 @noindent In these entries, the first string is just a name, and the
5664 character specifies how to select the template.  It is useful if the
5665 character is also the first letter of the name.  The next string specifies
5666 the template.  Two more (optional) strings give the file in which, and the
5667 headline under which, the new note should be stored.  The file (if not present
5668 or @code{nil}) defaults to @code{org-default-notes-file}, the heading to
5669 @code{org-remember-default-headline}.  If the file name is not an absolute
5670 path, it will be interpreted relative to @code{org-directory}.  The heading
5671 can also be the symbols @code{top} or @code{bottom} to send notes as level 1
5672 entries to the beginning or end of the file, respectively.
5674 An optional sixth element specifies the contexts in which the user can select
5675 the template.  This element can be a list of major modes or a function.
5676 @code{org-remember} will first check whether the function returns @code{t} or
5677 if we are in any of the listed major modes, and exclude templates for which
5678 this condition is not fulfilled.  Templates that do not specify this element
5679 at all, or that use @code{nil} or @code{t} as a value will always be
5680 selectable.
5682 So for example:
5684 @example
5685 (setq org-remember-templates
5686  '(("Bug" ?b "* BUG %?\n  %i\n  %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
5687    ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org" "X" my-check)
5688    ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
5689 @end example
5691 @noindent
5692 The first template will only be available when invoking @code{org-remember}
5693 from an buffer in @code{emacs-lisp-mode}.  The second template will only be
5694 available when the function @code{my-check} returns @code{t}.  The third
5695 template will be proposed in any context.
5697 When you call @kbd{M-x org-remember} (or @kbd{M-x remember}) to remember
5698 something, Org will prompt for a key to select the template (if you have
5699 more than one template) and then prepare the buffer like
5700 @example
5701 * TODO
5702   [[file:@var{link to where you called remember}]]
5703 @end example
5705 @noindent
5706 During expansion of the template, special @kbd{%}-escapes allow dynamic
5707 insertion of content:
5708 @example
5709 %^@{@var{prompt}@}  @r{prompt the user for a string and replace this sequence with it.}
5710             @r{You may specify a default value and a completion table with}
5711             @r{%^@{prompt|default|completion2|completion3...@}}
5712             @r{The arrow keys access a prompt-specific history.}
5713 %a          @r{annotation, normally the link created with @code{org-store-link}}
5714 %A          @r{like @code{%a}, but prompt for the description part}
5715 %i          @r{initial content, the region when remember is called with C-u.}
5716             @r{The entire text will be indented like @code{%i} itself.}
5717 %t          @r{timestamp, date only}
5718 %T          @r{timestamp with date and time}
5719 %u, %U      @r{like the above, but inactive timestamps}
5720 %^t         @r{like @code{%t}, but prompt for date.  Similarly @code{%^T}, @code{%^u}, @code{%^U}}
5721             @r{You may define a prompt like @code{%^@{Birthday@}t}}
5722 %n          @r{user name (taken from @code{user-full-name})}
5723 %c          @r{Current kill ring head.}
5724 %x          @r{Content of the X clipboard.}
5725 %^C         @r{Interactive selection of which kill or clip to use.}
5726 %^L         @r{Like @code{%^C}, but insert as link.}
5727 %^g         @r{prompt for tags, with completion on tags in target file.}
5728 %k          @r{title of currently clocked task}
5729 %K          @r{link to currently clocked task}
5730 %^G         @r{prompt for tags, with completion all tags in all agenda files.}
5731 %^@{@var{prop}@}p   @r{Prompt the user for a value for property @var{prop}}
5732 %:keyword   @r{specific information for certain link types, see below}
5733 %[@var{file}]     @r{insert the contents of the file given by @var{file}}
5734 %(@var{sexp})     @r{evaluate Elisp @var{sexp} and replace with the result}
5735 %!          @r{immediately store note after completing the template}
5736             @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
5737 %&          @r{jump to target location immediately after storing note}
5738 @end example
5740 @noindent
5741 For specific link types, the following keywords will be
5742 defined@footnote{If you define your own link types (@pxref{Adding
5743 hyperlink types}), any property you store with
5744 @code{org-store-link-props} can be accessed in remember templates in a
5745 similar way.}:
5747 @vindex org-from-is-user-regexp
5748 @example
5749 Link type          |  Available keywords
5750 -------------------+----------------------------------------------
5751 bbdb               |  %:name %:company
5752 bbdb               |  %::server %:port %:nick
5753 vm, wl, mh, rmail  |  %:type %:subject %:message-id
5754                    |  %:from %:fromname %:fromaddress
5755                    |  %:to   %:toname   %:toaddress
5756                    |  %: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}.}}
5757 gnus               |  %:group, @r{for messages also all email fields}
5758 w3, w3m            |  %:url
5759 info               |  %:file %:node
5760 calendar           |  %:date"
5761 @end example
5763 @noindent
5764 To place the cursor after template expansion use:
5766 @example
5767 %?          @r{After completing the template, position cursor here.}
5768 @end example
5770 @noindent
5771 If you change your mind about which template to use, call
5772 @code{org-remember} in the remember buffer.  You may then select a new
5773 template that will be filled with the previous context information.
5775 @node Storing notes, Refiling notes, Remember templates, Remember
5776 @subsection Storing notes
5778 @vindex org-remember-clock-out-on-exit
5779 When you are finished preparing a note with Remember, you have to press
5780 @kbd{C-c C-c} to file the note away.  If you have started the clock in the
5781 Remember buffer, you will first be asked if you want to clock out
5782 now@footnote{To avoid this query, configure the variable
5783 @code{org-remember-clock-out-on-exit}.}.  If you answer @kbd{n}, the clock
5784 will continue to run after the note was filed away.
5786 The handler will then store the note in the file and under the headline
5787 specified in the template, or it will use the default file and headline.
5788 The window configuration will be restored, sending you back to the working
5789 context before the call to Remember.  To re-use the location found
5790 during the last call to Remember, exit the Remember buffer with
5791 @kbd{C-0 C-c C-c}, @ie specify a zero prefix argument to @kbd{C-c C-c}.
5792 Another special case is @kbd{C-2 C-c C-c} which files the note as a child of
5793 the currently clocked item.
5795 @vindex org-remember-store-without-prompt
5796 If you want to store the note directly to a different place, use
5797 @kbd{C-1 C-c C-c} instead to exit Remember@footnote{Configure the
5798 variable @code{org-remember-store-without-prompt} to make this behavior
5799 the default.}.  The handler will then first prompt for a target file---if 
5800 you press @key{RET}, the value specified for the template is used.
5801 Then the command offers the headings tree of the selected file, with the
5802 cursor position at the default headline (if you specified one in the
5803 template).  You can either immediately press @key{RET} to get the note
5804 placed there.  Or you can use the following keys to find a different
5805 location:
5806 @example
5807 @key{TAB}         @r{Cycle visibility.}
5808 @key{down} / @key{up}   @r{Next/previous visible headline.}
5809 n / p        @r{Next/previous visible headline.}
5810 f / b        @r{Next/previous headline same level.}
5811 u            @r{One level up.}
5812 @c 0-9          @r{Digit argument.}
5813 @end example
5814 @noindent
5815 Pressing @key{RET} or @key{left} or @key{right}
5816 then leads to the following result.
5818 @vindex org-reverse-note-order
5819 @multitable @columnfractions 0.2 0.15 0.65
5820 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
5821 @item on headline     @tab @key{RET}              @tab as sublevel of the heading at cursor, first or last
5822 @item                 @tab                        @tab depending on @code{org-reverse-note-order}.
5823 @item                 @tab @key{left}/@key{right} @tab as same level, before/after current heading
5824 @item buffer-start    @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
5825 @item                 @tab @tab depending on @code{org-reverse-note-order}.
5826 @item not on headline @tab @key{RET}
5827       @tab at cursor position, level taken from context.
5828 @end multitable
5830 Before inserting the text into a tree, the function ensures that the text has
5831 a headline, @ie a first line that starts with a @samp{*}.  If not, a
5832 headline is constructed from the current date.  If you have indented the text
5833 of the note below the headline, the indentation will be adapted if inserting
5834 the note into the tree requires demotion from level 1.
5836 @node Refiling notes,  , Storing notes, Remember
5837 @subsection Refiling notes
5838 @cindex refiling notes
5840 Remember is usually used to quickly capture notes and tasks into one or
5841 a few capture lists.  When reviewing the captured data, you may want to
5842 refile some of the entries into a different list, for example into a
5843 project.  Cutting, finding the right location, and then pasting the note
5844 is cumbersome.  To simplify this process, you can use the following
5845 special command:
5847 @table @kbd
5848 @kindex C-c C-w
5849 @item C-c C-w
5850 @vindex org-reverse-note-order
5851 @vindex org-refile-targets
5852 @vindex org-refile-use-outline-path
5853 @vindex org-outline-path-complete-in-steps
5854 @vindex org-refile-allow-creating-parent-nodes
5855 Refile the entry or region at point.  This command offers possible locations
5856 for refiling the entry and lets you select one with completion.  The item (or
5857 all items in the region) is filed below the target heading as a subitem.
5858 Depending on @code{org-reverse-note-order}, it will be either the first or
5859 last subitem.@*
5860 By default, all level 1 headlines in the current buffer are considered to be
5861 targets, but you can have more complex definitions across a number of files.
5862 See the variable @code{org-refile-targets} for details.  If you would like to
5863 select a location via a file-path-like completion along the outline path, see
5864 the variables @code{org-refile-use-outline-path} and
5865 @code{org-outline-path-complete-in-steps}.  If you would like to be able to
5866 create new nodes as new parents for for refiling on the fly, check the
5867 variable @code{org-refile-allow-creating-parent-nodes}.
5868 @kindex C-u C-c C-w
5869 @item C-u C-c C-w
5870 Use the refile interface to jump to a heading.
5871 @kindex C-u C-u C-c C-w
5872 @item C-u C-u C-c C-w
5873 Jump to the location where @code{org-refile} last moved a tree to.
5874 @end table
5877 @node Attachments, RSS Feeds, Remember, Capture
5878 @section Attachments
5879 @cindex attachments
5881 @vindex org-attach-directory
5882 It is often useful to associate reference material with an outline node/task.
5883 Small chunks of plain text can simply be stored in the subtree of a project.
5884 Hyperlinks (@pxref{Hyperlinks}) can be used to establish associations with
5885 files that live elsewhere on your computer or in the cloud, like emails or
5886 source code files belonging to a project.  Another method is @i{attachments},
5887 which are files located in a directory belonging to an outline node.  Org
5888 uses directories named by the unique ID of each entry.  These directories are
5889 located in the @file{data} directory which lives in the same directory where
5890 your Org file lives@footnote{If you move entries or Org files from one
5891 directory to another, you may want to configure @code{org-attach-directory}
5892 to contain an absolute path.}.  If you initialize this directory with
5893 @code{git init}, Org will automatically commit changes when it sees them.
5894 The attachment system has been contributed to Org by John Wiegley.
5896 In cases where it seems better to do so, you can also attach a directory of your
5897 choice to an entry.  You can also make children inherit the attachment
5898 directory from a parent, so that an entire subtree uses the same attached
5899 directory.
5901 @noindent The following commands deal with attachments.
5903 @table @kbd
5905 @kindex C-c C-a
5906 @item C-c C-a
5907 The dispatcher for commands related to the attachment system.  After these
5908 keys, a list of commands is displayed and you need to press an additional key
5909 to select a command:
5911 @table @kbd
5912 @kindex C-c C-a a
5913 @item a
5914 @vindex org-attach-method
5915 Select a file and move it into the task's attachment directory.  The file
5916 will be copied, moved, or linked, depending on @code{org-attach-method}.
5917 Note that hard links are not supported on all systems.
5919 @kindex C-c C-a c
5920 @kindex C-c C-a m
5921 @kindex C-c C-a l
5922 @item c/m/l
5923 Attach a file using the copy/move/link method.
5924 Note that hard links are not supported on all systems.
5926 @kindex C-c C-a n
5927 @item n
5928 Create a new attachment as an Emacs buffer.
5930 @kindex C-c C-a z
5931 @item z
5932 Synchronize the current task with its attachment directory, in case you added
5933 attachments yourself.
5935 @kindex C-c C-a o
5936 @item o
5937 @vindex org-file-apps
5938 Open current task's attachment.  If there are more than one, prompt for a
5939 file name first.  Opening will follow the rules set by @code{org-file-apps}.
5940 For more details, see the information on following hyperlinks
5941 (@pxref{Handling links}).
5943 @kindex C-c C-a O
5944 @item O
5945 Also open the attachment, but force opening the file in Emacs.
5947 @kindex C-c C-a f
5948 @item f
5949 Open the current task's attachment directory.
5951 @kindex C-c C-a F
5952 @item F
5953 Also open the directory, but force using @command{dired} in Emacs.
5955 @kindex C-c C-a d
5956 @item d
5957 Select and delete a single attachment.
5959 @kindex C-c C-a D
5960 @item D
5961 Delete all of a task's attachments.  A safer way is to open the directory in
5962 @command{dired} and delete from there.
5964 @kindex C-c C-a s
5965 @item C-c C-a s
5966 @cindex property, ATTACH_DIR
5967 Set a specific directory as the entry's attachment directory.  This works by
5968 putting the directory path into the @code{ATTACH_DIR} property.
5970 @kindex C-c C-a i
5971 @item C-c C-a i
5972 @cindex property, ATTACH_DIR_INHERIT
5973 Set the @code{ATTACH_DIR_INHERIT} property, so that children will use the
5974 same directory for attachments as the parent does.
5975 @end table
5976 @end table
5978 @node RSS Feeds, Protocols, Attachments, Capture
5979 @section RSS feeds
5980 @cindex RSS feeds
5982 Org has the capablity to add and change entries based on information found in
5983 RSS feeds.  You could use this to make a task out of each new podcast in a
5984 podcast feed.  Or you could use a phone-based note-creating service on the
5985 web to import tasks into Org.  To access feeds, you need to configure the
5986 variable @code{org-feed-alist}.  The docstring of this variable has detailed
5987 information.  Here is just an example:
5989 @example
5990 (setq org-feed-alist
5991       '(("ReQall" "http://www.reqall.com/user/feeds/rss/a1b2c3....."
5992          "~/org/feeds.org" "ReQall Entries")
5993 @end example
5994 @noindent
5995 will configure that new items from the feed provided by @file{reqall.com}
5996 will result in new entries in the file @file{~/org/feeds.org} under the
5997 heading @samp{ReQall Entries}, whenever the following command is used:
5999 @table @kbd
6000 @kindex C-c C-x g
6001 @item C-c C-x g
6002 Collect items from the feeds configured in @code{org-feed-alist} and act upon
6003 them.
6004 @kindex C-c C-x G
6005 @item C-c C-x G
6006 Prompt for a feed name and go to the inbox configured for this feed.
6007 @end table
6009 Under the same headline, Org will create a drawer @samp{FEEDSTATUS} in which
6010 it will store information about the status of items in the feed, to avoid
6011 adding the same item several times.  You should add @samp{FEEDSTATUS} to the
6012 list of drawers in that file:
6014 @example
6015 #+DRAWERS: LOGBOOK PROPERTIES FEEDSTATUS
6016 @end example
6018 For more information, see @file{org-feed.el} and the docstring of
6019 @code{org-feed-alist}.
6021 @node Protocols,  , RSS Feeds, Capture
6022 @section Protocols for external access
6023 @cindex protocols, for external access
6024 @cindex emacsserver
6026 You can set up Org for handling protocol calls from outside applications that
6027 are passed to Emacs through the @file{emacsserver}.  For example, you can
6028 configure bookmarks in your web browser to send a link to the current page to
6029 Org and create a note from it using Remember (@pxref{Remember}).  Or you
6030 could create a bookmark that will tell Emacs to open the local source file of
6031 a remote website you are looking at with the browser.  See
6032 @uref{http://orgmode.org/worg/org-contrib/org-protocol.php} for detailed
6033 documentation and setup instructions.
6036 @node Agenda Views, Embedded LaTeX, Capture, Top
6037 @chapter Agenda Views
6038 @cindex agenda views
6040 Due to the way Org works, TODO items, time-stamped items, and
6041 tagged headlines can be scattered throughout a file or even a number of
6042 files.  To get an overview of open action items, or of events that are
6043 important for a particular date, this information must be collected,
6044 sorted and displayed in an organized way.
6046 Org can select items based on various criteria and display them
6047 in a separate buffer.  Seven different view types are provided:
6049 @itemize @bullet
6050 @item
6051 an @emph{agenda} that is like a calendar and shows information
6052 for specific dates,
6053 @item
6054 a @emph{TODO list} that covers all unfinished
6055 action items,
6056 @item
6057 a @emph{match view}, showings headlines based on the tags, properties, and
6058 TODO state associated with them,
6059 @item
6060 a @emph{timeline view} that shows all events in a single Org file,
6061 in time-sorted view,
6062 @item
6063 a @emph{keyword search view} that shows all entries from multiple files
6064 that contain specified keywords,
6065 @item
6066 a @emph{stuck projects view} showing projects that currently don't move
6067 along, and
6068 @item
6069 @emph{custom views} that are special tag/keyword searches and
6070 combinations of different views.
6071 @end itemize
6073 @noindent
6074 The extracted information is displayed in a special @emph{agenda
6075 buffer}.  This buffer is read-only, but provides commands to visit the
6076 corresponding locations in the original Org files, and even to
6077 edit these files remotely.
6079 @vindex org-agenda-window-setup
6080 @vindex org-agenda-restore-windows-after-quit
6081 Two variables control how the agenda buffer is displayed and whether the
6082 window configuration is restored when the agenda exits:
6083 @code{org-agenda-window-setup} and
6084 @code{org-agenda-restore-windows-after-quit}.
6086 @menu
6087 * Agenda files::                Files being searched for agenda information
6088 * Agenda dispatcher::           Keyboard access to agenda views
6089 * Built-in agenda views::       What is available out of the box?
6090 * Presentation and sorting::    How agenda items are prepared for display
6091 * Agenda commands::             Remote editing of Org trees
6092 * Custom agenda views::         Defining special searches and views
6093 * Exporting Agenda Views::      
6094 * Agenda column view::          Using column view for collected entries
6095 @end menu
6097 @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
6098 @section Agenda files
6099 @cindex agenda files
6100 @cindex files for agenda
6102 @vindex org-agenda-files
6103 The information to be shown is normally collected from all @emph{agenda
6104 files}, the files listed in the variable
6105 @code{org-agenda-files}@footnote{If the value of that variable is not a
6106 list, but a single file name, then the list of agenda files will be
6107 maintained in that external file.}. If a directory is part of this list,
6108 all files with the extension @file{.org} in this directory will be part
6109 of the list.
6111 Thus, even if you only work with a single Org file, that file should
6112 be put into the list@footnote{When using the dispatcher, pressing
6113 @kbd{<} before selecting a command will actually limit the command to
6114 the current file, and ignore @code{org-agenda-files} until the next
6115 dispatcher command.}.  You can customize @code{org-agenda-files}, but
6116 the easiest way to maintain it is through the following commands
6118 @cindex files, adding to agenda list
6119 @table @kbd
6120 @kindex C-c [
6121 @item C-c [
6122 Add current file to the list of agenda files.  The file is added to
6123 the front of the list.  If it was already in the list, it is moved to
6124 the front.  With a prefix argument, file is added/moved to the end.
6125 @kindex C-c ]
6126 @item C-c ]
6127 Remove current file from the list of agenda files.
6128 @kindex C-,
6129 @kindex C-'
6130 @item C-,
6131 @itemx C-'
6132 Cycle through agenda file list, visiting one file after the other.
6133 @kindex M-x org-iswitchb
6134 @item M-x org-iswitchb
6135 Command to use an @code{iswitchb}-like interface to switch to and between Org
6136 buffers.
6137 @end table
6139 @noindent
6140 The Org menu contains the current list of files and can be used
6141 to visit any of them.
6143 If you would like to focus the agenda temporarily on a file not in
6144 this list, or on just one file in the list, or even on only a subtree in a
6145 file, then this can be done in different ways.  For a single agenda command,
6146 you may press @kbd{<} once or several times in the dispatcher
6147 (@pxref{Agenda dispatcher}).  To restrict the agenda scope for an
6148 extended period, use the following commands:
6150 @table @kbd
6151 @kindex C-c C-x <
6152 @item C-c C-x <
6153 Permanently restrict the agenda to the current subtree.  When with a
6154 prefix argument, or with the cursor before the first headline in a file,
6155 the agenda scope is set to the entire file.  This restriction remains in
6156 effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
6157 or @kbd{>} in the agenda dispatcher.  If there is a window displaying an
6158 agenda view, the new restriction takes effect immediately.
6159 @kindex C-c C-x >
6160 @item C-c C-x >
6161 Remove the permanent restriction created by @kbd{C-c C-x <}.
6162 @end table
6164 @noindent
6165 When working with @file{speedbar.el}, you can use the following commands in
6166 the Speedbar frame:
6167 @table @kbd
6168 @kindex <
6169 @item < @r{in the speedbar frame}
6170 Permanently restrict the agenda to the item---either an Org file or a subtree
6171 in such a file---at the cursor in the Speedbar frame.
6172 If there is a window displaying an agenda view, the new restriction takes
6173 effect immediately.
6174 @kindex >
6175 @item > @r{in the speedbar frame}
6176 Lift the restriction.
6177 @end table
6179 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
6180 @section The agenda dispatcher
6181 @cindex agenda dispatcher
6182 @cindex dispatching agenda commands
6183 The views are created through a dispatcher, which should be bound to a
6184 global key---for example @kbd{C-c a} (@pxref{Installation}).  In the
6185 following we will assume that @kbd{C-c a} is indeed how the dispatcher
6186 is accessed and list keyboard access to commands accordingly.  After
6187 pressing @kbd{C-c a}, an additional letter is required to execute a
6188 command.  The dispatcher offers the following default commands:
6189 @table @kbd
6190 @item a
6191 Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
6192 @item t @r{/} T
6193 Create a list of all TODO items (@pxref{Global TODO list}).
6194 @item m @r{/} M
6195 Create a list of headlines matching a TAGS expression (@pxref{Matching
6196 tags and properties}).
6197 @item L
6198 Create the timeline view for the current buffer (@pxref{Timeline}).
6199 @item s
6200 Create a list of entries selected by a boolean expression of keywords
6201 and/or regular expressions that must or must not occur in the entry.
6202 @item /
6203 @vindex org-agenda-text-search-extra-files
6204 Search for a regular expression in all agenda files and additionally in
6205 the files listed in @code{org-agenda-text-search-extra-files}.  This
6206 uses the Emacs command @code{multi-occur}.  A prefix argument can be
6207 used to specify the number of context lines for each match, default is
6209 @item # @r{/} !
6210 Create a list of stuck projects (@pxref{Stuck projects}).
6211 @item <
6212 Restrict an agenda command to the current buffer@footnote{For backward
6213 compatibility, you can also press @kbd{1} to restrict to the current
6214 buffer.}.  After pressing @kbd{<}, you still need to press the character
6215 selecting the command.
6216 @item < <
6217 If there is an active region, restrict the following agenda command to
6218 the region.  Otherwise, restrict it to the current subtree@footnote{For
6219 backward compatibility, you can also press @kbd{0} to restrict to the
6220 current region/subtree.}.  After pressing @kbd{< <}, you still need to press the
6221 character selecting the command.
6222 @end table
6224 You can also define custom commands that will be accessible through the
6225 dispatcher, just like the default commands.  This includes the
6226 possibility to create extended agenda buffers that contain several
6227 blocks together, for example the weekly agenda, the global TODO list and
6228 a number of special tags matches.  @xref{Custom agenda views}.
6230 @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
6231 @section The built-in agenda views
6233 In this section we describe the built-in views.
6235 @menu
6236 * Weekly/daily agenda::         The calendar page with current tasks
6237 * Global TODO list::            All unfinished action items
6238 * Matching tags and properties::  Structured information with fine-tuned search
6239 * Timeline::                    Time-sorted view for single file
6240 * Keyword search::              Finding entries by keyword
6241 * Stuck projects::              Find projects you need to review
6242 @end menu
6244 @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
6245 @subsection The weekly/daily agenda
6246 @cindex agenda
6247 @cindex weekly agenda
6248 @cindex daily agenda
6250 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
6251 paper agenda, showing all the tasks for the current week or day.
6253 @table @kbd
6254 @cindex org-agenda, command
6255 @kindex C-c a a
6256 @item C-c a a
6257 @vindex org-agenda-ndays
6258 Compile an agenda for the current week from a list of Org files.  The agenda
6259 shows the entries for each day.  With a numeric prefix@footnote{For backward
6260 compatibility, the universal prefix @kbd{C-u} causes all TODO entries to be
6261 listed before the agenda.  This feature is deprecated, use the dedicated TODO
6262 list, or a block agenda instead (@pxref{Block agenda}).}  (like @kbd{C-u 2 1
6263 C-c a a}) you may set the number of days to be displayed (see also the
6264 variable @code{org-agenda-ndays})
6265 @end table
6267 Remote editing from the agenda buffer means, for example, that you can
6268 change the dates of deadlines and appointments from the agenda buffer.
6269 The commands available in the Agenda buffer are listed in @ref{Agenda
6270 commands}.
6272 @subsubheading Calendar/Diary integration
6273 @cindex calendar integration
6274 @cindex diary integration
6276 Emacs contains the calendar and diary by Edward M. Reingold.  The
6277 calendar displays a three-month calendar with holidays from different
6278 countries and cultures.  The diary allows you to keep track of
6279 anniversaries, lunar phases, sunrise/set, recurrent appointments
6280 (weekly, monthly) and more.  In this way, it is quite complementary to
6281 Org.  It can be very useful to combine output from Org with
6282 the diary.
6284 In order to include entries from the Emacs diary into Org mode's
6285 agenda, you only need to customize the variable
6287 @lisp
6288 (setq org-agenda-include-diary t)
6289 @end lisp
6291 @noindent After that, everything will happen automatically.  All diary
6292 entries including holidays, anniversaries, etc., will be included in the
6293 agenda buffer created by Org mode.  @key{SPC}, @key{TAB}, and
6294 @key{RET} can be used from the agenda buffer to jump to the diary
6295 file in order to edit existing diary entries.  The @kbd{i} command to
6296 insert new entries for the current date works in the agenda buffer, as
6297 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
6298 Sunrise/Sunset times, show lunar phases and to convert to other
6299 calendars, respectively.  @kbd{c} can be used to switch back and forth
6300 between calendar and agenda.
6302 If you are using the diary only for sexp entries and holidays, it is
6303 faster to not use the above setting, but instead to copy or even move
6304 the entries into an Org file. Org mode evaluates diary-style sexp
6305 entries, and does it faster because there is no overhead for first
6306 creating the diary display.  Note that the sexp entries must start at
6307 the left margin, no whitespace is allowed before them.  For example,
6308 the following segment of an Org file will be processed and entries
6309 will be made in the agenda:
6311 @example
6312 * Birthdays and similar stuff
6313 #+CATEGORY: Holiday
6314 %%(org-calendar-holiday)   ; special function for holiday names
6315 #+CATEGORY: Ann
6316 %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
6317 %%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d years old
6318 @end example
6320 @subsubheading Anniversaries from BBDB
6321 @cindex BBDB, anniversaries
6322 @cindex anniversaries, from BBDB
6324 If you are using the Big Brothers Database to store your contacts, you will
6325 very likely prefer to store anniversaries in BBDB rather than in a
6326 separate Org or diary file.  Org supports this and will show BBDB
6327 anniversaries as part of the agenda.  All you need to do is to add the
6328 following to one your your agenda files:
6330 @example
6331 * Anniversaries
6332   :PROPERTIES:
6333   :CATEGORY: Anniv
6334   :END
6335 %%(org-bbdb-anniversaries)
6336 @end example
6338 You can then go ahead and define anniversaries for a BBDB record.  Basically,
6339 you need to press @kbd{C-o anniversary @key{RET}} with the cursor in a BBDB
6340 record and then add the date in the format @code{YYYY-MM-DD}, followed by a
6341 space and the class of the anniversary (@samp{birthday} or @samp{wedding}, or
6342 a format string).  If you omit the class, it will default to @samp{birthday}.
6343 Here are a few examples, the header for the file @file{org-bbdb.el} contains
6344 more detailed information.
6346 @example
6347 1973-06-22
6348 1955-08-02 wedding
6349 2008-04-14 %s released version 6.01 of org-mode, %d years ago
6350 @end example
6352 After a change to BBDB, or for the first agenda display during an Emacs
6353 session, the agenda display will suffer a short delay as Org updates its
6354 hash with anniversaries.  However, from then on things will be very fast---much
6355 faster in fact than a long list of @samp{%%(diary-anniversary)} entries
6356 in an Org or Diary file.
6358 @subsubheading Appointment reminders
6359 @cindex @file{appt.el}
6360 @cindex appointment reminders
6362 Org can interact with Emacs appointments notification facility.  To add all
6363 the appointments of your agenda files, use the command
6364 @code{org-agenda-to-appt}.  This command also lets you filter through the
6365 list of your appointments and add only those belonging to a specific category
6366 or matching a regular expression. See the docstring for details.
6368 @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
6369 @subsection The global TODO list
6370 @cindex global TODO list
6371 @cindex TODO list, global
6373 The global TODO list contains all unfinished TODO items formatted and
6374 collected into a single place.
6376 @table @kbd
6377 @kindex C-c a t
6378 @item C-c a t
6379 Show the global TODO list.  This collects the TODO items from all
6380 agenda files (@pxref{Agenda Views}) into a single buffer.  The buffer is in
6381 @code{agenda-mode}, so there are commands to examine and manipulate
6382 the TODO entries directly from that buffer (@pxref{Agenda commands}).
6383 @kindex C-c a T
6384 @item C-c a T
6385 @cindex TODO keyword matching
6386 @vindex org-todo-keywords
6387 Like the above, but allows selection of a specific TODO keyword.  You
6388 can also do this by specifying a prefix argument to @kbd{C-c a t}.  With
6389 a @kbd{C-u} prefix you are prompted for a keyword, and you may also
6390 specify several keywords by separating them with @samp{|} as the boolean OR
6391 operator.  With a numeric prefix, the nth keyword in
6392 @code{org-todo-keywords} is selected.
6393 @kindex r
6394 The @kbd{r} key in the agenda buffer regenerates it, and you can give
6395 a prefix argument to this command to change the selected TODO keyword,
6396 for example @kbd{3 r}.  If you often need a search for a specific
6397 keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
6398 Matching specific TODO keywords can also be done as part of a tags
6399 search (@pxref{Tag searches}).
6400 @end table
6402 Remote editing of TODO items means that you can change the state of a
6403 TODO entry with a single key press.  The commands available in the
6404 TODO list are described in @ref{Agenda commands}.
6406 @cindex sublevels, inclusion into TODO list
6407 Normally the global TODO list simply shows all headlines with TODO
6408 keywords.  This list can become very long.  There are two ways to keep
6409 it more compact:
6410 @itemize @minus
6411 @item
6412 @vindex org-agenda-todo-ignore-scheduled
6413 @vindex org-agenda-todo-ignore-deadlines
6414 @vindex org-agenda-todo-ignore-with-date
6415 Some people view a TODO item that has been @emph{scheduled} for execution or
6416 have a @emph{deadline} (@pxref{Timestamps}) as no longer @emph{open}.
6417 Configure the variables @code{org-agenda-todo-ignore-scheduled},
6418 @code{org-agenda-todo-ignore-deadlines}, and/or
6419 @code{org-agenda-todo-ignore-with-date} to exclude such items from the
6420 global TODO list.
6421 @item
6422 @vindex org-agenda-todo-list-sublevels
6423 TODO items may have sublevels to break up the task into subtasks.  In
6424 such cases it may be enough to list only the highest level TODO headline
6425 and omit the sublevels from the global list.  Configure the variable
6426 @code{org-agenda-todo-list-sublevels} to get this behavior.
6427 @end itemize
6429 @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
6430 @subsection Matching tags and properties
6431 @cindex matching, of tags
6432 @cindex matching, of properties
6433 @cindex tags view
6434 @cindex match view
6436 If headlines in the agenda files are marked with @emph{tags} (@pxref{Tags}),
6437 or have properties (@pxref{Properties and Columns}), you can select headlines
6438 based on this metadata and collect them into an agenda buffer.  The match
6439 syntax described here also applies when creating sparse trees with @kbd{C-c /
6442 @table @kbd
6443 @kindex C-c a m
6444 @item C-c a m
6445 Produce a list of all headlines that match a given set of tags.  The
6446 command prompts for a selection criterion, which is a boolean logic
6447 expression with tags, like @samp{+work+urgent-withboss} or
6448 @samp{work|home} (@pxref{Tags}).  If you often need a specific search,
6449 define a custom command for it (@pxref{Agenda dispatcher}).
6450 @kindex C-c a M
6451 @item C-c a M
6452 @vindex org-tags-match-list-sublevels
6453 @vindex org-agenda-tags-todo-honor-ignore-options
6454 Like @kbd{C-c a m}, but only select headlines that are also TODO items and
6455 force checking subitems (see variable @code{org-tags-match-list-sublevels}).
6456 To exclude scheduled/deadline items, see the variable
6457 @code{org-agenda-tags-todo-honor-ignore-options}.  Matching specific TODO
6458 keywords together with a tags match is also possible, see @ref{Tag searches}.
6459 @end table
6461 The commands available in the tags list are described in @ref{Agenda
6462 commands}.
6464 @subsubheading Match syntax
6466 @cindex Boolean logic, for tag/property searches
6467 A search string can use Boolean operators @samp{&} for AND and @samp{|} for
6468 OR.  @samp{&} binds more strongly than @samp{|}.  Parentheses are currently
6469 not implemented.  Each element in the search is either a tag, a regular
6470 expression matching tags, or an expression like @code{PROPERTY OPERATOR
6471 VALUE} with a comparison operator, accessing a property value.  Each element
6472 may be preceded by @samp{-}, to select against it, and @samp{+} is syntactic
6473 sugar for positive selection.  The AND operator @samp{&} is optional when
6474 @samp{+} or @samp{-} is present.  Here are some examples, using only tags.
6476 @table @samp
6477 @item +work-boss
6478 Select headlines tagged @samp{:work:}, but discard those also tagged
6479 @samp{:boss:}.
6480 @item work|laptop
6481 Selects lines tagged @samp{:work:} or @samp{:laptop:}.
6482 @item work|laptop+night
6483 Like before, but require the @samp{:laptop:} lines to be tagged also
6484 @samp{:night:}.
6485 @end table
6487 @cindex regular expressions, with tags search
6488 Instead of a tag, you may also specify a regular expression enclosed in curly
6489 braces.  For example,
6490 @samp{work+@{^boss.*@}} matches headlines that contain the tag
6491 @samp{:work:} and any tag @i{starting} with @samp{boss}.
6493 @cindex TODO keyword matching, with tags search
6494 @cindex level, require for tags/property match
6495 @cindex category, require for tags/property match
6496 @vindex org-odd-levels-only
6497 You may also test for properties (@pxref{Properties and Columns}) at the same
6498 time as matching tags.  The properties may be real properties, or special
6499 properties that represent other metadata (@pxref{Special properties}).  For
6500 example, the ``property'' @code{TODO} represents the TODO keyword of the
6501 entry.  Or, the ``property'' @code{LEVEL} represents the level of an entry.
6502 So a search @samp{+LEVEL=3+boss-TODO="DONE"} lists all level three headlines
6503 that have the tag @samp{boss} and are @emph{not} marked with the TODO keyword
6504 DONE.  In buffers with @code{org-odd-levels-only} set, @samp{LEVEL} does not
6505 count the number of stars, but @samp{LEVEL=2} will correspond to 3 stars etc.
6507 Here are more examples:
6508 @table @samp
6509 @item work+TODO="WAITING"
6510 Select @samp{:work:}-tagged TODO lines with the specific TODO
6511 keyword @samp{WAITING}.
6512 @item work+TODO="WAITING"|home+TODO="WAITING"
6513 Waiting tasks both at work and at home.
6514 @end table
6516 When matching properties, a number of different operators can be used to test
6517 the value of a property.  Here is a complex example:
6519 @example
6520 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2         \
6521          +With=@{Sarah\|Denny@}+SCHEDULED>="<2008-10-11>"
6522 @end example
6524 @noindent
6525 The type of comparison will depend on how the comparison value is written:
6526 @itemize @minus
6527 @item
6528 If the comparison value is a plain number, a numerical comparison is done,
6529 and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=},
6530 @samp{>=}, and @samp{<>}.
6531 @item
6532 If the comparison value is enclosed in double-quotes, 
6533 a string comparison is done, and the same operators are allowed.
6534 @item
6535 If the comparison value is enclosed in double-quotes @emph{and} angular
6536 brackets (like @samp{DEADLINE<="<2008-12-24 18:30>"}), both values are
6537 assumed to be date/time specifications in the standard Org way, and the
6538 comparison will be done accordingly.  Special values that will be recognized
6539 are @code{"<now>"} for now (including time), and @code{"<today>"}, and
6540 @code{"<tomorrow>"} for these days at 0:00 hours, @ie without a time
6541 specification.  Also strings like @code{"<+5d>"} or @code{"<-2m>"} with units
6542 @code{d}, @code{w}, @code{m}, and @code{y} for day, week, month, and year,
6543 respectively, can be used.
6544 @item
6545 If the comparison value is enclosed
6546 in curly braces, a regexp match is performed, with @samp{=} meaning that the
6547 regexp matches the property value, and @samp{<>} meaning that it does not
6548 match.
6549 @end itemize
6551 So the search string in the example finds entries tagged @samp{:work:} but
6552 not @samp{:boss:}, which also have a priority value @samp{A}, a
6553 @samp{:Coffee:} property with the value @samp{unlimited}, an @samp{Effort}
6554 property that is numerically smaller than 2, a @samp{:With:} property that is
6555 matched by the regular expression @samp{Sarah\|Denny}, and that are scheduled
6556 on or after October 11, 2008.
6558 Accessing TODO, LEVEL, and CATEGORY during a search is fast.  Accessing any
6559 other properties will slow down the search.  However, once you have paid the
6560 price by accessing one property, testing additional properties is cheap
6561 again.
6563 You can configure Org mode to use property inheritance during a search, but
6564 beware that this can slow down searches considerably.  See @ref{Property
6565 inheritance}, for details.
6567 For backward compatibility, and also for typing speed, there is also a
6568 different way to test TODO states in a search.  For this, terminate the
6569 tags/property part of the search string (which may include several terms
6570 connected with @samp{|}) with a @samp{/} and then specify a Boolean
6571 expression just for TODO keywords.  The syntax is then similar to that for
6572 tags, but should be applied with care: For example, a positive
6573 selection on several TODO keywords cannot meaningfully be combined with
6574 boolean AND.  However, @emph{negative selection} combined with AND can be
6575 meaningful.  To make sure that only lines are checked that actually have any
6576 TODO keyword (resulting in a speed-up), use @kbd{C-c a M}, or equivalently
6577 start the TODO part after the slash with @samp{!}.  Examples:
6579 @table @samp
6580 @item work/WAITING
6581 Same as @samp{work+TODO="WAITING"}
6582 @item work/!-WAITING-NEXT
6583 Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
6584 nor @samp{NEXT}
6585 @item work/!+WAITING|+NEXT
6586 Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
6587 @samp{NEXT}.
6588 @end table
6590 @node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
6591 @subsection Timeline for a single file
6592 @cindex timeline, single file
6593 @cindex time-sorted view
6595 The timeline summarizes all time-stamped items from a single Org mode
6596 file in a @emph{time-sorted view}.  The main purpose of this command is
6597 to give an overview over events in a project.
6599 @table @kbd
6600 @kindex C-c a L
6601 @item C-c a L
6602 Show a time-sorted view of the Org file, with all time-stamped items.
6603 When called with a @kbd{C-u} prefix, all unfinished TODO entries
6604 (scheduled or not) are also listed under the current date.
6605 @end table
6607 @noindent
6608 The commands available in the timeline buffer are listed in
6609 @ref{Agenda commands}.
6611 @node Keyword search, Stuck projects, Timeline, Built-in agenda views
6612 @subsection Keyword search
6613 @cindex keyword search
6614 @cindex searching, for keywords
6616 This agenda view is a general text search facility for Org mode entries.
6617 It is particularly useful to find notes.
6619 @table @kbd
6620 @kindex C-c a s
6621 @item C-c a s
6622 This is a special search that lets you select entries by keywords or
6623 regular expression, using a boolean logic.  For example, the search
6624 string
6626 @example
6627 +computer +wifi -ethernet -@{8\.11[bg]@}
6628 @end example
6630 @noindent
6631 will search for note entries that contain the keywords @code{computer}
6632 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
6633 not matched by the regular expression @code{8\.11[bg]}, meaning to
6634 exclude both 8.11b and 8.11g.
6636 @vindex org-agenda-text-search-extra-files
6637 Note that in addition to the agenda files, this command will also search
6638 the files listed in @code{org-agenda-text-search-extra-files}.
6639 @end table
6641 @node Stuck projects,  , Keyword search, Built-in agenda views
6642 @subsection Stuck projects
6644 If you are following a system like David Allen's GTD to organize your
6645 work, one of the ``duties'' you have is a regular review to make sure
6646 that all projects move along.  A @emph{stuck} project is a project that
6647 has no defined next actions, so it will never show up in the TODO lists
6648 Org mode produces.  During the review, you need to identify such
6649 projects and define next actions for them.
6651 @table @kbd
6652 @kindex C-c a #
6653 @item C-c a #
6654 List projects that are stuck.
6655 @kindex C-c a !
6656 @item C-c a !
6657 @vindex org-stuck-projects
6658 Customize the variable @code{org-stuck-projects} to define what a stuck
6659 project is and how to find it.
6660 @end table
6662 You almost certainly will have to configure this view before it will
6663 work for you.  The built-in default assumes that all your projects are
6664 level-2 headlines, and that a project is not stuck if it has at least
6665 one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
6667 Let's assume that you, in your own way of using Org mode, identify
6668 projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
6669 indicate a project that should not be considered yet.  Let's further
6670 assume that the TODO keyword DONE marks finished projects, and that NEXT
6671 and TODO indicate next actions.  The tag @@SHOP indicates shopping and
6672 is a next action even without the NEXT tag.  Finally, if the project
6673 contains the special word IGNORE anywhere, it should not be listed
6674 either.  In this case you would start by identifying eligible projects
6675 with a tags/todo match@footnote{@xref{Tag searches}.}
6676 @samp{+PROJECT/-MAYBE-DONE}, and then check for TODO, NEXT, @@SHOP, and
6677 IGNORE in the subtree to identify projects that are not stuck.  The
6678 correct customization for this is
6680 @lisp
6681 (setq org-stuck-projects
6682       '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
6683                                "\\<IGNORE\\>"))
6684 @end lisp
6686 Note that if a project is identified as non-stuck, the subtree of this entry
6687 will still be searched for stuck projets.
6689 @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
6690 @section Presentation and sorting
6691 @cindex presentation, of agenda items
6693 @vindex org-agenda-prefix-format
6694 Before displaying items in an agenda view, Org mode visually prepares
6695 the items and sorts them.  Each item occupies a single line.  The line
6696 starts with a @emph{prefix} that contains the @emph{category}
6697 (@pxref{Categories}) of the item and other important information.  You can
6698 customize the prefix using the option @code{org-agenda-prefix-format}.
6699 The prefix is followed by a cleaned-up version of the outline headline
6700 associated with the item.
6702 @menu
6703 * Categories::                  Not all tasks are equal
6704 * Time-of-day specifications::  How the agenda knows the time
6705 * Sorting of agenda items::     The order of things
6706 @end menu
6708 @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
6709 @subsection Categories
6711 @cindex category
6712 The category is a broad label assigned to each agenda item.  By default,
6713 the category is simply derived from the file name, but you can also
6714 specify it with a special line in the buffer, like this@footnote{For
6715 backward compatibility, the following also works: If there are several
6716 such lines in a file, each specifies the category for the text below it.
6717 The first category also applies to any text before the first CATEGORY
6718 line.  However, using this method is @emph{strongly} deprecated as it is
6719 incompatible with the outline structure of the document.  The correct
6720 method for setting multiple categories in a buffer is using a
6721 property.}:
6723 @example
6724 #+CATEGORY: Thesis
6725 @end example
6727 @noindent
6728 @cindex property, CATEGORY
6729 If you would like to have a special CATEGORY for a single entry or a
6730 (sub)tree, give the entry a @code{:CATEGORY:} property with the
6731 special category you want to apply as the value.
6733 @noindent
6734 The display in the agenda buffer looks best if the category is not
6735 longer than 10 characters.
6737 @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
6738 @subsection Time-of-day specifications
6739 @cindex time-of-day specification
6741 Org mode checks each agenda item for a time-of-day specification.  The
6742 time can be part of the timestamp that triggered inclusion into the
6743 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}.  Time
6744 ranges can be specified with two timestamps, like
6746 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
6748 In the headline of the entry itself, a time(range) may also appear as
6749 plain text (like @samp{12:45} or a @samp{8:30-1pm}).  If the agenda
6750 integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
6751 specifications in diary entries are recognized as well.
6753 For agenda display, Org mode extracts the time and displays it in a
6754 standard 24 hour format as part of the prefix.  The example times in
6755 the previous paragraphs would end up in the agenda like this:
6757 @example
6758     8:30-13:00 Arthur Dent lies in front of the bulldozer
6759    12:45...... Ford Prefect arrives and takes Arthur to the pub
6760    19:00...... The Vogon reads his poem
6761    20:30-22:15 Marvin escorts the Hitchhikers to the bridge
6762 @end example
6764 @cindex time grid
6765 If the agenda is in single-day mode, or for the display of today, the
6766 timed entries are embedded in a time grid, like
6768 @example
6769     8:00...... ------------------
6770     8:30-13:00 Arthur Dent lies in front of the bulldozer
6771    10:00...... ------------------
6772    12:00...... ------------------
6773    12:45...... Ford Prefect arrives and takes Arthur to the pub
6774    14:00...... ------------------
6775    16:00...... ------------------
6776    18:00...... ------------------
6777    19:00...... The Vogon reads his poem
6778    20:00...... ------------------
6779    20:30-22:15 Marvin escorts the Hitchhikers to the bridge
6780 @end example
6782 @vindex org-agenda-use-time-grid
6783 @vindex org-agenda-time-grid
6784 The time grid can be turned on and off with the variable
6785 @code{org-agenda-use-time-grid}, and can be configured with
6786 @code{org-agenda-time-grid}.
6788 @node Sorting of agenda items,  , Time-of-day specifications, Presentation and sorting
6789 @subsection Sorting of agenda items
6790 @cindex sorting, of agenda items
6791 @cindex priorities, of agenda items
6792 Before being inserted into a view, the items are sorted.  How this is
6793 done depends on the type of view.
6794 @itemize @bullet
6795 @item
6796 @vindex org-agenda-files
6797 For the daily/weekly agenda, the items for each day are sorted.  The
6798 default order is to first collect all items containing an explicit
6799 time-of-day specification.  These entries will be shown at the beginning
6800 of the list, as a @emph{schedule} for the day.  After that, items remain
6801 grouped in categories, in the sequence given by @code{org-agenda-files}.
6802 Within each category, items are sorted by priority (@pxref{Priorities}),
6803 which is composed of the base priority (2000 for priority @samp{A}, 1000
6804 for @samp{B}, and 0 for @samp{C}), plus additional increments for
6805 overdue scheduled or deadline items.
6806 @item
6807 For the TODO list, items remain in the order of categories, but within
6808 each category, sorting takes place according to priority
6809 (@pxref{Priorities}).  The priority used for sorting derives from the
6810 priority cookie, with additions depending on how close an item is to its due
6811 or scheduled date.
6812 @item
6813 For tags matches, items are not sorted at all, but just appear in the
6814 sequence in which they are found in the agenda files.
6815 @end itemize
6817 @vindex org-agenda-sorting-strategy
6818 Sorting can be customized using the variable
6819 @code{org-agenda-sorting-strategy}, and may also include criteria based on
6820 the estimated effort of an entry (@pxref{Effort estimates}).
6822 @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
6823 @section Commands in the agenda buffer
6824 @cindex commands, in agenda buffer
6826 Entries in the agenda buffer are linked back to the Org file or diary
6827 file where they originate.  You are not allowed to edit the agenda
6828 buffer itself, but commands are provided to show and jump to the
6829 original entry location, and to edit the Org files ``remotely'' from
6830 the agenda buffer.  In this way, all information is stored only once,
6831 removing the risk that your agenda and note files may diverge.
6833 Some commands can be executed with mouse clicks on agenda lines.  For
6834 the other commands, the cursor needs to be in the desired line.
6836 @table @kbd
6837 @tsubheading{Motion}
6838 @cindex motion commands in agenda
6839 @kindex n
6840 @item n
6841 Next line (same as @key{up} and @kbd{C-p}).
6842 @kindex p
6843 @item p
6844 Previous line (same as @key{down} and @kbd{C-n}).
6845 @tsubheading{View/Go to Org file}
6846 @kindex mouse-3
6847 @kindex @key{SPC}
6848 @item mouse-3
6849 @itemx @key{SPC}
6850 Display the original location of the item in another window.
6851 With prefix arg, make sure that the entire entry is made visible in the
6852 outline, not only the heading.
6854 @kindex L
6855 @item L
6856 Display original location and recenter that window.
6858 @kindex mouse-2
6859 @kindex mouse-1
6860 @kindex @key{TAB}
6861 @item mouse-2
6862 @itemx mouse-1
6863 @itemx @key{TAB}
6864 Go to the original location of the item in another window.  Under Emacs
6865 22, @kbd{mouse-1} will also works for this.
6867 @kindex @key{RET}
6868 @itemx @key{RET}
6869 Go to the original location of the item and delete other windows.
6871 @kindex f
6872 @item f
6873 @vindex org-agenda-start-with-follow-mode
6874 Toggle Follow mode.  In Follow mode, as you move the cursor through
6875 the agenda buffer, the other window always shows the corresponding
6876 location in the Org file.  The initial setting for this mode in new
6877 agenda buffers can be set with the variable
6878 @code{org-agenda-start-with-follow-mode}.
6880 @kindex b
6881 @item b
6882 Display the entire subtree of the current item in an indirect buffer.  With a
6883 numeric prefix argument N, go up to level N and then take that tree.  If N is
6884 negative, go up that many levels.  With a @kbd{C-u} prefix, do not remove the
6885 previously used indirect buffer.
6887 @kindex v l
6888 @kindex l
6889 @item v l @ @r{or short} @ l
6890 @vindex org-log-done
6891 @vindex org-agenda-log-mode-items
6892 Toggle Logbook mode.  In Logbook mode, entries that were marked DONE while
6893 logging was on (variable @code{org-log-done}) are shown in the agenda, as are
6894 entries that have been clocked on that day.  You can configure the entry
6895 types that should be included in log mode using the variable
6896 @code{org-agenda-log-mode-items}.  When called with a @kbd{C-u} prefix, show
6897 all possible logbook entries, including state changes.  When called with two
6898 prefix args @kbd{C-u C-u}, show only logging information, nothing else.
6900 @kindex v a
6901 @kindex v A
6902 @item v a
6903 @itemx v A
6904 Toggle Archives mode.  In Archives mode, trees that are marked
6905 @code{ARCHIVED} are also scanned when producing the agenda.  When you use the
6906 capital @kbd{A}, even all archive files are included.  To exit archives mode,
6907 press @kbd{v a} again.
6909 @kindex R
6910 @item R
6911 @vindex org-agenda-start-with-clockreport-mode
6912 Toggle Clockreport mode.  In Clockreport mode, the daily/weekly agenda will
6913 always show a table with the clocked times for the timespan and file scope
6914 covered by the current agenda view.  The initial setting for this mode in new
6915 agenda buffers can be set with the variable
6916 @code{org-agenda-start-with-clockreport-mode}.
6918 @tsubheading{Change display}
6919 @cindex display changing, in agenda
6920 @kindex o
6921 @item o
6922 Delete other windows.
6924 @kindex v d
6925 @kindex d
6926 @kindex v w
6927 @kindex w
6928 @kindex v m
6929 @kindex v y
6930 @item v d @ @r{or short} @ d
6931 @itemx v w @ @r{or short} @ w
6932 @itemx v m
6933 @itemx v y
6934 Switch to day/week/month/year view.  When switching to day or week view,
6935 this setting becomes the default for subsequent agenda commands.  Since
6936 month and year views are slow to create, they do not become the default.
6937 A numeric prefix argument may be used to jump directly to a specific day
6938 of the year, ISO week, month, or year, respectively.  For example,
6939 @kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9.  When
6940 setting day, week, or month view, a year may be encoded in the prefix
6941 argument as well.  For example, @kbd{200712 w} will jump to week 12 in
6942 2007.  If such a year specification has only one or two digits, it will
6943 be mapped to the interval 1938-2037.
6945 @kindex D
6946 @item D
6947 Toggle the inclusion of diary entries.  See @ref{Weekly/daily agenda}.
6949 @kindex G
6950 @item G
6951 @vindex org-agenda-use-time-grid
6952 @vindex org-agenda-time-grid
6953 Toggle the time grid on and off.  See also the variables
6954 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
6956 @kindex r
6957 @item r
6958 Recreate the agenda buffer, for example to reflect the changes after
6959 modification of the timestamps of items with S-@key{left} and
6960 @kbd{S-@key{right}}.  When the buffer is the global TODO list, a prefix
6961 argument is interpreted to create a selective list for a specific TODO
6962 keyword.
6963 @kindex g
6964 @item g
6965 Same as @kbd{r}.
6967 @kindex s
6968 @kindex C-x C-s
6969 @item s
6970 @itemx C-x C-s
6971 Save all Org buffers in the current Emacs session, and also the locations of
6972 IDs.
6974 @kindex @key{right}
6975 @item @key{right}
6976 @vindex org-agenda-ndays
6977 Display the following @code{org-agenda-ndays} days.  For example, if
6978 the display covers a week, switch to the following week.  With prefix
6979 arg, go forward that many times @code{org-agenda-ndays} days.
6981 @kindex @key{left}
6982 @item @key{left}
6983 Display the previous dates.
6985 @kindex .
6986 @item .
6987 Go to today.
6989 @kindex j
6990 @item j
6991 Prompt for a date and go there.
6993 @kindex C-c C-x C-c
6994 @item C-c C-x C-c
6995 @vindex org-columns-default-format
6996 Invoke column view (@pxref{Column view}) in the agenda buffer.  The column
6997 view format is taken from the entry at point, or (if there is no entry at
6998 point), from the first entry in the agenda view.  So whatever the format for
6999 that entry would be in the original buffer (taken from a property, from a
7000 @code{#+COLUMNS} line, or from the default variable
7001 @code{org-columns-default-format}), will be used in the agenda.
7003 @kindex C-c C-x >
7004 @item C-c C-x >
7005 Remove the restriction lock on the agenda, if it is currently restricted to a
7006 file or subtree (@pxref{Agenda files}).
7008 @tsubheading{Secondary filtering and query editing}
7009 @cindex filtering, by tag and effort, in agenda
7010 @cindex tag filtering, in agenda
7011 @cindex effort filtering, in agenda
7012 @cindex query editing, in agenda
7014 @kindex /
7015 @item /
7016 @vindex org-agenda-filter-preset
7017 Filter the current agenda view with respect to a tag and/or effort estimates.
7018 The difference between this and a custom agenda command is that filtering is
7019 very fast, so that you can switch quickly between different filters without
7020 having to recreate the agenda@footnote{Custom commands can preset a filter by
7021 binding the variable @code{org-agenda-filter-preset} as an option.  This
7022 filter will then be applied to the view and presist as a basic filter through
7023 refreshes and more secondary filtering.}
7025 You will be prompted for a tag selection letter.  Pressing @key{TAB} at that
7026 prompt will offer use completion to select a tag (including any tags that do
7027 not have a selection character).  The command then hides all entries that do
7028 not contain or inherit this tag.  When called with prefix arg, remove the
7029 entries that @emph{do} have the tag.  A second @kbd{/} at the prompt will
7030 turn off the filter and unhide any hidden entries.  If the first key you
7031 press is either @kbd{+} or @kbd{-}, the previous filter will be narrowed by
7032 requiring or forbidding the selected additional tag.  Instead of pressing
7033 @kbd{+} or @kbd{-} after @kbd{/}, you can also immediately use the @kbd{\}
7034 command.
7036 @vindex org-sort-agenda-noeffort-is-high
7037 In order to filter for effort estimates, you should set-up allowed
7038 efforts globally, for example
7039 @lisp
7040 (setq org-global-properties
7041     '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
7042 @end lisp
7043 You can then filter for an effort by first typing an operator, one of
7044 @kbd{<}, @kbd{>}, and @kbd{=}, and then the one-digit index of an effort
7045 estimate in your array of allowed values, where @kbd{0} means the 10th value.
7046 The filter will then restrict to entries with effort smaller-or-equal, equal,
7047 or larger-or-equal than the selected value.  If the digits 0-9 are not used
7048 as fast access keys to tags, you can also simply press the index digit
7049 directly without an operator.  In this case, @kbd{<} will be assumed.  For
7050 application of the operator, entries without a defined effort will be treated
7051 according to the value of @code{org-sort-agenda-noeffort-is-high}.  To filter
7052 for tasks without effort definition, press @kbd{?} as the operator.
7054 @kindex \
7055 @item \
7056 Narrow the current agenda filter by an additional condition.  When called with
7057 prefix arg, remove the entries that @emph{do} have the tag, or that do match
7058 the effort criterion.  You can achieve the same effect by pressing @kbd{+} or
7059 @kbd{-} as the first key after the @kbd{/} command.
7061 @kindex [
7062 @kindex ]
7063 @kindex @{
7064 @kindex @}
7065 @item [ ] @{ @}
7066 In the @i{search view} (@pxref{Keyword search}), these keys add new search
7067 words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{} and
7068 @kbd{@}}) to the query string.  The opening bracket/brace will add a positive
7069 search term prefixed by @samp{+}, indicating that this search term @i{must}
7070 occur/match in the entry.  The closing bracket/brace will add a negative
7071 search term which @i{must not} occur/match in the entry for it to be
7072 selected.
7075 @tsubheading{Remote editing}
7076 @cindex remote editing, from agenda
7078 @item 0-9
7079 Digit argument.
7081 @cindex undoing remote-editing events
7082 @cindex remote editing, undo
7083 @kindex C-_
7084 @item C-_
7085 Undo a change due to a remote editing command.  The change is undone
7086 both in the agenda buffer and in the remote buffer.
7088 @kindex t
7089 @item t
7090 Change the TODO state of the item, both in the agenda and in the
7091 original org file.
7093 @kindex C-k
7094 @item C-k
7095 @vindex org-agenda-confirm-kill
7096 Delete the current agenda item along with the entire subtree belonging
7097 to it in the original Org file.  If the text to be deleted remotely
7098 is longer than one line, the kill needs to be confirmed by the user.  See
7099 variable @code{org-agenda-confirm-kill}.
7101 @kindex C-c C-w
7102 @item C-c C-w
7103 Refile the entry at point.
7105 @kindex a
7106 @item a
7107 Toggle the ARCHIVE tag for the current headline.
7109 @kindex A
7110 @item A
7111 Move the subtree corresponding to the current entry to its @emph{archive
7112 sibling}.
7114 @kindex $
7115 @item $
7116 Archive the subtree corresponding to the current headline.  This means the
7117 entry will be moved to the configured archive location, most likely a
7118 different file.
7120 @kindex T
7121 @item T
7122 @vindex org-agenda-show-inherited-tags
7123 Show all tags associated with the current item.  This is useful if you have
7124 turned off @code{org-agenda-show-inherited-tags}, but still want to see all
7125 tags of a headline occasionally.
7127 @kindex :
7128 @item :
7129 Set tags for the current headline.  If there is an active region in the
7130 agenda, change a tag for all headings in the region.
7132 @kindex ,
7133 @item ,
7134 Set the priority for the current item.  Org mode prompts for the
7135 priority character. If you reply with @key{SPC}, the priority cookie
7136 is removed from the entry.
7138 @kindex P
7139 @item P
7140 Display weighted priority of current item.
7142 @kindex +
7143 @kindex S-@key{up}
7144 @item +
7145 @itemx S-@key{up}
7146 Increase the priority of the current item.  The priority is changed in
7147 the original buffer, but the agenda is not resorted.  Use the @kbd{r}
7148 key for this.
7150 @kindex -
7151 @kindex S-@key{down}
7152 @item -
7153 @itemx S-@key{down}
7154 Decrease the priority of the current item.
7156 @kindex z
7157 @item z
7158 @vindex org-log-into-drawer
7159 Add a note to the entry.  This note will be recorded, and then files to the
7160 same location where state change notes are put.  Depending on
7161 @code{org-log-into-drawer}, this maybe inside a drawer.
7163 @kindex C-c C-a
7164 @item C-c C-a
7165 Dispatcher for all command related to attachments.
7167 @kindex C-c C-s
7168 @item C-c C-s
7169 Schedule this item
7171 @kindex C-c C-d
7172 @item C-c C-d
7173 Set a deadline for this item.
7175 @kindex k
7176 @item k
7177 Agenda actions, to set dates for selected items to the cursor date.
7178 This command also works in the calendar!  The command prompts for an
7179 additional key:
7180 @example
7181 m   @r{Mark the entry at point for action.  You can also make entries}
7182     @r{in Org files with @kbd{C-c C-x C-k}.}
7183 d   @r{Set the deadline of the marked entry to the date at point.}
7184 s   @r{Schedule the marked entry at the date at point.}
7185 r   @r{Call @code{org-remember} with the cursor date as default date.}
7186 @end example
7187 @noindent
7188 Press @kbd{r} afterward to refresh the agenda and see the effect of the
7189 command.
7191 @kindex S-@key{right}
7192 @item S-@key{right}
7193 Change the timestamp associated with the current line by one day into the
7194 future.  With a numeric prefix argument, change it by that many days.  For
7195 example, @kbd{3 6 5 S-@key{right}} will change it by a year.  With a
7196 @kbd{C-u} prefix, change the time by one hour.  If you immediately repeat the
7197 command, it will continue to change hours even without the prefix arg.  With
7198 a double @kbd{C-u C-u} prefix, do the same for changing minutes.  The stamp
7199 is changed in the original Org file, but the change is not directly reflected
7200 in the agenda buffer.  Use @kbd{r} or @kbd{g} to update the buffer.
7202 @kindex S-@key{left}
7203 @item S-@key{left}
7204 Change the timestamp associated with the current line by one day
7205 into the past.
7207 @kindex >
7208 @item >
7209 Change the timestamp associated with the current line to today.
7210 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
7211 on my keyboard.
7213 @kindex I
7214 @item I
7215 Start the clock on the current item.  If a clock is running already, it
7216 is stopped first.
7218 @kindex O
7219 @item O
7220 Stop the previously started clock.
7222 @kindex X
7223 @item X
7224 Cancel the currently running clock.
7226 @kindex J
7227 @item J
7228 Jump to the running clock in another window.
7230 @tsubheading{Bulk remote editing selected entries}
7231 @cindex remote editing, bulk, from agenda
7233 @kindex m
7234 @item s
7235 Mark the entry at point for bulk action.
7237 @kindex u
7238 @item u
7239 Unmark entry for bulk action.
7241 @kindex U
7242 @item U
7243 Unmark all marked entries for bulk action.
7245 @kindex B
7246 @item B
7247 Bulk action: Act on all marked entries in the agenda.  This will prompt for
7248 another key to select the action to be applied:
7249 @example
7250 r  @r{Prompt for a single refile target and move all entries.  The entries}
7251    @r{will no longer be in the agenda, refresh (@kbd{g}) to bring them back.}
7252 $  @r{Archive all selected entries.}
7253 A  @r{Archive entries by moving them to their respective archive siblings.}
7254 t  @r{Change TODO state.  This prompts for a single TODO keyword and}
7255    @r{changes the state of all selected entries, bypassing blocking and}
7256    @r{suppressing logging notes (but not time stamps).}
7257 +  @r{Add a tag to all selected entries.}
7258 -  @r{Remove a tag from all selected entries.}
7259 s  @r{Schedule all items to a new date.  To shift existing schedule dates}
7260    @r{by a fixed number of days, use something starting with double plus}
7261    @r{at the prompt, for example @samp{++8d} or @samp{++2w}.}
7262 d  @r{Set deadline to a specific date.}
7263 @end example
7266 @tsubheading{Calendar commands}
7267 @cindex calendar commands, from agenda
7268 @kindex c
7269 @item c
7270 Open the Emacs calendar and move to the date at the agenda cursor.
7272 @item c
7273 When in the calendar, compute and show the Org mode agenda for the
7274 date at the cursor.
7276 @cindex diary entries, creating from agenda
7277 @kindex i
7278 @item i
7279 Insert a new entry into the diary.  Prompts for the type of entry
7280 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
7281 entry in the diary, just as @kbd{i d}, etc., would do in the calendar.
7282 The date is taken from the cursor position.
7284 @kindex M
7285 @item M
7286 Show the phases of the moon for the three months around current date.
7288 @kindex S
7289 @item S
7290 Show sunrise and sunset times.  The geographical location must be set
7291 with calendar variables, see the documentation for the Emacs calendar.
7293 @kindex C
7294 @item C
7295 Convert the date at cursor into many other cultural and historic
7296 calendars.
7298 @kindex H
7299 @item H
7300 Show holidays for three months around the cursor date.
7302 @item M-x org-export-icalendar-combine-agenda-files
7303 Export a single iCalendar file containing entries from all agenda files.
7304 This is a globally available command, and also available in the agenda menu.
7306 @tsubheading{Exporting to a file}
7307 @kindex C-x C-w
7308 @item C-x C-w
7309 @cindex exporting agenda views
7310 @cindex agenda views, exporting
7311 @vindex org-agenda-exporter-settings
7312 Write the agenda view to a file.  Depending on the extension of the selected
7313 file name, the view will be exported as HTML (extension @file{.html} or
7314 @file{.htm}), Postscript (extension @file{.ps}), PDF (extension @file{.pdf}),
7315 or plain text (any other extension).  When called with a @kbd{C-u} prefix
7316 argument, immediately open the newly created file.  Use the variable
7317 @code{org-agenda-exporter-settings} to set options for @file{ps-print} and
7318 for @file{htmlize} to be used during export.
7320 @tsubheading{Quit and Exit}
7321 @kindex q
7322 @item q
7323 Quit agenda, remove the agenda buffer.
7325 @kindex x
7326 @cindex agenda files, removing buffers
7327 @item x
7328 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
7329 for the compilation of the agenda.  Buffers created by the user to
7330 visit Org files will not be removed.
7331 @end table
7334 @node Custom agenda views, Exporting Agenda Views, Agenda commands, Agenda Views
7335 @section Custom agenda views
7336 @cindex custom agenda views
7337 @cindex agenda views, custom
7339 Custom agenda commands serve two purposes: to store and quickly access
7340 frequently used TODO and tags searches, and to create special composite
7341 agenda buffers.  Custom agenda commands will be accessible through the
7342 dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
7344 @menu
7345 * Storing searches::            Type once, use often
7346 * Block agenda::                All the stuff you need in a single buffer
7347 * Setting Options::             Changing the rules
7348 @end menu
7350 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
7351 @subsection Storing searches
7353 The first application of custom searches is the definition of keyboard
7354 shortcuts for frequently used searches, either creating an agenda
7355 buffer, or a sparse tree (the latter covering of course only the current
7356 buffer).
7357 @kindex C-c a C
7358 @vindex org-agenda-custom-commands
7359 Custom commands are configured in the variable
7360 @code{org-agenda-custom-commands}.  You can customize this variable, for
7361 example by pressing @kbd{C-c a C}.  You can also directly set it with
7362 Emacs Lisp in @file{.emacs}.  The following example contains all valid
7363 search types:
7365 @lisp
7366 @group
7367 (setq org-agenda-custom-commands
7368       '(("w" todo "WAITING")
7369         ("W" todo-tree "WAITING")
7370         ("u" tags "+boss-urgent")
7371         ("v" tags-todo "+boss-urgent")
7372         ("U" tags-tree "+boss-urgent")
7373         ("f" occur-tree "\\<FIXME\\>")
7374         ("h" . "HOME+Name tags searches") ; description for "h" prefix
7375         ("hl" tags "+home+Lisa")
7376         ("hp" tags "+home+Peter")
7377         ("hk" tags "+home+Kim")))
7378 @end group
7379 @end lisp
7381 @noindent
7382 The initial string in each entry defines the keys you have to press
7383 after the dispatcher command @kbd{C-c a} in order to access the command.
7384 Usually this will be just a single character, but if you have many
7385 similar commands, you can also define two-letter combinations where the
7386 first character is the same in several combinations and serves as a
7387 prefix key@footnote{You can provide a description for a prefix key by
7388 inserting a cons cell with the prefix and the description.}.  The second
7389 parameter is the search type, followed by the string or regular
7390 expression to be used for the matching.  The example above will
7391 therefore define:
7393 @table @kbd
7394 @item C-c a w
7395 as a global search for TODO entries with @samp{WAITING} as the TODO
7396 keyword
7397 @item C-c a W
7398 as the same search, but only in the current buffer and displaying the
7399 results as a sparse tree
7400 @item C-c a u
7401 as a global tags search for headlines marked @samp{:boss:} but not
7402 @samp{:urgent:}
7403 @item C-c a v
7404 as the same search as @kbd{C-c a u}, but limiting the search to
7405 headlines that are also TODO items
7406 @item C-c a U
7407 as the same search as @kbd{C-c a u}, but only in the current buffer and
7408 displaying the result as a sparse tree
7409 @item C-c a f
7410 to create a sparse tree (again: current buffer only) with all entries
7411 containing the word @samp{FIXME}
7412 @item C-c a h
7413 as a prefix command for a HOME tags search where you have to press an
7414 additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
7415 Peter, or Kim) as additional tag to match.
7416 @end table
7418 @node Block agenda, Setting Options, Storing searches, Custom agenda views
7419 @subsection Block agenda
7420 @cindex block agenda
7421 @cindex agenda, with block views
7423 Another possibility is the construction of agenda views that comprise
7424 the results of @emph{several} commands, each of which creates a block in
7425 the agenda buffer.  The available commands include @code{agenda} for the
7426 daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
7427 for the global TODO list (as constructed with @kbd{C-c a t}), and the
7428 matching commands discussed above: @code{todo}, @code{tags}, and
7429 @code{tags-todo}.  Here are two examples:
7431 @lisp
7432 @group
7433 (setq org-agenda-custom-commands
7434       '(("h" "Agenda and Home-related tasks"
7435          ((agenda "")
7436           (tags-todo "home")
7437           (tags "garden")))
7438         ("o" "Agenda and Office-related tasks"
7439          ((agenda "")
7440           (tags-todo "work")
7441           (tags "office")))))
7442 @end group
7443 @end lisp
7445 @noindent
7446 This will define @kbd{C-c a h} to create a multi-block view for stuff
7447 you need to attend to at home.  The resulting agenda buffer will contain
7448 your agenda for the current week, all TODO items that carry the tag
7449 @samp{home}, and also all lines tagged with @samp{garden}.  Finally the
7450 command @kbd{C-c a o} provides a similar view for office tasks.
7452 @node Setting Options,  , Block agenda, Custom agenda views
7453 @subsection Setting options for custom commands
7454 @cindex options, for custom agenda views
7456 @vindex org-agenda-custom-commands
7457 Org mode contains a number of variables regulating agenda construction
7458 and display.  The global variables define the behavior for all agenda
7459 commands, including the custom commands.  However, if you want to change
7460 some settings just for a single custom view, you can do so.  Setting
7461 options requires inserting a list of variable names and values at the
7462 right spot in @code{org-agenda-custom-commands}.  For example:
7464 @lisp
7465 @group
7466 (setq org-agenda-custom-commands
7467       '(("w" todo "WAITING"
7468          ((org-agenda-sorting-strategy '(priority-down))
7469           (org-agenda-prefix-format "  Mixed: ")))
7470         ("U" tags-tree "+boss-urgent"
7471          ((org-show-following-heading nil)
7472           (org-show-hierarchy-above nil)))
7473         ("N" search ""
7474          ((org-agenda-files '("~org/notes.org"))
7475           (org-agenda-text-search-extra-files nil)))))
7476 @end group
7477 @end lisp
7479 @noindent
7480 Now the @kbd{C-c a w} command will sort the collected entries only by
7481 priority, and the prefix format is modified to just say @samp{  Mixed: }
7482 instead of giving the category of the entry.  The sparse tags tree of
7483 @kbd{C-c a U} will now turn out ultra-compact, because neither the
7484 headline hierarchy above the match, nor the headline following the match
7485 will be shown.  The command @kbd{C-c a N} will do a text search limited
7486 to only a single file.
7488 @vindex org-agenda-custom-commands
7489 For command sets creating a block agenda,
7490 @code{org-agenda-custom-commands} has two separate spots for setting
7491 options.  You can add options that should be valid for just a single
7492 command in the set, and options that should be valid for all commands in
7493 the set.  The former are just added to the command entry, the latter
7494 must come after the list of command entries.  Going back to the block
7495 agenda example (@pxref{Block agenda}), let's change the sorting strategy
7496 for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
7497 the results for GARDEN tags query in the opposite order,
7498 @code{priority-up}.  This would look like this:
7500 @lisp
7501 @group
7502 (setq org-agenda-custom-commands
7503       '(("h" "Agenda and Home-related tasks"
7504          ((agenda)
7505           (tags-todo "home")
7506           (tags "garden"
7507                 ((org-agenda-sorting-strategy '(priority-up)))))
7508          ((org-agenda-sorting-strategy '(priority-down))))
7509         ("o" "Agenda and Office-related tasks"
7510          ((agenda)
7511           (tags-todo "work")
7512           (tags "office")))))
7513 @end group
7514 @end lisp
7516 As you see, the values and parentheses setting is a little complex.
7517 When in doubt, use the customize interface to set this variable---it
7518 fully supports its structure.  Just one caveat: When setting options in
7519 this interface, the @emph{values} are just Lisp expressions.  So if the
7520 value is a string, you need to add the double-quotes around the value
7521 yourself.
7524 @node Exporting Agenda Views, Agenda column view, Custom agenda views, Agenda Views
7525 @section Exporting Agenda Views
7526 @cindex agenda views, exporting
7528 If you are away from your computer, it can be very useful to have a printed
7529 version of some agenda views to carry around.  Org mode can export custom
7530 agenda views as plain text, HTML@footnote{You need to install Hrvoje Niksic's
7531 @file{htmlize.el}.}, Postscript, PDF@footnote{To create PDF output, the
7532 ghostscript @file{ps2pdf} utility must be installed on the system.  Selecting
7533 a PDF file with also create the postscript file.}, and iCalendar files.  If
7534 you want to do this only occasionally, use the command
7536 @table @kbd
7537 @kindex C-x C-w
7538 @item C-x C-w
7539 @cindex exporting agenda views
7540 @cindex agenda views, exporting
7541 @vindex org-agenda-exporter-settings
7542 Write the agenda view to a file.  Depending on the extension of the
7543 selected file name, the view will be exported as HTML (extension
7544 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
7545 iCalendar (extension @file{.ics}), or plain text (any other extension).
7546 Use the variable @code{org-agenda-exporter-settings} to
7547 set options for @file{ps-print} and for @file{htmlize} to be used during
7548 export, for example
7550 @vindex org-agenda-add-entry-text-maxlines
7551 @vindex htmlize-output-type
7552 @vindex ps-number-of-columns
7553 @vindex ps-landscape-mode
7554 @lisp
7555 (setq org-agenda-exporter-settings
7556       '((ps-number-of-columns 2)
7557         (ps-landscape-mode t)
7558         (org-agenda-add-entry-text-maxlines 5)
7559         (htmlize-output-type 'css)))
7560 @end lisp
7561 @end table
7563 If you need to export certain agenda views frequently, you can associate
7564 any custom agenda command with a list of output file names
7565 @footnote{If you want to store standard views like the weekly agenda
7566 or the global TODO list as well, you need to define custom commands for
7567 them in order to be able to specify file names.}.  Here is an example
7568 that first defines custom commands for the agenda and the global
7569 TODO list, together with a number of files to which to export them.
7570 Then we define two block agenda commands and specify file names for them
7571 as well.  File names can be relative to the current working directory,
7572 or absolute.
7574 @lisp
7575 @group
7576 (setq org-agenda-custom-commands
7577       '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
7578         ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
7579         ("h" "Agenda and Home-related tasks"
7580          ((agenda "")
7581           (tags-todo "home")
7582           (tags "garden"))
7583          nil
7584          ("~/views/home.html"))
7585         ("o" "Agenda and Office-related tasks"
7586          ((agenda)
7587           (tags-todo "work")
7588           (tags "office"))
7589          nil
7590          ("~/views/office.ps" "~/calendars/office.ics"))))
7591 @end group
7592 @end lisp
7594 The extension of the file name determines the type of export.  If it is
7595 @file{.html}, Org mode will use the @file{htmlize.el} package to convert
7596 the buffer to HTML and save it to this file name.  If the extension is
7597 @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
7598 Postscript output.  If the extension is @file{.ics}, iCalendar export is
7599 run export over all files that were used to construct the agenda, and
7600 limit the export to entries listed in the agenda.  Any other
7601 extension produces a plain ASCII file.
7603 The export files are @emph{not} created when you use one of those
7604 commands interactively because this might use too much overhead.
7605 Instead, there is a special command to produce @emph{all} specified
7606 files in one step:
7608 @table @kbd
7609 @kindex C-c a e
7610 @item C-c a e
7611 Export all agenda views that have export file names associated with
7612 them.
7613 @end table
7615 You can use the options section of the custom agenda commands to also
7616 set options for the export commands.  For example:
7618 @lisp
7619 (setq org-agenda-custom-commands
7620       '(("X" agenda ""
7621          ((ps-number-of-columns 2)
7622           (ps-landscape-mode t)
7623           (org-agenda-prefix-format " [ ] ")
7624           (org-agenda-with-colors nil)
7625           (org-agenda-remove-tags t))
7626          ("theagenda.ps"))))
7627 @end lisp
7629 @noindent
7630 This command sets two options for the Postscript exporter, to make it
7631 print in two columns in landscape format---the resulting page can be cut
7632 in two and then used in a paper agenda.  The remaining settings modify
7633 the agenda prefix to omit category and scheduling information, and
7634 instead include a checkbox to check off items.  We also remove the tags
7635 to make the lines compact, and we don't want to use colors for the
7636 black-and-white printer.  Settings specified in
7637 @code{org-agenda-exporter-settings} will also apply, but the settings
7638 in @code{org-agenda-custom-commands} take precedence.
7640 @noindent
7641 From the command line you may also use
7642 @example
7643 emacs -f org-batch-store-agenda-views -kill
7644 @end example
7645 @noindent
7646 or, if you need to modify some parameters@footnote{Quoting depends on the
7647 system you use, please check the FAQ for examples.}
7648 @example
7649 emacs -eval '(org-batch-store-agenda-views                      \
7650               org-agenda-ndays 30                               \
7651               org-agenda-start-day "2007-11-01"                 \
7652               org-agenda-include-diary nil                      \
7653               org-agenda-files (quote ("~/org/project.org")))'  \
7654       -kill
7655 @end example
7656 @noindent
7657 which will create the agenda views restricted to the file
7658 @file{~/org/project.org}, without diary entries and with a 30-day
7659 extent.
7661 You can also extract agenda information in a way that allows further
7662 processing by other programs.  See @ref{Extracting agenda information}, for
7663 more information.
7666 @node Agenda column view,  , Exporting Agenda Views, Agenda Views
7667 @section Using column view in the agenda
7668 @cindex column view, in agenda
7669 @cindex agenda, column view
7671 Column view (@pxref{Column view}) is normally used to view and edit
7672 properties embedded in the hierarchical structure of an Org file.  It can be
7673 quite useful to use column view also from the agenda, where entries are
7674 collected by certain criteria.
7676 @table @kbd
7677 @kindex C-c C-x C-c
7678 @item C-c C-x C-c
7679 Turn on column view in the agenda.
7680 @end table
7682 To understand how to use this properly, it is important to realize that the
7683 entries in the agenda are no longer in their proper outline environment.
7684 This causes the following issues:
7686 @enumerate
7687 @item
7688 @vindex org-columns-default-format
7689 @vindex org-overriding-columns-format
7690 Org needs to make a decision which @code{COLUMNS} format to use.  Since the
7691 entries in the agenda are collected from different files, and different files
7692 may have different @code{COLUMNS} formats, this is a non-trivial problem.
7693 Org first checks if the variable @code{org-overriding-columns-format} is
7694 currently set, and if so, takes the format from there.  Otherwise it takes
7695 the format associated with the first item in the agenda, or, if that item
7696 does not have a specific format (defined in a property, or in its file), it
7697 uses @code{org-columns-default-format}.
7698 @item
7699 @cindex property, special, CLOCKSUM
7700 If any of the columns has a summary type defined (@pxref{Column attributes}),
7701 turning on column view in the agenda will visit all relevant agenda files and
7702 make sure that the computations of this property are up to date.  This is
7703 also true for the special @code{CLOCKSUM} property.  Org will then sum the
7704 values displayed in the agenda.  In the daily/weekly agenda, the sums will
7705 cover a single day, in all other views they cover the entire block.  It is
7706 vital to realize that the agenda may show the same entry @emph{twice} (for
7707 example as scheduled and as a deadline), and it may show two entries from the
7708 same hierarchy (for example a @emph{parent} and its @emph{child}).  In these
7709 cases, the summation in the agenda will lead to incorrect results because
7710 some values will count double.
7711 @item
7712 When the column view in the agenda shows the @code{CLOCKSUM}, that is always
7713 the entire clocked time for this item.  So even in the daily/weekly agenda,
7714 the clocksum listed in column view may originate from times outside the
7715 current view.  This has the advantage that you can compare these values with
7716 a column listing the planned total effort for a task---one of the major
7717 applications for column view in the agenda.  If you want information about
7718 clocked time in the displayed period use clock table mode (press @kbd{R} in
7719 the agenda).
7720 @end enumerate
7723 @node Embedded LaTeX, Exporting, Agenda Views, Top
7724 @chapter Embedded La@TeX{}
7725 @cindex @TeX{} interpretation
7726 @cindex La@TeX{} interpretation
7728 Plain ASCII is normally sufficient for almost all note taking.  One
7729 exception, however, are scientific notes which need to be able to contain
7730 mathematical symbols and the occasional formula.  La@TeX{}@footnote{La@TeX{}
7731 is a macro system based on Donald E. Knuth's @TeX{} system.  Many of the
7732 features described here as ``La@TeX{}'' are really from @TeX{}, but for
7733 simplicity I am blurring this distinction.}  is widely used to typeset
7734 scientific documents. Org mode supports embedding La@TeX{} code into its
7735 files, because many academics are used to reading La@TeX{} source code, and
7736 because it can be readily processed into images for HTML production.
7738 It is not necessary to mark La@TeX{} macros and code in any special way.
7739 If you observe a few conventions, Org mode knows how to find it and what
7740 to do with it.
7742 @menu
7743 * Math symbols::                @TeX{} macros for symbols and Greek letters
7744 * Subscripts and superscripts::  Simple syntax for raising/lowering text
7745 * LaTeX fragments::             Complex formulas made easy
7746 * Processing LaTeX fragments::  Previewing La@TeX{} processing
7747 * CDLaTeX mode::                Speed up entering of formulas
7748 @end menu
7750 @node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
7751 @section Math symbols
7752 @cindex math symbols
7753 @cindex @TeX{} macros
7755 You can use La@TeX{} macros to insert special symbols like @samp{\alpha} to
7756 indicate the Greek letter, or @samp{\to} to indicate an arrow.  Completion
7757 for these macros is available, just type @samp{\} and maybe a few letters,
7758 and press @kbd{M-@key{TAB}} to see possible completions.  Unlike La@TeX{}
7759 code, Org mode allows these macros to be present without surrounding math
7760 delimiters, for example:
7762 @example
7763 Angles are written as Greek letters \alpha, \beta and \gamma.
7764 @end example
7765 @noindent
7766 During HTML export (@pxref{HTML export}), these symbols are translated
7767 into the proper syntax for HTML, for the above examples this is
7768 @samp{&alpha;} and @samp{&rarr;}, respectively.  If you need such a symbol
7769 inside a word, terminate it like this: @samp{\Aacute@{@}stor}.
7771 @node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
7772 @section Subscripts and superscripts
7773 @cindex subscript
7774 @cindex superscript
7776 Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
7777 and subscripts.  Again, these can be used without embedding them in
7778 math-mode delimiters.  To increase the readability of ASCII text, it is
7779 not necessary (but OK) to surround multi-character sub- and superscripts
7780 with curly braces.  For example
7782 @example
7783 The mass if the sun is M_sun = 1.989 x 10^30 kg.  The radius of
7784 the sun is R_@{sun@} = 6.96 x 10^8 m.
7785 @end example
7787 To avoid interpretation as raised or lowered text, you can quote
7788 @samp{^} and @samp{_} with a backslash: @samp{\^} and @samp{\_}.
7790 During HTML export (@pxref{HTML export}), subscript and superscripts
7791 are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
7793 @node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
7794 @section La@TeX{} fragments
7795 @cindex La@TeX{} fragments
7797 @vindex org-format-latex-header
7798 With symbols, sub- and superscripts, HTML is pretty much at its end when
7799 it comes to representing mathematical formulas@footnote{Yes, there is
7800 MathML, but that is not yet fully supported by many browsers, and there
7801 is no decent converter for turning La@TeX{} or ASCII representations of
7802 formulas into MathML. So for the time being, converting formulas into
7803 images seems the way to go.}. More complex expressions need a dedicated
7804 formula processor. To this end, Org mode can contain arbitrary La@TeX{}
7805 fragments. It provides commands to preview the typeset result of these
7806 fragments, and upon export to HTML, all fragments will be converted to
7807 images and inlined into the HTML document@footnote{The La@TeX{} export
7808 will not use images for displaying La@TeX{} fragments but include these
7809 fragments directly into the La@TeX{} code.}. For this to work you
7810 need to be on a system with a working La@TeX{} installation. You also
7811 need the @file{dvipng} program, available at
7812 @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
7813 will be used when processing a fragment can be configured with the
7814 variable @code{org-format-latex-header}.
7816 La@TeX{} fragments don't need any special marking at all.  The following
7817 snippets will be identified as La@TeX{} source code:
7818 @itemize @bullet
7819 @item
7820 Environments of any kind.  The only requirement is that the
7821 @code{\begin} statement appears on a new line, preceded by only
7822 whitespace.
7823 @item
7824 Text within the usual La@TeX{} math delimiters.  To avoid conflicts with
7825 currency specifications, single @samp{$} characters are only recognized as
7826 math delimiters if the enclosed text contains at most two line breaks, is
7827 directly attached to the @samp{$} characters with no whitespace in between,
7828 and if the closing @samp{$} is followed by whitespace, punctuation or a dash.
7829 For the other delimiters, there is no such restriction, so when in doubt, use
7830 @samp{\(...\)} as inline math delimiters.
7831 @end itemize
7833 @noindent For example:
7835 @example
7836 \begin@{equation@}                          % arbitrary environments,
7837 x=\sqrt@{b@}                                % even tables, figures
7838 \end@{equation@}                            % etc
7840 If $a^2=b$ and \( b=2 \), then the solution must be
7841 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
7842 @end example
7844 @noindent
7845 @vindex org-format-latex-options
7846 If you need any of the delimiter ASCII sequences for other purposes, you
7847 can configure the option @code{org-format-latex-options} to deselect the
7848 ones you do not wish to have interpreted by the La@TeX{} converter.
7850 @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
7851 @section Processing LaTeX fragments
7852 @cindex LaTeX fragments, preview
7854 La@TeX{} fragments can be processed to produce preview images of the
7855 typeset expressions:
7857 @table @kbd
7858 @kindex C-c C-x C-l
7859 @item C-c C-x C-l
7860 Produce a preview image of the La@TeX{} fragment at point and overlay it
7861 over the source code.  If there is no fragment at point, process all
7862 fragments in the current entry (between two headlines).  When called
7863 with a prefix argument, process the entire subtree.  When called with
7864 two prefix arguments, or when the cursor is before the first headline,
7865 process the entire buffer.
7866 @kindex C-c C-c
7867 @item C-c C-c
7868 Remove the overlay preview images.
7869 @end table
7871 During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
7872 converted into images and inlined into the document if the following
7873 setting is active:
7875 @lisp
7876 (setq org-export-with-LaTeX-fragments t)
7877 @end lisp
7879 @node CDLaTeX mode,  , Processing LaTeX fragments, Embedded LaTeX
7880 @section Using CDLa@TeX{} to enter math
7881 @cindex CDLa@TeX{}
7883 CDLa@TeX{} mode is a minor mode that is normally used in combination with a
7884 major La@TeX{} mode like AUC@TeX{} in order to speed-up insertion of
7885 environments and math templates.  Inside Org mode, you can make use of
7886 some of the features of CDLa@TeX{} mode.  You need to install
7887 @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
7888 AUC@TeX{}) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
7889 Don't use CDLa@TeX{} mode itself under Org mode, but use the light
7890 version @code{org-cdlatex-mode} that comes as part of Org mode.  Turn it
7891 on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
7892 Org files with
7894 @lisp
7895 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
7896 @end lisp
7898 When this mode is enabled, the following features are present (for more
7899 details see the documentation of CDLa@TeX{} mode):
7900 @itemize @bullet
7901 @kindex C-c @{
7902 @item
7903 Environment templates can be inserted with @kbd{C-c @{}.
7904 @item
7905 @kindex @key{TAB}
7906 The @key{TAB} key will do template expansion if the cursor is inside a
7907 La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
7908 inside such a fragment, see the documentation of the function
7909 @code{org-inside-LaTeX-fragment-p}.}.  For example, @key{TAB} will
7910 expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
7911 correctly inside the first brace.  Another @key{TAB} will get you into
7912 the second brace.  Even outside fragments, @key{TAB} will expand
7913 environment abbreviations at the beginning of a line.  For example, if
7914 you write @samp{equ} at the beginning of a line and press @key{TAB},
7915 this abbreviation will be expanded to an @code{equation} environment.
7916 To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
7917 @item
7918 @kindex _
7919 @kindex ^
7920 @vindex cdlatex-simplify-sub-super-scripts
7921 Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
7922 characters together with a pair of braces.  If you use @key{TAB} to move
7923 out of the braces, and if the braces surround only a single character or
7924 macro, they are removed again (depending on the variable
7925 @code{cdlatex-simplify-sub-super-scripts}).
7926 @item
7927 @kindex `
7928 Pressing the backquote @kbd{`} followed by a character inserts math
7929 macros, also outside La@TeX{} fragments.  If you wait more than 1.5 seconds
7930 after the backquote, a help window will pop up.
7931 @item
7932 @kindex '
7933 Pressing the single-quote @kbd{'} followed by another character modifies
7934 the symbol before point with an accent or a font.  If you wait more than
7935 1.5 seconds after the backquote, a help window will pop up.  Character
7936 modification will work only inside La@TeX{} fragments, outside the quote
7937 is normal.
7938 @end itemize
7940 @node Exporting, Publishing, Embedded LaTeX, Top
7941 @chapter Exporting
7942 @cindex exporting
7944 Org-mode documents can be exported into a variety of other formats.  For
7945 printing and sharing of notes, ASCII export produces a readable and simple
7946 version of an Org file.  HTML export allows you to publish a notes file on
7947 the web, while the XOXO format provides a solid base for exchange with a
7948 broad range of other applications. La@TeX{} export lets you use Org mode and
7949 its structured editing functions to easily create La@TeX{} files.  DocBook
7950 export makes it possible to convert Org files to many other formats using
7951 DocBook tools.  To incorporate entries with associated times like deadlines
7952 or appointments into a desktop calendar program like iCal, Org mode can also
7953 produce extracts in the iCalendar format.  Currently Org mode only supports
7954 export, not import of these different formats.
7956 Org supports export of selected regions when @code{transient-mark-mode} is
7957 enabled (default in Emacs 23).
7959 @menu
7960 * Markup rules::                Which structures are recognized?
7961 * Selective export::            Using tags to select and exclude trees
7962 * Export options::              Per-file export settings
7963 * The export dispatcher::       How to access exporter commands
7964 * ASCII export::                Exporting to plain ASCII
7965 * HTML export::                 Exporting to HTML
7966 * LaTeX and PDF export::        Exporting to La@TeX{}, and processing to PDF
7967 * DocBook export::              Exporting to DocBook
7968 * XOXO export::                 Exporting to XOXO
7969 * iCalendar export::            Exporting in iCalendar format
7970 @end menu
7972 @node Markup rules, Selective export, Exporting, Exporting
7973 @section Markup rules
7975 When exporting Org-mode documents, the exporter tries to reflect the
7976 structure of the document as accurately as possible in the backend.  Since
7977 export targets like HTML, La@TeX{}, or DocBook allow much richer formatting,
7978 Org mode has rules on how to prepare text for rich export.  This section
7979 summarizes the markup rules used in an Org-mode buffer.
7981 @menu
7982 * Document title::              How the document title is determined
7983 * Headings and sections::       The main structure of the exported document
7984 * Table of contents::           If, where, how to create a table of contents
7985 * Initial text::                Text before the first headline
7986 * Lists::                       Plain lists are exported
7987 * Paragraphs::                  What determines beginning and ending
7988 * Literal examples::            Source code and other examples
7989 * Include files::               Include the contents of a file during export
7990 * Tables exported::             Tables are exported richly
7991 * Inlined images::              How to inline images during export
7992 * Footnote markup::             ASCII representation of footnotes
7993 * Emphasis and monospace::      To bold or not to bold
7994 * TeX macros and LaTeX fragments::  Create special, rich export.
7995 * Horizontal rules::            A line across the page
7996 * Comment lines::               Some lines will not be exported
7997 * Macro replacement::           Global replacement of place holdes
7998 @end menu
8000 @node Document title, Headings and sections, Markup rules, Markup rules
8001 @subheading Document title
8002 @cindex document title, markup rules
8004 @noindent
8005 The title of the exported document is taken from the special line
8007 @cindex #+TITLE
8008 @example
8009 #+TITLE: This is the title of the document
8010 @end example
8012 @noindent
8013 If this line does not exist, the title is derived from the first non-empty,
8014 non-comment line in the buffer.  If no such line exists, or if you have
8015 turned off exporting of the text before the first headline (see below), the
8016 title will be the file name without extension.
8018 @cindex property, EXPORT_TITLE
8019 If you are exporting only a subtree by marking is as the region, the heading
8020 of the subtree will become the title of the document.  If the subtree has a
8021 property @code{EXPORT_TITLE}, that will take precedence.
8023 @node Headings and sections, Table of contents, Document title, Markup rules
8024 @subheading Headings and sections
8025 @cindex headings and sections, markup rules
8027 @vindex org-headline-levels
8028 The outline structure of the document as described in @ref{Document
8029 Structure}, forms the basis for defining sections of the exported document.
8030 However, since the outline structure is also used for (for example) lists of
8031 tasks, only the first three outline levels will be used as headings.  Deeper
8032 levels will become itemized lists.  You can change the location of this
8033 switch globally by setting the variable @code{org-headline-levels}, or on a
8034 per-file basis with a line
8036 @cindex #+OPTIONS
8037 @example
8038 #+OPTIONS: H:4
8039 @end example
8041 @node Table of contents, Initial text, Headings and sections, Markup rules
8042 @subheading Table of contents
8043 @cindex table of contents, markup rules
8045 @vindex org-export-with-toc
8046 The table of contents is normally inserted directly before the first headline
8047 of the file.  If you would like to get it to a different location, insert the
8048 string @code{[TABLE-OF-CONTENTS]} on a line by itself at the desired
8049 location.  The depth of the table of contents is by default the same as the
8050 number of headline levels, but you can choose a smaller number, or turn off
8051 the table of contents entirely, by configuring the variable
8052 @code{org-export-with-toc}, or on a per-file basis with a line like
8054 @example
8055 #+OPTIONS: toc:2          (only to two levels in TOC)
8056 #+OPTIONS: toc:nil        (no TOC at all)
8057 @end example
8059 @node Initial text, Lists, Table of contents, Markup rules
8060 @subheading Text before the first headline
8061 @cindex text before first headline, markup rules
8062 @cindex #+TEXT
8064 Org mode normally exports the text before the first headline, and even uses
8065 the first line as the document title.  The text will be fully marked up.  If
8066 you need to include literal HTML, La@TeX{}, or DocBook code, use the special
8067 constructs described below in the sections for the individual exporters.
8069 @vindex org-export-skip-text-before-1st-heading
8070 Some people like to use the space before the first headline for setup and
8071 internal links and therefore would like to control the exported text before
8072 the first headline in a different way.  You can do so by setting the variable
8073 @code{org-export-skip-text-before-1st-heading} to @code{t}.  On a per-file
8074 basis, you can get the same effect with @samp{#+OPTIONS: skip:t}.
8076 @noindent
8077 If you still want to have some text before the first headline, use the
8078 @code{#+TEXT} construct:
8080 @example
8081 #+OPTIONS: skip:t
8082 #+TEXT: This text will go before the *first* headline.
8083 #+TEXT: [TABLE-OF-CONTENTS]
8084 #+TEXT: This goes between the table of contents and the first headline
8085 @end example
8087 @node Lists, Paragraphs, Initial text, Markup rules
8088 @subheading Lists
8089 @cindex lists, markup rules
8091 Plain lists as described in @ref{Plain lists}, are translated to the backend's
8092 syntax for such lists.  Most backends support unordered, ordered, and
8093 description lists.
8095 @node Paragraphs, Literal examples, Lists, Markup rules
8096 @subheading Paragraphs, line breaks, and quoting
8097 @cindex paragraphs, markup rules
8099 Paragraphs are separated by at least one empty line.  If you need to enforce
8100 a line break within a paragraph, use @samp{\\} at the end of a line.
8102 To keep the line breaks in a region, but otherwise use normal formatting, you
8103 can use this construct, which can also be used to format poetry.
8105 @cindex #+BEGIN_VERSE
8106 @example
8107 #+BEGIN_VERSE
8108  Great clouds overhead
8109  Tiny black birds rise and fall
8110  Snow covers Emacs
8112      -- AlexSchroeder
8113 #+END_VERSE
8114 @end example
8116 When quoting a passage from another document, it is customary to format this
8117 as a paragraph that is indented on both the left and the right margin.  You
8118 can include quotations in Org-mode documents like this:
8120 @cindex #+BEGIN_QUOTE
8121 @example
8122 #+BEGIN_QUOTE
8123 Everything should be made as simple as possible,
8124 but not any simpler -- Albert Einstein
8125 #+END_QUOTE
8126 @end example
8128 If you would like to center some text, do it like this:
8129 @cindex #+BEGIN_CENTER
8130 @example
8131 #+BEGIN_CENTER
8132 Everything should be made as simple as possible, \\
8133 but not any simpler
8134 #+END_CENTER
8135 @end example
8137 @node Literal examples, Include files, Paragraphs, Markup rules
8138 @subheading Literal examples
8139 @cindex literal examples, markup rules
8140 @cindex code line refenences, markup rules
8142 You can include literal examples that should not be subjected to
8143 markup.  Such examples will be typeset in monospace, so this is well suited
8144 for source code and similar examples.
8145 @cindex #+BEGIN_EXAMPLE
8147 @example
8148 #+BEGIN_EXAMPLE
8149 Some example from a text file.
8150 #+END_EXAMPLE
8151 @end example
8153 Note that such blocks may be @i{indented} in order to align nicely with
8154 indented text and in particular with plain list structure (@pxref{Plain
8155 lists}).  For simplicity when using small examples, you can also start the
8156 example lines with a colon followed by a space.  There may also be additional
8157 whitespace before the colon:
8159 @example
8160 Here is an example
8161    : Some example from a text file.
8162 @end example
8164 @cindex formatting source code, markup rules
8165 If the example is source code from a programming language, or any other text
8166 that can be marked up by font-lock in Emacs, you can ask for the example to
8167 look like the fontified Emacs buffer@footnote{Currently this works only for
8168 the HTML backend, and requires the @file{htmlize.el} package version 1.34 or
8169 later.}.  This is done with the @samp{src} block, where you also need to
8170 specify the name of the major mode that should be used to fontify the
8171 example:
8172 @cindex #+BEGIN_SRC
8174 @example
8175 #+BEGIN_SRC emacs-lisp
8176 (defun org-xor (a b)
8177    "Exclusive or."
8178    (if a (not b) b))
8179 #+END_SRC
8180 @end example
8182 Both in @code{example} and in @code{src} snippets, you can add a @code{-n}
8183 switch to the end of the @code{BEGIN} line, to get the lines of the example
8184 numbered.  If you use a @code{+n} switch, the numbering from the previous
8185 numbered snippet will be continued in the current one.  In literal examples,
8186 Org will interpret strings like @samp{(ref:name)} as labels, and use them as
8187 targets for special hyperlinks like @code{[[(name)]]} (@ie the reference
8188 name enclosed in single parenthesis).  In HTML, hovering the mouse over such
8189 a link will remote-highlight the corresponding code line, which is kind of
8190 cool.  If the example/src snippet is numbered, you can also add a @code{-r}
8191 switch.  Then labels will be @i{removed} from the source code and the links
8192 will be @i{replaced}@footnote{If you want to explain the use of such labels
8193 themelves in org-mode example code, you can use the @code{-k} switch to make
8194 sure they are not touched.} with line numbers from the code listing.  Here is
8195 an example:
8197 @example
8198 #+BEGIN_SRC emacs-lisp -n -r
8199 (save-excursion                  (ref:sc)
8200    (goto-char (point-min))       (ref:jump)
8201 #+END SRC
8202 In line [[(sc)]] we remember the current positon.  [[(jump)][Line (jump)]]
8203 jumps to point-min.
8204 @end example
8206 @vindex org-coderef-label-format
8207 If the syntax for the label format conflicts with the language syntax, use a
8208 @code{-l} switch to change the format, for example @samp{#+BEGIN_SRC pascal
8209 -n -r -l "((%s))"}.  See also the variable @code{org-coderef-label-format}.
8211 HTML export also allows examples to be published as text areas, @xref{Text
8212 areas in HTML export}.
8214 @table @kbd
8215 @kindex C-c '
8216 @item C-c '
8217 Edit the source code example at point in its native mode.  This works by
8218 switching to a temporary buffer with the source code.  You need to exit by
8219 pressing @kbd{C-c '} again@footnote{Upon exit, lines starting with @samp{*}
8220 or @samp{#} will get a comma prepended, to keep them from being interpreted
8221 by Org as outline nodes or special comments.  These commas will be striped
8222 for editing with @kbd{C-c '}, and also for export.}, the edited version will
8223 then replace the old version in the Org buffer.  Fixed-width regions
8224 (where each line starts with a colon followed by a space) will be edited
8225 using @code{artist-mode}@footnote{You may select a different-mode with the
8226 variable @code{org-edit-fixed-width-region-mode}.} to allow creating ASCII
8227 drawings easily.  Using this command in an empty line will create a new
8228 fixed-width region.
8229 @kindex C-c l
8230 @item C-c l
8231 Calling @code{org-store-link} while editing a source code example in a
8232 temporary buffer created with @kbd{C-c '} will prompt for a label, make sure
8233 that it is unique in the current buffer, and insert it with the proper
8234 formatting like @samp{(ref:label)} at the end of the current line.  Then the
8235 label is stored as a link @samp{(label)}, for retrieval with @kbd{C-c C-l}.
8236 @end table
8239 @node Include files, Tables exported, Literal examples, Markup rules
8240 @subheading Include files
8241 @cindex include files, markup rules
8243 During export, you can include the content of another file.  For example, to
8244 include your @file{.emacs} file, you could use:
8245 @cindex #+INCLUDE
8247 @example
8248 #+INCLUDE: "~/.emacs" src emacs-lisp
8249 @end example
8250 @noindent
8251 The optional second and third parameter are the markup (@samp{quote},
8252 @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
8253 language for formatting the contents.  The markup is optional, if it is not
8254 given, the text will be assumed to be in Org mode format and will be
8255 processed normally.  The include line will also allow additional keyword
8256 parameters @code{:prefix1} and @code{:prefix} to specify prefixes for the
8257 first line and for each following line, as well as any options accepted by
8258 the selected markup.  For example, to include a file as an item, use
8260 @example
8261 #+INCLUDE: "~/snippets/xx" :prefix1 "   + " :prefix "     "
8262 @end example
8264 @table @kbd
8265 @kindex C-c '
8266 @item C-c '
8267 Visit the include file at point.
8268 @end table
8270 @node Tables exported, Inlined images, Include files, Markup rules
8271 @subheading Tables
8272 @cindex tables, markup rules
8274 Both the native Org mode tables (@pxref{Tables}) and tables formatted with
8275 the @file{table.el} package will be exported properly.  For Org mode tables,
8276 the lines before the first horizontal separator line will become table header
8277 lines.  You can use the following lines somewhere before the table to assign
8278 a caption and a label for cross references:
8280 @example
8281 #+CAPTION: This is the caption for the next table (or link)
8282 #+LABEL:   tbl:basic-data
8283 @end example
8285 @node Inlined images, Footnote markup, Tables exported, Markup rules
8286 @subheading Inlined Images
8287 @cindex inlined images, markup rules
8289 Some backends (HTML, La@TeX{}, and DocBook) allow you to directly include images
8290 into the exported document.  Org does this, if a link to an image files does
8291 not have a description part, for example @code{[[./img/a.jpg]]}.  If you wish
8292 to define a caption for the image and maybe a label for internal cross
8293 references, you can use (before, but close to the link)
8295 @example
8296 #+CAPTION: This is the caption for the next figure link (or table)
8297 #+LABEL:   fig:SED-HR4049
8298 @end example
8300 You may also define additional attributes for the figure.  As this is
8301 backend-specific, see the sections about the individual backends for more
8302 information.
8304 @node Footnote markup, Emphasis and monospace, Inlined images, Markup rules
8305 @subheading Footnote markup
8306 @cindex footnotes, markup rules
8307 @cindex @file{footnote.el}
8309 Footnotes defined in the way described in @ref{Footnotes}, will be exported by
8310 all backends.  Org allows multiple references to the same note, and
8311 different backends support this to varying degrees.
8313 @node Emphasis and monospace, TeX macros and LaTeX fragments, Footnote markup, Markup rules
8314 @subheading Emphasis and monospace
8316 @cindex underlined text, markup rules
8317 @cindex bold text, markup rules
8318 @cindex italic text, markup rules
8319 @cindex verbatim text, markup rules
8320 @cindex code text, markup rules
8321 @cindex strike-through text, markup rules
8322 You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
8323 and @code{~verbatim~}, and, if you must, @samp{+strike-through+}.  Text
8324 in the code and verbatim string is not processed for Org-mode specific
8325 syntax, it is exported verbatim.
8327 @node TeX macros and LaTeX fragments, Horizontal rules, Emphasis and monospace, Markup rules
8328 @subheading @TeX{} macros and La@TeX{} fragments
8329 @cindex La@TeX{} fragments, markup rules
8330 @cindex @TeX{} macros, markup rules
8331 @cindex HTML entities
8332 @cindex La@TeX{} entities
8334 @vindex org-html-entities
8335 A @TeX{}-like syntax is used to specify special characters.  Where possible,
8336 these will be transformed into the native format of the exporter backend.
8337 Strings like @code{\alpha} will be exported as @code{&alpha;} in the HTML
8338 output, and as @code{$\alpha$} in the La@TeX{} output.  Similarly,
8339 @code{\nbsp} will become @code{&nbsp;} in HTML and @code{~} in La@TeX{}.
8340 This applies for a large number of entities, with names taken from both HTML
8341 and La@TeX{}, see the variable @code{org-html-entities} for the complete
8342 list.  If you are unsure about a name, use @kbd{M-@key{TAB}} for completion
8343 after having typed the backslash and optionally a few characters
8344 (@pxref{Completion}).
8346 La@TeX{} fragments are converted into images for HTML export, and they are
8347 written literally into the La@TeX{} export.  See also @ref{Embedded LaTeX}.
8349 Finally, @samp{\-} is treated as a shy hyphen, and @samp{--}, @samp{---}, and
8350 @samp{...} are all converted into special commands creating hyphens of
8351 different lengths or a compact set of dots.
8353 @node Horizontal rules, Comment lines, TeX macros and LaTeX fragments, Markup rules
8354 @subheading  Horizontal rules
8355 @cindex horizontal rules, markup rules
8356 A line consisting of only dashes, and at least 5 of them, will be
8357 exported as a horizontal line (@samp{<hr/>} in HTML).
8359 @node Comment lines, Macro replacement, Horizontal rules, Markup rules
8360 @subheading Comment lines
8361 @cindex comment lines
8362 @cindex exporting, not
8363 @cindex #+BEGIN_COMMENT
8365 Lines starting with @samp{#} in column zero are treated as comments and will
8366 never be exported.  Also entire subtrees starting with the word
8367 @samp{COMMENT} will never be exported.  Finally, regions surrounded by
8368 @samp{#+BEGIN_COMMENT} ... @samp{#+END_COMMENT} will not be exported.
8370 @table @kbd
8371 @kindex C-c ;
8372 @item C-c ;
8373 Toggle the COMMENT keyword at the beginning of an entry.
8374 @end table
8376 @node Macro replacement,  , Comment lines, Markup rules
8377 @subheading Macro replacement
8378 @cindex macro replacement, during export
8379 @cindex #+MACRO
8381 You can define text snippets with
8383 @example
8384 #+MACRO: name   replacement text $1, $2 are arguments
8385 @end example
8387 @noindent which can be referenced anywhere in the document (even in
8388 code examples) with @code{@{@{@{name(arg1,arg2)@}@}@}}.  In addition to
8389 defined macros, @code{@{@{@{title@}@}@}}, @code{@{@{@{author@}@}@}}, etc.,
8390 will reference information set by the @code{#+TITLE:}, @code{#+AUTHOR:}, and
8391 similar lines.  Also, @code{@{@{@{date(@var{FORMAT})@}@}@}} and
8392 @code{@{@{@{modification-time(@var{FORMAT})@}@}@}} refer to current date time
8393 and to the modification time of the file being exported, respectively.
8394 @var{FORMAT} should be a format string understood by
8395 @code{format-time-string}.
8397 @node Selective export, Export options, Markup rules, Exporting
8398 @section Selective export
8399 @cindex export, selective by tags
8401 @vindex org-export-select-tags
8402 @vindex org-export-exclude-tags
8403 You may use tags to select the parts of a document that should be exported,
8404 or to exclude parts from export.  This behavior is governed by two variables:
8405 @code{org-export-select-tags} and @code{org-export-exclude-tags}.
8407 Org first checks if any of the @emph{select} tags is present in the buffer.
8408 If yes, all trees that do not carry one of these tags will be excluded.  If a
8409 selected tree is a subtree, the heading hierarchy above it will also be
8410 selected for export, but not the text below those headings.
8412 @noindent
8413 If none of the select tags is found, the whole buffer will be selected for
8414 export.
8416 @noindent
8417 Finally, all subtrees that are marked by any of the @emph{exclude} tags will
8418 be removed from the export buffer.
8420 @node Export options, The export dispatcher, Selective export, Exporting
8421 @section Export options
8422 @cindex options, for export
8424 @cindex completion, of option keywords
8425 The exporter recognizes special lines in the buffer which provide
8426 additional information.  These lines may be put anywhere in the file.
8427 The whole set of lines can be inserted into the buffer with @kbd{C-c
8428 C-e t}.  For individual lines, a good way to make sure the keyword is
8429 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
8430 (@pxref{Completion}).   For a summary of other in-buffer settings not
8431 specifically related to export, see @ref{In-buffer settings}.
8432 In particular, note that you can place commonly-used (export) options in
8433 a separate file which can be included using @code{#+SETUPFILE}.
8435 @table @kbd
8436 @kindex C-c C-e t
8437 @item C-c C-e t
8438 Insert template with export options, see example below.
8439 @end table
8441 @cindex #+TITLE
8442 @cindex #+AUTHOR
8443 @cindex #+DATE
8444 @cindex #+EMAIL
8445 @cindex #+DESCRIPTION
8446 @cindex #+KEYWORDS
8447 @cindex #+LANGUAGE
8448 @cindex #+TEXT
8449 @cindex #+OPTIONS
8450 @cindex #+BIND
8451 @cindex #+LINK_UP
8452 @cindex #+LINK_HOME
8453 @cindex #+EXPORT_SELECT_TAGS
8454 @cindex #+EXPORT_EXCLUDE_TAGS
8455 @cindex #+LATEX_HEADER
8456 @vindex user-full-name
8457 @vindex user-mail-address
8458 @vindex org-export-default-language
8459 @example
8460 #+TITLE:       the title to be shown (default is the buffer name)
8461 #+AUTHOR:      the author (default taken from @code{user-full-name})
8462 #+DATE:        a date, fixed, of a format string for @code{format-time-string}
8463 #+EMAIL:       his/her email address (default from @code{user-mail-address})
8464 #+DESCRIPTION: the page description, @eg for the XHTML meta tag
8465 #+KEYWORDS:    the page keywords, @eg for the XHTML meta tag
8466 #+LANGUAGE:    language for HTML, @eg @samp{en} (@code{org-export-default-language})
8467 #+TEXT:        Some descriptive text to be inserted at the beginning.
8468 #+TEXT:        Several lines may be given.
8469 #+OPTIONS:     H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
8470 #+BIND:        lisp-var lisp-val, e.g.: org-export-latex-low-levels itemize
8471 #+LINK_UP:     the ``up'' link of an exported page
8472 #+LINK_HOME:   the ``home'' link of an exported page
8473 #+LATEX_HEADER: extra line(s) for the LaTeX header, like \usepackage@{xyz@}
8474 #+EXPORT_SELECT_TAGS:   Tags that select a tree for export
8475 #+EXPORT_EXCLUDE_TAGS:  Tags that exclude a tree from export
8476 @end example
8478 @noindent
8479 The OPTIONS line is a compact@footnote{If you want to configure many options
8480 this way, you can use several OPTIONS lines.} form to specify export settings.  Here
8481 you can:
8482 @cindex headline levels
8483 @cindex section-numbers
8484 @cindex table of contents
8485 @cindex line-break preservation
8486 @cindex quoted HTML tags
8487 @cindex fixed-width sections
8488 @cindex tables
8489 @cindex @TeX{}-like syntax for sub- and superscripts
8490 @cindex footnotes
8491 @cindex special strings
8492 @cindex emphasized text
8493 @cindex @TeX{} macros
8494 @cindex La@TeX{} fragments
8495 @cindex author info, in export
8496 @cindex time info, in export
8497 @example
8498 H:         @r{set the number of headline levels for export}
8499 num:       @r{turn on/off section-numbers}
8500 toc:       @r{turn on/off table of contents, or set level limit (integer)}
8501 \n:        @r{turn on/off line-break-preservation}
8502 @@:         @r{turn on/off quoted HTML tags}
8503 ::         @r{turn on/off fixed-width sections}
8504 |:         @r{turn on/off tables}
8505 ^:         @r{turn on/off @TeX{}-like syntax for sub- and superscripts.  If}
8506            @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
8507            @r{the simple @code{a_b} will be left as it is.}
8508 -:         @r{turn on/off conversion of special strings.}
8509 f:         @r{turn on/off footnotes like this[1].}
8510 todo:      @r{turn on/off inclusion of TODO keywords into exported text}
8511 pri:       @r{turn on/off priority cookies}
8512 tags:      @r{turn on/off inclusion of tags, may also be @code{not-in-toc}}
8513 <:         @r{turn on/off inclusion of any time/date stamps like DEADLINES}
8514 *:         @r{turn on/off emphasized text (bold, italic, underlined)}
8515 TeX:       @r{turn on/off simple @TeX{} macros in plain text}
8516 LaTeX:     @r{turn on/off La@TeX{} fragments}
8517 skip:      @r{turn on/off skipping the text before the first heading}
8518 author:    @r{turn on/off inclusion of author name/email into exported file}
8519 creator:   @r{turn on/off inclusion of creator info into exported file}
8520 timestamp: @r{turn on/off inclusion creation time into exported file}
8521 d:         @r{turn on/off inclusion of drawers}
8522 @end example
8523 @noindent
8524 These options take effect in both the HTML and La@TeX{} export, except
8525 for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
8526 @code{nil} for the La@TeX{} export.
8528 When exporting only a single subtree by selecting it with @kbd{C-c @@} before
8529 calling an export command, the subtree can overrule some of the file's export
8530 settings with properties @code{EXPORT_FILE_NAME}, @code{EXPORT_TITLE},
8531 @code{EXPORT_TEXT}, @code{EXPORT_AUTHOR}, @code{EXPORT_DATE}, and
8532 @code{EXPORT_OPTIONS}.
8534 @node The export dispatcher, ASCII export, Export options, Exporting
8535 @section The export dispatcher
8536 @cindex dispatcher, for export commands
8538 All export commands can be reached using the export dispatcher, which is a
8539 prefix key that prompts for an additional key specifying the command.
8540 Normally the entire file is exported, but if there is an active region that
8541 contains one outline tree, the first heading is used as document title and
8542 the subtrees are exported.
8544 @table @kbd
8545 @kindex C-c C-e
8546 @item C-c C-e
8547 @vindex org-export-run-in-background
8548 Dispatcher for export and publishing commands.  Displays a help-window
8549 listing the additional key(s) needed to launch an export or publishing
8550 command.  The prefix arg is passed through to the exporter.  A double prefix
8551 @kbd{C-u C-u} causes most commands to be executed in the background, in a
8552 separate Emacs process@footnote{To make this behavior the default, customize
8553 the variable @code{org-export-run-in-background}.}.
8554 @kindex C-c C-e v
8555 @item C-c C-e v
8556 Like @kbd{C-c C-e}, but only export the text that is currently visible
8557 (@ie not hidden by outline visibility).
8558 @kindex C-u C-u C-c C-e
8559 @item C-u C-u C-c C-e
8560 @vindex org-export-run-in-background
8561 Call an the exporter, but reverse the setting of
8562 @code{org-export-run-in-background}, @ie request background processing if
8563 not set, or force processing in the current Emacs process if set.
8564 @end table
8566 @node ASCII export, HTML export, The export dispatcher, Exporting
8567 @section ASCII export
8568 @cindex ASCII export
8570 ASCII export produces a simple and very readable version of an Org-mode
8571 file.
8573 @cindex region, active
8574 @cindex active region
8575 @cindex transient-mark-mode
8576 @table @kbd
8577 @kindex C-c C-e a
8578 @item C-c C-e a
8579 @cindex property, EXPORT_FILE_NAME
8580 Export as ASCII file.  For an Org file, @file{myfile.org}, the ASCII file
8581 will be @file{myfile.txt}.  The file will be overwritten without
8582 warning.  If there is an active region@footnote{This requires
8583 @code{transient-mark-mode} be turned on.}, only the region will be
8584 exported. If the selected region is a single tree@footnote{To select the
8585 current subtree, use @kbd{C-c @@}.}, the tree head will
8586 become the document title.  If the tree head entry has or inherits an
8587 @code{EXPORT_FILE_NAME} property, that name will be used for the
8588 export.
8589 @kindex C-c C-e A
8590 @item C-c C-e A
8591 Export to a temporary buffer, do not create a file.
8592 @kindex C-c C-e v a
8593 @item C-c C-e v a
8594 Export only the visible part of the document.
8595 @end table
8597 @cindex headline levels, for exporting
8598 In the exported version, the first 3 outline levels will become
8599 headlines, defining a general document structure.  Additional levels
8600 will be exported as itemized lists.  If you want that transition to occur
8601 at a different level, specify it with a prefix argument.  For example,
8603 @example
8604 @kbd{C-1 C-c C-e a}
8605 @end example
8607 @noindent
8608 creates only top level headlines and does the rest as items.  When
8609 headlines are converted to items, the indentation of the text following
8610 the headline is changed to fit nicely under the item.  This is done with
8611 the assumption that the first body line indicates the base indentation of
8612 the body text.  Any indentation larger than this is adjusted to preserve
8613 the layout relative to the first line.  Should there be lines with less
8614 indentation than the first, these are left alone.
8616 @vindex org-export-ascii-links-to-notes
8617 Links will be exported in a footnote-like style, with the descriptive part in
8618 the text and the link in a note before the next heading.  See the variable
8619 @code{org-export-ascii-links-to-notes} for details and other options.
8621 @node HTML export, LaTeX and PDF export, ASCII export, Exporting
8622 @section HTML export
8623 @cindex HTML export
8625 Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
8626 HTML formatting, in ways similar to John Gruber's @emph{markdown}
8627 language, but with additional support for tables.
8629 @menu
8630 * HTML Export commands::        How to invoke HTML export
8631 * Quoting HTML tags::           Using direct HTML in Org mode
8632 * Links::                       Transformation of links for HTML
8633 * Tables in HTML export::       How to modify the formatting of tables
8634 * Images in HTML export::       How to insert figures into HTML output
8635 * Text areas in HTML export::   An alternative way to show an example
8636 * CSS support::                 Changing the appearance of the output
8637 * Javascript support::          Info and Folding in a web browser
8638 @end menu
8640 @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
8641 @subsection HTML export commands
8643 @cindex region, active
8644 @cindex active region
8645 @cindex transient-mark-mode
8646 @table @kbd
8647 @kindex C-c C-e h
8648 @item C-c C-e h
8649 @cindex property, EXPORT_FILE_NAME
8650 Export as HTML file @file{myfile.html}.  For an Org file @file{myfile.org},
8651 the ASCII file will be @file{myfile.html}.  The file will be overwritten
8652 without warning.  If there is an active region@footnote{This requires
8653 @code{transient-mark-mode} be turned on.}, only the region will be
8654 exported. If the selected region is a single tree@footnote{To select the
8655 current subtree, use @kbd{C-c @@}.}, the tree head will become the document
8656 title.  If the tree head entry has, or inherits, an @code{EXPORT_FILE_NAME}
8657 property, that name will be used for the export.
8658 @kindex C-c C-e b
8659 @item C-c C-e b
8660 Export as HTML file and immediately open it with a browser.
8661 @kindex C-c C-e H
8662 @item C-c C-e H
8663 Export to a temporary buffer, do not create a file.
8664 @kindex C-c C-e R
8665 @item C-c C-e R
8666 Export the active region to a temporary buffer.  With a prefix argument, do
8667 not produce the file header and footer, but just the plain HTML section for
8668 the region.  This is good for cut-and-paste operations.
8669 @kindex C-c C-e v h
8670 @kindex C-c C-e v b
8671 @kindex C-c C-e v H
8672 @kindex C-c C-e v R
8673 @item C-c C-e v h
8674 @item C-c C-e v b
8675 @item C-c C-e v H
8676 @item C-c C-e v R
8677 Export only the visible part of the document.
8678 @item M-x org-export-region-as-html
8679 Convert the region to HTML under the assumption that it was Org-mode
8680 syntax before.  This is a global command that can be invoked in any
8681 buffer.
8682 @item M-x org-replace-region-by-HTML
8683 Replace the active region (assumed to be in Org-mode syntax) by HTML
8684 code.
8685 @end table
8687 @cindex headline levels, for exporting
8688 In the exported version, the first 3 outline levels will become headlines,
8689 defining a general document structure.  Additional levels will be exported as
8690 itemized lists.  If you want that transition to occur at a different level,
8691 specify it with a numeric prefix argument.  For example,
8693 @example
8694 @kbd{C-2 C-c C-e b}
8695 @end example
8697 @noindent
8698 creates two levels of headings and does the rest as items.
8700 @node Quoting HTML tags, Links, HTML Export commands, HTML export
8701 @subsection Quoting HTML tags
8703 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
8704 @samp{&gt;} in HTML export.  If you want to include simple HTML tags
8705 which should be interpreted as such, mark them with @samp{@@} as in
8706 @samp{@@<b>bold text@@</b>}.  Note that this really works only for
8707 simple tags.  For more extensive HTML that should be copied verbatim to
8708 the exported file use either
8710 @cindex #+HTML
8711 @cindex #+BEGIN_HTML
8712 @example
8713 #+HTML: Literal HTML code for export
8714 @end example
8716 @noindent or
8717 @cindex #+BEGIN_HTML
8719 @example
8720 #+BEGIN_HTML
8721 All lines between these markers are exported literally
8722 #+END_HTML
8723 @end example
8726 @node Links, Tables in HTML export, Quoting HTML tags, HTML export
8727 @subsection Links
8729 @cindex links, in HTML export
8730 @cindex internal links, in HTML export
8731 @cindex external links, in HTML export
8732 Internal links (@pxref{Internal links}) will continue to work in HTML.  This
8733 includes automatic links created by radio targets (@pxref{Radio
8734 targets}).  Links to external files will still work if the target file is on
8735 the same @i{relative} path as the published Org file.  Links to other
8736 @file{.org} files will be translated into HTML links under the assumption
8737 that an HTML version also exists of the linked file, at the same relative
8738 path.  @samp{id:} links can then be used to jump to specific entries across
8739 files.  For information related to linking files while publishing them to a
8740 publishing directory see @ref{Publishing links}.
8742 If you want to specify attributes for links, you can do so using a special
8743 @code{#+ATTR_HTML} line to define attributes that will be added to the
8744 @code{<a>} or @code{<img>} tags.  Here is an example that sets @code{title}
8745 and @code{style} attributes for a link:
8747 @cindex #+ATTR_HTML
8748 @example
8749 #+ATTR_HTML: title="The Org-mode homepage" style="color:red;"
8750 [[http://orgmode.org]]
8751 @end example
8753 @node Tables in HTML export, Images in HTML export, Links, HTML export
8754 @subsection Tables
8755 @cindex tables, in HTML
8756 @vindex org-export-html-table-tag
8758 Org-mode tables are exported to HTML using the table tag defined in
8759 @code{org-export-html-table-tag}.  The default setting makes tables without
8760 cell borders and frame.  If you would like to change this for individual
8761 tables, place somthing like the following before the table:
8763 @cindex #+CAPTION
8764 @example
8765 #+CAPTION: This is a table with lines around and between cells
8766 #+ATTR_HTML: border="2" rules="all" frame="all"
8767 @end example
8769 @node Images in HTML export, Text areas in HTML export, Tables in HTML export, HTML export
8770 @subsection Images
8772 @cindex images, inline in HTML
8773 @cindex inlining images in HTML
8774 @vindex org-export-html-inline-images
8775 HTML export can inline images given as links in the Org file, and
8776 it can make an image the clickable part of a link.  By
8777 default@footnote{But see the variable
8778 @code{org-export-html-inline-images}.}, images are inlined if a link does
8779 not have a description.  So @samp{[[file:myimg.jpg]]} will be inlined,
8780 while @samp{[[file:myimg.jpg][the image]]} will just produce a link
8781 @samp{the image} that points to the image.  If the description part
8782 itself is a @code{file:} link or a @code{http:} URL pointing to an
8783 image, this image will be inlined and activated so that clicking on the
8784 image will activate the link.  For example, to include a thumbnail that
8785 will link to a high resolution version of the image, you could use:
8787 @example
8788 [[file:highres.jpg][file:thumb.jpg]]
8789 @end example
8791 If you need to add attributes to an inlines image, use a @code{#+ATTR_HTML},
8792 for example:
8794 @cindex #+CAPTION
8795 @example
8796 #+CAPTION: A black cat stalking a spider
8797 #+ATTR_HTML: alt="cat/spider image" title="one second before action"
8798 [[./img/a.jpg]]
8799 @end example
8801 @noindent
8802 and you could use @code{http} addresses just as well.
8804 @node Text areas in HTML export, CSS support, Images in HTML export, HTML export
8805 @subsection Text areas
8807 @cindex text areas, in HTML
8808 An alternative way to publish literal code examples in HTML is to use text
8809 areas, where the example can even be edited before pasting it into an
8810 application.  It is triggered by a @code{-t} switch at an @code{example} or
8811 @code{src} block.  Using this switch disables any options for syntax and
8812 label highlighting, and line numbering, which may be present.  You may also
8813 use @code{-h} and @code{-w} switches to specify the height and width of the
8814 text area, which default to the number of lines in the example, and 80,
8815 respectively.  For example
8817 @example
8818 #+BEGIN_EXAMPLE -t -w 40
8819 (defun org-xor (a b)
8820    "Exclusive or."
8821    (if a (not b) b))
8822 #+END_EXAMPLE
8823 @end example
8826 @node CSS support, Javascript support, Text areas in HTML export, HTML export
8827 @subsection CSS support
8828 @cindex CSS, for HTML export
8829 @cindex HTML export, CSS
8831 @vindex org-export-html-todo-kwd-class-prefix
8832 @vindex org-export-html-tag-class-prefix
8833 You can also give style information for the exported file.  The HTML exporter
8834 assigns the following special CSS classes@footnote{If the classes on TODO
8835 keywords and tags lead to conflicts, use the variables
8836 @code{org-export-html-todo-kwd-class-prefix} and
8837 @code{org-export-html-tag-class-prefix} to make them unique.} to appropriate
8838 parts of the document---your style specifications may change these, in
8839 addition to any of the standard classes like for headlines, tables, etc.
8840 @example
8841 p.author            @r{author information, including email}
8842 p.date              @r{publishing date}
8843 p.creator           @r{creator info, about org-mode version}
8844 .title              @r{document title}
8845 .todo               @r{TODO keywords, all not-done states}
8846 .done               @r{the DONE keywords, all stated the count as done}
8847 .WAITING            @r{each TODO keyword also uses a class named after itself}
8848 .timestamp          @r{timestamp}
8849 .timestamp-kwd      @r{keyword associated with a timestamp, like SCHEDULED}
8850 .timestamp-wrapper  @r{span around keyword plus timestamp}
8851 .tag                @r{tag in a headline}
8852 ._HOME              @r{each tag uses itself as a class, "@@" replaced by "_"}
8853 .target             @r{target for links}
8854 .linenr             @r{the line number in a code example}
8855 .code-highlighted   @r{for highlighting referenced code lines}
8856 div.outline-N       @r{div for outline level N (headline plus text))}
8857 div.outline-text-N  @r{extra div for text at outline level N}
8858 .section-number-N   @r{section number in headlines, different for each level}
8859 div.figure          @r{how to format an inlined image}
8860 pre.src             @r{formatted source code}
8861 pre.example         @r{normal example}
8862 p.verse             @r{verse paragraph}
8863 div.footnotes       @r{footnote section headline}
8864 p.footnote          @r{footnote definition paragraph, containing a footnote}
8865 .footref            @r{a footnote reference number (always a <sup>)}
8866 .footnum            @r{footnote number in footnote definition (always <sup>)}
8867 @end example
8869 @vindex org-export-html-style-default
8870 @vindex org-export-html-style-include-default
8871 @vindex org-export-html-style
8872 @vindex org-export-html-extra
8873 @vindex org-export-html-style-default
8874 Each exported file contains a compact default style that defines these
8875 classes in a basic way@footnote{This style is defined in the constant
8876 @code{org-export-html-style-default}, which you should not modify.  To turn
8877 inclusion of these defaults off, customize
8878 @code{org-export-html-style-include-default}}.  You may overwrite these
8879 settings, or add to them by using the variables @code{org-export-html-style}
8880 (for Org-wide settings) and @code{org-export-html-style-extra} (for more
8881 granular settings, like file-local settings).  To set the latter variable
8882 individually for each file, you can use
8884 @cindex #+STYLE
8885 @example
8886 #+STYLE: <link rel="stylesheet" type="text/css" href="stylesheet.css" />
8887 @end example
8889 @noindent
8890 For longer style definitions, you can use several such lines.  You could also
8891 directly write a @code{<style>} @code{</style>} section in this way, without
8892 referring to an external file.
8894 @c FIXME: More about header and footer styles
8895 @c FIXME: Talk about links and targets.
8897 @node Javascript support,  , CSS support, HTML export
8898 @subsection Javascript supported display of web pages
8900 @cindex Rose, Sebastian
8901 Sebastian Rose has written a JavaScript program especially designed to
8902 enhance the web viewing experience of HTML files created with Org.  This
8903 program allows you to view large files in two different ways.  The first one
8904 is an @emph{Info}-like mode where each section is displayed separately and
8905 navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
8906 as well, press @kbd{?} for an overview of the available keys).  The second
8907 view type is a @emph{folding} view much like Org provides inside Emacs.  The
8908 script is available at @url{http://orgmode.org/org-info.js} and you can find
8909 the documentation for it at @url{http://orgmode.org/worg/code/org-info-js/}.
8910 We host the script at our site, but if you use it a lot, you might
8911 not want to be dependent on @url{orgmode.org} and prefer to install a local
8912 copy on your own web server.
8914 To use the script, you need to make sure that the @file{org-jsinfo.el} module
8915 gets loaded.  It should be loaded by default, but you can try @kbd{M-x
8916 customize-variable @key{RET} org-modules @key{RET}} to convince yourself that
8917 this is indeed the case.  All it then takes to make use of the program is
8918 adding a single line to the Org file:
8920 @cindex #+INFOJS_OPT
8921 @example
8922 #+INFOJS_OPT: view:info toc:nil
8923 @end example
8925 @noindent
8926 If this line is found, the HTML header will automatically contain the code
8927 needed to invoke the script.  Using the line above, you can set the following
8928 viewing options:
8930 @example
8931 path:    @r{The path to the script.  The default is to grab the script from}
8932          @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
8933          @r{a local copy and use a path like @samp{../scripts/org-info.js}.}
8934 view:    @r{Initial view when website is first shown.  Possible values are:}
8935          info      @r{Info-like interface with one section per page.}
8936          overview  @r{Folding interface, initially showing only top-level.}
8937          content   @r{Folding interface, starting with all headlines visible.}
8938          showall   @r{Folding interface, all headlines and text visible.}
8939 sdepth:  @r{Maximum headline level that will still become an independent}
8940          @r{section for info and folding modes.  The default is taken from}
8941          @r{@code{org-headline-levels} (= the @code{H} switch in @code{#+OPTIONS}).}
8942          @r{If this is smaller than in @code{org-headline-levels}, each}
8943          @r{info/folding section can still contain child headlines.}
8944 toc:     @r{Should the table of content @emph{initially} be visible?}
8945          @r{Even when @code{nil}, you can always get to the "toc" with @kbd{i}.}
8946 tdepth:  @r{The depth of the table of contents.  The defaults are taken from}
8947          @r{the variables @code{org-headline-levels} and @code{org-export-with-toc}.}
8948 ftoc:    @r{Does the css of the page specify a fixed position for the "toc"?}
8949          @r{If yes, the toc will never be displayed as a section.}
8950 ltoc:    @r{Should there be short contents (children) in each section?}
8951          @r{Make this @code{above} if the section should be above initial text.}
8952 mouse:   @r{Headings are highlighted when the mouse is over them.  Should be}
8953          @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
8954 buttons: @r{Should view-toggle buttons be everywhere?  When @code{nil} (the}
8955          @r{default), only one such button will be present.}
8956 @end example
8957 @noindent
8958 @vindex org-infojs-options
8959 @vindex org-export-html-use-infojs
8960 You can choose default values for these options by customizing the variable
8961 @code{org-infojs-options}.  If you always want to apply the script to your
8962 pages, configure the variable @code{org-export-html-use-infojs}.
8964 @node LaTeX and PDF export, DocBook export, HTML export, Exporting
8965 @section La@TeX{} and PDF export
8966 @cindex La@TeX{} export
8967 @cindex PDF export
8968 @cindex Guerry, Bastian
8970 Org mode contains a La@TeX{} exporter written by Bastien Guerry.  With
8971 further processing, this backend is also used to produce PDF output.  Since
8972 the La@TeX{} output uses @file{hyperref} to implement links and cross
8973 references, the PDF output file will be fully linked.
8975 @menu
8976 * LaTeX/PDF export commands::   Which key invokes which commands
8977 * Quoting LaTeX code::          Incorporating literal La@TeX{} code
8978 * Sectioning structure::        Changing sectioning in La@TeX{} output
8979 * Tables in LaTeX export::      Options for exporting tables to La@TeX{}
8980 * Images in LaTeX export::      How to insert figures into La@TeX{} output
8981 @end menu
8983 @node LaTeX/PDF export commands, Quoting LaTeX code, LaTeX and PDF export, LaTeX and PDF export
8984 @subsection La@TeX{} export commands
8986 @cindex region, active
8987 @cindex active region
8988 @cindex transient-mark-mode
8989 @table @kbd
8990 @kindex C-c C-e l
8991 @item C-c C-e l
8992 @cindex property EXPORT_FILE_NAME
8993 Export as La@TeX{} file @file{myfile.tex}.  For an Org file
8994 @file{myfile.org}, the ASCII file will be @file{myfile.tex}.  The file will
8995 be overwritten without warning.  If there is an active region@footnote{This
8996 requires @code{transient-mark-mode} be turned on.}, only the region will be
8997 exported. If the selected region is a single tree@footnote{To select the
8998 current subtree, use @kbd{C-c @@}.}, the tree head will become the document
8999 title.  If the tree head entry has or inherits an @code{EXPORT_FILE_NAME}
9000 property, that name will be used for the export.
9001 @kindex C-c C-e L
9002 @item C-c C-e L
9003 Export to a temporary buffer, do not create a file.
9004 @kindex C-c C-e v l
9005 @kindex C-c C-e v L
9006 @item C-c C-e v l
9007 @item C-c C-e v L
9008 Export only the visible part of the document.
9009 @item M-x org-export-region-as-latex
9010 Convert the region to La@TeX{} under the assumption that it was Org mode
9011 syntax before.  This is a global command that can be invoked in any
9012 buffer.
9013 @item M-x org-replace-region-by-latex
9014 Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
9015 code.
9016 @kindex C-c C-e p
9017 @item C-c C-e p
9018 Export as La@TeX{} and then process to PDF.
9019 @kindex C-c C-e d
9020 @item C-c C-e d
9021 Export as La@TeX{} and then process to PDF, then open the resulting PDF file.
9022 @end table
9024 @cindex headline levels, for exporting
9025 @vindex org-latex-low-levels
9026 In the exported version, the first 3 outline levels will become
9027 headlines, defining a general document structure.  Additional levels
9028 will be exported as description lists.  The exporter can ignore them or
9029 convert them to a custom string depending on
9030 @code{org-latex-low-levels}.
9032 If you want that transition to occur at a different level, specify it
9033 with a numeric prefix argument. For example,
9035 @example
9036 @kbd{C-2 C-c C-e l}
9037 @end example
9039 @noindent
9040 creates two levels of headings and does the rest as items.
9042 @node Quoting LaTeX code, Sectioning structure, LaTeX/PDF export commands, LaTeX and PDF export
9043 @subsection Quoting La@TeX{} code
9045 Embedded La@TeX{} as described in @ref{Embedded LaTeX}, will be correctly
9046 inserted into the La@TeX{} file.  This includes simple macros like
9047 @samp{\ref@{LABEL@}} to create a cross reference to a figure.  Furthermore,
9048 you can add special code that should only be present in La@TeX{} export with
9049 the following constructs:
9051 @cindex #+LaTeX
9052 @cindex #+BEGIN_LaTeX
9053 @example
9054 #+LaTeX: Literal LaTeX code for export
9055 @end example
9057 @noindent or
9058 @cindex #+BEGIN_LaTeX
9060 @example
9061 #+BEGIN_LaTeX
9062 All lines between these markers are exported literally
9063 #+END_LaTeX
9064 @end example
9066 @node  Sectioning structure, Tables in LaTeX export, Quoting LaTeX code, LaTeX and PDF export
9067 @subsection Sectioning structure
9068 @cindex La@TeX{} class
9069 @cindex La@TeX{} sectioning structure
9071 By default, the La@TeX{} output uses the class @code{article}.
9073 @vindex org-export-latex-default-class
9074 @vindex org-export-latex-classes
9075 @cindex #+LATEX_HEADER
9076 @cindex #+LATEX_CLASS
9077 @cindex property, LATEX_CLASS
9078 You can change this globally by setting a different value for
9079 @code{org-export-latex-default-class} or locally by adding an option like
9080 @code{#+LaTeX_CLASS: myclass} in your file, or with a @code{:LaTeX_CLASS:}
9081 property that applies when exporting a region containing only this (sub)tree.
9082 The class should be listed in @code{org-export-latex-classes}, where you can
9083 also define the sectioning structure for each class, as well as defining
9084 additional classes.  You can also use @code{#+LATEX_HEADER:
9085 \usepackage@{xyz@}} to add lines to the header.
9087 @node Tables in LaTeX export, Images in LaTeX export, Sectioning structure, LaTeX and PDF export
9088 @subsection Tables in La@TeX{} export
9089 @cindex tables, in La@TeX{} export
9091 For La@TeX{} export of a table, you can specify a label and a caption
9092 (@pxref{Markup rules}).  You can also use the @code{ATTR_LaTeX} line to
9093 request a longtable environment for the table, so that it may span several
9094 pages.  Finally, you can set the alignment string:
9096 @cindex #+CAPTION
9097 @cindex #+LABEL
9098 @cindex #+ATTR_LaTeX
9099 @example
9100 #+CAPTION: A long table
9101 #+LABEL: tbl:long
9102 #+ATTR_LaTeX: longtable align=l|lp@{3cm@}r|l
9103 | ..... | ..... |
9104 | ..... | ..... |
9105 @end example
9108 @node Images in LaTeX export,  , Tables in LaTeX export, LaTeX and PDF export
9109 @subsection Images in La@TeX{} export
9110 @cindex images, inline in La@TeX{}
9111 @cindex inlining images in La@TeX{}
9113 Images that are linked to without a description part in the link, like
9114 @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]} will be inserted into the PDF
9115 output files resulting from La@TeX{} output.  Org will use an
9116 @code{\includegraphics} macro to insert the image.  If you have specified a
9117 caption and/or a label as described in @ref{Markup rules}, the figure will
9118 be wrapped into a @code{figure} environment and thus become a floating
9119 element.  Finally, you can use an @code{#+ATTR_LaTeX:} line to specify the
9120 options that can be used in the optional argument of the
9121 @code{\includegraphics} macro.
9123 @cindex #+CAPTION
9124 @cindex #+LABEL
9125 @cindex #+ATTR_LaTeX
9126 @example
9127 #+CAPTION:    The black-body emission of the disk around HR 4049
9128 #+LABEL:      fig:SED-HR4049
9129 #+ATTR_LaTeX: width=5cm,angle=90
9130 [[./img/sed-hr4049.pdf]]
9131 @end example
9133 @vindex org-export-latex-inline-image-extensions
9134 If you need references to a label created in this way, write
9135 @samp{\ref@{fig:SED-HR4049@}} just like in La@TeX{}.  The default settings will
9136 recognize files types that can be included as images during processing by
9137 @command{pdflatex} (@file{png}, @file{jpg}, and @file{pdf} files).  If you process your
9138 files in a different way, you may need to customize the variable
9139 @code{org-export-latex-inline-image-extensions}.
9141 @node DocBook export, XOXO export, LaTeX and PDF export, Exporting
9142 @section DocBook export
9143 @cindex DocBook export
9144 @cindex PDF export
9145 @cindex Cui, Baoqui
9147 Org contains a DocBook exporter written by Baoqiu Cui.  Once an Org file is
9148 exported to DocBook format, it can be further processed to produce other
9149 formats, including PDF, HTML, man pages, etc., using many available DocBook
9150 tools and stylesheets.
9152 Currently DocBook exporter only supports DocBook V5.0.
9154 @menu
9155 * DocBook export commands::     How to invoke DocBook export
9156 * Quoting DocBook code::        Incorporating DocBook code in Org files
9157 * Recursive sections::          Recursive sections in DocBook
9158 * Tables in DocBook export::    Tables are exported as HTML tables
9159 * Images in DocBook export::    How to insert figures into DocBook output
9160 * Special characters::          How to handle special characters
9161 @end menu
9163 @node DocBook export commands, Quoting DocBook code, DocBook export, DocBook export
9164 @subsection DocBook export commands
9166 @cindex region, active
9167 @cindex active region
9168 @cindex transient-mark-mode
9169 @table @kbd
9170 @kindex C-c C-e D
9171 @item C-c C-e D
9172 @cindex property EXPORT_FILE_NAME
9173 Export as DocBook file.  For an Org file, @file{myfile.org}, the DocBook XML
9174 file will be @file{myfile.xml}.  The file will be overwritten without
9175 warning.  If there is an active region@footnote{This requires
9176 @code{transient-mark-mode} to be turned on}, only the region will be
9177 exported.  If the selected region is a single tree@footnote{To select the
9178 current subtree, use @kbd{C-c @@}.}, the tree head will become the document
9179 title.  If the tree head entry has, or inherits, an @code{EXPORT_FILE_NAME}
9180 property, that name will be used for the export.
9181 @kindex C-c C-e V
9182 @item C-c C-e V
9183 Export as DocBook file, process to PDF, then open the resulting PDF file.
9185 @vindex org-export-docbook-xslt-proc-command
9186 @vindex org-export-docbook-xsl-fo-proc-command
9187 Note that, in order to produce PDF output based on exported DocBook file, you
9188 need to have XSLT processor and XSL-FO processor software installed on your
9189 system.  Check variables @code{org-export-docbook-xslt-proc-command} and
9190 @code{org-export-docbook-xsl-fo-proc-command}.
9192 @kindex C-c C-e v D
9193 @item C-c C-e v D
9194 Export only the visible part of the document.
9195 @end table
9197 @node Quoting DocBook code, Recursive sections, DocBook export commands, DocBook export
9198 @subsection Quoting DocBook code
9200 You can quote DocBook code in Org files and copy it verbatim into exported
9201 DocBook file with the following constructs:
9203 @cindex #+DOCBOOK
9204 @cindex #+BEGIN_DOCBOOK
9205 @example
9206 #+DOCBOOK: Literal DocBook code for export
9207 @end example
9209 @noindent or
9210 @cindex #+BEGIN_DOCBOOK
9212 @example
9213 #+BEGIN_DOCBOOK
9214 All lines between these markers are exported by DocBook exporter
9215 literally.
9216 #+END_DOCBOOK
9217 @end example
9219 For example, you can use the following lines to include a DocBook warning
9220 admonition.  As to what this warning says, you should pay attention to the
9221 document context when quoting DocBook code in Org files.  You may make
9222 exported DocBook XML files invalid by not quoting DocBook code correctly.
9224 @example
9225 #+BEGIN_DOCBOOK
9226 <warning>
9227   <para>You should know what you are doing when quoting DocBook XML code
9228   in your Org file.  Invalid DocBook XML file may be generated by
9229   DocBook exporter if you are not careful!</para>
9230 </warning>
9231 #+END_DOCBOOK
9232 @end example
9234 @node Recursive sections, Tables in DocBook export, Quoting DocBook code, DocBook export
9235 @subsection Recursive sections
9236 @cindex DocBook recursive sections
9238 DocBook exporter exports Org files as articles using the @code{article}
9239 element in DocBook.  Recursive sections, @ie @code{section} elements, are
9240 used in exported articles.  Top level headlines in Org files are exported as
9241 top level sections, and lower level headlines are exported as nested
9242 sections.  The entire structure of Org files will be exported completely, no
9243 matter how many nested levels of headlines there are.
9245 Using recursive sections makes it easy to port and reuse exported DocBook
9246 code in other DocBook document types like @code{book} or @code{set}.
9248 @node Tables in DocBook export, Images in DocBook export, Recursive sections, DocBook export
9249 @subsection Tables in DocBook export
9250 @cindex tables, in DocBook export
9252 Tables in Org files are exported as HTML tables, which have been supported since
9253 DocBook V4.3.
9255 If a table does not have a caption, an informal table is generated using the
9256 @code{informaltable} element; otherwise, a formal table will be generated
9257 using the @code{table} element.
9259 @node Images in DocBook export, Special characters, Tables in DocBook export, DocBook export
9260 @subsection Images in DocBook export
9261 @cindex images, inline in DocBook
9262 @cindex inlining images in DocBook
9264 Images that are linked to without a description part in the link, like
9265 @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]}, will be exported to DocBook
9266 using @code{mediaobject} elements.  Each @code{mediaobject} element contains
9267 an @code{imageobject} that wraps an @code{imagedata} element.  If you have
9268 specified a caption for an image as described in @ref{Markup rules}, a
9269 @code{caption} element will be added in @code{mediaobject}.  If a label is
9270 also specified, it will be exported as an @code{xml:id} attribute of the
9271 @code{mediaobject} element.
9273 @vindex org-export-docbook-default-image-attributes
9274 Image attributes supported by the @code{imagedata} element, like @code{align}
9275 or @code{width}, can be specified in two ways: you can either customize
9276 variable @code{org-export-docbook-default-image-attributes} or use the
9277 @code{#+ATTR_DOCBOOK:} line.  Attributes sepcified in variable
9278 @code{org-export-docbook-default-image-attributes} are applied to all inline
9279 images in the Org file to be exported (unless they are overwritten by image
9280 attributes specified in @code{#+ATTR_DOCBOOK:} lines).
9282 The @code{#+ATTR_DOCBOOK:} line can be used to specify additional image
9283 attributes or overwrite default image attributes for individual images.  If
9284 the same attribute appears in both the @code{#+ATTR_DOCBOOK:} line and
9285 variable @code{org-export-docbook-default-image-attributes}, the former
9286 overwrites the latter.  Here is an example about how image attributes can be
9287 set:
9289 @cindex #+CAPTION
9290 @cindex #+LABEL
9291 @cindex #+ATTR_DOCBOOK
9292 @example
9293 #+CAPTION:    The logo of Org mode
9294 #+LABEL:      unicorn-svg
9295 #+ATTR_DOCBOOK: scalefit="1" width="100%" depth="100%"
9296 [[./img/org-mode-unicorn.svg]]
9297 @end example
9299 @vindex org-export-docbook-inline-image-extensions
9300 By default, DocBook exporter recognizes the following image file types:
9301 @file{jpeg}, @file{jpg}, @file{png}, @file{gif}, and @file{svg}.  You can
9302 customize variable @code{org-export-docbook-inline-image-extensions} to add
9303 more types to this list as long as DocBook supports them.
9305 @node Special characters,  , Images in DocBook export, DocBook export
9306 @subsection Special characters in DocBook export
9307 @cindex Special characters in DocBook export
9309 @vindex org-export-docbook-doctype
9310 @vindex org-html-entities
9311 Special characters that are written in @TeX{}-like syntax, such as @code{\alpha},
9312 @code{\Gamma}, and @code{\Zeta}, are supported by DocBook exporter.  These
9313 characters are rewritten to XML entities, like @code{&alpha;},
9314 @code{&Gamma;}, and @code{&Zeta;}, based on the list saved in variable
9315 @code{org-html-entities}.  As long as the generated DocBook file includes the
9316 corresponding entities, these special characters are recognized.
9318 You can customize variable @code{org-export-docbook-doctype} to include the
9319 entities you need.  For example, you can set variable
9320 @code{org-export-docbook-doctype} to the following value to recognize all
9321 special characters included in XHTML entities:
9323 @example
9324 "<!DOCTYPE article [
9325 <!ENTITY % xhtml1-symbol PUBLIC
9326 \"-//W3C//ENTITIES Symbol for HTML//EN//XML\"
9327 \"http://www.w3.org/2003/entities/2007/xhtml1-symbol.ent\"
9329 %xhtml1-symbol;
9332 @end example
9334 @node XOXO export, iCalendar export, DocBook export, Exporting
9335 @section XOXO export
9336 @cindex XOXO export
9338 Org mode contains an exporter that produces XOXO-style output.
9339 Currently, this exporter only handles the general outline structure and
9340 does not interpret any additional Org-mode features.
9342 @table @kbd
9343 @kindex C-c C-e x
9344 @item C-c C-e x
9345 Export as XOXO file @file{myfile.html}.
9346 @kindex C-c C-e v
9347 @item C-c C-e v x
9348 Export only the visible part of the document.
9349 @end table
9351 @node iCalendar export,  , XOXO export, Exporting
9352 @section iCalendar export
9353 @cindex iCalendar export
9355 @vindex org-icalendar-include-todo
9356 @vindex org-icalendar-use-deadline
9357 @vindex org-icalendar-use-scheduled
9358 @vindex org-icalendar-categories
9359 Some people use Org mode for keeping track of projects, but still prefer a
9360 standard calendar application for anniversaries and appointments.  In this
9361 case it can be useful to show deadlines and other time-stamped items in Org
9362 files in the calendar application.  Org mode can export calendar information
9363 in the standard iCalendar format.  If you also want to have TODO entries
9364 included in the export, configure the variable
9365 @code{org-icalendar-include-todo}.  Plain timestamps are exported as VEVENT,
9366 and TODO items as VTODO.  It will also create events from deadlines that are
9367 in non-TODO items.  Deadlines and scheduling dates in TODO items will be used
9368 to set the start and due dates for the TODO entry@footnote{See the variables
9369 @code{org-icalendar-use-deadline} and @code{org-icalendar-use-scheduled}.}.
9370 As categories, it will use the tags locally defined in the heading, and the
9371 file/tree category@footnote{To add inherited tags or the TODO state,
9372 configure the variable @code{org-icalendar-categories}.}.
9374 @vindex org-icalendar-store-UID
9375 @cindex property, ID
9376 The iCalendar standard requires each entry to have a globally unique
9377 identifier (UID).  Org creates these identifiers during export.  If you set
9378 the variable @code{org-icalendar-store-UID}, the UID will be stored in the
9379 @code{:ID:} property of the entry and re-used next time you report this
9380 entry.  Since a single entry can give rise to multiple iCalendar entries (as
9381 a timestamp, a deadline, a scheduled item, and as a TODO item), Org adds
9382 prefixes to the UID, depending on what triggered the inclusion of the entry.
9383 In this way the UID remains unique, but a synchronization program can still
9384 figure out from which entry all the different instances originate.
9386 @table @kbd
9387 @kindex C-c C-e i
9388 @item C-c C-e i
9389 Create iCalendar entries for the current file and store them in the same
9390 directory, using a file extension @file{.ics}.
9391 @kindex C-c C-e I
9392 @item C-c C-e I
9393 @vindex org-agenda-files
9394 Like @kbd{C-c C-e i}, but do this for all files in
9395 @code{org-agenda-files}.  For each of these files, a separate iCalendar
9396 file will be written.
9397 @kindex C-c C-e c
9398 @item C-c C-e c
9399 @vindex org-combined-agenda-icalendar-file
9400 Create a single large iCalendar file from all files in
9401 @code{org-agenda-files} and write it to the file given by
9402 @code{org-combined-agenda-icalendar-file}.
9403 @end table
9405 @vindex org-use-property-inheritance
9406 @vindex org-icalendar-include-body
9407 @cindex property, SUMMARY
9408 @cindex property, DESCRIPTION
9409 @cindex property, LOCATION
9410 The export will honor SUMMARY, DESCRIPTION and LOCATION@footnote{The LOCATION
9411 property can be inherited from higher in the hierarchy if you configure
9412 @code{org-use-property-inheritance} accordingly.} properties if the selected
9413 entries have them.  If not, the summary will be derived from the headline,
9414 and the description from the body (limited to
9415 @code{org-icalendar-include-body} characters).
9417 How this calendar is best read and updated, depends on the application
9418 you are using.  The FAQ covers this issue.
9420 @node Publishing, Miscellaneous, Exporting, Top
9421 @chapter Publishing
9422 @cindex publishing
9423 @cindex O'Toole, David
9425 Org includes a publishing management system that allows you to configure
9426 automatic HTML conversion of @emph{projects} composed of interlinked org
9427 files.  You can also configure Org to automatically upload your exported HTML
9428 pages and related attachments, such as images and source code files, to a web
9429 server.
9431 You can also use Org to convert files into PDF, or even combine HTML and PDF
9432 conversion so that files are available in both formats on the server.
9434 Publishing has been contributed to Org by David O'Toole.
9436 @menu
9437 * Configuration::               Defining projects
9438 * Uploading files::             How to get files up on the server
9439 * Sample configuration::        Example projects
9440 * Triggering publication::      Publication commands
9441 @end menu
9443 @node Configuration, Uploading files, Publishing, Publishing
9444 @section Configuration
9446 Publishing needs significant configuration to specify files, destination
9447 and many other properties of a project.
9449 @menu
9450 * Project alist::               The central configuration variable
9451 * Sources and destinations::    From here to there
9452 * Selecting files::             What files are part of the project?
9453 * Publishing action::           Setting the function doing the publishing
9454 * Publishing options::          Tweaking HTML export
9455 * Publishing links::            Which links keep working after publishing?
9456 * Project page index::          Publishing a list of project files
9457 @end menu
9459 @node Project alist, Sources and destinations, Configuration, Configuration
9460 @subsection The variable @code{org-publish-project-alist}
9461 @cindex org-publish-project-alist
9462 @cindex projects, for publishing
9464 @vindex org-publish-project-alist
9465 Publishing is configured almost entirely through setting the value of one
9466 variable, called @code{org-publish-project-alist}.  Each element of the list
9467 configures one project, and may be in one of the two following forms:
9469 @lisp
9470    ("project-name" :property value :property value ...)
9471 @r{or}
9472    ("project-name" :components ("project-name" "project-name" ...))
9474 @end lisp
9476 In both cases, projects are configured by specifying property values.  A
9477 project defines the set of files that will be published, as well as the
9478 publishing configuration to use when publishing those files.  When a project
9479 takes the second form listed above, the individual members of the
9480 @code{:components} property are taken to be sub-projects, which group
9481 together files requiring different publishing options.  When you publish such
9482 a ``meta-project'', all the components will also be published, in the
9483 sequence given.
9485 @node Sources and destinations, Selecting files, Project alist, Configuration
9486 @subsection Sources and destinations for files
9487 @cindex directories, for publishing
9489 Most properties are optional, but some should always be set.  In
9490 particular, Org needs to know where to look for source files,
9491 and where to put published files.
9493 @multitable @columnfractions 0.3 0.7
9494 @item @code{:base-directory}
9495 @tab Directory containing publishing source files
9496 @item @code{:publishing-directory}
9497 @tab Directory where output files will be published.  You can directly
9498 publish to a webserver using a file name syntax appropriate for
9499 the Emacs @file{tramp} package.  Or you can publish to a local directory and
9500 use external tools to upload your website (@pxref{Uploading files}).
9501 @item @code{:preparation-function}
9502 @tab Function called before starting the publishing process, for example, to
9503 run @code{make} for updating files to be published.
9504 @item @code{:completion-function}
9505 @tab Function called after finishing the publishing process, for example, to
9506 change permissions of the resulting files.
9507 @end multitable
9508 @noindent
9510 @node Selecting files, Publishing action, Sources and destinations, Configuration
9511 @subsection Selecting files
9512 @cindex files, selecting for publishing
9514 By default, all files with extension @file{.org} in the base directory
9515 are considered part of the project.  This can be modified by setting the
9516 properties
9517 @multitable @columnfractions 0.25 0.75
9518 @item @code{:base-extension}
9519 @tab Extension (without the dot!) of source files.  This actually is a
9520 regular expression.  Set this to the symbol @code{any} if you want to get all
9521 files in @code{:base-directory}, even without extension.
9523 @item @code{:exclude}
9524 @tab Regular expression to match file names that should not be
9525 published, even though they have been selected on the basis of their
9526 extension.
9528 @item @code{:include}
9529 @tab List of files to be included regardless of @code{:base-extension}
9530 and @code{:exclude}.
9531 @end multitable
9533 @node Publishing action, Publishing options, Selecting files, Configuration
9534 @subsection Publishing action
9535 @cindex action, for publishing
9537 Publishing means that a file is copied to the destination directory and
9538 possibly transformed in the process.  The default transformation is to export
9539 Org files as HTML files, and this is done by the function
9540 @code{org-publish-org-to-html} which calls the HTML exporter (@pxref{HTML
9541 export}).  But you also can publish your content as PDF files using
9542 @code{org-publish-org-to-pdf}.  If you want to publish the Org file itself,
9543 but with @i{archived}, @i{commented}, and @i{tag-excluded} trees removed, use
9544 @code{org-publish-org-to-org} and set the parameters @code{:plain-source}
9545 and/or @code{:htmlized-source}.  This will produce @file{file.org} and
9546 @file{file.org.html} in the publishing
9547 directory@footnote{@file{file-source.org} and @file{file-source.org.html} if
9548 source and publishing directories are equal.}.  Other files like images only
9549 need to be copied to the publishing destination, for this you may use
9550 @code{org-publish-attachment}.  For non-Org files, you always need to
9551 specify the publishing function:
9553 @multitable @columnfractions 0.3 0.7
9554 @item @code{:publishing-function}
9555 @tab Function executing the publication of a file.  This may also be a
9556 list of functions, which will all be called in turn.
9557 @item @code{:plain-source}
9558 @tab Non-nil means, publish plain source.
9559 @item @code{:htmlized-source}
9560 @tab Non-nil means, publish htmlized source.
9561 @end multitable
9563 The function must accept two arguments: a property list containing at least a
9564 @code{:publishing-directory} property, and the name of the file to be
9565 published.  It should take the specified file, make the necessary
9566 transformation (if any) and place the result into the destination folder.
9568 @node Publishing options, Publishing links, Publishing action, Configuration
9569 @subsection Options for the HTML/La@TeX{} exporters
9570 @cindex options, for publishing
9572 The property list can be used to set many export options for the HTML
9573 and La@TeX{} exporters.  In most cases, these properties correspond to user
9574 variables in Org.  The table below lists these properties along
9575 with the variable they belong to.  See the documentation string for the
9576 respective variable for details.
9578 @vindex org-export-html-link-up
9579 @vindex org-export-html-link-home
9580 @vindex org-export-default-language
9581 @vindex org-display-custom-times
9582 @vindex org-export-headline-levels
9583 @vindex org-export-with-section-numbers
9584 @vindex org-export-section-number-format
9585 @vindex org-export-with-toc
9586 @vindex org-export-preserve-breaks
9587 @vindex org-export-with-archived-trees
9588 @vindex org-export-with-emphasize
9589 @vindex org-export-with-sub-superscripts
9590 @vindex org-export-with-special-strings
9591 @vindex org-export-with-footnotes
9592 @vindex org-export-with-drawers
9593 @vindex org-export-with-tags
9594 @vindex org-export-with-todo-keywords
9595 @vindex org-export-with-priority
9596 @vindex org-export-with-TeX-macros
9597 @vindex org-export-with-LaTeX-fragments
9598 @vindex org-export-skip-text-before-1st-heading
9599 @vindex org-export-with-fixed-width
9600 @vindex org-export-with-timestamps
9601 @vindex org-export-author-info
9602 @vindex org-export-creator-info
9603 @vindex org-export-with-tables
9604 @vindex org-export-highlight-first-table-line
9605 @vindex org-export-html-style-include-default
9606 @vindex org-export-html-style
9607 @vindex org-export-html-style-extra
9608 @vindex org-export-html-link-org-files-as-html
9609 @vindex org-export-html-inline-images
9610 @vindex org-export-html-extension
9611 @vindex org-export-html-table-tag
9612 @vindex org-export-html-expand
9613 @vindex org-export-html-with-timestamp
9614 @vindex org-export-publishing-directory
9615 @vindex org-export-html-preamble
9616 @vindex org-export-html-postamble
9617 @vindex org-export-html-auto-preamble
9618 @vindex org-export-html-auto-postamble
9619 @vindex user-full-name
9620 @vindex user-mail-address
9621 @vindex org-export-select-tags
9622 @vindex org-export-exclude-tags
9624 @multitable @columnfractions 0.32 0.68
9625 @item @code{:link-up}               @tab @code{org-export-html-link-up}
9626 @item @code{:link-home}             @tab @code{org-export-html-link-home}
9627 @item @code{:language}              @tab @code{org-export-default-language}
9628 @item @code{:customtime}            @tab @code{org-display-custom-times}
9629 @item @code{:headline-levels}       @tab @code{org-export-headline-levels}
9630 @item @code{:section-numbers}       @tab @code{org-export-with-section-numbers}
9631 @item @code{:section-number-format} @tab @code{org-export-section-number-format}
9632 @item @code{:table-of-contents}     @tab @code{org-export-with-toc}
9633 @item @code{:preserve-breaks}       @tab @code{org-export-preserve-breaks}
9634 @item @code{:archived-trees}        @tab @code{org-export-with-archived-trees}
9635 @item @code{:emphasize}             @tab @code{org-export-with-emphasize}
9636 @item @code{:sub-superscript}       @tab @code{org-export-with-sub-superscripts}
9637 @item @code{:special-strings}       @tab @code{org-export-with-special-strings}
9638 @item @code{:footnotes}             @tab @code{org-export-with-footnotes}
9639 @item @code{:drawers}               @tab @code{org-export-with-drawers}
9640 @item @code{:tags}                  @tab @code{org-export-with-tags}
9641 @item @code{:todo-keywords}         @tab @code{org-export-with-todo-keywords}
9642 @item @code{:priority}              @tab @code{org-export-with-priority}
9643 @item @code{:TeX-macros}            @tab @code{org-export-with-TeX-macros}
9644 @item @code{:LaTeX-fragments}       @tab @code{org-export-with-LaTeX-fragments}
9645 @item @code{:skip-before-1st-heading} @tab @code{org-export-skip-text-before-1st-heading}
9646 @item @code{:fixed-width}           @tab @code{org-export-with-fixed-width}
9647 @item @code{:timestamps}            @tab @code{org-export-with-timestamps}
9648 @item @code{:author-info}           @tab @code{org-export-author-info}
9649 @item @code{:creator-info}          @tab @code{org-export-creator-info}
9650 @item @code{:tables}                @tab @code{org-export-with-tables}
9651 @item @code{:table-auto-headline}   @tab @code{org-export-highlight-first-table-line}
9652 @item @code{:style-include-default} @tab @code{org-export-html-style-include-default}
9653 @item @code{:style}                 @tab @code{org-export-html-style}
9654 @item @code{:style-extra}           @tab @code{org-export-html-style-extra}
9655 @item @code{:convert-org-links}     @tab @code{org-export-html-link-org-files-as-html}
9656 @item @code{:inline-images}         @tab @code{org-export-html-inline-images}
9657 @item @code{:html-extension}        @tab @code{org-export-html-extension}
9658 @item @code{:xml-declaration}       @tab @code{org-export-html-xml-declaration}
9659 @item @code{:html-table-tag}        @tab @code{org-export-html-table-tag}
9660 @item @code{:expand-quoted-html}    @tab @code{org-export-html-expand}
9661 @item @code{:timestamp}             @tab @code{org-export-html-with-timestamp}
9662 @item @code{:publishing-directory}  @tab @code{org-export-publishing-directory}
9663 @item @code{:preamble}              @tab @code{org-export-html-preamble}
9664 @item @code{:postamble}             @tab @code{org-export-html-postamble}
9665 @item @code{:auto-preamble}         @tab @code{org-export-html-auto-preamble}
9666 @item @code{:auto-postamble}        @tab @code{org-export-html-auto-postamble}
9667 @item @code{:author}                @tab @code{user-full-name}
9668 @item @code{:email}                 @tab @code{user-mail-address} : @code{addr;addr;..}
9669 @item @code{:select-tags}           @tab @code{org-export-select-tags}
9670 @item @code{:exclude-tags}          @tab @code{org-export-exclude-tags}
9671 @item @code{:latex-image-options}   @tab @code{org-export-latex-image-default-option}
9672 @end multitable
9674 Most of the @code{org-export-with-*} variables have the same effect in
9675 both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
9676 @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
9677 La@TeX{} export.
9679 @vindex org-publish-project-alist
9680 When a property is given a value in @code{org-publish-project-alist},
9681 its setting overrides the value of the corresponding user variable (if
9682 any) during publishing.  Options set within a file (@pxref{Export
9683 options}), however, override everything.
9685 @node Publishing links, Project page index, Publishing options, Configuration
9686 @subsection Links between published files
9687 @cindex links, publishing
9689 To create a link from one Org file to another, you would use
9690 something like @samp{[[file:foo.org][The foo]]} or simply
9691 @samp{file:foo.org.} (@pxref{Hyperlinks}).  When published, this link
9692 becomes a link to @file{foo.html}.  In this way, you can interlink the
9693 pages of your "org web" project and the links will work as expected when
9694 you publish them to HTML.  If you also publish the Org source file and want
9695 to link to that, use an @code{http:} link instead of a @code{file:} link,
9696 because @code{file:} links are converted to link to the corresponding
9697 @file{html} file.
9699 You may also link to related files, such as images. Provided you are careful
9700 with relative file names, and provided you have also configured Org to upload
9701 the related files, these links will work too. See @ref{Complex example}, for
9702 an example of this usage.
9704 Sometimes an Org file to be published may contain links that are
9705 only valid in your production environment, but not in the publishing
9706 location.  In this case, use the property
9708 @multitable @columnfractions 0.4 0.6
9709 @item @code{:link-validation-function}
9710 @tab Function to validate links
9711 @end multitable
9713 @noindent
9714 to define a function for checking link validity.  This function must
9715 accept two arguments, the file name and a directory relative to which
9716 the file name is interpreted in the production environment.  If this
9717 function returns @code{nil}, then the HTML generator will only insert a
9718 description into the HTML file, but no link.  One option for this
9719 function is @code{org-publish-validate-link} which checks if the given
9720 file is part of any project in @code{org-publish-project-alist}.
9722 @node Project page index,  , Publishing links, Configuration
9723 @subsection Project page index
9724 @cindex index, of published pages
9726 The following properties may be used to control publishing of an
9727 index of files or a summary page for a given project.
9729 @multitable @columnfractions 0.25 0.75
9730 @item @code{:auto-index}
9731 @tab When non-nil, publish an index during @code{org-publish-current-project}
9732 or @code{org-publish-all}.
9734 @item @code{:index-filename}
9735 @tab Filename for output of index. Defaults to @file{sitemap.org} (which
9736 becomes @file{sitemap.html}).
9738 @item @code{:index-title}
9739 @tab Title of index page. Defaults to name of file.
9741 @item @code{:index-function}
9742 @tab Plug-in function to use for generation of index.
9743 Defaults to @code{org-publish-org-index}, which generates a plain list
9744 of links to all files in the project.
9745 @end multitable
9747 @node Uploading files, Sample configuration, Configuration, Publishing
9748 @section Uploading files
9749 @cindex rsync
9750 @cindex unison
9752 For those people already utilising third party sync tools such as
9753 @command{rsync} or @command{unison}, it might be preferable not to use the built in
9754 @i{remote} publishing facilities of Org mode which rely heavily on
9755 Tramp.  Tramp, while very useful and powerful, tends not to be
9756 so efficient for multiple file transfer and has been known to cause problems
9757 under heavy usage.
9759 Specialised synchronization utilities offer several advantages.  In addition
9760 to timestamp comparison, they also do content and permissions/attribute
9761 checks.  For this reason you might prefer to publish your web to a local
9762 directory (possibly even @i{in place} with your Org files) and then use
9763 @file{unison} or @file{rsync} to do the synchronisation with the remote host.
9765 Since Unison (for example) can be configured as to which files to transfer to
9766 a certain remote destination, it can greatly simplify the project publishing
9767 definition.  Simply keep all files in the correct location, process your Org
9768 files with @code{org-publish} and let the synchronization tool do the rest.
9769 You do not need, in this scenario, to include attachments such as @file{jpg},
9770 @file{css} or @file{gif} files in the project definition since the 3rd party
9771 tool syncs them.
9773 Publishing to a local directory is also much faster than to a remote one, so
9774 that you can afford more easily to republish entire projects.  If you set
9775 @code{org-publish-use-timestamps-flag} to @code{nil}, you gain the main
9776 benefit of re-including any changed external files such as source example
9777 files you might include with @code{#+INCLUDE}.  The timestamp mechanism in
9778 Org is not smart enough to detect if included files have been modified.
9780 @node Sample configuration, Triggering publication, Uploading files, Publishing
9781 @section Sample configuration
9783 Below we provide two example configurations.  The first one is a simple
9784 project publishing only a set of Org files.  The second example is
9785 more complex, with a multi-component project.
9787 @menu
9788 * Simple example::              One-component publishing
9789 * Complex example::             A multi-component publishing example
9790 @end menu
9792 @node Simple example, Complex example, Sample configuration, Sample configuration
9793 @subsection Example: simple publishing configuration
9795 This example publishes a set of Org files to the @file{public_html}
9796 directory on the local machine.
9798 @lisp
9799 (setq org-publish-project-alist
9800       '(("org"
9801          :base-directory "~/org/"
9802          :publishing-directory "~/public_html"
9803          :section-numbers nil
9804          :table-of-contents nil
9805          :style "<link rel=\"stylesheet\"
9806                 href=\"../other/mystyle.css\"
9807                 type=\"text/css\"/>")))
9808 @end lisp
9810 @node Complex example,  , Simple example, Sample configuration
9811 @subsection Example: complex publishing configuration
9813 This more complicated example publishes an entire website, including
9814 Org files converted to HTML, image files, Emacs Lisp source code, and
9815 style sheets. The publishing directory is remote and private files are
9816 excluded.
9818 To ensure that links are preserved, care should be taken to replicate
9819 your directory structure on the web server, and to use relative file
9820 paths. For example, if your Org files are kept in @file{~/org} and your
9821 publishable images in @file{~/images}, you'd link to an image with
9823 @example
9824 file:../images/myimage.png
9825 @end example
9827 On the web server, the relative path to the image should be the
9828 same. You can accomplish this by setting up an "images" folder in the
9829 right place on the web server, and publishing images to it.
9831 @lisp
9832 (setq org-publish-project-alist
9833       '(("orgfiles"
9834           :base-directory "~/org/"
9835           :base-extension "org"
9836           :publishing-directory "/ssh:user@@host:~/html/notebook/"
9837           :publishing-function org-publish-org-to-html
9838           :exclude "PrivatePage.org"   ;; regexp
9839           :headline-levels 3
9840           :section-numbers nil
9841           :table-of-contents nil
9842           :style "<link rel=\"stylesheet\"
9843                   href=\"../other/mystyle.css\" type=\"text/css\"/>"
9844           :auto-preamble t
9845           :auto-postamble nil)
9847          ("images"
9848           :base-directory "~/images/"
9849           :base-extension "jpg\\|gif\\|png"
9850           :publishing-directory "/ssh:user@@host:~/html/images/"
9851           :publishing-function org-publish-attachment)
9853          ("other"
9854           :base-directory "~/other/"
9855           :base-extension "css\\|el"
9856           :publishing-directory "/ssh:user@@host:~/html/other/"
9857           :publishing-function org-publish-attachment)
9858          ("website" :components ("orgfiles" "images" "other"))))
9859 @end lisp
9861 @node Triggering publication,  , Sample configuration, Publishing
9862 @section Triggering publication
9864 Once properly configured, Org can publish with the following commands:
9866 @table @kbd
9867 @kindex C-c C-e C
9868 @item C-c C-e C
9869 Prompt for a specific project and publish all files that belong to it.
9870 @kindex C-c C-e P
9871 @item C-c C-e P
9872 Publish the project containing the current file.
9873 @kindex C-c C-e F
9874 @item C-c C-e F
9875 Publish only the current file.
9876 @kindex C-c C-e E
9877 @item C-c C-e E
9878 Publish every project.
9879 @end table
9881 @vindex org-publish-use-timestamps-flag
9882 Org uses timestamps to track when a file has changed. The above functions
9883 normally only publish changed files. You can override this and force
9884 publishing of all files by giving a prefix argument to any of the commands
9885 above, or by customizing the variable @code{org-publish-use-timestamps-flag}.
9886 This may be necessary in particular if files include other files via
9887 @code{#+SETUPFILE:} or @code{#+INCLUDE:}.
9889 @node Miscellaneous, Hacking, Publishing, Top
9890 @chapter Miscellaneous
9892 @menu
9893 * Completion::                  M-TAB knows what you need
9894 * Customization::               Adapting Org to your taste
9895 * In-buffer settings::          Overview of the #+KEYWORDS
9896 * The very busy C-c C-c key::   When in doubt, press C-c C-c
9897 * Clean view::                  Getting rid of leading stars in the outline
9898 * TTY keys::                    Using Org on a tty
9899 * Interaction::                 Other Emacs packages
9900 @end menu
9903 @node Completion, Customization, Miscellaneous, Miscellaneous
9904 @section Completion
9905 @cindex completion, of @TeX{} symbols
9906 @cindex completion, of TODO keywords
9907 @cindex completion, of dictionary words
9908 @cindex completion, of option keywords
9909 @cindex completion, of tags
9910 @cindex completion, of property keys
9911 @cindex completion, of link abbreviations
9912 @cindex @TeX{} symbol completion
9913 @cindex TODO keywords completion
9914 @cindex dictionary word completion
9915 @cindex option keyword completion
9916 @cindex tag completion
9917 @cindex link abbreviations, completion of
9919 Org supports in-buffer completion.  This type of completion does
9920 not make use of the minibuffer.  You simply type a few letters into
9921 the buffer and use the key to complete text right there.
9923 @table @kbd
9924 @kindex M-@key{TAB}
9925 @item M-@key{TAB}
9926 Complete word at point
9927 @itemize @bullet
9928 @item
9929 At the beginning of a headline, complete TODO keywords.
9930 @item
9931 After @samp{\}, complete @TeX{} symbols supported by the exporter.
9932 @item
9933 After @samp{*}, complete headlines in the current buffer so that they
9934 can be used in search links like @samp{[[*find this headline]]}.
9935 @item
9936 After @samp{:} in a headline, complete tags.  The list of tags is taken
9937 from the variable @code{org-tag-alist} (possibly set through the
9938 @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
9939 dynamically from all tags used in the current buffer.
9940 @item
9941 After @samp{:} and not in a headline, complete property keys.  The list
9942 of keys is constructed dynamically from all keys used in the current
9943 buffer.
9944 @item
9945 After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
9946 @item
9947 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
9948 @samp{OPTIONS} which set file-specific options for Org mode.  When the
9949 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
9950 will insert example settings for this keyword.
9951 @item
9952 In the line after @samp{#+STARTUP: }, complete startup keywords,
9953 @ie valid keys for this line.
9954 @item
9955 Elsewhere, complete dictionary words using Ispell.
9956 @end itemize
9957 @end table
9959 @node Customization, In-buffer settings, Completion, Miscellaneous
9960 @section Customization
9961 @cindex customization
9962 @cindex options, for customization
9963 @cindex variables, for customization
9965 There are more than 180 variables that can be used to customize
9966 Org.  For the sake of compactness of the manual, I am not
9967 describing the variables here.  A structured overview of customization
9968 variables is available with @kbd{M-x org-customize}.  Or select
9969 @code{Browse Org Group} from the @code{Org->Customization} menu.  Many
9970 settings can also be activated on a per-file basis, by putting special
9971 lines into the buffer (@pxref{In-buffer settings}).
9973 @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
9974 @section Summary of in-buffer settings
9975 @cindex in-buffer settings
9976 @cindex special keywords
9978 Org mode uses special lines in the buffer to define settings on a
9979 per-file basis.  These lines start with a @samp{#+} followed by a
9980 keyword, a colon, and then individual words defining a setting.  Several
9981 setting words can be in the same line, but you can also have multiple
9982 lines for the keyword.  While these settings are described throughout
9983 the manual, here is a summary.  After changing any of those lines in the
9984 buffer, press @kbd{C-c C-c} with the cursor still in the line to
9985 activate the changes immediately.  Otherwise they become effective only
9986 when the file is visited again in a new Emacs session.
9988 @vindex org-archive-location
9989 @table @kbd
9990 @item #+ARCHIVE: %s_done::
9991 This line sets the archive location for the agenda file.  It applies for
9992 all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
9993 of the file.  The first such line also applies to any entries before it.
9994 The corresponding variable is @code{org-archive-location}.
9995 @item #+CATEGORY:
9996 This line sets the category for the agenda file.  The category applies
9997 for all subsequent lines until the next @samp{#+CATEGORY} line, or the
9998 end of the file.  The first such line also applies to any entries before it.
9999 @item #+COLUMNS: %25ITEM .....
10000 @cindex property, COLUMNS
10001 Set the default format for columns view.  This format applies when
10002 columns view is invoked in locations where no @code{COLUMNS} property
10003 applies.
10004 @item #+CONSTANTS: name1=value1 ...
10005 @vindex org-table-formula-constants
10006 @vindex org-table-formula
10007 Set file-local values for constants to be used in table formulas.  This
10008 line set the local variable @code{org-table-formula-constants-local}.
10009 The global version of this variable is
10010 @code{org-table-formula-constants}.
10011 @item #+FILETAGS: :tag1:tag2:tag3:
10012 Set tags that can be inherited by any entry in the file, including the
10013 top-level entries.
10014 @item #+DRAWERS: NAME1 .....
10015 @vindex org-drawers
10016 Set the file-local set of drawers.  The corresponding global variable is
10017 @code{org-drawers}.
10018 @item #+LINK:  linkword replace
10019 @vindex org-link-abbrev-alist
10020 These lines (several are allowed) specify link abbreviations.
10021 @xref{Link abbreviations}.  The corresponding variable is
10022 @code{org-link-abbrev-alist}.
10023 @item #+PRIORITIES: highest lowest default
10024 @vindex org-highest-priority
10025 @vindex org-lowest-priority
10026 @vindex org-default-priority
10027 This line sets the limits and the default for the priorities.  All three
10028 must be either letters A-Z or numbers 0-9.  The highest priority must
10029 have a lower ASCII number that the lowest priority.
10030 @item #+PROPERTY: Property_Name Value
10031 This line sets a default inheritance value for entries in the current
10032 buffer, most useful for specifying the allowed values of a property.
10033 @cindex #+SETUPFILE
10034 @item #+SETUPFILE: file
10035 This line defines a file that holds more in-buffer setup.  Normally this is
10036 entirely ignored.  Only when the buffer is parsed for option-setting lines
10037 (@ie when starting Org mode for a file, when pressing @kbd{C-c C-c} in a
10038 settings line, or when exporting), then the contents of this file are parsed
10039 as if they had been included in the buffer.  In particular, the file can be
10040 any other Org mode file with internal setup.  You can visit the file the
10041 cursor is in the line with @kbd{C-c '}.
10042 @item #+STARTUP:
10043 @cindex #+STARTUP:
10044 @vindex org-startup-folded
10045 This line sets options to be used at startup of Org mode, when an
10046 Org file is being visited.  The first set of options deals with the
10047 initial visibility of the outline tree.  The corresponding variable for
10048 global default settings is @code{org-startup-folded}, with a default
10049 value @code{t}, which means @code{overview}.
10050 @cindex @code{overview}, STARTUP keyword
10051 @cindex @code{content}, STARTUP keyword
10052 @cindex @code{showall}, STARTUP keyword
10053 @example
10054 overview   @r{top-level headlines only}
10055 content    @r{all headlines}
10056 showall    @r{no folding at all, show everything}
10057 @end example
10058 @vindex org-startup-align-all-tables
10059 Then there are options for aligning tables upon visiting a file.  This
10060 is useful in files containing narrowed table columns.  The corresponding
10061 variable is @code{org-startup-align-all-tables}, with a default value
10062 @code{nil}.
10063 @cindex @code{align}, STARTUP keyword
10064 @cindex @code{noalign}, STARTUP keyword
10065 @example
10066 align      @r{align all tables}
10067 noalign    @r{don't align tables on startup}
10068 @end example
10069 @vindex org-log-done
10070 @vindex org-log-note-clock-out
10071 @vindex org-log-repeat
10072 Logging the closing and reopening of TODO items and clock intervals can be
10073 configured using these options (see variables @code{org-log-done},
10074 @code{org-log-note-clock-out} and @code{org-log-repeat})
10075 @cindex @code{logdone}, STARTUP keyword
10076 @cindex @code{lognotedone}, STARTUP keyword
10077 @cindex @code{nologdone}, STARTUP keyword
10078 @cindex @code{lognoteclock-out}, STARTUP keyword
10079 @cindex @code{nolognoteclock-out}, STARTUP keyword
10080 @cindex @code{logrepeat}, STARTUP keyword
10081 @cindex @code{lognoterepeat}, STARTUP keyword
10082 @cindex @code{nologrepeat}, STARTUP keyword
10083 @example
10084 logdone            @r{record a timestamp when an item is marked DONE}
10085 lognotedone        @r{record timestamp and a note when DONE}
10086 nologdone          @r{don't record when items are marked DONE}
10087 logrepeat          @r{record a time when reinstating a repeating item}
10088 lognoterepeat      @r{record a note when reinstating a repeating item}
10089 nologrepeat        @r{do not record when reinstating repeating item}
10090 lognoteclock-out   @r{record a note when clocking out}
10091 nolognoteclock-out @r{don't record a note when clocking out}
10092 @end example
10093 @vindex org-hide-leading-stars
10094 @vindex org-odd-levels-only
10095 Here are the options for hiding leading stars in outline headings, and for
10096 indenting outlines.  The corresponding variables are
10097 @code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with a
10098 default setting @code{nil} (meaning @code{showstars} and @code{oddeven}).
10099 @cindex @code{hidestars}, STARTUP keyword
10100 @cindex @code{showstars}, STARTUP keyword
10101 @cindex @code{odd}, STARTUP keyword
10102 @cindex @code{even}, STARTUP keyword
10103 @example
10104 hidestars  @r{make all but one of the stars starting a headline invisible.}
10105 showstars  @r{show all stars starting a headline}
10106 indent     @r{virtual indentation according to outline level}
10107 noindent   @r{no virtual indentation according to outline level}
10108 odd        @r{allow only odd outline levels (1,3,...)}
10109 oddeven    @r{allow all outline levels}
10110 @end example
10111 @vindex org-put-time-stamp-overlays
10112 @vindex org-time-stamp-overlay-formats
10113 To turn on custom format overlays over timestamps (variables
10114 @code{org-put-time-stamp-overlays} and
10115 @code{org-time-stamp-overlay-formats}), use
10116 @cindex @code{customtime}, STARTUP keyword
10117 @example
10118 customtime @r{overlay custom time format}
10119 @end example
10120 @vindex constants-unit-system
10121 The following options influence the table spreadsheet (variable
10122 @code{constants-unit-system}).
10123 @cindex @code{constcgs}, STARTUP keyword
10124 @cindex @code{constSI}, STARTUP keyword
10125 @example
10126 constcgs   @r{@file{constants.el} should use the c-g-s unit system}
10127 constSI    @r{@file{constants.el} should use the SI unit system}
10128 @end example
10129 @vindex org-footnote-define-inline
10130 @vindex org-footnote-auto-label
10131 @vindex org-footnote-auto-adjust
10132 To influence footnote settings, use the following keywords.  The
10133 corresponding variables are @code{org-footnote-define-inline},
10134 @code{org-footnote-auto-label}, and @code{org-footnote-auto-adjust}.
10135 @cindex @code{fninline}, STARTUP keyword
10136 @cindex @code{nofninline}, STARTUP keyword
10137 @cindex @code{fnlocal}, STARTUP keyword
10138 @cindex @code{fnprompt}, STARTUP keyword
10139 @cindex @code{fnauto}, STARTUP keyword
10140 @cindex @code{fnconfirm}, STARTUP keyword
10141 @cindex @code{fnplain}, STARTUP keyword
10142 @cindex @code{fnadjust}, STARTUP keyword
10143 @cindex @code{nofnadjust}, STARTUP keyword
10144 @example
10145 fninline    @r{define footnotes inline}
10146 fnnoinline  @r{define footnotes in separate section}
10147 fnlocal     @r{define footnotes near first reference, but not inline}
10148 fnprompt    @r{prompt for footnote labels}
10149 fnauto      @r{create [fn:1]-like labels automatically (default)}
10150 fnconfirm   @r{offer automatic label for editing or confirmation}
10151 fnplain     @r{create [1]-like labels automatically}
10152 fnadjust    @r{automatically renumber and sort footnotes}
10153 nofnadjust  @r{do not renumber and sort automatically}
10154 @end example
10155 @cindex org-hide-block-startup
10156 To hide blocks on startup, use these keywords. The corresponding variable is
10157 @code{org-hide-block-startup}.
10158 @cindex @code{hideblocks}, STARTUP keyword
10159 @cindex @code{nohideblocks}, STARTUP keyword
10160 @example
10161 hideblocks   @r{Hide all begin/end blocks on startup}
10162 nohideblocks @r{Do not hide blocks on startup}
10163 @end example
10164 @item #+TAGS:  TAG1(c1) TAG2(c2)
10165 @vindex org-tag-alist
10166 These lines (several such lines are allowed) specify the valid tags in
10167 this file, and (potentially) the corresponding @emph{fast tag selection}
10168 keys.  The corresponding variable is @code{org-tag-alist}.
10169 @item #+TBLFM:
10170 This line contains the formulas for the table directly above the line.
10171 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+DATE:,
10172 @itemx #+OPTIONS:, #+BIND:
10173 @itemx #+DESCRIPTION:, #+KEYWORDS:
10174 @itemx #+LATEX_HEADER:, #+STYLE:, #+LINK_UP:, #+LINK_HOME:,
10175 @itemx #+EXPORT_SELECT_TAGS:, #+EXPORT_EXCLUDE_TAGS:
10176 These lines provide settings for exporting files.  For more details see
10177 @ref{Export options}.
10178 @item #+TODO:    #+SEQ_TODO:   #+TYP_TODO:
10179 @vindex org-todo-keywords
10180 These lines set the TODO keywords and their interpretation in the
10181 current file.  The corresponding variable is @code{org-todo-keywords}.
10182 @end table
10184 @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
10185 @section The very busy C-c C-c key
10186 @kindex C-c C-c
10187 @cindex C-c C-c, overview
10189 The key @kbd{C-c C-c} has many purposes in Org, which are all
10190 mentioned scattered throughout this manual.  One specific function of
10191 this key is to add @emph{tags} to a headline (@pxref{Tags}).  In many
10192 other circumstances it means something like @emph{``Hey Org, look
10193 here and update according to what you see here''}.  Here is a summary of
10194 what this means in different contexts.
10196 @itemize @minus
10197 @item
10198 If there are highlights in the buffer from the creation of a sparse
10199 tree, or from clock display, remove these highlights.
10200 @item
10201 If the cursor is in one of the special @code{#+KEYWORD} lines, this
10202 triggers scanning the buffer for these lines and updating the
10203 information.
10204 @item
10205 If the cursor is inside a table, realign the table.  This command
10206 works even if the automatic table editor has been turned off.
10207 @item
10208 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
10209 the entire table.
10210 @item
10211 If the cursor is inside a table created by the @file{table.el} package,
10212 activate that table.
10213 @item
10214 If the current buffer is a Remember buffer, close the note and file it.
10215 With a prefix argument, file it, without further interaction, to the
10216 default location.
10217 @item
10218 If the cursor is on a @code{<<<target>>>}, update radio targets and
10219 corresponding links in this buffer.
10220 @item
10221 If the cursor is in a property line or at the start or end of a property
10222 drawer, offer property commands.
10223 @item
10224 If the cursor is at a footnote reference, go to the corresponding
10225 definition, and vice versa.
10226 @item
10227 If the cursor is in a plain list item with a checkbox, toggle the status
10228 of the checkbox.
10229 @item
10230 If the cursor is on a numbered item in a plain list, renumber the
10231 ordered list.
10232 @item
10233 If the cursor is on the @code{#+BEGIN} line of a dynamic block, the
10234 block is updated.
10235 @end itemize
10237 @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
10238 @section A cleaner outline view
10239 @cindex hiding leading stars
10240 @cindex dynamic indentation
10241 @cindex odd-levels-only outlines
10242 @cindex clean outline view
10244 Some people find it noisy and distracting that the Org headlines start
10245 with a potentially large number of stars, and that text below the headlines
10246 is not indented.  This is not really a problem when you are writing a book
10247 where the outline headings are really section headlines.  However, in a more
10248 list-oriented outline, it is clear that an indented structure is a lot
10249 cleaner, as can be seen by comparing the two columns in the following
10250 example:
10252 @example
10253 @group
10254 * Top level headline             |    * Top level headline
10255 ** Second level                  |      * Second level
10256 *** 3rd level                    |        * 3rd level
10257 some text                        |          some text
10258 *** 3rd level                    |        * 3rd level
10259 more text                        |          more text
10260 * Another top level headline     |    * Another top level headline
10261 @end group
10262 @end example
10264 @noindent
10265 It is non-trivial to make such a look work in Emacs, but Org contains three
10266 separate features that, combined, achieve just that.
10268 @enumerate
10269 @item
10270 @emph{Indentation of text below headlines}@*
10271 You may indent text below each headline to make the left boundary line up
10272 with the headline, like
10274 @example
10275 *** 3rd level
10276     more text, now indented
10277 @end example
10279 @vindex org-adapt-indentation
10280 A good way to get this indentation is by hand, and Org supports this with
10281 paragraph filling, line wrapping, and structure editing@footnote{See also the
10282 variable @code{org-adapt-indentation}.} preserving or adapting the
10283 indentation as appropriate.  A different approach would be to have a way to
10284 automatically indent lines according to outline structure by adding overlays
10285 or text properties.  But I have not yet found a robust and efficient way to
10286 do this in large files.
10288 @item
10289 @vindex org-hide-leading-stars
10290 @emph{Hiding leading stars}@* You can modify the display in such a way that
10291 all leading stars become invisible.  To do this in a global way, configure
10292 the variable @code{org-hide-leading-stars} or change this on a per-file basis
10293 with
10295 @example
10296 #+STARTUP: hidestars
10297 @end example
10299 @noindent
10300 Note that the opposite behavior is selected with @code{showstars}.
10302 With hidden stars, the tree becomes:
10304 @example
10305 @group
10306 * Top level headline
10307  * Second level
10308   * 3rd level
10309   ...
10310 @end group
10311 @end example
10313 @noindent
10314 @vindex org-hide @r{(face)}
10315 Note that the leading stars are not truly replaced by whitespace, they
10316 are only fontified with the face @code{org-hide} that uses the
10317 background color as font color.  If you are not using either white or
10318 black background, you may have to customize this face to get the wanted
10319 effect.  Another possibility is to set this font such that the extra
10320 stars are @i{almost} invisible, for example using the color
10321 @code{grey90} on a white background.
10323 @item
10324 @vindex org-odd-levels-only
10325 Things become cleaner still if you skip all the even levels and use only odd
10326 levels 1, 3, 5..., effectively adding two stars to go from one outline level
10327 to the next@footnote{When you need to specify a level for a property search
10328 or refile targets, @samp{LEVEL=2} will correspond to 3 stars, etc@.}.  In this
10329 way we get the outline view shown at the beginning of this section.  In order
10330 to make the structure editing and export commands handle this convention
10331 correctly, configure the variable @code{org-odd-levels-only}, or set this on
10332 a per-file basis with one of the following lines:
10334 @example
10335 #+STARTUP: odd
10336 #+STARTUP: oddeven
10337 @end example
10339 You can convert an Org file from single-star-per-level to the
10340 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
10341 RET} in that file.  The reverse operation is @kbd{M-x
10342 org-convert-to-oddeven-levels}.
10343 @end enumerate
10345 @node TTY keys, Interaction, Clean view, Miscellaneous
10346 @section Using Org on a tty
10347 @cindex tty key bindings
10349 Because Org contains a large number of commands, by default many of
10350 Org's core commands are bound to keys that are generally not
10351 accessible on a tty, such as the cursor keys (@key{left}, @key{right},
10352 @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
10353 together with modifiers like @key{Meta} and/or @key{Shift}.  To access
10354 these commands on a tty when special keys are unavailable, the following
10355 alternative bindings can be used.  The tty bindings below will likely be
10356 more cumbersome; you may find for some of the bindings below that a
10357 customized workaround suits you better.  For example, changing a timestamp
10358 is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
10359 tty you would rather use @kbd{C-c .} to re-insert the timestamp.
10361 @multitable @columnfractions 0.15 0.2 0.2
10362 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
10363 @item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
10364 @item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
10365 @item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
10366 @item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
10367 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
10368 @item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
10369 @item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
10370 @item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
10371 @item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
10372 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
10373 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
10374 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
10375 @item @kbd{S-@key{left}}    @tab @kbd{C-c @key{left}}      @tab
10376 @item @kbd{S-@key{right}}   @tab @kbd{C-c @key{right}}     @tab
10377 @item @kbd{S-@key{up}}      @tab @kbd{C-c @key{up}}        @tab
10378 @item @kbd{S-@key{down}}    @tab @kbd{C-c @key{down}}      @tab
10379 @item @kbd{C-S-@key{left}}  @tab @kbd{C-c C-x @key{left}}  @tab
10380 @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
10381 @end multitable
10384 @node Interaction,  , TTY keys, Miscellaneous
10385 @section Interaction with other packages
10386 @cindex packages, interaction with other
10387 Org lives in the world of GNU Emacs and interacts in various ways
10388 with other code out there.
10390 @menu
10391 * Cooperation::                 Packages Org cooperates with
10392 * Conflicts::                   Packages that lead to conflicts
10393 @end menu
10395 @node Cooperation, Conflicts, Interaction, Interaction
10396 @subsection Packages that Org cooperates with
10398 @table @asis
10399 @cindex @file{calc.el}
10400 @cindex Gillespie, Dave
10401 @item @file{calc.el} by Dave Gillespie
10402 Org uses the Calc package for implementing spreadsheet
10403 functionality in its tables (@pxref{The spreadsheet}).  Org
10404 checks for the availability of Calc by looking for the function
10405 @code{calc-eval} which will have been autoloaded during setup if Calc has
10406 been installed properly.  As of Emacs 22, Calc is part of the Emacs
10407 distribution.  Another possibility for interaction between the two
10408 packages is using Calc for embedded calculations. @xref{Embedded Mode,
10409 , Embedded Mode, Calc, GNU Emacs Calc Manual}.
10410 @item @file{constants.el} by Carsten Dominik
10411 @cindex @file{constants.el}
10412 @cindex Dominik, Carsten
10413 @vindex org-table-formula-constants
10414 In a table formula (@pxref{The spreadsheet}), it is possible to use
10415 names for natural constants or units.  Instead of defining your own
10416 constants in the variable @code{org-table-formula-constants}, install
10417 the @file{constants} package which defines a large number of constants
10418 and units, and lets you use unit prefixes like @samp{M} for
10419 @samp{Mega}, etc@.  You will need version 2.0 of this package, available
10420 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
10421 the function @code{constants-get}, which has to be autoloaded in your
10422 setup.  See the installation instructions in the file
10423 @file{constants.el}.
10424 @item @file{cdlatex.el} by Carsten Dominik
10425 @cindex @file{cdlatex.el}
10426 @cindex Dominik, Carsten
10427 Org mode can make use of the CDLa@TeX{} package to efficiently enter
10428 La@TeX{} fragments into Org files.  See @ref{CDLaTeX mode}.
10429 @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
10430 @cindex @file{imenu.el}
10431 Imenu allows menu access to an index of items in a file.  Org mode
10432 supports Imenu---all you need to do to get the index is the following:
10433 @lisp
10434 (add-hook 'org-mode-hook
10435           (lambda () (imenu-add-to-menubar "Imenu")))
10436 @end lisp
10437 @vindex org-imenu-depth
10438 By default the index is two levels deep---you can modify the depth using
10439 the option @code{org-imenu-depth}.
10440 @item @file{remember.el} by John Wiegley
10441 @cindex @file{remember.el}
10442 @cindex Wiegley, John
10443 Org cooperates with remember, see @ref{Remember}.
10444 @file{Remember.el} is not part of Emacs, find it on the web.
10445 @item @file{speedbar.el} by Eric M. Ludlam
10446 @cindex @file{speedbar.el}
10447 @cindex Ludlam, Eric M.
10448 Speedbar is a package that creates a special frame displaying files and
10449 index items in files.  Org mode supports Speedbar and allows you to
10450 drill into Org files directly from the Speedbar.  It also allows you to
10451 restrict the scope of agenda commands to a file or a subtree by using
10452 the command @kbd{<} in the Speedbar frame.
10453 @cindex @file{table.el}
10454 @item @file{table.el} by Takaaki Ota
10455 @kindex C-c C-c
10456 @cindex table editor, @file{table.el}
10457 @cindex @file{table.el}
10458 @cindex Ota, Takaaki
10460 Complex ASCII tables with automatic line wrapping, column- and
10461 row-spanning, and alignment can be created using the Emacs table
10462 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
10463 and also part of Emacs 22).
10464 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
10465 will call @command{table-recognize-table} and move the cursor into the
10466 table.  Inside a table, the keymap of Org mode is inactive.  In order
10467 to execute Org mode-related commands, leave the table.
10469 @table @kbd
10470 @kindex C-c C-c
10471 @item C-c C-c
10472 Recognize @file{table.el} table.  Works when the cursor is in a
10473 table.el table.
10475 @kindex C-c ~
10476 @item C-c ~
10477 Insert a @file{table.el} table.  If there is already a table at point, this
10478 command converts it between the @file{table.el} format and the Org-mode
10479 format.  See the documentation string of the command
10480 @code{org-convert-table} for the restrictions under which this is
10481 possible.
10482 @end table
10483 @file{table.el} is part of Emacs 22.
10484 @item @file{footnote.el} by Steven L. Baur
10485 @cindex @file{footnote.el}
10486 @cindex Baur, Steven L.
10487 Org mode recognizes numerical footnotes as provided by this package.
10488 However, Org mode also has its own footnote support (@pxref{Footnotes}),
10489 which makes using @file{footnote.el} unnecessary.
10490 @end table
10492 @node Conflicts,  , Cooperation, Interaction
10493 @subsection Packages that lead to conflicts with Org mode
10495 @table @asis
10497 @cindex @code{shift-selection-mode}
10498 @vindex org-support-shift-select
10499 In Emacs 23, @code{shift-selection-mode} is on by default, meaning that
10500 cursor motions combined with the shift key should start or enlarge regions.
10501 This conflicts with the use of @kbd{S-@key{cursor}} commands in Org to change
10502 timestamps, TODO keywords, priorities, and item bullet types if the cursor is
10503 at such a location.  By default, @kbd{S-@key{cursor}} commands outside
10504 special contexts don't do anything, but you can customize the variable
10505 @code{org-support-shift-select}.  Org mode then tries to accommodate shift
10506 selection by (i) using it outside of the special contexts where special
10507 commands apply, and by (ii) extending an existing active region even if the
10508 cursor moves across a special context.
10510 @item @file{CUA.el} by Kim. F. Storm
10511 @cindex @file{CUA.el}
10512 @cindex Storm, Kim. F.
10513 @vindex org-replace-disputed-keys
10514 Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by CUA mode
10515 (as well as @code{pc-select-mode} and @code{s-region-mode}) to select and extend the
10516 region.  In fact, Emacs 23 has this built-in in the form of
10517 @code{shift-selection-mode}, see previous paragraph.  If you are using Emacs
10518 23, you probably don't want to use another package for this purpose.  However,
10519 if you prefer to leave these keys to a different package while working in
10520 Org mode, configure the variable @code{org-replace-disputed-keys}.  When set,
10521 Org will move the following key bindings in Org files, and in the agenda
10522 buffer (but not during date selection).
10524 @example
10525 S-UP      ->  M-p             S-DOWN     ->  M-n
10526 S-LEFT    ->  M--             S-RIGHT    ->  M-+
10527 C-S-LEFT  ->  M-S--           C-S-RIGHT  ->  M-S-+
10528 @end example
10530 @vindex org-disputed-keys
10531 Yes, these are unfortunately more difficult to remember.  If you want
10532 to have other replacement keys, look at the variable
10533 @code{org-disputed-keys}.
10535 @item @file{yasnippet.el}
10536 @cindex @file{yasnippet.el}
10537 The way Org-mode binds the TAB key (binding to @code{[tab]} instead of
10538 @code{"\t"}) overrules yasnippets' access to this key.  The following code
10539 fixed this problem:
10541 @lisp
10542 (add-hook 'org-mode-hook
10543           (lambda ()
10544             (org-set-local 'yas/trigger-key [tab])
10545             (define-key yas/keymap [tab] 'yas/next-field-group)))
10546 @end lisp
10548 @item @file{windmove.el} by Hovav Shacham
10549 @cindex @file{windmove.el}
10550 This package also uses the @kbd{S-<cursor>} keys, so everything written
10551 in the paragraph above about CUA mode also applies here.
10553 @end table
10555 @node Hacking, History and Acknowledgments, Miscellaneous, Top
10556 @appendix Hacking
10557 @cindex hacking
10559 This appendix covers some aspects where users can extend the functionality of
10560 Org.
10562 @menu
10563 * Hooks::                       Who to reach into Org's internals
10564 * Add-on packages::             Available extensions
10565 * Adding hyperlink types::      New custom link types
10566 * Context-sensitive commands::  How to add functioality to such commands
10567 * Tables in arbitrary syntax::  Orgtbl for La@TeX{} and other programs
10568 * Dynamic blocks::              Automatically filled blocks
10569 * Special agenda views::        Customized views
10570 * Extracting agenda information::  Postprocessing of agenda information
10571 * Using the property API::      Writing programs that use entry properties
10572 * Using the mapping API::       Mapping over all or selected entries
10573 @end menu
10575 @node Hooks, Add-on packages, Hacking, Hacking
10576 @section Hooks
10577 @cindex hooks
10579 Org has a large number of hook variables that can be used to add
10580 functionality.  This appendix about hacking is going to illustrate the
10581 use of some of them.  A complete list of all hooks with documentation is
10582 maintained by the Worg project and can be found at
10583 @uref{http://orgmode.org/worg/org-configs/org-hooks.php}.
10585 @node Add-on packages, Adding hyperlink types, Hooks, Hacking
10586 @section Add-on packages
10587 @cindex add-on packages
10589 A large number of add-on packages have been written by various authors.
10590 These packages are not part of Emacs, but they are distributed as contributed
10591 packages with the separate release available at the Org mode home page at
10592 @uref{http://orgmode.org}.  The list of contributed packages, along with
10593 documentation about each package, is maintained by the Worg project at
10594 @uref{http://orgmode.org/worg/org-contrib/}.
10598 @node Adding hyperlink types, Context-sensitive commands, Add-on packages, Hacking
10599 @section Adding hyperlink types
10600 @cindex hyperlinks, adding new types
10602 Org has a large number of hyperlink types built-in
10603 (@pxref{Hyperlinks}).  If you would like to add new link types, Org
10604 provides an interface for doing so.  Let's look at an example file,
10605 @file{org-man.el}, that will add support for creating links like
10606 @samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
10607 Emacs:
10609 @lisp
10610 ;;; org-man.el - Support for links to manpages in Org
10612 (require 'org)
10614 (org-add-link-type "man" 'org-man-open)
10615 (add-hook 'org-store-link-functions 'org-man-store-link)
10617 (defcustom org-man-command 'man
10618   "The Emacs command to be used to display a man page."
10619   :group 'org-link
10620   :type '(choice (const man) (const woman)))
10622 (defun org-man-open (path)
10623   "Visit the manpage on PATH.
10624 PATH should be a topic that can be thrown at the man command."
10625   (funcall org-man-command path))
10627 (defun org-man-store-link ()
10628   "Store a link to a manpage."
10629   (when (memq major-mode '(Man-mode woman-mode))
10630     ;; This is a man page, we do make this link
10631     (let* ((page (org-man-get-page-name))
10632            (link (concat "man:" page))
10633            (description (format "Manpage for %s" page)))
10634       (org-store-link-props
10635        :type "man"
10636        :link link
10637        :description description))))
10639 (defun org-man-get-page-name ()
10640   "Extract the page name from the buffer name."
10641   ;; This works for both `Man-mode' and `woman-mode'.
10642   (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
10643       (match-string 1 (buffer-name))
10644     (error "Cannot create link to this man page")))
10646 (provide 'org-man)
10648 ;;; org-man.el ends here
10649 @end lisp
10651 @noindent
10652 You would activate this new link type in @file{.emacs} with
10654 @lisp
10655 (require 'org-man)
10656 @end lisp
10658 @noindent
10659 Let's go through the file and see what it does.
10660 @enumerate
10661 @item
10662 It does @code{(require 'org)} to make sure that @file{org.el} has been
10663 loaded.
10664 @item
10665 The next line calls @code{org-add-link-type} to define a new link type
10666 with prefix @samp{man}.  The call also contains the name of a function
10667 that will be called to follow such a link.
10668 @item
10669 @vindex org-store-link-functions
10670 The next line adds a function to @code{org-store-link-functions}, in
10671 order to allow the command @kbd{C-c l} to record a useful link in a
10672 buffer displaying a man page.
10673 @end enumerate
10675 The rest of the file defines the necessary variables and functions.
10676 First there is a customization variable that determines which Emacs
10677 command should be used to display man pages.  There are two options,
10678 @code{man} and @code{woman}.  Then the function to follow a link is
10679 defined.  It gets the link path as an argument---in this case the link
10680 path is just a topic for the manual command.  The function calls the
10681 value of @code{org-man-command} to display the man page.
10683 Finally the function @code{org-man-store-link} is defined.  When you try
10684 to store a link with @kbd{C-c l}, this function will be called to
10685 try to make a link.  The function must first decide if it is supposed to
10686 create the link for this buffer type; we do this by checking the value
10687 of the variable @code{major-mode}.  If not, the function must exit and
10688 return the value @code{nil}.  If yes, the link is created by getting the
10689 manual topic from the buffer name and prefixing it with the string
10690 @samp{man:}.  Then it must call the command @code{org-store-link-props}
10691 and set the @code{:type} and @code{:link} properties.  Optionally you
10692 can also set the @code{:description} property to provide a default for
10693 the link description when the link is later inserted into an Org
10694 buffer with @kbd{C-c C-l}.
10696 When is makes sense for your new link type, you may also define a function
10697 @code{org-PREFIX-complete-link} that implements special (@eg completion)
10698 support for inserting such a link with @kbd{C-c C-l}.  Such a function should
10699 not accept any arguments, and return the full link with prefix.
10701 @node Context-sensitive commands, Tables in arbitrary syntax, Adding hyperlink types, Hacking
10702 @section Context-sensitive commands
10703 @cindex context-sensitive commands, hooks
10704 @cindex add-ons, context-sensitive commands
10705 @vindex org-ctrl-c-ctrl-c-hook
10707 Org has several commands that act differently depending on context.  The most
10708 important example it the @kbd{C-c C-c} (@pxref{The very busy C-c C-c key}).
10709 Also the @kbd{M-cursor} and @kbd{M-S-cursor} keys have this property.
10711 Add-ons can tap into this functionality by providing a function that detects
10712 special context for that add-on and executes functionality appropriate for
10713 the context.  Here is an example from Dan Davison's @file{org-R.el} which
10714 allows you to evaluate commands based on the @file{R} programming language.  For
10715 this package, special contexts are lines that start with @code{#+R:} or
10716 @code{#+RR:}.
10718 @lisp
10719 (defun org-R-apply-maybe ()
10720   "Detect if this is context for org-R and execute R commands."
10721   (if (save-excursion
10722         (beginning-of-line 1)
10723         (looking-at "#\\+RR?:"))
10724       (progn (call-interactively 'org-R-apply)
10725              t) ;; to signal that we took action
10726     nil)) ;; to signal that we did not
10728 (add-hook 'org-ctrl-c-ctrl-c-hook 'org-R-apply-maybe)
10729 @end lisp
10731 The function first checks if the cursor is in such a line.  If that is the
10732 case, @code{org-R-apply} is called and the function returns @code{t} to
10733 signal that action was taken, and @kbd{C-c C-c} will stop looking for other
10734 contexts.  If the function finds it should do nothing locally, it returns @code{nil} so that other, similar functions can have a try.
10737 @node Tables in arbitrary syntax, Dynamic blocks, Context-sensitive commands, Hacking
10738 @section Tables and lists in arbitrary syntax
10739 @cindex tables, in other modes
10740 @cindex lists, in other modes
10741 @cindex Orgtbl mode
10743 Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
10744 frequent feature request has been to make it work with native tables in
10745 specific languages, for example La@TeX{}.  However, this is extremely
10746 hard to do in a general way, would lead to a customization nightmare,
10747 and would take away much of the simplicity of the Orgtbl-mode table
10748 editor.
10751 This appendix describes a different approach.  We keep the Orgtbl mode
10752 table in its native format (the @i{source table}), and use a custom
10753 function to @i{translate} the table to the correct syntax, and to
10754 @i{install} it in the right location (the @i{target table}).  This puts
10755 the burden of writing conversion functions on the user, but it allows
10756 for a very flexible system.
10758 Bastien added the ability to do the same with lists.  You can use Org's
10759 facilities to edit and structure lists by turning @code{orgstruct-mode}
10760 on, then locally exporting such lists in another format (HTML, La@TeX{}
10761 or Texinfo.)
10764 @menu
10765 * Radio tables::                Sending and receiving
10766 * A LaTeX example::             Step by step, almost a tutorial
10767 * Translator functions::        Copy and modify
10768 * Radio lists::                 Doing the same for lists
10769 @end menu
10771 @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
10772 @subsection Radio tables
10773 @cindex radio tables
10775 To define the location of the target table, you first need to create two
10776 lines that are comments in the current mode, but contain magic words for
10777 Orgtbl mode to find.  Orgtbl mode will insert the translated table
10778 between these lines, replacing whatever was there before.  For example:
10780 @example
10781 /* BEGIN RECEIVE ORGTBL table_name */
10782 /* END RECEIVE ORGTBL table_name */
10783 @end example
10785 @noindent
10786 Just above the source table, we put a special line that tells
10787 Orgtbl mode how to translate this table and where to install it.  For
10788 example:
10789 @cindex #+ORGTBL
10790 @example
10791 #+ORGTBL: SEND table_name translation_function arguments....
10792 @end example
10794 @noindent
10795 @code{table_name} is the reference name for the table that is also used
10796 in the receiver lines. @code{translation_function} is the Lisp function
10797 that does the translation.  Furthermore, the line can contain a list of
10798 arguments (alternating key and value) at the end.  The arguments will be
10799 passed as a property list to the translation function for
10800 interpretation.  A few standard parameters are already recognized and
10801 acted upon before the translation function is called:
10803 @table @code
10804 @item :skip N
10805 Skip the first N lines of the table.  Hlines do count as separate lines for
10806 this parameter!
10808 @item :skipcols (n1 n2 ...)
10809 List of columns that should be skipped.  If the table has a column with
10810 calculation marks, that column is automatically discarded as well.
10811 Please note that the translator function sees the table @emph{after} the
10812 removal of these columns, the function never knows that there have been
10813 additional columns.
10814 @end table
10816 @noindent
10817 The one problem remaining is how to keep the source table in the buffer
10818 without disturbing the normal workings of the file, for example during
10819 compilation of a C file or processing of a La@TeX{} file.  There are a
10820 number of different solutions:
10822 @itemize @bullet
10823 @item
10824 The table could be placed in a block comment if that is supported by the
10825 language.  For example, in C mode you could wrap the table between
10826 @samp{/*} and @samp{*/} lines.
10827 @item
10828 Sometimes it is possible to put the table after some kind of @i{END}
10829 statement, for example @samp{\bye} in @TeX{} and @samp{\end@{document@}}
10830 in La@TeX{}.
10831 @item
10832 You can just comment the table line-by-line whenever you want to process
10833 the file, and uncomment it whenever you need to edit the table.  This
10834 only sounds tedious---the command @kbd{M-x orgtbl-toggle-comment}
10835 makes this comment-toggling very easy, in particular if you bind it to a
10836 key.
10837 @end itemize
10839 @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
10840 @subsection A La@TeX{} example of radio tables
10841 @cindex La@TeX{}, and Orgtbl mode
10843 The best way to wrap the source table in La@TeX{} is to use the
10844 @code{comment} environment provided by @file{comment.sty}.  It has to be
10845 activated by placing @code{\usepackage@{comment@}} into the document
10846 header.  Orgtbl mode can insert a radio table skeleton@footnote{By
10847 default this works only for La@TeX{}, HTML, and Texinfo.  Configure the
10848 variable @code{orgtbl-radio-tables} to install templates for other
10849 modes.}  with the command @kbd{M-x orgtbl-insert-radio-table}.  You will
10850 be prompted for a table name, let's say we use @samp{salesfigures}.  You
10851 will then get the following template:
10853 @cindex #+ORGTBL, SEND
10854 @example
10855 % BEGIN RECEIVE ORGTBL salesfigures
10856 % END RECEIVE ORGTBL salesfigures
10857 \begin@{comment@}
10858 #+ORGTBL: SEND salesfigures orgtbl-to-latex
10859 | | |
10860 \end@{comment@}
10861 @end example
10863 @noindent
10864 @vindex La@TeX{}-verbatim-environments
10865 The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
10866 @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
10867 into the receiver location with name @code{salesfigures}.  You may now
10868 fill in the table, feel free to use the spreadsheet features@footnote{If
10869 the @samp{#+TBLFM} line contains an odd number of dollar characters,
10870 this may cause problems with font-lock in La@TeX{} mode.  As shown in the
10871 example you can fix this by adding an extra line inside the
10872 @code{comment} environment that is used to balance the dollar
10873 expressions.  If you are using AUC@TeX{} with the font-latex library, a
10874 much better solution is to add the @code{comment} environment to the
10875 variable @code{LaTeX-verbatim-environments}.}:
10877 @example
10878 % BEGIN RECEIVE ORGTBL salesfigures
10879 % END RECEIVE ORGTBL salesfigures
10880 \begin@{comment@}
10881 #+ORGTBL: SEND salesfigures orgtbl-to-latex
10882 | Month | Days | Nr sold | per day |
10883 |-------+------+---------+---------|
10884 | Jan   |   23 |      55 |     2.4 |
10885 | Feb   |   21 |      16 |     0.8 |
10886 | March |   22 |     278 |    12.6 |
10887 #+TBLFM: $4=$3/$2;%.1f
10888 % $ (optional extra dollar to keep font-lock happy, see footnote)
10889 \end@{comment@}
10890 @end example
10892 @noindent
10893 When you are done, press @kbd{C-c C-c} in the table to get the converted
10894 table inserted between the two marker lines.
10896 Now let's assume you want to make the table header by hand, because you
10897 want to control how columns are aligned, etc@.  In this case we make sure
10898 that the table translator skips the first 2 lines of the source
10899 table, and tell the command to work as a @i{splice}, @ie to not produce
10900 header and footer commands of the target table:
10902 @example
10903 \begin@{tabular@}@{lrrr@}
10904 Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
10905 % BEGIN RECEIVE ORGTBL salesfigures
10906 % END RECEIVE ORGTBL salesfigures
10907 \end@{tabular@}
10909 \begin@{comment@}
10910 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
10911 | Month | Days | Nr sold | per day |
10912 |-------+------+---------+---------|
10913 | Jan   |   23 |      55 |     2.4 |
10914 | Feb   |   21 |      16 |     0.8 |
10915 | March |   22 |     278 |    12.6 |
10916 #+TBLFM: $4=$3/$2;%.1f
10917 \end@{comment@}
10918 @end example
10920 The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
10921 Orgtbl mode.  It uses a @code{tabular} environment to typeset the table
10922 and marks horizontal lines with @code{\hline}.  Furthermore, it
10923 interprets the following parameters (see also @pxref{Translator functions}):
10925 @table @code
10926 @item :splice nil/t
10927 When set to t, return only table body lines, don't wrap them into a
10928 tabular environment.  Default is nil.
10930 @item :fmt fmt
10931 A format to be used to wrap each field, it should contain @code{%s} for the
10932 original field value.  For example, to wrap each field value in dollars,
10933 you could use @code{:fmt "$%s$"}.  This may also be a property list with
10934 column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
10935 A function of one argument can be used in place of the strings; the
10936 function must return a formatted string.
10938 @item :efmt efmt
10939 Use this format to print numbers with exponentials.  The format should
10940 have @code{%s} twice for inserting mantissa and exponent, for example
10941 @code{"%s\\times10^@{%s@}"}.  The default is @code{"%s\\,(%s)"}.  This
10942 may also be a property list with column numbers and formats, for example
10943 @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}.  After
10944 @code{efmt} has been applied to a value, @code{fmt} will also be
10945 applied.  Similar to @code{fmt}, functions of two arguments can be
10946 supplied instead of strings.
10947 @end table
10949 @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
10950 @subsection Translator functions
10951 @cindex HTML, and Orgtbl mode
10952 @cindex translator function
10954 Orgtbl mode has several translator functions built-in: @code{orgtbl-to-csv}
10955 (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values)
10956 @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and @code{orgtbl-to-texinfo}.
10957 Except for @code{orgtbl-to-html}@footnote{The HTML translator uses the same
10958 code that produces tables during HTML export.}, these all use a generic
10959 translator, @code{orgtbl-to-generic}.  For example, @code{orgtbl-to-latex}
10960 itself is a very short function that computes the column definitions for the
10961 @code{tabular} environment, defines a few field and line separators and then
10962 hands processing over to the generic translator.  Here is the entire code:
10964 @lisp
10965 @group
10966 (defun orgtbl-to-latex (table params)
10967   "Convert the Orgtbl mode TABLE to LaTeX."
10968   (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
10969                                org-table-last-alignment ""))
10970          (params2
10971           (list
10972            :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
10973            :tend "\\end@{tabular@}"
10974            :lstart "" :lend " \\\\" :sep " & "
10975            :efmt "%s\\,(%s)" :hline "\\hline")))
10976     (orgtbl-to-generic table (org-combine-plists params2 params))))
10977 @end group
10978 @end lisp
10980 As you can see, the properties passed into the function (variable
10981 @var{PARAMS}) are combined with the ones newly defined in the function
10982 (variable @var{PARAMS2}).  The ones passed into the function (@ie the
10983 ones set by the @samp{ORGTBL SEND} line) take precedence.  So if you
10984 would like to use the La@TeX{} translator, but wanted the line endings to
10985 be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
10986 overrule the default with
10988 @example
10989 #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
10990 @end example
10992 For a new language, you can either write your own converter function in
10993 analogy with the La@TeX{} translator, or you can use the generic function
10994 directly.  For example, if you have a language where a table is started
10995 with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
10996 started with @samp{!BL!}, ended with @samp{!EL!}, and where the field
10997 separator is a TAB, you could call the generic translator like this (on
10998 a single line!):
11000 @example
11001 #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
11002                               :lstart "!BL! " :lend " !EL!" :sep "\t"
11003 @end example
11005 @noindent
11006 Please check the documentation string of the function
11007 @code{orgtbl-to-generic} for a full list of parameters understood by
11008 that function, and remember that you can pass each of them into
11009 @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
11010 using the generic function.
11012 Of course you can also write a completely new function doing complicated
11013 things the generic translator cannot do.  A translator function takes
11014 two arguments.  The first argument is the table, a list of lines, each
11015 line either the symbol @code{hline} or a list of fields.  The second
11016 argument is the property list containing all parameters specified in the
11017 @samp{#+ORGTBL: SEND} line.  The function must return a single string
11018 containing the formatted table.  If you write a generally useful
11019 translator, please post it on @email{emacs-orgmode@@gnu.org} so that
11020 others can benefit from your work.
11022 @node  Radio lists,  , Translator functions, Tables in arbitrary syntax
11023 @subsection Radio lists
11024 @cindex radio lists
11025 @cindex org-list-insert-radio-list
11027 Sending and receiving radio lists works exactly the same way than
11028 sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
11029 need to load the @code{org-export-latex.el} package to use radio lists
11030 since the relevant code is there for now.}.  As for radio tables, you
11031 can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
11032 calling @code{org-list-insert-radio-list}.
11034 Here are the differences with radio tables:
11036 @itemize @minus
11037 @item
11038 Use @code{ORGLST} instead of @code{ORGTBL}.
11039 @item
11040 The available translation functions for radio lists don't take
11041 parameters.
11042 @item
11043 @kbd{C-c C-c} will work when pressed on the first item of the list.
11044 @end itemize
11046 Here is a La@TeX{} example.  Let's say that you have this in your
11047 La@TeX{} file:
11049 @cindex #+ORGLIST
11050 @example
11051 % BEGIN RECEIVE ORGLST to-buy
11052 % END RECEIVE ORGLST to-buy
11053 \begin@{comment@}
11054 #+ORGLIST: SEND to-buy orgtbl-to-latex
11055 - a new house
11056 - a new computer
11057   + a new keyboard
11058   + a new mouse
11059 - a new life
11060 \end@{comment@}
11061 @end example
11063 Pressing `C-c C-c' on @code{a new house} and will insert the converted
11064 La@TeX{} list between the two marker lines.
11066 @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Hacking
11067 @section Dynamic blocks
11068 @cindex dynamic blocks
11070 Org documents can contain @emph{dynamic blocks}.  These are
11071 specially marked regions that are updated by some user-written function.
11072 A good example for such a block is the clock table inserted by the
11073 command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
11075 Dynamic block are enclosed by a BEGIN-END structure that assigns a name
11076 to the block and can also specify parameters for the function producing
11077 the content of the block.
11079 #+BEGIN:dynamic block
11080 @example
11081 #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
11083 #+END:
11084 @end example
11086 Dynamic blocks are updated with the following commands
11088 @table @kbd
11089 @kindex C-c C-x C-u
11090 @item C-c C-x C-u
11091 Update dynamic block at point.
11092 @kindex C-u C-c C-x C-u
11093 @item C-u C-c C-x C-u
11094 Update all dynamic blocks in the current file.
11095 @end table
11097 Updating a dynamic block means to remove all the text between BEGIN and
11098 END, parse the BEGIN line for parameters and then call the specific
11099 writer function for this block to insert the new content.  If you want
11100 to use the original content in the writer function, you can use the
11101 extra parameter @code{:content}.
11103 For a block with name @code{myblock}, the writer function is
11104 @code{org-dblock-write:myblock} with as only parameter a property list
11105 with the parameters given in the begin line.  Here is a trivial example
11106 of a block that keeps track of when the block update function was last
11107 run:
11109 @example
11110 #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
11112 #+END:
11113 @end example
11115 @noindent
11116 The corresponding block writer function could look like this:
11118 @lisp
11119 (defun org-dblock-write:block-update-time (params)
11120    (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
11121      (insert "Last block update at: "
11122              (format-time-string fmt (current-time)))))
11123 @end lisp
11125 If you want to make sure that all dynamic blocks are always up-to-date,
11126 you could add the function @code{org-update-all-dblocks} to a hook, for
11127 example @code{before-save-hook}.  @code{org-update-all-dblocks} is
11128 written in a way such that it does nothing in buffers that are not in
11129 @code{org-mode}.
11131 @node Special agenda views, Extracting agenda information, Dynamic blocks, Hacking
11132 @section Special agenda views
11133 @cindex agenda views, user-defined
11135 Org provides a special hook that can be used to narrow down the
11136 selection made by any of the agenda views.  You may specify a function
11137 that is used at each match to verify if the match should indeed be part
11138 of the agenda view, and if not, how much should be skipped.
11140 Let's say you want to produce a list of projects that contain a WAITING
11141 tag anywhere in the project tree.  Let's further assume that you have
11142 marked all tree headings that define a project with the TODO keyword
11143 PROJECT.  In this case you would run a TODO search for the keyword
11144 PROJECT, but skip the match unless there is a WAITING tag anywhere in
11145 the subtree belonging to the project line.
11147 To achieve this, you must write a function that searches the subtree for
11148 the tag.  If the tag is found, the function must return @code{nil} to
11149 indicate that this match should not be skipped.  If there is no such
11150 tag, return the location of the end of the subtree, to indicate that
11151 search should continue from there.
11153 @lisp
11154 (defun my-skip-unless-waiting ()
11155   "Skip trees that are not waiting"
11156   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
11157     (if (re-search-forward ":waiting:" subtree-end t)
11158         nil          ; tag found, do not skip
11159       subtree-end))) ; tag not found, continue after end of subtree
11160 @end lisp
11162 Now you may use this function in an agenda custom command, for example
11163 like this:
11165 @lisp
11166 (org-add-agenda-custom-command
11167  '("b" todo "PROJECT"
11168    ((org-agenda-skip-function 'my-skip-unless-waiting)
11169     (org-agenda-overriding-header "Projects waiting for something: "))))
11170 @end lisp
11172 @vindex org-agenda-overriding-header
11173 Note that this also binds @code{org-agenda-overriding-header} to get a
11174 meaningful header in the agenda view.
11176 @vindex org-odd-levels-only
11177 @vindex org-agenda-skip-function
11178 A general way to create custom searches is to base them on a search for
11179 entries with a certain level limit.  If you want to study all entries with
11180 your custom search function, simply do a search for
11181 @samp{LEVEL>0}@footnote{Note that, when using @code{org-odd-levels-only}, a
11182 level number corresponds to order in the hierarchy, not to the number of
11183 stars.}, and then use @code{org-agenda-skip-function} to select the entries
11184 you really want to have.
11186 You may also put a Lisp form into @code{org-agenda-skip-function}.  In
11187 particular, you may use the functions @code{org-agenda-skip-entry-if}
11188 and @code{org-agenda-skip-subtree-if} in this form, for example:
11190 @table @code
11191 @item '(org-agenda-skip-entry-if 'scheduled)
11192 Skip current entry if it has been scheduled.
11193 @item '(org-agenda-skip-entry-if 'notscheduled)
11194 Skip current entry if it has not been scheduled.
11195 @item '(org-agenda-skip-entry-if 'deadline)
11196 Skip current entry if it has a deadline.
11197 @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
11198 Skip current entry if it has a deadline, or if it is scheduled.
11199 @item '(org-agenda-skip-entry-if 'timestamp)
11200 Skip current entry if it has any timestamp, may also be deadline or scheduled.
11201 @item '(org-agenda-skip-entry 'regexp "regular expression")
11202 Skip current entry if the regular expression matches in the entry.
11203 @item '(org-agenda-skip-entry 'notregexp "regular expression")
11204 Skip current entry unless the regular expression matches.
11205 @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
11206 Same as above, but check and skip the entire subtree.
11207 @end table
11209 Therefore we could also have written the search for WAITING projects
11210 like this, even without defining a special function:
11212 @lisp
11213 (org-add-agenda-custom-command
11214  '("b" todo "PROJECT"
11215    ((org-agenda-skip-function '(org-agenda-skip-subtree-if
11216                                 'regexp ":waiting:"))
11217     (org-agenda-overriding-header "Projects waiting for something: "))))
11218 @end lisp
11220 @node Extracting agenda information, Using the property API, Special agenda views, Hacking
11221 @section Extracting agenda information
11222 @cindex agenda, pipe
11223 @cindex Scripts, for agenda processing
11225 @vindex org-agenda-custom-commands
11226 Org provides commands to access agenda information for the command
11227 line in Emacs batch mode.  This extracted information can be sent
11228 directly to a printer, or it can be read by a program that does further
11229 processing of the data.  The first of these commands is the function
11230 @code{org-batch-agenda}, that produces an agenda view and sends it as
11231 ASCII text to STDOUT.  The command takes a single string as parameter.
11232 If the string has length 1, it is used as a key to one of the commands
11233 you have configured in @code{org-agenda-custom-commands}, basically any
11234 key you can use after @kbd{C-c a}.  For example, to directly print the
11235 current TODO list, you could use
11237 @example
11238 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
11239 @end example
11241 If the parameter is a string with 2 or more characters, it is used as a
11242 tags/TODO match string.  For example, to print your local shopping list
11243 (all items with the tag @samp{shop}, but excluding the tag
11244 @samp{NewYork}), you could use
11246 @example
11247 emacs -batch -l ~/.emacs                                      \
11248       -eval '(org-batch-agenda "+shop-NewYork")' | lpr
11249 @end example
11251 @noindent
11252 You may also modify parameters on the fly like this:
11254 @example
11255 emacs -batch -l ~/.emacs                                      \
11256    -eval '(org-batch-agenda "a"                               \
11257             org-agenda-ndays 30                               \
11258             org-agenda-include-diary nil                      \
11259             org-agenda-files (quote ("~/org/project.org")))'  \
11260    | lpr
11261 @end example
11263 @noindent
11264 which will produce a 30-day agenda, fully restricted to the Org file
11265 @file{~/org/projects.org}, not even including the diary.
11267 If you want to process the agenda data in more sophisticated ways, you
11268 can use the command @code{org-batch-agenda-csv} to get a comma-separated
11269 list of values for each agenda item.  Each line in the output will
11270 contain a number of fields separated by commas.  The fields in a line
11271 are:
11273 @example
11274 category     @r{The category of the item}
11275 head         @r{The headline, without TODO keyword, TAGS and PRIORITY}
11276 type         @r{The type of the agenda entry, can be}
11277                 todo               @r{selected in TODO match}
11278                 tagsmatch          @r{selected in tags match}
11279                 diary              @r{imported from diary}
11280                 deadline           @r{a deadline}
11281                 scheduled          @r{scheduled}
11282                 timestamp          @r{appointment, selected by timestamp}
11283                 closed             @r{entry was closed on date}
11284                 upcoming-deadline  @r{warning about nearing deadline}
11285                 past-scheduled     @r{forwarded scheduled item}
11286                 block              @r{entry has date block including date}
11287 todo         @r{The TODO keyword, if any}
11288 tags         @r{All tags including inherited ones, separated by colons}
11289 date         @r{The relevant date, like 2007-2-14}
11290 time         @r{The time, like 15:00-16:50}
11291 extra        @r{String with extra planning info}
11292 priority-l   @r{The priority letter if any was given}
11293 priority-n   @r{The computed numerical priority}
11294 @end example
11296 @noindent
11297 Time and date will only be given if a timestamp (or deadline/scheduled)
11298 led to the selection of the item.
11300 A CSV list like this is very easy to use in a post-processing script.
11301 For example, here is a Perl program that gets the TODO list from
11302 Emacs/Org and prints all the items, preceded by a checkbox:
11304 @example
11305 #!/usr/bin/perl
11307 # define the Emacs command to run
11308 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
11310 # run it and capture the output
11311 $agenda = qx@{$cmd 2>/dev/null@};
11313 # loop over all lines
11314 foreach $line (split(/\n/,$agenda)) @{
11315   # get the individual values
11316   ($category,$head,$type,$todo,$tags,$date,$time,$extra,
11317    $priority_l,$priority_n) = split(/,/,$line);
11318   # process and print
11319   print "[ ] $head\n";
11321 @end example
11336 @node Using the property API, Using the mapping API, Extracting agenda information, Hacking
11337 @section Using the property API
11338 @cindex API, for properties
11339 @cindex properties, API
11341 Here is a description of the functions that can be used to work with
11342 properties.
11344 @defun org-entry-properties &optional pom which
11345 Get all properties of the entry at point-or-marker POM.@*
11346 This includes the TODO keyword, the tags, time strings for deadline,
11347 scheduled, and clocking, and any additional properties defined in the
11348 entry.  The return value is an alist, keys may occur multiple times
11349 if the property key was used several times.@*
11350 POM may also be nil, in which case the current entry is used.
11351 If WHICH is nil or `all', get all properties.  If WHICH is
11352 `special' or `standard', only get that subclass.
11353 @end defun
11354 @vindex org-use-property-inheritance
11355 @defun org-entry-get pom property &optional inherit
11356 Get value of PROPERTY for entry at point-or-marker POM.  By default,
11357 this only looks at properties defined locally in the entry.  If INHERIT
11358 is non-nil and the entry does not have the property, then also check
11359 higher levels of the hierarchy.  If INHERIT is the symbol
11360 @code{selective}, use inheritance if and only if the setting of
11361 @code{org-use-property-inheritance} selects PROPERTY for inheritance.
11362 @end defun
11364 @defun org-entry-delete pom property
11365 Delete the property PROPERTY from entry at point-or-marker POM.
11366 @end defun
11368 @defun org-entry-put pom property value
11369 Set PROPERTY to VALUE for entry at point-or-marker POM.
11370 @end defun
11372 @defun org-buffer-property-keys &optional include-specials
11373 Get all property keys in the current buffer.
11374 @end defun
11376 @defun org-insert-property-drawer
11377 Insert a property drawer at point.
11378 @end defun
11380 @defun org-entry-put-multivalued-property pom property &rest values
11381 Set PROPERTY at point-or-marker POM to VALUES.  VALUES should be a list of
11382 strings.  They will be concatenated, with spaces as separators.
11383 @end defun
11385 @defun org-entry-get-multivalued-property pom property
11386 Treat the value of the property PROPERTY as a whitespace-separated list of
11387 values and return the values as a list of strings.
11388 @end defun
11390 @defun org-entry-add-to-multivalued-property pom property value
11391 Treat the value of the property PROPERTY as a whitespace-separated list of
11392 values and make sure that VALUE is in this list.
11393 @end defun
11395 @defun org-entry-remove-from-multivalued-property pom property value
11396 Treat the value of the property PROPERTY as a whitespace-separated list of
11397 values and make sure that VALUE is @emph{not} in this list.
11398 @end defun
11400 @defun org-entry-member-in-multivalued-property pom property value
11401 Treat the value of the property PROPERTY as a whitespace-separated list of
11402 values and check if VALUE is in this list.
11403 @end defun
11405 @node Using the mapping API,  , Using the property API, Hacking
11406 @section Using the mapping API
11407 @cindex API, for mapping
11408 @cindex mapping entries, API
11410 Org has sophisticated mapping capabilities to find all entries satisfying
11411 certain criteria.  Internally, this functionality is used to produce agenda
11412 views, but there is also an API that can be used to execute arbitrary
11413 functions for each or selected entries.  The main entry point for this API
11416 @defun org-map-entries func &optional match scope &rest skip
11417 Call FUNC at each headline selected by MATCH in SCOPE.
11419 FUNC is a function or a Lisp form.  The function will be called without
11420 arguments, with the cursor positioned at the beginning of the headline.
11421 The return values of all calls to the function will be collected and
11422 returned as a list.
11424 The call to FUNC will be wrapped into a save-excursion form, so FUNC
11425 does not need to preserve point.  After evaluaton, the cursor will be
11426 moved to the end of the line (presumably of the headline of the
11427 processed entry) and search continues from there.  Under some
11428 circumstances, this may not produce the wanted results.  For example,
11429 if you have removed (@eg archived) the current (sub)tree it could
11430 mean that the next entry will be skipped entirely.  In such cases, you
11431 can specify the position from where search should continue by making
11432 FUNC set the variable `org-map-continue-from' to the desired buffer
11433 position.
11435 MATCH is a tags/property/todo match as it is used in the agenda match view.
11436 Only headlines that are matched by this query will be considered during
11437 the iteration.  When MATCH is nil or t, all headlines will be
11438 visited by the iteration.
11440 SCOPE determines the scope of this command.  It can be any of:
11442 @example
11443 nil     @r{the current buffer, respecting the restriction if any}
11444 tree    @r{the subtree started with the entry at point}
11445 file    @r{the current buffer, without restriction}
11446 file-with-archives
11447         @r{the current buffer, and any archives associated with it}
11448 agenda  @r{all agenda files}
11449 agenda-with-archives
11450         @r{all agenda files with any archive files associated with them}
11451 (file1 file2 ...)
11452         @r{if this is a list, all files in the list will be scanned}
11453 @end example
11454 @noindent
11455 The remaining args are treated as settings for the skipping facilities of
11456 the scanner.  The following items can be given here:
11458 @vindex org-agenda-skip-function
11459 @example
11460 archive   @r{skip trees with the archive tag}
11461 comment   @r{skip trees with the COMMENT keyword}
11462 function or Lisp form
11463           @r{will be used as value for @code{org-agenda-skip-function},}
11464           @r{so whenever the function returns t, FUNC}
11465           @r{will not be called for that entry and search will}
11466           @r{continue from the point where the function leaves it}
11467 @end example
11468 @end defun
11470 The function given to that mapping routine can really do anything you like.
11471 It can use the property API (@pxref{Using the property API}) to gather more
11472 information about the entry, or in order to change metadata in the entry.
11473 Here are a couple of functions that might be handy:
11475 @defun org-todo &optional arg
11476 Change the TODO state of the entry, see the docstring of the functions for
11477 the many possible values for the argument ARG.
11478 @end defun
11480 @defun org-priority &optional action
11481 Change the priority of the entry, see the docstring of this function for the
11482 possible values for ACTION.
11483 @end defun
11485 @defun org-toggle-tag tag &optional onoff
11486 Toggle the tag TAG in the current entry.  Setting ONOFF to either @code{on}
11487 or @code{off} will not toggle tag, but ensure that it is either on or off.
11488 @end defun
11490 @defun org-promote
11491 Promote the current entry.
11492 @end defun
11494 @defun org-demote
11495 Demote the current entry.
11496 @end defun
11498 Here is a simple example that will turn all entries in the current file with
11499 a tag @code{TOMORROW} into TODO entries with the keyword @code{UPCOMING}.
11500 Entries in comment trees and in archive trees will be ignored.
11502 @lisp
11503 (org-map-entries
11504    '(org-todo "UPCOMING")
11505    "+TOMORROW" 'file 'archive 'comment)
11506 @end lisp
11508 The following example counts the number of entries with TODO keyword
11509 @code{WAITING}, in all agenda files.
11511 @lisp
11512 (length (org-map-entries t "/+WAITING" 'agenda))
11513 @end lisp
11515 @node History and Acknowledgments, Main Index, Hacking, Top
11516 @appendix History and Acknowledgments
11517 @cindex acknowledgments
11518 @cindex history
11519 @cindex thanks
11521 Org was born in 2003, out of frustration over the user interface
11522 of the Emacs Outline mode.  I was trying to organize my notes and
11523 projects, and using Emacs seemed to be the natural way to go.  However,
11524 having to remember eleven different commands with two or three keys per
11525 command, only to hide and show parts of the outline tree, that seemed
11526 entirely unacceptable to me.  Also, when using outlines to take notes, I
11527 constantly wanted to restructure the tree, organizing it parallel to my
11528 thoughts and plans.  @emph{Visibility cycling} and @emph{structure
11529 editing} were originally implemented in the package
11530 @file{outline-magic.el}, but quickly moved to the more general
11531 @file{org.el}.  As this environment became comfortable for project
11532 planning, the next step was adding @emph{TODO entries}, basic 
11533 @emph{timestamps}, and @emph{table support}.  These areas highlighted the two main
11534 goals that Org still has today: To be a new, outline-based,
11535 plain text mode with innovative and intuitive editing features, and to
11536 incorporate project planning functionality directly into a notes file.
11538 A special thanks goes to @i{Bastien Guerry} who has not only written a large
11539 number of extensions to Org (most of them integrated into the core by now),
11540 but who has also helped in the development and maintenance of Org so much that he
11541 should be considered the main co-contributor to this package.
11543 Since the first release, literally thousands of emails to me or to
11544 @email{emacs-orgmode@@gnu.org} have provided a constant stream of bug
11545 reports, feedback, new ideas, and sometimes patches and add-on code.
11546 Many thanks to everyone who has helped to improve this package.  I am
11547 trying to keep here a list of the people who had significant influence
11548 in shaping one or more aspects of Org.  The list may not be
11549 complete, if I have forgotten someone, please accept my apologies and
11550 let me know.
11552 @itemize @bullet
11554 @item
11555 @i{Russel Adams} came up with the idea for drawers.
11556 @item
11557 @i{Thomas Baumann} wrote @file{org-bbdb.el} and @file{org-mhe.el}.
11558 @item
11559 @i{Christophe Bataillon} created the great unicorn logo that we use on the
11560 Org-mode website.
11561 @item
11562 @i{Alex Bochannek} provided a patch for rounding timestamps.
11563 @item
11564 @i{Brad Bozarth} showed how to pull RSS feed data into Org-mode files.
11565 @item
11566 @i{Tom Breton} wrote @file{org-choose.el}.
11567 @item
11568 @i{Charles Cave}'s suggestion sparked the implementation of templates
11569 for Remember.
11570 @item
11571 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
11572 specified time.
11573 @item
11574 @i{Gregory Chernov} patched support for Lisp forms into table
11575 calculations and improved XEmacs compatibility, in particular by porting
11576 @file{nouline.el} to XEmacs.
11577 @item
11578 @i{Sacha Chua} suggested copying some linking code from Planner.
11579 @item
11580 @i{Baoqiu Cui} contributed the DocBook exporter.
11581 @item
11582 @i{Eddward DeVilla} proposed and tested checkbox statistics.  He also
11583 came up with the idea of properties, and that there should be an API for
11584 them.
11585 @item
11586 @i{Nick Dokos} tracked down several nasty bugs.
11587 @item
11588 @i{Kees Dullemond} used to edit projects lists directly in HTML and so
11589 inspired some of the early development, including HTML export.  He also
11590 asked for a way to narrow wide table columns.
11591 @item
11592 @i{Christian Egli} converted the documentation into Texinfo format,
11593 patched CSS formatting into the HTML exporter, and inspired the agenda.
11594 @item
11595 @i{David Emery} provided a patch for custom CSS support in exported
11596 HTML agendas.
11597 @item
11598 @i{Nic Ferrier} contributed mailcap and XOXO support.
11599 @item
11600 @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
11601 @item
11602 @i{John Foerch} figured out how to make incremental search show context
11603 around a match in a hidden outline tree.
11604 @item
11605 @i{Niels Giesen} had the idea to automatically archive DONE trees.
11606 @item
11607 @i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and
11608 has been prolific with patches, ideas, and bug reports.
11609 @item
11610 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
11611 @item
11612 @i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
11613 task state change logging, and the clocktable.  His clear explanations have
11614 been critical when we started to adopt the Git version control system.
11615 @item
11616 @i{Manuel Hermenegildo} has contributed various ideas, small fixes and
11617 patches.
11618 @item
11619 @i{Phil Jackson} wrote @file{org-irc.el}.
11620 @item
11621 @i{Scott Jaderholm} proposed footnotes, control over whitespace between
11622 folded entries, and column view for properties.
11623 @item
11624 @i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}.
11625 @item
11626 @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it.  He also
11627 provided frequent feedback and some patches.
11628 @item
11629 @i{Matt Lundin} has proposed last-row references for table formulas and named
11630 invisible anchors.  He has also worked a lot on the FAQ.
11631 @item
11632 @i{Jason F. McBrayer} suggested agenda export to CSV format.
11633 @item
11634 @i{Max Mikhanosha} came up with the idea of refiling.
11635 @item
11636 @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
11637 basis.
11638 @item
11639 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
11640 happy.
11641 @item
11642 @i{Rick Moynihan} proposed allowing multiple TODO sequences in a file
11643 and being able to quickly restrict the agenda to a subtree.
11644 @item
11645 @i{Todd Neal} provided patches for links to Info files and Elisp forms.
11646 @item
11647 @i{Greg Newman} refreshed the unicorn logo into its current form.
11648 @item
11649 @i{Tim O'Callaghan} suggested in-file links, search options for general
11650 file links, and TAGS.
11651 @item
11652 @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
11653 into Japanese.
11654 @item
11655 @i{Oliver Oppitz} suggested multi-state TODO items.
11656 @item
11657 @i{Scott Otterson} sparked the introduction of descriptive text for
11658 links, among other things.
11659 @item
11660 @i{Pete Phillips} helped during the development of the TAGS feature, and
11661 provided frequent feedback.
11662 @item
11663 @i{Martin Pohlack} provided the code snippet to bundle character insertion
11664 into bundles of 20 for undo.
11665 @item
11666 @i{T.V. Raman} reported bugs and suggested improvements.
11667 @item
11668 @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
11669 control.
11670 @item
11671 @i{Paul Rivier} provided the basic implementation of named footnotes.
11672 @item
11673 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
11674 @item
11675 @i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
11676 webpages derived from Org using an Info-like or a folding interface with
11677 single-key navigation.
11678 @item
11679 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
11680 conflict with @file{allout.el}.
11681 @item
11682 @i{Jason Riedy} generalized the send-receive mechanism for Orgtbl tables with
11683 extensive patches.
11684 @item
11685 @i{Philip Rooke} created the Org reference card, provided lots
11686 of feedback, developed and applied standards to the Org documentation.
11687 @item
11688 @i{Christian Schlauer} proposed angular brackets around links, among
11689 other things.
11690 @item
11691 @i{Eric Schulte} wrote @file{org-plot.el} and contributed various patches,
11692 small features and modules.
11693 @item
11694 Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s
11695 @file{organizer-mode.el}.
11696 @item
11697 @i{Ilya Shlyakhter} proposed the Archive Sibling, line numbering in literal
11698 examples, and remote highlighting for referenced code lines.
11699 @item
11700 @i{Stathis Sideris} wrote the @file{ditaa.jar} ASCII to PNG converter that is
11701 now packaged into Org's @file{contrib} directory.
11702 @item
11703 @i{Daniel Sinder} came up with the idea of internal archiving by locking
11704 subtrees.
11705 @item
11706 @i{Dale Smith} proposed link abbreviations.
11707 @item
11708 @i{James TD Smith} has contributed a large number of patches for useful
11709 tweaks and features.
11710 @item
11711 @i{Adam Spiers} asked for global linking commands, inspired the link
11712 extension system, added support for mairix, and proposed the mapping API.
11713 @item
11714 @i{Andy Stewart} contributed code to @file{org-w3m.el}, to copy HTML content
11715 with links transformation to Org syntax.
11716 @item
11717 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
11718 chapter about publishing.
11719 @item
11720 @i{J@"urgen Vollmer} contributed code generating the table of contents
11721 in HTML output.
11722 @item
11723 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
11724 keyword.
11725 @item
11726 @i{David Wainberg} suggested archiving, and improvements to the linking
11727 system.
11728 @item
11729 @i{John Wiegley} wrote @file{emacs-wiki.el}, @file{planner.el}, and
11730 @file{muse.el}, which have some overlap with Org.  Initially the development
11731 of Org was fully independent because I was not aware of the existence of
11732 these packages.  But with time I have occasionally looked at John's code and
11733 learned a lot from it.  John has also contributed a number of great ideas and
11734 patches directly to Org, including the attachment system
11735 (@file{org-attach.el}), integration with Apple Mail
11736 (@file{org-mac-message.el}), and hierarchical dependencies of TODO items.
11737 @item
11738 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
11739 linking to Gnus.
11740 @item
11741 @i{Roland Winkler} requested additional key bindings to make Org
11742 work on a tty.
11743 @item
11744 @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
11745 and contributed various ideas and code snippets.
11746 @end itemize
11749 @node Main Index, Key Index, History and Acknowledgments, Top
11750 @unnumbered Concept Index
11752 @printindex cp
11754 @node Key Index, Variable Index, Main Index, Top
11755 @unnumbered Key Index
11757 @printindex ky
11759 @node Variable Index,  , Key Index, Top
11760 @unnumbered Variable Index
11762 This is not a complete index of variables and faces, only the ones that are
11763 mentioned in the manual.  For a more complete list, use @kbd{M-x
11764 org-customize @key{RET}} and then klick yourself through the tree.
11766 @printindex vr
11768 @bye
11770 @ignore
11771         arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
11772 @end ignore
11774 @c Local variables:
11775 @c ispell-local-dictionary: "en_US-w_accents"
11776 @c ispell-local-pdict: "./.aspell.org.pws"
11777 @c fill-column: 77
11778 @c End: