Version number bump, 6.00pre-6
[org-mode.git] / doc / org.texi
blob4dd252129fe6967511a72503f92c6e8b5f5d2ffc
1 \input texinfo
2 @c %**start of header
3 @setfilename ../../info/org
4 @settitle The Org Manual
6 @set VERSION 6.00pre-6
7 @set DATE April 2008
9 @dircategory Emacs
10 @direntry
11 * Org Mode: (org).      Outline-based notes management and organizer
12 @end direntry
14 @c Version and Contact Info
15 @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
16 @set AUTHOR Carsten Dominik
17 @set MAINTAINER Carsten Dominik
18 @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
19 @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
20 @c %**end of header
21 @finalout
23 @c Macro definitions
25 @c Subheadings inside a table.
26 @macro tsubheading{text}
27 @ifinfo
28 @subsubheading \text\
29 @end ifinfo
30 @ifnotinfo
31 @item @b{\text\}
32 @end ifnotinfo
33 @end macro
35 @copying
36 This manual is for Org (version @value{VERSION}).
38 Copyright @copyright{} 2004, 2005, 2006, 2007, 2008 Free Software Foundation
40 @quotation
41 Permission is granted to copy, distribute and/or modify this document
42 under the terms of the GNU Free Documentation License, Version 1.1 or
43 any later version published by the Free Software Foundation; with no
44 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
45 and with the Back-Cover Texts as in (a) below.  A copy of the
46 license is included in the section entitled ``GNU Free Documentation
47 License.''
49 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
50 this GNU Manual, like GNU software.  Copies published by the Free
51 Software Foundation raise funds for GNU development.''
52 @end quotation
53 @end copying
55 @titlepage
56 @title The Org Manual
58 @subtitle Release @value{VERSION}
59 @author by Carsten Dominik
61 @c The following two commands start the copyright page.
62 @page
63 @vskip 0pt plus 1filll
64 @insertcopying
65 @end titlepage
67 @c Output the table of contents at the beginning.
68 @contents
70 @ifnottex
71 @node Top, Introduction, (dir), (dir)
72 @top Org Mode Manual
74 @insertcopying
75 @end ifnottex
77 @menu
78 * Introduction::                Getting started
79 * Document Structure::          A tree works like your brain
80 * Tables::                      Pure magic for quick formatting
81 * Hyperlinks::                  Notes in context
82 * TODO Items::                  Every tree branch can be a TODO item
83 * Tags::                        Tagging headlines and matching sets of tags
84 * Properties and Columns::      Storing information about an entry
85 * Dates and Times::             Making items useful for planning
86 * Remember::                    Quickly adding nodes to the outline tree
87 * Agenda Views::                Collecting information into views
88 * Embedded LaTeX::              LaTeX fragments and formulas
89 * Exporting::                   Sharing and publishing of notes
90 * Publishing::                  Create a web site of linked Org files
91 * Miscellaneous::               All the rest which did not fit elsewhere
92 * Extensions and Hacking::      It is possible to write add-on code
93 * History and Acknowledgments::  How Org came into being
94 * Main Index::                  An index of Org's concepts and features
95 * Key Index::                   Key bindings and where they are described
97 @detailmenu
98  --- The Detailed Node Listing ---
100 Introduction
102 * Summary::                     Brief summary of what Org does
103 * Installation::                How to install a downloaded version of Org
104 * Activation::                  How to activate Org for certain buffers
105 * Feedback::                    Bug reports, ideas, patches etc.
106 * Conventions::                 Type-setting conventions in the manual
108 Document Structure
110 * Outlines::                    Org is based on Outline mode
111 * Headlines::                   How to typeset Org tree headlines
112 * Visibility cycling::          Show and hide, much simplified
113 * Motion::                      Jumping to other headlines
114 * Structure editing::           Changing sequence and level of headlines
115 * Archiving::                   Move done task trees to a different place
116 * Sparse trees::                Matches embedded in context
117 * Plain lists::                 Additional structure within an entry
118 * Drawers::                     Tucking stuff away
119 * Orgstruct mode::              Structure editing outside Org
121 Archiving
123 * ARCHIVE tag::                 Marking a tree as inactive
124 * Moving subtrees::             Moving a tree to an archive file
126 Tables
128 * Built-in table editor::       Simple tables
129 * Narrow columns::              Stop wasting space in tables
130 * Column groups::               Grouping to trigger vertical lines
131 * Orgtbl mode::                 The table editor as minor mode
132 * The spreadsheet::             The table editor has spreadsheet capabilities
134 The spreadsheet
136 * References::                  How to refer to another field or range
137 * Formula syntax for Calc::     Using Calc to compute stuff
138 * Formula syntax for Lisp::     Writing formulas in Emacs Lisp
139 * Field formulas::              Formulas valid for a single field
140 * Column formulas::             Formulas valid for an entire column
141 * Editing and debugging formulas::  Fixing formulas
142 * Updating the table::          Recomputing all dependent fields
143 * Advanced features::           Field names, parameters and automatic recalc
145 Hyperlinks
147 * Link format::                 How links in Org are formatted
148 * Internal links::              Links to other places in the current file
149 * External links::              URL-like links to the world
150 * Handling links::              Creating, inserting and following
151 * Using links outside Org::     Linking from my C source code?
152 * Link abbreviations::          Shortcuts for writing complex links
153 * Search options::              Linking to a specific location
154 * Custom searches::             When the default search is not enough
156 Internal links
158 * Radio targets::               Make targets trigger links in plain text
160 TODO Items
162 * TODO basics::                 Marking and displaying TODO entries
163 * TODO extensions::             Workflow and assignments
164 * Progress logging::            Dates and notes for progress
165 * Priorities::                  Some things are more important than others
166 * Breaking down tasks::         Splitting a task into manageable pieces
167 * Checkboxes::                  Tick-off lists
169 Extended use of TODO keywords
171 * Workflow states::             From TODO to DONE in steps
172 * TODO types::                  I do this, Fred does the rest
173 * Multiple sets in one file::   Mixing it all, and still finding your way
174 * Fast access to TODO states::  Single letter selection of a state
175 * Per-file keywords::           Different files, different requirements
176 * Faces for TODO keywords::     Highlighting states
178 Progress logging
180 * Closing items::               When was this entry marked DONE?
181 * Tracking TODO state changes::  When did the status change?
183 Tags
185 * Tag inheritance::             Tags use the tree structure of the outline
186 * Setting tags::                How to assign tags to a headline
187 * Tag searches::                Searching for combinations of tags
189 Properties and Columns
191 * Property syntax::             How properties are spelled out
192 * Special properties::          Access to other Org mode features
193 * Property searches::           Matching property values
194 * Property inheritance::        Passing values down the tree
195 * Column view::                 Tabular viewing and editing
196 * Property API::                Properties for Lisp programmers
198 Column view
200 * Defining columns::            The COLUMNS format property
201 * Using column view::           How to create and use column view
202 * Capturing column view::       A dynamic block for column view
204 Defining columns
206 * Scope of column definitions::  Where defined, where valid?
207 * Column attributes::           Appearance and content of a column
209 Dates and Times
211 * Timestamps::                  Assigning a time to a tree entry
212 * Creating timestamps::         Commands which insert timestamps
213 * Deadlines and scheduling::    Planning your work
214 * Clocking work time::          Tracking how long you spend on a task
216 Creating timestamps
218 * The date/time prompt::        How Org mode helps you entering date and time
219 * Custom time format::          Making dates look different
221 Deadlines and scheduling
223 * Inserting deadline/schedule::  Planning items
224 * Repeated tasks::              Items that show up again and again
226 Remember
228 * Setting up Remember::         Some code for .emacs to get things going
229 * Remember templates::          Define the outline of different note types
230 * Storing notes::               Directly get the note to where it belongs
231 * Refiling notes::              Moving a note or task to a project
233 Agenda Views
235 * Agenda files::                Files being searched for agenda information
236 * Agenda dispatcher::           Keyboard access to agenda views
237 * Built-in agenda views::       What is available out of the box?
238 * Presentation and sorting::    How agenda items are prepared for display
239 * Agenda commands::             Remote editing of Org trees
240 * Custom agenda views::         Defining special searches and views
242 The built-in agenda views
244 * Weekly/daily agenda::         The calendar page with current tasks
245 * Global TODO list::            All unfinished action items
246 * Matching tags and properties::  Structured information with fine-tuned search
247 * Timeline::                    Time-sorted view for single file
248 * Keyword search::              Finding entries by keyword
249 * Stuck projects::              Find projects you need to review
251 Presentation and sorting
253 * Categories::                  Not all tasks are equal
254 * Time-of-day specifications::  How the agenda knows the time
255 * Sorting of agenda items::     The order of things
257 Custom agenda views
259 * Storing searches::            Type once, use often
260 * Block agenda::                All the stuff you need in a single buffer
261 * Setting Options::             Changing the rules
262 * Exporting Agenda Views::      Writing agendas to files
263 * Using the agenda elsewhere::  Using agenda information in other programs
265 Embedded LaTeX
267 * Math symbols::                TeX macros for symbols and Greek letters
268 * Subscripts and superscripts::  Simple syntax for raising/lowering text
269 * LaTeX fragments::             Complex formulas made easy
270 * Processing LaTeX fragments::  Previewing LaTeX processing
271 * CDLaTeX mode::                Speed up entering of formulas
273 Exporting
275 * ASCII export::                Exporting to plain ASCII
276 * HTML export::                 Exporting to HTML
277 * LaTeX export::                Exporting to LaTeX
278 * XOXO export::                 Exporting to XOXO
279 * iCalendar export::            Exporting in iCalendar format
280 * Text interpretation::         How the exporter looks at the file
282 HTML export
284 * HTML Export commands::        How to invoke LaTeX export
285 * Quoting HTML tags::           Using direct HTML in Org mode
286 * Links::                       Transformation of links for HTML
287 * Images::                      How to include images
288 * CSS support::                 Changing the appearance of the output
289 * Javascript support::          Info and Folding in a web browser
291 LaTeX export
293 * LaTeX export commands::       How to invoke LaTeX export
294 * Quoting LaTeX code::          Incorporating literal LaTeX code
295 * Sectioning structure::        Changing sectioning in LaTeX output
297 Text interpretation by the exporter
299 * Comment lines::               Some lines will not be exported
300 * Initial text::                Text before the first headline
301 * Footnotes::                   Numbers like [1]
302 * Quoted examples::             Inserting quoted chunks of text
303 * Enhancing text::              Subscripts, symbols and more
304 * Export options::              How to influence the export settings
306 Publishing
308 * Configuration::               Defining projects
309 * Sample configuration::        Example projects
310 * Triggering publication::      Publication commands
312 Configuration
314 * Project alist::               The central configuration variable
315 * Sources and destinations::    From here to there
316 * Selecting files::             What files are part of the project?
317 * Publishing action::           Setting the function doing the publishing
318 * Publishing options::          Tweaking HTML export
319 * Publishing links::            Which links keep working after publishing?
320 * Project page index::          Publishing a list of project files
322 Sample configuration
324 * Simple example::              One-component publishing
325 * Complex example::             A multi-component publishing example
327 Miscellaneous
329 * Completion::                  M-TAB knows what you need
330 * Customization::               Adapting Org to your taste
331 * In-buffer settings::          Overview of the #+KEYWORDS
332 * The very busy C-c C-c key::   When in doubt, press C-c C-c
333 * Clean view::                  Getting rid of leading stars in the outline
334 * TTY keys::                    Using Org on a tty
335 * Interaction::                 Other Emacs packages
336 * Bugs::                        Things which do not work perfectly
338 Interaction with other packages
340 * Cooperation::                 Packages Org cooperates with
341 * Conflicts::                   Packages that lead to conflicts
343 Extensions, Hooks and Hacking
345 * Extensions::                  Existing 3rd-party extensions
346 * Adding hyperlink types::      New custom link types
347 * Tables in arbitrary syntax::  Orgtbl for LaTeX and other programs
348 * Dynamic blocks::              Automatically filled blocks
349 * Special agenda views::        Customized views
350 * Using the property API::      Writing programs that use entry properties
352 Tables and lists in arbitrary syntax
354 * Radio tables::                Sending and receiving
355 * A LaTeX example::             Step by step, almost a tutorial
356 * Translator functions::        Copy and modify
357 * Radio lists::                 Doing the same for lists
359 @end detailmenu
360 @end menu
362 @node Introduction, Document Structure, Top, Top
363 @chapter Introduction
364 @cindex introduction
366 @menu
367 * Summary::                     Brief summary of what Org does
368 * Installation::                How to install a downloaded version of Org
369 * Activation::                  How to activate Org for certain buffers
370 * Feedback::                    Bug reports, ideas, patches etc.
371 * Conventions::                 Type-setting conventions in the manual
372 @end menu
374 @node Summary, Installation, Introduction, Introduction
375 @section Summary
376 @cindex summary
378 Org is a mode for keeping notes, maintaining TODO lists, and doing
379 project planning with a fast and effective plain-text system.
381 Org develops organizational tasks around NOTES files that contain
382 lists or information about projects as plain text.  Org is
383 implemented on top of Outline mode, which makes it possible to keep the
384 content of large files well structured.  Visibility cycling and
385 structure editing help to work with the tree.  Tables are easily created
386 with a built-in table editor.  Org supports TODO items, deadlines,
387 time stamps, and scheduling.  It dynamically compiles entries into an
388 agenda that utilizes and smoothly integrates much of the Emacs calendar
389 and diary.  Plain text URL-like links connect to websites, emails,
390 Usenet messages, BBDB entries, and any files related to the projects.
391 For printing and sharing of notes, an Org file can be exported as a
392 structured ASCII file, as HTML, or (TODO and agenda items only) as an
393 iCalendar file.  It can also serve as a publishing tool for a set of
394 linked web pages.
396 An important design aspect that distinguishes Org from for example
397 Planner/Muse is that it encourages to store every piece of information
398 only once.  In Planner, you have project pages, day pages and possibly
399 other files, duplicating some information such as tasks.  In Org,
400 you only have notes files.  In your notes you mark entries as tasks,
401 label them with tags and timestamps.  All necessary lists like a
402 schedule for the day, the agenda for a meeting, tasks lists selected by
403 tags etc are created dynamically when you need them.
405 Org keeps simple things simple.  When first fired up, it should
406 feel like a straightforward, easy to use outliner.  Complexity is not
407 imposed, but a large amount of functionality is available when you need
408 it.  Org is a toolbox and can be used in different ways, for
409 example as:
411 @example
412 @r{@bullet{} outline extension with visibility cycling and structure editing}
413 @r{@bullet{} ASCII system and table editor for taking structured notes}
414 @r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
415 @r{@bullet{} TODO list editor}
416 @r{@bullet{} full agenda and planner with deadlines and work scheduling}
417 @r{@bullet{} environment to implement David Allen's GTD system}
418 @r{@bullet{} a basic database application}
419 @r{@bullet{} simple hypertext system, with HTML and LaTeX export}
420 @r{@bullet{} publishing tool to create a set of interlinked webpages}
421 @end example
423 Org's automatic, context sensitive table editor with spreadsheet
424 capabilities can be integrated into any major mode by activating the
425 minor Orgtbl mode.  Using a translation step, it can be used to maintain
426 tables in arbitrary file types, for example in La@TeX{}.  The structure
427 editing and list creation capabilities can be used outside Org with
428 the minor Orgstruct mode.
430 @cindex FAQ
431 There is a website for Org which provides links to the newest
432 version of Org, as well as additional information, frequently asked
433 questions (FAQ), links to tutorials etc.  This page is located at
434 @uref{http://orgmode.org}.
436 @page
439 @node Installation, Activation, Summary, Introduction
440 @section Installation
441 @cindex installation
442 @cindex XEmacs
444 @b{Important:} @i{If Org is part of the Emacs distribution or an
445 XEmacs package, please skip this section and go directly to
446 @ref{Activation}.}
448 If you have downloaded Org from the Web, either as a distribution @file{.zip}
449 or @file{.tar} file, or as a GIT archive, you must take the following steps
450 to install it: Go into the unpacked Org distribution directory and edit the
451 top section of the file @file{Makefile}.  You must set the name of the Emacs
452 binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
453 directories where local Lisp and Info files are kept.  If you don't have
454 access to the system-wide directories, you can simply run Org directly from
455 the distribution directory by adding the @file{lisp} subdirectory to the
456 Emacs load path.  To do this, add the following line to @file{.emacs}:
458 @example
459 (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
460 @end example
462 @noindent
463 If you plan to use code from the @file{contrib} subdirectory, do a similar
464 step for this directory:
466 @example
467 (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
468 @end example
470 @b{XEmacs users now need to install the file @file{noutline.el} from
471 the @file{xemacs} sub-directory of the Org distribution.  Use the
472 command:}
474 @example
475 @b{make install-noutline}
476 @end example
478 @noindent Now byte-compile the Lisp files with the shell command:
480 @example
481 make
482 @end example
484 @noindent If you are running Org from the distribution directory, this is
485 all.  If you want to install into the system directories, use
487 @example
488 make install
489 make install-info
490 @end example
492 @noindent Then add to @file{.emacs}:
494 @lisp
495 ;; This line only if Org is not part of the X/Emacs distribution.
496 (require 'org-install)
497 @end lisp
500 @node Activation, Feedback, Installation, Introduction
501 @section Activation
502 @cindex activation
503 @cindex autoload
504 @cindex global key bindings
505 @cindex key bindings, global
507 @iftex
508 @b{Important:} @i{If you use copy-and-paste to copy lisp code from the
509 PDF documentation as viewed by Acrobat reader to your .emacs file, the
510 single quote character comes out incorrectly and the code will not work.
511 You need to fix the single quotes by hand, or copy from Info
512 documentation.}
513 @end iftex
515 Add the following lines to your @file{.emacs} file.  The last two lines
516 define @emph{global} keys for the commands @command{org-store-link} and
517 @command{org-agenda} - please choose suitable keys yourself.
519 @lisp
520 ;; The following lines are always needed.  Choose your own keys.
521 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
522 (global-set-key "\C-cl" 'org-store-link)
523 (global-set-key "\C-ca" 'org-agenda)
524 @end lisp
526 Furthermore, you must activate @code{font-lock-mode} in Org
527 buffers, because significant functionality depends on font-locking being
528 active.  You can do this with either one of the following two lines
529 (XEmacs user must use the second option):
530 @lisp
531 (global-font-lock-mode 1)                     ; for all buffers
532 (add-hook 'org-mode-hook 'turn-on-font-lock)  ; Org buffers only
533 @end lisp
535 @cindex Org mode, turning on
536 With this setup, all files with extension @samp{.org} will be put
537 into Org mode.  As an alternative, make the first line of a file look
538 like this:
540 @example
541 MY PROJECTS    -*- mode: org; -*-
542 @end example
544 @noindent which will select Org mode for this buffer no matter what
545 the file's name is.  See also the variable
546 @code{org-insert-mode-line-in-empty-file}.
548 @node Feedback, Conventions, Activation, Introduction
549 @section Feedback
550 @cindex feedback
551 @cindex bug reports
552 @cindex maintainer
553 @cindex author
555 If you find problems with Org, or if you have questions, remarks,
556 or ideas about it, please contact the maintainer @value{MAINTAINER} at
557 @value{MAINTAINEREMAIL}.
559 For bug reports, please provide as much information as possible,
560 including the version information of Emacs (@kbd{C-h v emacs-version
561 @key{RET}}) and Org (@kbd{C-h v org-version @key{RET}}), as well as
562 the Org related setup in @file{.emacs}.  If an error occurs, a
563 backtrace can be very useful (see below on how to create one).  Often a
564 small example file helps, along with clear information about:
566 @enumerate
567 @item What exactly did you do?
568 @item What did you expect to happen?
569 @item What happened instead?
570 @end enumerate
571 @noindent Thank you for helping to improve this mode.
573 @subsubheading How to create a useful backtrace
575 @cindex backtrace of an error
576 If working with Org produces an error with a message you don't
577 understand, you may have hit a bug.  The best way to report this is by
578 providing, in addition to what was mentioned above, a @emph{Backtrace}.
579 This is information from the built-in debugger about where and how the
580 error occurred.  Here is how to produce a useful backtrace:
582 @enumerate
583 @item
584 Start a fresh Emacs or XEmacs, and make sure that it will load the
585 original Lisp code in @file{org.el} instead of the compiled version in
586 @file{org.elc}.  The backtrace contains much more information if it is
587 produced with uncompiled code.  To do this, either rename @file{org.elc}
588 to something else before starting Emacs, or ask Emacs explicitly to load
589 @file{org.el} by using the command line
590 @example
591 emacs -l /path/to/org.el
592 @end example
593 @item
594 Go to the @code{Options} menu and select @code{Enter Debugger on Error}
595 (XEmacs has this option in the @code{Troubleshooting} sub-menu).
596 @item
597 Do whatever you have to do to hit the error.  Don't forget to
598 document the steps you take.
599 @item
600 When you hit the error, a @file{*Backtrace*} buffer will appear on the
601 screen.  Save this buffer to a file (for example using @kbd{C-x C-w}) and
602 attach it to your bug report.
603 @end enumerate
605 @node Conventions,  , Feedback, Introduction
606 @section Typesetting conventions used in this manual
608 Org uses three types of keywords: TODO keywords, tags, and property
609 names.  In this manual we use the following conventions:
611 @table @code
612 @item TODO
613 @itemx WAITING
614 TODO keywords are written with all capitals, even if they are
615 user-defined.
616 @item boss
617 @itemx ARCHIVE
618 User-defined tags are written in lowercase; built-in tags with special
619 meaning are written with all capitals.
620 @item Release
621 @itemx PRIORITY
622 User-defined properties are capitalized; built-in properties with
623 special meaning are written with all capitals.
624 @end table
626 @node Document Structure, Tables, Introduction, Top
627 @chapter Document Structure
628 @cindex document structure
629 @cindex structure of document
631 Org is based on outline mode and provides flexible commands to
632 edit the structure of the document.
634 @menu
635 * Outlines::                    Org is based on Outline mode
636 * Headlines::                   How to typeset Org tree headlines
637 * Visibility cycling::          Show and hide, much simplified
638 * Motion::                      Jumping to other headlines
639 * Structure editing::           Changing sequence and level of headlines
640 * Archiving::                   Move done task trees to a different place
641 * Sparse trees::                Matches embedded in context
642 * Plain lists::                 Additional structure within an entry
643 * Drawers::                     Tucking stuff away
644 * Orgstruct mode::              Structure editing outside Org
645 @end menu
647 @node Outlines, Headlines, Document Structure, Document Structure
648 @section Outlines
649 @cindex outlines
650 @cindex Outline mode
652 Org is implemented on top of Outline mode.  Outlines allow a
653 document to be organized in a hierarchical structure, which (at least
654 for me) is the best representation of notes and thoughts.  An overview
655 of this structure is achieved by folding (hiding) large parts of the
656 document to show only the general document structure and the parts
657 currently being worked on.  Org greatly simplifies the use of
658 outlines by compressing the entire show/hide functionality into a single
659 command @command{org-cycle}, which is bound to the @key{TAB} key.
661 @node Headlines, Visibility cycling, Outlines, Document Structure
662 @section Headlines
663 @cindex headlines
664 @cindex outline tree
666 Headlines define the structure of an outline tree.  The headlines in
667 Org start with one or more stars, on the left margin@footnote{See
668 the variable @code{org-special-ctrl-a/e} to configure special behavior
669 of @kbd{C-a} and @kbd{C-e} in headlines.}.  For example:
671 @example
672 * Top level headline
673 ** Second level
674 *** 3rd level
675     some text
676 *** 3rd level
677     more text
679 * Another top level headline
680 @end example
682 @noindent Some people find the many stars too noisy and would prefer an
683 outline that has whitespace followed by a single star as headline
684 starters.  @ref{Clean view} describes a setup to realize this.
686 An empty line after the end of a subtree is considered part of it and
687 will be hidden when the subtree is folded.  However, if you leave at
688 least two empty lines, one empty line will remain visible after folding
689 the subtree, in order to structure the collapsed view.  See the
690 variable @code{org-cycle-separator-lines} to modify this behavior.
692 @node Visibility cycling, Motion, Headlines, Document Structure
693 @section Visibility cycling
694 @cindex cycling, visibility
695 @cindex visibility cycling
696 @cindex trees, visibility
697 @cindex show hidden text
698 @cindex hide text
700 Outlines make it possible to hide parts of the text in the buffer.
701 Org uses just two commands, bound to @key{TAB} and
702 @kbd{S-@key{TAB}} to change the visibility in the buffer.
704 @cindex subtree visibility states
705 @cindex subtree cycling
706 @cindex folded, subtree visibility state
707 @cindex children, subtree visibility state
708 @cindex subtree, subtree visibility state
709 @table @kbd
710 @kindex @key{TAB}
711 @item @key{TAB}
712 @emph{Subtree cycling}: Rotate current subtree among the states
714 @example
715 ,-> FOLDED -> CHILDREN -> SUBTREE --.
716 '-----------------------------------'
717 @end example
719 The cursor must be on a headline for this to work@footnote{see, however,
720 the option @code{org-cycle-emulate-tab}.}.  When the cursor is at the
721 beginning of the buffer and the first line is not a headline, then
722 @key{TAB} actually runs global cycling (see below)@footnote{see the
723 option @code{org-cycle-global-at-bob}.}.  Also when called with a prefix
724 argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
726 @cindex global visibility states
727 @cindex global cycling
728 @cindex overview, global visibility state
729 @cindex contents, global visibility state
730 @cindex show all, global visibility state
731 @kindex S-@key{TAB}
732 @item S-@key{TAB}
733 @itemx C-u @key{TAB}
734 @emph{Global cycling}: Rotate the entire buffer among the states
736 @example
737 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
738 '--------------------------------------'
739 @end example
741 When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
742 CONTENTS view up to headlines of level N will be shown.  Note that inside
743 tables, @kbd{S-@key{TAB}} jumps to the previous field.
745 @cindex show all, command
746 @kindex C-c C-a
747 @item C-c C-a
748 Show all.
749 @kindex C-c C-r
750 @item C-c C-r
751 Reveal context around point, showing the current entry, the following heading
752 and the hierarchy above.  Useful for working near a location that has been
753 exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
754 (@pxref{Agenda commands}).  With a prefix argument show, on each
755 level, all sibling headings.
756 @kindex C-c C-x b
757 @item C-c C-x b
758 Show the current subtree in an indirect buffer@footnote{The indirect
759 buffer
760 @ifinfo
761 (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
762 @end ifinfo
763 @ifnotinfo
764 (see the Emacs manual for more information about indirect buffers)
765 @end ifnotinfo
766 will contain the entire buffer, but will be narrowed to the current
767 tree.  Editing the indirect buffer will also change the original buffer,
768 but without affecting visibility in that buffer.}.  With a numeric
769 prefix argument N, go up to level N and then take that tree.  If N is
770 negative then go up that many levels.  With a @kbd{C-u} prefix, do not remove
771 the previously used indirect buffer.
772 @end table
774 When Emacs first visits an Org file, the global state is set to
775 OVERVIEW, i.e. only the top level headlines are visible.  This can be
776 configured through the variable @code{org-startup-folded}, or on a
777 per-file basis by adding one of the following lines anywhere in the
778 buffer:
780 @example
781 #+STARTUP: overview
782 #+STARTUP: content
783 #+STARTUP: showall
784 @end example
786 @node Motion, Structure editing, Visibility cycling, Document Structure
787 @section Motion
788 @cindex motion, between headlines
789 @cindex jumping, to headlines
790 @cindex headline navigation
791 The following commands jump to other headlines in the buffer.
793 @table @kbd
794 @kindex C-c C-n
795 @item C-c C-n
796 Next heading.
797 @kindex C-c C-p
798 @item C-c C-p
799 Previous heading.
800 @kindex C-c C-f
801 @item C-c C-f
802 Next heading same level.
803 @kindex C-c C-b
804 @item C-c C-b
805 Previous heading same level.
806 @kindex C-c C-u
807 @item C-c C-u
808 Backward to higher level heading.
809 @kindex C-c C-j
810 @item C-c C-j
811 Jump to a different place without changing the current outline
812 visibility.  Shows the document structure in a temporary buffer, where
813 you can use the following keys to find your destination:
814 @example
815 @key{TAB}         @r{Cycle visibility.}
816 @key{down} / @key{up}   @r{Next/previous visible headline.}
817 n / p        @r{Next/previous visible headline.}
818 f / b        @r{Next/previous headline same level.}
819 u            @r{One level up.}
820 0-9          @r{Digit argument.}
821 @key{RET}         @r{Select this location.}
822 @end example
823 @end table
825 @node Structure editing, Archiving, Motion, Document Structure
826 @section Structure editing
827 @cindex structure editing
828 @cindex headline, promotion and demotion
829 @cindex promotion, of subtrees
830 @cindex demotion, of subtrees
831 @cindex subtree, cut and paste
832 @cindex pasting, of subtrees
833 @cindex cutting, of subtrees
834 @cindex copying, of subtrees
835 @cindex subtrees, cut and paste
837 @table @kbd
838 @kindex M-@key{RET}
839 @item M-@key{RET}
840 Insert new heading with same level as current.  If the cursor is in a
841 plain list item, a new item is created (@pxref{Plain lists}).  To force
842 creation of a new headline, use a prefix argument, or first press @key{RET}
843 to get to the beginning of the next line.  When this command is used in
844 the middle of a line, the line is split and the rest of the line becomes
845 the new headline@footnote{If you do not want the line to be split,
846 customize the variable @code{org-M-RET-may-split-line}.}.  If the
847 command is used at the beginning of a headline, the new headline is
848 created before the current line.  If at the beginning of any other line,
849 the content of that line is made the new heading.  If the command is
850 used at the end of a folded subtree (i.e. behind the ellipses at the end
851 of a headline), then a headline like the current one will be inserted
852 after the end of the subtree.
853 @kindex C-@key{RET}
854 @item C-@key{RET}
855 Insert a new heading after the current subtree, same level as the
856 current headline.  This command works from anywhere in the entry.
857 @kindex M-S-@key{RET}
858 @item M-S-@key{RET}
859 Insert new TODO entry with same level as current heading.
860 @kindex M-@key{left}
861 @item M-@key{left}
862 Promote current heading by one level.
863 @kindex M-@key{right}
864 @item M-@key{right}
865 Demote current heading by one level.
866 @kindex M-S-@key{left}
867 @item M-S-@key{left}
868 Promote the current subtree by one level.
869 @kindex M-S-@key{right}
870 @item M-S-@key{right}
871 Demote the current subtree by one level.
872 @kindex M-S-@key{up}
873 @item M-S-@key{up}
874 Move subtree up (swap with previous subtree of same
875 level).
876 @kindex M-S-@key{down}
877 @item M-S-@key{down}
878 Move subtree down (swap with next subtree of same level).
879 @kindex C-c C-x C-w
880 @kindex C-c C-x C-k
881 @item C-c C-x C-w
882 @itemx C-c C-x C-k
883 Kill subtree, i.e. remove it from buffer but save in kill ring.
884 With a numeric prefix argument N, kill N sequential subtrees.
885 @kindex C-c C-x M-w
886 @item C-c C-x M-w
887 Copy subtree to kill ring.  With a numeric prefix argument N, copy the N
888 sequential subtrees.
889 @kindex C-c C-x C-y
890 @item C-c C-x C-y
891 Yank subtree from kill ring.  This does modify the level of the subtree to
892 make sure the tree fits in nicely at the yank position.  The yank level can
893 also be specified with a numeric prefix argument, or by yanking after a
894 headline marker like @samp{****}.
895 @kindex C-c C-w
896 @item C-c C-w
897 Refile entry to a different location.  @xref{Refiling notes}.
898 @kindex C-c ^
899 @item C-c ^
900 Sort same-level entries.  When there is an active region, all entries in the
901 region will be sorted.  Otherwise the children of the current headline are
902 sorted.  The command prompts for the sorting method, which can be
903 alphabetically, numerically, by time (using the first time stamp in each
904 entry), by priority, or by TODO keyword (in the sequence the keywords have
905 been defined in the setup).  Reverse sorting is possible as well.  You can
906 also supply your own function to extract the sorting key.  With a @kbd{C-u}
907 prefix, sorting will be case-sensitive.  With two @kbd{C-u C-u} prefixes,
908 duplicate entries will also be removed.
909 @kindex C-c *
910 @item C-c *
911 Turn a normal line or plain list item into a headline (so that it
912 becomes a subheading at its location).  Also turn a headline into a
913 normal line by removing the stars.  If there is an active region, turn
914 all lines in the region into headlines.  Or, if the first line is a
915 headline, remove the stars from all headlines in the region.
916 @end table
918 @cindex region, active
919 @cindex active region
920 @cindex Transient mark mode
921 When there is an active region (Transient mark mode), promotion and
922 demotion work on all headlines in the region.  To select a region of
923 headlines, it is best to place both point and mark at the beginning of a
924 line, mark at the beginning of the first headline, and point at the line
925 just after the last headline to change.  Note that when the cursor is
926 inside a table (@pxref{Tables}), the Meta-Cursor keys have different
927 functionality.
929 @node Archiving, Sparse trees, Structure editing, Document Structure
930 @section Archiving
931 @cindex archiving
933 When a project represented by a (sub)tree is finished, you may want
934 to move the tree out of the way and to stop it from contributing to the
935 agenda.  Org mode knows two ways of archiving.  You can mark a tree with
936 the ARCHIVE tag, or you can move an entire (sub)tree to a different
937 location.
939 @menu
940 * ARCHIVE tag::                 Marking a tree as inactive
941 * Moving subtrees::             Moving a tree to an archive file
942 @end menu
944 @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
945 @subsection The ARCHIVE tag
946 @cindex internal archiving
948 A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
949 its location in the outline tree, but behaves in the following way:
950 @itemize @minus
951 @item
952 It does not open when you attempt to do so with a visibility cycling
953 command (@pxref{Visibility cycling}).  You can force cycling archived
954 subtrees with @kbd{C-@key{TAB}}, or by setting the option
955 @code{org-cycle-open-archived-trees}.  Also normal outline commands like
956 @code{show-all} will open archived subtrees.
957 @item
958 During sparse tree construction (@pxref{Sparse trees}), matches in
959 archived subtrees are not exposed, unless you configure the option
960 @code{org-sparse-tree-open-archived-trees}.
961 @item
962 During agenda view construction (@pxref{Agenda Views}), the content of
963 archived trees is ignored unless you configure the option
964 @code{org-agenda-skip-archived-trees}.
965 @item
966 Archived trees are not exported (@pxref{Exporting}), only the headline
967 is.  Configure the details using the variable
968 @code{org-export-with-archived-trees}.
969 @end itemize
971 The following commands help managing the ARCHIVE tag:
973 @table @kbd
974 @kindex C-c C-x a
975 @item C-c C-x a
976 Toggle the ARCHIVE tag for the current headline.  When the tag is set,
977 the headline changes to a shadowed face, and the subtree below it is
978 hidden.
979 @kindex C-u C-c C-x a
980 @item C-u C-c C-x a
981 Check if any direct children of the current headline should be archived.
982 To do this, each subtree is checked for open TODO entries.  If none are
983 found, the command offers to set the ARCHIVE tag for the child.  If the
984 cursor is @emph{not} on a headline when this command is invoked, the
985 level 1 trees will be checked.
986 @kindex C-@kbd{TAB}
987 @item C-@kbd{TAB}
988 Cycle a tree even if it is tagged with ARCHIVE.
989 @end table
991 @node Moving subtrees,  , ARCHIVE tag, Archiving
992 @subsection Moving subtrees
993 @cindex external archiving
995 Once an entire project is finished, you may want to move it to a different
996 location.  Org can move it to an @emph{Attic Sibling} in the same tree, to a
997 different tree in the current file, or to a different file, the archive file.
999 @table @kbd
1000 @kindex C-c C-x A
1001 @item C-c C-x A
1002 Move the curent entry to the @emph{Attic Sibling}.  This is a sibling of the
1003 entry with the heading @samp{Attic} and the tag @samp{ARCHIVE}
1004 (@pxref{ARCHIVE tag}).  The entry becomes a child of that sibling and in this
1005 way retains a lot of its original context, including inherited tags and
1006 approximate position in the outline.
1007 @kindex C-c C-x C-s
1008 @item C-c C-x C-s
1009 Archive the subtree starting at the cursor position to the location
1010 given by @code{org-archive-location}.  Context information that could be
1011 lost like the file name, the category, inherited tags, and the TODO
1012 state will be store as properties in the entry.
1013 @kindex C-u C-c C-x C-s
1014 @item C-u C-c C-x C-s
1015 Check if any direct children of the current headline could be moved to
1016 the archive.  To do this, each subtree is checked for open TODO entries.
1017 If none are found, the command offers to move it to the archive
1018 location.  If the cursor is @emph{not} on a headline when this command
1019 is invoked, the level 1 trees will be checked.
1020 @end table
1022 @cindex archive locations
1023 The default archive location is a file in the same directory as the
1024 current file, with the name derived by appending @file{_archive} to the
1025 current file name.  For information and examples on how to change this,
1026 see the documentation string of the variable
1027 @code{org-archive-location}.  There is also an in-buffer option for
1028 setting this variable, for example@footnote{For backward compatibility,
1029 the following also works: If there are several such lines in a file,
1030 each specifies the archive location for the text below it.  The first
1031 such line also applies to any text before its definition.  However,
1032 using this method is @emph{strongly} deprecated as it is incompatible
1033 with the outline structure of the document.  The correct method for
1034 setting multiple archive locations in a buffer is using a property.}:
1036 @example
1037 #+ARCHIVE: %s_done::
1038 @end example
1040 @noindent
1041 If you would like to have a special ARCHIVE location for a single entry
1042 or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
1043 location as the value (@pxref{Properties and Columns}).
1045 When a subtree is moved, it receives a number of special properties that
1046 record context information like the file from where the entry came, it's
1047 outline path the archiving time etc.  Configure the variable
1048 @code{org-archive-save-context-info} to adjust the amount of information
1049 added.
1051 @node Sparse trees, Plain lists, Archiving, Document Structure
1052 @section Sparse trees
1053 @cindex sparse trees
1054 @cindex trees, sparse
1055 @cindex folding, sparse trees
1056 @cindex occur, command
1058 An important feature of Org mode is the ability to construct
1059 @emph{sparse trees} for selected information in an outline tree, so that
1060 the entire document is folded as much as possible, but the selected
1061 information is made visible along with the headline structure above
1062 it@footnote{See also the variables @code{org-show-hierarchy-above},
1063 @code{org-show-following-heading}, and @code{org-show-siblings} for
1064 detailed control on how much context is shown around each match.}.  Just
1065 try it out and you will see immediately how it works.
1067 Org mode contains several commands creating such trees, all these
1068 commands can be accessed through a dispatcher:
1070 @table @kbd
1071 @kindex C-c /
1072 @item C-c /
1073 This prompts for an extra key to select a sparse-tree creating command.
1074 @kindex C-c / r
1075 @item C-c / r
1076 Occur.  Prompts for a regexp and shows a sparse tree with all matches.
1077 If the match is in a headline, the headline is made visible.  If the
1078 match is in the body of an entry, headline and body are made visible.
1079 In order to provide minimal context, also the full hierarchy of
1080 headlines above the match is shown, as well as the headline following
1081 the match.  Each match is also highlighted; the highlights disappear
1082 when the buffer is changed by an editing command, or by pressing
1083 @kbd{C-c C-c}.  When called with a @kbd{C-u} prefix argument, previous
1084 highlights are kept, so several calls to this command can be stacked.
1085 @end table
1087 @noindent
1088 For frequently used sparse trees of specific search strings, you can
1089 use the variable @code{org-agenda-custom-commands} to define fast
1090 keyboard access to specific sparse trees.  These commands will then be
1091 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
1092 For example:
1094 @lisp
1095 (setq org-agenda-custom-commands
1096       '(("f" occur-tree "FIXME")))
1097 @end lisp
1099 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
1100 a sparse tree matching the string @samp{FIXME}.
1102 The other sparse tree commands select headings based on TODO keywords,
1103 tags, or properties and will be discussed later in this manual.
1105 @kindex C-c C-e v
1106 @cindex printing sparse trees
1107 @cindex visible text, printing
1108 To print a sparse tree, you can use the Emacs command
1109 @code{ps-print-buffer-with-faces} which does not print invisible parts
1110 of the document @footnote{This does not work under XEmacs, because
1111 XEmacs uses selective display for outlining, not text properties.}.
1112 Or you can use the command @kbd{C-c C-e v} to export only the visible
1113 part of the document and print the resulting file.
1115 @node Plain lists, Drawers, Sparse trees, Document Structure
1116 @section Plain lists
1117 @cindex plain lists
1118 @cindex lists, plain
1119 @cindex lists, ordered
1120 @cindex ordered lists
1122 Within an entry of the outline tree, hand-formatted lists can provide
1123 additional structure.  They also provide a way to create lists of
1124 checkboxes (@pxref{Checkboxes}).  Org supports editing such lists,
1125 and the HTML exporter (@pxref{Exporting}) parses and formats them.
1127 Org knows ordered and unordered lists.  Unordered list items start
1128 with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
1129 bullet, lines must be indented or they will be seen as top-level
1130 headlines.  Also, when you are hiding leading stars to get a clean
1131 outline view, plain list items starting with a star are visually
1132 indistinguishable from true headlines.  In short: even though @samp{*}
1133 is supported, it may be better to not use it for plain list items.} as
1134 bullets.  Ordered list items start with a numeral followed by either a
1135 period or a right parenthesis, such as @samp{1.} or @samp{1)}.  Items
1136 belonging to the same list must have the same indentation on the first
1137 line.  In particular, if an ordered list reaches number @samp{10.}, then
1138 the 2--digit numbers must be written left-aligned with the other numbers
1139 in the list.  Indentation also determines the end of a list item.  It
1140 ends before the next line that is indented like the bullet/number, or
1141 less.  Empty lines are part of the previous item, so you can have
1142 several paragraphs in one item.  If you would like an empty line to
1143 terminate all currently open plain lists, configure the variable
1144 @code{org-empty-line-terminates-plain-lists}.  Here is an example:
1146 @example
1147 @group
1148 ** Lord of the Rings
1149    My favorite scenes are (in this order)
1150    1. The attack of the Rohirrim
1151    2. Eowyns fight with the witch king
1152       + this was already my favorite scene in the book
1153       + I really like Miranda Otto.
1154    3. Peter Jackson being shot by Legolas
1155        - on DVD only
1156       He makes a really funny face when it happens.
1157    But in the end, not individual scenes matter but the film as a whole.
1158 @end group
1159 @end example
1161 Org supports these lists by tuning filling and wrapping commands to
1162 deal with them correctly@footnote{Org only changes the filling
1163 settings for Emacs.  For XEmacs, you should use Kyle E. Jones'
1164 @file{filladapt.el}.  To turn this on,  put into @file{.emacs}:
1165 @code{(require 'filladapt)}}.
1167 The following commands act on items when the cursor is in the first line
1168 of an item (the line with the bullet or number).
1170 @table @kbd
1171 @kindex @key{TAB}
1172 @item @key{TAB}
1173 Items can be folded just like headline levels if you set the variable
1174 @code{org-cycle-include-plain-lists}.  The level of an item is then
1175 given by the indentation of the bullet/number.  Items are always
1176 subordinate to real headlines, however; the hierarchies remain
1177 completely separated.
1179 If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
1180 fixes the indentation of the current line in a heuristic way.
1181 @kindex M-@key{RET}
1182 @item M-@key{RET}
1183 Insert new item at current level.  With a prefix argument, force a new
1184 heading (@pxref{Structure editing}).  If this command is used in the middle
1185 of a line, the line is @emph{split} and the rest of the line becomes the new
1186 item@footnote{If you do not want the line to be split, customize the variable
1187 @code{org-M-RET-may-split-line}.}.  If this command is executed in the
1188 @emph{whitespace before a bullet or number}, the new item is created
1189 @emph{before} the current item.  If the command is executed in the white
1190 space before the text that is part of an item but does not contain the
1191 bullet, a bullet is added to the current line.
1192 @kindex M-S-@key{RET}
1193 @item M-S-@key{RET}
1194 Insert a new item with a checkbox (@pxref{Checkboxes}).
1195 @kindex S-@key{up}
1196 @kindex S-@key{down}
1197 @item S-@key{up}
1198 @itemx S-@key{down}
1199 Jump to the previous/next item in the current list.
1200 @kindex M-S-@key{up}
1201 @kindex M-S-@key{down}
1202 @item M-S-@key{up}
1203 @itemx M-S-@key{down}
1204 Move the item including subitems up/down (swap with previous/next item
1205 of same indentation).  If the list is ordered, renumbering is
1206 automatic.
1207 @kindex M-S-@key{left}
1208 @kindex M-S-@key{right}
1209 @item M-S-@key{left}
1210 @itemx M-S-@key{right}
1211 Decrease/increase the indentation of the item, including subitems.
1212 Initially, the item tree is selected based on current indentation.
1213 When these commands are executed several times in direct succession,
1214 the initially selected region is used, even if the new indentation
1215 would imply a different hierarchy.  To use the new hierarchy, break
1216 the command chain with a cursor motion or so.
1217 @kindex C-c C-c
1218 @item C-c C-c
1219 If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
1220 state of the checkbox.  If not, this command makes sure that all the
1221 items on this list level use the same bullet.  Furthermore, if this is
1222 an ordered list, make sure the numbering is OK.
1223 @kindex C-c -
1224 @item C-c -
1225 Cycle the entire list level through the different itemize/enumerate bullets
1226 (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}).  With a numeric prefix
1227 argument N, select the Nth bullet from this list.  If there is an active
1228 region when calling this, all lines will be converted to list items.  If the
1229 first line already was a list item, any item markers will be removed from the
1230 list.  Finally, even without an active region, a normal line will be
1231 converted into a list item.
1232 @end table
1234 @node Drawers, Orgstruct mode, Plain lists, Document Structure
1235 @section Drawers
1236 @cindex drawers
1237 @cindex visibility cycling, drawers
1239 Sometimes you want to keep information associated with an entry, but you
1240 normally don't want to see it.  For this, Org mode has @emph{drawers}.
1241 Drawers need to be configured with the variable
1242 @code{org-drawers}@footnote{You can define drawers on a per-file basis
1243 with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}.  Drawers
1244 look like this:
1246 @example
1247 ** This is a headline
1248    Still outside the drawer
1249    :DRAWERNAME:
1250       This is inside the drawer.
1251    :END:
1252    After the drawer.
1253 @end example
1255 Visibility cycling (@pxref{Visibility cycling}) on the headline will
1256 hide and show the entry, but keep the drawer collapsed to a single line.
1257 In order to look inside the drawer, you need to move the cursor to the
1258 drawer line and press @key{TAB} there.  Org mode uses a drawer for
1259 storing properties (@pxref{Properties and Columns}).
1261 @node Orgstruct mode,  , Drawers, Document Structure
1262 @section The Orgstruct minor mode
1263 @cindex Orgstruct mode
1264 @cindex minor mode for structure editing
1266 If you like the intuitive way the Org mode structure editing and list
1267 formatting works, you might want to use these commands in other modes
1268 like Text mode or Mail mode as well.  The minor mode Orgstruct mode
1269 makes this possible.  You can always toggle the mode with @kbd{M-x
1270 orgstruct-mode}.  To turn it on by default, for example in Mail mode,
1273 @lisp
1274 (add-hook 'mail-mode-hook 'turn-on-orgstruct)
1275 @end lisp
1277 When this mode is active and the cursor is on a line that looks to
1278 Org like a headline of the first line of a list item, most
1279 structure editing commands will work, even if the same keys normally
1280 have different functionality in the major mode you are using.  If the
1281 cursor is not in one of those special lines, Orgstruct mode lurks
1282 silently in the shadow.
1284 @node Tables, Hyperlinks, Document Structure, Top
1285 @chapter Tables
1286 @cindex tables
1287 @cindex editing tables
1289 Org comes with a fast and intuitive table editor.  Spreadsheet-like
1290 calculations are supported in connection with the Emacs @file{calc}
1291 package
1292 @ifinfo
1293 (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
1294 @end ifinfo
1295 @ifnotinfo
1296 (see the Emacs Calculator manual for more information about the Emacs
1297 calculator).
1298 @end ifnotinfo
1300 @menu
1301 * Built-in table editor::       Simple tables
1302 * Narrow columns::              Stop wasting space in tables
1303 * Column groups::               Grouping to trigger vertical lines
1304 * Orgtbl mode::                 The table editor as minor mode
1305 * The spreadsheet::             The table editor has spreadsheet capabilities
1306 @end menu
1308 @node Built-in table editor, Narrow columns, Tables, Tables
1309 @section The built-in table editor
1310 @cindex table editor, built-in
1312 Org makes it easy to format tables in plain ASCII.  Any line with
1313 @samp{|} as the first non-whitespace character is considered part of a
1314 table.  @samp{|} is also the column separator.  A table might look like
1315 this:
1317 @example
1318 | Name  | Phone | Age |
1319 |-------+-------+-----|
1320 | Peter |  1234 |  17 |
1321 | Anna  |  4321 |  25 |
1322 @end example
1324 A table is re-aligned automatically each time you press @key{TAB} or
1325 @key{RET} or @kbd{C-c C-c} inside the table.  @key{TAB} also moves to
1326 the next field (@key{RET} to the next row) and creates new table rows
1327 at the end of the table or before horizontal lines.  The indentation
1328 of the table is set by the first line.  Any line starting with
1329 @samp{|-} is considered as a horizontal separator line and will be
1330 expanded on the next re-align to span the whole table width.  So, to
1331 create the above table, you would only type
1333 @example
1334 |Name|Phone|Age|
1336 @end example
1338 @noindent and then press @key{TAB} to align the table and start filling in
1339 fields.
1341 When typing text into a field, Org treats @key{DEL},
1342 @key{Backspace}, and all character keys in a special way, so that
1343 inserting and deleting avoids shifting other fields.  Also, when
1344 typing @emph{immediately after the cursor was moved into a new field
1345 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
1346 field is automatically made blank.  If this behavior is too
1347 unpredictable for you, configure the variables
1348 @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
1350 @table @kbd
1351 @tsubheading{Creation and conversion}
1352 @kindex C-c |
1353 @item C-c |
1354 Convert the active region to table. If every line contains at least one
1355 TAB character, the function assumes that the material is tab separated.
1356 If every line contains a comma, comma-separated values (CSV) are assumed.
1357 If not, lines are split at whitespace into fields.  You can use a prefix
1358 argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
1359 C-u} forces TAB, and a numeric argument N indicates that at least N
1360 consecutive spaces, or alternatively a TAB will be the separator.
1362 If there is no active region, this command creates an empty Org
1363 table.  But it's easier just to start typing, like
1364 @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
1366 @tsubheading{Re-aligning and field motion}
1367 @kindex C-c C-c
1368 @item C-c C-c
1369 Re-align the table without moving the cursor.
1371 @kindex @key{TAB}
1372 @item @key{TAB}
1373 Re-align the table, move to the next field.  Creates a new row if
1374 necessary.
1376 @kindex S-@key{TAB}
1377 @item S-@key{TAB}
1378 Re-align, move to previous field.
1380 @kindex @key{RET}
1381 @item @key{RET}
1382 Re-align the table and move down to next row.  Creates a new row if
1383 necessary.  At the beginning or end of a line, @key{RET} still does
1384 NEWLINE, so it can be used to split a table.
1386 @tsubheading{Column and row editing}
1387 @kindex M-@key{left}
1388 @kindex M-@key{right}
1389 @item M-@key{left}
1390 @itemx M-@key{right}
1391 Move the current column left/right.
1393 @kindex M-S-@key{left}
1394 @item M-S-@key{left}
1395 Kill the current column.
1397 @kindex M-S-@key{right}
1398 @item M-S-@key{right}
1399 Insert a new column to the left of the cursor position.
1401 @kindex M-@key{up}
1402 @kindex M-@key{down}
1403 @item M-@key{up}
1404 @itemx M-@key{down}
1405 Move the current row up/down.
1407 @kindex M-S-@key{up}
1408 @item M-S-@key{up}
1409 Kill the current row or horizontal line.
1411 @kindex M-S-@key{down}
1412 @item M-S-@key{down}
1413 Insert a new row above the current row.  With a prefix argument, the line is
1414 created below the current one.
1416 @kindex C-c -
1417 @item C-c -
1418 Insert a horizontal line below current row. With a prefix argument, the line
1419 is created above the current line.
1421 @kindex C-c ^
1422 @item C-c ^
1423 Sort the table lines in the region.  The position of point indicates the
1424 column to be used for sorting, and the range of lines is the range
1425 between the nearest horizontal separator lines, or the entire table.  If
1426 point is before the first column, you will be prompted for the sorting
1427 column.  If there is an active region, the mark specifies the first line
1428 and the sorting column, while point should be in the last line to be
1429 included into the sorting.  The command prompts for the sorting type
1430 (alphabetically, numerically, or by time).  When called with a prefix
1431 argument, alphabetic sorting will be case-sensitive.
1433 @tsubheading{Regions}
1434 @kindex C-c C-x M-w
1435 @item C-c C-x M-w
1436 Copy a rectangular region from a table to a special clipboard.  Point
1437 and mark determine edge fields of the rectangle.  The process ignores
1438 horizontal separator lines.
1440 @kindex C-c C-x C-w
1441 @item C-c C-x C-w
1442 Copy a rectangular region from a table to a special clipboard, and
1443 blank all fields in the rectangle.  So this is the ``cut'' operation.
1445 @kindex C-c C-x C-y
1446 @item C-c C-x C-y
1447 Paste a rectangular region into a table.
1448 The upper right corner ends up in the current field.  All involved fields
1449 will be overwritten.  If the rectangle does not fit into the present table,
1450 the table is enlarged as needed.  The process ignores horizontal separator
1451 lines.
1453 @kindex C-c C-q
1454 @kindex M-@key{RET}
1455 @item C-c C-q
1456 @itemx M-@kbd{RET}
1457 Wrap several fields in a column like a paragraph.  If there is an active
1458 region, and both point and mark are in the same column, the text in the
1459 column is wrapped to minimum width for the given number of lines.  A numeric
1460 prefix argument may be used to change the number of desired lines.  If there
1461 is no region, the current field is split at the cursor position and the text
1462 fragment to the right of the cursor is prepended to the field one line
1463 down. If there is no region, but you specify a prefix argument, the current
1464 field is made blank, and the content is appended to the field above.
1466 @tsubheading{Calculations}
1467 @cindex formula, in tables
1468 @cindex calculations, in tables
1469 @cindex region, active
1470 @cindex active region
1471 @cindex Transient mark mode
1472 @kindex C-c +
1473 @item C-c +
1474 Sum the numbers in the current column, or in the rectangle defined by
1475 the active region.  The result is shown in the echo area and can
1476 be inserted with @kbd{C-y}.
1478 @kindex S-@key{RET}
1479 @item S-@key{RET}
1480 When current field is empty, copy from first non-empty field above.
1481 When not empty, copy current field down to next row and move cursor
1482 along with it.  Depending on the variable
1483 @code{org-table-copy-increment}, integer field values will be
1484 incremented during copy.  This key is also used by CUA mode
1485 (@pxref{Cooperation}).
1487 @tsubheading{Miscellaneous}
1488 @kindex C-c `
1489 @item C-c `
1490 Edit the current field in a separate window.  This is useful for fields
1491 that are not fully visible (@pxref{Narrow columns}).  When called with a
1492 @kbd{C-u} prefix, just make the full field visible, so that it can be
1493 edited in place.
1495 @item M-x org-table-import
1496 Import a file as a table.  The table should be TAB- or whitespace
1497 separated.  Useful, for example, to import a spreadsheet table or data
1498 from a database, because these programs generally can write
1499 TAB-separated text files.  This command works by inserting the file into
1500 the buffer and then converting the region to a table.  Any prefix
1501 argument is passed on to the converter, which uses it to determine the
1502 separator.
1503 @item C-c |
1504 Tables can also be imported by pasting tabular text into the Org
1505 buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
1506 @kbd{C-c |} command (see above under @i{Creation and conversion}.
1508 @item M-x org-table-export
1509 Export the table as a TAB-separated file.  Useful for data exchange with,
1510 for example, spreadsheet or database programs.
1511 @end table
1513 If you don't like the automatic table editor because it gets in your
1514 way on lines which you would like to start with @samp{|}, you can turn
1515 it off with
1517 @lisp
1518 (setq org-enable-table-editor nil)
1519 @end lisp
1521 @noindent Then the only table command that still works is
1522 @kbd{C-c C-c} to do a manual re-align.
1524 @node Narrow columns, Column groups, Built-in table editor, Tables
1525 @section Narrow columns
1526 @cindex narrow columns in tables
1528 The width of columns is automatically determined by the table editor.
1529 Sometimes a single field or a few fields need to carry more text,
1530 leading to inconveniently wide columns.  To limit@footnote{This feature
1531 does not work on XEmacs.} the width of a column, one field anywhere in
1532 the column may contain just the string @samp{<N>} where @samp{N} is an
1533 integer specifying the width of the column in characters.  The next
1534 re-align will then set the width of this column to no more than this
1535 value.
1537 @example
1538 @group
1539 |---+------------------------------|               |---+--------|
1540 |   |                              |               |   | <6>    |
1541 | 1 | one                          |               | 1 | one    |
1542 | 2 | two                          |     ----\     | 2 | two    |
1543 | 3 | This is a long chunk of text |     ----/     | 3 | This=> |
1544 | 4 | four                         |               | 4 | four   |
1545 |---+------------------------------|               |---+--------|
1546 @end group
1547 @end example
1549 @noindent
1550 Fields that are wider become clipped and end in the string @samp{=>}.
1551 Note that the full text is still in the buffer, it is only invisible.
1552 To see the full text, hold the mouse over the field - a tool-tip window
1553 will show the full content.  To edit such a field, use the command
1554 @kbd{C-c `} (that is @kbd{C-c} followed by the backquote).  This will
1555 open a new window with the full field.  Edit it and finish with @kbd{C-c
1556 C-c}.
1558 When visiting a file containing a table with narrowed columns, the
1559 necessary character hiding has not yet happened, and the table needs to
1560 be aligned before it looks nice.  Setting the option
1561 @code{org-startup-align-all-tables} will realign all tables in a file
1562 upon visiting, but also slow down startup.  You can also set this option
1563 on a per-file basis with:
1565 @example
1566 #+STARTUP: align
1567 #+STARTUP: noalign
1568 @end example
1570 @node Column groups, Orgtbl mode, Narrow columns, Tables
1571 @section Column groups
1572 @cindex grouping columns in tables
1574 When Org exports tables, it does so by default without vertical
1575 lines because that is visually more satisfying in general.  Occasionally
1576 however, vertical lines can be useful to structure a table into groups
1577 of columns, much like horizontal lines can do for groups of rows.  In
1578 order to specify column groups, you can use a special row where the
1579 first field contains only @samp{/}.  The further fields can either
1580 contain @samp{<} to indicate that this column should start a group,
1581 @samp{>} to indicate the end of a column, or @samp{<>} to make a column
1582 a group of its own.  Boundaries between column groups will upon export be
1583 marked with vertical lines.  Here is an example:
1585 @example
1586 |   |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1587 |---+----+-----+-----+-----+---------+------------|
1588 | / | <> |   < |     |   > |       < |          > |
1589 | # |  1 |   1 |   1 |   1 |       1 |          1 |
1590 | # |  2 |   4 |   8 |  16 |  1.4142 |     1.1892 |
1591 | # |  3 |   9 |  27 |  81 |  1.7321 |     1.3161 |
1592 |---+----+-----+-----+-----+---------+------------|
1593 #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
1594 @end example
1596 It is also sufficient to just insert the column group starters after
1597 every vertical line you'd like to have:
1599 @example
1600 |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1601 |----+-----+-----+-----+---------+------------|
1602 | /  | <   |     |     | <       |            |
1603 @end example
1605 @node Orgtbl mode, The spreadsheet, Column groups, Tables
1606 @section The Orgtbl minor mode
1607 @cindex Orgtbl mode
1608 @cindex minor mode for tables
1610 If you like the intuitive way the Org table editor works, you
1611 might also want to use it in other modes like Text mode or Mail mode.
1612 The minor mode Orgtbl mode makes this possible.  You can always toggle
1613 the mode with @kbd{M-x orgtbl-mode}.  To turn it on by default, for
1614 example in mail mode, use
1616 @lisp
1617 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
1618 @end lisp
1620 Furthermore, with some special setup, it is possible to maintain tables
1621 in arbitrary syntax with Orgtbl mode.  For example, it is possible to
1622 construct La@TeX{} tables with the underlying ease and power of
1623 Orgtbl mode, including spreadsheet capabilities.  For details, see
1624 @ref{Tables in arbitrary syntax}.
1626 @node The spreadsheet,  , Orgtbl mode, Tables
1627 @section The spreadsheet
1628 @cindex calculations, in tables
1629 @cindex spreadsheet capabilities
1630 @cindex @file{calc} package
1632 The table editor makes use of the Emacs @file{calc} package to implement
1633 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms to
1634 derive fields from other fields.  While fully featured, Org's
1635 implementation is not identical to other spreadsheets.  For example,
1636 Org knows the concept of a @emph{column formula} that will be
1637 applied to all non-header fields in a column without having to copy the
1638 formula to each relevant field.
1640 @menu
1641 * References::                  How to refer to another field or range
1642 * Formula syntax for Calc::     Using Calc to compute stuff
1643 * Formula syntax for Lisp::     Writing formulas in Emacs Lisp
1644 * Field formulas::              Formulas valid for a single field
1645 * Column formulas::             Formulas valid for an entire column
1646 * Editing and debugging formulas::  Fixing formulas
1647 * Updating the table::          Recomputing all dependent fields
1648 * Advanced features::           Field names, parameters and automatic recalc
1649 @end menu
1651 @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
1652 @subsection References
1653 @cindex references
1655 To compute fields in the table from other fields, formulas must
1656 reference other fields or ranges.  In Org, fields can be referenced
1657 by name, by absolute coordinates, and by relative coordinates.  To find
1658 out what the coordinates of a field are, press @kbd{C-c ?} in that
1659 field, or press @kbd{C-c @}} to toggle the display of a grid.
1661 @subsubheading Field references
1662 @cindex field references
1663 @cindex references, to fields
1665 Formulas can reference the value of another field in two ways.  Like in
1666 any other spreadsheet, you may reference fields with a letter/number
1667 combination like @code{B3}, meaning the 2nd field in the 3rd row.
1668 @c Such references are always fixed to that field, they don't change
1669 @c when you copy and paste a formula to a different field.  So
1670 @c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
1672 @noindent
1673 Org also uses another, more general operator that looks like this:
1674 @example
1675 @@row$column
1676 @end example
1678 @noindent
1679 Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
1680 or relative to the current column like @samp{+1} or @samp{-2}.
1682 The row specification only counts data lines and ignores horizontal
1683 separator lines (hlines).  You can use absolute row numbers
1684 @samp{1}...@samp{N}, and row numbers relative to the current row like
1685 @samp{+3} or @samp{-1}.  Or specify the row relative to one of the
1686 hlines: @samp{I} refers to the first hline@footnote{Note that only
1687 hlines are counted that @emph{separate} table lines.  If the table
1688 starts with a hline above the header, it does not count.}, @samp{II} to
1689 the second etc.  @samp{-I} refers to the first such line above the
1690 current line, @samp{+I} to the first such line below the current line.
1691 You can also write @samp{III+2} which is the second data line after the
1692 third hline in the table.  Relative row numbers like @samp{-3} will not
1693 cross hlines if the current line is too close to the hline.  Instead,
1694 the value directly at the hline is used.
1696 @samp{0} refers to the current row and column.  Also, if you omit
1697 either the column or the row part of the reference, the current
1698 row/column is implied.
1700 Org's references with @emph{unsigned} numbers are fixed references
1701 in the sense that if you use the same reference in the formula for two
1702 different fields, the same field will be referenced each time.
1703 Org's references with @emph{signed} numbers are floating
1704 references because the same reference operator can reference different
1705 fields depending on the field being calculated by the formula.
1707 Here are a few examples:
1709 @example
1710 @@2$3      @r{2nd row, 3rd column}
1711 C2        @r{same as previous}
1712 $5        @r{column 5 in the current row}
1713 E&        @r{same as previous}
1714 @@2        @r{current column, row 2}
1715 @@-1$-3    @r{the field one row up, three columns to the left}
1716 @@-I$2     @r{field just under hline above current row, column 2}
1717 @end example
1719 @subsubheading Range references
1720 @cindex range references
1721 @cindex references, to ranges
1723 You may reference a rectangular range of fields by specifying two field
1724 references connected by two dots @samp{..}.  If both fields are in the
1725 current row, you may simply use @samp{$2..$7}, but if at least one field
1726 is in a different row, you need to use the general @code{@@row$column}
1727 format at least for the first field (i.e the reference must start with
1728 @samp{@@} in order to be interpreted correctly).  Examples:
1730 @example
1731 $1..$3        @r{First three fields in the current row.}
1732 $P..$Q        @r{Range, using column names (see under Advanced)}
1733 @@2$1..@@4$3    @r{6 fields between these two fields.}
1734 A2..C4        @r{Same as above.}
1735 @@-1$-2..@@-1   @r{3 numbers from the column to the left, 2 up to current row}
1736 @end example
1738 @noindent Range references return a vector of values that can be fed
1739 into Calc vector functions.  Empty fields in ranges are normally
1740 suppressed, so that the vector contains only the non-empty fields (but
1741 see the @samp{E} mode switch below).  If there are no non-empty fields,
1742 @samp{[0]} is returned to avoid syntax errors in formulas.
1744 @subsubheading Named references
1745 @cindex named references
1746 @cindex references, named
1747 @cindex name, of column or field
1748 @cindex constants, in calculations
1750 @samp{$name} is interpreted as the name of a column, parameter or
1751 constant.  Constants are defined globally through the variable
1752 @code{org-table-formula-constants}, and locally (for the file) through a
1753 line like
1755 @example
1756 #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
1757 @end example
1759 @noindent
1760 Also properties (@pxref{Properties and Columns}) can be used as
1761 constants in table formulas: For a property @samp{:Xyz:} use the name
1762 @samp{$PROP_Xyz}, and the property will be searched in the current
1763 outline entry and in the hierarchy above it.  If you have the
1764 @file{constants.el} package, it will also be used to resolve constants,
1765 including natural constants like @samp{$h} for Planck's constant, and
1766 units like @samp{$km} for kilometers@footnote{@file{Constant.el} can
1767 supply the values of constants in two different unit systems, @code{SI}
1768 and @code{cgs}.  Which one is used depends on the value of the variable
1769 @code{constants-unit-system}.  You can use the @code{#+STARTUP} options
1770 @code{constSI} and @code{constcgs} to set this value for the current
1771 buffer.}.  Column names and parameters can be specified in special table
1772 lines.  These are described below, see @ref{Advanced features}.  All
1773 names must start with a letter, and further consist of letters and
1774 numbers.
1776 @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
1777 @subsection Formula syntax for Calc
1778 @cindex formula syntax, Calc
1779 @cindex syntax, of formulas
1781 A formula can be any algebraic expression understood by the Emacs
1782 @file{Calc} package.  @b{Note that @file{calc} has the
1783 non-standard convention that @samp{/} has lower precedence than
1784 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.}  Before
1785 evaluation by @code{calc-eval} (@pxref{Calling Calc from
1786 Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
1787 Emacs Calc Manual}),
1788 @c FIXME:  The link to the Calc manual in HTML does not work.
1789 variable substitution takes place according to the rules described above.
1790 @cindex vectors, in table calculations
1791 The range vectors can be directly fed into the Calc vector functions
1792 like @samp{vmean} and @samp{vsum}.
1794 @cindex format specifier
1795 @cindex mode, for @file{calc}
1796 A formula can contain an optional mode string after a semicolon.  This
1797 string consists of flags to influence Calc and other modes during
1798 execution.  By default, Org uses the standard Calc modes (precision
1799 12, angular units degrees, fraction and symbolic modes off.  The display
1800 format, however, has been changed to @code{(float 5)} to keep tables
1801 compact.  The default settings can be configured using the variable
1802 @code{org-calc-default-modes}.
1804 @example
1805 p20           @r{switch the internal precision to 20 digits}
1806 n3 s3 e2 f4   @r{normal, scientific, engineering, or fixed display format}
1807 D R           @r{angle modes: degrees, radians}
1808 F S           @r{fraction and symbolic modes}
1809 N             @r{interpret all fields as numbers, use 0 for non-numbers}
1810 T             @r{force text interpretation}
1811 E             @r{keep empty fields in ranges}
1812 @end example
1814 @noindent
1815 In addition, you may provide a @code{printf} format specifier to
1816 reformat the final result.  A few examples:
1818 @example
1819 $1+$2                @r{Sum of first and second field}
1820 $1+$2;%.2f           @r{Same, format result to two decimals}
1821 exp($2)+exp($1)      @r{Math functions can be used}
1822 $0;%.1f              @r{Reformat current cell to 1 decimal}
1823 ($3-32)*5/9          @r{Degrees F -> C conversion}
1824 $c/$1/$cm            @r{Hz -> cm conversion, using @file{constants.el}}
1825 tan($1);Dp3s1        @r{Compute in degrees, precision 3, display SCI 1}
1826 sin($1);Dp3%.1e      @r{Same, but use printf specifier for display}
1827 vmean($2..$7)        @r{Compute column range mean, using vector function}
1828 vmean($2..$7);EN     @r{Same, but treat empty fields as 0}
1829 taylor($3,x=7,2)     @r{taylor series of $3, at x=7, second degree}
1830 @end example
1832 Calc also contains a complete set of logical operations.  For example
1834 @example
1835 if($1<20,teen,string(""))  @r{``teen'' if age $1 less than 20, else empty}
1836 @end example
1838 @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
1839 @subsection Emacs Lisp forms as formulas
1840 @cindex Lisp forms, as table formulas
1842 It is also possible to write a formula in Emacs Lisp; this can be useful
1843 for string manipulation and control structures, if the Calc's
1844 functionality is not enough.  If a formula starts with a single quote
1845 followed by an opening parenthesis, then it is evaluated as a lisp form.
1846 The evaluation should return either a string or a number.  Just as with
1847 @file{calc} formulas, you can specify modes and a printf format after a
1848 semicolon.  With Emacs Lisp forms, you need to be conscious about the way
1849 field references are interpolated into the form.  By default, a
1850 reference will be interpolated as a Lisp string (in double quotes)
1851 containing the field.  If you provide the @samp{N} mode switch, all
1852 referenced elements will be numbers (non-number fields will be zero) and
1853 interpolated as Lisp numbers, without quotes.  If you provide the
1854 @samp{L} flag, all fields will be interpolated literally, without quotes.
1855 I.e., if you want a reference to be interpreted as a string by the Lisp
1856 form, enclose the reference operator itself in double quotes, like
1857 @code{"$3"}.  Ranges are inserted as space-separated fields, so you can
1858 embed them in list or vector syntax.  A few examples, note how the
1859 @samp{N} mode is used when we do computations in lisp.
1861 @example
1862 @r{Swap the first two characters of the content of column 1}
1863   '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
1864 @r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
1865   '(+ $1 $2);N
1866 @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
1867   '(apply '+ '($1..$4));N
1868 @end example
1870 @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
1871 @subsection Field formulas
1872 @cindex field formula
1873 @cindex formula, for individual table field
1875 To assign a formula to a particular field, type it directly into the
1876 field, preceded by @samp{:=}, for example @samp{:=$1+$2}.  When you
1877 press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
1878 the field, the formula will be stored as the formula for this field,
1879 evaluated, and the current field replaced with the result.
1881 Formulas are stored in a special line starting with @samp{#+TBLFM:}
1882 directly below the table.  If you typed the equation in the 4th field of
1883 the 3rd data line in the table, the formula will look like
1884 @samp{@@3$4=$1+$2}.  When inserting/deleting/swapping column and rows
1885 with the appropriate commands, @i{absolute references} (but not relative
1886 ones) in stored formulas are modified in order to still reference the
1887 same field.  Of cause this is not true if you edit the table structure
1888 with normal editing commands - then you must fix the equations yourself.
1890 Instead of typing an equation into the field, you may also use the
1891 following command
1893 @table @kbd
1894 @kindex C-u C-c =
1895 @item C-u C-c =
1896 Install a new formula for the current field.  The command prompts for a
1897 formula, with default taken from the @samp{#+TBLFM:} line, applies
1898 it to the current field and stores it.
1899 @end table
1901 @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
1902 @subsection Column formulas
1903 @cindex column formula
1904 @cindex formula, for table column
1906 Often in a table, the same formula should be used for all fields in a
1907 particular column.  Instead of having to copy the formula to all fields
1908 in that column, Org allows to assign a single formula to an entire
1909 column.  If the table contains horizontal separator hlines, everything
1910 before the first such line is considered part of the table @emph{header}
1911 and will not be modified by column formulas.
1913 To assign a formula to a column, type it directly into any field in the
1914 column, preceded by an equal sign, like @samp{=$1+$2}.  When you press
1915 @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
1916 field, the formula will be stored as the formula for the current column,
1917 evaluated and the current field replaced with the result.  If the field
1918 contains only @samp{=}, the previously stored formula for this column is
1919 used.  For each column, Org will only remember the most recently
1920 used formula.  In the @samp{TBLFM:} line, column formulas will look like
1921 @samp{$4=$1+$2}.
1923 Instead of typing an equation into the field, you may also use the
1924 following command:
1926 @table @kbd
1927 @kindex C-c =
1928 @item C-c =
1929 Install a new formula for the current column and replace current field with
1930 the result of the formula.  The command prompts for a formula, with default
1931 taken from the @samp{#+TBLFM} line, applies it to the current field and
1932 stores it.  With a numeric prefix argument(e.g. @kbd{C-5 C-c =}) the command
1933 will apply it to that many consecutive fields in the current column.
1934 @end table
1936 @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
1937 @subsection Editing and debugging formulas
1938 @cindex formula editing
1939 @cindex editing, of table formulas
1941 You can edit individual formulas in the minibuffer or directly in the
1942 field.  Org can also prepare a special buffer with all active
1943 formulas of a table.  When offering a formula for editing, Org
1944 converts references to the standard format (like @code{B3} or @code{D&})
1945 if possible.  If you prefer to only work with the internal format (like
1946 @code{@@3$2} or @code{$4}), configure the variable
1947 @code{org-table-use-standard-references}.
1949 @table @kbd
1950 @kindex C-c =
1951 @kindex C-u C-c =
1952 @item C-c =
1953 @itemx C-u C-c =
1954 Edit the formula associated with the current column/field in the
1955 minibuffer.  See @ref{Column formulas} and @ref{Field formulas}.
1956 @kindex C-u C-u C-c =
1957 @item C-u C-u C-c =
1958 Re-insert the active formula (either a
1959 field formula, or a column formula) into the current field, so that you
1960 can edit it directly in the field.  The advantage over editing in the
1961 minibuffer is that you can use the command @kbd{C-c ?}.
1962 @kindex C-c ?
1963 @item C-c ?
1964 While editing a formula in a table field, highlight the field(s)
1965 referenced by the reference at the cursor position in the formula.
1966 @kindex C-c @}
1967 @item C-c @}
1968 Toggle the display of row and column numbers for a table, using
1969 overlays.  These are updated each time the table is aligned, you can
1970 force it with @kbd{C-c C-c}.
1971 @kindex C-c @{
1972 @item C-c @{
1973 Toggle the formula debugger on and off.  See below.
1974 @kindex C-c '
1975 @item C-c '
1976 Edit all formulas for the current table in a special buffer, where the
1977 formulas will be displayed one per line.  If the current field has an
1978 active formula, the cursor in the formula editor will mark it.
1979 While inside the special buffer, Org will automatically highlight
1980 any field or range reference at the cursor position.  You may edit,
1981 remove and add formulas, and use the following commands:
1982 @table @kbd
1983 @kindex C-c C-c
1984 @kindex C-x C-s
1985 @item C-c C-c
1986 @itemx C-x C-s
1987 Exit the formula editor and store the modified formulas.  With @kbd{C-u}
1988 prefix, also apply the new formulas to the entire table.
1989 @kindex C-c C-q
1990 @item C-c C-q
1991 Exit the formula editor without installing changes.
1992 @kindex C-c C-r
1993 @item C-c C-r
1994 Toggle all references in the formula editor between standard (like
1995 @code{B3}) and internal (like @code{@@3$2}).
1996 @kindex @key{TAB}
1997 @item @key{TAB}
1998 Pretty-print or indent lisp formula at point.  When in a line containing
1999 a lisp formula, format the formula according to Emacs Lisp rules.
2000 Another @key{TAB} collapses the formula back again.  In the open
2001 formula, @key{TAB} re-indents just like in Emacs lisp mode.
2002 @kindex M-@key{TAB}
2003 @item M-@key{TAB}
2004 Complete Lisp symbols, just like in Emacs lisp mode.
2005 @kindex S-@key{up}
2006 @kindex S-@key{down}
2007 @kindex S-@key{left}
2008 @kindex S-@key{right}
2009 @item S-@key{up}/@key{down}/@key{left}/@key{right}
2010 Shift the reference at point.  For example, if the reference is
2011 @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
2012 This also works for relative references, and for hline references.
2013 @kindex M-S-@key{up}
2014 @kindex M-S-@key{down}
2015 @item M-S-@key{up}/@key{down}
2016 Move the test line for column formulas in the Org buffer up and
2017 down.
2018 @kindex M-@key{up}
2019 @kindex M-@key{down}
2020 @item M-@key{up}/@key{down}
2021 Scroll the window displaying the table.
2022 @kindex C-c @}
2023 @item C-c @}
2024 Turn the coordinate grid in the table on and off.
2025 @end table
2026 @end table
2028 Making a table field blank does not remove the formula associated with
2029 the field, because that is stored in a different line (the @samp{TBLFM}
2030 line) - during the next recalculation the field will be filled again.
2031 To remove a formula from a field, you have to give an empty reply when
2032 prompted for the formula, or to edit the @samp{#+TBLFM} line.
2034 @kindex C-c C-c
2035 You may edit the @samp{#+TBLFM} directly and re-apply the changed
2036 equations with @kbd{C-c C-c} in that line, or with the normal
2037 recalculation commands in the table.
2039 @subsubheading Debugging formulas
2040 @cindex formula debugging
2041 @cindex debugging, of table formulas
2042 When the evaluation of a formula leads to an error, the field content
2043 becomes the string @samp{#ERROR}.  If you would like see what is going
2044 on during variable substitution and calculation in order to find a bug,
2045 turn on formula debugging in the @code{Tbl} menu and repeat the
2046 calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
2047 field.  Detailed information will be displayed.
2049 @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
2050 @subsection Updating the table
2051 @cindex recomputing table fields
2052 @cindex updating, table
2054 Recalculation of a table is normally not automatic, but needs to be
2055 triggered by a command.  See @ref{Advanced features} for a way to make
2056 recalculation at least semi-automatically.
2058 In order to recalculate a line of a table or the entire table, use the
2059 following commands:
2061 @table @kbd
2062 @kindex C-c *
2063 @item C-c *
2064 Recalculate the current row by first applying the stored column formulas
2065 from left to right, and all field formulas in the current row.
2067 @kindex C-u C-c *
2068 @item C-u C-c *
2069 @kindex C-u C-c C-c
2070 @itemx C-u C-c C-c
2071 Recompute the entire table, line by line.  Any lines before the first
2072 hline are left alone, assuming that these are part of the table header.
2074 @kindex C-u C-u C-c *
2075 @kindex C-u C-u C-c C-c
2076 @item C-u C-u C-c *
2077 @itemx C-u C-u C-c C-c
2078 Iterate the table by recomputing it until no further changes occur.
2079 This may be necessary if some computed fields use the value of other
2080 fields that are computed @i{later} in the calculation sequence.
2081 @end table
2083 @node Advanced features,  , Updating the table, The spreadsheet
2084 @subsection Advanced features
2086 If you want the recalculation of fields to happen automatically, or if
2087 you want to be able to assign @i{names} to fields and columns, you need
2088 to reserve the first column of the table for special marking characters.
2089 @table @kbd
2090 @kindex C-#
2091 @item C-#
2092 Rotate the calculation mark in first column through the states @samp{},
2093 @samp{#}, @samp{*}, @samp{!}, @samp{$}.  The meaning of these characters
2094 is discussed below.  When there is an active region, change all marks in
2095 the region.
2096 @end table
2098 Here is an example of a table that collects exam results of students and
2099 makes use of these features:
2101 @example
2102 @group
2103 |---+---------+--------+--------+--------+-------+------|
2104 |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2105 |---+---------+--------+--------+--------+-------+------|
2106 | ! |         |     P1 |     P2 |     P3 |   Tot |      |
2107 | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
2108 | ^ |         |     m1 |     m2 |     m3 |    mt |      |
2109 |---+---------+--------+--------+--------+-------+------|
2110 | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
2111 | # | Sara    |      6 |     14 |     19 |    39 |  7.8 |
2112 | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
2113 |---+---------+--------+--------+--------+-------+------|
2114 |   | Average |        |        |        |  29.7 |      |
2115 | ^ |         |        |        |        |    at |      |
2116 | $ | max=50  |        |        |        |       |      |
2117 |---+---------+--------+--------+--------+-------+------|
2118 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
2119 @end group
2120 @end example
2122 @noindent @b{Important}: Please note that for these special tables,
2123 recalculating the table with @kbd{C-u C-c *} will only affect rows that
2124 are marked @samp{#} or @samp{*}, and fields that have a formula assigned
2125 to the field itself.  The column formulas are not applied in rows with
2126 empty first field.
2128 @cindex marking characters, tables
2129 The marking characters have the following meaning:
2130 @table @samp
2131 @item !
2132 The fields in this line define names for the columns, so that you may
2133 refer to a column as @samp{$Tot} instead of @samp{$6}.
2134 @item ^
2135 This row defines names for the fields @emph{above} the row.  With such
2136 a definition, any formula in the table may use @samp{$m1} to refer to
2137 the value @samp{10}.  Also, if you assign a formula to a names field, it
2138 will be stored as @samp{$name=...}.
2139 @item _
2140 Similar to @samp{^}, but defines names for the fields in the row
2141 @emph{below}.
2142 @item $
2143 Fields in this row can define @emph{parameters} for formulas.  For
2144 example, if a field in a @samp{$} row contains @samp{max=50}, then
2145 formulas in this table can refer to the value 50 using @samp{$max}.
2146 Parameters work exactly like constants, only that they can be defined on
2147 a per-table basis.
2148 @item #
2149 Fields in this row are automatically recalculated when pressing
2150 @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row.  Also, this row
2151 is selected for a global recalculation with @kbd{C-u C-c *}.  Unmarked
2152 lines will be left alone by this command.
2153 @item *
2154 Selects this line for global recalculation with @kbd{C-u C-c *}, but
2155 not for automatic recalculation.  Use this when automatic
2156 recalculation slows down editing too much.
2157 @item
2158 Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
2159 All lines that should be recalculated should be marked with @samp{#}
2160 or @samp{*}.
2161 @item /
2162 Do not export this line.  Useful for lines that contain the narrowing
2163 @samp{<N>} markers.
2164 @end table
2166 Finally, just to whet your appetite on what can be done with the
2167 fantastic @file{calc} package, here is a table that computes the Taylor
2168 series of degree @code{n} at location @code{x} for a couple of
2169 functions.
2171 @example
2172 @group
2173 |---+-------------+---+-----+--------------------------------------|
2174 |   | Func        | n | x   | Result                               |
2175 |---+-------------+---+-----+--------------------------------------|
2176 | # | exp(x)      | 1 | x   | 1 + x                                |
2177 | # | exp(x)      | 2 | x   | 1 + x + x^2 / 2                      |
2178 | # | exp(x)      | 3 | x   | 1 + x + x^2 / 2 + x^3 / 6            |
2179 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2180 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2    |
2181 | * | tan(x)      | 3 | x   | 0.0175 x + 1.77e-6 x^3               |
2182 |---+-------------+---+-----+--------------------------------------|
2183 #+TBLFM: $5=taylor($2,$4,$3);n3
2184 @end group
2185 @end example
2187 @node Hyperlinks, TODO Items, Tables, Top
2188 @chapter Hyperlinks
2189 @cindex hyperlinks
2191 Like HTML, Org provides links inside a file, external links to
2192 other files, Usenet articles, emails, and much more.
2194 @menu
2195 * Link format::                 How links in Org are formatted
2196 * Internal links::              Links to other places in the current file
2197 * External links::              URL-like links to the world
2198 * Handling links::              Creating, inserting and following
2199 * Using links outside Org::     Linking from my C source code?
2200 * Link abbreviations::          Shortcuts for writing complex links
2201 * Search options::              Linking to a specific location
2202 * Custom searches::             When the default search is not enough
2203 @end menu
2205 @node Link format, Internal links, Hyperlinks, Hyperlinks
2206 @section Link format
2207 @cindex link format
2208 @cindex format, of links
2210 Org will recognize plain URL-like links and activate them as
2211 clickable links.  The general link format, however, looks like this:
2213 @example
2214 [[link][description]]       @r{or alternatively}           [[link]]
2215 @end example
2217 Once a link in the buffer is complete (all brackets present), Org
2218 will change the display so that @samp{description} is displayed instead
2219 of @samp{[[link][description]]} and @samp{link} is displayed instead of
2220 @samp{[[link]]}.  Links will be highlighted in the face @code{org-link},
2221 which by default is an underlined face.  You can directly edit the
2222 visible part of a link.  Note that this can be either the @samp{link}
2223 part (if there is no description) or the @samp{description} part.  To
2224 edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
2225 cursor on the link.
2227 If you place the cursor at the beginning or just behind the end of the
2228 displayed text and press @key{BACKSPACE}, you will remove the
2229 (invisible) bracket at that location.  This makes the link incomplete
2230 and the internals are again displayed as plain text.  Inserting the
2231 missing bracket hides the link internals again.  To show the
2232 internal structure of all links, use the menu entry
2233 @code{Org->Hyperlinks->Literal links}.
2235 @node Internal links, External links, Link format, Hyperlinks
2236 @section Internal links
2237 @cindex internal links
2238 @cindex links, internal
2239 @cindex targets, for links
2241 If the link does not look like a URL, it is considered to be internal in
2242 the current file.  Links such as @samp{[[My Target]]} or @samp{[[My
2243 Target][Find my target]]} lead to a text search in the current file.
2244 The link can be followed with @kbd{C-c C-o} when the cursor is on the
2245 link, or with a mouse click (@pxref{Handling links}).  The preferred
2246 match for such a link is a dedicated target: the same string in double
2247 angular brackets.  Targets may be located anywhere; sometimes it is
2248 convenient to put them into a comment line. For example
2250 @example
2251 # <<My Target>>
2252 @end example
2254 @noindent In HTML export (@pxref{HTML export}), such targets will become
2255 named anchors for direct access through @samp{http} links@footnote{Note
2256 that text before the first headline is usually not exported, so the
2257 first such target should be after the first headline.}.
2259 If no dedicated target exists, Org will search for the words in the
2260 link.  In the above example the search would be for @samp{my target}.
2261 Links starting with a star like @samp{*My Target} restrict the search to
2262 headlines.  When searching, Org mode will first try an exact match, but
2263 then move on to more and more lenient searches.  For example, the link
2264 @samp{[[*My Targets]]} will find any of the following:
2266 @example
2267 ** My targets
2268 ** TODO my targets are bright
2269 ** my 20 targets are
2270 @end example
2272 To insert a link targeting a headline, in-buffer completion can be used.
2273 Just type a star followed by a few optional letters into the buffer and
2274 press @kbd{M-@key{TAB}}.  All headlines in the current buffer will be
2275 offered as completions.  @xref{Handling links}, for more commands
2276 creating links.
2278 Following a link pushes a mark onto Org's own mark ring.  You can
2279 return to the previous position with @kbd{C-c &}.  Using this command
2280 several times in direct succession goes back to positions recorded
2281 earlier.
2283 @menu
2284 * Radio targets::               Make targets trigger links in plain text
2285 @end menu
2287 @node Radio targets,  , Internal links, Internal links
2288 @subsection Radio targets
2289 @cindex radio targets
2290 @cindex targets, radio
2291 @cindex links, radio targets
2293 Org can automatically turn any occurrences of certain target names
2294 in normal text into a link.  So without explicitly creating a link, the
2295 text connects to the target radioing its position.  Radio targets are
2296 enclosed by triple angular brackets.  For example, a target @samp{<<<My
2297 Target>>>} causes each occurrence of @samp{my target} in normal text to
2298 become activated as a link.  The Org file is scanned automatically
2299 for radio targets only when the file is first loaded into Emacs.  To
2300 update the target list during editing, press @kbd{C-c C-c} with the
2301 cursor on or at a target.
2303 @node External links, Handling links, Internal links, Hyperlinks
2304 @section External links
2305 @cindex links, external
2306 @cindex external links
2307 @cindex links, external
2308 @cindex Gnus links
2309 @cindex BBDB links
2310 @cindex IRC links
2311 @cindex URL links
2312 @cindex file links
2313 @cindex VM links
2314 @cindex RMAIL links
2315 @cindex WANDERLUST links
2316 @cindex MH-E links
2317 @cindex USENET links
2318 @cindex SHELL links
2319 @cindex Info links
2320 @cindex elisp links
2322 Org supports links to files, websites, Usenet and email messages,
2323 BBDB database entries and links to both IRC conversations and their
2324 logs.  External links are URL-like locators.  They start with a short
2325 identifying string followed by a colon.  There can be no space after
2326 the colon.  The following list shows examples for each link type.
2328 @example
2329 http://www.astro.uva.nl/~dominik          @r{on the web}
2330 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
2331 file:papers/last.pdf                      @r{file, relative path}
2332 news:comp.emacs                           @r{Usenet link}
2333 mailto:adent@@galaxy.net                  @r{Mail link}
2334 vm:folder                                 @r{VM folder link}
2335 vm:folder#id                              @r{VM message link}
2336 vm://myself@@some.where.org/folder#id     @r{VM on remote machine}
2337 wl:folder                                 @r{WANDERLUST folder link}
2338 wl:folder#id                              @r{WANDERLUST message link}
2339 mhe:folder                                @r{MH-E folder link}
2340 mhe:folder#id                             @r{MH-E message link}
2341 rmail:folder                              @r{RMAIL folder link}
2342 rmail:folder#id                           @r{RMAIL message link}
2343 gnus:group                                @r{Gnus group link}
2344 gnus:group#id                             @r{Gnus article link}
2345 bbdb:Richard Stallman                     @r{BBDB link}
2346 irc:/irc.com/#emacs/bob                   @r{IRC link}
2347 shell:ls *.org                            @r{A shell command}
2348 elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
2349 @end example
2351 A link should be enclosed in double brackets and may contain a
2352 descriptive text to be displayed instead of the URL (@pxref{Link
2353 format}), for example:
2355 @example
2356 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
2357 @end example
2359 @noindent
2360 If the description is a file name or URL that points to an image, HTML
2361 export (@pxref{HTML export}) will inline the image as a clickable
2362 button.  If there is no description at all and the link points to an
2363 image,
2364 that image will be inlined into the exported HTML file.
2366 @cindex angular brackets, around links
2367 @cindex plain text external links
2368 Org also finds external links in the normal text and activates them
2369 as links.  If spaces must be part of the link (for example in
2370 @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
2371 about the end of the link, enclose them in angular brackets.
2373 @node Handling links, Using links outside Org, External links, Hyperlinks
2374 @section Handling links
2375 @cindex links, handling
2377 Org provides methods to create a link in the correct syntax, to
2378 insert it into an Org file, and to follow the link.
2380 @table @kbd
2381 @kindex C-c l
2382 @cindex storing links
2383 @item C-c l
2384 Store a link to the current location.  This is a @emph{global} command
2385 which can be used in any buffer to create a link.  The link will be
2386 stored for later insertion into an Org buffer (see below).  For
2387 Org files, if there is a @samp{<<target>>} at the cursor, the
2388 link points to the target.  Otherwise it points to the current
2389 headline.  For VM, Rmail, Wanderlust, MH-E, Gnus and BBDB buffers, the
2390 link will indicate the current article/entry.  For W3 and W3M buffers,
2391 the link goes to the current URL.  For IRC links, if you set the
2392 variable @code{org-irc-link-to-logs} to non-nil then @kbd{C-c l} will
2393 store a @samp{file:/} style link to the relevant point in the logs for
2394 the current conversation. Otherwise an @samp{irc:/} style link to the
2395 user/channel/server under the point will be stored.  For any other
2396 files, the link will point to the file, with a search string
2397 (@pxref{Search options}) pointing to the contents of the current line.
2398 If there is an active region, the selected words will form the basis
2399 of the search string.  If the automatically created link is not
2400 working correctly or accurately enough, you can write custom functions
2401 to select the search string and to do the search for particular file
2402 types - see @ref{Custom searches}.  The key binding @kbd{C-c l} is
2403 only a suggestion - see @ref{Installation}.
2405 @kindex C-c C-l
2406 @cindex link completion
2407 @cindex completion, of links
2408 @cindex inserting links
2409 @item C-c C-l
2410 Insert a link.  This prompts for a link to be inserted into the buffer.  You
2411 can just type a link, using text for an internal link, or one of the link
2412 type prefixes mentioned in the examples above.  All links stored during the
2413 current session are part of the history for this prompt, so you can access
2414 them with @key{up} and @key{down} (or @kbd{M-p/n}).  Completion, on the other
2415 hand, will help you to insert valid link prefixes like @samp{http:} or
2416 @samp{ftp:}, including the prefixes defined through link abbreviations
2417 (@pxref{Link abbreviations}).  The link will be inserted into the
2418 buffer@footnote{After insertion of a stored link, the link will be removed
2419 from the list of stored links.  To keep it in the list later use, use a
2420 triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
2421 @code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
2422 If some text was selected when this command is called, the selected text
2423 becomes the default description.@* Note that you don't have to use this
2424 command to insert a link.  Links in Org are plain text, and you can type
2425 or paste them straight into the buffer.  By using this command, the links are
2426 automatically enclosed in double brackets, and you will be asked for the
2427 optional descriptive text.
2429 @c  If the link is a @samp{file:} link and
2430 @c the linked file is located in the same directory as the current file or
2431 @c a subdirectory of it, the path of the file will be inserted relative to
2432 @c the current directory.
2434 @kindex C-u C-c C-l
2435 @cindex file name completion
2436 @cindex completion, of file names
2437 @item C-u C-c C-l
2438 When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
2439 a file will be inserted and you may use file name completion to select
2440 the name of the file.  The path to the file is inserted relative to the
2441 directory of the current org file, if the linked file is in the current
2442 directory or in a sub-directory of it, or if the path is written relative
2443 to the current directory using @samp{../}.  Otherwise an absolute path
2444 is used, if possible with @samp{~/} for your home directory.  You can
2445 force an absolute path with two @kbd{C-u} prefixes.
2447 @item C-c C-l @r{(with cursor on existing link)}
2448 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
2449 link and description parts of the link.
2451 @cindex following links
2452 @kindex C-c C-o
2453 @item C-c C-o
2454 Open link at point.  This will launch a web browser for URLs (using
2455 @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
2456 for the corresponding links, and execute the command in a shell link.
2457 When the cursor is on an internal link, this commands runs the
2458 corresponding search.  When the cursor is on a TAG list in a headline,
2459 it creates the corresponding TAGS view.  If the cursor is on a time
2460 stamp, it compiles the agenda for that date.  Furthermore, it will visit
2461 text and remote files in @samp{file:} links with Emacs and select a
2462 suitable application for local non-text files.  Classification of files
2463 is based on file extension only.  See option @code{org-file-apps}.  If
2464 you want to override the default application and visit the file with
2465 Emacs, use a @kbd{C-u} prefix.
2467 @kindex mouse-2
2468 @kindex mouse-1
2469 @item mouse-2
2470 @itemx mouse-1
2471 On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
2472 would.  Under Emacs 22, also @kbd{mouse-1} will follow a link.
2474 @kindex mouse-3
2475 @item mouse-3
2476 Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
2477 internal links to be displayed in another window@footnote{See the
2478 variable @code{org-display-internal-link-with-indirect-buffer}}.
2480 @cindex mark ring
2481 @kindex C-c %
2482 @item C-c %
2483 Push the current position onto the mark ring, to be able to return
2484 easily. Commands following an internal link do this automatically.
2486 @cindex links, returning to
2487 @kindex C-c &
2488 @item C-c &
2489 Jump back to a recorded position.  A position is recorded by the
2490 commands following internal links, and by @kbd{C-c %}.  Using this
2491 command several times in direct succession moves through a ring of
2492 previously recorded positions.
2494 @kindex C-c C-x C-n
2495 @kindex C-c C-x C-p
2496 @cindex links, finding next/previous
2497 @item C-c C-x C-n
2498 @itemx C-c C-x C-p
2499 Move forward/backward to the next link in the buffer.  At the limit of
2500 the buffer, the search fails once, and then wraps around.  The key
2501 bindings for this are really too long, you might want to bind this also
2502 to @kbd{C-n} and @kbd{C-p}
2503 @lisp
2504 (add-hook 'org-load-hook
2505   (lambda ()
2506     (define-key 'org-mode-map "\C-n" 'org-next-link)
2507     (define-key 'org-mode-map "\C-p" 'org-previous-link)))
2508 @end lisp
2509 @end table
2511 @node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
2512 @section Using links outside Org
2514 You can insert and follow links that have Org syntax not only in
2515 Org, but in any Emacs buffer.  For this, you should create two
2516 global commands, like this (please select suitable global keys
2517 yourself):
2519 @lisp
2520 (global-set-key "\C-c L" 'org-insert-link-global)
2521 (global-set-key "\C-c o" 'org-open-at-point-global)
2522 @end lisp
2524 @node Link abbreviations, Search options, Using links outside Org, Hyperlinks
2525 @section Link abbreviations
2526 @cindex link abbreviations
2527 @cindex abbreviation, links
2529 Long URLs can be cumbersome to type, and often many similar links are
2530 needed in a document.  For this you can use link abbreviations.  An
2531 abbreviated link looks like this
2533 @example
2534 [[linkword:tag][description]]
2535 @end example
2537 @noindent
2538 where the tag is optional.  Such abbreviations are resolved according to
2539 the information in the variable @code{org-link-abbrev-alist} that
2540 relates the linkwords to replacement text.  Here is an example:
2542 @lisp
2543 @group
2544 (setq org-link-abbrev-alist
2545   '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
2546     ("google"   . "http://www.google.com/search?q=")
2547     ("ads"      . "http://adsabs.harvard.edu/cgi-bin/
2548                    nph-abs_connect?author=%s&db_key=AST")))
2549 @end group
2550 @end lisp
2552 If the replacement text contains the string @samp{%s}, it will be
2553 replaced with the tag.  Otherwise the tag will be appended to the string
2554 in order to create the link.  You may also specify a function that will
2555 be called with the tag as the only argument to create the link.
2557 With the above setting, you could link to a specific bug with
2558 @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
2559 @code{[[google:OrgMode]]} and find out what the Org author is
2560 doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
2562 If you need special abbreviations just for a single Org buffer, you
2563 can define them in the file with
2565 @example
2566 #+LINK: bugzilla  http://10.1.2.9/bugzilla/show_bug.cgi?id=
2567 #+LINK: google    http://www.google.com/search?q=%s
2568 @end example
2570 @noindent
2571 In-buffer completion @pxref{Completion} can be used after @samp{[} to
2572 complete link abbreviations.
2574 @node Search options, Custom searches, Link abbreviations, Hyperlinks
2575 @section Search options in file links
2576 @cindex search option in file links
2577 @cindex file links, searching
2579 File links can contain additional information to make Emacs jump to a
2580 particular location in the file when following a link.  This can be a
2581 line number or a search option after a double@footnote{For backward
2582 compatibility, line numbers can also follow a single colon.} colon. For
2583 example, when the command @kbd{C-c l} creates a link (@pxref{Handling
2584 links}) to a file, it encodes the words in the current line as a search
2585 string that can be used to find this line back later when following the
2586 link with @kbd{C-c C-o}.
2588 Here is the syntax of the different ways to attach a search to a file
2589 link, together with an explanation:
2591 @example
2592 [[file:~/code/main.c::255]]
2593 [[file:~/xx.org::My Target]]
2594 [[file:~/xx.org::*My Target]]
2595 [[file:~/xx.org::/regexp/]]
2596 @end example
2598 @table @code
2599 @item 255
2600 Jump to line 255.
2601 @item My Target
2602 Search for a link target @samp{<<My Target>>}, or do a text search for
2603 @samp{my target}, similar to the search in internal links, see
2604 @ref{Internal links}.  In HTML export (@pxref{HTML export}), such a file
2605 link will become an HTML reference to the corresponding named anchor in
2606 the linked file.
2607 @item *My Target
2608 In an Org file, restrict search to headlines.
2609 @item /regexp/
2610 Do a regular expression search for @code{regexp}.  This uses the Emacs
2611 command @code{occur} to list all matches in a separate window.  If the
2612 target file is in Org mode, @code{org-occur} is used to create a
2613 sparse tree with the matches.
2614 @c If the target file is a directory,
2615 @c @code{grep} will be used to search all files in the directory.
2616 @end table
2618 As a degenerate case, a file link with an empty file name can be used
2619 to search the current file.  For example, @code{[[file:::find me]]} does
2620 a search for @samp{find me} in the current file, just as
2621 @samp{[[find me]]} would.
2623 @node Custom searches,  , Search options, Hyperlinks
2624 @section Custom Searches
2625 @cindex custom search strings
2626 @cindex search strings, custom
2628 The default mechanism for creating search strings and for doing the
2629 actual search related to a file link may not work correctly in all
2630 cases.  For example, BibTeX database files have many entries like
2631 @samp{year="1993"} which would not result in good search strings,
2632 because the only unique identification for a BibTeX entry is the
2633 citation key.
2635 If you come across such a problem, you can write custom functions to set
2636 the right search string for a particular file type, and to do the search
2637 for the string in the file.  Using @code{add-hook}, these functions need
2638 to be added to the hook variables
2639 @code{org-create-file-search-functions} and
2640 @code{org-execute-file-search-functions}.  See the docstring for these
2641 variables for more information.  Org actually uses this mechanism
2642 for Bib@TeX{} database files, and you can use the corresponding code as
2643 an implementation example.  Search for @samp{BibTeX links} in the source
2644 file.
2648 @node TODO Items, Tags, Hyperlinks, Top
2649 @chapter TODO Items
2650 @cindex TODO items
2652 Org mode does not maintain TODO lists as separate documents.  Instead,
2653 TODO items are an integral part of the notes file, because TODO items
2654 usually come up while taking notes!  With Org mode, simply mark any
2655 entry in a tree as being a TODO item.  In this way, information is not
2656 duplicated, and the entire context from which the TODO item emerged is
2657 always present.
2659 Of course, this technique for managing TODO items scatters them
2660 throughout your notes file.  Org mode compensates for this by providing
2661 methods to give you an overview of all the things that you have to do.
2663 @menu
2664 * TODO basics::                 Marking and displaying TODO entries
2665 * TODO extensions::             Workflow and assignments
2666 * Progress logging::            Dates and notes for progress
2667 * Priorities::                  Some things are more important than others
2668 * Breaking down tasks::         Splitting a task into manageable pieces
2669 * Checkboxes::                  Tick-off lists
2670 @end menu
2672 @node TODO basics, TODO extensions, TODO Items, TODO Items
2673 @section Basic TODO functionality
2675 Any headline becomes a TODO item when it starts with the word
2676 @samp{TODO}, for example:
2678 @example
2679 *** TODO Write letter to Sam Fortune
2680 @end example
2682 @noindent
2683 The most important commands to work with TODO entries are:
2685 @table @kbd
2686 @kindex C-c C-t
2687 @cindex cycling, of TODO states
2688 @item C-c C-t
2689 Rotate the TODO state of the current item among
2691 @example
2692 ,-> (unmarked) -> TODO -> DONE --.
2693 '--------------------------------'
2694 @end example
2696 The same rotation can also be done ``remotely'' from the timeline and
2697 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
2699 @kindex C-u C-c C-t
2700 @item C-u C-c C-t
2701 Select a specific keyword using completion or (if it has been set up)
2702 the fast selection interface.  For the latter, you need to assign keys
2703 to TODO states, see @ref{Per-file keywords} and @ref{Setting tags} for
2704 more information.
2706 @kindex S-@key{right}
2707 @kindex S-@key{left}
2708 @item S-@key{right}
2709 @itemx S-@key{left}
2710 Select the following/preceding TODO state, similar to cycling.  Useful
2711 mostly if more than two TODO states are possible (@pxref{TODO
2712 extensions}).
2713 @kindex C-c C-v
2714 @kindex C-c / t
2715 @cindex sparse tree, for TODO
2716 @item C-c C-v
2717 @itemx C-c / t
2718 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
2719 the entire buffer, but shows all TODO items and the headings hierarchy
2720 above them.  With a prefix argument, search for a specific TODO.  You will be
2721 prompted for the keyword, and you can also give a list of keywords like
2722 @code{KWD1|KWD2|...}.  With numeric prefix argument N, show the tree for the
2723 Nth keyword in the variable @code{org-todo-keywords}.  With two prefix
2724 arguments, find all TODO and DONE entries.
2725 @kindex C-c a t
2726 @item C-c a t
2727 Show the global TODO list.  Collects the TODO items from all agenda
2728 files (@pxref{Agenda Views}) into a single buffer.  The new buffer will
2729 be in @code{agenda-mode}, which provides commands to examine and
2730 manipulate the TODO entries from the new buffer (@pxref{Agenda
2731 commands}).  @xref{Global TODO list}, for more information.
2732 @kindex S-M-@key{RET}
2733 @item S-M-@key{RET}
2734 Insert a new TODO entry below the current one.
2735 @end table
2737 @node TODO extensions, Progress logging, TODO basics, TODO Items
2738 @section Extended use of TODO keywords
2739 @cindex extended TODO keywords
2741 By default, marked TODO entries have one of only two states: TODO and
2742 DONE.  Org mode allows you to classify TODO items in more complex ways
2743 with @emph{TODO keywords} (stored in @code{org-todo-keywords}).  With
2744 special setup, the TODO keyword system can work differently in different
2745 files.
2747 Note that @i{tags} are another way to classify headlines in general and
2748 TODO items in particular (@pxref{Tags}).
2750 @menu
2751 * Workflow states::             From TODO to DONE in steps
2752 * TODO types::                  I do this, Fred does the rest
2753 * Multiple sets in one file::   Mixing it all, and still finding your way
2754 * Fast access to TODO states::  Single letter selection of a state
2755 * Per-file keywords::           Different files, different requirements
2756 * Faces for TODO keywords::     Highlighting states
2757 @end menu
2759 @node Workflow states, TODO types, TODO extensions, TODO extensions
2760 @subsection TODO keywords as workflow states
2761 @cindex TODO workflow
2762 @cindex workflow states as TODO keywords
2764 You can use TODO keywords to indicate different @emph{sequential} states
2765 in the process of working on an item, for example@footnote{Changing
2766 this variable only becomes effective after restarting Org mode in a
2767 buffer.}:
2769 @lisp
2770 (setq org-todo-keywords
2771   '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
2772 @end lisp
2774 The vertical bar separates the TODO keywords (states that @emph{need
2775 action}) from the DONE states (which need @emph{no further action}.  If
2776 you don't provide the separator bar, the last state is used as the DONE
2777 state.
2778 @cindex completion, of TODO keywords
2779 With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
2780 to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED.  You may
2781 also use a numeric prefix argument to quickly select a specific state.  For
2782 example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
2783 Or you can use @kbd{S-left} to go backward through the sequence.  If you
2784 define many keywords, you can use in-buffer completion
2785 (@pxref{Completion}) or even a special one-key selection scheme
2786 (@pxref{Fast access to TODO states}) to insert these words into the
2787 buffer.  Changing a TODO state can be logged with a timestamp, see
2788 @ref{Tracking TODO state changes} for more information.
2790 @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
2791 @subsection TODO keywords as types
2792 @cindex TODO types
2793 @cindex names as TODO keywords
2794 @cindex types as TODO keywords
2796 The second possibility is to use TODO keywords to indicate different
2797 @emph{types} of action items.  For example, you might want to indicate
2798 that items are for ``work'' or ``home''.  Or, when you work with several
2799 people on a single project, you might want to assign action items
2800 directly to persons, by using their names as TODO keywords.  This would
2801 be set up like this:
2803 @lisp
2804 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
2805 @end lisp
2807 In this case, different keywords do not indicate a sequence, but rather
2808 different types.  So the normal work flow would be to assign a task to a
2809 person, and later to mark it DONE.  Org mode supports this style by adapting
2810 the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
2811 @kbd{t} command in the timeline and agenda buffers.}.  When used several
2812 times in succession, it will still cycle through all names, in order to first
2813 select the right type for a task.  But when you return to the item after some
2814 time and execute @kbd{C-c C-t} again, it will switch from any name directly
2815 to DONE.  Use prefix arguments or completion to quickly select a specific
2816 name.  You can also review the items of a specific TODO type in a sparse tree
2817 by using a numeric prefix to @kbd{C-c C-v}.  For example, to see all things
2818 Lucy has to do, you would use @kbd{C-3 C-c C-v}.  To collect Lucy's items
2819 from all agenda files into a single buffer, you would use the numeric prefix
2820 argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
2822 @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
2823 @subsection Multiple keyword sets in one file
2824 @cindex TODO keyword sets
2826 Sometimes you may want to use different sets of TODO keywords in
2827 parallel.  For example, you may want to have the basic
2828 @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
2829 separate state indicating that an item has been canceled (so it is not
2830 DONE, but also does not require action).  Your setup would then look
2831 like this:
2833 @lisp
2834 (setq org-todo-keywords
2835       '((sequence "TODO" "|" "DONE")
2836         (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
2837         (sequence "|" "CANCELED")))
2838 @end lisp
2840 The keywords should all be different, this helps Org mode to keep track
2841 of which subsequence should be used for a given entry.  In this setup,
2842 @kbd{C-c C-t} only operates within a subsequence, so it switches from
2843 @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
2844 (nothing) to @code{REPORT}.  Therefore you need a mechanism to initially
2845 select the correct sequence.  Besides the obvious ways like typing a
2846 keyword or using completion, you may also apply the following commands:
2848 @table @kbd
2849 @kindex C-S-@key{right}
2850 @kindex C-S-@key{left}
2851 @item C-S-@key{right}
2852 @itemx C-S-@key{left}
2853 These keys jump from one TODO subset to the next.  In the above example,
2854 @kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
2855 @code{REPORT}, and any of the words in the second row to @code{CANCELED}.
2856 @kindex S-@key{right}
2857 @kindex S-@key{left}
2858 @item S-@key{right}
2859 @itemx S-@key{left}
2860 @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
2861 @emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
2862 would switch from @code{DONE} to @code{REPORT} in the example above.
2863 @end table
2865 @node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
2866 @subsection Fast access to TODO states
2868 If you would like to quickly change an entry to an arbitrary TODO state
2869 instead of cycling through the states, you can set up keys for
2870 single-letter access to the states.  This is done by adding the section
2871 key after each keyword, in parenthesis.  For example:
2873 @lisp
2874 (setq org-todo-keywords
2875       '((sequence "TODO(t)" "|" "DONE(d)")
2876         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
2877         (sequence "|" "CANCELED(c)")))
2878 @end lisp
2880 If you then press @code{C-u C-c C-t} followed by the selection key, the
2881 entry will be switched to this state.  @key{SPC} can be used to remove
2882 any TODO keyword from an entry.  Should you like this way of selecting
2883 TODO states a lot, you might want to set the variable
2884 @code{org-use-fast-todo-selection} to @code{t} and make this behavior
2885 the default.  Check also the variable
2886 @code{org-fast-tag-selection-include-todo}, it allows to change the TODO
2887 state through the tags interface (@pxref{Setting tags}), in case you
2888 like to mingle the two concepts.
2890 @node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
2891 @subsection Setting up keywords for individual files
2892 @cindex keyword options
2893 @cindex per-file keywords
2895 It can be very useful to use different aspects of the TODO mechanism in
2896 different files.  For file-local settings, you need to add special lines
2897 to the file which set the keywords and interpretation for that file
2898 only.  For example, to set one of the two examples discussed above, you
2899 need one of the following lines, starting in column zero anywhere in the
2900 file:
2902 @example
2903 #+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
2904 @end example
2906 @example
2907 #+TYP_TODO: Fred Sara Lucy Mike | DONE
2908 @end example
2910 A setup for using several sets in parallel would be:
2912 @example
2913 #+SEQ_TODO: TODO | DONE
2914 #+SEQ_TODO: REPORT BUG KNOWNCAUSE | FIXED
2915 #+SEQ_TODO: | CANCELED
2916 @end example
2918 @cindex completion, of option keywords
2919 @kindex M-@key{TAB}
2920 @noindent To make sure you are using the correct keyword, type
2921 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
2923 @cindex DONE, final TODO keyword
2924 Remember that the keywords after the vertical bar (or the last keyword
2925 if no bar is there) must always mean that the item is DONE (although you
2926 may use a different word).  After changing one of these lines, use
2927 @kbd{C-c C-c} with the cursor still in the line to make the changes
2928 known to Org mode@footnote{Org mode parses these lines only when
2929 Org mode is activated after visiting a file.  @kbd{C-c C-c} with the
2930 cursor in a line starting with @samp{#+} is simply restarting Org mode
2931 for the current buffer.}.
2933 @node Faces for TODO keywords,  , Per-file keywords, TODO extensions
2934 @subsection Faces for TODO keywords
2935 @cindex faces, for TODO keywords
2937 Org mode highlights TODO keywords with special faces: @code{org-todo}
2938 for keywords indicating that an item still has to be acted upon, and
2939 @code{org-done} for keywords indicating that an item is finished.  If
2940 you are using more than 2 different states, you might want to use
2941 special faces for some of them.  This can be done using the variable
2942 @code{org-todo-keyword-faces}.  For example:
2944 @lisp
2945 (setq org-todo-keyword-faces
2946       '(("TODO"      . org-warning)
2947         ("DEFERRED"  . shadow)
2948         ("CANCELED"  . (:foreground "blue" :weight bold))))
2949 @end lisp
2951 While using a list with face properties as shown for CANCELED
2952 @emph{should} work, this does not aways seem to be the case.  If
2953 necessary, define a special face and use that.
2955 @page
2956 @node Progress logging, Priorities, TODO extensions, TODO Items
2957 @section Progress logging
2958 @cindex progress logging
2959 @cindex logging, of progress
2961 Org mode can automatically record a time stamp and possibly a note when
2962 you mark a TODO item as DONE, or even each time you change the state of
2963 a TODO item.  This system is highly configurable, settings can be on a
2964 per-keyword basis and can be localized to a file or even a subtree.  For
2965 information on how to clock working time for a task, see @ref{Clocking
2966 work time}.
2968 @menu
2969 * Closing items::               When was this entry marked DONE?
2970 * Tracking TODO state changes::  When did the status change?
2971 @end menu
2973 @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
2974 @subsection Closing items
2976 The most basic logging is to keep track of @emph{when} a certain TODO
2977 item was finished.  This is achieved with@footnote{The corresponding
2978 in-buffer setting is: @code{#+STARTUP: logdone}}.
2980 @lisp
2981 (setq org-log-done 'time)
2982 @end lisp
2984 @noindent
2985 Then each time you turn an entry from a TODO (not-done) state into any
2986 of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
2987 just after the headline.  If you turn the entry back into a TODO item
2988 through further state cycling, that line will be removed again.  If you
2989 want to record a note along with the timestamp, use@footnote{The
2990 corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
2992 @lisp
2993 (setq org-log-done 'note)
2994 @end lisp
2996 @noindent
2997 You will then be prompted for a note, and that note will be stored below
2998 the entry with a @samp{Closing Note} heading.
3000 In the timeline (@pxref{Timeline}) and in the agenda
3001 (@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
3002 display the TODO items with a @samp{CLOSED} timestamp on each day,
3003 giving you an overview of what has been done.
3005 @node Tracking TODO state changes,  , Closing items, Progress logging
3006 @subsection Tracking TODO state changes
3008 When TODO keywords are used as workflow states (@pxref{Workflow
3009 states}), you might want to keep track of when a state change occurred
3010 and maybe take a note about this change.  Since it is normally too much
3011 to record a note for every state, Org mode expects configuration on a
3012 per-keyword basis for this.  This is achieved by adding special markers
3013 @samp{!} (for a time stamp) and @samp{@@} (for a note) in parenthesis
3014 after each keyword.  For example, with the setting
3016 @lisp
3017 (setq org-todo-keywords
3018   '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
3019 @end lisp
3021 @noindent
3022 you not only define global TODO keywords and fast access keys, but also
3023 request that a time is recorded when the entry is turned into
3024 DONE@footnote{It is possible that Org mode will record two time stamps
3025 when you are using both @code{org-log-done} and state change logging.
3026 However, it will never prompt for two notes - if you have configured
3027 both, the state change recording note will take precedence and cancel
3028 the @samp{Closing Note}.}, and that a note is recorded when switching to
3029 WAIT or CANCELED.  The setting for WAIT is even more special: The
3030 @samp{!} after the slash means that in addition to the note taken when
3031 entering the state, a time stamp should be recorded when @i{leaving} the
3032 WAIT state, if and only if the @i{target} state does not configure
3033 logging for entering it.  So it has no effect when switching from WAIT
3034 to DONE, because DONE is configured to record a timestamp only.  But
3035 when switching from WAIT back to TODO, the @samp{/!} in the WAIT
3036 setting now triggers a timestamp even though TODO has no logging
3037 configured.
3039 You can use the exact same syntax for setting logging preferences local
3040 to a buffer:
3041 @example
3042 #+SEQ_TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
3043 @end example
3045 In order to define logging settings that are local to a subtree or a
3046 single item, define a LOGGING property in this entry.  Any non-empty
3047 LOGGING property resets all logging settings to nil.  You may then turn
3048 on logging for this specific tree using STARTUP keywords like
3049 @code{lognotedone} or @code{logrepeat}, as well as adding state specific
3050 settings like @code{TODO(!)}.  For example
3052 @example
3053 * TODO Log each state with only a time
3054   :PROPERTIES:
3055   :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
3056   :END:
3057 * TODO Only log when switching to WAIT, and when repeating
3058   :PROPERTIES:
3059   :LOGGING: WAIT(@@) logrepeat
3060   :END:
3061 * TODO No logging at all
3062   :PROPERTIES:
3063   :LOGGING: nil
3064   :END:
3065 @end example
3068 @node Priorities, Breaking down tasks, Progress logging, TODO Items
3069 @section Priorities
3070 @cindex priorities
3072 If you use Org mode extensively, you may end up enough TODO items that
3073 it starts to make sense to prioritize them.  Prioritizing can be done by
3074 placing a @emph{priority cookie} into the headline of a TODO item, like
3075 this
3077 @example
3078 *** TODO [#A] Write letter to Sam Fortune
3079 @end example
3081 @noindent
3082 By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
3083 @samp{C}.  @samp{A} is the highest priority.  An entry without a cookie
3084 is treated as priority @samp{B}.  Priorities make a difference only in
3085 the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
3086 no inherent meaning to Org mode.
3088 Priorities can be attached to any outline tree entries; they do not need
3089 to be TODO items.
3091 @table @kbd
3092 @kindex @kbd{C-c ,}
3093 @item @kbd{C-c ,}
3094 Set the priority of the current headline.  The command prompts for a
3095 priority character @samp{A}, @samp{B} or @samp{C}.  When you press
3096 @key{SPC} instead, the priority cookie is removed from the headline.
3097 The priorities can also be changed ``remotely'' from the timeline and
3098 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
3100 @kindex S-@key{up}
3101 @kindex S-@key{down}
3102 @item S-@key{up}
3103 @itemx S-@key{down}
3104 Increase/decrease priority of current headline@footnote{See also the
3105 option @code{org-priority-start-cycle-with-default'}.}.  Note that these
3106 keys are also used to modify time stamps (@pxref{Creating timestamps}).
3107 Furthermore, these keys are also used by CUA mode (@pxref{Conflicts}).
3108 @end table
3110 You can change the range of allowed priorities by setting the variables
3111 @code{org-highest-priority}, @code{org-lowest-priority}, and
3112 @code{org-default-priority}.  For an individual buffer, you may set
3113 these values (highest, lowest, default) like this (please make sure that
3114 the highest priority is earlier in the alphabet than the lowest
3115 priority):
3117 @example
3118 #+PRIORITIES: A C B
3119 @end example
3121 @node Breaking down tasks, Checkboxes, Priorities, TODO Items
3122 @section Breaking tasks down into subtasks
3123 @cindex tasks, breaking down
3125 It is often advisable to break down large tasks into smaller, manageable
3126 subtasks.  You can do this by creating an outline tree below a TODO
3127 item, with detailed subtasks on the tree@footnote{To keep subtasks out
3128 of the global TODO list, see the
3129 @code{org-agenda-todo-list-sublevels}.}.  Another possibility is the use
3130 of checkboxes to identify (a hierarchy of) a large number of subtasks
3131 (@pxref{Checkboxes}).
3134 @node Checkboxes,  , Breaking down tasks, TODO Items
3135 @section Checkboxes
3136 @cindex checkboxes
3138 Every item in a plain list (@pxref{Plain lists}) can be made into a
3139 checkbox by starting it with the string @samp{[ ]}.  This feature is
3140 similar to TODO items (@pxref{TODO Items}), but is more lightweight.
3141 Checkboxes are not included into the global TODO list, so they are often
3142 great to split a task into a number of simple steps.  Or you can use
3143 them in a shopping list.  To toggle a checkbox, use @kbd{C-c C-c}, or
3144 use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
3146 Here is an example of a checkbox list.
3148 @example
3149 * TODO Organize party [2/4]
3150   - [-] call people [1/3]
3151     - [ ] Peter
3152     - [X] Sarah
3153     - [ ] Sam
3154   - [X] order food
3155   - [ ] think about what music to play
3156   - [X] talk to the neighbors
3157 @end example
3159 Checkboxes work hierarchically, so if a checkbox item has children that
3160 are checkboxes, toggling one of the children checkboxes will make the
3161 parent checkbox reflect if none, some, or all of the children are
3162 checked.
3164 @cindex statistics, for checkboxes
3165 @cindex checkbox statistics
3166 The @samp{[2/4]} and @samp{[1/3]} in the first and second line are
3167 cookies indicating how many checkboxes present in this entry have been
3168 checked off, and the total number of checkboxes are present.  This can
3169 give you an idea on how many checkboxes remain, even without opening a
3170 folded entry.  The cookies can be placed into a headline or into (the
3171 first line of) a plain list item. Each cookie covers all checkboxes
3172 structurally below the headline/item on which the cookie appear.  You
3173 have to insert the cookie yourself by typing either @samp{[/]} or
3174 @samp{[%]}.  With @samp{[/]} you get an @samp{n out of m} result, as in
3175 the examples above.  With @samp{[%]} you get information about the
3176 percentage of checkboxes checked (in the above example, this would be
3177 @samp{[50%]} and @samp{[33%]}, respectively).
3179 @noindent The following commands work with checkboxes:
3181 @table @kbd
3182 @kindex C-c C-c
3183 @item C-c C-c
3184 Toggle checkbox at point.  With a prefix argument, set it to @samp{[-]},
3185 which is considered to be an intermediate state.
3186 @kindex C-c C-x C-b
3187 @item C-c C-x C-b
3188 Toggle checkbox at point.
3189 @itemize @minus
3190 @item
3191 If there is an active region, toggle the first checkbox in the region
3192 and set all remaining boxes to the same status as the first.  If you
3193 want to toggle all boxes in the region independently, use a prefix
3194 argument.
3195 @item
3196 If the cursor is in a headline, toggle checkboxes in the region between
3197 this headline and the next (so @emph{not} the entire subtree).
3198 @item
3199 If there is no active region, just toggle the checkbox at point.
3200 @end itemize
3201 @kindex M-S-@key{RET}
3202 @item M-S-@key{RET}
3203 Insert a new item with a checkbox.
3204 This works only if the cursor is already in a plain list item
3205 (@pxref{Plain lists}).
3206 @kindex C-c #
3207 @item C-c #
3208 Update the checkbox statistics in the current outline entry.  When
3209 called with a @kbd{C-u} prefix, update the entire file.  Checkbox
3210 statistic cookies are updated automatically if you toggle checkboxes
3211 with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}.  If you
3212 delete boxes or add/change them by hand, use this command to get things
3213 back into synch.  Or simply toggle any checkbox twice with @kbd{C-c C-c}.
3214 @end table
3216 @node Tags, Properties and Columns, TODO Items, Top
3217 @chapter Tags
3218 @cindex tags
3219 @cindex headline tagging
3220 @cindex matching, tags
3221 @cindex sparse tree, tag based
3223 An excellent way to implement labels and contexts for cross-correlating
3224 information is to assign @i{tags} to headlines.  Org mode has extensive
3225 support for tags.
3227 Every headline can contain a list of tags; they occur at the end of the
3228 headline.  Tags are normal words containing letters, numbers, @samp{_},
3229 and @samp{@@}.  Tags must be preceded and followed by a single colon,
3230 e.g., @samp{:WORK:}.  Several tags can be specified, as in
3231 @samp{:work:URGENT:}.
3233 @menu
3234 * Tag inheritance::             Tags use the tree structure of the outline
3235 * Setting tags::                How to assign tags to a headline
3236 * Tag searches::                Searching for combinations of tags
3237 @end menu
3239 @node Tag inheritance, Setting tags, Tags, Tags
3240 @section Tag inheritance
3241 @cindex tag inheritance
3242 @cindex inheritance, of tags
3243 @cindex sublevels, inclusion into tags match
3245 @i{Tags} make use of the hierarchical structure of outline trees.  If a
3246 heading has a certain tag, all subheadings will inherit the tag as
3247 well.  For example, in the list
3249 @example
3250 * Meeting with the French group      :work:
3251 ** Summary by Frank                  :boss:notes:
3252 *** TODO Prepare slides for him      :action:
3253 @end example
3255 @noindent
3256 the final heading will have the tags @samp{:work:}, @samp{:boss:},
3257 @samp{:notes:}, and @samp{:action:} even though the final heading is not
3258 explicitly marked with those tags.  When executing tag searches and
3259 Org mode finds that a certain headline matches the search criterion, it
3260 will not check any sublevel headline, assuming that these also match and
3261 that the list of matches could become very long because of that.  If you
3262 do want the sublevels be tested and listed as well, you may set the
3263 variable @code{org-tags-match-list-sublevels}.  To limit tag inheritance
3264 to specific tags, or to turn it off entirely, use the variable
3265 @code{org-use-tag-inheritance}.
3267 @node Setting tags, Tag searches, Tag inheritance, Tags
3268 @section Setting tags
3269 @cindex setting tags
3270 @cindex tags, setting
3272 @kindex M-@key{TAB}
3273 Tags can simply be typed into the buffer at the end of a headline.
3274 After a colon, @kbd{M-@key{TAB}} offers completion on tags.  There is
3275 also a special command for inserting tags:
3277 @table @kbd
3278 @kindex C-c C-c
3279 @item C-c C-c
3280 @cindex completion, of tags
3281 Enter new tags for the current headline.  Org mode will either offer
3282 completion or a special single-key interface for setting tags, see
3283 below.  After pressing @key{RET}, the tags will be inserted and aligned
3284 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
3285 tags in the current buffer will be aligned to that column, just to make
3286 things look nice.  TAGS are automatically realigned after promotion,
3287 demotion, and TODO state changes (@pxref{TODO basics}).
3288 @end table
3290 Org will support tag insertion based on a @emph{list of tags}.  By
3291 default this list is constructed dynamically, containing all tags
3292 currently used in the buffer.  You may also globally specify a hard list
3293 of tags with the variable @code{org-tag-alist}.  Finally you can set
3294 the default tags for a given file with lines like
3296 @example
3297 #+TAGS: @@work @@home @@tennisclub
3298 #+TAGS: laptop car pc sailboat
3299 @end example
3301 If you have globally defined your preferred set of tags using the
3302 variable @code{org-tag-alist}, but would like to use a dynamic tag list
3303 in a specific file, add an empty TAGS option line to that file:
3305 @example
3306 #+TAGS:
3307 @end example
3309 By default Org mode uses the standard minibuffer completion facilities for
3310 entering tags.  However, it also implements another, quicker, tag selection
3311 method called @emph{fast tag selection}.  This allows you to select and
3312 deselect tags with just a single key press.  For this to work well you should
3313 assign unique letters to most of your commonly used tags.  You can do this
3314 globally by configuring the variable @code{org-tag-alist} in your
3315 @file{.emacs} file.  For example, you may find the need to tag many items in
3316 different files with @samp{:@@home:}.  In this case you can set something
3317 like:
3319 @lisp
3320 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
3321 @end lisp
3323 @noindent If the tag is only relevant to the file you are working on then you
3324 can, instead, set the TAGS option line as:
3326 @example
3327 #+TAGS: @@work(w)  @@home(h)  @@tennisclub(t)  laptop(l)  pc(p)
3328 @end example
3330 @noindent
3331 You can also group together tags that are mutually exclusive.  By using
3332 braces, as in:
3334 @example
3335 #+TAGS: @{ @@work(w)  @@home(h)  @@tennisclub(t) @}  laptop(l)  pc(p)
3336 @end example
3338 @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
3339 and @samp{@@tennisclub} should be selected.  Multiple such groups are allowed.
3341 @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
3342 these lines to activate any changes.
3344 @noindent
3345 To set these mutually exclusive groups in the variable @code{org-mode-alist}
3346 you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
3347 of the braces.  The previous example would be set globally by the following
3348 configuration:
3350 @lisp
3351 (setq org-tag-alist '((:startgroup . nil)
3352                       ("@@work" . ?w) ("@@home" . ?h)
3353                       ("@@tennisclub" . ?t)
3354                       (:endgroup . nil)
3355                       ("laptop" . ?l) ("pc" . ?p)))
3356 @end lisp
3358 If at least one tag has a selection key then pressing @kbd{C-c C-c} will
3359 automatically present you with a special interface, listing inherited tags,
3360 the tags of the current headline, and a list of all valid tags with
3361 corresponding keys@footnote{Keys will automatically be assigned to tags which
3362 have no configured keys.}.  In this interface, you can use the following
3363 keys:
3365 @table @kbd
3366 @item a-z...
3367 Pressing keys assigned to tags will add or remove them from the list of
3368 tags in the current line.  Selecting a tag in a group of mutually
3369 exclusive tags will turn off any other tags from that group.
3370 @kindex @key{TAB}
3371 @item @key{TAB}
3372 Enter a tag in the minibuffer, even if the tag is not in the predefined
3373 list.  You will be able to complete on all tags present in the buffer.
3374 @kindex @key{SPC}
3375 @item @key{SPC}
3376 Clear all tags for this line.
3377 @kindex @key{RET}
3378 @item @key{RET}
3379 Accept the modified set.
3380 @item C-g
3381 Abort without installing changes.
3382 @item q
3383 If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
3384 @item !
3385 Turn off groups of mutually exclusive tags.  Use this to (as an
3386 exception) assign several tags from such a group.
3387 @item C-c
3388 Toggle auto-exit after the next change (see below).
3389 If you are using expert mode, the first @kbd{C-c} will display the
3390 selection window.
3391 @end table
3393 @noindent
3394 This method lets you assign tags to a headline with very few keys.  With
3395 the above setup, you could clear the current tags and set @samp{@@home},
3396 @samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
3397 C-c @key{SPC} h l p @key{RET}}.  Switching from @samp{@@home} to
3398 @samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
3399 alternatively with @kbd{C-c C-c C-c w}.  Adding the non-predefined tag
3400 @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
3401 @key{RET} @key{RET}}.
3403 If you find that most of the time, you need only a single key press to
3404 modify your list of tags, set the variable
3405 @code{org-fast-tag-selection-single-key}.  Then you no longer have to
3406 press @key{RET} to exit fast tag selection - it will immediately exit
3407 after the first change.  If you then occasionally need more keys, press
3408 @kbd{C-c} to turn off auto-exit for the current tag selection process
3409 (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
3410 C-c}).  If you set the variable to the value @code{expert}, the special
3411 window is not even shown for single-key tag selection, it comes up only
3412 when you press an extra @kbd{C-c}.
3414 @node Tag searches,  , Setting tags, Tags
3415 @section Tag searches
3416 @cindex tag searches
3417 @cindex searching for tags
3419 Once a system of tags has been set up, it can be used to collect related
3420 information into special lists.
3422 @table @kbd
3423 @kindex C-c \
3424 @kindex C-c / T
3425 @item C-c \
3426 @itemx C-c / T
3427 Create a sparse tree with all headlines matching a tags search.  With a
3428 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
3429 @kindex C-c a m
3430 @item C-c a m
3431 Create a global list of tag matches from all agenda files.
3432 @xref{Matching tags and properties}.
3433 @kindex C-c a M
3434 @item C-c a M
3435 Create a global list of tag matches from all agenda files, but check
3436 only TODO items and force checking subitems (see variable
3437 @code{org-tags-match-list-sublevels}).
3438 @end table
3440 @cindex Boolean logic, for tag searches
3441 A @i{tags} search string can use Boolean operators @samp{&} for AND and
3442 @samp{|} for OR.  @samp{&} binds more strongly than @samp{|}.
3443 Parenthesis are currently not implemented.  A tag may also be preceded
3444 by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
3445 positive selection.  The AND operator @samp{&} is optional when @samp{+}
3446 or @samp{-} is present.  Examples:
3448 @table @samp
3449 @item +work-boss
3450 Select headlines tagged @samp{:work:}, but discard those also tagged
3451 @samp{:boss:}.
3452 @item work|laptop
3453 Selects lines tagged @samp{:work:} or @samp{:laptop:}.
3454 @item work|laptop&night
3455 Like before, but require the @samp{:laptop:} lines to be tagged also
3456 @samp{:night:}.
3457 @end table
3459 @cindex TODO keyword matching, with tags search
3460 If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
3461 can be useful to also match on the TODO keyword.  This can be done by
3462 adding a condition after a slash to a tags match.  The syntax is similar
3463 to the tag matches, but should be applied with consideration: For
3464 example, a positive selection on several TODO keywords can not
3465 meaningfully be combined with boolean AND.  However, @emph{negative
3466 selection} combined with AND can be meaningful.  To make sure that only
3467 lines are checked that actually have any TODO keyword, use @kbd{C-c a
3468 M}, or equivalently start the TODO part after the slash with @samp{!}.
3469 Examples:
3471 @table @samp
3472 @item work/WAITING
3473 Select @samp{:work:}-tagged TODO lines with the specific TODO
3474 keyword @samp{WAITING}.
3475 @item work/!-WAITING-NEXT
3476 Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
3477 nor @samp{NEXT}
3478 @item work/+WAITING|+NEXT
3479 Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
3480 @samp{NEXT}.
3481 @end table
3483 @cindex regular expressions, with tags search
3484 Any element of the tag/todo match can be a regular expression - in this
3485 case it must be enclosed in curly braces.  For example,
3486 @samp{work+@{^boss.*@}} matches headlines that contain the tag
3487 @samp{:work:} and any tag @i{starting} with @samp{boss}.
3489 @cindex level, require for tags/property match
3490 @cindex category, require for tags/property match
3491 You can also require a headline to be of a certain level or category, by
3492 writing instead of any TAG an expression like @samp{LEVEL=3} or
3493 @samp{CATEGORY="work"}, respectively.  For example, a search
3494 @samp{+LEVEL=3+boss/-DONE} lists all level three headlines that have the
3495 tag @samp{boss} and are @emph{not} marked with the TODO keyword DONE.
3497 @node Properties and Columns, Dates and Times, Tags, Top
3498 @chapter Properties and Columns
3499 @cindex properties
3501 Properties are a set of key-value pairs associated with an entry.  There
3502 are two main applications for properties in Org mode.  First, properties
3503 are like tags, but with a value.  Second, you can use properties to
3504 implement (very basic) database capabilities in an Org buffer.  For
3505 an example of the first application, imagine maintaining a file where
3506 you document bugs and plan releases of a piece of software.  Instead of
3507 using tags like @code{:release_1:}, @code{:release_2:}, one can use a
3508 property, say @code{:Release:}, that in different subtrees has different
3509 values, such as @code{1.0} or @code{2.0}.  For an example of the second
3510 application of properties, imagine keeping track of your music CD's,
3511 where properties could be things such as the album artist, date of
3512 release, number of tracks, and so on.
3514 Properties can be conveniently edited and viewed in column view
3515 (@pxref{Column view}).
3517 Properties are like tags, but with a value.  For example, in a file
3518 where you document bugs and plan releases of a piece of software,
3519 instead of using tags like @code{:release_1:}, @code{:release_2:}, it
3520 can be more efficient to use a property @code{:Release:} with a value
3521 @code{1.0} or @code{2.0}.  Second, you can use properties to implement
3522 (very basic) database capabilities in an Org buffer, for example to
3523 create a list of Music CD's you own.  You can edit and view properties
3524 conveniently in column view (@pxref{Column view}).
3526 @menu
3527 * Property syntax::             How properties are spelled out
3528 * Special properties::          Access to other Org mode features
3529 * Property searches::           Matching property values
3530 * Property inheritance::        Passing values down the tree
3531 * Column view::                 Tabular viewing and editing
3532 * Property API::                Properties for Lisp programmers
3533 @end menu
3535 @node Property syntax, Special properties, Properties and Columns, Properties and Columns
3536 @section Property syntax
3537 @cindex property syntax
3538 @cindex drawer, for properties
3540 Properties are key-value pairs.  They need to be inserted into a special
3541 drawer (@pxref{Drawers}) with the name @code{PROPERTIES}.  Each property
3542 is specified on a single line, with the key (surrounded by colons)
3543 first, and the value after it.  Here is an example:
3545 @example
3546 * CD collection
3547 ** Classic
3548 *** Goldberg Variations
3549     :PROPERTIES:
3550     :Title:     Goldberg Variations
3551     :Composer:  J.S. Bach
3552     :Artist:    Glen Gould
3553     :Publisher: Deutsche Grammphon
3554     :NDisks:    1
3555     :END:
3556 @end example
3558 You may define the allowed values for a particular property @samp{:Xyz:}
3559 by setting a property @samp{:Xyz_ALL:}.  This special property is
3560 @emph{inherited}, so if you set it in a level 1 entry, it will apply to
3561 the entire tree.  When allowed values are defined, setting the
3562 corresponding property becomes easier and is less prone to typing
3563 errors.  For the example with the CD collection, we can predefine
3564 publishers and the number of disks in a box like this:
3566 @example
3567 * CD collection
3568   :PROPERTIES:
3569   :NDisks_ALL:  1 2 3 4
3570   :Publisher_ALL: "Deutsche Grammophon" Phillips EMI
3571   :END:
3572 @end example
3574 If you want to set properties that can be inherited by any entry in a
3575 file, use a line like
3577 @example
3578 #+PROPERTY: NDisks_ALL 1 2 3 4
3579 @end example
3581 Property values set with the global variable
3582 @code{org-global-properties} can be inherited by all entries in all
3583 Org files.
3585 @noindent
3586 The following commands help to work with properties:
3588 @table @kbd
3589 @kindex M-@key{TAB}
3590 @item M-@key{TAB}
3591 After an initial colon in a line, complete property keys.  All keys used
3592 in the current file will be offered as possible completions.
3593 @kindex C-c C-x p
3594 @item C-c C-x p
3595 Set a property.  This prompts for a property name and a value.  If
3596 necessary, the property drawer is created as well.
3597 @item M-x org-insert-property-drawer
3598 Insert a property drawer into the current entry.  The drawer will be
3599 inserted early in the entry, but after the lines with planning
3600 information like deadlines.
3601 @kindex C-c C-c
3602 @item C-c C-c
3603 With the cursor in a property drawer, this executes property commands.
3604 @item C-c C-c s
3605 Set a property in the current entry.  Both the property and the value
3606 can be inserted using completion.
3607 @kindex S-@key{right}
3608 @kindex S-@key{left}
3609 @item S-@key{left}/@key{right}
3610 Switch property at point to the next/previous allowed value.
3611 @item C-c C-c d
3612 Remove a property from the current entry.
3613 @item C-c C-c D
3614 Globally remove a property, from all entries in the current file.
3615 @item C-c C-c c
3616 Compute the property at point, using the operator and scope from the
3617 nearest column format definition.
3618 @end table
3620 @node Special properties, Property searches, Property syntax, Properties and Columns
3621 @section Special properties
3622 @cindex properties, special
3624 Special properties provide alternative access method to Org mode
3625 features discussed in the previous chapters, like the TODO state or the
3626 priority of an entry.  This interface exists so that you can include
3627 these states into columns view (@pxref{Column view}), or to use them in
3628 queries.  The following property names are special and should not be
3629 used as keys in the properties drawer:
3631 @example
3632 TODO         @r{The TODO keyword of the entry.}
3633 TAGS         @r{The tags defined directly in the headline.}
3634 ALLTAGS      @r{All tags, including inherited ones.}
3635 PRIORITY     @r{The priority of the entry, a string with a single letter.}
3636 DEADLINE     @r{The deadline time string, without the angular brackets.}
3637 SCHEDULED    @r{The scheduling time stamp, without the angular brackets.}
3638 TIMESTAMP    @r{The first keyword-less time stamp in the entry.}
3639 TIMESTAMP_IA @r{The first inactive time stamp in the entry.}
3640 CLOCKSUM     @r{The sum of CLOCK intervals in the subtree.  @code{org-clock-sum}}
3641              @r{must be run first to compute the values.}
3642 @end example
3644 @node Property searches, Property inheritance, Special properties, Properties and Columns
3645 @section Property searches
3646 @cindex properties, searching
3647 @cindex searching, of properties
3649 To create sparse trees and special lists with selection based on
3650 properties, the same commands are used as for tag searches (@pxref{Tag
3651 searches}), and the same logic applies.  For example, a search string
3653 @example
3654 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort=""+With=@{Sarah\|Denny@}
3655 @end example
3657 @noindent
3658 finds entries tagged @samp{:work:} but not @samp{:boss:}, which
3659 also have a priority value @samp{A}, a @samp{:Coffee:} property with the
3660 value @samp{unlimited}, an @samp{Effort} property that is undefined or
3661 empty, and a @samp{:With:} property that is matched by
3662 the regular expression @samp{Sarah\|Denny}.
3664 You can configure Org mode to use property inheritance during a search,
3665 see @ref{Property inheritance} for details.
3667 There is also a special command for creating sparse trees based on a
3668 single property:
3670 @table @kbd
3671 @kindex C-c / p
3672 @item C-c / p
3673 Create a sparse tree based on the value of a property.  This first
3674 prompts for the name of a property, and then for a value.  A sparse tree
3675 is created with all entries that define this property with the given
3676 value.  If you enclose the value into curly braces, it is interpreted as
3677 a regular expression and matched against the property values.
3678 @end table
3680 @node Property inheritance, Column view, Property searches, Properties and Columns
3681 @section Property Inheritance
3682 @cindex properties, inheritance
3683 @cindex inheritance, of properties
3685 The outline structure of Org mode documents lends itself for an
3686 inheritance model of properties: If the parent in a tree has a certain
3687 property, the children can inherit this property.  Org mode does not
3688 turn this on by default, because it can slow down property searches
3689 significantly and is often not needed.  However, if you find inheritance
3690 useful, you can turn it on by setting the variable
3691 @code{org-use-property-inheritance}.  It may be set to @code{t}, to make
3692 all properties inherited from the parent, to a list of properties
3693 that should be inherited, or to a regular expression that matches
3694 inherited properties.
3696 Org mode has a few properties for which inheritance is hard-coded, at
3697 least for the special applications for which they are used:
3699 @table @code
3700 @item COLUMNS
3701 The @code{:COLUMNS:} property defines the format of column view
3702 (@pxref{Column view}).  It is inherited in the sense that the level
3703 where a @code{:COLUMNS:} property is defined is used as the starting
3704 point for a column view table, independently of the location in the
3705 subtree from where columns view is turned on.
3706 @item CATEGORY
3707 For agenda view, a category set through a @code{:CATEGORY:} property
3708 applies to the entire subtree.
3709 @item ARCHIVE
3710 For archiving, the @code{:ARCHIVE:} property may define the archive
3711 location for the entire subtree (@pxref{Moving subtrees}).
3712 @item LOGGING
3713 The LOGGING property may define logging settings for an entry or a
3714 subtree (@pxref{Tracking TODO state changes}).
3715 @end table
3717 @node Column view, Property API, Property inheritance, Properties and Columns
3718 @section Column view
3720 A great way to view and edit properties in an outline tree is
3721 @emph{column view}.  In column view, each outline item is turned into a
3722 table row.  Columns in this table provide access to properties of the
3723 entries.  Org mode implements columns by overlaying a tabular structure
3724 over the headline of each item.  While the headlines have been turned
3725 into a table row, you can still change the visibility of the outline
3726 tree.  For example, you get a compact table by switching to CONTENTS
3727 view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
3728 is active), but you can still open, read, and edit the entry below each
3729 headline.  Or, you can switch to column view after executing a sparse
3730 tree command and in this way get a table only for the selected items.
3731 Column view also works in agenda buffers (@pxref{Agenda Views}) where
3732 queries have collected selected items, possibly from a number of files.
3734 @menu
3735 * Defining columns::            The COLUMNS format property
3736 * Using column view::           How to create and use column view
3737 * Capturing column view::       A dynamic block for column view
3738 @end menu
3740 @node Defining columns, Using column view, Column view, Column view
3741 @subsection Defining columns
3742 @cindex column view, for properties
3743 @cindex properties, column view
3745 Setting up a column view first requires defining the columns.  This is
3746 done by defining a column format line.
3748 @menu
3749 * Scope of column definitions::  Where defined, where valid?
3750 * Column attributes::           Appearance and content of a column
3751 @end menu
3753 @node Scope of column definitions, Column attributes, Defining columns, Defining columns
3754 @subsubsection Scope of column definitions
3756 To define a column format for an entire file, use a line like
3758 @example
3759 #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3760 @end example
3762 To specify a format that only applies to a specific tree, add a
3763 @code{:COLUMNS:} property to the top node of that tree, for example:
3765 @example
3766 ** Top node for columns view
3767    :PROPERTIES:
3768    :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3769    :END:
3770 @end example
3772 If a @code{:COLUMNS:} property is present in an entry, it defines columns
3773 for the entry itself, and for the entire subtree below it.  Since the
3774 column definition is part of the hierarchical structure of the document,
3775 you can define columns on level 1 that are general enough for all
3776 sublevels, and more specific columns further down, when you edit a
3777 deeper part of the tree.
3779 @node Column attributes,  , Scope of column definitions, Defining columns
3780 @subsubsection Column attributes
3781 A column definition sets the attributes of a column.  The general
3782 definition looks like this:
3784 @example
3785  %[width]property[(title)][@{summary-type@}]
3786 @end example
3788 @noindent
3789 Except for the percent sign and the property name, all items are
3790 optional.  The individual parts have the following meaning:
3792 @example
3793 width           @r{An integer specifying the width of the column in characters.}
3794                 @r{If omitted, the width will be determined automatically.}
3795 property        @r{The property that should be edited in this column.}
3796 (title)         @r{The header text for the column. If omitted, the}
3797                 @r{property name is used.}
3798 @{summary-type@}  @r{The summary type.  If specified, the column values for}
3799                 @r{parent nodes are computed from the children.}
3800                 @r{Supported summary types are:}
3801                 @{+@}       @r{Sum numbers in this column.}
3802                 @{+;%.1f@}  @r{Like @samp{+}, but format result with @samp{%.1f}.}
3803                 @{$@}       @r{Currency, short for @samp{+;%.2f}.}
3804                 @{:@}       @r{Sum times, HH:MM:SS, plain numbers are hours.}
3805                 @{X@}       @r{Checkbox status, [X] if all children are [X].}
3806                 @{X/@}      @r{Checkbox status, [n/m].}
3807                 @{X%@}      @r{Checkbox status, [n%].}
3808 @end example
3810 @noindent
3811 Here is an example for a complete columns definition, along with allowed
3812 values.
3814 @example
3815 :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.}
3816                    %10Time_Estimate@{:@} %CLOCKSUM
3817 :Owner_ALL:    Tammy Mark Karl Lisa Don
3818 :Status_ALL:   "In progress" "Not started yet" "Finished" ""
3819 :Approved_ALL: "[ ]" "[X]"
3820 @end example
3822 The first column, @samp{%25ITEM}, means the first 25 characters of the
3823 item itself, i.e. of the headline.  You probably always should start the
3824 column definition with the @samp{ITEM} specifier.  The other specifiers
3825 create columns @samp{Owner} with a list of names as allowed values, for
3826 @samp{Status} with four different possible values, and for a checkbox
3827 field @samp{Approved}.  When no width is given after the @samp{%}
3828 character, the column will be exactly as wide as it needs to be in order
3829 to fully display all values.  The @samp{Approved} column does have a
3830 modified title (@samp{Approved?}, with a question mark).  Summaries will
3831 be created for the @samp{Time_Estimate} column by adding time duration
3832 expressions like HH:MM, and for the @samp{Approved} column, by providing
3833 an @samp{[X]} status if all children have been checked.  The
3834 @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
3835 in the subtree.
3837 @node Using column view, Capturing column view, Defining columns, Column view
3838 @subsection Using column view
3840 @table @kbd
3841 @tsubheading{Turning column view on and off}
3842 @kindex C-c C-x C-c
3843 @item C-c C-x C-c
3844 Create the column view for the local environment.  This command searches
3845 the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
3846 a format.  When one is found, the column view table is established for
3847 the entire tree, starting from the entry that contains the @code{:COLUMNS:}
3848 property.  If none is found, the format is taken from the @code{#+COLUMNS}
3849 line or from the variable @code{org-columns-default-format}, and column
3850 view is established for the current entry and its subtree.
3851 @kindex r
3852 @item r
3853 Recreate the column view, to include recent changes made in the buffer.
3854 @kindex g
3855 @item g
3856 Same as @kbd{r}.
3857 @kindex q
3858 @item q
3859 Exit column view.
3860 @tsubheading{Editing values}
3861 @item @key{left} @key{right} @key{up} @key{down}
3862 Move through the column view from field to field.
3863 @kindex S-@key{left}
3864 @kindex S-@key{right}
3865 @item  S-@key{left}/@key{right}
3866 Switch to the next/previous allowed value of the field.  For this, you
3867 have to have specified allowed values for a property.
3868 @kindex n
3869 @kindex p
3870 @itemx  n / p
3871 Same as @kbd{S-@key{left}/@key{right}}
3872 @kindex e
3873 @item e
3874 Edit the property at point.  For the special properties, this will
3875 invoke the same interface that you normally use to change that
3876 property.  For example, when editing a TAGS property, the tag completion
3877 or fast selection interface will pop up.
3878 @kindex C-c C-c
3879 @item C-c C-c
3880 When there is a checkbox at point, toggle it.
3881 @kindex v
3882 @item v
3883 View the full value of this property.  This is useful if the width of
3884 the column is smaller than that of the value.
3885 @kindex a
3886 @item a
3887 Edit the list of allowed values for this property.  If the list is found
3888 in the hierarchy, the modified values is stored there.  If no list is
3889 found, the new value is stored in the first entry that is part of the
3890 current column view.
3891 @tsubheading{Modifying the table structure}
3892 @kindex <
3893 @kindex >
3894 @item < / >
3895 Make the column narrower/wider by one character.
3896 @kindex S-M-@key{right}
3897 @item S-M-@key{right}
3898 Insert a new column, to the right of the current column.
3899 @kindex S-M-@key{left}
3900 @item S-M-@key{left}
3901 Delete the current column.
3902 @end table
3904 @node Capturing column view,  , Using column view, Column view
3905 @subsection Capturing column view
3907 Since column view is just an overlay over a buffer, it cannot be
3908 exported or printed directly.  If you want to capture a column view, use
3909 this @code{columnview} dynamic block (@pxref{Dynamic blocks}).  The frame
3910 of this block looks like this:
3912 @example
3913 * The column view
3914 #+BEGIN: columnview :hlines 1 :id "label"
3916 #+END:
3917 @end example
3919 @noindent This dynamic block has the following parameters:
3921 @table @code
3922 @item :id
3923 This is most important parameter.  Column view is a feature that is
3924 often localized to a certain (sub)tree, and the capture block might be
3925 in a different location in the file.  To identify the tree whose view to
3926 capture, you can use 3 values:
3927 @example
3928 local     @r{use the tree in which the capture block is located}
3929 global    @r{make a global view, including all headings in the file}
3930 "label"   @r{call column view in the tree that has and @code{:ID:}}
3931           @r{property with the value @i{label}}
3932 @end example
3933 @item :hlines
3934 When @code{t}, insert a hline after every line.  When a number N, insert
3935 a hline before each headline with level @code{<= N}.
3936 @item :vlines
3937 When set to @code{t}, enforce column groups to get vertical lines.
3938 @item :maxlevel
3939 When set to a number, don't capture entries below this level.
3940 @item :skip-empty-rows
3941 When set to @code{t}, skip row where the only non-empty specifier of the
3942 column view is @code{ITEM}.
3944 @end table
3946 @noindent
3947 The following commands insert or update the dynamic block:
3949 @table @kbd
3950 @kindex C-c C-x r
3951 @item C-c C-x r
3952 Insert a dynamic block capturing a column view.  You will be prompted
3953 for the scope or id of the view.
3954 @kindex C-c C-c
3955 @item C-c C-c
3956 @kindex C-c C-x C-u
3957 @itemx C-c C-x C-u
3958 Update dynamical block at point.  The cursor needs to be in the
3959 @code{#+BEGIN} line of the dynamic block.
3960 @kindex C-u C-c C-x C-u
3961 @item C-u C-c C-x C-u
3962 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
3963 you have several clock table blocks in a buffer.
3964 @end table
3966 @node Property API,  , Column view, Properties and Columns
3967 @section The Property API
3968 @cindex properties, API
3969 @cindex API, for properties
3971 There is a full API for accessing and changing properties.  This API can
3972 be used by Emacs Lisp programs to work with properties and to implement
3973 features based on them.  For more information see @ref{Using the
3974 property API}.
3976 @node Dates and Times, Remember, Properties and Columns, Top
3977 @chapter Dates and Times
3978 @cindex dates
3979 @cindex times
3980 @cindex time stamps
3981 @cindex date stamps
3983 To assist project planning, TODO items can be labeled with a date and/or
3984 a time.  The specially formatted string carrying the date and time
3985 information is called a @emph{timestamp} in Org mode.  This may be a
3986 little confusing because timestamp is often used as indicating when
3987 something was created or last changed.  However, in Org mode this term
3988 is used in a much wider sense.
3990 @menu
3991 * Timestamps::                  Assigning a time to a tree entry
3992 * Creating timestamps::         Commands which insert timestamps
3993 * Deadlines and scheduling::    Planning your work
3994 * Clocking work time::          Tracking how long you spend on a task
3995 @end menu
3998 @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
3999 @section Timestamps, deadlines and scheduling
4000 @cindex time stamps
4001 @cindex ranges, time
4002 @cindex date stamps
4003 @cindex deadlines
4004 @cindex scheduling
4006 A time stamp is a specification of a date (possibly with time or a range
4007 of times) in a special format, either @samp{<2003-09-16 Tue>} or
4008 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
4009 12:00-12:30>}@footnote{This is the standard ISO date/time format.  To
4010 use an alternative format, see @ref{Custom time format}.}.  A time stamp
4011 can appear anywhere in the headline or body of an Org tree entry.  Its
4012 presence causes entries to be shown on specific dates in the agenda
4013 (@pxref{Weekly/daily agenda}).  We distinguish:
4015 @table @var
4016 @item Plain time stamp; Event; Appointment
4017 @cindex timestamp
4018 A simple time stamp just assigns a date/time to an item.  This is just
4019 like writing down an appointment or event in a paper agenda.  In the
4020 timeline and agenda displays, the headline of an entry associated with a
4021 plain time stamp will be shown exactly on that date.
4023 @example
4024 * Meet Peter at the movies <2006-11-01 Wed 19:15>
4025 * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
4026 @end example
4028 @item Time stamp with repeater interval
4029 @cindex timestamp, with repeater interval
4030 A time stamp may contain a @emph{repeater interval}, indicating that it
4031 applies not only on the given date, but again and again after a certain
4032 interval of N days (d), weeks (w), months(m), or years(y).  The
4033 following will show up in the agenda every Wednesday:
4035 @example
4036 * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
4037 @end example
4039 @item Diary-style sexp entries
4040 For more complex date specifications, Org mode supports using the
4041 special sexp diary entries implemented in the Emacs calendar/diary
4042 package.  For example
4044 @example
4045 * The nerd meeting on every 2nd Thursday of the month
4046   <%%(diary-float t 4 2)>
4047 @end example
4049 @item Time/Date range
4050 @cindex timerange
4051 @cindex date range
4052 Two time stamps connected by @samp{--} denote a range.  The headline
4053 will be shown on the first and last day of the range, and on any dates
4054 that are displayed and fall in the range.  Here is an example:
4056 @example
4057 ** Meeting in Amsterdam
4058    <2004-08-23 Mon>--<2004-08-26 Thu>
4059 @end example
4061 @item Inactive time stamp
4062 @cindex timestamp, inactive
4063 @cindex inactive timestamp
4064 Just like a plain time stamp, but with square brackets instead of
4065 angular ones.  These time stamps are inactive in the sense that they do
4066 @emph{not} trigger an entry to show up in the agenda.
4068 @example
4069 * Gillian comes late for the fifth time [2006-11-01 Wed]
4070 @end example
4072 @end table
4074 @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
4075 @section Creating timestamps
4076 @cindex creating timestamps
4077 @cindex timestamps, creating
4079 For Org mode to recognize time stamps, they need to be in the specific
4080 format.  All commands listed below produce time stamps in the correct
4081 format.
4083 @table @kbd
4084 @kindex C-c .
4085 @item C-c .
4086 Prompt for a date and insert a corresponding time stamp.  When the
4087 cursor is at a previously used time stamp, it is updated to NOW.  When
4088 this command is used twice in succession, a time range is inserted.
4090 @kindex C-u C-c .
4091 @item C-u C-c .
4092 Like @kbd{C-c .}, but use the alternative format which contains date
4093 and time.  The default time can be rounded to multiples of 5 minutes,
4094 see the option @code{org-time-stamp-rounding-minutes}.
4096 @kindex C-c !
4097 @item C-c !
4098 Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
4099 an agenda entry.
4101 @kindex C-c <
4102 @item C-c <
4103 Insert a time stamp corresponding to the cursor date in the Calendar.
4105 @kindex C-c >
4106 @item C-c >
4107 Access the Emacs calendar for the current date.  If there is a
4108 timestamp in the current line, go to the corresponding date
4109 instead.
4111 @kindex C-c C-o
4112 @item C-c C-o
4113 Access the agenda for the date given by the time stamp or -range at
4114 point (@pxref{Weekly/daily agenda}).
4116 @kindex S-@key{left}
4117 @kindex S-@key{right}
4118 @item S-@key{left}
4119 @itemx S-@key{right}
4120 Change date at cursor by one day.  These key bindings conflict with
4121 CUA mode (@pxref{Conflicts}).
4123 @kindex S-@key{up}
4124 @kindex S-@key{down}
4125 @item S-@key{up}
4126 @itemx S-@key{down}
4127 Change the item under the cursor in a timestamp.  The cursor can be on a
4128 year, month, day, hour or minute.  Note that if the cursor is in a
4129 headline and not at a time stamp, these same keys modify the priority of
4130 an item.  (@pxref{Priorities}). The key bindings also conflict with
4131 CUA mode (@pxref{Conflicts}).
4133 @kindex C-c C-y
4134 @cindex evaluate time range
4135 @item C-c C-y
4136 Evaluate a time range by computing the difference between start and end.
4137 With a prefix argument, insert result after the time range (in a table: into
4138 the following column).
4139 @end table
4142 @menu
4143 * The date/time prompt::        How Org mode helps you entering date and time
4144 * Custom time format::          Making dates look different
4145 @end menu
4147 @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
4148 @subsection The date/time prompt
4149 @cindex date, reading in minibuffer
4150 @cindex time, reading in minibuffer
4152 When Org mode prompts for a date/time, the default is shown as an ISO
4153 date, and the prompt therefore seems to ask for an ISO date.  But it
4154 will in fact accept any string containing some date and/or time
4155 information, and it is really smart about interpreting your input.  You
4156 can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
4157 copied from an email message.  Org mode will find whatever information
4158 is in there and derive anything you have not specified from the
4159 @emph{default date and time}.  The default is usually the current date
4160 and time, but when modifying an existing time stamp, or when entering
4161 the second stamp of a range, it is taken from the stamp in the buffer.
4162 When filling in information, Org mode assumes that most of the time you
4163 will want to enter a date in the future: If you omit the month/year and
4164 the given day/month is @i{before} today, it will assume that you mean a
4165 future date@footnote{See the variable
4166 @code{org-read-date-prefer-future}.}.
4168 For example, lets assume that today is @b{June 13, 2006}.  Here is how
4169 various inputs will be interpreted, the items filled in by Org mode are
4170 in @b{bold}.
4172 @example
4173 3-2-5         --> 2003-02-05
4174 14            --> @b{2006}-@b{06}-14
4175 12            --> @b{2006}-@b{07}-12
4176 Fri           --> nearest Friday (defaultdate or later)
4177 sep 15        --> @b{2006}-11-15
4178 feb 15        --> @b{2007}-02-15
4179 sep 12 9      --> 2009-09-12
4180 12:45         --> @b{2006}-@b{06}-@b{13} 12:45
4181 22 sept 0:34  --> @b{2006}-09-22 0:34
4182 w4            --> ISO week for of the current year @b{2006}
4183 2012 w4 fri   --> Friday of ISO week 4 in 2012
4184 2012-w04-5    --> Same as above
4185 @end example
4187 Furthermore you can specify a relative date by giving, as the
4188 @emph{first} thing in the input: a plus/minus sign, a number and a
4189 letter [dwmy] to indicate change in days weeks, months, years.  With a
4190 single plus or minus, the date is always relative to today.  With a
4191 double plus or minus, it is relative to the default date.  If instead of
4192 a single letter, you use the abbreviation of day name, the date will be
4193 the nth such day.  E.g.
4195 @example
4196 +4d           --> four days from today
4197 +4            --> same as above
4198 +2w           --> two weeks from today
4199 ++5           --> five days from default date
4200 +2tue         --> second tuesday from now.
4201 @end example
4203 The function understands English month and weekday abbreviations.  If
4204 you want to use unabbreviated names and/or other languages, configure
4205 the variables @code{parse-time-months} and @code{parse-time-weekdays}.
4207 @cindex calendar, for selecting date
4208 Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
4209 you don't need/want the calendar, configure the variable
4210 @code{org-popup-calendar-for-date-prompt}.}.  When you exit the date
4211 prompt, either by clicking on a date in the calendar, or by pressing
4212 @key{RET}, the date selected in the calendar will be combined with the
4213 information entered at the prompt.  You can control the calendar fully
4214 from the minibuffer:
4216 @kindex <
4217 @kindex >
4218 @kindex mouse-1
4219 @kindex S-@key{right}
4220 @kindex S-@key{left}
4221 @kindex S-@key{down}
4222 @kindex S-@key{up}
4223 @kindex M-S-@key{right}
4224 @kindex M-S-@key{left}
4225 @kindex @key{RET}
4226 @example
4227 > / <          @r{Scroll calendar forward/backward by one month.}
4228 mouse-1        @r{Select date by clicking on it.}
4229 S-@key{right}/@key{left}     @r{One day forward/backward.}
4230 S-@key{down}/@key{up}     @r{One week forward/backward.}
4231 M-S-@key{right}/@key{left}   @r{One month forward/backward.}
4232 @key{RET}           @r{Choose date in calendar.}
4233 @end example
4235 The actions of the date/time prompt may seem complex, but I assure you
4236 they will grow on you.  To help you understand what is going on, the
4237 current interpretation of your input will be displayed live in the
4238 minibuffer@footnote{If you find this distracting, turn the display of
4239 with @code{org-read-date-display-live}.}.
4241 @node Custom time format,  , The date/time prompt, Creating timestamps
4242 @subsection Custom time format
4243 @cindex custom date/time format
4244 @cindex time format, custom
4245 @cindex date format, custom
4247 Org mode uses the standard ISO notation for dates and times as it is
4248 defined in ISO 8601.  If you cannot get used to this and require another
4249 representation of date and time to keep you happy, you can get it by
4250 customizing the variables @code{org-display-custom-times} and
4251 @code{org-time-stamp-custom-formats}.
4253 @table @kbd
4254 @kindex C-c C-x C-t
4255 @item C-c C-x C-t
4256 Toggle the display of custom formats for dates and times.
4257 @end table
4259 @noindent
4260 Org mode needs the default format for scanning, so the custom date/time
4261 format does not @emph{replace} the default format - instead it is put
4262 @emph{over} the default format using text properties.  This has the
4263 following consequences:
4264 @itemize @bullet
4265 @item
4266 You cannot place the cursor onto a time stamp anymore, only before or
4267 after.
4268 @item
4269 The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
4270 each component of a time stamp.  If the cursor is at the beginning of
4271 the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
4272 just like @kbd{S-@key{left}/@key{right}}.  At the end of the stamp, the
4273 time will be changed by one minute.
4274 @item
4275 If the time stamp contains a range of clock times or a repeater, these
4276 will not be overlayed, but remain in the buffer as they were.
4277 @item
4278 When you delete a time stamp character-by-character, it will only
4279 disappear from the buffer after @emph{all} (invisible) characters
4280 belonging to the ISO timestamp have been removed.
4281 @item
4282 If the custom time stamp format is longer than the default and you are
4283 using dates in tables, table alignment will be messed up.  If the custom
4284 format is shorter, things do work as expected.
4285 @end itemize
4288 @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
4289 @section Deadlines and scheduling
4291 A time stamp may be preceded by special keywords to facilitate planning:
4293 @table @var
4294 @item DEADLINE
4295 @cindex DEADLINE keyword
4297 Meaning: the task (most likely a TODO item, though not necessarily) is supposed
4298 to be finished on that date.
4300 On the deadline date, the task will be listed in the agenda.  In
4301 addition, the agenda for @emph{today} will carry a warning about the
4302 approaching or missed deadline, starting
4303 @code{org-deadline-warning-days} before the due date, and continuing
4304 until the entry is marked DONE.  An example:
4306 @example
4307 *** TODO write article about the Earth for the Guide
4308     The editor in charge is [[bbdb:Ford Prefect]]
4309     DEADLINE: <2004-02-29 Sun>
4310 @end example
4312 You can specify a different lead time for warnings for a specific
4313 deadlines using the following syntax.  Here is an example with a warning
4314 period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
4316 @item SCHEDULED
4317 @cindex SCHEDULED keyword
4319 Meaning: you are planning to start working on that task on the given
4320 date.
4322 The headline will be listed under the given date@footnote{It will still
4323 be listed on that date after it has been marked DONE.  If you don't like
4324 this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
4325 addition, a reminder that the scheduled date has passed will be present
4326 in the compilation for @emph{today}, until the entry is marked DONE.
4327 I.e., the task will automatically be forwarded until completed.
4329 @example
4330 *** TODO Call Trillian for a date on New Years Eve.
4331     SCHEDULED: <2004-12-25 Sat>
4332 @end example
4334 @noindent
4335 @b{Important:} Scheduling an item in Org mode should @i{not} be
4336 understood in the same way that we understand @i{scheduling a meeting}.
4337 Setting a date for a meeting is just a simple appointment, you should
4338 mark this entry with a simple plain time stamp, to get this item shown
4339 on the date where it applies.  This is a frequent mis-understanding from
4340 Org-users.  In Org mode, @i{scheduling} means setting a date when you
4341 want to start working on an action item.
4342 @end table
4344 You may use time stamps with repeaters in scheduling and deadline
4345 entries.  Org mode will issue early and late warnings based on the
4346 assumption that the time stamp represents the @i{nearest instance} of
4347 the repeater.  However, the use of diary sexp entries like
4349 @code{<%%(diary-float t 42)>}
4351 in scheduling and deadline timestamps is limited.  Org mode does not
4352 know enough about the internals of each sexp function to issue early and
4353 late warnings.  However, it will show the item on each day where the
4354 sexp entry matches.
4356 @menu
4357 * Inserting deadline/schedule::  Planning items
4358 * Repeated tasks::              Items that show up again and again
4359 @end menu
4361 @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
4362 @subsection Inserting deadlines or schedules
4364 The following commands allow to quickly insert a deadline or to schedule
4365 an item:
4367 @table @kbd
4369 @kindex C-c C-d
4370 @item C-c C-d
4371 Insert @samp{DEADLINE} keyword along with a stamp.  The insertion will
4372 happen in the line directly following the headline.  When called with a
4373 prefix arg, an existing deadline will be removed from the entry.
4374 @c FIXME Any CLOSED timestamp will be removed.????????
4376 @kindex C-c / d
4377 @cindex sparse tree, for deadlines
4378 @item C-c / d
4379 Create a sparse tree with all deadlines that are either past-due, or
4380 which will become due within @code{org-deadline-warning-days}.
4381 With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
4382 prefix, check that many days.  For example, @kbd{C-1 C-c / d} shows
4383 all deadlines due tomorrow.
4385 @kindex C-c C-s
4386 @item C-c C-s
4387 Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
4388 happen in the line directly following the headline.  Any CLOSED
4389 timestamp will be removed.  When called with a prefix argument, remove
4390 the scheduling date from the entry.
4391 @end table
4393 @node Repeated tasks,  , Inserting deadline/schedule, Deadlines and scheduling
4394 @subsection Repeated tasks
4396 Some tasks need to be repeated again and again.  Org mode helps to
4397 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
4398 or plain time stamp.  In the following example
4399 @example
4400 ** TODO Pay the rent
4401    DEADLINE: <2005-10-01 Sat +1m>
4402 @end example
4403 the @code{+1m} is a repeater; the intended interpretation is that the
4404 task has a deadline on <2005-10-01> and repeats itself every (one) month
4405 starting from that time.  If you need both a repeater and a special
4406 warning period in a deadline entry, the repeater comes first and the
4407 warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
4409 Deadlines and scheduled items produce entries in the agenda when they
4410 are over-due, so it is important to be able to mark such an entry as
4411 completed once you have done so.  When you mark a DEADLINE or a SCHEDULE
4412 with the TODO keyword DONE, it will no longer produce entries in the
4413 agenda.  The problem with this is, however, that then also the
4414 @emph{next} instance of the repeated entry will not be active.  Org mode
4415 deals with this in the following way: When you try to mark such an entry
4416 DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
4417 time stamp by the repeater interval, and immediately set the entry state
4418 back to TODO.  In the example above, setting the state to DONE would
4419 actually switch the date like this:
4421 @example
4422 ** TODO Pay the rent
4423    DEADLINE: <2005-11-01 Tue +1m>
4424 @end example
4426 You will also be prompted for a note@footnote{You can change this using
4427 the option @code{org-log-repeat}, or the @code{#+STARTUP} options
4428 @code{logrepeat}, @code{lognoterepeat}, and @code{nologrepeat}.} that
4429 will be put under the DEADLINE line to keep a record that you actually
4430 acted on the previous instance of this deadline.
4432 As a consequence of shifting the base date, this entry will no longer be
4433 visible in the agenda when checking past dates, but all future instances
4434 will be visible.
4436 With the @samp{+1m} cookie, the date shift will always be exactly one
4437 month.  So if you have not payed the rent for three months, marking this
4438 entry DONE will still keep it as an overdue deadline.  Depending on the
4439 task, this may not be the best way to handle it.  For example, if you
4440 forgot to call you father for 3 weeks, it does not make sense to call
4441 her 3 times in a single day to make up for it.  Finally, there are tasks
4442 like changing batteries which should always repeat a certain time
4443 @i{after} the last time you did it.  For these tasks, Org mode has
4444 special repeaters markers with @samp{++} and @samp{.+}.  For example:
4446 @example
4447 ** TODO Call Father
4448    DEADLINE: <2008-02-10 Sun ++1w>
4449    Marking this DONE will shift the date by at least one week,
4450    but also by as many weeks as it takes to get this date into
4451    the future.  However, it stays on a Sunday, even if you called
4452    and marked it done on Saturday.
4453 ** TODO Check the batteries in the smoke detectors
4454    DEADLINE: <2005-11-01 Tue .+1m>
4455    Marking this DONE will shift the date to one month after
4456    today.
4457 @end example
4459 You may have both scheduling and deadline information for a specific
4460 task - just make sure that the repeater intervals on both are the same.
4462 @node Clocking work time,  , Deadlines and scheduling, Dates and Times
4463 @section Clocking work time
4465 Org mode allows you to clock the time you spent on specific tasks in a
4466 project.  When you start working on an item, you can start the clock.
4467 When you stop working on that task, or when you mark the task done, the
4468 clock is stopped and the corresponding time interval is recorded.  It
4469 also computes the total time spent on each subtree of a project.
4471 @table @kbd
4472 @kindex C-c C-x C-i
4473 @item C-c C-x C-i
4474 Start the clock on the current item (clock-in).  This inserts the CLOCK
4475 keyword together with a timestamp.  If this is not the first clocking of
4476 this item, the multiple CLOCK lines will be wrapped into a
4477 @code{:CLOCK:} drawer (see also the variable
4478 @code{org-clock-into-drawer}).
4479 @kindex C-c C-x C-o
4480 @item C-c C-x C-o
4481 Stop the clock (clock-out).  The inserts another timestamp at the same
4482 location where the clock was last started.  It also directly computes
4483 the resulting time in inserts it after the time range as @samp{=>
4484 HH:MM}.  See the variable @code{org-log-note-clock-out} for the
4485 possibility to record an additional note together with the clock-out
4486 time stamp@footnote{The corresponding in-buffer setting is:
4487 @code{#+STARTUP: lognoteclock-out}}.
4488 @kindex C-c C-y
4489 @item C-c C-y
4490 Recompute the time interval after changing one of the time stamps.  This
4491 is only necessary if you edit the time stamps directly.  If you change
4492 them with @kbd{S-@key{cursor}} keys, the update is automatic.
4493 @kindex C-c C-t
4494 @item C-c C-t
4495 Changing the TODO state of an item to DONE automatically stops the clock
4496 if it is running in this same item.
4497 @kindex C-c C-x C-x
4498 @item C-c C-x C-x
4499 Cancel the current clock.  This is useful if a clock was started by
4500 mistake, or if you ended up working on something else.
4501 @kindex C-c C-x C-j
4502 @item C-c C-x C-j
4503 Jump to the entry that contains the currently running clock, an another
4504 window.
4505 @kindex C-c C-x C-d
4506 @item C-c C-x C-d
4507 Display time summaries for each subtree in the current buffer.  This
4508 puts overlays at the end of each headline, showing the total time
4509 recorded under that heading, including the time of any subheadings. You
4510 can use visibility cycling to study the tree, but the overlays disappear
4511 when you change the buffer (see variable
4512 @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
4513 @kindex C-c C-x C-r
4514 @item C-c C-x C-r
4515 Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
4516 report as an Org mode table into the current file.  When the cursor is
4517 at an existing clock table, just update it.  When called with a prefix
4518 argument, jump to the first clock report in the current document and
4519 update it.
4520 @example
4521 #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
4522 #+END: clocktable
4523 @end example
4524 @noindent
4525 If such a block already exists at point, its content is replaced by the
4526 new table.  The @samp{BEGIN} line can specify options:
4527 @example
4528 :maxlevel    @r{Maximum level depth to which times are listed in the table.}
4529 :emphasize   @r{When @code{t}, emphasize level one and level two items}
4530 :scope       @r{The scope to consider.  This can be any of the following:}
4531              nil        @r{the current buffer or narrowed region}
4532              file       @r{the full current buffer}
4533              subtree    @r{the subtree where the clocktable is located}
4534              treeN      @r{the surrounding level N tree, for example @code{tree3}}
4535              tree       @r{the surrounding level 1 tree}
4536              agenda     @r{all agenda files}
4537              ("file"..) @r{scan these files}
4538 :block       @r{The time block to consider.  This block is specified either}
4539              @r{absolute, or relative to the current time and may be any of}
4540              @r{these formats:}
4541              2007-12-31    @r{New year eve 2007}
4542              2007-12       @r{December 2007}
4543              2007-W50      @r{ISO-week 50 in 2007}
4544              2007          @r{the year 2007}
4545              today, yesterday, today-N          @r{a relative day}
4546              thisweek, lastweek, thisweek-N     @r{a relative week}
4547              thismonth, lastmonth, thismonth-N  @r{a relative month}
4548              thisyear, lastyear, thisyear-N     @r{a relative year}
4549              @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
4550 :tstart      @r{A time string specifying when to start considering times}
4551 :tend        @r{A time string specifying when to stop considering times}
4552 :step        @r{@code{week} or @code{day}, to split the table into chunks}
4553 :link        @r{Link the item headlines in the table to their origins}
4554 @end example
4555 So to get a clock summary of the current level 1 tree, for the current
4556 day, you could write
4557 @example
4558 #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
4559 #+END: clocktable
4560 @end example
4561 and to use a specific time range you could write@footnote{Note that all
4562 parameters must be specified in a single line - the line is broken here
4563 only to fit it onto the manual.}
4564 @example
4565 #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
4566                     :tend "<2006-08-10 Thu 12:00>"
4567 #+END: clocktable
4568 @end example
4569 @kindex C-c C-c
4570 @item C-c C-c
4571 @kindex C-c C-x C-u
4572 @itemx C-c C-x C-u
4573 Update dynamical block at point.  The cursor needs to be in the
4574 @code{#+BEGIN} line of the dynamic block.
4575 @kindex C-u C-c C-x C-u
4576 @item C-u C-c C-x C-u
4577 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
4578 you have several clock table blocks in a buffer.
4579 @kindex S-@key{left}
4580 @kindex S-@key{right}
4581 @item S-@key{left}
4582 @itemx S-@key{right}
4583 Shift the current @code{:block} interval and update the table.  The cursor
4584 needs to be in the @code{#+BEGIN: clocktable} line for this command.  If
4585 @code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
4586 @end table
4588 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
4589 the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
4590 worked on or closed during a day.
4592 @node Remember, Agenda Views, Dates and Times, Top
4593 @chapter Remember
4594 @cindex @file{remember.el}
4596 The @i{Remember} package by John Wiegley lets you store quick notes with
4597 little interruption of your work flow.  See
4598 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
4599 information.  It is an excellent way to add new notes and tasks to
4600 Org files.  Org significantly expands the possibilities of
4601 @i{remember}: You may define templates for different note types, and
4602 associate target files and headlines with specific templates.  It also
4603 allows you to select the location where a note should be stored
4604 interactively, on the fly.
4606 @menu
4607 * Setting up Remember::         Some code for .emacs to get things going
4608 * Remember templates::          Define the outline of different note types
4609 * Storing notes::               Directly get the note to where it belongs
4610 * Refiling notes::              Moving a note or task to a project
4611 @end menu
4613 @node Setting up Remember, Remember templates, Remember, Remember
4614 @section Setting up Remember
4616 The following customization will tell @i{remember} to use org files as
4617 target, and to create annotations compatible with Org links.
4619 @example
4620 (org-remember-insinuate)
4621 (setq org-directory "~/path/to/my/orgfiles/")
4622 (setq org-default-notes-file (concat org-directory "/notes.org"))
4623 (define-key global-map "\C-cr" 'org-remember)
4624 @end example
4626 The last line binds the command @code{org-remember} to a global
4627 key@footnote{Please select your own key, @kbd{C-c r} is only a
4628 suggestion.}.  @code{org-remember} basically just calls @code{remember},
4629 but it makes a few things easier: If there is an active region, it will
4630 automatically copy the region into the remember buffer.  It also allows
4631 to jump to the buffer and location where remember notes are being
4632 stored: Just call @code{org-remember} with a prefix argument.  If you
4633 use two prefix arguments, Org jumps to the location where the last
4634 remember note was stored.
4636 @node Remember templates, Storing notes, Setting up Remember, Remember
4637 @section Remember templates
4638 @cindex templates, for remember
4640 In combination with Org, you can use templates to generate
4641 different types of @i{remember} notes.  For example, if you would like
4642 to use one template to create general TODO entries, another one for
4643 journal entries, and a third one for collecting random ideas, you could
4644 use:
4646 @example
4647 (setq org-remember-templates
4648  '(("Todo" ?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org" "Tasks")
4649    ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")
4650    ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
4651 @end example
4653 @noindent In these entries, the first string is just a name, and the
4654 character specifies how to select the template.  It is useful if the
4655 character is also the first letter of the name.  The next string
4656 specifies the template.  Two more (optional) strings give the file in
4657 which, and the headline under which the new note should be stored.  The
4658 file (if not present or @code{nil}) defaults to
4659 @code{org-default-notes-file}, the heading to
4660 @code{org-remember-default-headline}.  If the file name is not an
4661 absolute path, it will be interpreted relative to @code{org-directory}.
4663 An optional sixth element specifies the contexts in which the user can
4664 select the template.  This element can be either a list of major modes
4665 or a function.  @code{org-remember} will first check whether the function
4666 returns @code{t} or if we are in any of the listed major mode, and select 
4667 the template accordingly.
4669 So for example:
4671 @example
4672 (setq org-remember-templates
4673  '(("Bug" ?b "* BUG %?\n  %i\n  %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
4674    ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org" my-check)
4675    ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
4676 @end example
4678 The first template will only be available when invoking @code{org-remember}
4679 from an buffer in @code{emacs-lisp-mode}.  The second template will only be
4680 available when the function @code{my-check} returns @code{t}.  The third
4681 template will be proposed in any context.
4683 When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember
4684 something, org will prompt for a key to select the template (if you have
4685 more than one template) and then prepare the buffer like
4686 @example
4687 * TODO
4688   [[file:link to where you called remember]]
4689 @end example
4691 @noindent
4692 During expansion of the template, special @kbd{%}-escapes allow dynamic
4693 insertion of content:
4694 @example
4695 %^@{prompt@}  @r{prompt the user for a string and replace this sequence with it.}
4696             @r{You may specify a default value and a completion table with}
4697             @r{%^@{prompt|default|completion2|completion3...@}}
4698             @r{The arrow keys access a prompt-specific history.}
4699 %t          @r{time stamp, date only}
4700 %T          @r{time stamp with date and time}
4701 %u, %U      @r{like the above, but inactive time stamps}
4702 %^t         @r{like @code{%t}, but prompt for date.  Similarly @code{%^T}, @code{%^u}, @code{%^U}}
4703             @r{You may define a prompt like @code{%^@{Birthday@}t}}
4704 %n          @r{user name (taken from @code{user-full-name})}
4705 %a          @r{annotation, normally the link created with @code{org-store-link}}
4706 %A          @r{like @code{%a}, but prompt for the description part}
4707 %i          @r{initial content, the region when remember is called with C-u.}
4708             @r{The entire text will be indented like @code{%i} itself.}
4709 %c          @r{Current kill ring head.}
4710 %x          @r{Content of the X clipboard.}
4711 %^C         @r{Interactive selection of which kill or clip to use.}
4712 %^L         @r{Like @code{%^C}, but insert as link.}
4713 %^g         @r{prompt for tags, with completion on tags in target file.}
4714 %^G         @r{prompt for tags, with completion all tags in all agenda files.}
4715 %:keyword   @r{specific information for certain link types, see below}
4716 %[pathname] @r{insert the contents of the file given by @code{pathname}}
4717 %(sexp)     @r{evaluate elisp @code{(sexp)} and replace with the result}
4718 %!          @r{immediately store note after completing the template}
4719             @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
4720 @end example
4722 @noindent
4723 For specific link types, the following keywords will be
4724 defined@footnote{If you define your own link types (@pxref{Adding
4725 hyperlink types}), any property you store with
4726 @code{org-store-link-props} can be accessed in remember templates in a
4727 similar way.}:
4729 @example
4730 Link type          |  Available keywords
4731 -------------------+----------------------------------------------
4732 bbdb               |  %:name %:company
4733 bbdb               |  %::server %:port %:nick
4734 vm, wl, mh, rmail  |  %:type %:subject %:message-id
4735                    |  %:from %:fromname %:fromaddress
4736                    |  %:to   %:toname   %:toaddress
4737                    |  %: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}.}}
4738 gnus               |  %:group, @r{for messages also all email fields}
4739 w3, w3m            |  %:url
4740 info               |  %:file %:node
4741 calendar           |  %:date"
4742 @end example
4744 @noindent
4745 To place the cursor after template expansion use:
4747 @example
4748 %?          @r{After completing the template, position cursor here.}
4749 @end example
4751 @noindent
4752 If you change your mind about which template to use, call
4753 @code{org-remember} in the remember buffer.  You may then select a new
4754 template that will be filled with the previous context information.
4756 @node Storing notes, Refiling notes, Remember templates, Remember
4757 @section Storing notes
4759 When you are finished preparing a note with @i{remember}, you have to
4760 press @kbd{C-c C-c} to file the note away.  The handler will store the
4761 note in the file and under the headline specified in the template, or it
4762 will use the default file and headlines.  The window configuration will
4763 be restored, sending you back to the working context before the call to
4764 @code{remember}.  To re-use the location found during the last call to
4765 @code{remember}, exit the remember buffer with @kbd{C-u C-u C-c C-c},
4766 i.e. specify a double prefix argument to @kbd{C-c C-c}.
4768 If you want to store the note directly to a different place, use
4769 @kbd{C-u C-c C-c} instead to exit remember@footnote{Configure the
4770 variable @code{org-remember-store-without-prompt} to make this behavior
4771 the default.}.  The handler will then first prompt for a target file -
4772 if you press @key{RET}, the value specified for the template is used.
4773 Then the command offers the headings tree of the selected file, with the
4774 cursor position at the default headline (if you had specified one in the
4775 template).  You can either immediately press @key{RET} to get the note
4776 placed there.  Or you can use the following keys to find a different
4777 location:
4778 @example
4779 @key{TAB}         @r{Cycle visibility.}
4780 @key{down} / @key{up}   @r{Next/previous visible headline.}
4781 n / p        @r{Next/previous visible headline.}
4782 f / b        @r{Next/previous headline same level.}
4783 u            @r{One level up.}
4784 @c 0-9          @r{Digit argument.}
4785 @end example
4786 @noindent
4787 Pressing @key{RET} or @key{left} or @key{right}
4788 then leads to the following result.
4790 @multitable @columnfractions 0.2 0.15 0.65
4791 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
4792 @item on headline     @tab @key{RET}              @tab as sublevel of the heading at cursor, first or last
4793 @item                 @tab                        @tab depending on @code{org-reverse-note-order}.
4794 @item                 @tab @key{left}/@key{right} @tab as same level, before/after current heading
4795 @item buffer-start    @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
4796 @item                 @tab @tab depending on @code{org-reverse-note-order}.
4797 @item not on headline @tab @key{RET}
4798       @tab at cursor position, level taken from context.
4799 @end multitable
4801 Before inserting the text into a tree, the function ensures that the
4802 text has a headline, i.e. a first line that starts with a @samp{*}.  If
4803 not, a headline is constructed from the current date and some additional
4804 data.  If you have indented the text of the note below the headline, the
4805 indentation will be adapted if inserting the note into the tree requires
4806 demotion from level 1.
4808 @node Refiling notes,  , Storing notes, Remember
4809 @section Refiling notes
4810 @cindex refiling notes
4812 Remember is usually used to quickly capture notes and tasks into one or
4813 a few capture lists.  When reviewing the captured data, you may want to
4814 refile some of the entries into a different list, for example into a
4815 project.  Cutting, finding the right location and then pasting the note
4816 is cumbersome.  To simplify this process, you can use the following
4817 special command:
4819 @table @kbd
4820 @kindex C-c C-w
4821 @item C-c C-w
4822 Refile the entry at point.  This command offers possible locations for
4823 refiling the entry and lets you select one with completion.  The item is
4824 filed below the target heading as a subitem.  Depending on
4825 @code{org-reverse-note-order}, it will be either the first of last
4826 subitem.@* By default, all level 1 headlines in the current buffer are
4827 considered to be targets, but you can have more complex definitions
4828 across a number of files.  See the variable @code{org-refile-targets}
4829 for details.
4830 @kindex C-u C-c C-w
4831 @item C-u C-c C-w
4832 Use the refile interface to jump to a heading.
4833 @kindex C-u C-u C-c C-w
4834 @item C- C-u C-c C-w
4835 Jump to the location where @code{org-refile} last moved a tree to.
4836 @end table
4838 @node Agenda Views, Embedded LaTeX, Remember, Top
4839 @chapter Agenda Views
4840 @cindex agenda views
4842 Due to the way Org works, TODO items, time-stamped items, and
4843 tagged headlines can be scattered throughout a file or even a number of
4844 files.  To get an overview of open action items, or of events that are
4845 important for a particular date, this information must be collected,
4846 sorted and displayed in an organized way.
4848 Org can select items based on various criteria, and display them
4849 in a separate buffer.  Seven different view types are provided:
4851 @itemize @bullet
4852 @item
4853 an @emph{agenda} that is like a calendar and shows information
4854 for specific dates,
4855 @item
4856 a @emph{TODO list} that covers all unfinished
4857 action items,
4858 @item
4859 a @emph{tags view}, showings headlines based on
4860 the tags associated with them,
4861 @item
4862 a @emph{timeline view} that shows all events in a single Org file,
4863 in time-sorted view,
4864 @item
4865 a @emph{keyword search view} that shows all entries from multiple files
4866 that contain specified keywords.
4867 @item
4868 a @emph{stuck projects view} showing projects that currently don't move
4869 along, and
4870 @item
4871 @emph{custom views} that are special tag/keyword searches and
4872 combinations of different views.
4873 @end itemize
4875 @noindent
4876 The extracted information is displayed in a special @emph{agenda
4877 buffer}.  This buffer is read-only, but provides commands to visit the
4878 corresponding locations in the original Org files, and even to
4879 edit these files remotely.
4881 Two variables control how the agenda buffer is displayed and whether the
4882 window configuration is restored when the agenda exits:
4883 @code{org-agenda-window-setup} and
4884 @code{org-agenda-restore-windows-after-quit}.
4886 @menu
4887 * Agenda files::                Files being searched for agenda information
4888 * Agenda dispatcher::           Keyboard access to agenda views
4889 * Built-in agenda views::       What is available out of the box?
4890 * Presentation and sorting::    How agenda items are prepared for display
4891 * Agenda commands::             Remote editing of Org trees
4892 * Custom agenda views::         Defining special searches and views
4893 @end menu
4895 @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
4896 @section Agenda files
4897 @cindex agenda files
4898 @cindex files for agenda
4900 The information to be shown is normally collected from all @emph{agenda
4901 files}, the files listed in the variable
4902 @code{org-agenda-files}@footnote{If the value of that variable is not a
4903 list, but a single file name, then the list of agenda files will be
4904 maintained in that external file.}. If a directory is part of this list,
4905 all files with the extension @file{.org} in this directory will be part
4906 of the list.
4908 Thus even if you only work with a single Org file, this file should
4909 be put into that list@footnote{When using the dispatcher, pressing
4910 @kbd{<} before selecting a command will actually limit the command to
4911 the current file, and ignore @code{org-agenda-files} until the next
4912 dispatcher command.}.  You can customize @code{org-agenda-files}, but
4913 the easiest way to maintain it is through the following commands
4915 @cindex files, adding to agenda list
4916 @table @kbd
4917 @kindex C-c [
4918 @item C-c [
4919 Add current file to the list of agenda files.  The file is added to
4920 the front of the list.  If it was already in the list, it is moved to
4921 the front.  With a prefix argument, file is added/moved to the end.
4922 @kindex C-c ]
4923 @item C-c ]
4924 Remove current file from the list of agenda files.
4925 @kindex C-,
4926 @kindex C-'
4927 @item C-,
4928 @itemx C-'
4929 Cycle through agenda file list, visiting one file after the other.
4930 @end table
4932 @noindent
4933 The Org menu contains the current list of files and can be used
4934 to visit any of them.
4936 If you would like to focus the agenda temporarily onto a file not in
4937 this list, or onto just one file in the list or even only a subtree in a
4938 file, this can be done in different ways.  For a single agenda command,
4939 you may press @kbd{<} once or several times in the dispatcher
4940 (@pxref{Agenda dispatcher}).  To restrict the agenda scope for an
4941 extended period, use the following commands:
4943 @table @kbd
4944 @kindex C-c C-x <
4945 @item C-c C-x <
4946 Permanently restrict the agenda to the current subtree.  When with a
4947 prefix argument, or with the cursor before the first headline in a file,
4948 the agenda scope is set to the entire file.  This restriction remains in
4949 effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
4950 or @kbd{>} in the agenda dispatcher.  If there is a window displaying an
4951 agenda view, the new restriction takes effect immediately.
4952 @kindex C-c C-x <
4953 @item C-c C-x <
4954 Remove the permanent restriction created by @kbd{C-c C-x <}.
4955 @end table
4957 @noindent
4958 When working with @file{Speedbar}, you can use the following commands in
4959 the Speedbar frame:
4960 @table @kbd
4961 @kindex <
4962 @item < @r{in the speedbar frame}
4963 Permanently restrict the agenda to the item at the cursor in the
4964 Speedbar frame, either an Org file or a subtree in such a file.
4965 If there is a window displaying an agenda view, the new restriction takes
4966 effect immediately.
4967 @kindex <
4968 @item > @r{in the speedbar frame}
4969 Lift the restriction again.
4970 @end table
4972 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
4973 @section The agenda dispatcher
4974 @cindex agenda dispatcher
4975 @cindex dispatching agenda commands
4976 The views are created through a dispatcher that should be bound to a
4977 global key, for example @kbd{C-c a} (@pxref{Installation}).  In the
4978 following we will assume that @kbd{C-c a} is indeed how the dispatcher
4979 is accessed and list keyboard access to commands accordingly.  After
4980 pressing @kbd{C-c a}, an additional letter is required to execute a
4981 command.  The dispatcher offers the following default commands:
4982 @table @kbd
4983 @item a
4984 Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
4985 @item t @r{/} T
4986 Create a list of all TODO items (@pxref{Global TODO list}).
4987 @item m @r{/} M
4988 Create a list of headlines matching a TAGS expression (@pxref{Matching
4989 tags and properties}).
4990 @item L
4991 Create the timeline view for the current buffer (@pxref{Timeline}).
4992 @item s
4993 Create a list of entries selected by a boolean expression of keywords
4994 and/or regular expressions that must or must not occur in the entry.
4995 @item /
4996 Search for a regular expression in all agenda files and additionally in
4997 the files listed in @code{org-agenda-multi-occur-extra-files}.  This
4998 uses the Emacs command @code{multi-occur}.  A prefix argument can be
4999 used to specify the number of context lines for each match, default is
5001 @item # @r{/} !
5002 Create a list of stuck projects (@pxref{Stuck projects}).
5003 @item <
5004 Restrict an agenda command to the current buffer@footnote{For backward
5005 compatibility, you can also press @kbd{1} to restrict to the current
5006 buffer.}.  After pressing @kbd{<}, you still need to press the character
5007 selecting the command.
5008 @item < <
5009 If there is an active region, restrict the following agenda command to
5010 the region.  Otherwise, restrict it to the current subtree@footnote{For
5011 backward compatibility, you can also press @kbd{0} to restrict to the
5012 current buffer.}.  After pressing @kbd{< <}, you still need to press the
5013 character selecting the command.
5014 @end table
5016 You can also define custom commands that will be accessible through the
5017 dispatcher, just like the default commands.  This includes the
5018 possibility to create extended agenda buffers that contain several
5019 blocks together, for example the weekly agenda, the global TODO list and
5020 a number of special tags matches.  @xref{Custom agenda views}.
5022 @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
5023 @section The built-in agenda views
5025 In this section we describe the built-in views.
5027 @menu
5028 * Weekly/daily agenda::         The calendar page with current tasks
5029 * Global TODO list::            All unfinished action items
5030 * Matching tags and properties::  Structured information with fine-tuned search
5031 * Timeline::                    Time-sorted view for single file
5032 * Keyword search::              Finding entries by keyword
5033 * Stuck projects::              Find projects you need to review
5034 @end menu
5036 @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
5037 @subsection The weekly/daily agenda
5038 @cindex agenda
5039 @cindex weekly agenda
5040 @cindex daily agenda
5042 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
5043 paper agenda, showing all the tasks for the current week or day.
5045 @table @kbd
5046 @cindex org-agenda, command
5047 @kindex C-c a a
5048 @item C-c a a
5049 Compile an agenda for the current week from a list of org files.  The
5050 agenda shows the entries for each day.  With a numeric
5051 prefix@footnote{For backward compatibility, the universal prefix
5052 @kbd{C-u} causes all TODO entries to be listed before the agenda.  This
5053 feature is deprecated, use the dedicated TODO list, or a block agenda
5054 instead.}  (like @kbd{C-u 2 1 C-c a a}) you may set the number of days
5055 to be displayed (see also the variable @code{org-agenda-ndays})
5056 @end table
5058 Remote editing from the agenda buffer means, for example, that you can
5059 change the dates of deadlines and appointments from the agenda buffer.
5060 The commands available in the Agenda buffer are listed in @ref{Agenda
5061 commands}.
5063 @subsubheading Calendar/Diary integration
5064 @cindex calendar integration
5065 @cindex diary integration
5067 Emacs contains the calendar and diary by Edward M. Reingold.  The
5068 calendar displays a three-month calendar with holidays from different
5069 countries and cultures.  The diary allows you to keep track of
5070 anniversaries, lunar phases, sunrise/set, recurrent appointments
5071 (weekly, monthly) and more.  In this way, it is quite complementary to
5072 Org.  It can be very useful to combine output from Org with
5073 the diary.
5075 In order to include entries from the Emacs diary into Org mode's
5076 agenda, you only need to customize the variable
5078 @lisp
5079 (setq org-agenda-include-diary t)
5080 @end lisp
5082 @noindent After that, everything will happen automatically.  All diary
5083 entries including holidays, anniversaries etc will be included in the
5084 agenda buffer created by Org mode.  @key{SPC}, @key{TAB}, and
5085 @key{RET} can be used from the agenda buffer to jump to the diary
5086 file in order to edit existing diary entries.  The @kbd{i} command to
5087 insert new entries for the current date works in the agenda buffer, as
5088 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
5089 Sunrise/Sunset times, show lunar phases and to convert to other
5090 calendars, respectively.  @kbd{c} can be used to switch back and forth
5091 between calendar and agenda.
5093 If you are using the diary only for sexp entries and holidays, it is
5094 faster to not use the above setting, but instead to copy or even move
5095 the entries into an Org file. Org mode evaluates diary-style sexp
5096 entries, and does it faster because there is no overhead for first
5097 creating the diary display.  Note that the sexp entries must start at
5098 the left margin, no white space is allowed before them.  For example,
5099 the following segment of an Org file will be processed and entries
5100 will be made in the agenda:
5102 @example
5103 * Birthdays and similar stuff
5104 #+CATEGORY: Holiday
5105 %%(org-calendar-holiday)   ; special function for holiday names
5106 #+CATEGORY: Ann
5107 %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
5108 %%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d years old
5109 @end example
5111 @subsubheading Appointment reminders
5112 @cindex @file{appt.el}
5113 @cindex appointment reminders
5115 Org can interact with Emacs appointments notification facility.
5117 To add all the appointments of your agenda files, use the command
5118 @code{org-agenda-to-appt}.  This commands also lets you filter through
5119 the list of your appointments and add only those belonging to a specific
5120 category or matching a regular expression. See the docstring for
5121 details.
5123 @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
5124 @subsection The global TODO list
5125 @cindex global TODO list
5126 @cindex TODO list, global
5128 The global TODO list contains all unfinished TODO items, formatted and
5129 collected into a single place.
5131 @table @kbd
5132 @kindex C-c a t
5133 @item C-c a t
5134 Show the global TODO list.  This collects the TODO items from all
5135 agenda files (@pxref{Agenda Views}) into a single buffer.  The buffer is in
5136 @code{agenda-mode}, so there are commands to examine and manipulate
5137 the TODO entries directly from that buffer (@pxref{Agenda commands}).
5138 @kindex C-c a T
5139 @item C-c a T
5140 @cindex TODO keyword matching
5141 Like the above, but allows selection of a specific TODO keyword.  You
5142 can also do this by specifying a prefix argument to @kbd{C-c a t}.  With
5143 a @kbd{C-u} prefix you are prompted for a keyword, and you may also
5144 specify several keywords by separating them with @samp{|} as boolean OR
5145 operator.  With a numeric prefix, the Nth keyword in
5146 @code{org-todo-keywords} is selected.
5147 @kindex r
5148 The @kbd{r} key in the agenda buffer regenerates it, and you can give
5149 a prefix argument to this command to change the selected TODO keyword,
5150 for example @kbd{3 r}.  If you often need a search for a specific
5151 keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
5152 Matching specific TODO keywords can also be done as part of a tags
5153 search (@pxref{Tag searches}).
5154 @end table
5156 Remote editing of TODO items means that you can change the state of a
5157 TODO entry with a single key press.  The commands available in the
5158 TODO list are described in @ref{Agenda commands}.
5160 @cindex sublevels, inclusion into TODO list
5161 Normally the global TODO list simply shows all headlines with TODO
5162 keywords.  This list can become very long.  There are two ways to keep
5163 it more compact:
5164 @itemize @minus
5165 @item
5166 Some people view a TODO item that has been @emph{scheduled} for
5167 execution (@pxref{Timestamps}) as no longer @emph{open}.  Configure the
5168 variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
5169 items from the global TODO list.
5170 @item
5171 TODO items may have sublevels to break up the task into subtasks.  In
5172 such cases it may be enough to list only the highest level TODO headline
5173 and omit the sublevels from the global list.  Configure the variable
5174 @code{org-agenda-todo-list-sublevels} to get this behavior.
5175 @end itemize
5177 @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
5178 @subsection Matching tags and properties
5179 @cindex matching, of tags
5180 @cindex matching, of properties
5181 @cindex tags view
5183 If headlines in the agenda files are marked with @emph{tags}
5184 (@pxref{Tags}), you can select headlines based on the tags that apply
5185 to them and collect them into an agenda buffer.
5187 @table @kbd
5188 @kindex C-c a m
5189 @item C-c a m
5190 Produce a list of all headlines that match a given set of tags.  The
5191 command prompts for a selection criterion, which is a boolean logic
5192 expression with tags, like @samp{+work+urgent-withboss} or
5193 @samp{work|home} (@pxref{Tags}).  If you often need a specific search,
5194 define a custom command for it (@pxref{Agenda dispatcher}).
5195 @kindex C-c a M
5196 @item C-c a M
5197 Like @kbd{C-c a m}, but only select headlines that are also TODO items
5198 and force checking subitems (see variable
5199 @code{org-tags-match-list-sublevels}).  Matching specific TODO keywords
5200 together with a tags match is also possible, see @ref{Tag searches}.
5201 @end table
5203 The commands available in the tags list are described in @ref{Agenda
5204 commands}.
5206 @node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
5207 @subsection Timeline for a single file
5208 @cindex timeline, single file
5209 @cindex time-sorted view
5211 The timeline summarizes all time-stamped items from a single Org mode
5212 file in a @emph{time-sorted view}.  The main purpose of this command is
5213 to give an overview over events in a project.
5215 @table @kbd
5216 @kindex C-c a L
5217 @item C-c a L
5218 Show a time-sorted view of the org file, with all time-stamped items.
5219 When called with a @kbd{C-u} prefix, all unfinished TODO entries
5220 (scheduled or not) are also listed under the current date.
5221 @end table
5223 @noindent
5224 The commands available in the timeline buffer are listed in
5225 @ref{Agenda commands}.
5227 @node Keyword search, Stuck projects, Timeline, Built-in agenda views
5228 @subsection Keyword search
5229 @cindex keyword search
5230 @cindex searching, for keywords
5232 This agenda view is a general text search facility for Org mode entries.
5233 It is particularly useful to find notes.
5235 @table @kbd
5236 @kindex C-c a s
5237 @item C-c a s
5238 This is a special search that lets you select entries by keywords or
5239 regular expression, using a boolean logic.  For example, the search
5240 string
5242 @example
5243 +computer +wifi -ethernet -@{8\.11[bg]@}
5244 @end example
5246 @noindent
5247 will search for note entries that contain the keywords @code{computer}
5248 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
5249 not matched by the regular expression @code{8\.11[bg]}, meaning to
5250 exclude both 8.11b and 8.11g.
5252 Note that in addition to the agenda files, this command will also search
5253 the files listed in @code{org-agenda-text-search-extra-files}.
5254 @end table
5256 @node Stuck projects,  , Keyword search, Built-in agenda views
5257 @subsection Stuck projects
5259 If you are following a system like David Allen's GTD to organize your
5260 work, one of the ``duties'' you have is a regular review to make sure
5261 that all projects move along.  A @emph{stuck} project is a project that
5262 has no defined next actions, so it will never show up in the TODO lists
5263 Org mode produces.  During the review, you need to identify such
5264 projects and define next actions for them.
5266 @table @kbd
5267 @kindex C-c a #
5268 @item C-c a #
5269 List projects that are stuck.
5270 @kindex C-c a !
5271 @item C-c a !
5272 Customize the variable @code{org-stuck-projects} to define what a stuck
5273 project is and how to find it.
5274 @end table
5276 You almost certainly will have to configure this view before it will
5277 work for you.  The built-in default assumes that all your projects are
5278 level-2 headlines, and that a project is not stuck if it has at least
5279 one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
5281 Lets assume that you, in your own way of using Org mode, identify
5282 projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
5283 indicate a project that should not be considered yet.  Lets further
5284 assume that the TODO keyword DONE marks finished projects, and that NEXT
5285 and TODO indicate next actions.  The tag @@SHOP indicates shopping and
5286 is a next action even without the NEXT tag.  Finally, if the project
5287 contains the special word IGNORE anywhere, it should not be listed
5288 either.  In this case you would start by identifying eligible projects
5289 with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
5290 TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
5291 are not stuck.  The correct customization for this is
5293 @lisp
5294 (setq org-stuck-projects
5295       '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
5296                                "\\<IGNORE\\>"))
5297 @end lisp
5300 @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
5301 @section Presentation and sorting
5302 @cindex presentation, of agenda items
5304 Before displaying items in an agenda view, Org mode visually prepares
5305 the items and sorts them.  Each item occupies a single line.  The line
5306 starts with a @emph{prefix} that contains the @emph{category}
5307 (@pxref{Categories}) of the item and other important information.  You can
5308 customize the prefix using the option @code{org-agenda-prefix-format}.
5309 The prefix is followed by a cleaned-up version of the outline headline
5310 associated with the item.
5312 @menu
5313 * Categories::                  Not all tasks are equal
5314 * Time-of-day specifications::  How the agenda knows the time
5315 * Sorting of agenda items::     The order of things
5316 @end menu
5318 @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
5319 @subsection Categories
5321 @cindex category
5322 The category is a broad label assigned to each agenda item.  By default,
5323 the category is simply derived from the file name, but you can also
5324 specify it with a special line in the buffer, like this@footnote{For
5325 backward compatibility, the following also works: If there are several
5326 such lines in a file, each specifies the category for the text below it.
5327 The first category also applies to any text before the first CATEGORY
5328 line.  However, using this method is @emph{strongly} deprecated as it is
5329 incompatible with the outline structure of the document.  The correct
5330 method for setting multiple categories in a buffer is using a
5331 property.}:
5333 @example
5334 #+CATEGORY: Thesis
5335 @end example
5337 @noindent
5338 If you would like to have a special CATEGORY for a single entry or a
5339 (sub)tree, give the entry a @code{:CATEGORY:} property with the location
5340 as the value (@pxref{Properties and Columns}).
5342 @noindent
5343 The display in the agenda buffer looks best if the category is not
5344 longer than 10 characters.
5346 @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
5347 @subsection Time-of-day specifications
5348 @cindex time-of-day specification
5350 Org mode checks each agenda item for a time-of-day specification.  The
5351 time can be part of the time stamp that triggered inclusion into the
5352 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}.  Time
5353 ranges can be specified with two time stamps, like
5355 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
5357 In the headline of the entry itself, a time(range) may also appear as
5358 plain text (like @samp{12:45} or a @samp{8:30-1pm}.  If the agenda
5359 integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
5360 specifications in diary entries are recognized as well.
5362 For agenda display, Org mode extracts the time and displays it in a
5363 standard 24 hour format as part of the prefix.  The example times in
5364 the previous paragraphs would end up in the agenda like this:
5366 @example
5367     8:30-13:00 Arthur Dent lies in front of the bulldozer
5368    12:45...... Ford Prefect arrives and takes Arthur to the pub
5369    19:00...... The Vogon reads his poem
5370    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5371 @end example
5373 @cindex time grid
5374 If the agenda is in single-day mode, or for the display of today, the
5375 timed entries are embedded in a time grid, like
5377 @example
5378     8:00...... ------------------
5379     8:30-13:00 Arthur Dent lies in front of the bulldozer
5380    10:00...... ------------------
5381    12:00...... ------------------
5382    12:45...... Ford Prefect arrives and takes Arthur to the pub
5383    14:00...... ------------------
5384    16:00...... ------------------
5385    18:00...... ------------------
5386    19:00...... The Vogon reads his poem
5387    20:00...... ------------------
5388    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5389 @end example
5391 The time grid can be turned on and off with the variable
5392 @code{org-agenda-use-time-grid}, and can be configured with
5393 @code{org-agenda-time-grid}.
5395 @node Sorting of agenda items,  , Time-of-day specifications, Presentation and sorting
5396 @subsection Sorting of agenda items
5397 @cindex sorting, of agenda items
5398 @cindex priorities, of agenda items
5399 Before being inserted into a view, the items are sorted.  How this is
5400 done depends on the type of view.
5401 @itemize @bullet
5402 @item
5403 For the daily/weekly agenda, the items for each day are sorted.  The
5404 default order is to first collect all items containing an explicit
5405 time-of-day specification.  These entries will be shown at the beginning
5406 of the list, as a @emph{schedule} for the day.  After that, items remain
5407 grouped in categories, in the sequence given by @code{org-agenda-files}.
5408 Within each category, items are sorted by priority (@pxref{Priorities}),
5409 which is composed of the base priority (2000 for priority @samp{A}, 1000
5410 for @samp{B}, and 0 for @samp{C}), plus additional increments for
5411 overdue scheduled or deadline items.
5412 @item
5413 For the TODO list, items remain in the order of categories, but within
5414 each category, sorting takes place according to priority
5415 (@pxref{Priorities}).
5416 @item
5417 For tags matches, items are not sorted at all, but just appear in the
5418 sequence in which they are found in the agenda files.
5419 @end itemize
5421 Sorting can be customized using the variable
5422 @code{org-agenda-sorting-strategy}.
5425 @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
5426 @section Commands in the agenda buffer
5427 @cindex commands, in agenda buffer
5429 Entries in the agenda buffer are linked back to the org file or diary
5430 file where they originate.  You are not allowed to edit the agenda
5431 buffer itself, but commands are provided to show and jump to the
5432 original entry location, and to edit the org-files ``remotely'' from
5433 the agenda buffer.  In this way, all information is stored only once,
5434 removing the risk that your agenda and note files may diverge.
5436 Some commands can be executed with mouse clicks on agenda lines.  For
5437 the other commands, the cursor needs to be in the desired line.
5439 @table @kbd
5440 @tsubheading{Motion}
5441 @cindex motion commands in agenda
5442 @kindex n
5443 @item n
5444 Next line (same as @key{up} and @kbd{C-p}).
5445 @kindex p
5446 @item p
5447 Previous line (same as @key{down} and @kbd{C-n}).
5448 @tsubheading{View/Go to org file}
5449 @kindex mouse-3
5450 @kindex @key{SPC}
5451 @item mouse-3
5452 @itemx @key{SPC}
5453 Display the original location of the item in another window.
5455 @kindex L
5456 @item L
5457 Display original location and recenter that window.
5459 @kindex mouse-2
5460 @kindex mouse-1
5461 @kindex @key{TAB}
5462 @item mouse-2
5463 @itemx mouse-1
5464 @itemx @key{TAB}
5465 Go to the original location of the item in another window.  Under Emacs
5466 22, @kbd{mouse-1} will also works for this.
5468 @kindex @key{RET}
5469 @itemx @key{RET}
5470 Go to the original location of the item and delete other windows.
5472 @kindex f
5473 @item f
5474 Toggle Follow mode.  In Follow mode, as you move the cursor through
5475 the agenda buffer, the other window always shows the corresponding
5476 location in the org file.  The initial setting for this mode in new
5477 agenda buffers can be set with the variable
5478 @code{org-agenda-start-with-follow-mode}.
5480 @kindex b
5481 @item b
5482 Display the entire subtree of the current item in an indirect buffer.  With a
5483 numeric prefix argument N, go up to level N and then take that tree.  If N is
5484 negative, go up that many levels.  With a @kbd{C-u} prefix, do not remove the
5485 previously used indirect buffer.
5487 @kindex l
5488 @item l
5489 Toggle Logbook mode.  In Logbook mode, entries that where marked DONE while
5490 logging was on (variable @code{org-log-done}) are shown in the agenda,
5491 as are entries that have been clocked on that day.
5493 @kindex R
5494 @item R
5495 Toggle Clockreport mode.  In clockreport mode, the daily/weekly agenda will
5496 always show a table with the clocked times for the timespan and file scope
5497 covered by the current agenda view.  The initial setting for this mode in new
5498 agenda buffers can be set with the variable
5499 @code{org-agenda-start-with-follow-mode}.
5501 @tsubheading{Change display}
5502 @cindex display changing, in agenda
5503 @kindex o
5504 @item o
5505 Delete other windows.
5507 @kindex d
5508 @kindex w
5509 @kindex m
5510 @kindex y
5511 @item d w m y
5512 Switch to day/week/month/year view.  When switching to day or week view,
5513 this setting becomes the default for subsequent agenda commands.  Since
5514 month and year views are slow to create, they do not become the default.
5515 A numeric prefix argument may be used to jump directly to a specific day
5516 of the year, ISO week, month, or year, respectively.  For example,
5517 @kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9.  When
5518 setting day, week, or month view, a year may be encoded in the prefix
5519 argument as well.  For example, @kbd{200712 w} will jump to week 12 in
5520 2007.  If such a year specification has only one or two digits, it will
5521 be mapped to the interval 1938-2037.
5523 @kindex D
5524 @item D
5525 Toggle the inclusion of diary entries.  See @ref{Weekly/daily agenda}.
5527 @kindex G
5528 @item G
5529 Toggle the time grid on and off.  See also the variables
5530 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
5532 @kindex r
5533 @item r
5534 Recreate the agenda buffer, for example to reflect the changes
5535 after modification of the time stamps of items with S-@key{left} and
5536 S-@key{right}.  When the buffer is the global TODO list, a prefix
5537 argument is interpreted to create a selective list for a specific TODO
5538 keyword.
5539 @kindex g
5540 @item g
5541 Same as @kbd{r}.
5543 @kindex s
5544 @kindex C-x C-s
5545 @item s
5546 @itemx C-x C-s
5547 Save all Org buffers in the current Emacs session.
5549 @kindex @key{right}
5550 @item @key{right}
5551 Display the following @code{org-agenda-ndays} days.  For example, if
5552 the display covers a week, switch to the following week.  With prefix
5553 arg, go forward that many times @code{org-agenda-ndays} days.
5555 @kindex @key{left}
5556 @item @key{left}
5557 Display the previous dates.
5559 @kindex .
5560 @item .
5561 Go to today.
5563 @kindex C-c C-x C-c
5564 @item C-c C-x C-c
5565 Invoke column view (@pxref{Column view}) in the agenda buffer.  The column
5566 view format is taken from the entry at point, or (if there is no entry at
5567 point), from the first entry in the agenda view.  So whatever the format for
5568 that entry would be in the original buffer (taken from a property, from a
5569 @code{#+COLUMNS} line, or from the default variable
5570 @code{org-columns-default-format}), will be used in the agenda.
5572 @tsubheading{Query editing}
5573 @cindex query editing, in agenda
5575 @kindex [
5576 @kindex ]
5577 @kindex @{
5578 @kindex @}
5579 @item [ ] @{ @}
5580 In the @i{search view} (@pxref{Keyword search}), these keys add new
5581 search words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{}
5582 and @kbd{@}}) to the query string.  The opening bracket/brace will add a
5583 positive search term prefixed by @samp{+}, indicating that this search
5584 term @i{must} occur/match in the entry.  Closing bracket/brace add a
5585 negative search term which @i{must not} occur/match in the entry for it
5586 to be selected.
5589 @tsubheading{Remote editing}
5590 @cindex remote editing, from agenda
5592 @item 0-9
5593 Digit argument.
5595 @cindex undoing remote-editing events
5596 @cindex remote editing, undo
5597 @kindex C-_
5598 @item C-_
5599 Undo a change due to a remote editing command.  The change is undone
5600 both in the agenda buffer and in the remote buffer.
5602 @kindex t
5603 @item t
5604 Change the TODO state of the item, both in the agenda and in the
5605 original org file.
5607 @kindex C-k
5608 @item C-k
5609 Delete the current agenda item along with the entire subtree belonging
5610 to it in the original Org file.  If the text to be deleted remotely
5611 is longer than one line, the kill needs to be confirmed by the user.  See
5612 variable @code{org-agenda-confirm-kill}.
5614 @kindex a
5615 @item a
5616 Toggle the ARCHIVE tag for the current headline.
5618 @kindex A
5619 @item A
5620 Move the subtree correspoding to the current entry to its @emph{Archive
5621 Sibling}.
5623 @kindex $
5624 @item $
5625 Archive the subtree corresponding to the current headline.  This means the
5626 entry will be moved to the configured archive locatin, most likely a
5627 different file.
5629 @kindex T
5630 @item T
5631 Show all tags associated with the current item.  Because of
5632 inheritance, this may be more than the tags listed in the line itself.
5634 @kindex :
5635 @item :
5636 Set tags for the current headline.  If there is an active region in the
5637 agenda, change a tag for all headings in the region.
5639 @kindex ,
5640 @item ,
5641 Set the priority for the current item.  Org mode prompts for the
5642 priority character. If you reply with @key{SPC}, the priority cookie
5643 is removed from the entry.
5645 @kindex P
5646 @item P
5647 Display weighted priority of current item.
5649 @kindex +
5650 @kindex S-@key{up}
5651 @item +
5652 @itemx S-@key{up}
5653 Increase the priority of the current item.  The priority is changed in
5654 the original buffer, but the agenda is not resorted.  Use the @kbd{r}
5655 key for this.
5657 @kindex -
5658 @kindex S-@key{down}
5659 @item -
5660 @itemx S-@key{down}
5661 Decrease the priority of the current item.
5663 @kindex C-c C-s
5664 @item C-c C-s
5665 Schedule this item
5667 @kindex C-c C-d
5668 @item C-c C-d
5669 Set a deadline for this item.
5671 @kindex S-@key{right}
5672 @item S-@key{right}
5673 Change the time stamp associated with the current line by one day into the
5674 future.  With a numeric prefix argument, change it by that many days.  For
5675 example, @kbd{3 6 5 S-@key{right}} will change it by a year.  The stamp is
5676 changed in the original org file, but the change is not directly reflected in
5677 the agenda buffer.  Use the @kbd{r} key to update the buffer.
5679 @kindex S-@key{left}
5680 @item S-@key{left}
5681 Change the time stamp associated with the current line by one day
5682 into the past.
5684 @kindex >
5685 @item >
5686 Change the time stamp associated with the current line to today.
5687 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
5688 on my keyboard.
5690 @kindex I
5691 @item I
5692 Start the clock on the current item.  If a clock is running already, it
5693 is stopped first.
5695 @kindex O
5696 @item O
5697 Stop the previously started clock.
5699 @kindex X
5700 @item X
5701 Cancel the currently running clock.
5703 @kindex J
5704 @item J
5705 Jump to the running clock in another window.
5707 @tsubheading{Calendar commands}
5708 @cindex calendar commands, from agenda
5709 @kindex c
5710 @item c
5711 Open the Emacs calendar and move to the date at the agenda cursor.
5713 @item c
5714 When in the calendar, compute and show the Org mode agenda for the
5715 date at the cursor.
5717 @cindex diary entries, creating from agenda
5718 @kindex i
5719 @item i
5720 Insert a new entry into the diary.  Prompts for the type of entry
5721 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
5722 entry in the diary, just as @kbd{i d} etc. would do in the calendar.
5723 The date is taken from the cursor position.
5725 @kindex M
5726 @item M
5727 Show the phases of the moon for the three months around current date.
5729 @kindex S
5730 @item S
5731 Show sunrise and sunset times.  The geographical location must be set
5732 with calendar variables, see documentation of the Emacs calendar.
5734 @kindex C
5735 @item C
5736 Convert the date at cursor into many other cultural and historic
5737 calendars.
5739 @kindex H
5740 @item H
5741 Show holidays for three month around the cursor date.
5743 @item M-x org-export-icalendar-combine-agenda-files
5744 Export a single iCalendar file containing entries from all agenda files.
5745 This is a globally available command, and also available in the agenda menu.
5747 @tsubheading{Exporting to a file}
5748 @kindex C-x C-w
5749 @item C-x C-w
5750 @cindex exporting agenda views
5751 @cindex agenda views, exporting
5752 Write the agenda view to a file.  Depending on the extension of the
5753 selected file name, the view will be exported as HTML (extension
5754 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
5755 plain text (any other extension).  Use the variable
5756 @code{org-agenda-exporter-settings} to set options for @file{ps-print}
5757 and for @file{htmlize} to be used during export.
5759 @tsubheading{Quit and Exit}
5760 @kindex q
5761 @item q
5762 Quit agenda, remove the agenda buffer.
5764 @kindex x
5765 @cindex agenda files, removing buffers
5766 @item x
5767 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
5768 for the compilation of the agenda.  Buffers created by the user to
5769 visit org files will not be removed.
5770 @end table
5773 @node Custom agenda views,  , Agenda commands, Agenda Views
5774 @section Custom agenda views
5775 @cindex custom agenda views
5776 @cindex agenda views, custom
5778 Custom agenda commands serve two purposes: to store and quickly access
5779 frequently used TODO and tags searches, and to create special composite
5780 agenda buffers.  Custom agenda commands will be accessible through the
5781 dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
5783 @menu
5784 * Storing searches::            Type once, use often
5785 * Block agenda::                All the stuff you need in a single buffer
5786 * Setting Options::             Changing the rules
5787 * Exporting Agenda Views::      Writing agendas to files
5788 * Using the agenda elsewhere::  Using agenda information in other programs
5789 @end menu
5791 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
5792 @subsection Storing searches
5794 The first application of custom searches is the definition of keyboard
5795 shortcuts for frequently used searches, either creating an agenda
5796 buffer, or a sparse tree (the latter covering of course only the current
5797 buffer).
5798 @kindex C-c a C
5799 Custom commands are configured in the variable
5800 @code{org-agenda-custom-commands}.  You can customize this variable, for
5801 example by pressing @kbd{C-c a C}.  You can also directly set it with
5802 Emacs Lisp in @file{.emacs}.  The following example contains all valid
5803 search types:
5805 @lisp
5806 @group
5807 (setq org-agenda-custom-commands
5808       '(("w" todo "WAITING")
5809         ("W" todo-tree "WAITING")
5810         ("u" tags "+boss-urgent")
5811         ("v" tags-todo "+boss-urgent")
5812         ("U" tags-tree "+boss-urgent")
5813         ("f" occur-tree "\\<FIXME\\>")
5814         ("h" . "HOME+Name tags searches") ; description for "h" prefix
5815         ("hl" tags "+home+Lisa")
5816         ("hp" tags "+home+Peter")
5817         ("hk" tags "+home+Kim")))
5818 @end group
5819 @end lisp
5821 @noindent
5822 The initial string in each entry defines the keys you have to press
5823 after the dispatcher command @kbd{C-c a} in order to access the command.
5824 Usually this will be just a single character, but if you have many
5825 similar commands, you can also define two-letter combinations where the
5826 first character is the same in several combinations and serves as a
5827 prefix key@footnote{You can provide a description for a prefix key by
5828 inserting a cons cell with the prefix and the description.}.  The second
5829 parameter is the search type, followed by the string or regular
5830 expression to be used for the matching.  The example above will
5831 therefore define:
5833 @table @kbd
5834 @item C-c a w
5835 as a global search for TODO entries with @samp{WAITING} as the TODO
5836 keyword
5837 @item C-c a W
5838 as the same search, but only in the current buffer and displaying the
5839 results as a sparse tree
5840 @item C-c a u
5841 as a global tags search for headlines marked @samp{:boss:} but not
5842 @samp{:urgent:}
5843 @item C-c a v
5844 as the same search as @kbd{C-c a u}, but limiting the search to
5845 headlines that are also TODO items
5846 @item C-c a U
5847 as the same search as @kbd{C-c a u}, but only in the current buffer and
5848 displaying the result as a sparse tree
5849 @item C-c a f
5850 to create a sparse tree (again: current buffer only) with all entries
5851 containing the word @samp{FIXME}
5852 @item C-c a h
5853 as a prefix command for a HOME tags search where you have to press an
5854 additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
5855 Peter, or Kim) as additional tag to match.
5856 @end table
5858 @node Block agenda, Setting Options, Storing searches, Custom agenda views
5859 @subsection Block agenda
5860 @cindex block agenda
5861 @cindex agenda, with block views
5863 Another possibility is the construction of agenda views that comprise
5864 the results of @emph{several} commands, each of which creates a block in
5865 the agenda buffer.  The available commands include @code{agenda} for the
5866 daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
5867 for the global TODO list (as constructed with @kbd{C-c a t}), and the
5868 matching commands discussed above: @code{todo}, @code{tags}, and
5869 @code{tags-todo}.  Here are two examples:
5871 @lisp
5872 @group
5873 (setq org-agenda-custom-commands
5874       '(("h" "Agenda and Home-related tasks"
5875          ((agenda "")
5876           (tags-todo "home")
5877           (tags "garden")))
5878         ("o" "Agenda and Office-related tasks"
5879          ((agenda "")
5880           (tags-todo "work")
5881           (tags "office")))))
5882 @end group
5883 @end lisp
5885 @noindent
5886 This will define @kbd{C-c a h} to create a multi-block view for stuff
5887 you need to attend to at home.  The resulting agenda buffer will contain
5888 your agenda for the current week, all TODO items that carry the tag
5889 @samp{home}, and also all lines tagged with @samp{garden}.  Finally the
5890 command @kbd{C-c a o} provides a similar view for office tasks.
5892 @node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
5893 @subsection Setting options for custom commands
5894 @cindex options, for custom agenda views
5896 Org mode contains a number of variables regulating agenda construction
5897 and display.  The global variables define the behavior for all agenda
5898 commands, including the custom commands.  However, if you want to change
5899 some settings just for a single custom view, you can do so.  Setting
5900 options requires inserting a list of variable names and values at the
5901 right spot in @code{org-agenda-custom-commands}.  For example:
5903 @lisp
5904 @group
5905 (setq org-agenda-custom-commands
5906       '(("w" todo "WAITING"
5907          ((org-agenda-sorting-strategy '(priority-down))
5908           (org-agenda-prefix-format "  Mixed: ")))
5909         ("U" tags-tree "+boss-urgent"
5910          ((org-show-following-heading nil)
5911           (org-show-hierarchy-above nil)))
5912         ("N" search ""
5913          ((org-agenda-files '("~org/notes.org"))
5914           (org-agenda-text-search-extra-files nil)))))
5915 @end group
5916 @end lisp
5918 @noindent
5919 Now the @kbd{C-c a w} command will sort the collected entries only by
5920 priority, and the prefix format is modified to just say @samp{  Mixed: }
5921 instead of giving the category of the entry.  The sparse tags tree of
5922 @kbd{C-c a U} will now turn out ultra-compact, because neither the
5923 headline hierarchy above the match, nor the headline following the match
5924 will be shown.  The command @kbd{C-c a N} will do a text search limited
5925 to only a single file.
5927 For command sets creating a block agenda,
5928 @code{org-agenda-custom-commands} has two separate spots for setting
5929 options.  You can add options that should be valid for just a single
5930 command in the set, and options that should be valid for all commands in
5931 the set.  The former are just added to the command entry, the latter
5932 must come after the list of command entries.  Going back to the block
5933 agenda example (@pxref{Block agenda}), let's change the sorting strategy
5934 for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
5935 the results for GARDEN tags query in the opposite order,
5936 @code{priority-up}.  This would look like this:
5938 @lisp
5939 @group
5940 (setq org-agenda-custom-commands
5941       '(("h" "Agenda and Home-related tasks"
5942          ((agenda)
5943           (tags-todo "home")
5944           (tags "garden"
5945                 ((org-agenda-sorting-strategy '(priority-up)))))
5946          ((org-agenda-sorting-strategy '(priority-down))))
5947         ("o" "Agenda and Office-related tasks"
5948          ((agenda)
5949           (tags-todo "work")
5950           (tags "office")))))
5951 @end group
5952 @end lisp
5954 As you see, the values and parenthesis setting is a little complex.
5955 When in doubt, use the customize interface to set this variable - it
5956 fully supports its structure.  Just one caveat: When setting options in
5957 this interface, the @emph{values} are just lisp expressions.  So if the
5958 value is a string, you need to add the double quotes around the value
5959 yourself.
5962 @node Exporting Agenda Views, Using the agenda elsewhere, Setting Options, Custom agenda views
5963 @subsection Exporting Agenda Views
5964 @cindex agenda views, exporting
5966 If you are away from your computer, it can be very useful to have a
5967 printed version of some agenda views to carry around.  Org mode can
5968 export custom agenda views as plain text, HTML@footnote{You need to
5969 install Hrvoje Niksic' @file{htmlize.el}.} postscript, and iCalendar
5970 files.  If you want to do this only occasionally, use the command
5972 @table @kbd
5973 @kindex C-x C-w
5974 @item C-x C-w
5975 @cindex exporting agenda views
5976 @cindex agenda views, exporting
5977 Write the agenda view to a file.  Depending on the extension of the
5978 selected file name, the view will be exported as HTML (extension
5979 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
5980 iCalendar (extension @file{.ics}), or plain text (any other extension).
5981 Use the variable @code{org-agenda-exporter-settings} to
5982 set options for @file{ps-print} and for @file{htmlize} to be used during
5983 export, for example
5985 @lisp
5986 (setq org-agenda-exporter-settings
5987       '((ps-number-of-columns 2)
5988         (ps-landscape-mode t)
5989         (htmlize-output-type 'css)))
5990 @end lisp
5991 @end table
5993 If you need to export certain agenda views frequently, you can associate
5994 any custom agenda command with a list of output file names
5995 @footnote{If you want to store standard views like the weekly agenda
5996 or the global TODO list as well, you need to define custom commands for
5997 them in order to be able to specify file names.}.  Here is an example
5998 that first does define custom commands for the agenda and the global
5999 todo list, together with a number of files to which to export them.
6000 Then we define two block agenda commands and specify file names for them
6001 as well.  File names can be relative to the current working directory,
6002 or absolute.
6004 @lisp
6005 @group
6006 (setq org-agenda-custom-commands
6007       '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
6008         ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
6009         ("h" "Agenda and Home-related tasks"
6010          ((agenda "")
6011           (tags-todo "home")
6012           (tags "garden"))
6013          nil
6014          ("~/views/home.html"))
6015         ("o" "Agenda and Office-related tasks"
6016          ((agenda)
6017           (tags-todo "work")
6018           (tags "office"))
6019          nil
6020          ("~/views/office.ps" "~/calendars/office.ics"))))
6021 @end group
6022 @end lisp
6024 The extension of the file name determines the type of export.  If it is
6025 @file{.html}, Org mode will use the @file{htmlize.el} package to convert
6026 the buffer to HTML and save it to this file name.  If the extension is
6027 @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
6028 postscript output.  If the extension is @file{.ics}, iCalendar export is
6029 run export over all files that were used to construct the agenda, and
6030 limit the export to entries listed in the agenda now.  Any other
6031 extension produces a plain ASCII file.
6033 The export files are @emph{not} created when you use one of those
6034 commands interactively because this might use too much overhead.
6035 Instead, there is a special command to produce @emph{all} specified
6036 files in one step:
6038 @table @kbd
6039 @kindex C-c a e
6040 @item C-c a e
6041 Export all agenda views that have export file names associated with
6042 them.
6043 @end table
6045 You can use the options section of the custom agenda commands to also
6046 set options for the export commands.  For example:
6048 @lisp
6049 (setq org-agenda-custom-commands
6050       '(("X" agenda ""
6051          ((ps-number-of-columns 2)
6052           (ps-landscape-mode t)
6053           (org-agenda-prefix-format " [ ] ")
6054           (org-agenda-with-colors nil)
6055           (org-agenda-remove-tags t))
6056          ("theagenda.ps"))))
6057 @end lisp
6059 @noindent
6060 This command sets two options for the postscript exporter, to make it
6061 print in two columns in landscape format - the resulting page can be cut
6062 in two and then used in a paper agenda.  The remaining settings modify
6063 the agenda prefix to omit category and scheduling information, and
6064 instead include a checkbox to check off items.  We also remove the tags
6065 to make the lines compact, and we don't want to use colors for the
6066 black-and-white printer.  Settings specified in
6067 @code{org-agenda-exporter-settings} will also apply, but the settings
6068 in @code{org-agenda-custom-commands} take precedence.
6070 @noindent
6071 From the command line you may also use
6072 @example
6073 emacs -f org-batch-store-agenda-views -kill
6074 @end example
6075 @noindent
6076 or, if you need to modify some parameters
6077 @example
6078 emacs -eval '(org-batch-store-agenda-views                      \
6079               org-agenda-ndays 30                               \
6080               org-agenda-start-day "2007-11-01"                 \
6081               org-agenda-include-diary nil                      \
6082               org-agenda-files (quote ("~/org/project.org")))'  \
6083       -kill
6084 @end example
6085 @noindent
6086 which will create the agenda views restricted to the file
6087 @file{~/org/project.org}, without diary entries and with 30 days
6088 extent.
6090 @node Using the agenda elsewhere,  , Exporting Agenda Views, Custom agenda views
6091 @subsection Using agenda information outside of Org
6092 @cindex agenda, pipe
6093 @cindex Scripts, for agenda processing
6095 Org provides commands to access agenda information for the command
6096 line in emacs batch mode.  This extracted information can be sent
6097 directly to a printer, or it can be read by a program that does further
6098 processing of the data.  The first of these commands is the function
6099 @code{org-batch-agenda}, that produces an agenda view and sends it as
6100 ASCII text to STDOUT.  The command takes a single string as parameter.
6101 If the string has length 1, it is used as a key to one of the commands
6102 you have configured in @code{org-agenda-custom-commands}, basically any
6103 key you can use after @kbd{C-c a}.  For example, to directly print the
6104 current TODO list, you could use
6106 @example
6107 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
6108 @end example
6110 If the parameter is a string with 2 or more characters, it is used as a
6111 tags/todo match string.  For example, to print your local shopping list
6112 (all items with the tag @samp{shop}, but excluding the tag
6113 @samp{NewYork}), you could use
6115 @example
6116 emacs -batch -l ~/.emacs                                      \
6117       -eval '(org-batch-agenda "+shop-NewYork")' | lpr
6118 @end example
6120 @noindent
6121 You may also modify parameters on the fly like this:
6123 @example
6124 emacs -batch -l ~/.emacs                                      \
6125    -eval '(org-batch-agenda "a"                               \
6126             org-agenda-ndays 30                               \
6127             org-agenda-include-diary nil                      \
6128             org-agenda-files (quote ("~/org/project.org")))'  \
6129    | lpr
6130 @end example
6132 @noindent
6133 which will produce a 30 day agenda, fully restricted to the Org file
6134 @file{~/org/projects.org}, not even including the diary.
6136 If you want to process the agenda data in more sophisticated ways, you
6137 can use the command @code{org-batch-agenda-csv} to get a comma-separated
6138 list of values for each agenda item.  Each line in the output will
6139 contain a number of fields separated by commas.  The fields in a line
6140 are:
6142 @example
6143 category     @r{The category of the item}
6144 head         @r{The headline, without TODO kwd, TAGS and PRIORITY}
6145 type         @r{The type of the agenda entry, can be}
6146                 todo               @r{selected in TODO match}
6147                 tagsmatch          @r{selected in tags match}
6148                 diary              @r{imported from diary}
6149                 deadline           @r{a deadline}
6150                 scheduled          @r{scheduled}
6151                 timestamp          @r{appointment, selected by timestamp}
6152                 closed             @r{entry was closed on date}
6153                 upcoming-deadline  @r{warning about nearing deadline}
6154                 past-scheduled     @r{forwarded scheduled item}
6155                 block              @r{entry has date block including date}
6156 todo         @r{The TODO keyword, if any}
6157 tags         @r{All tags including inherited ones, separated by colons}
6158 date         @r{The relevant date, like 2007-2-14}
6159 time         @r{The time, like 15:00-16:50}
6160 extra        @r{String with extra planning info}
6161 priority-l   @r{The priority letter if any was given}
6162 priority-n   @r{The computed numerical priority}
6163 @end example
6165 @noindent
6166 Time and date will only be given if a timestamp (or deadline/scheduled)
6167 lead to the selection of the item.
6169 A CSV list like this is very easy to use in a post processing script.
6170 For example, here is a Perl program that gets the TODO list from
6171 Emacs/Org and prints all the items, preceded by a checkbox:
6173 @example
6174 @group
6175 #!/usr/bin/perl
6177 # define the Emacs command to run
6178 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
6180 # run it and capture the output
6181 $agenda = qx@{$cmd 2>/dev/null@};
6183 # loop over all lines
6184 foreach $line (split(/\n/,$agenda)) @{
6186   # get the individual values
6187   ($category,$head,$type,$todo,$tags,$date,$time,$extra,
6188    $priority_l,$priority_n) = split(/,/,$line);
6190   # proccess and print
6191   print "[ ] $head\n";
6193 @end group
6194 @end example
6196 @node Embedded LaTeX, Exporting, Agenda Views, Top
6197 @chapter Embedded LaTeX
6198 @cindex @TeX{} interpretation
6199 @cindex La@TeX{} interpretation
6201 Plain ASCII is normally sufficient for almost all note taking.  One
6202 exception, however, are scientific notes which need to be able to contain
6203 mathematical symbols and the occasional formula.  La@TeX{}@footnote{La@TeX{}
6204 is a macro system based on Donald E. Knuth's @TeX{} system.  Many of the
6205 features described here as ``La@TeX{}'' are really from @TeX{}, but for
6206 simplicity I am blurring this distinction.}  is widely used to typeset
6207 scientific documents. Org mode supports embedding La@TeX{} code into its
6208 files, because many academics are used to reading La@TeX{} source code, and
6209 because it can be readily processed into images for HTML production.
6211 It is not necessary to mark La@TeX{} macros and code in any special way.
6212 If you observe a few conventions, Org mode knows how to find it and what
6213 to do with it.
6215 @menu
6216 * Math symbols::                TeX macros for symbols and Greek letters
6217 * Subscripts and superscripts::  Simple syntax for raising/lowering text
6218 * LaTeX fragments::             Complex formulas made easy
6219 * Processing LaTeX fragments::  Previewing LaTeX processing
6220 * CDLaTeX mode::                Speed up entering of formulas
6221 @end menu
6223 @node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
6224 @section Math symbols
6225 @cindex math symbols
6226 @cindex TeX macros
6228 You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
6229 to indicate the Greek letter, or @samp{\to} to indicate an arrow.
6230 Completion for these macros is available, just type @samp{\} and maybe a
6231 few letters, and press @kbd{M-@key{TAB}} to see possible completions.
6232 Unlike La@TeX{} code, Org mode allows these macros to be present
6233 without surrounding math delimiters, for example:
6235 @example
6236 Angles are written as Greek letters \alpha, \beta and \gamma.
6237 @end example
6239 During HTML export (@pxref{HTML export}), these symbols are translated
6240 into the proper syntax for HTML, for the above examples this is
6241 @samp{&alpha;} and @samp{&rarr;}, respectively.
6243 @node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
6244 @section Subscripts and superscripts
6245 @cindex subscript
6246 @cindex superscript
6248 Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
6249 and subscripts.  Again, these can be used without embedding them in
6250 math-mode delimiters.  To increase the readability of ASCII text, it is
6251 not necessary (but OK) to surround multi-character sub- and superscripts
6252 with curly braces.  For example
6254 @example
6255 The mass if the sun is M_sun = 1.989 x 10^30 kg.  The radius of
6256 the sun is R_@{sun@} = 6.96 x 10^8 m.
6257 @end example
6259 To avoid interpretation as raised or lowered text, you can quote
6260 @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
6262 During HTML export (@pxref{HTML export}), subscript and superscripts
6263 are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
6265 @node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
6266 @section LaTeX fragments
6267 @cindex LaTeX fragments
6269 With symbols, sub- and superscripts, HTML is pretty much at its end when
6270 it comes to representing mathematical formulas@footnote{Yes, there is
6271 MathML, but that is not yet fully supported by many browsers, and there
6272 is no decent converter for turning La@TeX{} or ASCII representations of
6273 formulas into MathML. So for the time being, converting formulas into
6274 images seems the way to go.}. More complex expressions need a dedicated
6275 formula processor. To this end, Org mode can contain arbitrary La@TeX{}
6276 fragments. It provides commands to preview the typeset result of these
6277 fragments, and upon export to HTML, all fragments will be converted to
6278 images and inlined into the HTML document@footnote{The La@TeX{} export
6279 will not use images for displaying La@TeX{} fragments but include these
6280 fragments directly into the La@TeX{} code.}. For this to work you
6281 need to be on a system with a working La@TeX{} installation. You also
6282 need the @file{dvipng} program, available at
6283 @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
6284 will be used when processing a fragment can be configured with the
6285 variable @code{org-format-latex-header}.
6287 La@TeX{} fragments don't need any special marking at all.  The following
6288 snippets will be identified as La@TeX{} source code:
6289 @itemize @bullet
6290 @item
6291 Environments of any kind.  The only requirement is that the
6292 @code{\begin} statement appears on a new line, preceded by only
6293 whitespace.
6294 @item
6295 Text within the usual La@TeX{} math delimiters.  To avoid conflicts with
6296 currency specifications, single @samp{$} characters are only recognized
6297 as math delimiters if the enclosed text contains at most two line breaks,
6298 is directly attached to the @samp{$} characters with no whitespace in
6299 between, and if the closing @samp{$} is followed by whitespace or
6300 punctuation.  For the other delimiters, there is no such restriction, so
6301 when in doubt, use @samp{\(...\)} as inline math delimiters.
6302 @end itemize
6304 @noindent For example:
6306 @example
6307 \begin@{equation@}                          % arbitrary environments,
6308 x=\sqrt@{b@}                                % even tables, figures
6309 \end@{equation@}                            % etc
6311 If $a^2=b$ and \( b=2 \), then the solution must be
6312 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
6313 @end example
6315 @noindent
6316 If you need any of the delimiter ASCII sequences for other purposes, you
6317 can configure the option @code{org-format-latex-options} to deselect the
6318 ones you do not wish to have interpreted by the La@TeX{} converter.
6320 @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
6321 @section Processing LaTeX fragments
6322 @cindex LaTeX fragments, preview
6324 La@TeX{} fragments can be processed to produce a preview images of the
6325 typeset expressions:
6327 @table @kbd
6328 @kindex C-c C-x C-l
6329 @item C-c C-x C-l
6330 Produce a preview image of the La@TeX{} fragment at point and overlay it
6331 over the source code.  If there is no fragment at point, process all
6332 fragments in the current entry (between two headlines).  When called
6333 with a prefix argument, process the entire subtree.  When called with
6334 two prefix arguments, or when the cursor is before the first headline,
6335 process the entire buffer.
6336 @kindex C-c C-c
6337 @item C-c C-c
6338 Remove the overlay preview images.
6339 @end table
6341 During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
6342 converted into images and inlined into the document if the following
6343 setting is active:
6345 @lisp
6346 (setq org-export-with-LaTeX-fragments t)
6347 @end lisp
6349 @node CDLaTeX mode,  , Processing LaTeX fragments, Embedded LaTeX
6350 @section Using CDLaTeX to enter math
6351 @cindex CDLaTeX
6353 CDLaTeX mode is a minor mode that is normally used in combination with a
6354 major La@TeX{} mode like AUCTeX in order to speed-up insertion of
6355 environments and math templates.  Inside Org mode, you can make use of
6356 some of the features of CDLaTeX mode.  You need to install
6357 @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
6358 AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
6359 Don't turn CDLaTeX mode itself under Org mode, but use the light
6360 version @code{org-cdlatex-mode} that comes as part of Org mode.  Turn it
6361 on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
6362 Org files with
6364 @lisp
6365 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
6366 @end lisp
6368 When this mode is enabled, the following features are present (for more
6369 details see the documentation of CDLaTeX mode):
6370 @itemize @bullet
6371 @kindex C-c @{
6372 @item
6373 Environment templates can be inserted with @kbd{C-c @{}.
6374 @item
6375 @kindex @key{TAB}
6376 The @key{TAB} key will do template expansion if the cursor is inside a
6377 La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
6378 inside such a fragment, see the documentation of the function
6379 @code{org-inside-LaTeX-fragment-p}.}.  For example, @key{TAB} will
6380 expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
6381 correctly inside the first brace.  Another @key{TAB} will get you into
6382 the second brace.  Even outside fragments, @key{TAB} will expand
6383 environment abbreviations at the beginning of a line.  For example, if
6384 you write @samp{equ} at the beginning of a line and press @key{TAB},
6385 this abbreviation will be expanded to an @code{equation} environment.
6386 To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
6387 @item
6388 @kindex _
6389 @kindex ^
6390 Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
6391 characters together with a pair of braces.  If you use @key{TAB} to move
6392 out of the braces, and if the braces surround only a single character or
6393 macro, they are removed again (depending on the variable
6394 @code{cdlatex-simplify-sub-super-scripts}).
6395 @item
6396 @kindex `
6397 Pressing the backquote @kbd{`} followed by a character inserts math
6398 macros, also outside La@TeX{} fragments.  If you wait more than 1.5 seconds
6399 after the backquote, a help window will pop up.
6400 @item
6401 @kindex '
6402 Pressing the normal quote @kbd{'} followed by another character modifies
6403 the symbol before point with an accent or a font.  If you wait more than
6404 1.5 seconds after the backquote, a help window will pop up.  Character
6405 modification will work only inside La@TeX{} fragments, outside the quote
6406 is normal.
6407 @end itemize
6409 @node Exporting, Publishing, Embedded LaTeX, Top
6410 @chapter Exporting
6411 @cindex exporting
6413 Org mode documents can be exported into a variety of other formats.  For
6414 printing and sharing of notes, ASCII export produces a readable and
6415 simple version of an Org file.  HTML export allows you to publish a
6416 notes file on the web, while the XOXO format provides a solid base for
6417 exchange with a broad range of other applications. La@TeX{} export lets
6418 you use Org mode and its structured editing functions to easily create
6419 La@TeX{} files.  To incorporate entries with associated times like
6420 deadlines or appointments into a desktop calendar program like iCal,
6421 Org mode can also produce extracts in the iCalendar format.  Currently
6422 Org mode only supports export, not import of these different formats.
6424 When exporting, Org mode uses special conventions to enrich the output
6425 produced.  @xref{Text interpretation}, for more details.
6427 @table @kbd
6428 @kindex C-c C-e
6429 @item C-c C-e
6430 Dispatcher for export and publishing commands.  Displays a help-window
6431 listing the additional key(s) needed to launch an export or publishing
6432 command.
6433 @end table
6435 @menu
6436 * ASCII export::                Exporting to plain ASCII
6437 * HTML export::                 Exporting to HTML
6438 * LaTeX export::                Exporting to LaTeX
6439 * XOXO export::                 Exporting to XOXO
6440 * iCalendar export::            Exporting in iCalendar format
6441 * Text interpretation::         How the exporter looks at the file
6442 @end menu
6444 @node ASCII export, HTML export, Exporting, Exporting
6445 @section ASCII export
6446 @cindex ASCII export
6448 ASCII export produces a simple and very readable version of an Org mode
6449 file.
6451 @cindex region, active
6452 @cindex active region
6453 @cindex Transient mark mode
6454 @table @kbd
6455 @kindex C-c C-e a
6456 @item C-c C-e a
6457 Export as ASCII file.  For an org file @file{myfile.org}, the ASCII file
6458 will be @file{myfile.txt}.  The file will be overwritten without
6459 warning.  If there is an active region, only the region will be
6460 exported. If the selected region is a single tree, the tree head will
6461 become the document title.  If the tree head entry has or inherits an
6462 @code{:EXPORT_FILE_NAME:} property, that name will be used for the
6463 export.
6464 @kindex C-c C-e v a
6465 @item C-c C-e v a
6466 Export only the visible part of the document.
6467 @end table
6469 @cindex headline levels, for exporting
6470 In the exported version, the first 3 outline levels will become
6471 headlines, defining a general document structure.  Additional levels
6472 will be exported as itemized lists.  If you want that transition to occur
6473 at a different level, specify it with a prefix argument.  For example,
6475 @example
6476 @kbd{C-1 C-c C-e a}
6477 @end example
6479 @noindent
6480 creates only top level headlines and does the rest as items.  When
6481 headlines are converted to items, the indentation of the text following
6482 the headline is changed to fit nicely under the item.  This is done with
6483 the assumption that the first body line indicates the base indentation of
6484 the body text.  Any indentation larger than this is adjusted to preserve
6485 the layout relative to the first line.  Should there be lines with less
6486 indentation than the first, these are left alone.
6488 @node HTML export, LaTeX export, ASCII export, Exporting
6489 @section HTML export
6490 @cindex HTML export
6492 Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
6493 HTML formatting, in ways similar to John Grubers @emph{markdown}
6494 language, but with additional support for tables.
6496 @menu
6497 * HTML Export commands::        How to invoke LaTeX export
6498 * Quoting HTML tags::           Using direct HTML in Org mode
6499 * Links::                       Transformation of links for HTML
6500 * Images::                      How to include images
6501 * CSS support::                 Changing the appearance of the output
6502 * Javascript support::          Info and Folding in a web browser
6503 @end menu
6505 @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
6506 @subsection HTML export commands
6508 @cindex region, active
6509 @cindex active region
6510 @cindex Transient mark mode
6511 @table @kbd
6512 @kindex C-c C-e h
6513 @item C-c C-e h
6514 Export as HTML file @file{myfile.html}.  For an org file
6515 @file{myfile.org}, the ASCII file will be @file{myfile.html}.  The file
6516 will be overwritten without warning.  If there is an active region, only
6517 the region will be exported. If the selected region is a single tree,
6518 the tree head will become the document title.  If the tree head entry
6519 has or inherits an @code{:EXPORT_FILE_NAME:} property, that name will be
6520 used for the export.
6521 @kindex C-c C-e b
6522 @item C-c C-e b
6523 Export as HTML file and immediately open it with a browser.
6524 @kindex C-c C-e H
6525 @item C-c C-e H
6526 Export to a temporary buffer, do not create a file.
6527 @kindex C-c C-e R
6528 @item C-c C-e R
6529 Export the active region to a temporary buffer.  With a prefix argument, do
6530 not produce the file header and footer, but just the plain HTML section for
6531 the region.  This is good for cut-and-paste operations.
6532 @kindex C-c C-e v h
6533 @kindex C-c C-e v b
6534 @kindex C-c C-e v H
6535 @kindex C-c C-e v R
6536 @item C-c C-e v h
6537 @item C-c C-e v b
6538 @item C-c C-e v H
6539 @item C-c C-e v R
6540 Export only the visible part of the document.
6541 @item M-x org-export-region-as-html
6542 Convert the region to HTML under the assumption that it was Org mode
6543 syntax before.  This is a global command that can be invoked in any
6544 buffer.
6545 @item M-x org-replace-region-by-HTML
6546 Replace the active region (assumed to be in Org mode syntax) by HTML
6547 code.
6548 @end table
6550 @cindex headline levels, for exporting
6551 In the exported version, the first 3 outline levels will become headlines,
6552 defining a general document structure.  Additional levels will be exported as
6553 itemized lists.  If you want that transition to occur at a different level,
6554 specify it with a numeric prefix argument.  For example,
6556 @example
6557 @kbd{C-2 C-c C-e b}
6558 @end example
6560 @noindent
6561 creates two levels of headings and does the rest as items.
6563 @node Quoting HTML tags, Links, HTML Export commands, HTML export
6564 @subsection Quoting HTML tags
6566 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
6567 @samp{&gt;} in HTML export.  If you want to include simple HTML tags
6568 which should be interpreted as such, mark them with @samp{@@} as in
6569 @samp{@@<b>bold text@@</b>}.  Note that this really works only for
6570 simple tags.  For more extensive HTML that should be copied verbatim to
6571 the exported file use either
6573 @example
6574 #+HTML: Literal HTML code for export
6575 @end example
6577 @noindent or
6579 @example
6580 #+BEGIN_HTML
6581 All lines between these markers are exported literally
6582 #+END_HTML
6583 @end example
6586 @node Links, Images, Quoting HTML tags, HTML export
6587 @subsection Links
6589 @cindex links, in HTML export
6590 @cindex internal links, in HTML export
6591 @cindex external links, in HTML export
6592 Internal links (@pxref{Internal links}) will continue to work in HTML
6593 files only if they match a dedicated @samp{<<target>>}.  Automatic links
6594 created by radio targets (@pxref{Radio targets}) will also work in the
6595 HTML file.  Links to external files will still work if the HTML file is
6596 in the same directory as the Org file.  Links to other @file{.org}
6597 files will be translated into HTML links under the assumption that an
6598 HTML version also exists of the linked file.  For information related to
6599 linking files while publishing them to a publishing directory see
6600 @ref{Publishing links}.
6602 @node Images, CSS support, Links, HTML export
6603 @subsection Images
6605 @cindex images, inline in HTML
6606 @cindex inlining images in HTML
6607 HTML export can inline images given as links in the Org file, and
6608 it can make an image the clickable part of a link.  By
6609 default@footnote{but see the variable
6610 @code{org-export-html-inline-images}}, images are inlined if a link does
6611 not have a description.  So @samp{[[file:myimg.jpg]]} will be inlined,
6612 while @samp{[[file:myimg.jpg][the image]]} will just produce a link
6613 @samp{the image} that points to the image.  If the description part
6614 itself is a @code{file:} link or a @code{http:} URL pointing to an
6615 image, this image will be inlined and activated so that clicking on the
6616 image will activate the link.  For example, to include a thumbnail that
6617 will link to a high resolution version of the image, you could use:
6619 @example
6620 [[file:highres.jpg][file:thumb.jpg]]
6621 @end example
6623 @noindent
6624 and you could use @code{http} addresses just as well.
6626 @node CSS support, Javascript support, Images, HTML export
6627 @subsection CSS support
6628 @cindex CSS, for HTML export
6629 @cindex HTML export, CSS
6631 You can also give style information for the exported file.  The HTML
6632 exporter assigns the following CSS classes to appropriate parts of the
6633 document - your style specifications may change these:
6634 @example
6635 .todo           @r{TODO keywords}
6636 .done           @r{the DONE keyword}
6637 .timestamp      @r{time stamp}
6638 .timestamp-kwd  @r{keyword associated with a time stamp, like SCHEDULED}
6639 .tag            @r{tag in a headline}
6640 .target         @r{target for links}
6641 @end example
6643 The default style specification can be configured through the option
6644 @code{org-export-html-style}.  If you want to use a file-local style,
6645 you may use file variables, best wrapped into a COMMENT section at the
6646 end of the outline tree.  For example@footnote{Under Emacs 21, the
6647 continuation lines for a variable value should have no @samp{#} at the
6648 start of the line.}:
6650 @example
6651 * COMMENT html style specifications
6653 # Local Variables:
6654 # org-export-html-style: "   <style type=\"text/css\">
6655 #       p @{font-weight: normal; color: gray; @}
6656 #       h1 @{color: black; @}
6657 #   </style>"
6658 # End:
6659 @end example
6661 Remember to execute @kbd{M-x normal-mode} after changing this to make
6662 the new style visible to Emacs.  This command restarts Org mode for the
6663 current buffer and forces Emacs to re-evaluate the local variables
6664 section in the buffer.
6666 @c FIXME: More about header and footer styles
6667 @c FIXME: Talk about links and targets.
6669 @node Javascript support,  , CSS support, HTML export
6670 @subsection Javascript supported display of web pages
6672 @emph{Sebastian Rose} has written a JavaScript program especially designed to
6673 enhance the web viewing experience of HTML files created with Org.  This
6674 program allows to view large files in two different ways.  The first one is
6675 an @emph{Info}-like mode where each section is displayed separately and
6676 navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
6677 as well, press @kbd{?} for an overview of the available keys).  The second
6678 view type is a @emph{folding} view much like Org provides it inside Emacs.
6679 The script is available at @url{http://orgmode.org/org-info.js} and you can
6680 find the documentation for it at @url{http://orgmode.org/org-infojs.html}.
6681 We are serving the script from our site, but if you use it a lot, you might
6682 not want to be dependent on @url{orgmode.org} and prefer to install a local
6683 copy on your own web server.
6685 To use the script, you need to make sure that the @file{org-infojs.el} module
6686 gets loaded.  It should be loaded by default, try @kbd{M-x customize-variable
6687 @key{RET} org-modules @key{RET}} to convince yourself that this is indeed the
6688 case.  All it then takes to make use of the program is adding a single line
6689 to the Org file:
6691 @example
6692 #+INFOSJ_OPT: view:info toc:nil
6693 @end example
6695 @noindent
6696 If this line is found, the HTML header will automatically contain the code
6697 needed to invoke the script.  Using the line above, you can set the following
6698 viewing options:
6700 @example
6701 view:    @r{Initial view when website is first shown.  Possible values are}
6702          info      @r{Info-like interface with one section per page.}
6703          overview  @r{Folding interface, initially showing only top-level.}
6704          content   @r{Folding interface, starting with all headlines visible.}
6705          showall   @r{Folding interface, all headlines and text visible.}
6706 toc:     @r{Should the table of content be visible as the first section?}
6707          @r{Even when @code{nil}, you can always get to the toc with @kbd{i}.}
6708 ltoc:    @r{Should there be short contents in each section?}
6709 path:    @r{The path to the script.  The default is to grab the script from}
6710          @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
6711          @r{a local copy use a path like @samp{../scripts/org-info.js}.}
6712 mouse:   @r{Headings are highlighted when the mouse is over the.  Should be}
6713          @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
6714 buttons: @r{Should view-toggle buttons be everywhere?  When @code{nil} (the}
6715          @r{default), only one such button will be present.}
6716 @end example
6718 You can choose default values for these options by customizing the variable
6719 @code{org-infojs-options}.  If you always want to apply the script to your
6720 pages, configure the variable @code{org-export-html-use-infojs}.
6722 @node LaTeX export, XOXO export, HTML export, Exporting
6723 @section LaTeX export
6724 @cindex LaTeX export
6726 Org mode contains a La@TeX{} exporter written by Bastien Guerry.
6728 @menu
6729 * LaTeX export commands::       How to invoke LaTeX export
6730 * Quoting LaTeX code::          Incorporating literal LaTeX code
6731 * Sectioning structure::        Changing sectioning in LaTeX output
6732 @end menu
6734 @node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
6735 @subsection LaTeX export commands
6737 @table @kbd
6738 @kindex C-c C-e l
6739 @item C-c C-e l
6740 Export as La@TeX{} file @file{myfile.tex}.
6741 @kindex C-c C-e L
6742 @item C-c C-e L
6743 Export to a temporary buffer, do not create a file.
6744 @kindex C-c C-e v l
6745 @kindex C-c C-e v L
6746 @item C-c C-e v l
6747 @item C-c C-e v L
6748 Export only the visible part of the document.
6749 @item M-x org-export-region-as-latex
6750 Convert the region to La@TeX{} under the assumption that it was Org mode
6751 syntax before.  This is a global command that can be invoked in any
6752 buffer.
6753 @item M-x org-replace-region-by-latex
6754 Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
6755 code.
6756 @end table
6758 @cindex headline levels, for exporting
6759 In the exported version, the first 3 outline levels will become
6760 headlines, defining a general document structure.  Additional levels
6761 will be exported as description lists.  The exporter can ignore them or
6762 convert them to a custom string depending on
6763 @code{org-latex-low-levels}.
6765 If you want that transition to occur at a different level, specify it
6766 with a numeric prefix argument. For example,
6768 @example
6769 @kbd{C-2 C-c C-e l}
6770 @end example
6772 @noindent
6773 creates two levels of headings and does the rest as items.
6775 @node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export
6776 @subsection Quoting LaTeX code
6778 Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
6779 inserted into the La@TeX{} file.  Furthermore, you can add special code
6780 that should only be present in La@TeX{} export with the following
6781 constructs:
6783 @example
6784 #+LaTeX: Literal LaTeX code for export
6785 @end example
6787 @noindent or
6789 @example
6790 #+BEGIN_LaTeX
6791 All lines between these markers are exported literally
6792 #+END_LaTeX
6793 @end example
6797 @node   Sectioning structure,  , Quoting LaTeX code, LaTeX export
6798 @subsection Sectioning structure
6799 @cindex LaTeX class
6800 @cindex LaTeX sectioning structure
6802 By default, the La@TeX{} output uses the class @code{article}.
6804 You can change this globally by setting a different value for
6805 @code{org-export-latex-default-class} or locally by adding an option
6806 like @code{#+LaTeX_CLASS: myclass} in your file.  The class should be
6807 listed in @code{org-export-latex-classes}, where you can also define the
6808 sectioning structure for each class.
6811 @node XOXO export, iCalendar export, LaTeX export, Exporting
6812 @section XOXO export
6813 @cindex XOXO export
6815 Org mode contains an exporter that produces XOXO-style output.
6816 Currently, this exporter only handles the general outline structure and
6817 does not interpret any additional Org mode features.
6819 @table @kbd
6820 @kindex C-c C-e x
6821 @item C-c C-e x
6822 Export as XOXO file @file{myfile.html}.
6823 @kindex C-c C-e v
6824 @item C-c C-e v x
6825 Export only the visible part of the document.
6826 @end table
6828 @node iCalendar export, Text interpretation, XOXO export, Exporting
6829 @section iCalendar export
6830 @cindex iCalendar export
6832 Some people like to use Org mode for keeping track of projects, but
6833 still prefer a standard calendar application for anniversaries and
6834 appointments.  In this case it can be useful to have deadlines and
6835 other time-stamped items in Org files show up in the calendar
6836 application.  Org mode can export calendar information in the standard
6837 iCalendar format.  If you also want to have TODO entries included in the
6838 export, configure the variable @code{org-icalendar-include-todo}.
6840 @table @kbd
6841 @kindex C-c C-e i
6842 @item C-c C-e i
6843 Create iCalendar entries for the current file and store them in the same
6844 directory, using a file extension @file{.ics}.
6845 @kindex C-c C-e I
6846 @item C-c C-e I
6847 Like @kbd{C-c C-e i}, but do this for all files in
6848 @code{org-agenda-files}.  For each of these files, a separate iCalendar
6849 file will be written.
6850 @kindex C-c C-e c
6851 @item C-c C-e c
6852 Create a single large iCalendar file from all files in
6853 @code{org-agenda-files} and write it to the file given by
6854 @code{org-combined-agenda-icalendar-file}.
6855 @end table
6857 The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
6858 the selected entries have them.  If not, the summary will be derived
6859 from the headline, and the description from the body (limited to
6860 @code{org-icalendar-include-body} characters).
6862 How this calendar is best read and updated, depends on the application
6863 you are using.  The FAQ covers this issue.
6866 @node Text interpretation,  , iCalendar export, Exporting
6867 @section Text interpretation by the exporter
6869 The exporter backends interpret additional structure in the Org file
6870 in order to produce better output.
6872 @menu
6873 * Comment lines::               Some lines will not be exported
6874 * Initial text::                Text before the first headline
6875 * Footnotes::                   Numbers like [1]
6876 * Quoted examples::             Inserting quoted chunks of text
6877 * Enhancing text::              Subscripts, symbols and more
6878 * Export options::              How to influence the export settings
6879 @end menu
6881 @node Comment lines, Initial text, Text interpretation, Text interpretation
6882 @subsection Comment lines
6883 @cindex comment lines
6884 @cindex exporting, not
6886 Lines starting with @samp{#} in column zero are treated as comments
6887 and will never be exported.  Also entire subtrees starting with the
6888 word @samp{COMMENT} will never be exported.
6890 @table @kbd
6891 @kindex C-c ;
6892 @item C-c ;
6893 Toggle the COMMENT keyword at the beginning of an entry.
6894 @end table
6896 @node Initial text, Footnotes, Comment lines, Text interpretation
6897 @subsection Text before the first headline
6899 Org mode normally ignores any text before the first headline when
6900 exporting, leaving this region for internal links to speed up navigation
6901 etc.  However, in publishing-oriented files, you might want to have some
6902 text before the first headline, like a small introduction, special HTML
6903 code with a navigation bar, etc.  You can ask to have this part of the
6904 file exported as well by setting the variable
6905 @code{org-export-skip-text-before-1st-heading} to @code{nil}.  On a
6906 per-file basis, you can get the same effect with
6908 @example
6909 #+OPTIONS: skip:nil
6910 @end example
6912 The text before the first headline will be fully processed
6913 (@pxref{Enhancing text}), and the first non-comment line becomes the
6914 title of the exported document.  If you need to include literal HTML,
6915 use the special constructs described in @ref{Quoting HTML tags}.  The
6916 table of contents is normally inserted directly before the first
6917 headline of the file.  If you would like to get it to a different
6918 location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by
6919 itself at the desired location.
6921 Finally, if you want to use the space before the first headline for
6922 internal purposes, but @emph{still} want to place something before the
6923 first headline when exporting the file, you can use the @code{#+TEXT}
6924 construct:
6926 @example
6927 #+OPTIONS: skip:t
6928 #+TEXT: This text will go before the *first* headline.
6929 #+TEXT: We place the table of contents here:
6930 #+TEXT: [TABLE-OF-CONTENTS]
6931 #+TEXT: This goes between the table of contents and the first headline
6932 @end example
6934 @node Footnotes, Quoted examples, Initial text, Text interpretation
6935 @subsection Footnotes
6936 @cindex footnotes
6937 @cindex @file{footnote.el}
6939 Numbers in square brackets are treated as footnotes, so that you can use
6940 the Emacs package @file{footnote.el} to create footnotes.  For example:
6942 @example
6943 The Org homepage[1] clearly needs help from
6944 a good web designer.
6946 [1] The link is: http://orgmode.org
6947 @end example
6949 @noindent
6950 @kindex C-c !
6951 Note that the @file{footnote} package uses @kbd{C-c !} to invoke its
6952 commands.  This binding conflicts with the Org mode command for
6953 inserting inactive time stamps.  You could use the variable
6954 @code{footnote-prefix} to switch footnotes commands to another key.  Or,
6955 if you are too used to this binding, you could use
6956 @code{org-replace-disputed-keys} and @code{org-disputed-keys} to change
6957 the settings in Org.
6959 @node Quoted examples, Enhancing text, Footnotes, Text interpretation
6960 @subsection Quoted examples
6961 @cindex quoted examples
6962 @cindex examples, quoted
6963 @cindex text, fixed width
6964 @cindex fixed width text
6966 When writing technical documents, you often need to insert examples that
6967 are not further interpreted by Org mode.  For historical reasons, there
6968 are several ways to do this:
6970 @itemize @bullet
6971 @item
6972 If a headline starts with the word @samp{QUOTE}, the text below the
6973 headline will be typeset as fixed-width, to allow quoting of computer
6974 codes etc.
6975 @item
6976 Lines starting with @samp{:} are also typeset in fixed-width font.
6977 @table @kbd
6978 @kindex C-c :
6979 @item C-c :
6980 Toggle fixed-width for entry (QUOTE) or region, see below.
6981 @end table
6982 @item
6983 Finally, text between
6984 @example
6985 #+BEGIN_EXAMPLE
6986 quoted text
6987 #+END_EXAMPLE
6988 @end example
6989 will also be exported in this way.
6990 @end itemize
6993 @node Enhancing text, Export options, Quoted examples, Text interpretation
6994 @subsection Enhancing text for export
6995 @cindex enhancing text
6996 @cindex richer text
6998 Some of the export backends of Org mode allow for sophisticated text
6999 formatting, this is true in particular for the HTML and La@TeX{}
7000 backends.  Org mode has a number of typing conventions that allow to
7001 produce a richly formatted output.
7003 @itemize @bullet
7005 @cindex hand-formatted lists
7006 @cindex lists, hand-formatted
7007 @item
7008 Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
7009 or @samp{2)} as enumerator will be recognized and transformed if the
7010 backend supports lists.  See @xref{Plain lists}.
7012 @cindex underlined text
7013 @cindex bold text
7014 @cindex italic text
7015 @cindex verbatim text
7016 @item
7017 You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
7018 and @code{~verbatim~}, and, if you must, @samp{+strikethrough+}.  Text
7019 in the code and verbatim string is not processed for Org mode specific
7020 syntax, it is exported verbatim.
7022 @cindex horizontal rules, in exported files
7023 @item
7024 A line consisting of only dashes, and at least 5 of them, will be
7025 exported as a horizontal line (@samp{<hr/>} in HTML).
7027 @cindex LaTeX fragments, export
7028 @cindex TeX macros, export
7029 @item
7030 Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML
7031 entities or images (@pxref{Embedded LaTeX}).
7033 @cindex tables, export
7034 @item
7035 Tables are transformed into native tables under the exporter, if the
7036 export backend supports this. Data fields before the first horizontal
7037 separator line will be formatted as table header fields.
7039 @cindex fixed width
7040 @item
7041 If a headline starts with the word @samp{QUOTE}, the text below the
7042 headline will be typeset as fixed-width, to allow quoting of computer
7043 codes etc.  Lines starting with @samp{:} are also typeset in fixed-width
7044 font.
7045 @table @kbd
7046 @kindex C-c :
7047 @item C-c :
7048 Toggle fixed-width for entry (QUOTE) or region, see below.
7049 @end table
7050 Finally, text between
7051 @example
7052 #+BEGIN_EXAMPLE
7053 quoted text
7054 #+END_EXAMPLE
7055 @end example
7056 will also be exported in this way.
7058 @cindex linebreak, forced
7059 @item
7060 A double backslash @emph{at the end of a line} enforces a line break at
7061 this position.
7063 @cindex HTML entities, LaTeX entities
7064 @item
7065 Strings like @code{\alpha} will be exported as @code{&alpha;}, in the
7066 HTML output.  These strings are exported as @code{$\alpha$} in the
7067 La@TeX{} output.  Similarly, @code{\nbsp} will become @code{&nbsp;} in
7068 HTML and in La@TeX{}.  This applies for a long list of entities, see
7069 the variable @code{org-html-entities} for the complete list.
7070 @c FIXME
7071 @end itemize
7073 If these conversions conflict with your habits of typing ASCII text,
7074 they can all be turned off with corresponding variables.  See the
7075 customization group @code{org-export-general}, and the following section
7076 which explains how to set export options with special lines in a
7077 buffer.
7080 @node Export options,  , Enhancing text, Text interpretation
7081 @subsection Export options
7082 @cindex options, for export
7084 @cindex completion, of option keywords
7085 The exporter recognizes special lines in the buffer which provide
7086 additional information.  These lines may be put anywhere in the file.
7087 The whole set of lines can be inserted into the buffer with @kbd{C-c
7088 C-e t}.  For individual lines, a good way to make sure the keyword is
7089 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
7090 (@pxref{Completion}).
7092 @table @kbd
7093 @kindex C-c C-e t
7094 @item C-c C-e t
7095 Insert template with export options, see example below.
7096 @end table
7098 @example
7099 #+TITLE:     the title to be shown (default is the buffer name)
7100 #+AUTHOR:    the author (default taken from @code{user-full-name})
7101 #+DATE:      A date, fixed, of a format string for @code{format-time-string}
7102 #+EMAIL:     his/her email address (default from @code{user-mail-address})
7103 #+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
7104 #+TEXT:      Some descriptive text to be inserted at the beginning.
7105 #+TEXT:      Several lines may be given.
7106 #+OPTIONS:   H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
7107 @end example
7109 @noindent
7110 The OPTIONS line is a compact form to specify export settings.  Here
7111 you can:
7112 @cindex headline levels
7113 @cindex section-numbers
7114 @cindex table of contents
7115 @cindex linebreak preservation
7116 @cindex quoted HTML tags
7117 @cindex fixed-width sections
7118 @cindex tables
7119 @cindex @TeX{}-like syntax for sub- and superscripts
7120 @cindex footnotes
7121 @cindex special strings
7122 @cindex emphasized text
7123 @cindex @TeX{} macros
7124 @cindex La@TeX{} fragments
7125 @cindex author info, in export
7126 @cindex time info, in export
7127 @example
7128 H:         @r{set the number of headline levels for export}
7129 num:       @r{turn on/off section-numbers}
7130 toc:       @r{turn on/off table of contents, or set level limit (integer)}
7131 \n:        @r{turn on/off linebreak-preservation}
7132 @@:         @r{turn on/off quoted HTML tags}
7133 ::         @r{turn on/off fixed-width sections}
7134 |:         @r{turn on/off tables}
7135 ^:         @r{turn on/off @TeX{}-like syntax for sub- and superscripts.  If}
7136            @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
7137            @r{the simple @code{a_b} will be left as it is.}
7138 -:         @r{turn on/off conversion of special strings.}
7139 f:         @r{turn on/off foototes like this[1].}
7140 *:         @r{turn on/off emphasized text (bold, italic, underlined)}
7141 TeX:       @r{turn on/off simple @TeX{} macros in plain text}
7142 LaTeX:     @r{turn on/off La@TeX{} fragments}
7143 skip:      @r{turn on/off skipping the text before the first heading}
7144 author:    @r{turn on/off inclusion of author name/email into exported file}
7145 timestamp: @r{turn on/off inclusion creation time into exported file}
7146 d:         @r{turn on/off inclusion of drawers}
7147 @end example
7149 These options take effect in both the HTML and La@TeX{} export, except
7150 for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
7151 @code{nil} for the La@TeX{} export.
7153 @node Publishing, Miscellaneous, Exporting, Top
7154 @chapter Publishing
7155 @cindex publishing
7157 Org includes@footnote{@file{org-publish.el} is not distributed with
7158 Emacs 21, if you are still using Emacs 21, you need you need to download
7159 this file separately.} a publishing management system that allows you to
7160 configure automatic HTML conversion of @emph{projects} composed of
7161 interlinked org files.  This system is called @emph{org-publish}.  You can
7162 also configure org-publish to automatically upload your exported HTML
7163 pages and related attachments, such as images and source code files, to
7164 a web server. Org-publish turns Org into a web-site authoring tool.
7166 You can also use Org-publish to convert files into La@TeX{}, or even
7167 combine HTML and La@TeX{} conversion so that files are available in both
7168 formats on the server@footnote{Since La@TeX{} files on a server are not
7169 that helpful, you surely want to perform further conversion on them --
7170 e.g. convert them to @code{PDF} format.}.
7172 Org-publish has been contributed to Org by David O'Toole.
7174 @menu
7175 * Configuration::               Defining projects
7176 * Sample configuration::        Example projects
7177 * Triggering publication::      Publication commands
7178 @end menu
7180 @node Configuration, Sample configuration, Publishing, Publishing
7181 @section Configuration
7183 Publishing needs significant configuration to specify files, destination
7184 and many other properties of a project.
7186 @menu
7187 * Project alist::               The central configuration variable
7188 * Sources and destinations::    From here to there
7189 * Selecting files::             What files are part of the project?
7190 * Publishing action::           Setting the function doing the publishing
7191 * Publishing options::          Tweaking HTML export
7192 * Publishing links::            Which links keep working after publishing?
7193 * Project page index::          Publishing a list of project files
7194 @end menu
7196 @node Project alist, Sources and destinations, Configuration, Configuration
7197 @subsection The variable @code{org-publish-project-alist}
7198 @cindex org-publish-project-alist
7199 @cindex projects, for publishing
7201 Org-publish is configured almost entirely through setting the value of
7202 one variable, called @code{org-publish-project-alist}.
7203 Each element of the list configures one project, and may be in one of
7204 the two following forms:
7206 @lisp
7207 ("project-name" :property value :property value ...)
7209 @r{or}
7211 ("project-name" :components ("project-name" "project-name" ...))
7213 @end lisp
7215 In both cases, projects are configured by specifying property values.
7216 A project defines the set of files that will be published, as well as
7217 the publishing configuration to use when publishing those files.  When
7218 a project takes the second form listed above, the individual members
7219 of the ``components'' property are taken to be components of the
7220 project, which group together files requiring different publishing
7221 options. When you publish such a ``meta-project'' all the components
7222 will also publish.
7224 @node Sources and destinations, Selecting files, Project alist, Configuration
7225 @subsection Sources and destinations for files
7226 @cindex directories, for publishing
7228 Most properties are optional, but some should always be set. In
7229 particular, org-publish needs to know where to look for source files,
7230 and where to put published files.
7232 @multitable @columnfractions 0.3 0.7
7233 @item @code{:base-directory}
7234 @tab Directory containing publishing source files
7235 @item @code{:publishing-directory}
7236 @tab Directory (possibly remote) where output files will be published.
7237 @item @code{:preparation-function}
7238 @tab Function called before starting publishing process, for example to
7239 run @code{make} for updating files to be published.
7240 @end multitable
7241 @noindent
7243 @node Selecting files, Publishing action, Sources and destinations, Configuration
7244 @subsection Selecting files
7245 @cindex files, selecting for publishing
7247 By default, all files with extension @file{.org} in the base directory
7248 are considered part of the project.  This can be modified by setting the
7249 properties
7250 @multitable @columnfractions 0.25 0.75
7251 @item @code{:base-extension}
7252 @tab Extension (without the dot!) of source files.  This actually is a
7253 regular expression.
7255 @item @code{:exclude}
7256 @tab Regular expression to match file names that should not be
7257 published, even though they have been selected on the basis of their
7258 extension.
7260 @item @code{:include}
7261 @tab List of files to be included regardless of @code{:base-extension}
7262 and @code{:exclude}.
7263 @end multitable
7265 @node Publishing action, Publishing options, Selecting files, Configuration
7266 @subsection Publishing action
7267 @cindex action, for publishing
7269 Publishing means that a file is copied to the destination directory and
7270 possibly transformed in the process.  The default transformation is to
7271 export Org files as HTML files, and this is done by the function
7272 @code{org-publish-org-to-html} which calls the HTML exporter
7273 (@pxref{HTML export}). But you also can publish your files in La@TeX{} by
7274 using the function @code{org-publish-org-to-latex} instead. Other files
7275 like images only need to be copied to the publishing destination. For
7276 non-Org files, you need to specify the publishing function.
7279 @multitable @columnfractions 0.3 0.7
7280 @item @code{:publishing-function}
7281 @tab Function executing the publication of a file.  This may also be a
7282 list of functions, which will all be called in turn.
7283 @end multitable
7285 The function must accept two arguments: a property list containing at
7286 least a @code{:publishing-directory} property, and the name of the file
7287 to be published.  It should take the specified file, make the necessary
7288 transformation (if any) and place the result into the destination folder.
7289 You can write your own publishing function, but @code{org-publish}
7290 provides one for attachments (files that only need to be copied):
7291 @code{org-publish-attachment}.
7293 @node Publishing options, Publishing links, Publishing action, Configuration
7294 @subsection Options for the HTML/LaTeX exporters
7295 @cindex options, for publishing
7297 The property list can be used to set many export options for the HTML
7298 and La@TeX{} exporters.  In most cases, these properties correspond to user
7299 variables in Org.  The table below lists these properties along
7300 with the variable they belong to.  See the documentation string for the
7301 respective variable for details.
7303 @multitable @columnfractions 0.3 0.7
7304 @item @code{:language}              @tab @code{org-export-default-language}
7305 @item @code{:headline-levels}       @tab @code{org-export-headline-levels}
7306 @item @code{:section-numbers}       @tab @code{org-export-with-section-numbers}
7307 @item @code{:table-of-contents}     @tab @code{org-export-with-toc}
7308 @item @code{:archived-trees}        @tab @code{org-export-with-archived-trees}
7309 @item @code{:emphasize}             @tab @code{org-export-with-emphasize}
7310 @item @code{:sub-superscript}       @tab @code{org-export-with-sub-superscripts}
7311 @item @code{:special-strings}       @tab @code{org-export-with-special-strings}
7312 @item @code{:TeX-macros}            @tab @code{org-export-with-TeX-macros}
7313 @item @code{:LaTeX-fragments}       @tab @code{org-export-with-LaTeX-fragments}
7314 @item @code{:fixed-width}           @tab @code{org-export-with-fixed-width}
7315 @item @code{:timestamps}           .@tab @code{org-export-with-timestamps}
7316 @item @code{:tags}                 .@tab @code{org-export-with-tags}
7317 @item @code{:tables}                @tab @code{org-export-with-tables}
7318 @item @code{:table-auto-headline}   @tab @code{org-export-highlight-first-table-line}
7319 @item @code{:style}                 @tab @code{org-export-html-style}
7320 @item @code{:convert-org-links}     @tab @code{org-export-html-link-org-files-as-html}
7321 @item @code{:inline-images}         @tab @code{org-export-html-inline-images}
7322 @item @code{:expand-quoted-html}    @tab @code{org-export-html-expand}
7323 @item @code{:timestamp}             @tab @code{org-export-html-with-timestamp}
7324 @item @code{:publishing-directory}  @tab @code{org-export-publishing-directory}
7325 @item @code{:preamble}              @tab @code{org-export-html-preamble}
7326 @item @code{:postamble}             @tab @code{org-export-html-postamble}
7327 @item @code{:auto-preamble}         @tab @code{org-export-html-auto-preamble}
7328 @item @code{:auto-postamble}        @tab @code{org-export-html-auto-postamble}
7329 @item @code{:author}                @tab @code{user-full-name}
7330 @item @code{:email}                 @tab @code{user-mail-address}
7331 @end multitable
7333 If you use several email addresses, separate them by a semi-column.
7335 Most of the @code{org-export-with-*} variables have the same effect in
7336 both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
7337 @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
7338 La@TeX{} export.
7340 When a property is given a value in @code{org-publish-project-alist},
7341 its setting overrides the value of the corresponding user variable (if
7342 any) during publishing.  Options set within a file (@pxref{Export
7343 options}), however, override everything.
7345 @node Publishing links, Project page index, Publishing options, Configuration
7346 @subsection Links between published files
7347 @cindex links, publishing
7349 To create a link from one Org file to another, you would use
7350 something like @samp{[[file:foo.org][The foo]]} or simply
7351 @samp{file:foo.org.} (@pxref{Hyperlinks}).  Upon publishing this link
7352 becomes a link to @file{foo.html}.  In this way, you can interlink the
7353 pages of your "org web" project and the links will work as expected when
7354 you publish them to HTML.
7356 You may also link to related files, such as images. Provided you are
7357 careful with relative pathnames, and provided you have also configured
7358 @code{org-publish} to upload the related files, these links will work
7359 too. @ref{Complex example} for an example of this usage.
7361 Sometime an Org file to be published may contain links that are
7362 only valid in your production environment, but not in the publishing
7363 location.  In this case, use the property
7365 @multitable @columnfractions 0.4 0.6
7366 @item @code{:link-validation-function}
7367 @tab Function to validate links
7368 @end multitable
7370 @noindent
7371 to define a function for checking link validity.  This function must
7372 accept two arguments, the file name and a directory relative to which
7373 the file name is interpreted in the production environment.  If this
7374 function returns @code{nil}, then the HTML generator will only insert a
7375 description into the HTML file, but no link.  One option for this
7376 function is @code{org-publish-validate-link} which checks if the given
7377 file is part of any project in @code{org-publish-project-alist}.
7379 @node Project page index,  , Publishing links, Configuration
7380 @subsection Project page index
7381 @cindex index, of published pages
7383 The following properties may be used to control publishing of an
7384 index of files or summary page for a given project.
7386 @multitable @columnfractions 0.25 0.75
7387 @item @code{:auto-index}
7388 @tab When non-nil, publish an index during org-publish-current-project or
7389 org-publish-all.
7391 @item @code{:index-filename}
7392 @tab Filename for output of index. Defaults to @file{index.org} (which
7393 becomes @file{index.html}).
7395 @item @code{:index-title}
7396 @tab Title of index page. Defaults to name of file.
7398 @item @code{:index-function}
7399 @tab Plug-in function to use for generation of index.
7400 Defaults to @code{org-publish-org-index}, which generates a plain list
7401 of links to all files in the project.
7402 @end multitable
7404 @node Sample configuration, Triggering publication, Configuration, Publishing
7405 @section Sample configuration
7407 Below we provide two example configurations.  The first one is a simple
7408 project publishing only a set of Org files.  The second example is
7409 more complex, with a multi-component project.
7411 @menu
7412 * Simple example::              One-component publishing
7413 * Complex example::             A multi-component publishing example
7414 @end menu
7416 @node Simple example, Complex example, Sample configuration, Sample configuration
7417 @subsection Example: simple publishing configuration
7419 This example publishes a set of Org files to the @file{public_html}
7420 directory on the local machine.
7422 @lisp
7423 (setq org-publish-project-alist
7424       '(("org"
7425          :base-directory "~/org/"
7426          :publishing-directory "~/public_html"
7427          :section-numbers nil
7428          :table-of-contents nil
7429          :style "<link rel=stylesheet
7430                 href=\"../other/mystyle.css\"
7431                 type=\"text/css\">")))
7432 @end lisp
7434 @node Complex example,  , Simple example, Sample configuration
7435 @subsection Example: complex publishing configuration
7437 This more complicated example publishes an entire website, including
7438 org files converted to HTML, image files, emacs lisp source code, and
7439 style sheets. The publishing-directory is remote and private files are
7440 excluded.
7442 To ensure that links are preserved, care should be taken to replicate
7443 your directory structure on the web server, and to use relative file
7444 paths. For example, if your org files are kept in @file{~/org} and your
7445 publishable images in @file{~/images}, you'd link to an image with
7447 @example
7448 file:../images/myimage.png
7449 @end example
7451 On the web server, the relative path to the image should be the
7452 same. You can accomplish this by setting up an "images" folder in the
7453 right place on the web server, and publishing images to it.
7455 @lisp
7456 (setq org-publish-project-alist
7457       '(("orgfiles"
7458           :base-directory "~/org/"
7459           :base-extension "org"
7460           :publishing-directory "/ssh:user@@host:~/html/notebook/"
7461           :publishing-function org-publish-org-to-html
7462           :exclude "PrivatePage.org"   ;; regexp
7463           :headline-levels 3
7464           :section-numbers nil
7465           :table-of-contents nil
7466           :style "<link rel=stylesheet
7467                   href=\"../other/mystyle.css\" type=\"text/css\">"
7468           :auto-preamble t
7469           :auto-postamble nil)
7471          ("images"
7472           :base-directory "~/images/"
7473           :base-extension "jpg\\|gif\\|png"
7474           :publishing-directory "/ssh:user@@host:~/html/images/"
7475           :publishing-function org-publish-attachment)
7477          ("other"
7478           :base-directory "~/other/"
7479           :base-extension "css\\|el"
7480           :publishing-directory "/ssh:user@@host:~/html/other/"
7481           :publishing-function org-publish-attachment)
7482          ("website" :components ("orgfiles" "images" "other"))))
7483 @end lisp
7485 @node Triggering publication,  , Sample configuration, Publishing
7486 @section Triggering publication
7488 Once org-publish is properly configured, you can publish with the
7489 following functions:
7491 @table @kbd
7492 @item C-c C-e C
7493 Prompt for a specific project and publish all files that belong to it.
7494 @item C-c C-e P
7495 Publish the project containing the current file.
7496 @item C-c C-e F
7497 Publish only the current file.
7498 @item C-c C-e A
7499 Publish all projects.
7500 @end table
7502 Org uses timestamps to track when a file has changed. The above
7503 functions normally only publish changed files. You can override this and
7504 force publishing of all files by giving a prefix argument.
7506 @node Miscellaneous, Extensions and Hacking, Publishing, Top
7507 @chapter Miscellaneous
7509 @menu
7510 * Completion::                  M-TAB knows what you need
7511 * Customization::               Adapting Org to your taste
7512 * In-buffer settings::          Overview of the #+KEYWORDS
7513 * The very busy C-c C-c key::   When in doubt, press C-c C-c
7514 * Clean view::                  Getting rid of leading stars in the outline
7515 * TTY keys::                    Using Org on a tty
7516 * Interaction::                 Other Emacs packages
7517 * Bugs::                        Things which do not work perfectly
7518 @end menu
7520 @node Completion, Customization, Miscellaneous, Miscellaneous
7521 @section Completion
7522 @cindex completion, of @TeX{} symbols
7523 @cindex completion, of TODO keywords
7524 @cindex completion, of dictionary words
7525 @cindex completion, of option keywords
7526 @cindex completion, of tags
7527 @cindex completion, of property keys
7528 @cindex completion, of link abbreviations
7529 @cindex @TeX{} symbol completion
7530 @cindex TODO keywords completion
7531 @cindex dictionary word completion
7532 @cindex option keyword completion
7533 @cindex tag completion
7534 @cindex link abbreviations, completion of
7536 Org supports in-buffer completion.  This type of completion does
7537 not make use of the minibuffer.  You simply type a few letters into
7538 the buffer and use the key to complete text right there.
7540 @table @kbd
7541 @kindex M-@key{TAB}
7542 @item M-@key{TAB}
7543 Complete word at point
7544 @itemize @bullet
7545 @item
7546 At the beginning of a headline, complete TODO keywords.
7547 @item
7548 After @samp{\}, complete @TeX{} symbols supported by the exporter.
7549 @item
7550 After @samp{*}, complete headlines in the current buffer so that they
7551 can be used in search links like @samp{[[*find this headline]]}.
7552 @item
7553 After @samp{:} in a headline, complete tags.  The list of tags is taken
7554 from the variable @code{org-tag-alist} (possibly set through the
7555 @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
7556 dynamically from all tags used in the current buffer.
7557 @item
7558 After @samp{:} and not in a headline, complete property keys.  The list
7559 of keys is constructed dynamically from all keys used in the current
7560 buffer.
7561 @item
7562 After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
7563 @item
7564 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
7565 @samp{OPTIONS} which set file-specific options for Org mode.  When the
7566 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
7567 will insert example settings for this keyword.
7568 @item
7569 In the line after @samp{#+STARTUP: }, complete startup keywords,
7570 i.e. valid keys for this line.
7571 @item
7572 Elsewhere, complete dictionary words using Ispell.
7573 @end itemize
7574 @end table
7576 @node Customization, In-buffer settings, Completion, Miscellaneous
7577 @section Customization
7578 @cindex customization
7579 @cindex options, for customization
7580 @cindex variables, for customization
7582 There are more than 180 variables that can be used to customize
7583 Org.  For the sake of compactness of the manual, I am not
7584 describing the variables here.  A structured overview of customization
7585 variables is available with @kbd{M-x org-customize}.  Or select
7586 @code{Browse Org Group} from the @code{Org->Customization} menu.  Many
7587 settings can also be activated on a per-file basis, by putting special
7588 lines into the buffer (@pxref{In-buffer settings}).
7590 @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
7591 @section Summary of in-buffer settings
7592 @cindex in-buffer settings
7593 @cindex special keywords
7595 Org mode uses special lines in the buffer to define settings on a
7596 per-file basis.  These lines start with a @samp{#+} followed by a
7597 keyword, a colon, and then individual words defining a setting.  Several
7598 setting words can be in the same line, but you can also have multiple
7599 lines for the keyword.  While these settings are described throughout
7600 the manual, here is a summary.  After changing any of those lines in the
7601 buffer, press @kbd{C-c C-c} with the cursor still in the line to
7602 activate the changes immediately.  Otherwise they become effective only
7603 when the file is visited again in a new Emacs session.
7605 @table @kbd
7606 @item #+ARCHIVE: %s_done::
7607 This line sets the archive location for the agenda file.  It applies for
7608 all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
7609 of the file.  The first such line also applies to any entries before it.
7610 The corresponding variable is @code{org-archive-location}.
7611 @item #+CATEGORY:
7612 This line sets the category for the agenda file.  The category applies
7613 for all subsequent lines until the next @samp{#+CATEGORY} line, or the
7614 end of the file.  The first such line also applies to any entries before it.
7615 @item #+COLUMNS: %25ITEM .....
7616 Set the default format for columns view.  This format applies when
7617 columns view is invoked in location where no @code{COLUMNS} property
7618 applies.
7619 @item #+CONSTANTS: name1=value1 ...
7620 Set file-local values for constants to be used in table formulas.  This
7621 line set the local variable @code{org-table-formula-constants-local}.
7622 The global version of this variable is
7623 @code{org-table-formula-constants}.
7624 @item #+DRAWERS: NAME1 .....
7625 Set the file-local set of drawers.  The corresponding global variable is
7626 @code{org-drawers}.
7627 @item #+LINK:  linkword replace
7628 These lines (several are allowed) specify link abbreviations.
7629 @xref{Link abbreviations}.  The corresponding variable is
7630 @code{org-link-abbrev-alist}.
7631 @item #+PRIORITIES: highest lowest default
7632 This line sets the limits and the default for the priorities.  All three
7633 must be either letters A-Z or numbers 0-9.  The highest priority must
7634 have a lower ASCII number that the lowest priority.
7635 @item #+PROPERTY: Property_Name Value
7636 This line sets a default inheritance value for entries in the current
7637 buffer, most useful for specifying the allowed values of a property.
7638 @item #+STARTUP:
7639 This line sets options to be used at startup of Org mode, when an
7640 Org file is being visited.  The first set of options deals with the
7641 initial visibility of the outline tree.  The corresponding variable for
7642 global default settings is @code{org-startup-folded}, with a default
7643 value @code{t}, which means @code{overview}.
7644 @cindex @code{overview}, STARTUP keyword
7645 @cindex @code{content}, STARTUP keyword
7646 @cindex @code{showall}, STARTUP keyword
7647 @example
7648 overview   @r{top-level headlines only}
7649 content    @r{all headlines}
7650 showall    @r{no folding at all, show everything}
7651 @end example
7652 Then there are options for aligning tables upon visiting a file.  This
7653 is useful in files containing narrowed table columns.  The corresponding
7654 variable is @code{org-startup-align-all-tables}, with a default value
7655 @code{nil}.
7656 @cindex @code{align}, STARTUP keyword
7657 @cindex @code{noalign}, STARTUP keyword
7658 @example
7659 align      @r{align all tables}
7660 noalign    @r{don't align tables on startup}
7661 @end example
7662 Logging closing and reinstating TODO items, and clock intervals
7663 (variables @code{org-log-done}, @code{org-log-note-clock-out}, and
7664 @code{org-log-repeat}) can be configured using these options.
7665 @cindex @code{logdone}, STARTUP keyword
7666 @cindex @code{lognotedone}, STARTUP keyword
7667 @cindex @code{nologdone}, STARTUP keyword
7668 @cindex @code{lognoteclock-out}, STARTUP keyword
7669 @cindex @code{nolognoteclock-out}, STARTUP keyword
7670 @cindex @code{logrepeat}, STARTUP keyword
7671 @cindex @code{lognoterepeat}, STARTUP keyword
7672 @cindex @code{nologrepeat}, STARTUP keyword
7673 @example
7674 logdone            @r{record a timestamp when an item is marked DONE}
7675 lognotedone        @r{record timestamp and a note when DONE}
7676 nologdone          @r{don't record when items are marked DONE}
7677 logrepeat          @r{record a time when reinstating a repeating item}
7678 lognoterepeat      @r{record a note when reinstating a repeating item}
7679 nologrepeat        @r{do not record when reinstating repeating item}
7680 lognoteclock-out   @r{record a note when clocking out}
7681 nolognoteclock-out @r{don't record a note when clocking out}
7682 @end example
7683 Here are the options for hiding leading stars in outline headings.  The
7684 corresponding variables are @code{org-hide-leading-stars} and
7685 @code{org-odd-levels-only}, both with a default setting @code{nil}
7686 (meaning @code{showstars} and @code{oddeven}).
7687 @cindex @code{hidestars}, STARTUP keyword
7688 @cindex @code{showstars}, STARTUP keyword
7689 @cindex @code{odd}, STARTUP keyword
7690 @cindex @code{even}, STARTUP keyword
7691 @example
7692 hidestars  @r{make all but one of the stars starting a headline invisible.}
7693 showstars  @r{show all stars starting a headline}
7694 odd        @r{allow only odd outline levels (1,3,...)}
7695 oddeven    @r{allow all outline levels}
7696 @end example
7697 To turn on custom format overlays over time stamps (variables
7698 @code{org-put-time-stamp-overlays} and
7699 @code{org-time-stamp-overlay-formats}), use
7700 @cindex @code{customtime}, STARTUP keyword
7701 @example
7702 customtime @r{overlay custom time format}
7703 @end example
7704 The following options influence the table spreadsheet (variable
7705 @code{constants-unit-system}).
7706 @cindex @code{constcgs}, STARTUP keyword
7707 @cindex @code{constSI}, STARTUP keyword
7708 @example
7709 constcgs   @r{@file{constants.el} should use the c-g-s unit system}
7710 constSI    @r{@file{constants.el} should use the SI unit system}
7711 @end example
7712 @item #+TAGS:  TAG1(c1) TAG2(c2)
7713 These lines (several such lines are allowed) specify the valid tags in
7714 this file, and (potentially) the corresponding @emph{fast tag selection}
7715 keys.  The corresponding variable is @code{org-tag-alist}.
7716 @item #+TBLFM:
7717 This line contains the formulas for the table directly above the line.
7718 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:
7719 These lines provide settings for exporting files.  For more details see
7720 @ref{Export options}.
7721 @item #+SEQ_TODO:   #+TYP_TODO:
7722 These lines set the TODO keywords and their interpretation in the
7723 current file.  The corresponding variables are @code{org-todo-keywords}
7724 and @code{org-todo-interpretation}.
7725 @end table
7727 @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
7728 @section The very busy C-c C-c key
7729 @kindex C-c C-c
7730 @cindex C-c C-c, overview
7732 The key @kbd{C-c C-c} has many purposes in Org, which are all
7733 mentioned scattered throughout this manual.  One specific function of
7734 this key is to add @emph{tags} to a headline (@pxref{Tags}).  In many
7735 other circumstances it means something like @emph{Hey Org, look
7736 here and update according to what you see here}.  Here is a summary of
7737 what this means in different contexts.
7739 @itemize @minus
7740 @item
7741 If there are highlights in the buffer from the creation of a sparse
7742 tree, or from clock display, remove these highlights.
7743 @item
7744 If the cursor is in one of the special @code{#+KEYWORD} lines, this
7745 triggers scanning the buffer for these lines and updating the
7746 information.
7747 @item
7748 If the cursor is inside a table, realign the table.  This command
7749 works even if the automatic table editor has been turned off.
7750 @item
7751 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
7752 the entire table.
7753 @item
7754 If the cursor is inside a table created by the @file{table.el} package,
7755 activate that table.
7756 @item
7757 If the current buffer is a remember buffer, close the note and file it.
7758 With a prefix argument, file it, without further interaction, to the
7759 default location.
7760 @item
7761 If the cursor is on a @code{<<<target>>>}, update radio targets and
7762 corresponding links in this buffer.
7763 @item
7764 If the cursor is in a property line or at the start or end of a property
7765 drawer, offer property commands.
7766 @item
7767 If the cursor is in a plain list item with a checkbox, toggle the status
7768 of the checkbox.
7769 @item
7770 If the cursor is on a numbered item in a plain list, renumber the
7771 ordered list.
7772 @item
7773 If the cursor is on the @code{#+BEGIN} line of a dynamical block, the
7774 block is updated.
7775 @end itemize
7777 @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
7778 @section A cleaner outline view
7779 @cindex hiding leading stars
7780 @cindex clean outline view
7782 Some people find it noisy and distracting that the Org headlines
7783 are starting with a potentially large number of stars.  For example
7784 the tree from @ref{Headlines}:
7786 @example
7787 * Top level headline
7788 ** Second level
7789 *** 3rd level
7790     some text
7791 *** 3rd level
7792     more text
7793 * Another top level headline
7794 @end example
7796 @noindent
7797 Unfortunately this is deeply ingrained into the code of Org and
7798 cannot be easily changed.  You can, however, modify the display in such
7799 a way that all leading stars become invisible and the outline more easy
7800 to read.  To do this, customize the variable
7801 @code{org-hide-leading-stars} like this:
7803 @lisp
7804 (setq org-hide-leading-stars t)
7805 @end lisp
7807 @noindent
7808 or change this on a per-file basis with one of the lines (anywhere in
7809 the buffer)
7811 @example
7812 #+STARTUP: showstars
7813 #+STARTUP: hidestars
7814 @end example
7816 @noindent
7817 Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
7818 the modifications.
7820 With stars hidden, the tree becomes:
7822 @example
7823 * Top level headline
7824  * Second level
7825   * 3rd level
7826     some text
7827   * 3rd level
7828     more text
7829 * Another top level headline
7830 @end example
7832 @noindent
7833 Note that the leading stars are not truly replaced by whitespace, they
7834 are only fontified with the face @code{org-hide} that uses the
7835 background color as font color.  If you are not using either white or
7836 black background, you may have to customize this face to get the wanted
7837 effect.  Another possibility is to set this font such that the extra
7838 stars are @i{almost} invisible, for example using the color
7839 @code{grey90} on a white background.
7841 Things become cleaner still if you skip all the even levels and use only
7842 odd levels 1, 3, 5..., effectively adding two stars to go from one
7843 outline level to the next:
7845 @example
7846 * Top level headline
7847   * Second level
7848     * 3rd level
7849       some text
7850     * 3rd level
7851       more text
7852 * Another top level headline
7853 @end example
7855 @noindent
7856 In order to make the structure editing and export commands handle this
7857 convention correctly, use
7859 @lisp
7860 (setq org-odd-levels-only t)
7861 @end lisp
7863 @noindent
7864 or set this on a per-file basis with one of the following lines (don't
7865 forget to press @kbd{C-c C-c} with the cursor in the startup line to
7866 activate changes immediately).
7868 @example
7869 #+STARTUP: odd
7870 #+STARTUP: oddeven
7871 @end example
7873 You can convert an Org file from single-star-per-level to the
7874 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
7875 RET} in that file.  The reverse operation is @kbd{M-x
7876 org-convert-to-oddeven-levels}.
7878 @node TTY keys, Interaction, Clean view, Miscellaneous
7879 @section Using Org on a tty
7880 @cindex tty key bindings
7882 Because Org contains a large number of commands, by default much of
7883 Org's core commands are bound to keys that are generally not
7884 accessible on a tty, such as the cursor keys (@key{left}, @key{right},
7885 @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
7886 together with modifiers like @key{Meta} and/or @key{Shift}.  To access
7887 these commands on a tty when special keys are unavailable, the following
7888 alternative bindings can be used.  The tty bindings below will likely be
7889 more cumbersome; you may find for some of the bindings below that a
7890 customized work-around suits you better.  For example, changing a time
7891 stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
7892 tty you would rather use @kbd{C-c .} to re-insert the timestamp.
7894 @multitable @columnfractions 0.15 0.2 0.2
7895 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
7896 @item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
7897 @item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
7898 @item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
7899 @item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
7900 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
7901 @item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
7902 @item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
7903 @item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
7904 @item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
7905 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
7906 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
7907 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
7908 @item @kbd{S-@key{left}}    @tab @kbd{C-c @key{left}}      @tab
7909 @item @kbd{S-@key{right}}   @tab @kbd{C-c @key{right}}     @tab
7910 @item @kbd{S-@key{up}}      @tab @kbd{C-c @key{up}}        @tab
7911 @item @kbd{S-@key{down}}    @tab @kbd{C-c @key{down}}      @tab
7912 @item @kbd{C-S-@key{left}}  @tab @kbd{C-c C-x @key{left}}  @tab
7913 @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
7914 @end multitable
7916 @node Interaction, Bugs, TTY keys, Miscellaneous
7917 @section Interaction with other packages
7918 @cindex packages, interaction with other
7919 Org lives in the world of GNU Emacs and interacts in various ways
7920 with other code out there.
7922 @menu
7923 * Cooperation::                 Packages Org cooperates with
7924 * Conflicts::                   Packages that lead to conflicts
7925 @end menu
7927 @node Cooperation, Conflicts, Interaction, Interaction
7928 @subsection Packages that Org cooperates with
7930 @table @asis
7931 @cindex @file{calc.el}
7932 @item @file{calc.el} by Dave Gillespie
7933 Org uses the Calc package for implementing spreadsheet
7934 functionality in its tables (@pxref{The spreadsheet}).  Org
7935 checks for the availability of Calc by looking for the function
7936 @code{calc-eval} which should be autoloaded in your setup if Calc has
7937 been installed properly.  As of Emacs 22, Calc is part of the Emacs
7938 distribution.  Another possibility for interaction between the two
7939 packages is using Calc for embedded calculations. @xref{Embedded Mode,
7940 , Embedded Mode, Calc, GNU Emacs Calc Manual}.
7941 @cindex @file{constants.el}
7942 @item @file{constants.el} by Carsten Dominik
7943 In a table formula (@pxref{The spreadsheet}), it is possible to use
7944 names for natural constants or units.  Instead of defining your own
7945 constants in the variable @code{org-table-formula-constants}, install
7946 the @file{constants} package which defines a large number of constants
7947 and units, and lets you use unit prefixes like @samp{M} for
7948 @samp{Mega} etc.  You will need version 2.0 of this package, available
7949 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
7950 the function @code{constants-get}, which has to be autoloaded in your
7951 setup.  See the installation instructions in the file
7952 @file{constants.el}.
7953 @item @file{cdlatex.el} by Carsten Dominik
7954 @cindex @file{cdlatex.el}
7955 Org mode can make use of the CDLaTeX package to efficiently enter
7956 La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
7957 @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
7958 @cindex @file{imenu.el}
7959 Imenu allows menu access to an index of items in a file.  Org mode
7960 supports Imenu - all you need to do to get the index is the following:
7961 @lisp
7962 (add-hook 'org-mode-hook
7963           (lambda () (imenu-add-to-menubar "Imenu")))
7964 @end lisp
7965 By default the index is two levels deep - you can modify the depth using
7966 the option @code{org-imenu-depth}.
7967 @item @file{remember.el} by John Wiegley
7968 @cindex @file{remember.el}
7969 Org cooperates with remember, see @ref{Remember}.
7970 @file{Remember.el} is not part of Emacs, find it on the web.
7971 @item @file{speedbar.el} by Eric M. Ludlam
7972 @cindex @file{speedbar.el}
7973 Speedbar is a package that creates a special frame displaying files and
7974 index items in files.  Org mode supports Speedbar and allows you to
7975 drill into Org files directly from the Speedbar.  It also allows to
7976 restrict the scope of agenda commands to a file or a subtree by using
7977 the command @kbd{<} in the Speedbar frame.
7978 @cindex @file{table.el}
7979 @item @file{table.el} by Takaaki Ota
7980 @kindex C-c C-c
7981 @cindex table editor, @file{table.el}
7982 @cindex @file{table.el}
7984 Complex ASCII tables with automatic line wrapping, column- and
7985 row-spanning, and alignment can be created using the Emacs table
7986 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
7987 and also part of Emacs 22).
7988 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
7989 will call @command{table-recognize-table} and move the cursor into the
7990 table.  Inside a table, the keymap of Org mode is inactive.  In order
7991 to execute Org mode-related commands, leave the table.
7993 @table @kbd
7994 @kindex C-c C-c
7995 @item C-c C-c
7996 Recognize @file{table.el} table.  Works when the cursor is in a
7997 table.el table.
7999 @kindex C-c ~
8000 @item C-c ~
8001 Insert a table.el table.  If there is already a table at point, this
8002 command converts it between the table.el format and the Org mode
8003 format.  See the documentation string of the command
8004 @code{org-convert-table} for the restrictions under which this is
8005 possible.
8006 @end table
8007 @file{table.el} is part of Emacs 22.
8008 @cindex @file{footnote.el}
8009 @item @file{footnote.el} by Steven L. Baur
8010 Org mode recognizes numerical footnotes as provided by this package
8011 (@pxref{Footnotes}).
8012 @end table
8014 @node Conflicts,  , Cooperation, Interaction
8015 @subsection Packages that lead to conflicts with Org mode
8017 @table @asis
8019 @cindex @file{allout.el}
8020 @item @file{allout.el} by Ken Manheimer
8021 Startup of Org may fail with the error message
8022 @code{(wrong-type-argument keymapp nil)} when there is an outdated
8023 version @file{allout.el} on the load path, for example the version
8024 distributed with Emacs 21.x.  Upgrade to Emacs 22 and this problem will
8025 disappear.  If for some reason you cannot do this, make sure that org.el
8026 is loaded @emph{before} @file{allout.el}, for example by putting
8027 @code{(require 'org)} early enough into your @file{.emacs} file.
8029 @cindex @file{CUA.el}
8030 @item @file{CUA.el} by Kim. F. Storm
8031 Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by
8032 CUA mode (as well as pc-select-mode and s-region-mode) to select and
8033 extend the region.  If you want to use one of these packages along with
8034 Org, configure the variable @code{org-replace-disputed-keys}.  When
8035 set, Org will move the following key bindings in Org files, and
8036 in the agenda buffer (but not during date selection).
8038 @example
8039 S-UP    -> M-p             S-DOWN  -> M-n
8040 S-LEFT  -> M--             S-RIGHT -> M-+
8041 @end example
8043 Yes, these are unfortunately more difficult to remember.  If you want
8044 to have other replacement keys, look at the variable
8045 @code{org-disputed-keys}.
8046 @item @file{windmove.el} by Hovav Shacham
8047 @cindex @file{windmove.el}
8048 Also this package uses the @kbd{S-<cursor>} keys, so everything written
8049 in the paragraph above about CUA mode also applies here.
8051 @cindex @file{footnote.el}
8052 @item @file{footnote.el} by Steven L. Baur
8053 Org supports the syntax of the footnote package, but only the
8054 numerical footnote markers.  Also, the default key for footnote
8055 commands, @kbd{C-c !} is already used by Org.  You could use the
8056 variable @code{footnote-prefix} to switch footnotes commands to another
8057 key.  Or, you could use @code{org-replace-disputed-keys} and
8058 @code{org-disputed-keys} to change the settings in Org.
8060 @end table
8063 @node Bugs,  , Interaction, Miscellaneous
8064 @section Bugs
8065 @cindex bugs
8067 Here is a list of things that should work differently, but which I
8068 have found too hard to fix.
8070 @itemize @bullet
8071 @item
8072 If a table field starts with a link, and if the corresponding table
8073 column is narrowed (@pxref{Narrow columns}) to a width too small to
8074 display the link, the field would look entirely empty even though it is
8075 not.  To prevent this, Org throws an error.  The work-around is to
8076 make the column wide enough to fit the link, or to add some text (at
8077 least 2 characters) before the link in the same field.
8078 @item
8079 Narrowing table columns does not work on XEmacs, because the
8080 @code{format} function does not transport text properties.
8081 @item
8082 Text in an entry protected with the @samp{QUOTE} keyword should not
8083 autowrap.
8084 @item
8085 When the application called by @kbd{C-c C-o} to open a file link fails
8086 (for example because the application does not exist or refuses to open
8087 the file), it does so silently.  No error message is displayed.
8088 @item
8089 Recalculating a table line applies the formulas from left to right.
8090 If a formula uses @emph{calculated} fields further down the row,
8091 multiple recalculation may be needed to get all fields consistent.  You
8092 may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
8093 recalculate until convergence.
8094 @item
8095 A single letter cannot be made bold, for example @samp{*a*}.
8096 @item
8097 The exporters work well, but could be made more efficient.
8098 @end itemize
8101 @node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
8102 @appendix Extensions, Hooks and Hacking
8104 This appendix lists extensions for Org written by other authors.
8105 It also covers some aspects where users can extend the functionality of
8106 Org.
8108 @menu
8109 * Extensions::                  Existing 3rd-party extensions
8110 * Adding hyperlink types::      New custom link types
8111 * Tables in arbitrary syntax::  Orgtbl for LaTeX and other programs
8112 * Dynamic blocks::              Automatically filled blocks
8113 * Special agenda views::        Customized views
8114 * Using the property API::      Writing programs that use entry properties
8115 @end menu
8117 @node Extensions, Adding hyperlink types, Extensions and Hacking, Extensions and Hacking
8118 @section Third-party extensions for Org
8119 @cindex extension, third-party
8121 The following extensions for Org have been written by other people:
8123 @table @asis
8124 @cindex @file{org-publish.el}
8125 @item @file{org-publish.el} by David O'Toole
8126 This package provides facilities for publishing related sets of Org
8127 files together with linked files like images as web pages.  It is
8128 highly configurable and can be used for other publishing purposes as
8129 well.  As of Org version 4.30, @file{org-publish.el} is part of the
8130 Org distribution.  It is not yet part of Emacs, however, a delay
8131 caused by the preparations for the 22.1 release.  In the mean time,
8132 @file{org-publish.el} can be downloaded from David's site:
8133 @url{http://dto.freeshell.org/e/org-publish.el}.
8134 @cindex @file{org-mouse.el}
8135 @item @file{org-mouse.el} by Piotr Zielinski
8136 This package implements extended mouse functionality for Org.  It
8137 allows you to cycle visibility and to edit the document structure with
8138 the mouse.  Best of all, it provides a context-sensitive menu on
8139 @key{mouse-3} that changes depending on the context of a mouse-click.
8140 As of Org version 4.53, @file{org-mouse.el} is part of the
8141 Org distribution.  It is not yet part of Emacs, however, a delay
8142 caused by the preparations for the 22.1 release.  In the mean time,
8143 @file{org-mouse.el} can be downloaded from Piotr's site:
8144 @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}.
8145 @cindex @file{org-blog.el}
8146 @item @file{org-blog.el} by David O'Toole
8147 A blogging plug-in for @file{org-publish.el}.@*
8148 @url{http://dto.freeshell.org/notebook/OrgMode.html}.
8149 @cindex @file{blorg.el}
8150 @item @file{blorg.el} by Bastien Guerry
8151 Publish Org files as
8152 blogs. @url{http://www.cognition.ens.fr/~guerry/blorg.html}.
8153 @cindex @file{org2rem.el}
8154 @item @file{org2rem.el} by Bastien Guerry
8155 Translates Org files into something readable by
8156 Remind. @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
8157 @item @file{org-toc.el} by Bastien Guerry
8158 Produces a simple table of contents of an Org file, for easy
8159 navigation. @url{http://www.cognition.ens.fr/~guerry/u/org-registry.el}.
8160 @item @file{org-registry.el} by Bastien Guerry
8161 Find which Org-file link to a certain document.
8162 @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
8163 @end table
8165 @page
8167 @node Adding hyperlink types, Tables in arbitrary syntax, Extensions, Extensions and Hacking
8168 @section Adding hyperlink types
8169 @cindex hyperlinks, adding new types
8171 Org has a large number of hyperlink types built-in
8172 (@pxref{Hyperlinks}).  If you would like to add new link types, it
8173 provides an interface for doing so.  Lets look at an example file
8174 @file{org-man.el} that will add support for creating links like
8175 @samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
8176 emacs:
8178 @lisp
8179 ;;; org-man.el - Support for links to manpages in Org
8181 (require 'org)
8183 (org-add-link-type "man" 'org-man-open)
8184 (add-hook 'org-store-link-functions 'org-man-store-link)
8186 (defcustom org-man-command 'man
8187   "The Emacs command to be used to display a man page."
8188   :group 'org-link
8189   :type '(choice (const man) (const woman)))
8191 (defun org-man-open (path)
8192   "Visit the manpage on PATH.
8193 PATH should be a topic that can be thrown at the man command."
8194   (funcall org-man-command path))
8196 (defun org-man-store-link ()
8197   "Store a link to a manpage."
8198   (when (memq major-mode '(Man-mode woman-mode))
8199     ;; This is a man page, we do make this link
8200     (let* ((page (org-man-get-page-name))
8201            (link (concat "man:" page))
8202            (description (format "Manpage for %s" page)))
8203       (org-store-link-props
8204        :type "man"
8205        :link link
8206        :description description))))
8208 (defun org-man-get-page-name ()
8209   "Extract the page name from the buffer name."
8210   ;; This works for both `Man-mode' and `woman-mode'.
8211   (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
8212       (match-string 1 (buffer-name))
8213     (error "Cannot create link to this man page")))
8215 (provide 'org-man)
8217 ;;; org-man.el ends here
8218 @end lisp
8220 @noindent
8221 You would activate this new link type in @file{.emacs} with
8223 @lisp
8224 (require 'org-man)
8225 @end lisp
8227 @noindent
8228 Lets go through the file and see what it does.
8229 @enumerate
8230 @item
8231 It does @code{(require 'org)} to make sure that @file{org.el} has been
8232 loaded.
8233 @item
8234 The next line calls @code{org-add-link-type} to define a new link type
8235 with prefix @samp{man}.  The call also contains the name of a function
8236 that will be called to follow such a link.
8237 @item
8238 The next line adds a function to @code{org-store-link-functions}, in
8239 order to allow the command @kbd{C-c l} to record a useful link in a
8240 buffer displaying a man page.
8241 @end enumerate
8243 The rest of the file defines the necessary variables and functions.
8244 First there is a customization variable that determines which emacs
8245 command should be used to display man pages.  There are two options,
8246 @code{man} and @code{woman}.  Then the function to follow a link is
8247 defined.  It gets the link path as an argument - in this case the link
8248 path is just a topic for the manual command.  The function calls the
8249 value of @code{org-man-command} to display the man page.
8251 Finally the function @code{org-man-store-link} is defined.  When you try
8252 to store a link with @kbd{C-c l}, also this function will be called to
8253 try to make a link.  The function must first decide if it is supposed to
8254 create the link for this buffer type, we do this by checking the value
8255 of the variable @code{major-mode}.  If not, the function must exit and
8256 return the value @code{nil}.  If yes, the link is created by getting the
8257 manual topic from the buffer name and prefixing it with the string
8258 @samp{man:}.  Then it must call the command @code{org-store-link-props}
8259 and set the @code{:type} and @code{:link} properties.  Optionally you
8260 can also set the @code{:description} property to provide a default for
8261 the link description when the link is later inserted into an Org
8262 buffer with @kbd{C-c C-l}.
8264 @node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Extensions and Hacking
8265 @section Tables and lists in arbitrary syntax
8266 @cindex tables, in other modes
8267 @cindex lists, in other modes
8268 @cindex Orgtbl mode
8270 Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
8271 frequent feature request has been to make it work with native tables in
8272 specific languages, for example La@TeX{}.  However, this is extremely
8273 hard to do in a general way, would lead to a customization nightmare,
8274 and would take away much of the simplicity of the Orgtbl mode table
8275 editor.
8278 This appendix describes a different approach.  We keep the Orgtbl mode
8279 table in its native format (the @i{source table}), and use a custom
8280 function to @i{translate} the table to the correct syntax, and to
8281 @i{install} it in the right location (the @i{target table}).  This puts
8282 the burden of writing conversion functions on the user, but it allows
8283 for a very flexible system.
8285 Bastien added the ability to do the same with lists.  You can use Org's
8286 facilities to edit and structure lists by turning @code{orgstruct-mode}
8287 on, then locally exporting such lists in another format (HTML, La@TeX{}
8288 or Texinfo.)
8291 @menu
8292 * Radio tables::                Sending and receiving
8293 * A LaTeX example::             Step by step, almost a tutorial
8294 * Translator functions::        Copy and modify
8295 * Radio lists::                 Doing the same for lists
8296 @end menu
8298 @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
8299 @subsection Radio tables
8300 @cindex radio tables
8302 To define the location of the target table, you first need to create two
8303 lines that are comments in the current mode, but contain magic words for
8304 Orgtbl mode to find.  Orgtbl mode will insert the translated table
8305 between these lines, replacing whatever was there before.  For example:
8307 @example
8308 /* BEGIN RECEIVE ORGTBL table_name */
8309 /* END RECEIVE ORGTBL table_name */
8310 @end example
8312 @noindent
8313 Just above the source table, we put a special line that tells
8314 Orgtbl mode how to translate this table and where to install it.  For
8315 example:
8316 @example
8317 #+ORGTBL: SEND table_name translation_function arguments....
8318 @end example
8320 @noindent
8321 @code{table_name} is the reference name for the table that is also used
8322 in the receiver lines. @code{translation_function} is the Lisp function
8323 that does the translation.  Furthermore, the line can contain a list of
8324 arguments (alternating key and value) at the end.  The arguments will be
8325 passed as a property list to the translation function for
8326 interpretation.  A few standard parameters are already recognized and
8327 acted upon before the translation function is called:
8329 @table @code
8330 @item :skip N
8331 Skip the first N lines of the table. Hlines do count!
8332 @item :skipcols (n1 n2 ...)
8333 List of columns that should be skipped.  If the table has a column with
8334 calculation marks, that column is automatically discarded as well.
8335 Please note that the translator function sees the table @emph{after} the
8336 removal of these columns, the function never knows that there have been
8337 additional columns.
8338 @end table
8340 @noindent
8341 The one problem remaining is how to keep the source table in the buffer
8342 without disturbing the normal workings of the file, for example during
8343 compilation of a C file or processing of a La@TeX{} file.  There are a
8344 number of different solutions:
8346 @itemize @bullet
8347 @item
8348 The table could be placed in a block comment if that is supported by the
8349 language.  For example, in C mode you could wrap the table between
8350 @samp{/*} and @samp{*/} lines.
8351 @item
8352 Sometimes it is possible to put the table after some kind of @i{END}
8353 statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
8354 in La@TeX{}.
8355 @item
8356 You can just comment the table line by line whenever you want to process
8357 the file, and uncomment it whenever you need to edit the table.  This
8358 only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
8359 make this comment-toggling very easy, in particular if you bind it to a
8360 key.
8361 @end itemize
8363 @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
8364 @subsection A LaTeX example of radio tables
8365 @cindex LaTeX, and Orgtbl mode
8367 The best way to wrap the source table in La@TeX{} is to use the
8368 @code{comment} environment provided by @file{comment.sty}.  It has to be
8369 activated by placing @code{\usepackage@{comment@}} into the document
8370 header.  Orgtbl mode can insert a radio table skeleton@footnote{By
8371 default this works only for La@TeX{}, HTML, and Texinfo.  Configure the
8372 variable @code{orgtbl-radio-tables} to install templates for other
8373 modes.}  with the command @kbd{M-x orgtbl-insert-radio-table}.  You will
8374 be prompted for a table name, lets say we use @samp{salesfigures}.  You
8375 will then get the following template:
8377 @example
8378 % BEGIN RECEIVE ORGTBL salesfigures
8379 % END RECEIVE ORGTBL salesfigures
8380 \begin@{comment@}
8381 #+ORGTBL: SEND salesfigures orgtbl-to-latex
8382 | | |
8383 \end@{comment@}
8384 @end example
8386 @noindent
8387 The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
8388 @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
8389 into the receiver location with name @code{salesfigures}.  You may now
8390 fill in the table, feel free to use the spreadsheet features@footnote{If
8391 the @samp{#+TBLFM} line contains an odd number of dollar characters,
8392 this may cause problems with font-lock in LaTeX mode.  As shown in the
8393 example you can fix this by adding an extra line inside the
8394 @code{comment} environment that is used to balance the dollar
8395 expressions.  If you are using AUCTeX with the font-latex library, a
8396 much better solution is to add the @code{comment} environment to the
8397 variable @code{LaTeX-verbatim-environments}.}:
8399 @example
8400 % BEGIN RECEIVE ORGTBL salesfigures
8401 % END RECEIVE ORGTBL salesfigures
8402 \begin@{comment@}
8403 #+ORGTBL: SEND salesfigures orgtbl-to-latex
8404 | Month | Days | Nr sold | per day |
8405 |-------+------+---------+---------|
8406 | Jan   |   23 |      55 |     2.4 |
8407 | Feb   |   21 |      16 |     0.8 |
8408 | March |   22 |     278 |    12.6 |
8409 #+TBLFM: $4=$3/$2;%.1f
8410 % $ (optional extra dollar to keep font-lock happy, see footnote)
8411 \end@{comment@}
8412 @end example
8414 @noindent
8415 When you are done, press @kbd{C-c C-c} in the table to get the converted
8416 table inserted between the two marker lines.
8418 Now lets assume you want to make the table header by hand, because you
8419 want to control how columns are aligned etc.  In this case we make sure
8420 that the table translator does skip the first 2 lines of the source
8421 table, and tell the command to work as a @i{splice}, i.e. to not produce
8422 header and footer commands of the target table:
8424 @example
8425 \begin@{tabular@}@{lrrr@}
8426 Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
8427 % BEGIN RECEIVE ORGTBL salesfigures
8428 % END RECEIVE ORGTBL salesfigures
8429 \end@{tabular@}
8431 \begin@{comment@}
8432 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
8433 | Month | Days | Nr sold | per day |
8434 |-------+------+---------+---------|
8435 | Jan   |   23 |      55 |     2.4 |
8436 | Feb   |   21 |      16 |     0.8 |
8437 | March |   22 |     278 |    12.6 |
8438 #+TBLFM: $4=$3/$2;%.1f
8439 \end@{comment@}
8440 @end example
8442 The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
8443 Orgtbl mode.  It uses a @code{tabular} environment to typeset the table
8444 and marks horizontal lines with @code{\hline}.  Furthermore, it
8445 interprets the following parameters:
8447 @table @code
8448 @item :splice nil/t
8449 When set to t, return only table body lines, don't wrap them into a
8450 tabular environment.  Default is nil.
8452 @item :fmt fmt
8453 A format to be used to wrap each field, should contain @code{%s} for the
8454 original field value.  For example, to wrap each field value in dollars,
8455 you could use @code{:fmt "$%s$"}.  This may also be a property list with
8456 column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
8458 @item :efmt efmt
8459 Use this format to print numbers with exponentials.  The format should
8460 have @code{%s} twice for inserting mantissa and exponent, for example
8461 @code{"%s\\times10^@{%s@}"}.  The default is @code{"%s\\,(%s)"}.  This
8462 may also be a property list with column numbers and formats, for example
8463 @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}.  After
8464 @code{efmt} has been applied to a value, @code{fmt} will also be
8465 applied.
8466 @end table
8468 @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
8469 @subsection Translator functions
8470 @cindex HTML, and Orgtbl mode
8471 @cindex translator function
8473 Orgtbl mode has several translator functions built-in:
8474 @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and
8475 @code{orgtbl-to-texinfo}.  Except for @code{orgtbl-to-html}@footnote{The
8476 HTML translator uses the same code that produces tables during HTML
8477 export.}, these all use a generic translator, @code{orgtbl-to-generic}.
8478 For example, @code{orgtbl-to-latex} itself is a very short function that
8479 computes the column definitions for the @code{tabular} environment,
8480 defines a few field and line separators and then hands over to the
8481 generic translator.  Here is the entire code:
8483 @lisp
8484 @group
8485 (defun orgtbl-to-latex (table params)
8486   "Convert the Orgtbl mode TABLE to LaTeX."
8487   (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
8488                                org-table-last-alignment ""))
8489          (params2
8490           (list
8491            :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
8492            :tend "\\end@{tabular@}"
8493            :lstart "" :lend " \\\\" :sep " & "
8494            :efmt "%s\\,(%s)" :hline "\\hline")))
8495     (orgtbl-to-generic table (org-combine-plists params2 params))))
8496 @end group
8497 @end lisp
8499 As you can see, the properties passed into the function (variable
8500 @var{PARAMS}) are combined with the ones newly defined in the function
8501 (variable @var{PARAMS2}).  The ones passed into the function (i.e. the
8502 ones set by the @samp{ORGTBL SEND} line) take precedence.  So if you
8503 would like to use the La@TeX{} translator, but wanted the line endings to
8504 be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
8505 overrule the default with
8507 @example
8508 #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
8509 @end example
8511 For a new language, you can either write your own converter function in
8512 analogy with the La@TeX{} translator, or you can use the generic function
8513 directly.  For example, if you have a language where a table is started
8514 with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
8515 started with @samp{!BL!}, ended with @samp{!EL!} and where the field
8516 separator is a TAB, you could call the generic translator like this (on
8517 a single line!):
8519 @example
8520 #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
8521                               :lstart "!BL! " :lend " !EL!" :sep "\t"
8522 @end example
8524 @noindent
8525 Please check the documentation string of the function
8526 @code{orgtbl-to-generic} for a full list of parameters understood by
8527 that function and remember that you can pass each of them into
8528 @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
8529 using the generic function.
8531 Of course you can also write a completely new function doing complicated
8532 things the generic translator cannot do.  A translator function takes
8533 two arguments.  The first argument is the table, a list of lines, each
8534 line either the symbol @code{hline} or a list of fields.  The second
8535 argument is the property list containing all parameters specified in the
8536 @samp{#+ORGTBL: SEND} line.  The function must return a single string
8537 containing the formatted table.  If you write a generally useful
8538 translator, please post it on @code{emacs-orgmode@@gnu.org} so that
8539 others can benefit from your work.
8541 @node  Radio lists,  , Translator functions, Tables in arbitrary syntax
8542 @subsection Radio lists
8543 @cindex radio lists
8544 @cindex org-list-insert-radio-list
8546 Sending and receiving radio lists works exactly the same way than
8547 sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
8548 need to load the @code{org-export-latex.el} package to use radio lists
8549 since the relevant code is there for now.}.  As for radio tables, you
8550 can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
8551 calling @code{org-list-insert-radio-list}.
8553 Here are the differences with radio tables:
8555 @itemize @minus
8556 @item
8557 Use @code{ORGLST} instead of @code{ORGTBL}.
8558 @item
8559 The available translation functions for radio lists don't take
8560 parameters.
8561 @item
8562 `C-c C-c' will work when pressed on the first item of the list.
8563 @end itemize
8565 Here is a La@TeX{} example.  Let's say that you have this in your
8566 La@TeX{} file:
8568 @example
8569 % BEGIN RECEIVE ORGLST to-buy
8570 % END RECEIVE ORGLST to-buy
8571 \begin@{comment@}
8572 #+ORGLIST: SEND to-buy orgtbl-to-latex
8573 - a new house
8574 - a new computer
8575   + a new keyboard
8576   + a new mouse
8577 - a new life
8578 \end@{comment@}
8579 @end example
8581 Pressing `C-c C-c' on @code{a new house} and will insert the converted
8582 La@TeX{} list between the two marker lines.
8584 @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Extensions and Hacking
8585 @section Dynamic blocks
8586 @cindex dynamic blocks
8588 Org documents can contain @emph{dynamic blocks}.  These are
8589 specially marked regions that are updated by some user-written function.
8590 A good example for such a block is the clock table inserted by the
8591 command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
8593 Dynamic block are enclosed by a BEGIN-END structure that assigns a name
8594 to the block and can also specify parameters for the function producing
8595 the content of the block.
8597 @example
8598 #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
8600 #+END:
8601 @end example
8603 Dynamic blocks are updated with the following commands
8605 @table @kbd
8606 @kindex C-c C-x C-u
8607 @item C-c C-x C-u
8608 Update dynamic block at point.
8609 @kindex C-u C-c C-x C-u
8610 @item C-u C-c C-x C-u
8611 Update all dynamic blocks in the current file.
8612 @end table
8614 Updating a dynamic block means to remove all the text between BEGIN and
8615 END, parse the BEGIN line for parameters and then call the specific
8616 writer function for this block to insert the new content.  If you want
8617 to use the original content in the writer function, you can use the
8618 extra parameter @code{:content}.
8620 For a block with name @code{myblock}, the writer function is
8621 @code{org-dblock-write:myblock} with as only parameter a property list
8622 with the parameters given in the begin line.  Here is a trivial example
8623 of a block that keeps track of when the block update function was last
8624 run:
8626 @example
8627 #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
8629 #+END:
8630 @end example
8632 @noindent
8633 The corresponding block writer function could look like this:
8635 @lisp
8636 (defun org-dblock-write:block-update-time (params)
8637    (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
8638      (insert "Last block update at: "
8639              (format-time-string fmt (current-time)))))
8640 @end lisp
8642 If you want to make sure that all dynamic blocks are always up-to-date,
8643 you could add the function @code{org-update-all-dblocks} to a hook, for
8644 example @code{before-save-hook}.  @code{org-update-all-dblocks} is
8645 written in a way that is does nothing in buffers that are not in Org.
8647 @node Special agenda views, Using the property API, Dynamic blocks, Extensions and Hacking
8648 @section Special agenda views
8649 @cindex agenda views, user-defined
8651 Org provides a special hook that can be used to narrow down the
8652 selection made by any of the agenda views.  You may specify a function
8653 that is used at each match to verify if the match should indeed be part
8654 of the agenda view, and if not, how much should be skipped.
8656 Let's say you want to produce a list of projects that contain a WAITING
8657 tag anywhere in the project tree.  Let's further assume that you have
8658 marked all tree headings that define a project with the TODO keyword
8659 PROJECT.  In this case you would run a TODO search for the keyword
8660 PROJECT, but skip the match unless there is a WAITING tag anywhere in
8661 the subtree belonging to the project line.
8663 To achieve this, you must write a function that searches the subtree for
8664 the tag.  If the tag is found, the function must return @code{nil} to
8665 indicate that this match should not be skipped.  If there is no such
8666 tag, return the location of the end of the subtree, to indicate that
8667 search should continue from there.
8669 @lisp
8670 (defun my-skip-unless-waiting ()
8671   "Skip trees that are not waiting"
8672   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
8673     (if (re-search-forward ":waiting:" subtree-end t)
8674         nil          ; tag found, do not skip
8675       subtree-end))) ; tag not found, continue after end of subtree
8676 @end lisp
8678 Now you may use this function in an agenda custom command, for example
8679 like this:
8681 @lisp
8682 (org-add-agenda-custom-command
8683  '("b" todo "PROJECT"
8684    ((org-agenda-skip-function 'my-org-waiting-projects)
8685     (org-agenda-overriding-header "Projects waiting for something: "))))
8686 @end lisp
8688 Note that this also binds @code{org-agenda-overriding-header} to get a
8689 meaningful header in the agenda view.
8691 You may also put a Lisp form into @code{org-agenda-skip-function}.  In
8692 particular, you may use the functions @code{org-agenda-skip-entry-if}
8693 and @code{org-agenda-skip-subtree-if} in this form, for example:
8695 @table @code
8696 @item '(org-agenda-skip-entry-if 'scheduled)
8697 Skip current entry if it has been scheduled.
8698 @item '(org-agenda-skip-entry-if 'notscheduled)
8699 Skip current entry if it has not been scheduled.
8700 @item '(org-agenda-skip-entry-if 'deadline)
8701 Skip current entry if it has a deadline.
8702 @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
8703 Skip current entry if it has a deadline, or if it is scheduled.
8704 @item '(org-agenda-skip-entry 'regexp "regular expression")
8705 Skip current entry if the regular expression matches in the entry.
8706 @item '(org-agenda-skip-entry 'notregexp "regular expression")
8707 Skip current entry unless the regular expression matches.
8708 @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
8709 Same as above, but check and skip the entire subtree.
8710 @end table
8712 Therefore we could also have written the search for WAITING projects
8713 like this, even without defining a special function:
8715 @lisp
8716 (org-add-agenda-custom-command
8717  '("b" todo "PROJECT"
8718    ((org-agenda-skip-function '(org-agenda-skip-subtree-if
8719                                 'regexp ":waiting:"))
8720     (org-agenda-overriding-header "Projects waiting for something: "))))
8721 @end lisp
8724 @node Using the property API,  , Special agenda views, Extensions and Hacking
8725 @section Using the property API
8726 @cindex API, for properties
8727 @cindex properties, API
8729 Here is a description of the functions that can be used to work with
8730 properties.
8732 @defun org-entry-properties &optional pom which
8733 Get all properties of the entry at point-or-marker POM.
8734 This includes the TODO keyword, the tags, time strings for deadline,
8735 scheduled, and clocking, and any additional properties defined in the
8736 entry.  The return value is an alist, keys may occur multiple times
8737 if the property key was used several times.
8738 POM may also be nil, in which case the current entry is used.
8739 If WHICH is nil or `all', get all properties.  If WHICH is
8740 `special' or `standard', only get that subclass.
8741 @end defun
8742 @defun org-entry-get pom property &optional inherit
8743 Get value of PROPERTY for entry at point-or-marker POM.  By default,
8744 this only looks at properties defined locally in the entry.  If INHERIT
8745 is non-nil and the entry does not have the property, then also check
8746 higher levels of the hierarchy.  If INHERIT is the symbol
8747 @code{selective}, use inheritance if and only if the setting of
8748 @code{org-use-property-inheritance} selects PROPERTY for inheritance.
8749 @end defun
8751 @defun org-entry-delete pom property
8752 Delete the property PROPERTY from entry at point-or-marker POM.
8753 @end defun
8755 @defun org-entry-put pom property value
8756 Set PROPERTY to VALUE for entry at point-or-marker POM.
8757 @end defun
8759 @defun org-buffer-property-keys &optional include-specials
8760 Get all property keys in the current buffer.
8761 @end defun
8763 @defun org-insert-property-drawer
8764 Insert a property drawer at point.
8765 @end defun
8767 @defun org-entry-add-to-multivalued-property pom property value
8768 Treat the value of the property PROPERTY as a whitespace-separated list of
8769 values and make sure that VALUE is in this list.
8770 @end defun
8772 @defun org-entry-remove-from-multivalued-property pom property value
8773 Treat the value of the property PROPERTY as a whitespace-separated list of
8774 values and make sure that VALUE is @emph{not} in this list.
8775 @end defun
8777 @defun org-entry-member-in-multivalued-property pom property value
8778 Treat the value of the property PROPERTY as a whitespace-separated list of
8779 values and check if VALUE is in this list.
8780 @end defun
8782 @node History and Acknowledgments, Main Index, Extensions and Hacking, Top
8783 @appendix History and Acknowledgments
8784 @cindex acknowledgments
8785 @cindex history
8786 @cindex thanks
8788 Org was borne in 2003, out of frustration over the user interface
8789 of the Emacs Outline mode.  I was trying to organize my notes and
8790 projects, and using Emacs seemed to be the natural way to go.  However,
8791 having to remember eleven different commands with two or three keys per
8792 command, only to hide and show parts of the outline tree, that seemed
8793 entirely unacceptable to me.  Also, when using outlines to take notes, I
8794 constantly want to restructure the tree, organizing it parallel to my
8795 thoughts and plans.  @emph{Visibility cycling} and @emph{structure
8796 editing} were originally implemented in the package
8797 @file{outline-magic.el}, but quickly moved to the more general
8798 @file{org.el}.  As this environment became comfortable for project
8799 planning, the next step was adding @emph{TODO entries}, basic @emph{time
8800 stamps}, and @emph{table support}.  These areas highlight the two main
8801 goals that Org still has today: To create a new, outline-based,
8802 plain text mode with innovative and intuitive editing features, and to
8803 incorporate project planning functionality directly into a notes file.
8805 A special thanks goes to @i{Bastien Guerry} who has not only writen a large
8806 number of extensions to Org (most of them integrated into the core by now),
8807 but has also helep the development and maintenance of Org so much that e
8808 should be considered co-author of this package.
8810 Since the first release, literally thousands of emails to me or on
8811 @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
8812 reports, feedback, new ideas, and sometimes patches and add-on code.
8813 Many thanks to everyone who has helped to improve this package.  I am
8814 trying to keep here a list of the people who had significant influence
8815 in shaping one or more aspects of Org.  The list may not be
8816 complete, if I have forgotten someone, please accept my apologies and
8817 let me know.
8819 @itemize @bullet
8821 @item
8822 @i{Russel Adams} came up with the idea for drawers.
8823 @item
8824 @i{Thomas Baumann} contributed the code for links to the MH-E email
8825 system.
8826 @item
8827 @i{Alex Bochannek} provided a patch for rounding time stamps.
8828 @item
8829 @i{Charles Cave}'s suggestion sparked the implementation of templates
8830 for Remember.
8831 @item
8832 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
8833 specified time.
8834 @item
8835 @i{Gregory Chernov} patched support for lisp forms into table
8836 calculations and improved XEmacs compatibility, in particular by porting
8837 @file{nouline.el} to XEmacs.
8838 @item
8839 @i{Sacha Chua} suggested to copy some linking code from Planner.
8840 @item
8841 @i{Eddward DeVilla} proposed and tested checkbox statistics.  He also
8842 came up with the idea of properties, and that there should be an API for
8843 them.
8844 @item
8845 @i{Kees Dullemond} used to edit projects lists directly in HTML and so
8846 inspired some of the early development, including HTML export.  He also
8847 asked for a way to narrow wide table columns.
8848 @item
8849 @i{Christian Egli} converted the documentation into Texinfo format,
8850 patched CSS formatting into the HTML exporter, and inspired the agenda.
8851 @item
8852 @i{David Emery} provided a patch for custom CSS support in exported
8853 HTML agendas.
8854 @item
8855 @i{Nic Ferrier} contributed mailcap and XOXO support.
8856 @item
8857 @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
8858 @item
8859 @i{John Foerch} figured out how to make incremental search show context
8860 around a match in a hidden outline tree.
8861 @item
8862 @i{Niels Giesen} had the idea to automatically archive DONE trees.
8863 @item
8864 @i{Bastien Guerry} wrote the La@TeX{} exporter and has been prolific
8865 with patches, ideas, and bug reports.
8866 @item
8867 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
8868 @item
8869 @i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
8870 task state change logging, and the clocktable.  His clear explanations have
8871 been critical when we started to adopt the GIT version control system.
8872 @item
8873 @i{Scott Jaderholm} proposed footnotes, control over whitespace between
8874 folded entries, and column view for properties.
8875 @item
8876 @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it.  He also
8877 provided frequent feedback and some patches.
8878 @item
8879 @i{Jason F. McBrayer} suggested agenda export to CSV format.
8880 @item
8881 @i{Max Mikhanosha} came up with the idea of refiling.
8882 @item
8883 @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
8884 basis.
8885 @item
8886 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
8887 happy.
8888 @item
8889 @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file
8890 and to be able to quickly restrict the agenda to a subtree.
8891 @item
8892 @i{Todd Neal} provided patches for links to Info files and elisp forms.
8893 @item
8894 @i{Tim O'Callaghan} suggested in-file links, search options for general
8895 file links, and TAGS.
8896 @item
8897 @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
8898 into Japanese.
8899 @item
8900 @i{Oliver Oppitz} suggested multi-state TODO items.
8901 @item
8902 @i{Scott Otterson} sparked the introduction of descriptive text for
8903 links, among other things.
8904 @item
8905 @i{Pete Phillips} helped during the development of the TAGS feature, and
8906 provided frequent feedback.
8907 @item
8908 @i{T.V. Raman} reported bugs and suggested improvements.
8909 @item
8910 @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
8911 control.
8912 @item
8913 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
8914 @item
8915 @i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
8916 webpages derived from Org using an Info-like, or a folding interface with
8917 single key navigation.
8918 @item
8919 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
8920 conflict with @file{allout.el}.
8921 @item
8922 @i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords.
8923 @item
8924 @i{Philip Rooke} created the Org reference card and provided lots
8925 of feedback.
8926 @item
8927 @i{Christian Schlauer} proposed angular brackets around links, among
8928 other things.
8929 @item
8930 Linking to VM/BBDB/Gnus was inspired by @i{Tom Shannon}'s
8931 @file{organizer-mode.el}.
8932 @item
8933 @i{Ilya Shlyakhter} proposed the Archive Sibling.
8934 @item
8935 @i{Daniel Sinder} came up with the idea of internal archiving by locking
8936 subtrees.
8937 @item
8938 @i{Dale Smith} proposed link abbreviations.
8939 @item
8940 @i{Adam Spiers} asked for global linking commands and inspired the link
8941 extension system.  support mairix.
8942 @item
8943 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
8944 chapter about publishing.
8945 @item
8946 @i{J@"urgen Vollmer} contributed code generating the table of contents
8947 in HTML output.
8948 @item
8949 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
8950 keyword.
8951 @item
8952 @i{David Wainberg} suggested archiving, and improvements to the linking
8953 system.
8954 @item
8955 @i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}.  The
8956 development of Org was fully independent, and both systems are
8957 really different beasts in their basic ideas and implementation details.
8958 I later looked at John's code, however, and learned from his
8959 implementation of (i) links where the link itself is hidden and only a
8960 description is shown, and (ii) popping up a calendar to select a date.
8961 John has also contributed a number of great ideas directly to Org.
8962 @item
8963 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
8964 linking to Gnus.
8965 @item
8966 @i{Roland Winkler} requested additional key bindings to make Org
8967 work on a tty.
8968 @item
8969 @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
8970 and contributed various ideas and code snippets.
8971 @end itemize
8974 @node Main Index, Key Index, History and Acknowledgments, Top
8975 @unnumbered The Main Index
8977 @printindex cp
8979 @node Key Index,  , Main Index, Top
8980 @unnumbered Key Index
8982 @printindex ky
8984 @bye
8986 @ignore
8987         arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
8988 @end ignore
8990 @c Local variables:
8991 @c ispell-local-dictionary: "en_US-w_accents"
8992 @c ispell-local-pdict: "./.aspell.org.pws"
8993 @c fill-column: 77
8994 @c End: