intermediate
[org-mode.git] / org.texi
blobbdc519126824011f2290141e2dcef53707dffdd8
1 \input texinfo
2 @c %**start of header
3 @setfilename ../../info/org
4 @settitle Org Mode Manual
6 @set VERSION 5.22a
7 @set DATE February 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-mode (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 Org Mode 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-mode 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-mode came into being 
94 * Main Index::                  
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-mode does
103 * Installation::                How to install a downloaded version of Org-mode
104 * Activation::                  How to activate Org-mode for certain buffers.
105 * Feedback::                    Bug reports, ideas, patches etc.
106 * Conventions::                 Type-setting conventions in the manual
108 Document Structure
110 * Outlines::                    Org-mode 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-mode
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-mode 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-mode::  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 * Time stamps::                 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::          
216 Creating timestamps
218 * The date/time prompt::        How org-mode helps you entering date and time
219 * Custom time format::          Making dates look differently
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 * Extracting Agenda Information for 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 appearence of the output
290 LaTeX export
292 * LaTeX export commands::       How to invoke LaTeX export
293 * Quoting LaTeX code::          Incorporating literal LaTeX code
294 * Sectioning structure::        
296 Text interpretation by the exporter
298 * Comment lines::               Some lines will not be exported
299 * Initial text::                Text before the first headline
300 * Footnotes::                   Numbers like [1]
301 * Quoted examples::             Inserting quoted chnuks of text            
302 * Enhancing text::              Subscripts, symbols and more
303 * Export options::              How to influence the export settings
305 Publishing
307 * Configuration::               Defining projects
308 * Sample configuration::        Example projects
309 * Triggering publication::      Publication commands
311 Configuration
313 * Project alist::               The central configuration variable
314 * Sources and destinations::    From here to there
315 * Selecting files::             What files are part of the project?
316 * Publishing action::           Setting the function doing the publishing
317 * Publishing options::          Tweaking HTML export
318 * Publishing links::            Which links keep working after publishing?
319 * Project page index::          Publishing a list of project files
321 Sample configuration
323 * Simple example::              One-component publishing
324 * Complex example::             A multi-component publishing example
326 Miscellaneous
328 * Completion::                  M-TAB knows what you need
329 * Customization::               Adapting Org-mode to your taste
330 * In-buffer settings::          Overview of the #+KEYWORDS
331 * The very busy C-c C-c key::   When in doubt, press C-c C-c
332 * Clean view::                  Getting rid of leading stars in the outline
333 * TTY keys::                    Using Org-mode on a tty
334 * Interaction::                 Other Emacs packages
335 * Bugs::                        Things which do not work perfectly
337 Interaction with other packages
339 * Cooperation::                 Packages Org-mode cooperates with
340 * Conflicts::                   Packages that lead to conflicts
342 Extensions, Hooks and Hacking
344 * Extensions::                  Existing 3rd-part extensions
345 * Adding hyperlink types::      New custom link types
346 * Tables in arbitrary syntax::  Orgtbl for LaTeX and other programs
347 * Dynamic blocks::              Automatically filled blocks
348 * Special agenda views::        Customized views
349 * Using the property API::      Writing programs that use entry properties
351 Tables and Lists in arbitrary syntax
353 * Radio tables::                Sending and receiving
354 * A LaTeX example::             Step by step, almost a tutorial
355 * Translator functions::        Copy and modify
356 * Radio lists::                 Doing the same for lists.
358 @end detailmenu
359 @end menu
361 @node Introduction, Document structure, Top, Top
362 @chapter Introduction
363 @cindex introduction
365 @menu
366 * Summary::                     Brief summary of what Org-mode does
367 * Installation::                How to install a downloaded version of Org-mode
368 * Activation::                  How to activate Org-mode for certain buffers.
369 * Feedback::                    Bug reports, ideas, patches etc.
370 * Conventions::                 Type-setting conventions in the manual
371 @end menu
373 @node Summary, Installation, Introduction, Introduction
374 @section Summary
375 @cindex summary
377 Org-mode is a mode for keeping notes, maintaining TODO lists, and doing
378 project planning with a fast and effective plain-text system.
380 Org-mode develops organizational tasks around NOTES files that contain
381 lists or information about projects as plain text.  Org-mode is
382 implemented on top of outline-mode, which makes it possible to keep the
383 content of large files well structured.  Visibility cycling and
384 structure editing help to work with the tree.  Tables are easily created
385 with a built-in table editor.  Org-mode supports TODO items, deadlines,
386 time stamps, and scheduling.  It dynamically compiles entries into an
387 agenda that utilizes and smoothly integrates much of the Emacs calendar
388 and diary.  Plain text URL-like links connect to websites, emails,
389 Usenet messages, BBDB entries, and any files related to the projects.
390 For printing and sharing of notes, an Org-mode file can be exported as a
391 structured ASCII file, as HTML, or (TODO and agenda items only) as an
392 iCalendar file.  It can also serve as a publishing tool for a set of
393 linked webpages.
395 An important design aspect that distinguishes Org-mode from for example
396 Planner/Muse is that it encourages to store every piece of information
397 only once.  In Planner, you have project pages, day pages and possibly
398 other files, duplicating some information such as tasks.  In Org-mode,
399 you only have notes files.  In your notes you mark entries as tasks,
400 label them with tags and timestamps.  All necessary lists like a
401 schedule for the day, the agenda for a meeting, tasks lists selected by
402 tags etc are created dynamically when you need them.
404 Org-mode keeps simple things simple.  When first fired up, it should
405 feel like a straightforward, easy to use outliner.  Complexity is not
406 imposed, but a large amount of functionality is available when you need
407 it.  Org-mode is a toolbox and can be used in different ways, for
408 example as:
410 @example
411 @r{@bullet{} outline extension with visibility cycling and structure editing}
412 @r{@bullet{} ASCII system and table editor for taking structured notes}
413 @r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
414 @r{@bullet{} TODO list editor}
415 @r{@bullet{} full agenda and planner with deadlines and work scheduling}
416 @r{@bullet{} environment to implement David Allen's GTD system}
417 @r{@bullet{} a basic database application}
418 @r{@bullet{} simple hypertext system, with HTML and LaTeX export}
419 @r{@bullet{} publishing tool to create a set of interlinked webpages}
420 @end example
422 Org-mode's automatic, context sensitive table editor with spreadsheet
423 capabilities can be integrated into any major mode by activating the
424 minor Orgtbl-mode.  Using a translation step, it can be used to maintain
425 tables in arbitrary file types, for example in La@TeX{}.  The structure
426 editing and list creation capabilities can be used outside Org-mode with
427 the minor Orgstruct-mode.
429 @cindex FAQ
430 There is a website for Org-mode which provides links to the newest
431 version of Org-mode, as well as additional information, frequently asked
432 questions (FAQ), links to tutorials etc.  This page is located at
433 @uref{http://orgmode.org}.
435 @page
438 @node Installation, Activation, Summary, Introduction
439 @section Installation
440 @cindex installation
441 @cindex XEmacs
443 @b{Important:} @i{If Org-mode is part of the Emacs distribution or an
444 XEmacs package, please skip this section and go directly to
445 @ref{Activation}.}
447 If you have downloaded Org-mode from the Web, you must take the
448 following steps to install it: Go into the Org-mode distribution
449 directory and edit the top section of the file @file{Makefile}.  You
450 must set the name of the Emacs binary (likely either @file{emacs} or
451 @file{xemacs}), and the paths to the directories where local Lisp and
452 Info files are kept.  If you don't have access to the system-wide
453 directories, create your own two directories for these files, enter them
454 into the Makefile, and make sure Emacs finds the Lisp files by adding
455 the following line to @file{.emacs}:
457 @example
458 (setq load-path (cons "~/path/to/lispdir" load-path))
459 @end example
461 @b{XEmacs users now need to install the file @file{noutline.el} from
462 the @file{xemacs} subdirectory of the Org-mode distribution.  Use the
463 command:}
465 @example
466 @b{make install-noutline}
467 @end example
469 @noindent Now byte-compile and install the Lisp files with the shell
470 commands:
472 @example
473 make
474 make install
475 @end example
477 @noindent If you want to install the info documentation, use this command:
479 @example
480 make install-info
481 @end example
483 @noindent Then add to @file{.emacs}:
485 @lisp
486 ;; This line only if org-mode is not part of the X/Emacs distribution.
487 (require 'org-install)
488 @end lisp
490 @node Activation, Feedback, Installation, Introduction
491 @section Activation
492 @cindex activation
493 @cindex autoload
494 @cindex global keybindings
495 @cindex keybindings, global
497 @iftex
498 @b{Important:} @i{If you use copy-and-paste to copy lisp code from the
499 PDF documentation as viewed by Acrobat reader to your .emacs file, the
500 single quote character comes out incorrectly and the code will not work.
501 You need to fix the single quotes by hand, or copy from Info
502 documentation.}
503 @end iftex
505 Add the following lines to your @file{.emacs} file.  The last two lines
506 define @emph{global} keys for the commands @command{org-store-link} and
507 @command{org-agenda} - please choose suitable keys yourself.
509 @lisp
510 ;; The following lines are always needed.  Choose your own keys.
511 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
512 (global-set-key "\C-cl" 'org-store-link)
513 (global-set-key "\C-ca" 'org-agenda)
514 @end lisp
516 Furthermore, you must activate @code{font-lock-mode} in org-mode
517 buffers, because significant functionality depends on font-locking being
518 active.  You can do this with either one of the following two lines
519 (XEmacs user must use the second option):
520 @lisp
521 (global-font-lock-mode 1)                     ; for all buffers
522 (add-hook 'org-mode-hook 'turn-on-font-lock)  ; org-mode buffers only
523 @end lisp
525 @cindex org-mode, turning on
526 With this setup, all files with extension @samp{.org} will be put
527 into Org-mode.  As an alternative, make the first line of a file look
528 like this:
530 @example
531 MY PROJECTS    -*- mode: org; -*-
532 @end example
534 @noindent which will select Org-mode for this buffer no matter what
535 the file's name is.  See also the variable
536 @code{org-insert-mode-line-in-empty-file}.
538 @node Feedback, Conventions, Activation, Introduction
539 @section Feedback
540 @cindex feedback
541 @cindex bug reports
542 @cindex maintainer
543 @cindex author
545 If you find problems with Org-mode, or if you have questions, remarks,
546 or ideas about it, please contact the maintainer @value{MAINTAINER} at
547 @value{MAINTAINEREMAIL}.
549 For bug reports, please provide as much information as possible,
550 including the version information of Emacs (@kbd{C-h v emacs-version
551 @key{RET}}) and Org-mode (@kbd{C-h v org-version @key{RET}}), as well as
552 the Org-mode related setup in @file{.emacs}.  If an error occurs, a
553 backtrace can be very useful (see below on how to create one).  Often a
554 small example file helps, along with clear information about:
556 @enumerate
557 @item What exactly did you do?
558 @item What did you expect to happen?
559 @item What happened instead?
560 @end enumerate
561 @noindent Thank you for helping to improve this mode.
563 @subsubheading How to create a useful backtrace
565 @cindex backtrace of an error
566 If working with Org-mode produces an error with a message you don't
567 understand, you may have hit a bug.  The best way to report this is by
568 providing, in addition to what was mentioned above, a @emph{Backtrace}.
569 This is information from the built-in debugger about where and how the
570 error occurred.  Here is how to produce a useful backtrace:
572 @enumerate
573 @item
574 Start a fresh Emacs or XEmacs, and make sure that it will load the
575 original Lisp code in @file{org.el} instead of the compiled version in
576 @file{org.elc}.  The backtrace contains much more information if it is
577 produced with uncompiled code.  To do this, either rename @file{org.elc}
578 to something else before starting Emacs, or ask Emacs explicitly to load
579 @file{org.el} by using the command line
580 @example
581 emacs -l /path/to/org.el
582 @end example
583 @item
584 Go to the @code{Options} menu and select @code{Enter Debugger on Error}
585 (XEmacs has this option in the @code{Troubleshooting} sub-menu).
586 @item
587 Do whatever you have to do to hit the error.  Don't forget to
588 document the steps you take.
589 @item
590 When you hit the error, a @file{*Backtrace*} buffer will appear on the
591 screen.  Save this buffer to a file (for example using @kbd{C-x C-w}) and
592 attach it to your bug report.
593 @end enumerate
595 @node Conventions,  , Feedback, Introduction
596 @section Typesetting conventions used in this manual
598 Org-mode uses three types of keywords: TODO keywords, tags, and property
599 names.  In this manual we use the following conventions:
601 @table @code
602 @item TODO
603 @itemx WAITING
604 TODO keywords are written with all capitals, even if they are
605 user-defined.
606 @item boss
607 @itemx ARCHIVE
608 User-defined tags are written in lowercase; built-in tags with special
609 meaning are written with all capitals.
610 @item Release
611 @itemx PRIORITY
612 User-defined properties are capitalized; built-in properties with
613 special meaning are written with all capitals.
614 @end table
616 @node Document structure, Tables, Introduction, Top
617 @chapter Document Structure
618 @cindex document structure
619 @cindex structure of document
621 Org-mode is based on outline mode and provides flexible commands to
622 edit the structure of the document.
624 @menu
625 * Outlines::                    Org-mode is based on outline-mode
626 * Headlines::                   How to typeset org-tree headlines
627 * Visibility cycling::          Show and hide, much simplified
628 * Motion::                      Jumping to other headlines
629 * Structure editing::           Changing sequence and level of headlines
630 * Archiving::                   Move done task trees to a different place
631 * Sparse trees::                Matches embedded in context
632 * Plain lists::                 Additional structure within an entry
633 * Drawers::                     Tucking stuff away
634 * orgstruct-mode::              Structure editing outside Org-mode
635 @end menu
637 @node Outlines, Headlines, Document structure, Document structure
638 @section Outlines
639 @cindex outlines
640 @cindex outline-mode
642 Org-mode is implemented on top of outline-mode.  Outlines allow a
643 document to be organized in a hierarchical structure, which (at least
644 for me) is the best representation of notes and thoughts.  An overview
645 of this structure is achieved by folding (hiding) large parts of the
646 document to show only the general document structure and the parts
647 currently being worked on.  Org-mode greatly simplifies the use of
648 outlines by compressing the entire show/hide functionality into a single
649 command @command{org-cycle}, which is bound to the @key{TAB} key.
651 @node Headlines, Visibility cycling, Outlines, Document structure
652 @section Headlines
653 @cindex headlines
654 @cindex outline tree
656 Headlines define the structure of an outline tree.  The headlines in
657 Org-mode start with one or more stars, on the left margin@footnote{See
658 the variable @code{org-special-ctrl-a/e} to configure special behavior
659 of @kbd{C-a} and @kbd{C-e} in headlines.}.  For example:
661 @example
662 * Top level headline
663 ** Second level
664 *** 3rd level
665     some text
666 *** 3rd level
667     more text
669 * Another top level headline
670 @end example
672 @noindent Some people find the many stars too noisy and would prefer an
673 outline that has whitespace followed by a single star as headline
674 starters.  @ref{Clean view} describes a setup to realize this.
676 An empty line after the end of a subtree is considered part of it and
677 will be hidden when the subtree is folded.  However, if you leave at
678 least two empty lines, one empty line will remain visible after folding
679 the subtree, in order to structure the collapsed view.  See the
680 variable @code{org-cycle-separator-lines} to modify this behavior.
682 @node Visibility cycling, Motion, Headlines, Document structure
683 @section Visibility cycling
684 @cindex cycling, visibility
685 @cindex visibility cycling
686 @cindex trees, visibility
687 @cindex show hidden text
688 @cindex hide text
690 Outlines make it possible to hide parts of the text in the buffer.
691 Org-mode uses just two commands, bound to @key{TAB} and
692 @kbd{S-@key{TAB}} to change the visibility in the buffer.
694 @cindex subtree visibility states
695 @cindex subtree cycling
696 @cindex folded, subtree visibility state
697 @cindex children, subtree visibility state
698 @cindex subtree, subtree visibility state
699 @table @kbd
700 @kindex @key{TAB}
701 @item @key{TAB}
702 @emph{Subtree cycling}: Rotate current subtree among the states
704 @example
705 ,-> FOLDED -> CHILDREN -> SUBTREE --.
706 '-----------------------------------'
707 @end example
709 The cursor must be on a headline for this to work@footnote{see, however,
710 the option @code{org-cycle-emulate-tab}.}.  When the cursor is at the
711 beginning of the buffer and the first line is not a headline, then
712 @key{TAB} actually runs global cycling (see below)@footnote{see the
713 option @code{org-cycle-global-at-bob}.}.  Also when called with a prefix
714 argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
716 @cindex global visibility states
717 @cindex global cycling
718 @cindex overview, global visibility state
719 @cindex contents, global visibility state
720 @cindex show all, global visibility state
721 @kindex S-@key{TAB}
722 @item S-@key{TAB}
723 @itemx C-u @key{TAB}
724 @emph{Global cycling}: Rotate the entire buffer among the states
726 @example
727 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
728 '--------------------------------------'
729 @end example
731 When @kbd{S-@key{TAB}} is called with a numerical prefix N, the CONTENTS
732 view up to headlines of level N will be shown.
733 Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field.
735 @cindex show all, command
736 @kindex C-c C-a
737 @item C-c C-a
738 Show all.
739 @kindex C-c C-r
740 @item C-c C-r
741 Reveal context around point, showing the current entry, the following
742 heading and the hierarchy above.  Useful for working near a location
743 that has been exposed by a sparse tree command (@pxref{Sparse trees}) or
744 an agenda command (@pxref{Agenda commands}).  With prefix arg show, on
745 each
747 level, all sibling headings.
748 @kindex C-c C-x b
749 @item C-c C-x b
750 Show the current subtree in an indirect buffer@footnote{The indirect
751 buffer
752 @ifinfo
753 (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
754 @end ifinfo
755 @ifnotinfo
756 (see the Emacs manual for more information about indirect buffers)
757 @end ifnotinfo
758 will contain the entire buffer, but will be narrowed to the current
759 tree.  Editing the indirect buffer will also change the original buffer,
760 but without affecting visibility in that buffer.}.  With numerical
761 prefix ARG, go up to this level and then take that tree.  If ARG is
762 negative, go up that many levels.  With @kbd{C-u} prefix, do not remove
763 the previously used indirect buffer.
764 @end table
766 When Emacs first visits an Org-mode file, the global state is set to
767 OVERVIEW, i.e. only the top level headlines are visible.  This can be
768 configured through the variable @code{org-startup-folded}, or on a
769 per-file basis by adding one of the following lines anywhere in the
770 buffer:
772 @example
773 #+STARTUP: overview
774 #+STARTUP: content
775 #+STARTUP: showall
776 @end example
778 @node Motion, Structure editing, Visibility cycling, Document structure
779 @section Motion
780 @cindex motion, between headlines
781 @cindex jumping, to headlines
782 @cindex headline navigation
783 The following commands jump to other headlines in the buffer.
785 @table @kbd
786 @kindex C-c C-n
787 @item C-c C-n
788 Next heading.
789 @kindex C-c C-p
790 @item C-c C-p
791 Previous heading.
792 @kindex C-c C-f
793 @item C-c C-f
794 Next heading same level.
795 @kindex C-c C-b
796 @item C-c C-b
797 Previous heading same level.
798 @kindex C-c C-u
799 @item C-c C-u
800 Backward to higher level heading.
801 @kindex C-c C-j
802 @item C-c C-j
803 Jump to a different place without changing the current outline
804 visibility.  Shows the document structure in a temporary buffer, where
805 you can use the following keys to find your destination:
806 @example
807 @key{TAB}         @r{Cycle visibility.}
808 @key{down} / @key{up}   @r{Next/previous visible headline.}
809 n / p        @r{Next/previous visible headline.}
810 f / b        @r{Next/previous headline same level.}
811 u            @r{One level up.}
812 0-9          @r{Digit argument.}
813 @key{RET}         @r{Select this location.}
814 @end example
815 @end table
817 @node Structure editing, Archiving, Motion, Document structure
818 @section Structure editing
819 @cindex structure editing
820 @cindex headline, promotion and demotion
821 @cindex promotion, of subtrees
822 @cindex demotion, of subtrees
823 @cindex subtree, cut and paste
824 @cindex pasting, of subtrees
825 @cindex cutting, of subtrees
826 @cindex copying, of subtrees
827 @cindex subtrees, cut and paste
829 @table @kbd
830 @kindex M-@key{RET}
831 @item M-@key{RET}
832 Insert new heading with same level as current.  If the cursor is in a
833 plain list item, a new item is created (@pxref{Plain lists}).  To force
834 creation of a new headline, use a prefix arg, or first press @key{RET}
835 to get to the beginning of the next line.  When this command is used in
836 the middle of a line, the line is split and the rest of the line becomes
837 the new headline@footnote{If you do not want the line to be split,
838 customize the variable @code{org-M-RET-may-split-line}.}.  If the
839 command is used at the beginning of a headline, the new headline is
840 created before the current line.  If at the beginning of any other line,
841 the content of that line is made the new heading.  If the command is
842 used at the end of a folded subtree (i.e. behind the ellipses at the end
843 of a headline), then a headline like the current one will be inserted
844 after the end of the subtree.
845 @kindex C-@key{RET}
846 @item C-@key{RET}
847 Insert a new heading after the current subtree, same level as the
848 current headline.  This command works from anywhere in the entry.
849 @kindex M-S-@key{RET}
850 @item M-S-@key{RET}
851 Insert new TODO entry with same level as current heading.
852 @kindex M-@key{left}
853 @item M-@key{left}
854 Promote current heading by one level.
855 @kindex M-@key{right}
856 @item M-@key{right}
857 Demote current heading by one level.
858 @kindex M-S-@key{left}
859 @item M-S-@key{left}
860 Promote the current subtree by one level.
861 @kindex M-S-@key{right}
862 @item M-S-@key{right}
863 Demote the current subtree by one level.
864 @kindex M-S-@key{up}
865 @item M-S-@key{up}
866 Move subtree up (swap with previous subtree of same
867 level).
868 @kindex M-S-@key{down}
869 @item M-S-@key{down}
870 Move subtree down (swap with next subtree of same level).
871 @kindex C-c C-x C-w
872 @kindex C-c C-x C-k
873 @item C-c C-x C-w
874 @itemx C-c C-x C-k
875 Kill subtree, i.e. remove it from buffer but save in kill ring.
876 With prefix arg, kill N sequential subtrees.
877 @kindex C-c C-x M-w
878 @item C-c C-x M-w
879 Copy subtree to kill ring.  With prefix arg, copy N sequential subtrees.
880 @kindex C-c C-x C-y
881 @item C-c C-x C-y
882 Yank subtree from kill ring.  This does modify the level of the subtree to
883 make sure the tree fits in nicely at the yank position.  The yank
884 level can also be specified with a prefix arg, or by yanking after a
885 headline marker like @samp{****}.
886 @kindex C-c C-w
887 @item C-c C-w
888 Refile entry to a different location.  @xref{Refiling notes}.
889 @kindex C-c ^
890 @item C-c ^
891 Sort same-level entries.  When there is an active region, all entries in
892 the region will be sorted.  Otherwise the children of the current
893 headline are sorted.  The command prompts for the sorting method, which
894 can be alphabetically, numerically, by time (using the first time stamp
895 in each entry), by priority, and each of these in reverse order.  You
896 can also supply your own function to extract the sorting key.  With a
897 @kbd{C-u} prefix, sorting will be case-sensitive.  With two @kbd{C-u
898 C-u} prefixes, duplicate entries will also be removed.
899 @end table
901 @cindex region, active
902 @cindex active region
903 @cindex transient-mark-mode
904 When there is an active region (transient-mark-mode), promotion and
905 demotion work on all headlines in the region.  To select a region of
906 headlines, it is best to place both point and mark at the beginning of a
907 line, mark at the beginning of the first headline, and point at the line
908 just after the last headline to change.  Note that when the cursor is
909 inside a table (@pxref{Tables}), the Meta-Cursor keys have different
910 functionality.
912 @node Archiving, Sparse trees, Structure editing, Document structure
913 @section Archiving
914 @cindex archiving
916 When a project represented by a (sub)tree is finished, you may want
917 to move the tree out of the way and to stop it from contributing to the
918 agenda.  Org-mode knows two ways of archiving.  You can mark a tree with
919 the ARCHIVE tag, or you can move an entire (sub)tree to a different
920 location.
922 @menu
923 * ARCHIVE tag::                 Marking a tree as inactive
924 * Moving subtrees::             Moving a tree to an archive file
925 @end menu
927 @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
928 @subsection The ARCHIVE tag
929 @cindex internal archiving
931 A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
932 its location in the outline tree, but behaves in the following way:
933 @itemize @minus
934 @item
935 It does not open when you attempt to do so with a visibility cycling
936 command (@pxref{Visibility cycling}).  You can force cycling archived
937 subtrees with @kbd{C-@key{TAB}}, or by setting the option
938 @code{org-cycle-open-archived-trees}.  Also normal outline commands like
939 @code{show-all} will open archived subtrees.
940 @item
941 During sparse tree construction (@pxref{Sparse trees}), matches in
942 archived subtrees are not exposed, unless you configure the option
943 @code{org-sparse-tree-open-archived-trees}.
944 @item
945 During agenda view construction (@pxref{Agenda views}), the content of
946 archived trees is ignored unless you configure the option
947 @code{org-agenda-skip-archived-trees}.
948 @item
949 Archived trees are not exported (@pxref{Exporting}), only the headline
950 is.  Configure the details using the variable
951 @code{org-export-with-archived-trees}.
952 @end itemize
954 The following commands help managing the ARCHIVE tag:
956 @table @kbd
957 @kindex C-c C-x C-a
958 @item C-c C-x C-a
959 Toggle the ARCHIVE tag for the current headline.  When the tag is set,
960 the headline changes to a shadowish face, and the subtree below it is
961 hidden.
962 @kindex C-u C-c C-x C-a
963 @item C-u C-c C-x C-a
964 Check if any direct children of the current headline should be archived.
965 To do this, each subtree is checked for open TODO entries.  If none are
966 found, the command offers to set the ARCHIVE tag for the child.  If the
967 cursor is @emph{not} on a headline when this command is invoked, the
968 level 1 trees will be checked.
969 @kindex C-@kbd{TAB}
970 @item C-@kbd{TAB}
971 Cycle a tree even if it is tagged with ARCHIVE.
972 @end table
974 @node Moving subtrees,  , ARCHIVE tag, Archiving
975 @subsection Moving subtrees
976 @cindex external archiving
978 Once an entire project is finished, you may want to move it to a
979 different location, either in the current file, or even in a different
980 file, the archive file.
982 @table @kbd
983 @kindex C-c C-x C-s
984 @item C-c C-x C-s
985 Archive the subtree starting at the cursor position to the location
986 given by @code{org-archive-location}.  Context information that could be
987 lost like the file name, the category, inherited tags, and the todo
988 state will be store as properties in the entry.
989 @kindex C-u C-c C-x C-s
990 @item C-u C-c C-x C-s
991 Check if any direct children of the current headline could be moved to
992 the archive.  To do this, each subtree is checked for open TODO entries.
993 If none are found, the command offers to move it to the archive
994 location.  If the cursor is @emph{not} on a headline when this command
995 is invoked, the level 1 trees will be checked.
996 @end table
998 @cindex archive locations
999 The default archive location is a file in the same directory as the
1000 current file, with the name derived by appending @file{_archive} to the
1001 current file name.  For information and examples on how to change this,
1002 see the documentation string of the variable
1003 @code{org-archive-location}.  There is also an in-buffer option for
1004 setting this variable, for example@footnote{For backward compatibility,
1005 the following also works: If there are several such lines in a file,
1006 each specifies the archive location for the text below it.  The first
1007 such line also applies to any text before its definition.  However,
1008 using this method is @emph{strongly} deprecated as it is incompatible
1009 with the outline structure of the document.  The correct method for
1010 setting multiple archive locations in a buffer is using a property.}:
1012 @example
1013 #+ARCHIVE: %s_done::
1014 @end example
1016 @noindent
1017 If you would like to have a special ARCHIVE location for a single entry
1018 or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
1019 location as the value (@pxref{Properties and columns}).
1021 When a subtree is moved, it receives a number of special properties that
1022 record context information like the file from where the entry came, it's
1023 outline path the archiving time etc.  Configure the variable
1024 @code{org-archive-save-context-info} to adjust the amount of information
1025 added.
1027 @node Sparse trees, Plain lists, Archiving, Document structure
1028 @section Sparse trees
1029 @cindex sparse trees
1030 @cindex trees, sparse
1031 @cindex folding, sparse trees
1032 @cindex occur, command
1034 An important feature of Org-mode is the ability to construct
1035 @emph{sparse trees} for selected information in an outline tree, so that
1036 the entire document is folded as much as possible, but the selected
1037 information is made visible along with the headline structure above
1038 it@footnote{See also the variables @code{org-show-hierarchy-above},
1039 @code{org-show-following-heading}, and @code{org-show-siblings} for
1040 detailed control on how much context is shown around each match.}.  Just
1041 try it out and you will see immediately how it works.
1043 Org-mode contains several commands creating such trees, all these
1044 commands can be accessed through a dispatcher:
1046 @table @kbd
1047 @kindex C-c /
1048 @item C-c /
1049 This prompts for an extra key to select a sparse-tree creating command.
1050 @kindex C-c / r
1051 @item C-c / r
1052 Occur.  Prompts for a regexp and shows a sparse tree with all matches.
1053 If the match is in a headline, the headline is made visible.  If the
1054 match is in the body of an entry, headline and body are made visible.
1055 In order to provide minimal context, also the full hierarchy of
1056 headlines above the match is shown, as well as the headline following
1057 the match.  Each match is also highlighted; the highlights disappear
1058 when the buffer is changed by an editing command, or by pressing
1059 @kbd{C-c C-c}.  When called with a @kbd{C-u} prefix argument, previous
1060 highlights are kept, so several calls to this command can be stacked.
1061 @end table
1063 @noindent
1064 For frequently used sparse trees of specific search strings, you can
1065 use the variable @code{org-agenda-custom-commands} to define fast
1066 keyboard access to specific sparse trees.  These commands will then be
1067 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
1068 For example:
1070 @lisp
1071 (setq org-agenda-custom-commands
1072       '(("f" occur-tree "FIXME")))
1073 @end lisp
1075 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
1076 a sparse tree matching the string @samp{FIXME}.
1078 The other sparse tree commands select headings based on TODO keywords,
1079 tags, or properties and will be discussed later in this manual.
1081 @kindex C-c C-e v
1082 @cindex printing sparse trees
1083 @cindex visible text, printing
1084 To print a sparse tree, you can use the Emacs command
1085 @code{ps-print-buffer-with-faces} which does not print invisible parts
1086 of the document @footnote{This does not work under XEmacs, because
1087 XEmacs uses selective display for outlining, not text properties.}.
1088 Or you can use the command @kbd{C-c C-e v} to export only the visible
1089 part of the document and print the resulting file.
1091 @node Plain lists, Drawers, Sparse trees, Document structure
1092 @section Plain lists
1093 @cindex plain lists
1094 @cindex lists, plain
1095 @cindex lists, ordered
1096 @cindex ordered lists
1098 Within an entry of the outline tree, hand-formatted lists can provide
1099 additional structure.  They also provide a way to create lists of
1100 checkboxes (@pxref{Checkboxes}).  Org-mode supports editing such lists,
1101 and the HTML exporter (@pxref{Exporting}) parses and formats them.
1103 Org-mode knows ordered and unordered lists.  Unordered list items start
1104 with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
1105 bullet, lines must be indented or they will be seen as top-level
1106 headlines.  Also, when you are hiding leading stars to get a clean
1107 outline view, plain list items starting with a star are visually
1108 indistinguishable from true headlines.  In short: even though @samp{*}
1109 is supported, it may be better to not use it for plain list items.} as
1110 bullets.  Ordered list items start with a numeral followed by either a
1111 period or a right parenthesis, such as @samp{1.} or @samp{1)}.  Items
1112 belonging to the same list must have the same indentation on the first
1113 line.  In particular, if an ordered list reaches number @samp{10.}, then
1114 the 2--digit numbers must be written left-aligned with the other numbers
1115 in the list.  Indentation also determines the end of a list item.  It
1116 ends before the next line that is indented like the bullet/number, or
1117 less.  Empty lines are part of the previous item, so you can have
1118 several paragraphs in one item.  If you would like an empty line to
1119 terminate all currently open plain lists, configure the variable
1120 @code{org-empty-line-terminates-plain-lists}.  Here is an example:
1122 @example
1123 @group
1124 ** Lord of the Rings
1125    My favorite scenes are (in this order)
1126    1. The attack of the Rohirrim
1127    2. Eowyns fight with the witch king
1128       + this was already my favorite scene in the book
1129       + I really like Miranda Otto.
1130    3. Peter Jackson being shot by Legolas
1131        - on DVD only
1132       He makes a really funny face when it happens.
1133    But in the end, not individual scenes matter but the film as a whole.
1134 @end group
1135 @end example
1137 Org-mode supports these lists by tuning filling and wrapping commands to
1138 deal with them correctly@footnote{Org-mode only changes the filling
1139 settings for Emacs.  For XEmacs, you should use Kyle E. Jones'
1140 @file{filladapt.el}.  To turn this on,  put into @file{.emacs}:
1141 @code{(require 'filladapt)}}. 
1143 The following commands act on items when the cursor is in the first line
1144 of an item (the line with the bullet or number).
1146 @table @kbd
1147 @kindex @key{TAB}
1148 @item @key{TAB}
1149 Items can be folded just like headline levels if you set the variable
1150 @code{org-cycle-include-plain-lists}.  The level of an item is then
1151 given by the indentation of the bullet/number.  Items are always
1152 subordinate to real headlines, however; the hierarchies remain
1153 completely separated.
1155 If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
1156 fixes the indentation of the curent line in a heuristic way.
1157 @kindex M-@key{RET}
1158 @item M-@key{RET}
1159 Insert new item at current level.  With prefix arg, force a new heading
1160 (@pxref{Structure editing}).  If this command is used in the middle of a
1161 line, the line is @emph{split} and the rest of the line becomes the new
1162 item@footnote{If you do not want the line to be split, customize the
1163 variable @code{org-M-RET-may-split-line}.}.  If this command is executed
1164 in the @emph{whitespace before a bullet or number}, the new item is
1165 created @emph{before} the current item.  If the command is executed in
1166 the white space before the text that is part of an item but does not
1167 contain the bullet, a bullet is added to the current line.
1168 @kindex M-S-@key{RET}
1169 @item M-S-@key{RET}
1170 Insert a new item with a checkbox (@pxref{Checkboxes}).
1171 @kindex S-@key{up}
1172 @kindex S-@key{down}
1173 @item S-@key{up}
1174 @itemx S-@key{down}
1175 Jump to the previous/next item in the current list.
1176 @kindex M-S-@key{up}
1177 @kindex M-S-@key{down}
1178 @item M-S-@key{up}
1179 @itemx M-S-@key{down}
1180 Move the item including subitems up/down (swap with previous/next item
1181 of same indentation).  If the list is ordered, renumbering is
1182 automatic.
1183 @kindex M-S-@key{left}
1184 @kindex M-S-@key{right}
1185 @item M-S-@key{left}
1186 @itemx M-S-@key{right}
1187 Decrease/increase the indentation of the item, including subitems.
1188 Initially, the item tree is selected based on current indentation.
1189 When these commands are executed several times in direct succession,
1190 the initially selected region is used, even if the new indentation
1191 would imply a different hierarchy.  To use the new hierarchy, break
1192 the command chain with a cursor motion or so.
1193 @kindex C-c C-c
1194 @item C-c C-c
1195 If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
1196 state of the checkbox.  If not, this command makes sure that all the
1197 items on this list level use the same bullet.  Furthermore, if this is
1198 an ordered list, make sure the numbering is ok.
1199 @kindex C-c -
1200 @item C-c -
1201 Cycle the entire list level through the different itemize/enumerate
1202 bullets (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}).
1203 With prefix arg, select the nth bullet from this list.
1204 @end table
1206 @node Drawers, orgstruct-mode, Plain lists, Document structure
1207 @section Drawers
1208 @cindex drawers
1209 @cindex visibility cycling, drawers
1211 Sometimes you want to keep information associated with an entry, but you
1212 normally don't want to see it.  For this, Org-mode has @emph{drawers}.
1213 Drawers need to be configured with the variable
1214 @code{org-drawers}@footnote{You can define drawers on a per-file basis
1215 with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}.  Drawers
1216 look like this:
1218 @example
1219 ** This is a headline
1220    Still outside the drawer
1221    :DRAWERNAME:
1222       This is inside the drawer.
1223    :END:
1224    After the drawer.
1225 @end example
1227 Visibility cycling (@pxref{Visibility cycling}) on the headline will
1228 hide and show the entry, but keep the drawer collapsed to a single line.
1229 In order to look inside the drawer, you need to move the cursor to the
1230 drawer line and press @key{TAB} there.  Org-mode uses a drawer for
1231 storing properties (@pxref{Properties and columns}).
1233 @node orgstruct-mode,  , Drawers, Document structure
1234 @section The Orgstruct minor mode
1235 @cindex orgstruct-mode
1236 @cindex minor mode for structure editing
1238 If you like the intuitive way the Org-mode structure editing and list
1239 formatting works, you might want to use these commands in other modes
1240 like text-mode or mail-mode as well.  The minor mode Orgstruct-mode
1241 makes this possible.  You can always toggle the mode with @kbd{M-x
1242 orgstruct-mode}.  To turn it on by default, for example in mail mode,
1245 @lisp
1246 (add-hook 'mail-mode-hook 'turn-on-orgstruct)
1247 @end lisp
1249 When this mode is active and the cursor is on a line that looks to
1250 Org-mode like a headline of the first line of a list item, most
1251 structure editing commands will work, even if the same keys normally
1252 have different functionality in the major mode you are using.  If the
1253 cursor is not in one of those special lines, Orgstruct-mode lurks
1254 silently in the shadow.
1256 @node Tables, Hyperlinks, Document structure, Top
1257 @chapter Tables
1258 @cindex tables
1259 @cindex editing tables
1261 Org-mode comes with a fast and intuitive table editor.  Spreadsheet-like
1262 calculations are supported in connection with the Emacs @file{calc}
1263 package 
1264 @ifinfo
1265 (@pxref{Top,Calc,,calc,Gnu Emacs Calculator Manual}).
1266 @end ifinfo
1267 @ifnotinfo
1268 (see the Emacs Calculator manual for more information about the Emacs
1269 calculator).
1270 @end ifnotinfo
1272 @menu
1273 * Built-in table editor::       Simple tables
1274 * Narrow columns::              Stop wasting space in tables   
1275 * Column groups::               Grouping to trigger vertical lines
1276 * orgtbl-mode::                 The table editor as minor mode
1277 * The spreadsheet::             The table editor has spreadsheet capabilities.
1278 @end menu
1280 @node Built-in table editor, Narrow columns, Tables, Tables
1281 @section The built-in table editor
1282 @cindex table editor, built-in
1284 Org-mode makes it easy to format tables in plain ASCII.  Any line with
1285 @samp{|} as the first non-whitespace character is considered part of a
1286 table.  @samp{|} is also the column separator.  A table might look like
1287 this:
1289 @example
1290 | Name  | Phone | Age |
1291 |-------+-------+-----|
1292 | Peter |  1234 |  17 |
1293 | Anna  |  4321 |  25 |
1294 @end example
1296 A table is re-aligned automatically each time you press @key{TAB} or
1297 @key{RET} or @kbd{C-c C-c} inside the table.  @key{TAB} also moves to
1298 the next field (@key{RET} to the next row) and creates new table rows
1299 at the end of the table or before horizontal lines.  The indentation
1300 of the table is set by the first line.  Any line starting with
1301 @samp{|-} is considered as a horizontal separator line and will be
1302 expanded on the next re-align to span the whole table width.  So, to
1303 create the above table, you would only type
1305 @example
1306 |Name|Phone|Age|
1308 @end example
1310 @noindent and then press @key{TAB} to align the table and start filling in
1311 fields.
1313 When typing text into a field, Org-mode treats @key{DEL},
1314 @key{Backspace}, and all character keys in a special way, so that
1315 inserting and deleting avoids shifting other fields.  Also, when
1316 typing @emph{immediately after the cursor was moved into a new field
1317 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
1318 field is automatically made blank.  If this behavior is too
1319 unpredictable for you, configure the variables
1320 @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
1322 @table @kbd
1323 @tsubheading{Creation and conversion}
1324 @kindex C-c |
1325 @item C-c |
1326 Convert the active region to table. If every line contains at least one
1327 TAB character, the function assumes that the material is tab separated.
1328 If every line contains a comma, comma-separated values (CSV) are assumed.
1329 If not, lines are split at whitespace into fields.  You can use a prefix
1330 argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
1331 C-u} forces TAB, and a numeric argument N indicates that at least N
1332 consequtive spaces, or alternatively a TAB will be the separator.
1333 @* 
1334 If there is no active region, this command creates an empty Org-mode
1335 table.  But it's easier just to start typing, like
1336 @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
1338 @tsubheading{Re-aligning and field motion}
1339 @kindex C-c C-c
1340 @item C-c C-c
1341 Re-align the table without moving the cursor.
1343 @kindex @key{TAB}
1344 @item @key{TAB}
1345 Re-align the table, move to the next field.  Creates a new row if
1346 necessary.
1348 @kindex S-@key{TAB}
1349 @item S-@key{TAB}
1350 Re-align, move to previous field.
1352 @kindex @key{RET}
1353 @item @key{RET}
1354 Re-align the table and move down to next row.  Creates a new row if
1355 necessary.  At the beginning or end of a line, @key{RET} still does
1356 NEWLINE, so it can be used to split a table.
1358 @tsubheading{Column and row editing}
1359 @kindex M-@key{left}
1360 @kindex M-@key{right}
1361 @item M-@key{left}
1362 @itemx M-@key{right}
1363 Move the current column left/right.
1365 @kindex M-S-@key{left}
1366 @item M-S-@key{left}
1367 Kill the current column.
1369 @kindex M-S-@key{right}
1370 @item M-S-@key{right}
1371 Insert a new column to the left of the cursor position.
1373 @kindex M-@key{up}
1374 @kindex M-@key{down}
1375 @item M-@key{up}
1376 @itemx M-@key{down}
1377 Move the current row up/down.
1379 @kindex M-S-@key{up}
1380 @item M-S-@key{up}
1381 Kill the current row or horizontal line.
1383 @kindex M-S-@key{down}
1384 @item M-S-@key{down}
1385 Insert a new row above (with arg: below) the current row.
1387 @kindex C-c -
1388 @item C-c -
1389 Insert a horizontal line below current row. With prefix arg, the line
1390 is created above the current line.
1392 @kindex C-c ^
1393 @item C-c ^
1394 Sort the table lines in the region.  The position of point indicates the
1395 column to be used for sorting, and the range of lines is the range
1396 between the nearest horizontal separator lines, or the entire table.  If
1397 point is before the first column, you will be prompted for the sorting
1398 column.  If there is an active region, the mark specifies the first line
1399 and the sorting column, while point should be in the last line to be
1400 included into the sorting.  The command prompts for the sorting type
1401 (alphabetically, numerically, or by time).  When called with a prefix
1402 argument, alphabetic sorting will be case-sensitive.
1404 @tsubheading{Regions}
1405 @kindex C-c C-x M-w
1406 @item C-c C-x M-w
1407 Copy a rectangular region from a table to a special clipboard.  Point
1408 and mark determine edge fields of the rectangle.  The process ignores
1409 horizontal separator lines.
1411 @kindex C-c C-x C-w
1412 @item C-c C-x C-w
1413 Copy a rectangular region from a table to a special clipboard, and
1414 blank all fields in the rectangle.  So this is the ``cut'' operation.
1416 @kindex C-c C-x C-y
1417 @item C-c C-x C-y
1418 Paste a rectangular region into a table.
1419 The upper right corner ends up in the current field.  All involved fields
1420 will be overwritten.  If the rectangle does not fit into the present table,
1421 the table is enlarged as needed.  The process ignores horizontal separator
1422 lines.
1424 @kindex C-c C-q
1425 @kindex M-@key{RET}
1426 @item C-c C-q
1427 @itemx M-@kbd{RET}
1428 Wrap several fields in a column like a paragraph.  If there is an active
1429 region, and both point and mark are in the same column, the text in the
1430 column is wrapped to minimum width for the given number of lines.  A
1431 prefix ARG may be used to change the number of desired lines.  If there
1432 is no region, the current field is split at the cursor position and the
1433 text fragment to the right of the cursor is prepended to the field one
1434 line down. If there is no region, but you specify a prefix ARG, the
1435 current field is made blank, and the content is appended to the field
1436 above.
1438 @tsubheading{Calculations}
1439 @cindex formula, in tables
1440 @cindex calculations, in tables
1441 @cindex region, active
1442 @cindex active region
1443 @cindex transient-mark-mode
1444 @kindex C-c +
1445 @item C-c +
1446 Sum the numbers in the current column, or in the rectangle defined by
1447 the active region.  The result is shown in the echo area and can
1448 be inserted with @kbd{C-y}.
1450 @kindex S-@key{RET}
1451 @item S-@key{RET}
1452 When current field is empty, copy from first non-empty field above.
1453 When not empty, copy current field down to next row and move cursor
1454 along with it.  Depending on the variable
1455 @code{org-table-copy-increment}, integer field values will be
1456 incremented during copy.  This key is also used by CUA-mode
1457 (@pxref{Cooperation}).
1459 @tsubheading{Miscellaneous}
1460 @kindex C-c `
1461 @item C-c `
1462 Edit the current field in a separate window.  This is useful for fields
1463 that are not fully visible (@pxref{Narrow columns}).  When called with a
1464 @kbd{C-u} prefix, just make the full field visible, so that it can be
1465 edited in place.
1467 @item M-x org-table-import
1468 Import a file as a table.  The table should be TAB- or whitespace
1469 separated.  Useful, for example, to import a spreadsheet table or data
1470 from a database, because these programs generally can write
1471 TAB-separated text files.  This command works by inserting the file into
1472 the buffer and then converting the region to a table.  Any prefix
1473 argument is passed on to the converter, which uses it to determine the
1474 separator.
1475 @item C-c |
1476 Tables can also be imported by pasting tabular text into the org-mode
1477 buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
1478 @kbd{C-c |} command (see above under @i{Creation and conversion}.
1480 @item M-x org-table-export
1481 Export the table as a TAB-separated file.  Useful for data exchange with,
1482 for example, spreadsheet or database programs.
1483 @end table
1485 If you don't like the automatic table editor because it gets in your
1486 way on lines which you would like to start with @samp{|}, you can turn
1487 it off with
1489 @lisp
1490 (setq org-enable-table-editor nil)
1491 @end lisp
1493 @noindent Then the only table command that still works is
1494 @kbd{C-c C-c} to do a manual re-align.
1496 @node Narrow columns, Column groups, Built-in table editor, Tables
1497 @section Narrow columns
1498 @cindex narrow columns in tables
1500 The width of columns is automatically determined by the table editor.
1501 Sometimes a single field or a few fields need to carry more text,
1502 leading to inconveniently wide columns.  To limit@footnote{This feature
1503 does not work on XEmacs.} the width of a column, one field anywhere in
1504 the column may contain just the string @samp{<N>} where @samp{N} is an
1505 integer specifying the width of the column in characters.  The next
1506 re-align will then set the width of this column to no more than this
1507 value.
1509 @example
1510 @group
1511 |---+------------------------------|               |---+--------|
1512 |   |                              |               |   | <6>    |
1513 | 1 | one                          |               | 1 | one    |
1514 | 2 | two                          |     ----\     | 2 | two    |
1515 | 3 | This is a long chunk of text |     ----/     | 3 | This=> |
1516 | 4 | four                         |               | 4 | four   |
1517 |---+------------------------------|               |---+--------|
1518 @end group
1519 @end example
1521 @noindent
1522 Fields that are wider become clipped and end in the string @samp{=>}.
1523 Note that the full text is still in the buffer, it is only invisible.
1524 To see the full text, hold the mouse over the field - a tool-tip window
1525 will show the full content.  To edit such a field, use the command
1526 @kbd{C-c `} (that is @kbd{C-c} followed by the backquote).  This will
1527 open a new window with the full field.  Edit it and finish with @kbd{C-c
1528 C-c}.
1530 When visiting a file containing a table with narrowed columns, the
1531 necessary character hiding has not yet happened, and the table needs to
1532 be aligned before it looks nice.  Setting the option
1533 @code{org-startup-align-all-tables} will realign all tables in a file
1534 upon visiting, but also slow down startup.  You can also set this option
1535 on a per-file basis with:
1537 @example
1538 #+STARTUP: align
1539 #+STARTUP: noalign
1540 @end example
1542 @node Column groups, orgtbl-mode, Narrow columns, Tables
1543 @section Column groups
1544 @cindex grouping columns in tables
1546 When Org-mode exports tables, it does so by default without vertical
1547 lines because that is visually more satisfying in general.  Occasionally
1548 however, vertical lines can be useful to structure a table into groups
1549 of columns, much like horizontal lines can do for groups of rows.  In
1550 order to specify column groups, you can use a special row where the
1551 first field contains only @samp{/}.  The further fields can either
1552 contain @samp{<} to indicate that this column should start a group,
1553 @samp{>} to indicate the end of a column, or @samp{<>} to make a column
1554 a group of its own.  Boundaries between colum groups will upon export be
1555 marked with vertical lines.  Here is an example:
1557 @example
1558 |   |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1559 |---+----+-----+-----+-----+---------+------------|
1560 | / | <> |   < |     |   > |       < |          > |
1561 | # |  1 |   1 |   1 |   1 |       1 |          1 |
1562 | # |  2 |   4 |   8 |  16 |  1.4142 |     1.1892 |
1563 | # |  3 |   9 |  27 |  81 |  1.7321 |     1.3161 |
1564 |---+----+-----+-----+-----+---------+------------|
1565 #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
1566 @end example
1568 It is also sufficient to just insert the colum group starters after
1569 every vertical line you'd like to have:
1571 @example
1572 |  N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1573 |----+-----+-----+-----+---------+------------|
1574 | /  | <   |     |     | <       |            |
1575 @end example
1577 @node orgtbl-mode, The spreadsheet, Column groups, Tables
1578 @section The Orgtbl minor mode
1579 @cindex orgtbl-mode
1580 @cindex minor mode for tables
1582 If you like the intuitive way the Org-mode table editor works, you
1583 might also want to use it in other modes like text-mode or mail-mode.
1584 The minor mode Orgtbl-mode makes this possible.  You can always toggle
1585 the mode with @kbd{M-x orgtbl-mode}.  To turn it on by default, for
1586 example in mail mode, use
1588 @lisp
1589 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
1590 @end lisp
1592 Furthermore, with some special setup, it is possible to maintain tables
1593 in arbitrary syntax with Orgtbl-mode.  For example, it is possible to
1594 construct La@TeX{} tables with the underlying ease and power of
1595 Orgtbl-mode, including spreadsheet capabilities.  For details, see
1596 @ref{Tables in arbitrary syntax}.
1598 @node The spreadsheet,  , orgtbl-mode, Tables
1599 @section The spreadsheet
1600 @cindex calculations, in tables
1601 @cindex spreadsheet capabilities
1602 @cindex @file{calc} package
1604 The table editor makes use of the Emacs @file{calc} package to implement
1605 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms to
1606 derive fields from other fields.  While fully featured, Org-mode's
1607 implementation is not identical to other spreadsheets.  For example,
1608 Org-mode knows the concept of a @emph{column formula} that will be
1609 applied to all non-header fields in a column without having to copy the
1610 formula to each relevant field.
1612 @menu
1613 * References::                  How to refer to another field or range
1614 * Formula syntax for Calc::     Using Calc to compute stuff
1615 * Formula syntax for Lisp::     Writing formulas in Emacs Lisp
1616 * Field formulas::              Formulas valid for a single field
1617 * Column formulas::             Formulas valid for an entire column
1618 * Editing and debugging formulas::  Fixing formulas
1619 * Updating the table::          Recomputing all dependent fields
1620 * Advanced features::           Field names, parameters and automatic recalc
1621 @end menu
1623 @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
1624 @subsection References
1625 @cindex references
1627 To compute fields in the table from other fields, formulas must
1628 reference other fields or ranges.  In Org-mode, fields can be referenced
1629 by name, by absolute coordinates, and by relative coordinates.  To find
1630 out what the coordinates of a field are, press @kbd{C-c ?} in that
1631 field, or press @kbd{C-c @}} to toggle the display of a grid.
1633 @subsubheading Field references
1634 @cindex field references
1635 @cindex references, to fields
1637 Formulas can reference the value of another field in two ways.  Like in
1638 any other spreadsheet, you may reference fields with a letter/number
1639 combination like @code{B3}, meaning the 2nd field in the 3rd row.
1640 @c Such references are always fixed to that field, they don't change
1641 @c when you copy and paste a formula to a different field.  So
1642 @c Org-mode's @code{B3} behaves like @code{$B$3} in other spreadsheets.
1644 @noindent
1645 Org-mode also uses another, more general operator that looks like this:
1646 @example
1647 @@row$column
1648 @end example
1650 @noindent
1651 Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
1652 or relative to the current column like @samp{+1} or @samp{-2}.
1654 The row specification only counts data lines and ignores horizontal
1655 separator lines (hlines).  You can use absolute row numbers
1656 @samp{1}...@samp{N}, and row numbers relative to the current row like
1657 @samp{+3} or @samp{-1}.  Or specify the row relative to one of the
1658 hlines: @samp{I} refers to the first hline@footnote{Note that only
1659 hlines are counted that @emph{separate} table lines.  If the table
1660 starts with a hline above the header, it does not count.}, @samp{II} to
1661 the second etc.  @samp{-I} refers to the first such line above the
1662 current line, @samp{+I} to the first such line below the current line.
1663 You can also write @samp{III+2} which is the second data line after the
1664 third hline in the table.  Relative row numbers like @samp{-3} will not
1665 cross hlines if the current line is too close to the hline.  Instead,
1666 the value directly at the hline is used.
1668 @samp{0} refers to the current row and column.  Also, if you omit
1669 either the column or the row part of the reference, the current
1670 row/column is implied. 
1672 Org-mode's references with @emph{unsigned} numbers are fixed references
1673 in the sense that if you use the same reference in the formula for two
1674 different fields, the same field will be referenced each time.
1675 Org-mode's references with @emph{signed} numbers are floating
1676 references because the same reference operator can reference different
1677 fields depending on the field being calculated by the formula.
1679 Here are a few examples:
1681 @example
1682 @@2$3      @r{2nd row, 3rd column}
1683 C2        @r{same as previous}
1684 $5        @r{column 5 in the current row}
1685 E&        @r{same as previous}
1686 @@2        @r{current column, row 2}
1687 @@-1$-3    @r{the field one row up, three columns to the left}
1688 @@-I$2     @r{field just under hline above current row, column 2}
1689 @end example
1691 @subsubheading Range references
1692 @cindex range references
1693 @cindex references, to ranges
1695 You may reference a rectangular range of fields by specifying two field
1696 references connected by two dots @samp{..}.  If both fields are in the
1697 current row, you may simply use @samp{$2..$7}, but if at least one field
1698 is in a different row, you need to use the general @code{@@row$column}
1699 format at least for the first field (i.e the reference must start with
1700 @samp{@@} in order to be interpreted correctly).  Examples:
1702 @example
1703 $1..$3        @r{First three fields in the current row.}
1704 $P..$Q        @r{Range, using column names (see under Advanced)}
1705 @@2$1..@@4$3    @r{6 fields between these two fields.}
1706 A2..C4        @r{Same as above.}
1707 @@-1$-2..@@-1   @r{3 numbers from the column to the left, 2 up to current row}
1708 @end example
1710 @noindent Range references return a vector of values that can be fed
1711 into Calc vector functions.  Empty fields in ranges are normally
1712 suppressed, so that the vector contains only the non-empty fields (but
1713 see the @samp{E} mode switch below).  If there are no non-empty fields,
1714 @samp{[0]} is returned to avoid syntax errors in formulas.
1716 @subsubheading Named references
1717 @cindex named references
1718 @cindex references, named
1719 @cindex name, of column or field
1720 @cindex constants, in calculations
1722 @samp{$name} is interpreted as the name of a column, parameter or
1723 constant.  Constants are defined globally through the variable
1724 @code{org-table-formula-constants}, and locally (for the file) through a
1725 line like
1727 @example
1728 #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
1729 @end example
1731 @noindent
1732 Also properties (@pxref{Properties and columns}) can be used as
1733 constants in table formulas: For a property @samp{:Xyz:} use the name
1734 @samp{$PROP_Xyz}, and the property will be searched in the current
1735 outline entry and in the hierarchy above it.  If you have the
1736 @file{constants.el} package, it will also be used to resolve constants,
1737 including natural constants like @samp{$h} for Planck's constant, and
1738 units like @samp{$km} for kilometers@footnote{@file{Constant.el} can
1739 supply the values of constants in two different unit systems, @code{SI}
1740 and @code{cgs}.  Which one is used depends on the value of the variable
1741 @code{constants-unit-system}.  You can use the @code{#+STARTUP} options
1742 @code{constSI} and @code{constcgs} to set this value for the current
1743 buffer.}.  Column names and parameters can be specified in special table
1744 lines.  These are described below, see @ref{Advanced features}.  All
1745 names must start with a letter, and further consist of letters and
1746 numbers.
1748 @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
1749 @subsection Formula syntax for Calc
1750 @cindex formula syntax, Calc
1751 @cindex syntax, of formulas
1753 A formula can be any algebraic expression understood by the Emacs
1754 @file{Calc} package.  @b{Note that @file{calc} has the
1755 non-standard convention that @samp{/} has lower precedence than
1756 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.}  Before
1757 evaluation by @code{calc-eval} (@pxref{Calling Calc from
1758 Your Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU
1759 Emacs Calc Manual}),
1760 @c FIXME:  The link to the calc manual in HTML does not work.
1761 variable substitution takes place according to the rules described above.
1762 @cindex vectors, in table calculations
1763 The range vectors can be directly fed into the calc vector functions
1764 like @samp{vmean} and @samp{vsum}.
1766 @cindex format specifier
1767 @cindex mode, for @file{calc}
1768 A formula can contain an optional mode string after a semicolon.  This
1769 string consists of flags to influence Calc and other modes during
1770 execution.  By default, Org-mode uses the standard calc modes (precision
1771 12, angular units degrees, fraction and symbolic modes off.  The display
1772 format, however, has been changed to @code{(float 5)} to keep tables
1773 compact.  The default settings can be configured using the variable
1774 @code{org-calc-default-modes}.
1776 @example
1777 p20           @r{switch the internal precision to 20 digits}
1778 n3 s3 e2 f4   @r{normal, scientific, engineering, or fixed display format}
1779 D R           @r{angle modes: degrees, radians}
1780 F S           @r{fraction and symbolic modes}
1781 N             @r{interpret all fields as numbers, use 0 for non-numbers}
1782 T             @r{force text interpretation}
1783 E             @r{keep empty fields in ranges}
1784 @end example
1786 @noindent
1787 In addition, you may provide a @code{printf} format specifier to
1788 reformat the final result.  A few examples:
1790 @example
1791 $1+$2                @r{Sum of first and second field}
1792 $1+$2;%.2f           @r{Same, format result to two decimals}
1793 exp($2)+exp($1)      @r{Math functions can be used}
1794 $0;%.1f              @r{Reformat current cell to 1 decimal}
1795 ($3-32)*5/9          @r{Degrees F -> C conversion}
1796 $c/$1/$cm            @r{Hz -> cm conversion, using @file{constants.el}}
1797 tan($1);Dp3s1        @r{Compute in degrees, precision 3, display SCI 1}
1798 sin($1);Dp3%.1e      @r{Same, but use printf specifier for display}
1799 vmean($2..$7)        @r{Compute column range mean, using vector function}
1800 vmean($2..$7);EN     @r{Same, but treat empty fields as 0}
1801 taylor($3,x=7,2)     @r{taylor series of $3, at x=7, second degree}
1802 @end example
1804 Calc also contains a complete set of logical operations.  For example
1806 @example
1807 if($1<20,teen,string(""))  @r{``teen'' if age $1 less than 20, else empty}
1808 @end example
1810 @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
1811 @subsection Emacs Lisp forms as formulas
1812 @cindex Lisp forms, as table formulas
1814 It is also possible to write a formula in Emacs Lisp; this can be useful
1815 for string manipulation and control structures, if the Calc's
1816 functionality is not enough.  If a formula starts with a single quote
1817 followed by an opening parenthesis, then it is evaluated as a lisp form.
1818 The evaluation should return either a string or a number.  Just as with
1819 @file{calc} formulas, you can specify modes and a printf format after a
1820 semicolon.  With Emacs Lisp forms, you need to be concious about the way
1821 field references are interpolated into the form.  By default, a
1822 reference will be interpolated as a Lisp string (in double quotes)
1823 containing the field.  If you provide the @samp{N} mode switch, all
1824 referenced elements will be numbers (non-number fields will be zero) and
1825 interpolated as Lisp numbers, without quotes.  If you provide the
1826 @samp{L} flag, all fields will be interpolated literally, without quotes.
1827 I.e., if you want a reference to be interpreted as a string by the Lisp
1828 form, enclode the reference operator itself in double quotes, like
1829 @code{"$3"}.  Ranges are inserted as space-separated fields, so you can
1830 embed them in list or vector syntax.  A few examples, note how the
1831 @samp{N} mode is used when we do computations in lisp.
1833 @example
1834 @r{Swap the first two characters of the content of column 1}
1835   '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
1836 @r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
1837   '(+ $1 $2);N
1838 @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
1839   '(apply '+ '($1..$4));N
1840 @end example
1842 @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
1843 @subsection Field formulas
1844 @cindex field formula
1845 @cindex formula, for individual table field
1847 To assign a formula to a particular field, type it directly into the
1848 field, preceded by @samp{:=}, for example @samp{:=$1+$2}.  When you
1849 press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
1850 the field, the formula will be stored as the formula for this field,
1851 evaluated, and the current field replaced with the result.
1853 Formulas are stored in a special line starting with @samp{#+TBLFM:}
1854 directly below the table.  If you typed the equation in the 4th field of
1855 the 3rd data line in the table, the formula will look like
1856 @samp{@@3$4=$1+$2}.  When inserting/deleting/swapping column and rows
1857 with the appropriate commands, @i{absolute references} (but not relative
1858 ones) in stored formulas are modified in order to still reference the
1859 same field.  Of cause this is not true if you edit the table structure
1860 with normal editing commands - then you must fix the equations yourself.
1862 Instead of typing an equation into the field, you may also use the
1863 following command
1865 @table @kbd
1866 @kindex C-u C-c =
1867 @item C-u C-c =
1868 Install a new formula for the current field.  The command prompts for a
1869 formula, with default taken from the @samp{#+TBLFM:} line, applies
1870 it to the current field and stores it.
1871 @end table
1873 @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
1874 @subsection Column formulas
1875 @cindex column formula
1876 @cindex formula, for table column
1878 Often in a table, the same formula should be used for all fields in a
1879 particular column.  Instead of having to copy the formula to all fields
1880 in that column, org-mode allows to assign a single formula to an entire
1881 column.  If the table contains horizontal separator hlines, everything
1882 before the first such line is considered part of the table @emph{header}
1883 and will not be modified by column formulas.
1885 To assign a formula to a column, type it directly into any field in the
1886 column, preceded by an equal sign, like @samp{=$1+$2}.  When you press
1887 @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
1888 field, the formula will be stored as the formula for the current column,
1889 evaluated and the current field replaced with the result.  If the field
1890 contains only @samp{=}, the previously stored formula for this column is
1891 used.  For each column, Org-mode will only remember the most recently
1892 used formula.  In the @samp{TBLFM:} line, column formulas will look like
1893 @samp{$4=$1+$2}.
1895 Instead of typing an equation into the field, you may also use the
1896 following command:
1898 @table @kbd
1899 @kindex C-c =
1900 @item C-c =
1901 Install a new formula for the current column and replace current field
1902 with the result of the formula.  The command prompts for a formula, with
1903 default taken from the @samp{#+TBLFM} line, applies it to the current
1904 field and stores it.  With a numerical prefix (e.g. @kbd{C-5 C-c =})
1905 will apply it to that many consecutive fields in the current column.
1906 @end table
1909 @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
1910 @subsection Editing and Debugging formulas
1911 @cindex formula editing
1912 @cindex editing, of table formulas
1914 You can edit individual formulas in the minibuffer or directly in the
1915 field.  Org-mode can also prepare a special buffer with all active
1916 formulas of a table.  When offering a formula for editing, Org-mode
1917 converts references to the standard format (like @code{B3} or @code{D&})
1918 if possible.  If you prefer to only work with the internal format (like
1919 @code{@@3$2} or @code{$4}), configure the variable
1920 @code{org-table-use-standard-references}.
1922 @table @kbd
1923 @kindex C-c =
1924 @kindex C-u C-c =
1925 @item C-c =
1926 @itemx C-u C-c =
1927 Edit the formula associated with the current column/field in the
1928 minibuffer.  See @ref{Column formulas} and @ref{Field formulas}.
1929 @kindex C-u C-u C-c =
1930 @item C-u C-u C-c =
1931 Re-insert the active formula (either a
1932 field formula, or a column formula) into the current field, so that you
1933 can edit it directly in the field.  The advantage over editing in the
1934 minibuffer is that you can use the command @kbd{C-c ?}.
1935 @kindex C-c ?
1936 @item C-c ?
1937 While editing a formula in a table field, highlight the field(s)
1938 referenced by the reference at the cursor position in the formula.
1939 @kindex C-c @}
1940 @item C-c @}
1941 Toggle the display of row and column numbers for a table, using
1942 overlays.  These are updated each time the table is aligned, you can
1943 force it with @kbd{C-c C-c}.
1944 @kindex C-c @{
1945 @item C-c @{
1946 Toggle the formula debugger on and off.  See below.
1947 @kindex C-c '
1948 @item C-c '
1949 Edit all formulas for the current table in a special buffer, where the
1950 formulas will be displayed one per line.  If the current field has an
1951 active formula, the cursor in the formula editor will mark it.
1952 While inside the special buffer, Org-mode will automatically highlight
1953 any field or range reference at the cursor position.  You may edit,
1954 remove and add formulas, and use the following commands:
1955 @table @kbd
1956 @kindex C-c C-c
1957 @kindex C-x C-s
1958 @item C-c C-c
1959 @itemx C-x C-s
1960 Exit the formula editor and store the modified formulas.  With @kbd{C-u}
1961 prefix, also apply the new formulas to the entire table.
1962 @kindex C-c C-q
1963 @item C-c C-q
1964 Exit the formula editor without installing changes.
1965 @kindex C-c C-r
1966 @item C-c C-r
1967 Toggle all references in the formula editor between standard (like
1968 @code{B3}) and internal (like @code{@@3$2}).
1969 @kindex @key{TAB}
1970 @item @key{TAB}
1971 Pretty-print or indent lisp formula at point.  When in a line containing
1972 a lisp formula, format the formula according to Emacs Lisp rules.
1973 Another @key{TAB} collapses the formula back again.  In the open
1974 formula, @key{TAB} re-indents just like in Emacs-lisp-mode.
1975 @kindex M-@key{TAB}
1976 @item M-@key{TAB}
1977 Complete Lisp symbols, just like in Emacs-lisp-mode.
1978 @kindex S-@key{up}
1979 @kindex S-@key{down}
1980 @kindex S-@key{left}
1981 @kindex S-@key{right}
1982 @item S-@key{up}/@key{down}/@key{left}/@key{right}
1983 Shift the reference at point.  For example, if the reference is
1984 @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
1985 This also works for relative references, and for hline references.
1986 @kindex M-S-@key{up}
1987 @kindex M-S-@key{down}
1988 @item M-S-@key{up}/@key{down}
1989 Move the test line for column formulas in the Org-mode buffer up and
1990 down.
1991 @kindex M-@key{up}
1992 @kindex M-@key{down}
1993 @item M-@key{up}/@key{down}
1994 Scroll the window displaying the table.
1995 @kindex C-c @}
1996 @item C-c @}
1997 Turn the coordinate grid in the table on and off.
1998 @end table
1999 @end table
2001 Making a table field blank does not remove the formula associated with
2002 the field, because that is stored in a different line (the @samp{TBLFM}
2003 line) - during the next recalculation the field will be filled again.
2004 To remove a formula from a field, you have to give an empty reply when
2005 prompted for the formula, or to edit the @samp{#+TBLFM} line.
2007 @kindex C-c C-c
2008 You may edit the @samp{#+TBLFM} directly and re-apply the changed
2009 equations with @kbd{C-c C-c} in that line, or with the normal
2010 recalculation commands in the table.
2012 @subsubheading Debugging formulas
2013 @cindex formula debugging
2014 @cindex debugging, of table formulas
2015 When the evaluation of a formula leads to an error, the field content
2016 becomes the string @samp{#ERROR}.  If you would like see what is going
2017 on during variable substitution and calculation in order to find a bug,
2018 turn on formula debugging in the @code{Tbl} menu and repeat the
2019 calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
2020 field.  Detailed information will be displayed.
2022 @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
2023 @subsection Updating the Table
2024 @cindex recomputing table fields
2025 @cindex updating, table
2027 Recalculation of a table is normally not automatic, but needs to be
2028 triggered by a command.  See @ref{Advanced features} for a way to make
2029 recalculation at least semi-automatically.
2031 In order to recalculate a line of a table or the entire table, use the
2032 following commands:
2034 @table @kbd
2035 @kindex C-c *
2036 @item C-c *
2037 Recalculate the current row by first applying the stored column formulas
2038 from left to right, and all field formulas in the current row.
2040 @kindex C-u C-c *
2041 @item C-u C-c *
2042 @kindex C-u C-c C-c
2043 @itemx C-u C-c C-c
2044 Recompute the entire table, line by line.  Any lines before the first
2045 hline are left alone, assuming that these are part of the table header.
2047 @kindex C-u C-u C-c *
2048 @kindex C-u C-u C-c C-c
2049 @item C-u C-u C-c *
2050 @itemx C-u C-u C-c C-c
2051 Iterate the table by recomputing it until no further changes occur.
2052 This may be necessary if some computed fields use the value of other
2053 fields that are computed @i{later} in the calculation sequence.
2054 @end table
2056 @node Advanced features,  , Updating the table, The spreadsheet
2057 @subsection Advanced features
2059 If you want the recalculation of fields to happen automatically, or if
2060 you want to be able to assign @i{names} to fields and columns, you need
2061 to reserve the first column of the table for special marking characters.
2062 @table @kbd
2063 @kindex C-#
2064 @item C-#
2065 Rotate the calculation mark in first column through the states @samp{},
2066 @samp{#}, @samp{*}, @samp{!}, @samp{$}.  The meaning of these characters
2067 is discussed below.  When there is an active region, change all marks in
2068 the region.
2069 @end table
2071 Here is an example of a table that collects exam results of students and
2072 makes use of these features:
2074 @example
2075 @group
2076 |---+---------+--------+--------+--------+-------+------|
2077 |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2078 |---+---------+--------+--------+--------+-------+------|
2079 | ! |         |     P1 |     P2 |     P3 |   Tot |      |
2080 | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
2081 | ^ |         |     m1 |     m2 |     m3 |    mt |      |
2082 |---+---------+--------+--------+--------+-------+------|
2083 | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
2084 | # | Sara    |      6 |     14 |     19 |    39 |  7.8 |
2085 | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
2086 |---+---------+--------+--------+--------+-------+------|
2087 |   | Average |        |        |        |  29.7 |      |
2088 | ^ |         |        |        |        |    at |      |
2089 | $ | max=50  |        |        |        |       |      |
2090 |---+---------+--------+--------+--------+-------+------|
2091 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
2092 @end group
2093 @end example
2095 @noindent @b{Important}: Please note that for these special tables,
2096 recalculating the table with @kbd{C-u C-c *} will only affect rows that
2097 are marked @samp{#} or @samp{*}, and fields that have a formula assigned
2098 to the field itself.  The column formulas are not applied in rows with
2099 empty first field.
2101 @cindex marking characters, tables
2102 The marking characters have the following meaning:
2103 @table @samp
2104 @item !
2105 The fields in this line define names for the columns, so that you may
2106 refer to a column as @samp{$Tot} instead of @samp{$6}.
2107 @item ^
2108 This row defines names for the fields @emph{above} the row.  With such
2109 a definition, any formula in the table may use @samp{$m1} to refer to
2110 the value @samp{10}.  Also, if you assign a formula to a names field, it
2111 will be stored as @samp{$name=...}.
2112 @item _
2113 Similar to @samp{^}, but defines names for the fields in the row
2114 @emph{below}.
2115 @item $
2116 Fields in this row can define @emph{parameters} for formulas.  For
2117 example, if a field in a @samp{$} row contains @samp{max=50}, then
2118 formulas in this table can refer to the value 50 using @samp{$max}.
2119 Parameters work exactly like constants, only that they can be defined on
2120 a per-table basis.
2121 @item #
2122 Fields in this row are automatically recalculated when pressing
2123 @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row.  Also, this row
2124 is selected for a global recalculation with @kbd{C-u C-c *}.  Unmarked
2125 lines will be left alone by this command.
2126 @item *
2127 Selects this line for global recalculation with @kbd{C-u C-c *}, but
2128 not for automatic recalculation.  Use this when automatic
2129 recalculation slows down editing too much.
2130 @item
2131 Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
2132 All lines that should be recalculated should be marked with @samp{#}
2133 or @samp{*}.
2134 @item /
2135 Do not export this line.  Useful for lines that contain the narrowing
2136 @samp{<N>} markers.
2137 @end table
2139 Finally, just to whet your appetite on what can be done with the
2140 fantastic @file{calc} package, here is a table that computes the Taylor
2141 series of degree @code{n} at location @code{x} for a couple of
2142 functions.
2144 @example
2145 @group
2146 |---+-------------+---+-----+--------------------------------------|
2147 |   | Func        | n | x   | Result                               |
2148 |---+-------------+---+-----+--------------------------------------|
2149 | # | exp(x)      | 1 | x   | 1 + x                                |
2150 | # | exp(x)      | 2 | x   | 1 + x + x^2 / 2                      |
2151 | # | exp(x)      | 3 | x   | 1 + x + x^2 / 2 + x^3 / 6            |
2152 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2153 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2    |
2154 | * | tan(x)      | 3 | x   | 0.0175 x + 1.77e-6 x^3               |
2155 |---+-------------+---+-----+--------------------------------------|
2156 #+TBLFM: $5=taylor($2,$4,$3);n3
2157 @end group
2158 @end example
2160 @node Hyperlinks, TODO items, Tables, Top
2161 @chapter Hyperlinks
2162 @cindex hyperlinks
2164 Like HTML, Org-mode provides links inside a file, external links to
2165 other files, Usenet articles, emails, and much more.
2167 @menu
2168 * Link format::                 How links in Org-mode are formatted
2169 * Internal links::              Links to other places in the current file
2170 * External links::              URL-like links to the world
2171 * Handling links::              Creating, inserting and following
2172 * Using links outside Org-mode::  Linking from my C source code?
2173 * Link abbreviations::          Shortcuts for writing complex links
2174 * Search options::              Linking to a specific location
2175 * Custom searches::             When the default search is not enough
2176 @end menu
2178 @node Link format, Internal links, Hyperlinks, Hyperlinks
2179 @section Link format
2180 @cindex link format
2181 @cindex format, of links
2183 Org-mode will recognize plain URL-like links and activate them as
2184 clickable links.  The general link format, however, looks like this:
2186 @example
2187 [[link][description]]       @r{or alternatively}           [[link]]  
2188 @end example
2190 Once a link in the buffer is complete (all brackets present), Org-mode
2191 will change the display so that @samp{description} is displayed instead
2192 of @samp{[[link][description]]} and @samp{link} is displayed instead of
2193 @samp{[[link]]}.  Links will be highlighted in the face @code{org-link},
2194 which by default is an underlined face.  You can directly edit the
2195 visible part of a link.  Note that this can be either the @samp{link}
2196 part (if there is no description) or the @samp{description} part.  To
2197 edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
2198 cursor on the link.
2200 If you place the cursor at the beginning or just behind the end of the
2201 displayed text and press @key{BACKSPACE}, you will remove the
2202 (invisible) bracket at that location.  This makes the link incomplete
2203 and the internals are again displayed as plain text.  Inserting the
2204 missing bracket hides the link internals again.  To show the
2205 internal structure of all links, use the menu entry
2206 @code{Org->Hyperlinks->Literal links}.
2208 @node Internal links, External links, Link format, Hyperlinks
2209 @section Internal links
2210 @cindex internal links
2211 @cindex links, internal
2212 @cindex targets, for links
2214 If the link does not look like a URL, it is considered to be internal in
2215 the current file.  Links such as @samp{[[My Target]]} or @samp{[[My
2216 Target][Find my target]]} lead to a text search in the current file.
2217 The link can be followed with @kbd{C-c C-o} when the cursor is on the
2218 link, or with a mouse click (@pxref{Handling links}).  The preferred
2219 match for such a link is a dedicated target: the same string in double
2220 angular brackets.  Targets may be located anywhere; sometimes it is
2221 convenient to put them into a comment line. For example
2223 @example
2224 # <<My Target>>
2225 @end example
2227 @noindent In HTML export (@pxref{HTML export}), such targets will become
2228 named anchors for direct access through @samp{http} links@footnote{Note
2229 that text before the first headline is usually not exported, so the
2230 first such target should be after the first headline.}.
2232 If no dedicated target exists, Org-mode will search for the words in the
2233 link.  In the above example the search would be for @samp{my target}.
2234 Links starting with a star like @samp{*My Target} restrict the search to
2235 headlines.  When searching, Org-mode will first try an exact match, but
2236 then move on to more and more lenient searches.  For example, the link
2237 @samp{[[*My Targets]]} will find any of the following:
2239 @example
2240 ** My targets
2241 ** TODO my targets are bright
2242 ** my 20 targets are
2243 @end example
2245 To insert a link targeting a headline, in-buffer completion can be used.
2246 Just type a star followed by a few optional letters into the buffer and
2247 press @kbd{M-@key{TAB}}.  All headlines in the current buffer will be
2248 offered as completions.  @xref{Handling links}, for more commands
2249 creating links.
2251 Following a link pushes a mark onto Org-mode's own mark ring.  You can
2252 return to the previous position with @kbd{C-c &}.  Using this command
2253 several times in direct succession goes back to positions recorded
2254 earlier.
2256 @menu
2257 * Radio targets::               Make targets trigger links in plain text.
2258 @end menu
2260 @node Radio targets,  , Internal links, Internal links
2261 @subsection Radio targets
2262 @cindex radio targets
2263 @cindex targets, radio
2264 @cindex links, radio targets
2266 Org-mode can automatically turn any occurrences of certain target names
2267 in normal text into a link.  So without explicitly creating a link, the
2268 text connects to the target radioing its position.  Radio targets are
2269 enclosed by triple angular brackets.  For example, a target @samp{<<<My
2270 Target>>>} causes each occurrence of @samp{my target} in normal text to
2271 become activated as a link.  The Org-mode file is scanned automatically
2272 for radio targets only when the file is first loaded into Emacs.  To
2273 update the target list during editing, press @kbd{C-c C-c} with the
2274 cursor on or at a target.
2276 @node External links, Handling links, Internal links, Hyperlinks
2277 @section External links
2278 @cindex links, external
2279 @cindex external links
2280 @cindex links, external
2281 @cindex GNUS links
2282 @cindex BBDB links
2283 @cindex IRC links
2284 @cindex URL links
2285 @cindex file links
2286 @cindex VM links
2287 @cindex RMAIL links
2288 @cindex WANDERLUST links
2289 @cindex MH-E links
2290 @cindex USENET links
2291 @cindex SHELL links
2292 @cindex Info links
2293 @cindex elisp links
2295 Org-mode supports links to files, websites, Usenet and email messages,
2296 BBDB database entries and links to both IRC conversations and their
2297 logs.  External links are URL-like locators.  They start with a short
2298 identifying string followed by a colon.  There can be no space after
2299 the colon.  The following list shows examples for each link type.
2301 @example
2302 http://www.astro.uva.nl/~dominik          @r{on the web}
2303 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
2304 file:papers/last.pdf                      @r{file, relative path}
2305 news:comp.emacs                           @r{Usenet link}
2306 mailto:adent@@galaxy.net                  @r{Mail link}
2307 vm:folder                                 @r{VM folder link}
2308 vm:folder#id                              @r{VM message link}
2309 vm://myself@@some.where.org/folder#id     @r{VM on remote machine}
2310 wl:folder                                 @r{WANDERLUST folder link}
2311 wl:folder#id                              @r{WANDERLUST message link}
2312 mhe:folder                                @r{MH-E folder link}
2313 mhe:folder#id                             @r{MH-E message link}
2314 rmail:folder                              @r{RMAIL folder link}
2315 rmail:folder#id                           @r{RMAIL message link}
2316 gnus:group                                @r{GNUS group link}
2317 gnus:group#id                             @r{GNUS article link}
2318 bbdb:Richard Stallman                     @r{BBDB link}
2319 irc:/irc.com/#emacs/bob                   @r{IRC link}
2320 shell:ls *.org                            @r{A shell command}
2321 elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
2322 @end example
2324 A link should be enclosed in double brackets and may contain a
2325 descriptive text to be displayed instead of the url (@pxref{Link
2326 format}), for example:
2328 @example
2329 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
2330 @end example
2332 @noindent
2333 If the description is a file name or URL that points to an image, HTML
2334 export (@pxref{HTML export}) will inline the image as a clickable
2335 button.  If there is no description at all and the link points to an
2336 image,
2337 that image will be inlined into the exported HTML file.
2339 @cindex angular brackets, around links
2340 @cindex plain text external links
2341 Org-mode also finds external links in the normal text and activates them
2342 as links.  If spaces must be part of the link (for example in
2343 @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
2344 about the end of the link, enclose them in angular brackets.
2346 @node Handling links, Using links outside Org-mode, External links, Hyperlinks
2347 @section Handling links
2348 @cindex links, handling
2350 Org-mode provides methods to create a link in the correct syntax, to
2351 insert it into an org-mode file, and to follow the link.
2353 @table @kbd
2354 @kindex C-c l
2355 @cindex storing links
2356 @item C-c l
2357 Store a link to the current location.  This is a @emph{global} command
2358 which can be used in any buffer to create a link.  The link will be
2359 stored for later insertion into an Org-mode buffer (see below).  For
2360 Org-mode files, if there is a @samp{<<target>>} at the cursor, the
2361 link points to the target.  Otherwise it points to the current
2362 headline.  For VM, RMAIL, WANDERLUST, MH-E, GNUS and BBDB buffers, the
2363 link will indicate the current article/entry.  For W3 and W3M buffers,
2364 the link goes to the current URL.  For IRC links, if you set the
2365 variable @code{org-irc-link-to-logs} to non-nil then @kbd{C-c l} will
2366 store a @samp{file:/} style link to the relevant point in the logs for
2367 the current conversation. Otherwise an @samp{irc:/} style link to the
2368 user/channel/server under the point will be stored.  For any other
2369 files, the link will point to the file, with a search string
2370 (@pxref{Search options}) pointing to the contents of the current line.
2371 If there is an active region, the selected words will form the basis
2372 of the search string.  If the automatically created link is not
2373 working correctly or accurately enough, you can write custom functions
2374 to select the search string and to do the search for particular file
2375 types - see @ref{Custom searches}.  The key binding @kbd{C-c l} is
2376 only a suggestion - see @ref{Installation}.
2378 @kindex C-c C-l
2379 @cindex link completion
2380 @cindex completion, of links
2381 @cindex inserting links
2382 @item C-c C-l
2383 Insert a link.  This prompts for a link to be inserted into the buffer.
2384 You can just type a link, using text for an internal link, or one of the
2385 link type prefixes mentioned in the examples above.  All links stored
2386 during the current session are part of the history for this prompt, so
2387 you can access them with @key{up} and @key{down} (or @kbd{M-p/n}).
2388 Completion, on the other hand, will help you to insert valid link
2389 prefixes like @samp{http:} or @samp{ftp:}, including the prefixes
2390 defined through link abbreviations (@pxref{Link abbreviations}).  The
2391 link will be inserted into the buffer@footnote{After insertion of a
2392 stored link, the link will be removed from the list of stored links.  To
2393 keep it in the list later use, use a triple @kbd{C-u} prefix to @kbd{C-c
2394 C-l}, or configure the option
2395 @code{org-keep-stored-link-after-insertion}.}, along with a descriptive
2396 text.  If some text was selected when this command is called, the
2397 selected text becomes the default description.@* Note that you don't
2398 have to use this command to insert a link.  Links in Org-mode are plain
2399 text, and you can type or paste them straight into the buffer.  By using
2400 this command, the links are automatically enclosed in double brackets,
2401 and you will be asked for the optional descriptive text.
2403 @c  If the link is a @samp{file:} link and
2404 @c the linked file is located in the same directory as the current file or
2405 @c a subdirectory of it, the path of the file will be inserted relative to
2406 @c the current directory.
2408 @kindex C-u C-c C-l
2409 @cindex file name completion
2410 @cindex completion, of file names
2411 @item C-u C-c C-l
2412 When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
2413 a file will be inserted and you may use file name completion to select
2414 the name of the file.  The path to the file is inserted relative to the
2415 directory of the current org file, if the linked file is in the current
2416 directory or in a subdirectory of it, or if the path is written relative
2417 to the current directory using @samp{../}.  Otherwise an absolute path
2418 is used, if possible with @samp{~/} for your home directory.  You can
2419 force an absolute path with two @kbd{C-u} prefixes.
2421 @item C-c C-l @r{(with cursor on existing link)}
2422 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
2423 link and description parts of the link.
2425 @cindex following links
2426 @kindex C-c C-o
2427 @item C-c C-o
2428 Open link at point.  This will launch a web browser for URLs (using
2429 @command{browse-url-at-point}), run vm/mh-e/wanderlust/rmail/gnus/bbdb
2430 for the corresponding links, and execute the command in a shell link.
2431 When the cursor is on an internal link, this commands runs the
2432 corresponding search.  When the cursor is on a TAG list in a headline,
2433 it creates the corresponding TAGS view.  If the cursor is on a time
2434 stamp, it compiles the agenda for that date.  Furthermore, it will visit
2435 text and remote files in @samp{file:} links with Emacs and select a
2436 suitable application for local non-text files.  Classification of files
2437 is based on file extension only.  See option @code{org-file-apps}.  If
2438 you want to override the default application and visit the file with
2439 Emacs, use a @kbd{C-u} prefix.
2441 @kindex mouse-2
2442 @kindex mouse-1
2443 @item mouse-2
2444 @itemx mouse-1
2445 On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
2446 would.  Under Emacs 22, also @kbd{mouse-1} will follow a link.
2448 @kindex mouse-3
2449 @item mouse-3
2450 Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
2451 internal links to be displayed in another window@footnote{See the
2452 variable @code{org-display-internal-link-with-indirect-buffer}}.
2454 @cindex mark ring
2455 @kindex C-c %
2456 @item C-c %
2457 Push the current position onto the mark ring, to be able to return
2458 easily. Commands following an internal link do this automatically.
2460 @cindex links, returning to
2461 @kindex C-c &
2462 @item C-c &
2463 Jump back to a recorded position.  A position is recorded by the
2464 commands following internal links, and by @kbd{C-c %}.  Using this
2465 command several times in direct succession moves through a ring of
2466 previously recorded positions.
2468 @kindex C-c C-x C-n
2469 @kindex C-c C-x C-p
2470 @cindex links, finding next/previous
2471 @item C-c C-x C-n
2472 @itemx C-c C-x C-p
2473 Move forward/backward to the next link in the buffer.  At the limit of
2474 the buffer, the search fails once, and then wraps around.  The key
2475 bindings for this are really too long, you might want to bind this also
2476 to @kbd{C-n} and @kbd{C-p}
2477 @lisp
2478 (add-hook 'org-load-hook
2479   (lambda ()
2480     (define-key 'org-mode-map "\C-n" 'org-next-link)
2481     (define-key 'org-mode-map "\C-p" 'org-previous-link)))
2482 @end lisp
2483 @end table
2485 @node Using links outside Org-mode, Link abbreviations, Handling links, Hyperlinks
2486 @section Using links outside Org-mode
2488 You can insert and follow links that have Org-mode syntax not only in
2489 Org-mode, but in any Emacs buffer.  For this, you should create two
2490 global commands, like this (please select suitable global keys
2491 yourself):
2493 @lisp
2494 (global-set-key "\C-c L" 'org-insert-link-global)
2495 (global-set-key "\C-c o" 'org-open-at-point-global)
2496 @end lisp
2498 @node Link abbreviations, Search options, Using links outside Org-mode, Hyperlinks
2499 @section Link abbreviations
2500 @cindex link abbreviations
2501 @cindex abbreviation, links
2503 Long URLs can be cumbersome to type, and often many similar links are
2504 needed in a document.  For this you can use link abbreviations.  An
2505 abbreviated link looks like this
2507 @example
2508 [[linkword:tag][description]]
2509 @end example
2511 @noindent
2512 where the tag is optional.  Such abbreviations are resolved according to
2513 the information in the variable @code{org-link-abbrev-alist} that
2514 relates the linkwords to replacement text.  Here is an example:
2516 @lisp
2517 @group
2518 (setq org-link-abbrev-alist
2519   '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
2520     ("google"   . "http://www.google.com/search?q=")
2521     ("ads"      . "http://adsabs.harvard.edu/cgi-bin/
2522                    nph-abs_connect?author=%s&db_key=AST")))
2523 @end group
2524 @end lisp
2526 If the replacement text contains the string @samp{%s}, it will be
2527 replaced with the tag.  Otherwise the tag will be appended to the string
2528 in order to create the link.  You may also specify a function that will
2529 be called with the tag as the only argument to create the link.
2531 With the above setting, you could link to a specific bug with
2532 @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
2533 @code{[[google:OrgMode]]} and find out what the Org-mode author is
2534 doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
2536 If you need special abbreviations just for a single Org-mode buffer, you
2537 can define them in the file with
2539 @example
2540 #+LINK: bugzilla  http://10.1.2.9/bugzilla/show_bug.cgi?id=
2541 #+LINK: google    http://www.google.com/search?q=%s
2542 @end example
2544 @noindent
2545 In-buffer completion @pxref{Completion} can be used after @samp{[} to
2546 complete link abbreviations.
2548 @node Search options, Custom searches, Link abbreviations, Hyperlinks
2549 @section Search options in file links
2550 @cindex search option in file links
2551 @cindex file links, searching
2553 File links can contain additional information to make Emacs jump to a
2554 particular location in the file when following a link.  This can be a
2555 line number or a search option after a double@footnote{For backward
2556 compatibility, line numbers can also follow a single colon.} colon. For
2557 example, when the command @kbd{C-c l} creates a link (@pxref{Handling
2558 links}) to a file, it encodes the words in the current line as a search
2559 string that can be used to find this line back later when following the
2560 link with @kbd{C-c C-o}. 
2562 Here is the syntax of the different ways to attach a search to a file
2563 link, together with an explanation:
2565 @example
2566 [[file:~/code/main.c::255]]
2567 [[file:~/xx.org::My Target]]
2568 [[file:~/xx.org::*My Target]]
2569 [[file:~/xx.org::/regexp/]]
2570 @end example
2572 @table @code
2573 @item 255
2574 Jump to line 255.
2575 @item My Target
2576 Search for a link target @samp{<<My Target>>}, or do a text search for
2577 @samp{my target}, similar to the search in internal links, see
2578 @ref{Internal links}.  In HTML export (@pxref{HTML export}), such a file
2579 link will become an HTML reference to the corresponding named anchor in
2580 the linked file.
2581 @item *My Target
2582 In an Org-mode file, restrict search to headlines.
2583 @item /regexp/
2584 Do a regular expression search for @code{regexp}.  This uses the Emacs
2585 command @code{occur} to list all matches in a separate window.  If the
2586 target file is in Org-mode, @code{org-occur} is used to create a
2587 sparse tree with the matches.
2588 @c If the target file is a directory,
2589 @c @code{grep} will be used to search all files in the directory.
2590 @end table
2592 As a degenerate case, a file link with an empty file name can be used
2593 to search the current file.  For example, @code{[[file:::find me]]} does
2594 a search for @samp{find me} in the current file, just as
2595 @samp{[[find me]]} would.
2597 @node Custom searches,  , Search options, Hyperlinks
2598 @section Custom Searches
2599 @cindex custom search strings
2600 @cindex search strings, custom
2602 The default mechanism for creating search strings and for doing the
2603 actual search related to a file link may not work correctly in all
2604 cases.  For example, BibTeX database files have many entries like
2605 @samp{year="1993"} which would not result in good search strings,
2606 because the only unique identification for a BibTeX entry is the
2607 citation key.
2609 If you come across such a problem, you can write custom functions to set
2610 the right search string for a particular file type, and to do the search
2611 for the string in the file.  Using @code{add-hook}, these functions need
2612 to be added to the hook variables
2613 @code{org-create-file-search-functions} and
2614 @code{org-execute-file-search-functions}.  See the docstring for these
2615 variables for more information.  Org-mode actually uses this mechanism
2616 for Bib@TeX{} database files, and you can use the corresponding code as
2617 an implementation example.  Search for @samp{BibTeX links} in the source
2618 file.
2622 @node TODO items, Tags, Hyperlinks, Top
2623 @chapter TODO items
2624 @cindex TODO items
2626 Org-mode does not maintain TODO lists as separate documents.  Instead,
2627 TODO items are an integral part of the notes file, because TODO items
2628 usually come up while taking notes!  With Org-mode, simply mark any
2629 entry in a tree as being a TODO item.  In this way, information is not
2630 duplicated, and the entire context from which the TODO item emerged is
2631 always present.
2633 Of course, this technique for managing TODO items scatters them
2634 throughout your notes file.  Org-mode compensates for this by providing
2635 methods to give you an overview of all the things that you have to do.
2637 @menu
2638 * TODO basics::                 Marking and displaying TODO entries
2639 * TODO extensions::             Workflow and assignments
2640 * Progress logging::            Dates and notes for progress
2641 * Priorities::                  Some things are more important than others
2642 * Breaking down tasks::         Splitting a task into manageable pieces
2643 * Checkboxes::                  Tick-off lists
2644 @end menu
2646 @node TODO basics, TODO extensions, TODO items, TODO items
2647 @section Basic TODO functionality
2649 Any headline becomes a TODO item when it starts with the word
2650 @samp{TODO}, for example:
2652 @example
2653 *** TODO Write letter to Sam Fortune
2654 @end example
2656 @noindent
2657 The most important commands to work with TODO entries are:
2659 @table @kbd
2660 @kindex C-c C-t
2661 @cindex cycling, of TODO states
2662 @item C-c C-t
2663 Rotate the TODO state of the current item among
2665 @example
2666 ,-> (unmarked) -> TODO -> DONE --.
2667 '--------------------------------'
2668 @end example
2670 The same rotation can also be done ``remotely'' from the timeline and
2671 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
2673 @kindex C-u C-c C-t
2674 @item C-u C-c C-t
2675 Select a specific keyword using completion or (if it has been set up)
2676 the fast selection interface.  For the latter, you need to assign keys
2677 to TODO states, see @ref{Per-file keywords} and @ref{Setting tags} for
2678 more information.
2680 @kindex S-@key{right}
2681 @kindex S-@key{left}
2682 @item S-@key{right}
2683 @itemx S-@key{left}
2684 Select the following/preceding TODO state, similar to cycling.  Useful
2685 mostly if more than two TODO states are possible (@pxref{TODO
2686 extensions}).
2687 @kindex C-c C-v
2688 @kindex C-c / t
2689 @cindex sparse tree, for TODO
2690 @item C-c C-v
2691 @itemx C-c / t
2692 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
2693 the entire buffer, but shows all TODO items and the headings hierarchy
2694 above them.  With prefix arg, search for a specific TODO.  You will be
2695 prompted for the keyword, and you can also give a list of keywords like
2696 @code{KWD1|KWD2|...}.  With numerical prefix N, show the tree for the
2697 Nth keyword in the variable @code{org-todo-keywords}.  With two prefix
2698 args, find all TODO and DONE entries.
2699 @kindex C-c a t
2700 @item C-c a t
2701 Show the global TODO list.  Collects the TODO items from all agenda
2702 files (@pxref{Agenda views}) into a single buffer.  The new buffer will
2703 be in @code{agenda-mode}, which provides commands to examine and
2704 manipulate the TODO entries from the new buffer (@pxref{Agenda
2705 commands}).  @xref{Global TODO list}, for more information.
2706 @kindex S-M-@key{RET}
2707 @item S-M-@key{RET}
2708 Insert a new TODO entry below the current one.
2709 @end table
2711 @node TODO extensions, Progress logging, TODO basics, TODO items
2712 @section Extended use of TODO keywords
2713 @cindex extended TODO keywords
2715 By default, marked TODO entries have one of only two states: TODO and
2716 DONE.  Org-mode allows you to classify TODO items in more complex ways
2717 with @emph{TODO keywords} (stored in @code{org-todo-keywords}).  With
2718 special setup, the TODO keyword system can work differently in different
2719 files.
2721 Note that @i{tags} are another way to classify headlines in general and
2722 TODO items in particular (@pxref{Tags}).
2724 @menu
2725 * Workflow states::             From TODO to DONE in steps
2726 * TODO types::                  I do this, Fred does the rest
2727 * Multiple sets in one file::   Mixing it all, and still finding your way
2728 * Fast access to TODO states::  Single letter selection of a state
2729 * Per-file keywords::           Different files, different requirements
2730 * Faces for TODO keywords::     Highlighting states
2731 @end menu
2733 @node Workflow states, TODO types, TODO extensions, TODO extensions
2734 @subsection TODO keywords as workflow states
2735 @cindex TODO workflow
2736 @cindex workflow states as TODO keywords
2738 You can use TODO keywords to indicate different @emph{sequential} states
2739 in the process of working on an item, for example@footnote{Changing
2740 this variable only becomes effective after restarting Org-mode in a
2741 buffer.}:
2743 @lisp
2744 (setq org-todo-keywords
2745   '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
2746 @end lisp
2748 The vertical bar separates the TODO keywords (states that @emph{need
2749 action}) from the DONE states (which need @emph{no further action}.  If
2750 you don't provide the separator bar, the last state is used as the DONE
2751 state.
2752 @cindex completion, of TODO keywords
2753 With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
2754 to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED.  You may
2755 also use a prefix argument to quickly select a specific state.  For
2756 example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
2757 Or you can use @kbd{S-left} to go backward through the sequence.  If you
2758 define many keywords, you can use in-buffer completion
2759 (@pxref{Completion}) or even a special one-key selection scheme
2760 (@pxref{Fast access to TODO states}) to insert these words into the
2761 buffer.  Changing a todo state can be logged with a timestamp, see
2762 @ref{Tracking TODO state changes} for more information.
2764 @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
2765 @subsection TODO keywords as types
2766 @cindex TODO types
2767 @cindex names as TODO keywords
2768 @cindex types as TODO keywords
2770 The second possibility is to use TODO keywords to indicate different
2771 @emph{types} of action items.  For example, you might want to indicate
2772 that items are for ``work'' or ``home''.  Or, when you work with several
2773 people on a single project, you might want to assign action items
2774 directly to persons, by using their names as TODO keywords.  This would
2775 be set up like this:
2777 @lisp
2778 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
2779 @end lisp
2781 In this case, different keywords do not indicate a sequence, but rather
2782 different types.  So the normal work flow would be to assign a task to a
2783 person, and later to mark it DONE.  Org-mode supports this style by
2784 adapting the workings of the command @kbd{C-c C-t}@footnote{This is also
2785 true for the @kbd{t} command in the timeline and agenda buffers.}.  When
2786 used several times in succession, it will still cycle through all names,
2787 in order to first select the right type for a task.  But when you return
2788 to the item after some time and execute @kbd{C-c C-t} again, it will
2789 switch from any name directly to DONE.  Use prefix arguments or
2790 completion to quickly select a specific name.  You can also review the
2791 items of a specific TODO type in a sparse tree by using a numeric prefix
2792 to @kbd{C-c C-v}.  For example, to see all things Lucy has to do, you
2793 would use @kbd{C-3 C-c C-v}.  To collect Lucy's items from all agenda
2794 files into a single buffer, you would use the prefix arg as well when
2795 creating the global todo list: @kbd{C-3 C-c t}.
2797 @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
2798 @subsection Multiple keyword sets in one file
2799 @cindex todo keyword sets
2801 Sometimes you may want to use different sets of TODO keywords in
2802 parallel.  For example, you may want to have the basic
2803 @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
2804 separate state indicating that an item has been canceled (so it is not
2805 DONE, but also does not require action).  Your setup would then look
2806 like this:
2808 @lisp
2809 (setq org-todo-keywords
2810       '((sequence "TODO" "|" "DONE")
2811         (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
2812         (sequence "|" "CANCELED")))
2813 @end lisp
2815 The keywords should all be different, this helps Org-mode to keep track
2816 of which subsequence should be used for a given entry.  In this setup,
2817 @kbd{C-c C-t} only operates within a subsequence, so it switches from
2818 @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
2819 (nothing) to @code{REPORT}.  Therefore you need a mechanism to initially
2820 select the correct sequence.  Besides the obvious ways like typing a
2821 keyword or using completion, you may also apply the following commands:
2823 @table @kbd
2824 @kindex C-S-@key{right}
2825 @kindex C-S-@key{left}
2826 @item C-S-@key{right}
2827 @itemx C-S-@key{left}
2828 These keys jump from one TODO subset to the next.  In the above example,
2829 @kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
2830 @code{REPORT}, and any of the words in the second row to @code{CANCELED}.
2831 @kindex S-@key{right}
2832 @kindex S-@key{left}
2833 @item S-@key{right}
2834 @itemx S-@key{left}
2835 @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
2836 @emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
2837 would switch from @code{DONE} to @code{REPORT} in the example above.
2838 @end table
2840 @node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
2841 @subsection Fast access to TODO states
2843 If you would like to quickly change an entry to an arbitrary TODO state
2844 instead of cycling through the states, you can set up keys for
2845 single-letter access to the states.  This is done by adding the section
2846 key after each keyword, in parenthesis.  For example:
2848 @lisp
2849 (setq org-todo-keywords
2850       '((sequence "TODO(t)" "|" "DONE(d)")
2851         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
2852         (sequence "|" "CANCELED(c)")))
2853 @end lisp
2855 If you then press @code{C-u C-c C-t} followed by the selection key, the
2856 entry will be switched to this state.  @key{SPC} can be used to remove
2857 any TODO keyword from an entry.  Should you like this way of selecting
2858 TODO states a lot, you might want to set the variable
2859 @code{org-use-fast-todo-selection} to @code{t} and make this behavior
2860 the default.  Check also the variable
2861 @code{org-fast-tag-selection-include-todo}, it allows to change the TODO
2862 state through the tags interface (@pxref{Setting tags}), in case you
2863 like to mingle the two concepts.
2865 @node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
2866 @subsection Setting up keywords for individual files
2867 @cindex keyword options
2868 @cindex per-file keywords
2870 It can be very useful to use different aspects of the TODO mechanism in
2871 different files.  For file-local settings, you need to add special lines
2872 to the file which set the keywords and interpretation for that file
2873 only.  For example, to set one of the two examples discussed above, you
2874 need one of the following lines, starting in column zero anywhere in the
2875 file:
2877 @example
2878 #+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
2879 @end example
2881 @example
2882 #+TYP_TODO: Fred Sara Lucy Mike | DONE
2883 @end example
2885 A setup for using several sets in parallel would be:
2887 @example
2888 #+SEQ_TODO: TODO | DONE
2889 #+SEQ_TODO: REPORT BUG KNOWNCAUSE | FIXED
2890 #+SEQ_TODO: | CANCELED
2891 @end example
2893 @cindex completion, of option keywords
2894 @kindex M-@key{TAB}
2895 @noindent To make sure you are using the correct keyword, type
2896 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
2898 @cindex DONE, final TODO keyword
2899 Remember that the keywords after the vertical bar (or the last keyword
2900 if no bar is there) must always mean that the item is DONE (although you
2901 may use a different word).  After changing one of these lines, use
2902 @kbd{C-c C-c} with the cursor still in the line to make the changes
2903 known to Org-mode@footnote{Org-mode parses these lines only when
2904 Org-mode is activated after visiting a file.  @kbd{C-c C-c} with the
2905 cursor in a line starting with @samp{#+} is simply restarting Org-mode
2906 for the current buffer.}.
2908 @node Faces for TODO keywords,  , Per-file keywords, TODO extensions
2909 @subsection Faces for TODO keywords
2910 @cindex faces, for TODO keywords
2912 Org-mode highlights TODO keywords with special faces: @code{org-todo}
2913 for keywords indicating that an item still has to be acted upon, and
2914 @code{org-done} for keywords indicating that an item is finished.  If
2915 you are using more than 2 different states, you might want to use
2916 special faces for some of them.  This can be done using the variable
2917 @code{org-todo-keyword-faces}.  For example:
2919 @lisp
2920 (setq org-todo-keyword-faces
2921       '(("TODO"      . org-warning)
2922         ("DEFERRED"  . shadow)
2923         ("CANCELED"  . (:foreground "blue" :weight bold))))
2924 @end lisp
2926 While using a list with face properties as shown for CANCELED
2927 @emph{should} work, this does not aways seem to be the case.  If
2928 necessary, define a special face and use that.
2930 @page
2931 @node Progress logging, Priorities, TODO extensions, TODO items
2932 @section Progress Logging
2933 @cindex progress logging
2934 @cindex logging, of progress
2936 Org-mode can automatically record a time stamp and possibly a note when
2937 you mark a TODO item as DONE, or even each time you change the state of
2938 a TODO item.  This system is highly configurable, settings can be on a
2939 per-keyword basis and can be localized to a file or even a subtree.  For
2940 information on how to clock working time for a task, see @ref{Clocking
2941 work time}.
2943 @menu
2944 * Closing items::               When was this entry marked DONE?
2945 * Tracking TODO state changes::  When did the status change?
2946 @end menu
2948 @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
2949 @subsection Closing items
2951 The most basic logging is to keep track of @emph{when} a certain TODO
2952 item was finished.  This is achieved with@footnote{The corresponding
2953 in-buffer setting is: @code{#+STARTUP: logdone}}.
2955 @lisp
2956 (setq org-log-done 'time)
2957 @end lisp
2959 @noindent
2960 Then each time you turn an entry from a TODO (not-done) state into any
2961 of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
2962 just after the headline.  If you turn the entry back into a TODO item
2963 through further state cycling, that line will be removed again.  If you
2964 want to record a note along with the timestamp, use@footnote{The
2965 corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
2967 @lisp
2968 (setq org-log-done 'note)
2969 @end lisp
2971 @noindent
2972 You will then be prompted for a note, and that note will be stored below
2973 the entry with a @samp{Closing Note} heading.
2975 In the timeline (@pxref{Timeline}) and in the agenda
2976 (@pxref{Weekly/Daily agenda}), you can then use the @kbd{l} key to
2977 display the TODO items with a @samp{CLOSED} timestamp on each day,
2978 giving you an overview of what has been done.
2980 @node Tracking TODO state changes,  , Closing items, Progress logging
2981 @subsection Tracking TODO state changes
2983 When TODO keywords are used as workflow states (@pxref{Workflow
2984 states}), you might want to keep track of when a state change occurred
2985 and maybe take a note about this change.  Since it is normally too much
2986 to record a note for every state, Org-mode expects configuration on a
2987 per-keyword basis for this.  This is achieved by adding special markers
2988 @samp{!} (for a time stamp) and @samp{@@} (for a note) in parenthesis
2989 after each keyword.  For example, with the setting
2991 @lisp
2992 (setq org-todo-keywords
2993   '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
2994 @end lisp
2996 @noindent
2997 you not only define global TODO keywords and fast access keys, but also
2998 request that a time is recorded when the entry is turned into
2999 DONE@footnote{It is possible that Org-mode will record two time stamps
3000 when you are using both @code{org-log-done} and state change logging.
3001 However, it will never prompt for two notes - if you have configured
3002 both, the state change recording note will take precedence and cancel
3003 the @samp{Closing Note}.}, and that a note is recorded when switching to
3004 WAIT or CANCELED.  The setting for WAIT is even more special: The
3005 @samp{!} after the slash means that in addition to the note taken when
3006 entering the state, a time stamp should be recorded when @i{leaving} the
3007 WAIT state.  This allows you to get a record when switching from WAIT
3008 back to TODO, without getting one when first turning an entry into a
3009 TODO.
3011 You can use the exact same syntax for setting logging preferences local
3012 to a buffer:
3013 @example
3014 #+SEQ_TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
3015 @end example
3017 In order to define logging settings that are local to a subtree or a
3018 single item, define a LOGGING property in this entry.  Any non-empty
3019 LOGGING property resets all logging settings to nil.  You may then turn
3020 on logging for this specific tree using STARTUP keywords like
3021 @code{lognotedone} or @code{logrepeat}, as well as adding state specific
3022 settings like @code{TODO(!)}.  For example
3024 @example
3025 * TODO Log each state with only a time
3026   :PROPERTIES:
3027   :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
3028   :END:
3029 * TODO Only log when switching to WAIT, and when repeating
3030   :PROPERTIES:
3031   :LOGGING: WAIT(@@) logrepeat
3032   :END:
3033 * TODO No logging at all
3034   :PROPERTIES:
3035   :LOGGING: nil
3036   :END:
3037 @end example
3040 @node Priorities, Breaking down tasks, Progress logging, TODO items
3041 @section Priorities
3042 @cindex priorities
3044 If you use Org-mode extensively, you may end up enough TODO items that
3045 it starts to make sense to prioritize them.  Prioritizing can be done by
3046 placing a @emph{priority cookie} into the headline of a TODO item, like
3047 this
3049 @example
3050 *** TODO [#A] Write letter to Sam Fortune
3051 @end example
3053 @noindent
3054 By default, Org-mode supports three priorities: @samp{A}, @samp{B}, and
3055 @samp{C}.  @samp{A} is the highest priority.  An entry without a cookie
3056 is treated as priority @samp{B}.  Priorities make a difference only in
3057 the agenda (@pxref{Weekly/Daily agenda}); outside the agenda, they have
3058 no inherent meaning to Org-mode.
3060 Priorities can be attached to any outline tree entries; they do not need
3061 to be TODO items.
3063 @table @kbd
3064 @kindex @kbd{C-c ,}
3065 @item @kbd{C-c ,}
3066 Set the priority of the current headline.  The command prompts for a
3067 priority character @samp{A}, @samp{B} or @samp{C}.  When you press
3068 @key{SPC} instead, the priority cookie is removed from the headline.
3069 The priorities can also be changed ``remotely'' from the timeline and
3070 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
3072 @kindex S-@key{up}
3073 @kindex S-@key{down}
3074 @item S-@key{up}
3075 @itemx S-@key{down}
3076 Increase/decrease priority of current headline@footnote{See also the
3077 option @code{org-priority-start-cycle-with-default'}.}.  Note that these
3078 keys are also used to modify time stamps (@pxref{Creating timestamps}).
3079 Furthermore, these keys are also used by CUA-mode (@pxref{Conflicts}).
3080 @end table
3082 You can change the range of allowed priorities by setting the variables
3083 @code{org-highest-priority}, @code{org-lowest-priority}, and
3084 @code{org-default-priority}.  For an individual buffer, you may set
3085 these values (highest, lowest, default) like this (please make sure that
3086 the highest priority is earlier in the alphabet than the lowest
3087 priority):
3089 @example
3090 #+PRIORITIES: A C B
3091 @end example
3093 @node Breaking down tasks, Checkboxes, Priorities, TODO items
3094 @section Breaking tasks down into subtasks
3095 @cindex tasks, breaking down
3097 It is often advisable to break down large tasks into smaller, manageable
3098 subtasks.  You can do this by creating an outline tree below a TODO
3099 item, with detailed subtasks on the tree@footnote{To keep subtasks out
3100 of the global TODO list, see the
3101 @code{org-agenda-todo-list-sublevels}.}.  Another possibility is the use
3102 of checkboxes to identify (a hierarchy of) a large number of subtasks
3103 (@pxref{Checkboxes}).
3106 @node Checkboxes,  , Breaking down tasks, TODO items
3107 @section Checkboxes
3108 @cindex checkboxes
3110 Every item in a plain list (@pxref{Plain lists}) can be made into a
3111 checkbox by starting it with the string @samp{[ ]}.  This feature is
3112 similar to TODO items (@pxref{TODO items}), but is more lightweight.
3113 Checkboxes are not included into the global TODO list, so they are often
3114 great to split a task into a number of simple steps.  Or you can use
3115 them in a shopping list.  To toggle a checkbox, use @kbd{C-c C-c}, or
3116 use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
3118 Here is an example of a checkbox list.
3120 @example
3121 * TODO Organize party [2/4]
3122   - [-] call people [1/3]
3123     - [ ] Peter
3124     - [X] Sarah
3125     - [ ] Sam
3126   - [X] order food
3127   - [ ] think about what music to play
3128   - [X] talk to the neighbors
3129 @end example
3131 Checkboxes work hierarchically, so if a checkbox item has children that
3132 are checkboxes, toggling one of the children checkboxes will make the
3133 parent checkbox reflect if none, some, or all of the children are
3134 checked.
3136 @cindex statistics, for checkboxes
3137 @cindex checkbox statistics
3138 The @samp{[2/4]} and @samp{[1/3]} in the first and second line are
3139 cookies indicating how many checkboxes present in this entry have been
3140 checked off, and the total number of checkboxes are present.  This can
3141 give you an idea on how many checkboxes remain, even without opening a
3142 folded entry.  The cookies can be placed into a headline or into (the
3143 first line of) a plain list item. Each cookie covers all checkboxes
3144 structurally below the headline/item on which the cookie appear.  You
3145 have to insert the cookie yourself by typing either @samp{[/]} or
3146 @samp{[%]}.  With @samp{[/]} you get an @samp{n out of m} result, as in
3147 the examples above.  With @samp{[%]} you get information about the
3148 percentage of checkboxes checked (in the above example, this would be
3149 @samp{[50%]} and @samp{[33%]}, respectively).
3151 @noindent The following commands work with checkboxes:
3153 @table @kbd
3154 @kindex C-c C-c
3155 @item C-c C-c
3156 Toggle checkbox at point.  With prefix argument, set it to @samp{[-]},
3157 which is considered to be an intermediate state.
3158 @kindex C-c C-x C-b
3159 @item C-c C-x C-b
3160 Toggle checkbox at point.
3161 @itemize @minus
3162 @item
3163 If there is an active region, toggle the first checkbox in the region
3164 and set all remaining boxes to the same status as the first.  If you
3165 want to toggle all boxes in the region independently, use a prefix
3166 argument.
3167 @item
3168 If the cursor is in a headline, toggle checkboxes in the region between
3169 this headline and the next (so @emph{not} the entire subtree).
3170 @item
3171 If there is no active region, just toggle the checkbox at point.
3172 @end itemize
3173 @kindex M-S-@key{RET}
3174 @item M-S-@key{RET}
3175 Insert a new item with a checkbox.
3176 This works only if the cursor is already in a plain list item
3177 (@pxref{Plain lists}).
3178 @kindex C-c #
3179 @item C-c #
3180 Update the checkbox statistics in the current outline entry.  When
3181 called with a @kbd{C-u} prefix, update the entire file.  Checkbox
3182 statistic cookies are updated automatically if you toggle checkboxes
3183 with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}.  If you
3184 delete boxes or add/change them by hand, use this command to get things
3185 back into synch.  Or simply toggle any checkbox twice with @kbd{C-c C-c}.
3186 @end table
3188 @node Tags, Properties and columns, TODO items, Top
3189 @chapter Tags
3190 @cindex tags
3191 @cindex headline tagging
3192 @cindex matching, tags
3193 @cindex sparse tree, tag based
3195 An excellent way to implement labels and contexts for cross-correlating
3196 information is to assign @i{tags} to headlines.  Org-mode has extensive
3197 support for tags.
3199 Every headline can contain a list of tags; they occur at the end of the
3200 headline.  Tags are normal words containing letters, numbers, @samp{_},
3201 and @samp{@@}.  Tags must be preceded and followed by a single colon,
3202 e.g., @samp{:WORK:}.  Several tags can be specified, as in
3203 @samp{:work:URGENT:}.
3205 @menu
3206 * Tag inheritance::             Tags use the tree structure of the outline
3207 * Setting tags::                How to assign tags to a headline
3208 * Tag searches::                Searching for combinations of tags
3209 @end menu
3211 @node Tag inheritance, Setting tags, Tags, Tags
3212 @section Tag inheritance
3213 @cindex tag inheritance
3214 @cindex inheritance, of tags
3215 @cindex sublevels, inclusion into tags match
3217 @i{Tags} make use of the hierarchical structure of outline trees.  If a
3218 heading has a certain tag, all subheadings will inherit the tag as
3219 well.  For example, in the list
3221 @example
3222 * Meeting with the French group      :work:
3223 ** Summary by Frank                  :boss:notes:
3224 *** TODO Prepare slides for him      :action:
3225 @end example
3227 @noindent
3228 the final heading will have the tags @samp{:work:}, @samp{:boss:},
3229 @samp{:notes:}, and @samp{:action:} even though the final heading is not
3230 explicitly marked with those tags.  When executing tag searches and
3231 Org-mode finds that a certain headline matches the search criterion, it
3232 will not check any sublevel headline, assuming that these also match and
3233 that the list of matches could become very long because of that.  If you
3234 do want the subevels be tested and listed as well, you may set the
3235 variable @code{org-tags-match-list-sublevels}.  To turn off tag
3236 inheritance entirely, use the variable @code{org-use-tag-inheritance}.
3238 @node Setting tags, Tag searches, Tag inheritance, Tags
3239 @section Setting tags
3240 @cindex setting tags
3241 @cindex tags, setting
3243 @kindex M-@key{TAB}
3244 Tags can simply be typed into the buffer at the end of a headline.
3245 After a colon, @kbd{M-@key{TAB}} offers completion on tags.  There is
3246 also a special command for inserting tags:
3248 @table @kbd
3249 @kindex C-c C-c
3250 @item C-c C-c
3251 @cindex completion, of tags
3252 Enter new tags for the current headline.  Org-mode will either offer
3253 completion or a special single-key interface for setting tags, see
3254 below.  After pressing @key{RET}, the tags will be inserted and aligned
3255 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
3256 tags in the current buffer will be aligned to that column, just to make
3257 things look nice.  TAGS are automatically realigned after promotion,
3258 demotion, and TODO state changes (@pxref{TODO basics}).
3259 @end table
3261 Org will support tag insertion based on a @emph{list of tags}.  By
3262 default this list is constructed dynamically, containing all tags
3263 currently used in the buffer.  You may also globally specify a hard list
3264 of tags with the variable @code{org-tag-alist}.  Finally you can set
3265 the default tags for a given file with lines like
3267 @example
3268 #+TAGS: @@work @@home @@tennisclub
3269 #+TAGS: laptop car pc sailboat
3270 @end example
3272 If you have globally defined your preferred set of tags using the
3273 variable @code{org-tag-alist}, but would like to use a dynamic tag list
3274 in a specific file, add an empty TAGS option line to that file:
3276 @example
3277 #+TAGS:
3278 @end example
3280 The default support method for entering tags is minibuffer completion.
3281 However, Org-mode also implements a much better method: @emph{fast tag
3282 selection}.  This method allows to select and deselect tags with a
3283 single key per tag.  To function efficiently, you should assign unique
3284 keys to most tags.  This can be done globally with
3286 @lisp
3287 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
3288 @end lisp
3290 @noindent or on a per-file basis with
3292 @example
3293 #+TAGS: @@work(w)  @@home(h)  @@tennisclub(t)  laptop(l)  pc(p)
3294 @end example
3296 @noindent
3297 You can also group together tags that are mutually exclusive.  With
3298 curly braces@footnote{In @code{org-mode-alist} use
3299 @code{'(:startgroup)} and @code{'(:endgroup)}, respectively.  Several
3300 groups are allowed.}
3302 @example
3303 #+TAGS: @{ @@work(w)  @@home(h)  @@tennisclub(t) @}  laptop(l)  pc(p)
3304 @end example
3306 @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
3307 and @samp{@@tennisclub} should be selected.
3309 @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
3310 these lines to activate any changes.
3312 If at least one tag has a selection key, pressing @kbd{C-c C-c} will
3313 automatically present you with a special interface, listing inherited
3314 tags, the tags of the current headline, and a list of all valid tags
3315 with corresponding keys@footnote{Keys will automatically be assigned to
3316 tags which have no configured keys.}.  In this interface, you can use
3317 the following keys:
3319 @table @kbd
3320 @item a-z...
3321 Pressing keys assigned to tags will add or remove them from the list of
3322 tags in the current line.  Selecting a tag in a group of mutually
3323 exclusive tags will turn off any other tags from that group.
3324 @kindex @key{TAB}
3325 @item @key{TAB}
3326 Enter a tag in the minibuffer, even if the tag is not in the predefined
3327 list.  You will be able to complete on all tags present in the buffer.
3328 @kindex @key{SPC}
3329 @item @key{SPC}
3330 Clear all tags for this line.
3331 @kindex @key{RET}
3332 @item @key{RET}
3333 Accept the modified set.
3334 @item C-g
3335 Abort without installing changes.
3336 @item q
3337 If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
3338 @item !
3339 Turn off groups of mutually exclusive tags.  Use this to (as an
3340 exception) assign several tags from such a group.
3341 @item C-c
3342 Toggle auto-exit after the next change (see below).
3343 If you are using expert mode, the first @kbd{C-c} will display the
3344 selection window.
3345 @end table
3347 @noindent
3348 This method lets you assign tags to a headline with very few keys.  With
3349 the above setup, you could clear the current tags and set @samp{@@home},
3350 @samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
3351 C-c @key{SPC} h l p @key{RET}}.  Switching from @samp{@@home} to
3352 @samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
3353 alternatively with @kbd{C-c C-c C-c w}.  Adding the non-predefined tag
3354 @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
3355 @key{RET} @key{RET}}.
3357 If you find that most of the time, you need only a single keypress to
3358 modify your list of tags, set the variable
3359 @code{org-fast-tag-selection-single-key}.  Then you no longer have to
3360 press @key{RET} to exit fast tag selection - it will immediately exit
3361 after the first change.  If you then occasionally need more keys, press
3362 @kbd{C-c} to turn off auto-exit for the current tag selection process
3363 (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
3364 C-c}).  If you set the variable to the value @code{expert}, the special
3365 window is not even shown for single-key tag selection, it comes up only
3366 when you press an extra @kbd{C-c}.
3368 @node Tag searches,  , Setting tags, Tags
3369 @section Tag searches
3370 @cindex tag searches
3371 @cindex searching for tags
3373 Once a system of tags has been set up, it can be used to collect related
3374 information into special lists.
3376 @table @kbd
3377 @kindex C-c \
3378 @kindex C-c / T
3379 @item C-c \
3380 @itemx C-c / T
3381 Create a sparse tree with all headlines matching a tags search.  With a
3382 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
3383 @kindex C-c a m
3384 @item C-c a m
3385 Create a global list of tag matches from all agenda files.
3386 @xref{Matching tags and properties}.
3387 @kindex C-c a M
3388 @item C-c a M
3389 Create a global list of tag matches from all agenda files, but check
3390 only TODO items and force checking subitems (see variable
3391 @code{org-tags-match-list-sublevels}).
3392 @end table
3394 @cindex Boolean logic, for tag searches
3395 A @i{tags} search string can use Boolean operators @samp{&} for AND and
3396 @samp{|} for OR.  @samp{&} binds more strongly than @samp{|}.
3397 Parenthesis are currently not implemented.  A tag may also be preceded
3398 by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
3399 positive selection.  The AND operator @samp{&} is optional when @samp{+}
3400 or @samp{-} is present.  Examples:
3402 @table @samp
3403 @item +work-boss
3404 Select headlines tagged @samp{:work:}, but discard those also tagged
3405 @samp{:boss:}.
3406 @item work|laptop
3407 Selects lines tagged @samp{:work:} or @samp{:laptop:}.
3408 @item work|laptop&night
3409 Like before, but require the @samp{:laptop:} lines to be tagged also
3410 @samp{:night:}.
3411 @end table
3413 @cindex TODO keyword matching, with tags search
3414 If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
3415 can be useful to also match on the TODO keyword.  This can be done by
3416 adding a condition after a slash to a tags match.  The syntax is similar
3417 to the tag matches, but should be applied with consideration: For
3418 example, a positive selection on several TODO keywords can not
3419 meaningfully be combined with boolean AND.  However, @emph{negative
3420 selection} combined with AND can be meaningful.  To make sure that only
3421 lines are checked that actually have any TODO keyword, use @kbd{C-c a
3422 M}, or equivalently start the todo part after the slash with @samp{!}.
3423 Examples:
3425 @table @samp
3426 @item work/WAITING
3427 Select @samp{:work:}-tagged TODO lines with the specific TODO
3428 keyword @samp{WAITING}.
3429 @item work/!-WAITING-NEXT
3430 Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
3431 nor @samp{NEXT}
3432 @item work/+WAITING|+NEXT
3433 Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
3434 @samp{NEXT}.
3435 @end table
3437 @cindex regular expressions, with tags search
3438 Any element of the tag/todo match can be a regular expression - in this
3439 case it must be enclosed in curly braces.  For example,
3440 @samp{work+@{^boss.*@}} matches headlines that contain the tag
3441 @samp{:work:} and any tag @i{starting} with @samp{boss}.
3443 @cindex level, require for tags/property match
3444 @cindex category, require for tags/property match
3445 You can also require a headline to be of a certain level or category, by
3446 writing instead of any TAG an expression like @samp{LEVEL=3} or
3447 @samp{CATEGORY="work"}, respectively.  For example, a search
3448 @samp{+LEVEL=3+boss/-DONE} lists all level three headlines that have the
3449 tag @samp{boss} and are @emph{not} marked with the todo keyword DONE.
3451 @node Properties and columns, Dates and times, Tags, Top
3452 @chapter Properties and Columns
3453 @cindex properties
3455 Properties are a set of key-value pairs associated with an entry.  There
3456 are two main applications for properties in Org-mode.  First, properties
3457 are like tags, but with a value.  Second, you can use properties to
3458 implement (very basic) database capabilities in an Org-mode buffer.  For
3459 an example of the first application, imagine maintaining a file where
3460 you document bugs and plan releases of a piece of software.  Instead of
3461 using tags like @code{:release_1:}, @code{:release_2:}, one can use a
3462 property, say @code{:Release:}, that in different subtrees has different
3463 values, such as @code{1.0} or @code{2.0}.  For an example of the second
3464 application of properties, imagine keeping track of one's music CD's,
3465 where properties could be things such as the album artist, date of
3466 release, number of tracks, and so on.
3468 Properties can be conveniently edited and viewed in column view
3469 (@pxref{Column view}).
3471 Properties are like tags, but with a value.  For example, in a file
3472 where you document bugs and plan releases of a piece of software,
3473 instead of using tags like @code{:release_1:}, @code{:release_2:}, it
3474 can be more efficient to use a property @code{:Release:} with a value
3475 @code{1.0} or @code{2.0}.  Second, you can use properties to implement
3476 (very basic) database capabilities in an Org-mode buffer, for example to
3477 create a list of Music CD's you own.  You can edit and view properties
3478 conveniently in column view (@pxref{Column view}).
3480 @menu
3481 * Property syntax::             How properties are spelled out
3482 * Special properties::          Access to other Org-mode features
3483 * Property searches::           Matching property values
3484 * Property inheritance::        Passing values down the tree
3485 * Column view::                 Tabular viewing and editing
3486 * Property API::                Properties for Lisp programmers
3487 @end menu
3489 @node Property syntax, Special properties, Properties and columns, Properties and columns
3490 @section Property Syntax
3491 @cindex property syntax
3492 @cindex drawer, for properties
3494 Properties are key-value pairs.  They need to be inserted into a special
3495 drawer (@pxref{Drawers}) with the name @code{PROPERTIES}.  Each property
3496 is specified on a single line, with the key (surrounded by colons)
3497 first, and the value after it.  Here is an example:
3499 @example
3500 * CD collection
3501 ** Classic
3502 *** Goldberg Variations
3503     :PROPERTIES:
3504     :Title:     Goldberg Variations
3505     :Composer:  J.S. Bach
3506     :Artist:    Glen Gould 
3507     :Publisher: Deutsche Grammphon
3508     :NDisks:    1
3509     :END:       
3510 @end example
3512 You may define the allowed values for a particular property @samp{:Xyz:}
3513 by setting a property @samp{:Xyz_ALL:}.  This special property is
3514 @emph{inherited}, so if you set it in a level 1 entry, it will apply to
3515 the entire tree.  When allowed values are defined, setting the
3516 corresponding property becomes easier and is less prone to typing
3517 errors.  For the example with the CD collection, we can predefine
3518 publishers and the number of disks in a box like this:
3520 @example
3521 * CD collection
3522   :PROPERTIES:
3523   :NDisks_ALL:  1 2 3 4
3524   :Publisher_ALL: "Deutsche Grammophon" Phillips EMI
3525   :END:
3526 @end example
3528 If you want to set properties that can be inherited by any entry in a
3529 file, use a line like
3531 @example
3532 #+PROPERTY: NDisks_ALL 1 2 3 4
3533 @end example
3535 Property values set with the global variable
3536 @code{org-global-properties} can be inherited by all entries in all
3537 Org-mode files.
3539 @noindent
3540 The following commands help to work with properties:
3542 @table @kbd
3543 @kindex M-@key{TAB}
3544 @item M-@key{TAB}
3545 After an initial colon in a line, complete property keys.  All keys used
3546 in the current file will be offered as possible completions.
3547 @kindex C-c C-x p
3548 @item C-c C-x p
3549 Set a property.  This prompts for a property name and a value.  If
3550 necessary, the property drawer is created as well.
3551 @item M-x org-insert-property-drawer
3552 Insert a property drawer into the current entry.  The drawer will be
3553 inserted early in the entry, but after the lines with planning
3554 information like deadlines.
3555 @kindex C-c C-c
3556 @item C-c C-c
3557 With the cursor in a property drawer, this executes property commands.
3558 @item C-c C-c s
3559 Set a property in the current entry.  Both the property and the value
3560 can be inserted using completion.
3561 @kindex S-@key{right}
3562 @kindex S-@key{left}
3563 @item S-@key{left}/@key{right}
3564 Switch property at point to the next/previous allowed value.
3565 @item C-c C-c d
3566 Remove a property from the current entry.
3567 @item C-c C-c D
3568 Globally remove a property, from all entries in the current file.
3569 @item C-c C-c c
3570 Compute the property at point, using the operator and scope from the
3571 nearest column format definition.
3572 @end table
3574 @node Special properties, Property searches, Property syntax, Properties and columns
3575 @section Special Properties
3576 @cindex properties, special
3578 Special properties provide alternative access method to Org-mode
3579 features discussed in the previous chapters, like the TODO state or the
3580 priority of an entry.  This interface exists so that you can include
3581 these states into columns view (@pxref{Column view}), or to use them in
3582 queries.  The following property names are special and should not be
3583 used as keys in the properties drawer:
3585 @example
3586 TODO         @r{The TODO keyword of the entry.}
3587 TAGS         @r{The tags defined directly in the headline.}
3588 ALLTAGS      @r{All tags, including inherited ones.}
3589 PRIORITY     @r{The priority of the entry, a string with a single letter.}
3590 DEADLINE     @r{The deadline time string, without the angular brackets.}
3591 SCHEDULED    @r{The scheduling time stamp, without the angular brackets.}
3592 TIMESTAMP    @r{The first keyword-less time stamp in the entry.}
3593 TIMESTAMP_IA @r{The first inactive time stamp in the entry.}
3594 CLOCKSUM     @r{The sum of CLOCK intervals in the subtree.  @code{org-clock-sum}}
3595              @r{must be run first to compute the values.}
3596 @end example
3598 @node Property searches, Property inheritance, Special properties, Properties and columns
3599 @section Property searches
3600 @cindex properties, searching
3601 @cindex properties, inheritance
3602 @cindex searching, of properties
3603 @cindex inheritance, of properties
3605 To create sparse trees and special lists with selection based on
3606 properties, the same commands are used as for tag searches (@pxref{Tag
3607 searches}), and the same logic applies.  For example, a search string
3609 @example
3610 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort=""+With=@{Sarah\|Denny@}
3611 @end example
3613 @noindent
3614 finds entries tagged @samp{:work:} but not @samp{:boss:}, which
3615 also have a priority value @samp{A}, a @samp{:Coffee:} property with the
3616 value @samp{unlimited}, an @samp{Effort} property that is undefined or
3617 empty, and a @samp{:With:} property that is matched by
3618 the regular expression @samp{Sarah\|Denny}.
3620 You can configure Org-mode to use property inheritance during a search,
3621 see @ref{Property inheritance} for details.
3623 There is also a special command for creating sparse trees based on a
3624 single property:
3626 @table @kbd
3627 @kindex C-c / p
3628 @item C-c / p
3629 Create a sparse tree based on the value of a property.  This first
3630 prompts for the name of a property, and then for a value.  A sparse tree
3631 is created with all entries that define this property with the given
3632 value.  If you enclose the value into curly braces, it is interpreted as
3633 a regular expression and matched against the property values.
3634 @end table
3636 @node Property inheritance, Column view, Property searches, Properties and columns
3637 @section Property Inheritance
3639 The outline structure of Org-mode documents lends itself for an
3640 inheritance model of properties: If the parent in a tree has a certain
3641 property, the children can inherit this property.  Org-mode does not
3642 turn this on by default, because it can slow down property searches
3643 significantly and is often not needed.  However, if you find inheritance
3644 useful, you can turn it on by setting the variable
3645 @code{org-use-property-inheritance}.  It may be set to @code{t}, to make
3646 all properties inherited from the parent, or to a list of properties
3647 that should be inherited.
3649 Org-mode has a few properties for which inheritance is hard-coded, at
3650 least for the special applications for which they are used:
3652 @table @code
3653 @item COLUMNS
3654 The @code{:COLUMNS:} property defines the format of column view
3655 (@pxref{Column view}).  It is inherited in the sense that the level
3656 where a @code{:COLUMNS:} property is defined is used as the starting
3657 point for a column view table, independently of the location in the
3658 subtree from where columns view is turned on.
3659 @item CATEGORY
3660 For agenda view, a category set through a @code{:CATEGORY:} property
3661 applies to the entire subtree.
3662 @item ARCHIVE
3663 For archiving, the @code{:ARCHIVE:} property may define the archive
3664 location for the entire subtree (@pxref{Moving subtrees}).
3665 @item LOGGING
3666 The LOGGING property may define logging settings for an entry or a
3667 subtree (@pxref{Tracking TODO state changes}).
3668 @end table
3670 @node Column view, Property API, Property inheritance, Properties and columns
3671 @section Column View
3673 A great way to view and edit properties in an outline tree is
3674 @emph{column view}.  In column view, each outline item is turned into a
3675 table row.  Columns in this table provide access to properties of the
3676 entries.  Org-mode implements columns by overlaying a tabular structure
3677 over the headline of each item.  While the headlines have been turned
3678 into a table row, you can still change the visibility of the outline
3679 tree.  For example, you get a compact table by switching to CONTENTS
3680 view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
3681 is active), but you can still open, read, and edit the entry below each
3682 headline.  Or, you can switch to column view after executing a sparse
3683 tree command and in this way get a table only for the selected items.
3684 Column view also works in agenda buffers (@pxref{Agenda views}) where
3685 queries have collected selected items, possibly from a number of files.
3687 @menu
3688 * Defining columns::            The COLUMNS format property
3689 * Using column view::           How to create and use column view
3690 * Capturing Column View::       A dynamic block for column view
3691 @end menu
3693 @node Defining columns, Using column view, Column view, Column view
3694 @subsection Defining Columns
3695 @cindex column view, for properties
3696 @cindex properties, column view
3698 Setting up a column view first requires defining the columns.  This is
3699 done by defining a column format line.
3701 @menu
3702 * Scope of column definitions::  Where defined, where valid?
3703 * Column attributes::           Appearance and content of a column
3704 @end menu
3706 @node Scope of column definitions, Column attributes, Defining columns, Defining columns
3707 @subsubsection Scope of column definitions
3709 To define a column format for an entire file, use a line like
3711 @example
3712 #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3713 @end example
3715 To specify a format that only applies to a specific tree, add a
3716 @code{:COLUMNS:} property to the top node of that tree, for example:
3718 @example
3719 ** Top node for columns view
3720    :PROPERTIES:
3721    :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3722    :END:
3723 @end example
3725 If a @code{:COLUMNS:} property is present in an entry, it defines columns
3726 for the entry itself, and for the entire subtree below it.  Since the
3727 column definition is part of the hierarchical structure of the document,
3728 you can define columns on level 1 that are general enough for all
3729 sublevels, and more specific columns further down, when you edit a
3730 deeper part of the tree.
3732 @node Column attributes,  , Scope of column definitions, Defining columns
3733 @subsubsection Column attributes
3734 A column definition sets the attributes of a column.  The general
3735 definition looks like this:
3737 @example
3738  %[width]property[(title)][@{summary-type@}]
3739 @end example
3741 @noindent
3742 Except for the percent sign and the property name, all items are
3743 optional.  The individual parts have the following meaning:
3745 @example
3746 width           @r{An integer specifying the width of the column in characters.}
3747                 @r{If omitted, the width will be determined automatically.}
3748 property        @r{The property that should be edited in this column.}
3749 (title)         @r{The header text for the column. If omitted, the}
3750                 @r{property name is used.}
3751 @{summary-type@}  @r{The summary type.  If specified, the column values for}
3752                 @r{parent nodes are computed from the children.}
3753                 @r{Supported summary types are:}
3754                 @{+@}       @r{Sum numbers in this column.}
3755                 @{+;%.1f@}  @r{Like @samp{+}, but format result with @samp{%.1f}.}
3756                 @{$@}       @r{Currency, short for @samp{+;%.2f}.}
3757                 @{:@}       @r{Sum times, HH:MM:SS, plain numbers are hours.}
3758                 @{X@}       @r{Checkbox status, [X] if all children are [X].}
3759                 @{X/@}      @r{Checkbox status, [n/m].}
3760                 @{X%@}      @r{Checkbox status, [n%].}
3761 @end example
3763 @noindent
3764 Here is an example for a complete columns definition, along with allowed
3765 values.
3767 @example
3768 :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.}
3769                    %10Time_Estimate@{:@} %CLOCKSUM
3770 :Owner_ALL:    Tammy Mark Karl Lisa Don
3771 :Status_ALL:   "In progress" "Not started yet" "Finished" ""
3772 :Approved_ALL: "[ ]" "[X]"
3773 @end example
3775 The first column, @samp{%25ITEM}, means the first 25 characters of the
3776 item itself, i.e. of the headline.  You probably always should start the
3777 column definition with the ITEM specifier.  The other specifiers create
3778 columns @samp{Owner} with a list of names as allowed values, for
3779 @samp{Status} with four different possible values, and for a checkbox
3780 field @samp{Approved}.  When no width is given after the @samp{%}
3781 character, the column will be exactly as wide as it needs to be in order
3782 to fully display all values.  The @samp{Approved} column does have a
3783 modified title (@samp{Approved?}, with a question mark).  Summaries will
3784 be created for the @samp{Time_Estimate} column by adding time duration
3785 expressions like HH:MM, and for the @samp{Approved} column, by providing
3786 an @samp{[X]} status if all children have been checked.  The
3787 @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
3788 in the subtree.
3790 @node Using column view, Capturing Column View, Defining columns, Column view
3791 @subsection Using Column View
3793 @table @kbd
3794 @tsubheading{Turning column view on and off}
3795 @kindex C-c C-x C-c
3796 @item C-c C-x C-c
3797 Create the column view for the local environment.  This command searches
3798 the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
3799 a format.  When one is found, the column view table is established for
3800 the entire tree, starting from the entry that contains the @code{:COLUMNS:}
3801 property.  If none is found, the format is taken from the @code{#+COLUMNS}
3802 line or from the variable @code{org-columns-default-format}, and column
3803 view is established for the current entry and its subtree.
3804 @kindex r
3805 @item r
3806 Recreate the column view, to included hanges happening in the buffer.
3807 @kindex g
3808 @item g
3809 Same as @kbd{r}.
3810 @kindex q
3811 @item q
3812 Exit column view.
3813 @tsubheading{Editing values}
3814 @item @key{left} @key{right} @key{up} @key{down}
3815 Move through the column view from field to field.
3816 @kindex S-@key{left}
3817 @kindex S-@key{right}
3818 @item  S-@key{left}/@key{right}
3819 Switch to the next/previous allowed value of the field.  For this, you
3820 have to have specified allowed values for a property.
3821 @kindex n
3822 @kindex p
3823 @itemx  n / p
3824 Same as @kbd{S-@key{left}/@key{right}}
3825 @kindex e
3826 @item e
3827 Edit the property at point.  For the special properties, this will
3828 invoke the same interface that you normally use to change that
3829 property.  For example, when editing a TAGS property, the tag completion
3830 or fast selection interface will pop up.
3831 @kindex C-c C-c
3832 @item C-c C-c
3833 When there is a checkbox at point, toggle it.
3834 @kindex v
3835 @item v
3836 View the full value of this property.  This is useful if the width of
3837 the column is smaller than that of the value.
3838 @kindex a
3839 @item a
3840 Edit the list of allowed values for this property.  If the list is found
3841 in the hierarchy, the modified values is stored there.  If no list is
3842 found, the new value is stored in the first entry that is part of the
3843 current column view.
3844 @tsubheading{Modifying the table structure}
3845 @kindex <
3846 @kindex >
3847 @item < / >
3848 Make the column narrower/wider by one character.
3849 @kindex S-M-@key{right}
3850 @item S-M-@key{right}
3851 Insert a new column, to the right of the current column.
3852 @kindex S-M-@key{left}
3853 @item S-M-@key{left}
3854 Delete the current column.
3855 @end table
3857 @node Capturing Column View,  , Using column view, Column view
3858 @subsection Capturing Column View
3860 Since column view is just an overlay over a buffer, it cannot be
3861 exported or printed directly.  If you want to capture a column view, use
3862 the dynamic block (@pxref{Dynamic blocks}).  The frame of this block
3863 looks like this:
3865 @example
3866 * The column view
3867 #+BEGIN: columnview :hlines 1 :id "label"
3869 #+END:
3870 @end example
3872 @noindent This dynamic block has the following parameters:
3874 @table @code
3875 @item :id
3876 This is most important parameter.  Column view is a feature that is
3877 often localized to a certain (sub)tree, and the capture block might be
3878 in a different location in the file.  To identify the tree whose view to
3879 capture, you can use 3 values:
3880 @example
3881 local     @r{use the tree in which the capture block is located}
3882 global    @r{make a global view, including all headings in the file}
3883 "label"   @r{call column view in the tree that has and @code{:ID:}}
3884           @r{property with the value @i{label}}
3885 @end example
3886 @item :hlines
3887 When @code{t}, insert a hline after every line.  When a number N, insert
3888 a hline before each headline with level @code{<= N}.
3889 @item :vlines
3890 When set to @code{t}, enforce column groups to get vertical lines.
3891 @end table
3893 @noindent
3894 The following commands insert or update the dynamic block:
3896 @table @kbd
3897 @kindex C-c C-x r
3898 @item C-c C-x r
3899 Insert a dynamic block capturing a column view.  You will be prompted
3900 for the scope or id of the view.
3901 @kindex C-c C-c
3902 @item C-c C-c
3903 @kindex C-c C-x C-u
3904 @itemx C-c C-x C-u
3905 Update dynamical block at point.  The cursor needs to be in the
3906 @code{#+BEGIN} line of the dynamic block.
3907 @kindex C-u C-c C-x C-u
3908 @item C-u C-c C-x C-u
3909 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
3910 you have several clocktable blocks in a buffer.
3911 @end table
3913 @node Property API,  , Column view, Properties and columns
3914 @section The Property API
3915 @cindex properties, API
3916 @cindex API, for properties
3918 There is a full API for accessing and changing properties.  This API can
3919 be used by Emacs Lisp programs to work with properties and to implement
3920 features based on them.  For more information see @ref{Using the
3921 property API}.
3923 @node Dates and times, Remember, Properties and columns, Top
3924 @chapter Dates and Times
3925 @cindex dates
3926 @cindex times
3927 @cindex time stamps
3928 @cindex date stamps
3930 To assist project planning, TODO items can be labeled with a date and/or
3931 a time.  The specially formatted string carrying the date and time
3932 information is called a @emph{timestamp} in Org-mode.  This may be a
3933 little confusing because timestamp is often used as indicating when
3934 something was created or last changed.  However, in Org-mode this term
3935 is used in a much wider sense.
3937 @menu
3938 * Time stamps::                 Assigning a time to a tree entry
3939 * Creating timestamps::         Commands which insert timestamps
3940 * Deadlines and scheduling::    Planning your work
3941 * Clocking work time::          
3942 @end menu
3945 @node Time stamps, Creating timestamps, Dates and times, Dates and times
3946 @section Time stamps, deadlines and scheduling
3947 @cindex time stamps
3948 @cindex ranges, time
3949 @cindex date stamps
3950 @cindex deadlines
3951 @cindex scheduling
3953 A time stamp is a specification of a date (possibly with time or a range
3954 of times) in a special format, either @samp{<2003-09-16 Tue>} or
3955 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
3956 12:00-12:30>}@footnote{This is the standard ISO date/time format.  To
3957 use an alternative format, see @ref{Custom time format}.}.  A time stamp
3958 can appear anywhere in the headline or body of an org-tree entry.  Its
3959 presence causes entries to be shown on specific dates in the agenda
3960 (@pxref{Weekly/Daily agenda}).  We distinguish:
3962 @table @var
3963 @item Plain time stamp; Event; Appointment
3964 @cindex timestamp
3965 A simple time stamp just assigns a date/time to an item.  This is just
3966 like writing down an appointment or event in a paper agenda.  In the
3967 timeline and agenda displays, the headline of an entry associated with a
3968 plain time stamp will be shown exactly on that date.
3970 @example
3971 * Meet Peter at the movies <2006-11-01 Wed 19:15>
3972 * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
3973 @end example
3975 @item Time stamp with repeater interval
3976 @cindex timestamp, with repeater interval
3977 A time stamp may contain a @emph{repeater interval}, indicating that it
3978 applies not only on the given date, but again and again after a certain
3979 interval of N days (d), weeks (w), months(m), or years(y).  The
3980 following will show up in the agenda every Wednesday:
3982 @example
3983 * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
3984 @end example
3986 @item Diary-style sexp entries
3987 For more complex date specifications, Org-mode supports using the
3988 special sexp diary entries implemented in the Emacs calendar/diary
3989 package.  For example
3991 @example
3992 * The nerd meeting on every 2nd Thursday of the month
3993   <%%(diary-float t 4 2)>
3994 @end example
3996 @item Time/Date range
3997 @cindex timerange
3998 @cindex date range
3999 Two time stamps connected by @samp{--} denote a range.  The headline
4000 will be shown on the first and last day of the range, and on any dates
4001 that are displayed and fall in the range.  Here is an example:
4003 @example
4004 ** Meeting in Amsterdam
4005    <2004-08-23 Mon>--<2004-08-26 Thu>
4006 @end example
4008 @item Inactive time stamp
4009 @cindex timestamp, inactive
4010 @cindex inactive timestamp
4011 Just like a plain time stamp, but with square brackets instead of
4012 angular ones.  These time stamps are inactive in the sense that they do
4013 @emph{not} trigger an entry to show up in the agenda.
4015 @example
4016 * Gillian comes late for the fifth time [2006-11-01 Wed]
4017 @end example
4019 @end table
4021 @node Creating timestamps, Deadlines and scheduling, Time stamps, Dates and times
4022 @section Creating timestamps
4023 @cindex creating timestamps
4024 @cindex timestamps, creating
4026 For Org-mode to recognize time stamps, they need to be in the specific
4027 format.  All commands listed below produce time stamps in the correct
4028 format.
4030 @table @kbd
4031 @kindex C-c .
4032 @item C-c .
4033 Prompt for a date and insert a corresponding time stamp.  When the
4034 cursor is at a previously used time stamp, it is updated to NOW.  When
4035 this command is used twice in succession, a time range is inserted.
4037 @kindex C-u C-c .
4038 @item C-u C-c .
4039 Like @kbd{C-c .}, but use the alternative format which contains date
4040 and time.  The default time can be rounded to multiples of 5 minutes,
4041 see the option @code{org-time-stamp-rounding-minutes}.
4043 @kindex C-c !
4044 @item C-c !
4045 Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
4046 an agenda entry.
4048 @kindex C-c <
4049 @item C-c <
4050 Insert a time stamp corresponding to the cursor date in the Calendar.
4052 @kindex C-c >
4053 @item C-c >
4054 Access the Emacs calendar for the current date.  If there is a
4055 timestamp in the current line, goto the corresponding date
4056 instead.
4058 @kindex C-c C-o
4059 @item C-c C-o
4060 Access the agenda for the date given by the time stamp or -range at
4061 point (@pxref{Weekly/Daily agenda}).
4063 @kindex S-@key{left}
4064 @kindex S-@key{right}
4065 @item S-@key{left}
4066 @itemx S-@key{right}
4067 Change date at cursor by one day.  These key bindings conflict with
4068 CUA-mode (@pxref{Conflicts}).
4070 @kindex S-@key{up}
4071 @kindex S-@key{down}
4072 @item S-@key{up}
4073 @itemx S-@key{down}
4074 Change the item under the cursor in a timestamp.  The cursor can be on a
4075 year, month, day, hour or minute.  Note that if the cursor is in a
4076 headline and not at a time stamp, these same keys modify the priority of
4077 an item.  (@pxref{Priorities}). The key bindings also conflict with
4078 CUA-mode (@pxref{Conflicts}).
4080 @kindex C-c C-y
4081 @cindex evaluate time range
4082 @item C-c C-y
4083 Evaluate a time range by computing the difference between start and
4084 end.  With prefix arg, insert result after the time range (in a table:
4085 into the following column).
4086 @end table
4089 @menu
4090 * The date/time prompt::        How org-mode helps you entering date and time
4091 * Custom time format::          Making dates look differently
4092 @end menu
4094 @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
4095 @subsection The date/time prompt
4096 @cindex date, reading in minibuffer
4097 @cindex time, reading in minibuffer
4099 When Org-mode prompts for a date/time, the default is shown as an ISO
4100 date, and the prompt therefore seems to ask for an ISO date.  But it
4101 will in fact accept any string containing some date and/or time
4102 information, and it is really smart about interpreting your input.  You
4103 can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
4104 copied from an email message.  Org-mode will find whatever information
4105 is in there and derive anything you have not specified from the
4106 @emph{default date and time}.  The default is usually the current date
4107 and time, but when modifying an existing time stamp, or when entering
4108 the second stamp of a range, it is taken from the stamp in the buffer.
4109 When filling in information, Org-mode assumes that most of the time you
4110 will want to enter a date in the future: If you omit the month/year and
4111 the given day/month is @i{before} today, it will assume that you mean a
4112 future date@footnote{See the variable
4113 @code{org-read-date-prefer-future}.}.
4115 For example, lets assume that today is @b{June 13, 2006}.  Here is how
4116 various inputs will be interpreted, the items filled in by Org-mode are
4117 in @b{bold}.
4119 @example
4120 3-2-5         --> 2003-02-05
4121 14            --> @b{2006}-@b{06}-14
4122 12            --> @b{2006}-@b{07}-12
4123 Fri           --> nearest Friday (defaultdate or later)
4124 sep 15        --> @b{2006}-11-15
4125 feb 15        --> @b{2007}-02-15
4126 sep 12 9      --> 2009-09-12
4127 12:45         --> @b{2006}-@b{06}-@b{13} 12:45
4128 22 sept 0:34  --> @b{2006}-09-22 0:34
4129 @end example
4131 Furthermore you can specify a relative date by giving, as the
4132 @emph{first} thing in the input: a plus/minus sign, a number and a
4133 letter [dwmy] to indicate change in days weeks, months, years.  With a
4134 single plus or minus, the date is always relative to today.  With a
4135 double plus or minus, it is relative to the default date.  If instead of
4136 a single letter, you use the abbreviation of day name, the date will be
4137 the nth such day.  E.g.
4139 @example
4140 +4d           --> four days from today
4141 +4            --> same as above
4142 +2w           --> two weeks from today
4143 ++5           --> five days from default date
4144 +2tue         --> second tuesday from now.
4145 @end example
4147 The function understands English month and weekday abbreviations.  If
4148 you want to use unabbreviated names and/or other languages, configure
4149 the variables @code{parse-time-months} and @code{parse-time-weekdays}.
4151 @cindex calendar, for selecting date
4152 Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
4153 you don't need/want the calendar, configure the variable
4154 @code{org-popup-calendar-for-date-prompt}.}.  When you exit the date
4155 prompt, either by clicking on a date in the calendar, or by pressing
4156 @key{RET}, the date selected in the calendar will be combined with the
4157 information entered at the prompt.  You can control the calendar fully
4158 from the minibuffer:
4160 @kindex <
4161 @kindex >
4162 @kindex mouse-1
4163 @kindex S-@key{right}
4164 @kindex S-@key{left}
4165 @kindex S-@key{down}
4166 @kindex S-@key{up}
4167 @kindex M-S-@key{right}
4168 @kindex M-S-@key{left}
4169 @kindex @key{RET}
4170 @example
4171 > / <          @r{Scroll calendar forward/backward by one month.}
4172 mouse-1        @r{Select date by clicking on it.}
4173 S-@key{right}/@key{left}     @r{One day forward/backward.}
4174 S-@key{down}/@key{up}     @r{One week forward/backward.}
4175 M-S-@key{right}/@key{left}   @r{One month forward/backward.}
4176 @key{RET}           @r{Choose date in calendar.}
4177 @end example
4179 The actions of the date/time prompt may seem complex, but I asure you
4180 they will grow on you.  To help you understand what is going on, the
4181 current interpretation of your input will be displayed live in the
4182 minibuffer@footnote{If you find this distracting, turn the display of
4183 with @code{org-read-date-display-live}.}.
4185 @node Custom time format,  , The date/time prompt, Creating timestamps
4186 @subsection Custom time format
4187 @cindex custom date/time format
4188 @cindex time format, custom
4189 @cindex date format, custom
4191 Org-mode uses the standard ISO notation for dates and times as it is
4192 defined in ISO 8601.  If you cannot get used to this and require another
4193 representation of date and time to keep you happy, you can get it by
4194 customizing the variables @code{org-display-custom-times} and
4195 @code{org-time-stamp-custom-formats}.
4197 @table @kbd
4198 @kindex C-c C-x C-t
4199 @item C-c C-x C-t
4200 Toggle the display of custom formats for dates and times.
4201 @end table
4203 @noindent
4204 Org-mode needs the default format for scanning, so the custom date/time
4205 format does not @emph{replace} the default format - instead it is put
4206 @emph{over} the default format using text properties.  This has the
4207 following consequences:
4208 @itemize @bullet
4209 @item 
4210 You cannot place the cursor onto a time stamp anymore, only before or
4211 after.
4212 @item
4213 The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
4214 each component of a time stamp.  If the cursor is at the beginning of
4215 the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
4216 just like @kbd{S-@key{left}/@key{right}}.  At the end of the stamp, the
4217 time will be changed by one minute.
4218 @item
4219 If the time stamp contains a range of clock times or a repeater, these
4220 will not be overlayed, but remain in the buffer as they were.
4221 @item
4222 When you delete a time stamp character-by-character, it will only
4223 disappear from the buffer after @emph{all} (invisible) characters
4224 belonging to the ISO timestamp have been removed.
4225 @item
4226 If the custom time stamp format is longer than the default and you are
4227 using dates in tables, table alignment will be messed up.  If the custom
4228 format is shorter, things do work as expected.
4229 @end itemize
4232 @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and times
4233 @section Deadlines and Scheduling
4235 A time stamp may be preceded by special keywords to facilitate planning:
4237 @table @var
4238 @item DEADLINE
4239 @cindex DEADLINE keyword
4241 Meaning: the task (most likely a TODO item, though not necessarily) is supposed
4242 to be finished on that date.
4244 On the deadline date, the task will be listed in the agenda.  In
4245 addition, the agenda for @emph{today} will carry a warning about the
4246 approaching or missed deadline, starting
4247 @code{org-deadline-warning-days} before the due date, and continuing
4248 until the entry is marked DONE.  An example:
4250 @example
4251 *** TODO write article about the Earth for the Guide
4252     The editor in charge is [[bbdb:Ford Prefect]]
4253     DEADLINE: <2004-02-29 Sun>
4254 @end example
4256 You can specify a different lead time for warnings for a specific
4257 deadlines using the following syntax.  Here is an example with a warning
4258 period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
4260 @item SCHEDULED
4261 @cindex SCHEDULED keyword
4263 Meaning: you are planning to start working on that task on the given
4264 date.
4266 The headline will be listed under the given date@footnote{It will still
4267 be listed on that date after it has been marked DONE.  If you don't like
4268 this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
4269 addition, a reminder that the scheduled date has passed will be present
4270 in the compilation for @emph{today}, until the entry is marked DONE.
4271 I.e., the task will automatically be forwarded until completed.
4273 @example
4274 *** TODO Call Trillian for a date on New Years Eve.
4275     SCHEDULED: <2004-12-25 Sat>
4276 @end example
4278 @noindent
4279 @b{Important:} Scheduling an item in Org-mode should @i{not} be
4280 understood in the same way that we understand @i{scheduling a meeting}.
4281 Setting a date for a meeting is just a simple appointment, you should
4282 mark this entry with a simple plain time stamp, to get this item shown
4283 on the date where it applies.  This is a frequent mis-understanding from
4284 Org-users.  In Org-mode, @i{scheduling} means setting a date when you
4285 want to start working on an action item.
4286 @end table
4288 You may use time stamps with repeaters in scheduling and deadline
4289 entries.  Org-mode will issue early and late warnings based on the
4290 assumption that the time stamp represents the @i{nearest instance} of
4291 the repeater.  However, the use of diary sexp entries like
4293 @code{<%%(diary-float t 42)>}
4295 in scheduling and deadline timestamps is limited.  Org-mode does not
4296 know enough about the internals of each sexp function to issue early and
4297 late warnings.  However, it will show the item on each day where the
4298 sexp entry matches.
4300 @menu
4301 * Inserting deadline/schedule::  Planning items
4302 * Repeated tasks::              Items that show up again and again
4303 @end menu
4305 @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
4306 @subsection Inserting deadline/schedule
4308 The following commands allow to quickly insert a deadline or to schedule
4309 an item:
4311 @table @kbd
4313 @kindex C-c C-d
4314 @item C-c C-d
4315 Insert @samp{DEADLINE} keyword along with a stamp.  The insertion will
4316 happen in the line directly following the headline.  When called with a
4317 prefix arg, an existing deadline will be removed from the entry.
4318 @c FIXME Any CLOSED timestamp will be removed.????????
4320 @kindex C-c / d
4321 @cindex sparse tree, for deadlines
4322 @item C-c / d
4323 Create a sparse tree with all deadlines that are either past-due, or
4324 which will become due within @code{org-deadline-warning-days}.
4325 With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
4326 prefix, check that many days.  For example, @kbd{C-1 C-c / d} shows
4327 all deadlines due tomorrow.
4329 @kindex C-c C-s
4330 @item C-c C-s
4331 Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
4332 happen in the line directly following the headline.  Any CLOSED
4333 timestamp will be removed.  When called with a prefix argument, remove
4334 the scheduling date from the entry.
4335 @end table
4337 @node Repeated tasks,  , Inserting deadline/schedule, Deadlines and scheduling
4338 @subsection Repeated Tasks
4340 Some tasks need to be repeated again and again.  Org-mode helps to
4341 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
4342 or plain time stamp.  In the following example
4343 @example
4344 ** TODO Pay the rent
4345    DEADLINE: <2005-10-01 Sat +1m>
4346 @end example
4347 the @code{+1m} is a repeater; the intended interpretation is that the
4348 task has a deadline on <2005-10-01> and repeats itself every (one) month
4349 starting from that time.  If you need both a repeater and a special
4350 warning period in a deadline entry, the repeater comes first and the
4351 warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
4353 Deadlines and scheduled items produce entries in the agenda when they
4354 are over-due, so it is important to be able to mark such an entry as
4355 completed once you have done so.  When you mark a DEADLINE or a SCHEDULE
4356 with the todo keyword DONE, it will no longer produce entries in the
4357 agenda.  The problem with this is, however, that then also the
4358 @emph{next} instance of the repeated entry will not be active.  Org-mode
4359 deals with this in the following way: When you try to mark such an entry
4360 DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
4361 time stamp by the repeater interval, and immediately set the entry state
4362 back to TODO.  In the example above, setting the state to DONE would
4363 actually switch the date like this:
4365 @example
4366 ** TODO Pay the rent
4367    DEADLINE: <2005-11-01 Tue +1m>
4368 @end example
4370 You will also be prompted for a note@footnote{You can change this using
4371 the option @code{org-log-repeat}, or the @code{#+STARTUP} options
4372 @code{logrepeat}, @code{lognoterepeat}, and @code{nologrepeat}.} that
4373 will be put under the DEADLINE line to keep a record that you actually
4374 acted on the previous instance of this deadline.
4376 As a consequence of shifting the base date, this entry will no longer be
4377 visible in the agenda when checking past dates, but all future instances
4378 will be visible.
4380 You may have both scheduling and deadline information for a specific
4381 task - just make sure that the repeater intervals on both are the same.
4383 @node Clocking work time,  , Deadlines and scheduling, Dates and times
4384 @section Clocking work time
4386 Org-mode allows you to clock the time you spent on specific tasks in a
4387 project.  When you start working on an item, you can start the clock.
4388 When you stop working on that task, or when you mark the task done, the
4389 clock is stopped and the corresponding time interval is recorded.  It
4390 also computes the total time spent on each subtree of a project.
4392 @table @kbd
4393 @kindex C-c C-x C-i
4394 @item C-c C-x C-i
4395 Start the clock on the current item (clock-in).  This inserts the CLOCK
4396 keyword together with a timestamp.  If this is not the first clocking of
4397 this item, the multiple CLOCK lines will be wrapped into a
4398 @code{:CLOCK:} drawer (see also the variable
4399 @code{org-clock-into-drawer}).
4400 @kindex C-c C-x C-o
4401 @item C-c C-x C-o
4402 Stop the clock (clock-out).  The inserts another timestamp at the same
4403 location where the clock was last started.  It also directly computes
4404 the resulting time in inserts it after the time range as @samp{=>
4405 HH:MM}.  See the variable @code{org-log-note-clock-out} for the
4406 possibility to record an additional note together with the clock-out
4407 time stamp@footnote{The corresponding in-buffer setting is:
4408 @code{#+STARTUP: lognoteclock-out}}.
4409 @kindex C-c C-y
4410 @item C-c C-y
4411 Recompute the time interval after changing one of the time stamps.  This
4412 is only necessary if you edit the time stamps directly.  If you change
4413 them with @kbd{S-@key{cursor}} keys, the update is automatic.
4414 @kindex C-c C-t
4415 @item C-c C-t
4416 Changing the TODO state of an item to DONE automatically stops the clock
4417 if it is running in this same item.
4418 @kindex C-c C-x C-x
4419 @item C-c C-x C-x
4420 Cancel the current clock.  This is useful if a clock was started by
4421 mistake, or if you ended up working on something else.
4422 @kindex C-c C-x C-j
4423 @item C-c C-x C-j
4424 Jump to the entry that contains the currently running clock, an another
4425 window.
4426 @kindex C-c C-x C-d
4427 @item C-c C-x C-d
4428 Display time summaries for each subtree in the current buffer.  This
4429 puts overlays at the end of each headline, showing the total time
4430 recorded under that heading, including the time of any subheadings. You
4431 can use visibility cycling to study the tree, but the overlays disappear
4432 when you change the buffer (see variable
4433 @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
4434 @kindex C-c C-x C-r
4435 @item C-c C-x C-r
4436 Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
4437 report as an org-mode table into the current file.  When the cursor is
4438 at an existing clock table, just update it.  When called with a prefix
4439 argument, jump to the first clock report in the current document and
4440 update it.
4441 @example
4442 #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
4444 #+END: clocktable
4445 @end example
4446 @noindent
4447 If such a block already exists at point, its content is replaced by the
4448 new table.  The @samp{BEGIN} line can specify options:
4449 @example
4450 :maxlevel    @r{Maximum level depth to which times are listed in the table.}
4451 :emphasize   @r{When @code{t}, emphasize level one and level two items}
4452 :scope       @r{The scope to consider.  This can be any of the following:}
4453              nil        @r{the current buffer or narrowed region}
4454              file       @r{the full current buffer}
4455              subtree    @r{the subtree where the clocktable is located}
4456              treeN      @r{the surrounding level N tree, for example @code{tree3}}
4457              tree       @r{the surrounding level 1 tree}
4458              agenda     @r{all agenda files}
4459              ("file"..) @r{scan these files}
4460 :block       @r{The time block to consider.  This block is specified relative}
4461              @r{to the current time and may be any of these keywords:}
4462              @r{@code{today}, @code{yesterday}, @code{thisweek}, @code{lastweek},}
4463              @r{@code{thismonth}, @code{lastmonth}, @code{thisyear}, or @code{lastyear}}.
4464 :tstart      @r{A time string specifying when to start considering times}
4465 :tend        @r{A time string specifying when to stop considering times}
4466 :step        @r{@code{week} or @code{day}, to split the table into chunks}
4467 @end example
4468 So to get a clock summary of the current level 1 tree, for the current
4469 day, you could write
4470 @example
4471 #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1
4473 #+END: clocktable
4474 @end example
4475 and to use a specific time range you could write@footnote{Note that all
4476 parameters must be specified in a single line - the line is broken here
4477 only to fit it onto the manual.}
4478 @example
4479 #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>" 
4480                     :tend "<2006-08-10 Thu 12:00>"
4482 #+END: clocktable
4483 @end example
4484 @kindex C-c C-c
4485 @item C-c C-c
4486 @kindex C-c C-x C-u
4487 @itemx C-c C-x C-u
4488 Update dynamical block at point.  The cursor needs to be in the
4489 @code{#+BEGIN} line of the dynamic block.
4490 @kindex C-u C-c C-x C-u
4491 @item C-u C-c C-x C-u
4492 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
4493 you have several clocktable blocks in a buffer.
4494 @end table
4496 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
4497 the agenda (@pxref{Weekly/Daily agenda}) to show which tasks have been
4498 worked on or closed during a day.
4500 @node Remember, Agenda views, Dates and times, Top
4501 @chapter Remember
4502 @cindex @file{remember.el}
4504 The @i{Remember} package by John Wiegley lets you store quick notes with
4505 little interruption of your work flow.  See
4506 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
4507 information.  It is an excellent way to add new notes and tasks to
4508 Org-mode files.  Org-mode significantly expands the possibilities of
4509 @i{remember}: You may define templates for different note types, and
4510 associate target files and headlines with specific templates.  It also
4511 allows you to select the location where a note should be stored
4512 interactively, on the fly.
4514 @menu
4515 * Setting up remember::         Some code for .emacs to get things going
4516 * Remember templates::          Define the outline of different note types
4517 * Storing notes::               Directly get the note to where it belongs
4518 * Refiling notes::              Moving a note or task to a project
4519 @end menu
4521 @node Setting up remember, Remember templates, Remember, Remember
4522 @section Setting up remember
4524 The following customization will tell @i{remember} to use org files as
4525 target, and to create annotations compatible with Org-mode links.
4527 @example
4528 (org-remember-insinuate)
4529 (setq org-directory "~/path/to/my/orgfiles/")
4530 (setq org-default-notes-file (concat org-directory "/notes.org"))
4531 (define-key global-map "\C-cr" 'org-remember)
4532 @end example
4534 The last line binds the command @code{org-remember} to a global
4535 key@footnote{Please select your own key, @kbd{C-c r} is only a
4536 suggestion.}.  @code{org-remember} basically just calls @code{remember},
4537 but it makes a few things easier: If there is an active region, it will
4538 automatically copy the region into the remember buffer.  It also allows
4539 to jump to the buffer and location where remember notes are being
4540 stored: Just call @code{org-remember} with a prefix argument.  If you
4541 use two prefix arguments, Org-mode jumps to the location where the last
4542 remember note was stored.
4544 @node Remember templates, Storing notes, Setting up remember, Remember
4545 @section Remember templates
4546 @cindex templates, for remember
4548 In combination with Org-mode, you can use templates to generate
4549 different types of @i{remember} notes.  For example, if you would like
4550 to use one template to create general TODO entries, another one for
4551 journal entries, and a third one for collecting random ideas, you could
4552 use:
4554 @example
4555 (setq org-remember-templates
4556  '(("Todo" ?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org" "Tasks")
4557    ("Journal" ?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")
4558    ("Idea" ?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
4559 @end example
4561 @noindent In these entries, the first string is just a name, and the
4562 character specifies how to select the template.  It is useful if the
4563 character is also the first letter of the name.  The next string
4564 specifies the template.  Two more (optional) strings give the file in
4565 which, and the headline under which the new note should be stored.  The
4566 file (if not present or @code{nil}) defaults to
4567 @code{org-default-notes-file}, the heading to
4568 @code{org-remember-default-headline}.
4570 When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember
4571 something, org will prompt for a key to select the template (if you have
4572 more than one template) and then prepare the buffer like
4573 @example
4574 * TODO
4575   [[file:link to where you called remember]]
4576 @end example
4578 @noindent
4579 During expansion of the template, special @kbd{%}-escapes allow dynamic
4580 insertion of content:
4581 @example
4582 %^@{prompt@}  @r{prompt the user for a string and replace this sequence with it.}
4583             @r{You may specify a default value and a completion table with}
4584             @r{%^@{prompt|default|completion2|completion3...@}}
4585             @r{The arrow keys access a prompt-specific history.}
4586 %t          @r{time stamp, date only}
4587 %T          @r{time stamp with date and time}
4588 %u, %U      @r{like the above, but inactive time stamps}
4589 %^t         @r{like @code{%t}, but prompt for date.  Similarly @code{%^T}, @code{%^u}, @code{%^U}}
4590             @r{You may define a prompt like @code{%^@{Birthday@}t}}
4591 %n          @r{user name (taken from @code{user-full-name})}
4592 %a          @r{annotation, normally the link created with @code{org-store-link}}
4593 %A          @r{like @code{%a}, but prompt for the description part}
4594 %i          @r{initial content, the region when remember is called with C-u.}
4595             @r{The entire text will be indented like @code{%i} itself.}
4596 %c          @r{Content of the clipboard, or current kill ring head.}
4597 %^g         @r{prompt for tags, with completion on tags in target file.}
4598 %^G         @r{prompt for tags, with completion all tags in all agenda files.}
4599 %:keyword   @r{specific information for certain link types, see below}
4600 %[pathname] @r{insert the contents of the file given by @code{pathname}}
4601 %(sexp)     @r{evaluate elisp @code{(sexp)} and replace with the result}
4602 %!          @r{immediately store note after completing the template}
4603             @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
4604 @end example
4606 @noindent
4607 For specific link types, the following keywords will be
4608 defined@footnote{If you define your own link types (@pxref{Adding
4609 hyperlink types}), any property you store with
4610 @code{org-store-link-props} can be accessed in remember templates in a
4611 similar way.}:
4613 @example
4614 Link type          |  Available keywords
4615 -------------------+----------------------------------------------
4616 bbdb               |  %:name %:company
4617 bbdb               |  %::server %:port %:nick
4618 vm, wl, mh, rmail  |  %:type %:subject %:message-id
4619                    |  %:from %:fromname %:fromaddress
4620                    |  %:to   %:toname   %:toaddress
4621                    |  %: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}.}}       
4622 gnus               |  %:group, @r{for messages also all email fields}
4623 w3, w3m            |  %:url
4624 info               |  %:file %:node
4625 calendar           |  %:date"
4626 @end example
4628 @noindent
4629 To place the cursor after template expansion use:
4631 @example
4632 %?          @r{After completing the template, position cursor here.}
4633 @end example
4635 @noindent
4636 If you change your mind about which template to use, call
4637 @code{org-remember} in the remember buffer.  You may then select a new
4638 template that will be filled with the previous context information.
4640 @node Storing notes, Refiling notes, Remember templates, Remember
4641 @section Storing notes
4643 When you are finished preparing a note with @i{remember}, you have to
4644 press @kbd{C-c C-c} to file the note away.  The handler will store the
4645 note in the file and under the headline specified in the template, or it
4646 will use the default file and headlines.  The window configuration will
4647 be restored, sending you back to the working context before the call to
4648 @code{remember}.  To re-use the location found during the last call to
4649 @code{remember}, exit the remember buffer with @kbd{C-u C-u C-c C-c},
4650 i.e. specify a double prefix argument to @kbd{C-c C-c}.
4652 If you want to store the note directly to a different place, use
4653 @kbd{C-u C-c C-c} instead to exit remember@footnote{Configure the
4654 variable @code{org-remember-store-without-prompt} to make this behavior
4655 the default.}.  The handler will then first prompt for a target file -
4656 if you press @key{RET}, the value specified for the template is used.
4657 Then the command offers the headings tree of the selected file, with the
4658 cursor position at the default headline (if you had specified one in the
4659 template).  You can either immediately press @key{RET} to get the note
4660 placed there.  Or you can use the following keys to find a different
4661 location:
4662 @example
4663 @key{TAB}         @r{Cycle visibility.}
4664 @key{down} / @key{up}   @r{Next/previous visible headline.}
4665 n / p        @r{Next/previous visible headline.}
4666 f / b        @r{Next/previous headline same level.}
4667 u            @r{One level up.}
4668 @c 0-9          @r{Digit argument.}
4669 @end example
4670 @noindent
4671 Pressing @key{RET} or @key{left} or @key{right}
4672 then leads to the following result.
4674 @multitable @columnfractions 0.2 0.15 0.65
4675 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
4676 @item on headline     @tab @key{RET}              @tab as sublevel of the heading at cursor, first or last
4677 @item                 @tab                        @tab depending on @code{org-reverse-note-order}.
4678 @item                 @tab @key{left}/@key{right} @tab as same level, before/after current heading
4679 @item buffer-start    @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
4680 @item                 @tab @tab depending on @code{org-reverse-note-order}.
4681 @item not on headline @tab @key{RET}
4682       @tab at cursor position, level taken from context.
4683 @end multitable
4685 Before inserting the text into a tree, the function ensures that the
4686 text has a headline, i.e. a first line that starts with a @samp{*}.  If
4687 not, a headline is constructed from the current date and some additional
4688 data.  If you have indented the text of the note below the headline, the
4689 indentation will be adapted if inserting the note into the tree requires
4690 demotion from level 1.
4692 @node Refiling notes,  , Storing notes, Remember
4693 @section Refiling notes
4694 @cindex refiling notes
4696 Remember is usually used to quickly capture notes and tasks into one or
4697 a few capture lists.  When reviewing the captured data, you may want to
4698 refile some of the entries into a different list, for example into a
4699 project.  Cutting, finding the right location and then pasting the note
4700 is cumbersome.  To simplify this process, you can use the following
4701 special command:
4703 @table @kbd
4704 @kindex C-c C-w
4705 @item C-c C-w
4706 Refile the entry at point.  This command offers possible locations for
4707 refiling the entry and lets you select one with completion.  The item is
4708 filed below the target heading as a subitem.  Depending on
4709 @code{org-reverse-note-order}, it will be either the first of last
4710 subitem.@* By default, all level 1 headlines in the current buffer are
4711 considered to be targets, but you can have more complex definitions
4712 across a number of files.  See the variable @code{org-refile-targets}
4713 for details.
4714 @kindex C-u C-c C-w
4715 @item C-u C-c C-w
4716 Use the refile interface to jump to a heading.
4717 @kindex C-u C-u C-c C-w
4718 @item C- C-u C-c C-w
4719 Jump to the location where @code{org-refile} last moved a tree to.
4720 @end table
4722 @node Agenda views, Embedded LaTeX, Remember, Top
4723 @chapter Agenda Views
4724 @cindex agenda views
4726 Due to the way Org-mode works, TODO items, time-stamped items, and
4727 tagged headlines can be scattered throughout a file or even a number of
4728 files.  To get an overview of open action items, or of events that are
4729 important for a particular date, this information must be collected,
4730 sorted and displayed in an organized way.
4732 Org-mode can select items based on various criteria, and display them
4733 in a separate buffer.  Seven different view types are provided:
4735 @itemize @bullet
4736 @item
4737 an @emph{agenda} that is like a calendar and shows information
4738 for specific dates,
4739 @item
4740 a @emph{TODO list} that covers all unfinished
4741 action items,
4742 @item
4743 a @emph{tags view}, showings headlines based on
4744 the tags associated with them,
4745 @item
4746 a @emph{timeline view} that shows all events in a single Org-mode file,
4747 in time-sorted view,
4748 @item
4749 a @emph{keyword search view} that shows all entries from multiple files
4750 that contain specified keywords.
4751 @item
4752 a @emph{stuck projects view} showing projects that currently don't move
4753 along, and
4754 @item
4755 @emph{custom views} that are special tag/keyword searches and
4756 combinations of different views.
4757 @end itemize
4759 @noindent
4760 The extracted information is displayed in a special @emph{agenda
4761 buffer}.  This buffer is read-only, but provides commands to visit the
4762 corresponding locations in the original Org-mode files, and even to
4763 edit these files remotely.  
4765 Two variables control how the agenda buffer is displayed and whether the
4766 window configuration is restored when the agenda exits:
4767 @code{org-agenda-window-setup} and
4768 @code{org-agenda-restore-windows-after-quit}.
4770 @menu
4771 * Agenda files::                Files being searched for agenda information
4772 * Agenda dispatcher::           Keyboard access to agenda views
4773 * Built-in agenda views::       What is available out of the box?
4774 * Presentation and sorting::    How agenda items are prepared for display
4775 * Agenda commands::             Remote editing of org trees
4776 * Custom agenda views::         Defining special searches and views
4777 @end menu
4779 @node Agenda files, Agenda dispatcher, Agenda views, Agenda views
4780 @section Agenda files
4781 @cindex agenda files
4782 @cindex files for agenda
4784 The information to be shown is normally collected from all @emph{agenda
4785 files}, the files listed in the variable
4786 @code{org-agenda-files}@footnote{If the value of that variable is not a
4787 list, but a single file name, then the list of agenda files will be
4788 maintained in that external file.}. If a directory is part of this list,
4789 all files with the extension @file{.org} in this directory will be part
4790 of the list.
4792 Thus even if you only work with a single Org-mode file, this file should
4793 be put into that list@footnote{When using the dispatcher, pressing
4794 @kbd{<} before selecting a command will actually limit the command to
4795 the current file, and ignore @code{org-agenda-files} until the next
4796 dispatcher command.}.  You can customize @code{org-agenda-files}, but
4797 the easiest way to maintain it is through the following commands
4799 @cindex files, adding to agenda list
4800 @table @kbd
4801 @kindex C-c [
4802 @item C-c [
4803 Add current file to the list of agenda files.  The file is added to
4804 the front of the list.  If it was already in the list, it is moved to
4805 the front.  With prefix arg, file is added/moved to the end.
4806 @kindex C-c ]
4807 @item C-c ]
4808 Remove current file from the list of agenda files.
4809 @kindex C-,
4810 @kindex C-'
4811 @item C-,
4812 @itemx C-'
4813 Cycle through agenda file list, visiting one file after the other.
4814 @end table
4816 @noindent
4817 The Org menu contains the current list of files and can be used
4818 to visit any of them.
4820 If you would like to focus the agenda temporarily onto a file not in
4821 this list, or onto just one file in the list or even only a subtree in a
4822 file, this can be done in different ways.  For a single agenda command,
4823 you may press @kbd{<} once or several times in the dispatcher
4824 (@pxref{Agenda dispatcher}).  To restrict the agenda scope for an
4825 extended period, use the following commands:
4827 @table @kbd
4828 @kindex C-c C-x <
4829 @item C-c C-x <
4830 Permanently restrict the agenda to the current subtree.  When with a
4831 prefix argument, or with the cursor before the first headline in a file,
4832 the agenda scope is set to the entire file.  This restriction remains in
4833 effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
4834 or @kbd{>} in the agenda dispatcher.  If there is a window displaying an
4835 agenda view, the new restriction takes effect immediately.
4836 @kindex C-c C-x <
4837 @item C-c C-x <
4838 Remove the permanent restriction created by @kbd{C-c C-x <}.
4839 @end table
4841 @noindent
4842 When working with @file{Speedbar}, you can use the following commands in
4843 the speedbar frame:
4844 @table @kbd
4845 @kindex <
4846 @item < @r{in the speedbar frame}
4847 Permanently restrict the agenda to the item at the cursor in the
4848 speedbar frame, either an Org-mode file or a subtree in such a file.
4849 If there is a window displaying an agenda view, the new restriction takes
4850 effect immediately.
4851 @kindex <
4852 @item > @r{in the speedbar frame}
4853 Lift the restriction again.
4854 @end table
4856 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda views
4857 @section The agenda dispatcher
4858 @cindex agenda dispatcher
4859 @cindex dispatching agenda commands
4860 The views are created through a dispatcher that should be bound to a
4861 global key, for example @kbd{C-c a} (@pxref{Installation}).  In the
4862 following we will assume that @kbd{C-c a} is indeed how the dispatcher
4863 is accessed and list keyboard access to commands accordingly.  After
4864 pressing @kbd{C-c a}, an additional letter is required to execute a
4865 command.  The dispatcher offers the following default commands:
4866 @table @kbd
4867 @item a
4868 Create the calendar-like agenda (@pxref{Weekly/Daily agenda}).
4869 @item t @r{/} T
4870 Create a list of all TODO items (@pxref{Global TODO list}).
4871 @item m @r{/} M
4872 Create a list of headlines matching a TAGS expression (@pxref{Matching
4873 tags and properties}).
4874 @item L
4875 Create the timeline view for the current buffer (@pxref{Timeline}).
4876 @item s
4877 Create a list of entries selected by a boolean expression of keywords
4878 and/or regular expressions that must or must not occur in the entry.
4879 @item /
4880 Search for a regular expression in all agenda files and additionally in
4881 the files listed in @code{org-agenda-multi-occur-extra-files}.  This
4882 uses the Emacs command @code{multi-occur}.  A prefix argument can be
4883 used to specify the number of context lines for each match, default is
4885 @item # @r{/} !
4886 Create a list of stuck projects (@pxref{Stuck projects}).
4887 @item <
4888 Restrict an agenda command to the current buffer@footnote{For backward
4889 compatibility, you can also press @kbd{1} to restrict to the current
4890 buffer.}.  After pressing @kbd{<}, you still need to press the character
4891 selecting the command.
4892 @item < <
4893 If there is an active region, restrict the following agenda command to
4894 the region.  Otherwise, restrict it to the current subtree@footnote{For
4895 backward compatibility, you can also press @kbd{0} to restrict to the
4896 current buffer.}.  After pressing @kbd{< <}, you still need to press the
4897 character selecting the command.
4898 @end table
4900 You can also define custom commands that will be accessible through the
4901 dispatcher, just like the default commands.  This includes the
4902 possibility to create extended agenda buffers that contain several
4903 blocks together, for example the weekly agenda, the global TODO list and
4904 a number of special tags matches.  @xref{Custom agenda views}.
4906 @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda views
4907 @section The built-in agenda views
4909 In this section we describe the built-in views.
4911 @menu
4912 * Weekly/Daily agenda::         The calendar page with current tasks
4913 * Global TODO list::            All unfinished action items
4914 * Matching tags and properties::  Structured information with fine-tuned search
4915 * Timeline::                    Time-sorted view for single file
4916 * Keyword search::              Finding entries by keyword
4917 * Stuck projects::              Find projects you need to review
4918 @end menu
4920 @node Weekly/Daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
4921 @subsection The weekly/daily agenda
4922 @cindex agenda
4923 @cindex weekly agenda
4924 @cindex daily agenda
4926 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
4927 paper agenda, showing all the tasks for the current week or day.
4929 @table @kbd
4930 @cindex org-agenda, command
4931 @kindex C-c a a
4932 @item C-c a a
4933 Compile an agenda for the current week from a list of org files.  The
4934 agenda shows the entries for each day.  With a numeric
4935 prefix@footnote{For backward compatibility, the universal prefix
4936 @kbd{C-u} causes all TODO entries to be listed before the agenda.  This
4937 feature is deprecated, use the dedicated TODO list, or a block agenda
4938 instead.}  (like @kbd{C-u 2 1 C-c a a}) you may set the number of days
4939 to be displayed (see also the variable @code{org-agenda-ndays})
4940 @end table
4942 Remote editing from the agenda buffer means, for example, that you can
4943 change the dates of deadlines and appointments from the agenda buffer.
4944 The commands available in the Agenda buffer are listed in @ref{Agenda
4945 commands}.
4947 @subsubheading Calendar/Diary integration
4948 @cindex calendar integration
4949 @cindex diary integration
4951 Emacs contains the calendar and diary by Edward M. Reingold.  The
4952 calendar displays a three-month calendar with holidays from different
4953 countries and cultures.  The diary allows you to keep track of
4954 anniversaries, lunar phases, sunrise/set, recurrent appointments
4955 (weekly, monthly) and more.  In this way, it is quite complementary to
4956 Org-mode.  It can be very useful to combine output from Org-mode with
4957 the diary.
4959 In order to include entries from the Emacs diary into Org-mode's
4960 agenda, you only need to customize the variable
4962 @lisp
4963 (setq org-agenda-include-diary t)
4964 @end lisp
4966 @noindent After that, everything will happen automatically.  All diary
4967 entries including holidays, anniversaries etc will be included in the
4968 agenda buffer created by Org-mode.  @key{SPC}, @key{TAB}, and
4969 @key{RET} can be used from the agenda buffer to jump to the diary
4970 file in order to edit existing diary entries.  The @kbd{i} command to
4971 insert new entries for the current date works in the agenda buffer, as
4972 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
4973 Sunrise/Sunset times, show lunar phases and to convert to other
4974 calendars, respectively.  @kbd{c} can be used to switch back and forth
4975 between calendar and agenda.
4977 If you are using the diary only for sexp entries and holidays, it is
4978 faster to not use the above setting, but instead to copy or even move
4979 the entries into an Org-mode file. Org-mode evaluates diary-style sexp
4980 entries, and does it faster because there is no overhead for first
4981 creating the diary display.  Note that the sexp entries must start at
4982 the left margin, no white space is allowed before them.  For example,
4983 the following segment of an Org-mode file will be processed and entries
4984 will be made in the agenda:
4986 @example
4987 * Birthdays and similar stuff
4988 #+CATEGORY: Holiday
4989 %%(org-calendar-holiday)   ; special function for holiday names
4990 #+CATEGORY: Ann
4991 %%(diary-anniversary 14  5 1956) Arthur Dent is %d years old
4992 %%(diary-anniversary  2 10 1869) Mahatma Gandhi would be %d years old
4993 @end example
4995 @subsubheading Appointment reminders
4996 @cindex @file{appt.el}
4997 @cindex appointment reminders
4999 Org can interact with Emacs appointments notification facility.
5001 To add all the appointments of your agenda files, use the command
5002 @code{org-agenda-to-appt}.  This commands also lets you filter through
5003 the list of your appointments and add only those belonging to a specific
5004 category or matching a regular expression. See the docstring for
5005 details.
5007 @node Global TODO list, Matching tags and properties, Weekly/Daily agenda, Built-in agenda views
5008 @subsection The global TODO list
5009 @cindex global TODO list
5010 @cindex TODO list, global
5012 The global TODO list contains all unfinished TODO items, formatted and
5013 collected into a single place.
5015 @table @kbd
5016 @kindex C-c a t
5017 @item C-c a t
5018 Show the global TODO list.  This collects the TODO items from all
5019 agenda files (@pxref{Agenda views}) into a single buffer.  The buffer is in
5020 @code{agenda-mode}, so there are commands to examine and manipulate
5021 the TODO entries directly from that buffer (@pxref{Agenda commands}).
5022 @kindex C-c a T
5023 @item C-c a T
5024 @cindex TODO keyword matching
5025 Like the above, but allows selection of a specific TODO keyword.  You
5026 can also do this by specifying a prefix argument to @kbd{C-c a t}.  With
5027 a @kbd{C-u} prefix you are prompted for a keyword, and you may also
5028 specify several keywords by separating them with @samp{|} as boolean OR
5029 operator.  With a numeric prefix, the Nth keyword in
5030 @code{org-todo-keywords} is selected.
5031 @kindex r
5032 The @kbd{r} key in the agenda buffer regenerates it, and you can give
5033 a prefix argument to this command to change the selected TODO keyword,
5034 for example @kbd{3 r}.  If you often need a search for a specific
5035 keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
5036 Matching specific TODO keywords can also be done as part of a tags
5037 search (@pxref{Tag searches}).
5038 @end table
5040 Remote editing of TODO items means that you can change the state of a
5041 TODO entry with a single key press.  The commands available in the
5042 TODO list are described in @ref{Agenda commands}.
5044 @cindex sublevels, inclusion into todo list
5045 Normally the global todo list simply shows all headlines with TODO
5046 keywords.  This list can become very long.  There are two ways to keep
5047 it more compact:
5048 @itemize @minus
5049 @item
5050 Some people view a TODO item that has been @emph{scheduled} for
5051 execution (@pxref{Time stamps}) as no longer @emph{open}.  Configure the
5052 variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
5053 items from the global TODO list.
5054 @item
5055 TODO items may have sublevels to break up the task into subtasks.  In
5056 such cases it may be enough to list only the highest level TODO headline
5057 and omit the sublevels from the global list.  Configure the variable
5058 @code{org-agenda-todo-list-sublevels} to get this behavior.
5059 @end itemize
5061 @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
5062 @subsection Matching Tags and Properties
5063 @cindex matching, of tags
5064 @cindex matching, of properties
5065 @cindex tags view
5067 If headlines in the agenda files are marked with @emph{tags}
5068 (@pxref{Tags}), you can select headlines based on the tags that apply
5069 to them and collect them into an agenda buffer.
5071 @table @kbd
5072 @kindex C-c a m
5073 @item C-c a m
5074 Produce a list of all headlines that match a given set of tags.  The
5075 command prompts for a selection criterion, which is a boolean logic
5076 expression with tags, like @samp{+work+urgent-withboss} or
5077 @samp{work|home} (@pxref{Tags}).  If you often need a specific search,
5078 define a custom command for it (@pxref{Agenda dispatcher}).
5079 @kindex C-c a M
5080 @item C-c a M
5081 Like @kbd{C-c a m}, but only select headlines that are also TODO items
5082 and force checking subitems (see variable
5083 @code{org-tags-match-list-sublevels}).  Matching specific todo keywords
5084 together with a tags match is also possible, see @ref{Tag searches}.
5085 @end table
5087 The commands available in the tags list are described in @ref{Agenda
5088 commands}.
5090 @node Timeline, Stuck projects, Matching tags and properties, Built-in agenda views
5091 @subsection Timeline for a single file
5092 @cindex timeline, single file
5093 @cindex time-sorted view
5095 The timeline summarizes all time-stamped items from a single Org-mode
5096 file in a @emph{time-sorted view}.  The main purpose of this command is
5097 to give an overview over events in a project.
5099 @table @kbd
5100 @kindex C-c a L
5101 @item C-c a L
5102 Show a time-sorted view of the org file, with all time-stamped items.
5103 When called with a @kbd{C-u} prefix, all unfinished TODO entries
5104 (scheduled or not) are also listed under the current date.
5105 @end table
5107 @noindent
5108 The commands available in the timeline buffer are listed in
5109 @ref{Agenda commands}.
5111 @node Keyword search, Stuck projects, Timeline, Built-in agenda views
5112 @subsection Keyword search
5113 @cindex keyword search
5114 @cindex searching, for keywords
5116 This agenda view is a general text search facility for Org-mode entries.
5117 It is particularly useful to find notes.
5119 @table @kbd
5120 @kindex C-c a s
5121 @item C-c a s
5122 This is a special search that lets you select entries by keywords or
5123 regular expression, using a boolean logic.  For example, the search
5124 string
5126 @example
5127 +computer +wifi -ethernet -@{8\.11[bg]@}
5128 @end example
5130 Will search for note entries that contain the keywords @code{computer}
5131 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
5132 not matched by the regular expression @code{8\.11[bg]}, meaning to
5133 exclude both 8.11b and 8.11g.
5134 @end table
5137 @node Stuck projects,  , Timeline, Built-in agenda views
5138 @subsection Stuck projects
5140 If you are following a system like David Allen's GTD to organize your
5141 work, one of the ``duties'' you have is a regular review to make sure
5142 that all projects move along.  A @emph{stuck} project is a project that
5143 has no defined next actions, so it will never show up in the TODO lists
5144 Org-mode produces.  During the review, you need to identify such
5145 projects and define next actions for them.
5147 @table @kbd
5148 @kindex C-c a #
5149 @item C-c a #
5150 List projects that are stuck.
5151 @kindex C-c a !
5152 @item C-c a !
5153 Customize the variable @code{org-stuck-projects} to define what a stuck
5154 project is and how to find it.
5155 @end table
5157 You almost certainly will have to configure this view before it will
5158 work for you.  The built-in default assumes that all your projects are
5159 level-2 headlines, and that a project is not stuck if it has at least
5160 one entry marked with a todo keyword TODO or NEXT or NEXTACTION.
5162 Lets assume that you, in your own way of using Org-mode, identify
5163 projects with a tag PROJECT, and that you use a todo keyword MAYBE to
5164 indicate a project that should not be considered yet.  Lets further
5165 assume that the todo keyword DONE marks finished projects, and that NEXT
5166 and TODO indicate next actions.  The tag @@SHOP indicates shopping and
5167 is a next action even without the NEXT tag.  Finally, if the project
5168 contains the special word IGNORE anywhere, it should not be listed
5169 either.  In this case you would start by identifying eligible projects
5170 with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
5171 TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
5172 are not stuck.  The correct customization for this is
5174 @lisp
5175 (setq org-stuck-projects
5176       '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
5177                                "\\<IGNORE\\>"))
5178 @end lisp
5181 @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda views
5182 @section Presentation and sorting
5183 @cindex presentation, of agenda items
5185 Before displaying items in an agenda view, Org-mode visually prepares
5186 the items and sorts them.  Each item occupies a single line.  The line
5187 starts with a @emph{prefix} that contains the @emph{category}
5188 (@pxref{Categories}) of the item and other important information.  You can
5189 customize the prefix using the option @code{org-agenda-prefix-format}.
5190 The prefix is followed by a cleaned-up version of the outline headline
5191 associated with the item.
5193 @menu
5194 * Categories::                  Not all tasks are equal
5195 * Time-of-day specifications::  How the agenda knows the time
5196 * Sorting of agenda items::     The order of things
5197 @end menu
5199 @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
5200 @subsection Categories
5202 @cindex category
5203 The category is a broad label assigned to each agenda item.  By default,
5204 the category is simply derived from the file name, but you can also
5205 specify it with a special line in the buffer, like this@footnote{For
5206 backward compatibility, the following also works: If there are several
5207 such lines in a file, each specifies the category for the text below it.
5208 The first category also applies to any text before the first CATEGORY
5209 line.  However, using this method is @emph{strongly} deprecated as it is
5210 incompatible with the outline structure of the document.  The correct
5211 method for setting multiple categories in a buffer is using a
5212 property.}:
5214 @example
5215 #+CATEGORY: Thesis
5216 @end example
5218 @noindent
5219 If you would like to have a special CATEGORY for a single entry or a
5220 (sub)tree, give the entry a @code{:CATEGORY:} property with the location
5221 as the value (@pxref{Properties and columns}).
5223 @noindent
5224 The display in the agenda buffer looks best if the category is not
5225 longer than 10 characters.
5227 @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
5228 @subsection Time-of-Day Specifications
5229 @cindex time-of-day specification
5231 Org-mode checks each agenda item for a time-of-day specification.  The
5232 time can be part of the time stamp that triggered inclusion into the
5233 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}.  Time
5234 ranges can be specified with two time stamps, like
5236 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
5238 In the headline of the entry itself, a time(range) may also appear as
5239 plain text (like @samp{12:45} or a @samp{8:30-1pm}.  If the agenda
5240 integrates the Emacs diary (@pxref{Weekly/Daily agenda}), time
5241 specifications in diary entries are recognized as well.
5243 For agenda display, Org-mode extracts the time and displays it in a
5244 standard 24 hour format as part of the prefix.  The example times in
5245 the previous paragraphs would end up in the agenda like this:
5247 @example
5248     8:30-13:00 Arthur Dent lies in front of the bulldozer
5249    12:45...... Ford Prefect arrives and takes Arthur to the pub
5250    19:00...... The Vogon reads his poem
5251    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5252 @end example
5254 @cindex time grid
5255 If the agenda is in single-day mode, or for the display of today, the
5256 timed entries are embedded in a time grid, like
5258 @example
5259     8:00...... ------------------
5260     8:30-13:00 Arthur Dent lies in front of the bulldozer
5261    10:00...... ------------------
5262    12:00...... ------------------
5263    12:45...... Ford Prefect arrives and takes Arthur to the pub
5264    14:00...... ------------------
5265    16:00...... ------------------
5266    18:00...... ------------------
5267    19:00...... The Vogon reads his poem
5268    20:00...... ------------------
5269    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5270 @end example
5272 The time grid can be turned on and off with the variable
5273 @code{org-agenda-use-time-grid}, and can be configured with
5274 @code{org-agenda-time-grid}.
5276 @node Sorting of agenda items,  , Time-of-day specifications, Presentation and sorting
5277 @subsection Sorting of agenda items
5278 @cindex sorting, of agenda items
5279 @cindex priorities, of agenda items
5280 Before being inserted into a view, the items are sorted.  How this is
5281 done depends on the type of view.
5282 @itemize @bullet
5283 @item
5284 For the daily/weekly agenda, the items for each day are sorted.  The
5285 default order is to first collect all items containing an explicit
5286 time-of-day specification.  These entries will be shown at the beginning
5287 of the list, as a @emph{schedule} for the day.  After that, items remain
5288 grouped in categories, in the sequence given by @code{org-agenda-files}.
5289 Within each category, items are sorted by priority (@pxref{Priorities}),
5290 which is composed of the base priority (2000 for priority @samp{A}, 1000
5291 for @samp{B}, and 0 for @samp{C}), plus additional increments for
5292 overdue scheduled or deadline items.
5293 @item 
5294 For the TODO list, items remain in the order of categories, but within
5295 each category, sorting takes place according to priority
5296 (@pxref{Priorities}).
5297 @item
5298 For tags matches, items are not sorted at all, but just appear in the
5299 sequence in which they are found in the agenda files.
5300 @end itemize
5302 Sorting can be customized using the variable
5303 @code{org-agenda-sorting-strategy}.
5306 @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda views
5307 @section Commands in the agenda buffer
5308 @cindex commands, in agenda buffer
5310 Entries in the agenda buffer are linked back to the org file or diary
5311 file where they originate.  You are not allowed to edit the agenda
5312 buffer itself, but commands are provided to show and jump to the
5313 original entry location, and to edit the org-files ``remotely'' from
5314 the agenda buffer.  In this way, all information is stored only once,
5315 removing the risk that your agenda and note files may diverge.
5317 Some commands can be executed with mouse clicks on agenda lines.  For
5318 the other commands, the cursor needs to be in the desired line.
5320 @table @kbd
5321 @tsubheading{Motion}
5322 @cindex motion commands in agenda
5323 @kindex n
5324 @item n
5325 Next line (same as @key{up} and @kbd{C-p}).
5326 @kindex p
5327 @item p
5328 Previous line (same as @key{down} and @kbd{C-n}).
5329 @tsubheading{View/GoTo org file}
5330 @kindex mouse-3
5331 @kindex @key{SPC}
5332 @item mouse-3
5333 @itemx @key{SPC}
5334 Display the original location of the item in another window.
5336 @kindex L
5337 @item L
5338 Display original location and recenter that window.
5340 @kindex mouse-2
5341 @kindex mouse-1
5342 @kindex @key{TAB}
5343 @item mouse-2
5344 @itemx mouse-1
5345 @itemx @key{TAB}
5346 Go to the original location of the item in another window.  Under Emacs
5347 22, @kbd{mouse-1} will also works for this.
5349 @kindex @key{RET}
5350 @itemx @key{RET}
5351 Go to the original location of the item and delete other windows.
5353 @kindex f
5354 @item f
5355 Toggle Follow mode.  In Follow mode, as you move the cursor through
5356 the agenda buffer, the other window always shows the corresponding
5357 location in the org file.  The initial setting for this mode in new
5358 agenda buffers can be set with the variable
5359 @code{org-agenda-start-with-follow-mode}.
5361 @kindex b
5362 @item b
5363 Display the entire subtree of the current item in an indirect buffer.
5364 With numerical prefix ARG, go up to this level and then take that tree.
5365 If ARG is negative, go up that many levels.  With @kbd{C-u} prefix, do
5366 not remove the previously used indirect buffer.
5368 @kindex l
5369 @item l
5370 Toggle Logbook mode.  In Logbook mode, entries that where marked DONE while
5371 logging was on (variable @code{org-log-done}) are shown in the agenda,
5372 as are entries that have been clocked on that day.
5374 @tsubheading{Change display}
5375 @cindex display changing, in agenda
5376 @kindex o
5377 @item o
5378 Delete other windows.
5380 @kindex d
5381 @kindex w
5382 @kindex m
5383 @kindex y
5384 @item d w m y
5385 Switch to day/week/month/year view.  When switching to day or week view,
5386 this setting becomes the default for subseqent agenda commands.  Since
5387 month and year views are slow to create, the do not become the default.
5389 @kindex D
5390 @item D
5391 Toggle the inclusion of diary entries.  See @ref{Weekly/Daily agenda}.
5393 @kindex G
5394 @item G
5395 Toggle the time grid on and off.  See also the variables
5396 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
5398 @kindex r
5399 @item r
5400 Recreate the agenda buffer, for example to reflect the changes
5401 after modification of the time stamps of items with S-@key{left} and
5402 S-@key{right}.  When the buffer is the global todo list, a prefix
5403 argument is interpreted to create a selective list for a specific TODO
5404 keyword.
5405 @kindex g
5406 @item g
5407 Same as @kbd{r}.
5409 @kindex s
5410 @kindex C-x C-s
5411 @item s
5412 @itemx C-x C-s
5413 Save all Org-mode buffers in the current Emacs session.
5415 @kindex @key{right}
5416 @item @key{right}
5417 Display the following @code{org-agenda-ndays} days.  For example, if
5418 the display covers a week, switch to the following week.  With prefix
5419 arg, go forward that many times @code{org-agenda-ndays} days.
5421 @kindex @key{left}
5422 @item @key{left}
5423 Display the previous dates.
5425 @kindex .
5426 @item .
5427 Goto today.
5429 @tsubheading{Remote editing}
5430 @cindex remote editing, from agenda
5432 @item 0-9
5433 Digit argument.
5435 @cindex undoing remote-editing events
5436 @cindex remote editing, undo
5437 @kindex C-_
5438 @item C-_
5439 Undo a change due to a remote editing command.  The change is undone
5440 both in the agenda buffer and in the remote buffer.
5442 @kindex t
5443 @item t
5444 Change the TODO state of the item, both in the agenda and in the
5445 original org file.
5447 @kindex C-k
5448 @item C-k
5449 Delete the current agenda item along with the entire subtree belonging
5450 to it in the original Org-mode file.  If the text to be deleted remotely
5451 is longer than one line, the kill needs to be confirmed by the user.  See
5452 variable @code{org-agenda-confirm-kill}.
5454 @kindex $
5455 @item $
5456 Archive the subtree corresponding to the current headline.
5458 @kindex T
5459 @item T
5460 Show all tags associated with the current item.  Because of
5461 inheritance, this may be more than the tags listed in the line itself.
5463 @kindex :
5464 @item :
5465 Set tags for the current headline.  If there is an active region in the
5466 agenda, change a tag for all headings in the region.
5468 @kindex a
5469 @item a
5470 Toggle the ARCHIVE tag for the current headline.
5472 @kindex ,
5473 @item ,
5474 Set the priority for the current item.  Org-mode prompts for the
5475 priority character. If you reply with @key{SPC}, the priority cookie
5476 is removed from the entry.
5478 @kindex P
5479 @item P
5480 Display weighted priority of current item.
5482 @kindex +
5483 @kindex S-@key{up}
5484 @item +
5485 @itemx S-@key{up}
5486 Increase the priority of the current item.  The priority is changed in
5487 the original buffer, but the agenda is not resorted.  Use the @kbd{r}
5488 key for this.
5490 @kindex -
5491 @kindex S-@key{down}
5492 @item -
5493 @itemx S-@key{down}
5494 Decrease the priority of the current item.
5496 @kindex C-c C-s
5497 @item C-c C-s
5498 Schedule this item
5500 @kindex C-c C-d
5501 @item C-c C-d
5502 Set a deadline for this item.
5504 @kindex S-@key{right}
5505 @item S-@key{right}
5506 Change the time stamp associated with the current line by one day into
5507 the future.  With prefix argument, change it by that many days.  For
5508 example, @kbd{3 6 5 S-@key{right}} will change it by a year.  The
5509 stamp is changed in the original org file, but the change is not
5510 directly reflected in the agenda buffer.  Use the
5511 @kbd{r} key to update the buffer.
5513 @kindex S-@key{left}
5514 @item S-@key{left}
5515 Change the time stamp associated with the current line by one day
5516 into the past.
5518 @kindex >
5519 @item >
5520 Change the time stamp associated with the current line to today.
5521 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
5522 on my keyboard.
5524 @kindex I
5525 @item I
5526 Start the clock on the current item.  If a clock is running already, it
5527 is stopped first.
5529 @kindex O
5530 @item O
5531 Stop the previously started clock.
5533 @kindex X
5534 @item X
5535 Cancel the currently running clock.
5537 @kindex J
5538 @item J
5539 Jump to the running clock in another window.
5541 @tsubheading{Calendar commands}
5542 @cindex calendar commands, from agenda
5543 @kindex c
5544 @item c
5545 Open the Emacs calendar and move to the date at the agenda cursor.
5547 @item c
5548 When in the calendar, compute and show the Org-mode agenda for the
5549 date at the cursor.
5551 @cindex diary entries, creating from agenda
5552 @kindex i
5553 @item i
5554 Insert a new entry into the diary.  Prompts for the type of entry
5555 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
5556 entry in the diary, just as @kbd{i d} etc. would do in the calendar.
5557 The date is taken from the cursor position.
5559 @kindex M
5560 @item M
5561 Show the phases of the moon for the three months around current date.
5563 @kindex S
5564 @item S
5565 Show sunrise and sunset times.  The geographical location must be set
5566 with calendar variables, see documentation of the Emacs calendar.
5568 @kindex C
5569 @item C
5570 Convert the date at cursor into many other cultural and historic
5571 calendars.
5573 @kindex H
5574 @item H
5575 Show holidays for three month around the cursor date.
5577 @c FIXME:  This should be a different key.
5578 @kindex C-c C-x C-c
5579 @item C-c C-x C-c
5580 Export a single iCalendar file containing entries from all agenda files.
5582 @tsubheading{Exporting to a file}
5583 @kindex C-x C-w
5584 @item C-x C-w
5585 @cindex exporting agenda views
5586 @cindex agenda views, exporting
5587 Write the agenda view to a file.  Depending on the extension of the
5588 selected file name, the view will be exported as HTML (extension
5589 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
5590 plain text (any other extension).  Use the variable
5591 @code{org-agenda-exporter-settings} to set options for @file{ps-print}
5592 and for @file{htmlize} to be used during export.
5594 @tsubheading{Quit and Exit}
5595 @kindex q
5596 @item q
5597 Quit agenda, remove the agenda buffer.
5599 @kindex x
5600 @cindex agenda files, removing buffers
5601 @item x
5602 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
5603 for the compilation of the agenda.  Buffers created by the user to
5604 visit org files will not be removed.
5605 @end table
5608 @node Custom agenda views,  , Agenda commands, Agenda views
5609 @section Custom agenda views
5610 @cindex custom agenda views
5611 @cindex agenda views, custom
5613 Custom agenda commands serve two purposes: to store and quickly access
5614 frequently used TODO and tags searches, and to create special composite
5615 agenda buffers.  Custom agenda commands will be accessible through the
5616 dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
5618 @menu
5619 * Storing searches::            Type once, use often
5620 * Block agenda::                All the stuff you need in a single buffer
5621 * Setting Options::             Changing the rules
5622 * Exporting Agenda Views::      Writing agendas to files.
5623 * Extracting Agenda Information for other programs::  
5624 @end menu
5626 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
5627 @subsection Storing searches
5629 The first application of custom searches is the definition of keyboard
5630 shortcuts for frequently used searches, either creating an agenda
5631 buffer, or a sparse tree (the latter covering of course only the current
5632 buffer).
5633 @kindex C-c a C
5634 Custom commands are configured in the variable
5635 @code{org-agenda-custom-commands}.  You can customize this variable, for
5636 example by pressing @kbd{C-c a C}.  You can also directly set it with
5637 Emacs Lisp in @file{.emacs}.  The following example contains all valid
5638 search types:
5640 @lisp
5641 @group
5642 (setq org-agenda-custom-commands
5643       '(("w" todo "WAITING")
5644         ("W" todo-tree "WAITING")
5645         ("u" tags "+boss-urgent")
5646         ("v" tags-todo "+boss-urgent")
5647         ("U" tags-tree "+boss-urgent")
5648         ("f" occur-tree "\\<FIXME\\>")
5649         ("h" . "HOME+Name tags searches") ; description for "h" prefix
5650         ("hl" tags "+home+Lisa")
5651         ("hp" tags "+home+Peter")
5652         ("hk" tags "+home+Kim")))
5653 @end group
5654 @end lisp
5656 @noindent
5657 The initial string in each entry defines the keys you have to press
5658 after the dispatcher command @kbd{C-c a} in order to access the command.
5659 Usually this will be just a single character, but if you have many
5660 similar commands, you can also define two-letter combinations where the
5661 first character is the same in several combinations and serves as a
5662 prefix key@footnote{You can provide a description for a prefix key by
5663 inserting a cons cell with the prefix and the description.}.  The second
5664 parameter is the search type, followed by the string or regular
5665 expression to be used for the matching.  The example above will
5666 therefore define:
5668 @table @kbd
5669 @item C-c a w
5670 as a global search for TODO entries with @samp{WAITING} as the TODO
5671 keyword
5672 @item C-c a W
5673 as the same search, but only in the current buffer and displaying the
5674 results as a sparse tree
5675 @item C-c a u
5676 as a global tags search for headlines marked @samp{:boss:} but not
5677 @samp{:urgent:}
5678 @item C-c a v
5679 as the same search as @kbd{C-c a u}, but limiting the search to
5680 headlines that are also TODO items
5681 @item C-c a U
5682 as the same search as @kbd{C-c a u}, but only in the current buffer and
5683 displaying the result as a sparse tree
5684 @item C-c a f
5685 to create a sparse tree (again: current buffer only) with all entries
5686 containing the word @samp{FIXME}
5687 @item C-c a h
5688 as a prefix command for a HOME tags search where you have to press an
5689 additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
5690 Peter, or Kim) as additional tag to match.
5691 @end table
5693 @node Block agenda, Setting Options, Storing searches, Custom agenda views
5694 @subsection Block agenda
5695 @cindex block agenda
5696 @cindex agenda, with block views
5698 Another possibility is the construction of agenda views that comprise
5699 the results of @emph{several} commands, each of which creates a block in
5700 the agenda buffer.  The available commands include @code{agenda} for the
5701 daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
5702 for the global todo list (as constructed with @kbd{C-c a t}), and the
5703 matching commands discussed above: @code{todo}, @code{tags}, and
5704 @code{tags-todo}.  Here are two examples:
5706 @lisp
5707 @group
5708 (setq org-agenda-custom-commands
5709       '(("h" "Agenda and Home-related tasks"
5710          ((agenda)
5711           (tags-todo "home")
5712           (tags "garden")))
5713         ("o" "Agenda and Office-related tasks"
5714          ((agenda)
5715           (tags-todo "work")
5716           (tags "office")))))
5717 @end group
5718 @end lisp
5720 @noindent
5721 This will define @kbd{C-c a h} to create a multi-block view for stuff
5722 you need to attend to at home.  The resulting agenda buffer will contain
5723 your agenda for the current week, all TODO items that carry the tag
5724 @samp{home}, and also all lines tagged with @samp{garden}.  Finally the
5725 command @kbd{C-c a o} provides a similar view for office tasks.
5728 @node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
5729 @subsection Setting Options for custom commands
5730 @cindex options, for custom agenda views
5732 Org-mode contains a number of variables regulating agenda construction
5733 and display.  The global variables define the behavior for all agenda
5734 commands, including the custom commands.  However, if you want to change
5735 some settings just for a single custom view, you can do so.  Setting
5736 options requires inserting a list of variable names and values at the
5737 right spot in @code{org-agenda-custom-commands}.  For example:
5739 @lisp
5740 @group
5741 (setq org-agenda-custom-commands
5742       '(("w" todo "WAITING"
5743          ((org-agenda-sorting-strategy '(priority-down))
5744           (org-agenda-prefix-format "  Mixed: ")))
5745         ("U" tags-tree "+boss-urgent"
5746          ((org-show-following-heading nil)
5747           (org-show-hierarchy-above nil)))))
5748 @end group
5749 @end lisp
5751 @noindent
5752 Now the @kbd{C-c a w} command will sort the collected entries only by
5753 priority, and the prefix format is modified to just say @samp{  Mixed: }
5754 instead of giving the category of the entry.  The sparse tags tree of
5755 @kbd{C-c a U} will now turn out ultra-compact, because neither the
5756 headline hierarchy above the match, nor the headline following the match
5757 will be shown.
5759 For command sets creating a block agenda,
5760 @code{org-agenda-custom-commands} has two separate spots for setting
5761 options.  You can add options that should be valid for just a single
5762 command in the set, and options that should be valid for all commands in
5763 the set.  The former are just added to the command entry, the latter
5764 must come after the list of command entries.  Going back to the block
5765 agenda example (@pxref{Block agenda}), let's change the sorting strategy
5766 for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
5767 the results for GARDEN tags query in the opposite order,
5768 @code{priority-up}.  This would look like this:
5770 @lisp
5771 @group
5772 (setq org-agenda-custom-commands
5773       '(("h" "Agenda and Home-related tasks"
5774          ((agenda)
5775           (tags-todo "home")
5776           (tags "garden"
5777                 ((org-agenda-sorting-strategy '(priority-up)))))
5778          ((org-agenda-sorting-strategy '(priority-down))))
5779         ("o" "Agenda and Office-related tasks"
5780          ((agenda)
5781           (tags-todo "work")
5782           (tags "office")))))
5783 @end group
5784 @end lisp
5786 As you see, the values and parenthesis setting is a little complex.
5787 When in doubt, use the customize interface to set this variable - it
5788 fully supports its structure.  Just one caveat: When setting options in
5789 this interface, the @emph{values} are just lisp expressions.  So if the
5790 value is a string, you need to add the double quotes around the value
5791 yourself.
5794 @node Exporting Agenda Views, Extracting Agenda Information for other programs, Setting Options, Custom agenda views
5795 @subsection Exporting Agenda Views
5796 @cindex agenda views, exporting
5798 If you are away from your computer, it can be very useful to have a
5799 printed version of some agenda views to carry around.  Org-mode can
5800 export custom agenda views as plain text, HTML@footnote{You need to
5801 install Hrvoje Niksic' @file{htmlize.el}.} and postscript.  If you want
5802 to do this only occasionally, use the command
5804 @table @kbd
5805 @kindex C-x C-w
5806 @item C-x C-w
5807 @cindex exporting agenda views
5808 @cindex agenda views, exporting
5809 Write the agenda view to a file.  Depending on the extension of the
5810 selected file name, the view will be exported as HTML (extension
5811 @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
5812 plain text (any other extension).  Use the variable
5813 @code{org-agenda-exporter-settings} to set options for @file{ps-print}
5814 and for @file{htmlize} to be used during export, for example
5815 @lisp
5816 (setq org-agenda-exporter-settings
5817       '((ps-number-of-columns 2)
5818         (ps-landscape-mode t)
5819         (htmlize-output-type 'css)))
5820 @end lisp
5821 @end table
5823 If you need to export certain agenda views frequently, you can associate
5824 any custom agenda command with a list of output file names
5825 @footnote{If you want to store standard views like the weekly agenda
5826 or the global TODO list as well, you need to define custom commands for
5827 them in order to be able to specify filenames.}.  Here is an example
5828 that first does define custom commands for the agenda and the global
5829 todo list, together with a number of files to which to export them.
5830 Then we define two block agenda commands and specify filenames for them
5831 as well.  File names can be relative to the current working directory,
5832 or absolute.
5834 @lisp
5835 @group
5836 (setq org-agenda-custom-commands
5837       '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
5838         ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
5839         ("h" "Agenda and Home-related tasks"
5840          ((agenda)
5841           (tags-todo "home")
5842           (tags "garden"))
5843          nil
5844          ("~/views/home.html"))
5845         ("o" "Agenda and Office-related tasks"
5846          ((agenda)
5847           (tags-todo "work")
5848           (tags "office"))
5849          nil
5850          ("~/views/office.ps"))))
5851 @end group
5852 @end lisp
5854 The extension of the file name determines the type of export.  If it is
5855 @file{.html}, Org-mode will use the @file{htmlize.el} package to convert
5856 the buffer to HTML and save it to this file name.  If the extension is
5857 @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
5858 postscript output.  Any other extension produces a plain ASCII file.
5860 The export files are @emph{not} created when you use one of those
5861 commands interactively.  Instead, there is a special command to produce
5862 @emph{all} specified files in one step:
5864 @table @kbd
5865 @kindex C-c a e
5866 @item C-c a e
5867 Export all agenda views that have export filenames associated with
5868 them.
5869 @end table
5871 You can use the options section of the custom agenda commands to also
5872 set options for the export commands.  For example:
5874 @lisp
5875 (setq org-agenda-custom-commands
5876       '(("X" agenda ""
5877          ((ps-number-of-columns 2)
5878           (ps-landscape-mode t)
5879           (org-agenda-prefix-format " [ ] ")
5880           (org-agenda-with-colors nil)
5881           (org-agenda-remove-tags t))
5882          ("theagenda.ps"))))
5883 @end lisp
5885 @noindent
5886 This command sets two options for the postscript exporter, to make it
5887 print in two columns in landscape format - the resulting page can be cut
5888 in two and then used in a paper agenda.  The remaining settings modify
5889 the agenda prefix to omit category and scheduling information, and
5890 instead include a checkbox to check off items.  We also remove the tags
5891 to make the lines compact, and we don't want to use colors for the
5892 black-and-white printer.  Settings specified in
5893 @code{org-agenda-exporter-settings} will also apply, but the settings
5894 in @code{org-agenda-custom-commands} take precedence.
5896 @noindent
5897 From the command line you may also use
5898 @example
5899 emacs -f org-batch-store-agenda-views -kill
5900 @end example
5901 @noindent
5902 or, if you need to modify some parameters
5903 @example
5904 emacs -eval '(org-batch-store-agenda-views                      \
5905               org-agenda-ndays 30                               \
5906               org-agenda-start-day "2007-11-01"                 \
5907               org-agenda-include-diary nil                      \
5908               org-agenda-files (quote ("~/org/project.org")))'  \
5909       -kill
5910 @end example
5911 @noindent
5912 which will create the agenda views restricted to the file
5913 @file{~/org/project.org}, without diary entries and with 30 days
5914 extent. 
5916 @node Extracting Agenda Information for other programs,  , Exporting Agenda Views, Custom agenda views
5917 @subsection Extracting Agenda Information for other programs
5918 @cindex agenda, pipe
5919 @cindex Scripts, for agenda processing
5921 Org-mode provides commands to access agenda information for the command
5922 line in emacs batch mode.  This extracted information can be sent
5923 directly to a printer, or it can be read by a program that does further
5924 processing of the data.  The first of these commands is the function
5925 @code{org-batch-agenda}, that produces an agenda view and sends it as
5926 ASCII text to STDOUT.  The command takes a single string as parameter.
5927 If the string has length 1, it is used as a key to one of the commands
5928 you have configured in @code{org-agenda-custom-commands}, basically any
5929 key you can use after @kbd{C-c a}.  For example, to directly print the
5930 current TODO list, you could use
5932 @example
5933 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
5934 @end example
5936 If the parameter is a string with 2 or more characters, it is used as a
5937 tags/todo match string.  For example, to print your local shopping list
5938 (all items with the tag @samp{shop}, but excluding the tag
5939 @samp{NewYork}), you could use
5941 @example
5942 emacs -batch -l ~/.emacs                                      \       
5943       -eval '(org-batch-agenda "+shop-NewYork")' | lpr
5944 @end example
5946 @noindent
5947 You may also modify parameters on the fly like this:
5949 @example
5950 emacs -batch -l ~/.emacs                                      \
5951    -eval '(org-batch-agenda "a"                               \
5952             org-agenda-ndays 30                               \
5953             org-agenda-include-diary nil                      \
5954             org-agenda-files (quote ("~/org/project.org")))'  \
5955    | lpr
5956 @end example
5958 @noindent
5959 which will produce a 30 day agenda, fully restricted to the Org file
5960 @file{~/org/projects.org}, not even including the diary.
5962 If you want to process the agenda data in more sophisticated ways, you
5963 can use the command @code{org-batch-agenda-csv} to get a comma-separated
5964 list of values for each agenda item.  Each line in the output will
5965 contain a number of fields separated by commas.  The fields in a line
5966 are:
5968 @example
5969 category     @r{The category of the item}
5970 head         @r{The headline, without TODO kwd, TAGS and PRIORITY}
5971 type         @r{The type of the agenda entry, can be}
5972                 todo               @r{selected in TODO match}
5973                 tagsmatch          @r{selected in tags match}
5974                 diary              @r{imported from diary}
5975                 deadline           @r{a deadline}
5976                 scheduled          @r{scheduled}
5977                 timestamp          @r{appointment, selected by timestamp}
5978                 closed             @r{entry was closed on date}
5979                 upcoming-deadline  @r{warning about nearing deadline}
5980                 past-scheduled     @r{forwarded scheduled item}
5981                 block              @r{entry has date block including date}
5982 todo         @r{The todo keyword, if any}
5983 tags         @r{All tags including inherited ones, separated by colons}
5984 date         @r{The relevant date, like 2007-2-14}
5985 time         @r{The time, like 15:00-16:50}
5986 extra        @r{String with extra planning info}
5987 priority-l   @r{The priority letter if any was given}
5988 priority-n   @r{The computed numerical priority}
5989 @end example
5991 @noindent
5992 Time and date will only be given if a timestamp (or deadline/scheduled)
5993 lead to the selection of the item.
5995 A CSV list like this is very easy to use in a post processing script.
5996 For example, here is a Perl program that gets the TODO list from
5997 Emacs/org-mode and prints all the items, preceded by a checkbox:
5999 @example
6000 @group
6001 #!/usr/bin/perl
6003 # define the Emacs command to run
6004 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
6006 # run it and capture the output
6007 $agenda = qx@{$cmd 2>/dev/null@};
6009 # loop over all lines
6010 foreach $line (split(/\n/,$agenda)) @{
6012   # get the individual values
6013   ($category,$head,$type,$todo,$tags,$date,$time,$extra,
6014    $priority_l,$priority_n) = split(/,/,$line);
6016   # proccess and print
6017   print "[ ] $head\n";
6019 @end group
6020 @end example
6022 @node Embedded LaTeX, Exporting, Agenda views, Top
6023 @chapter Embedded LaTeX
6024 @cindex @TeX{} interpretation
6025 @cindex La@TeX{} interpretation
6027 Plain ASCII is normally sufficient for almost all note taking.  One
6028 exception, however, are scientific notes which need to be able to
6029 contain mathematical symbols and the occasional formula.
6030 La@TeX{}@footnote{La@TeX{} is a macro system based on Donald E. Knuth's
6031 @TeX{} system.  Many of the features described here as ``La@TeX{}'' are
6032 really from @TeX{}, but for simplicity I am blurring this distinction.}
6033 is widely used to typeset scientific documents. Org-mode supports
6034 embedding La@TeX{} code into its files, because many academics are used
6035 to read La@TeX{} source code, and because it can be readily processed
6036 into images for HTML production.
6038 It is not necessary to mark La@TeX{} macros and code in any special way.
6039 If you observe a few conventions, Org-mode knows how to find it and what
6040 to do with it.
6042 @menu
6043 * Math symbols::                TeX macros for symbols and Greek letters
6044 * Subscripts and Superscripts::  Simple syntax for raising/lowering text
6045 * LaTeX fragments::             Complex formulas made easy
6046 * Processing LaTeX fragments::  Previewing LaTeX processing
6047 * CDLaTeX mode::                Speed up entering of formulas
6048 @end menu
6050 @node Math symbols, Subscripts and Superscripts, Embedded LaTeX, Embedded LaTeX
6051 @section Math symbols
6052 @cindex math symbols
6053 @cindex TeX macros
6055 You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
6056 to indicate the Greek letter, or @samp{\to} to indicate an arrow.
6057 Completion for these macros is available, just type @samp{\} and maybe a
6058 few letters, and press @kbd{M-@key{TAB}} to see possible completions.
6059 Unlike La@TeX{} code, Org-mode allows these macros to be present
6060 without surrounding math delimiters, for example:
6062 @example
6063 Angles are written as Greek letters \alpha, \beta and \gamma.
6064 @end example
6066 During HTML export (@pxref{HTML export}), these symbols are translated
6067 into the proper syntax for HTML, for the above examples this is
6068 @samp{&alpha;} and @samp{&rarr;}, respectively.
6070 @node Subscripts and Superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
6071 @section Subscripts and Superscripts
6072 @cindex subscript
6073 @cindex superscript
6075 Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
6076 and subscripts.  Again, these can be used without embedding them in
6077 math-mode delimiters.  To increase the readability of ASCII text, it is
6078 not necessary (but OK) to surround multi-character sub- and superscripts
6079 with curly braces.  For example
6081 @example
6082 The mass if the sun is M_sun = 1.989 x 10^30 kg.  The radius of
6083 the sun is R_@{sun@} = 6.96 x 10^8 m.
6084 @end example
6086 To avoid interpretation as raised or lowered text, you can quote
6087 @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
6089 During HTML export (@pxref{HTML export}), subscript and superscripts
6090 are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
6092 @node LaTeX fragments, Processing LaTeX fragments, Subscripts and Superscripts, Embedded LaTeX
6093 @section LaTeX fragments
6094 @cindex LaTeX fragments
6096 With symbols, sub- and superscripts, HTML is pretty much at its end when
6097 it comes to representing mathematical formulas@footnote{Yes, there is
6098 MathML, but that is not yet fully supported by many browsers, and there
6099 is no decent converter for turning La@TeX{} or ASCII representations of
6100 formulas into MathML. So for the time being, converting formulas into
6101 images seems the way to go.}. More complex expressions need a dedicated
6102 formula processor. To this end, Org-mode can contain arbitrary La@TeX{}
6103 fragments. It provides commands to preview the typeset result of these
6104 fragments, and upon export to HTML, all fragments will be converted to
6105 images and inlined into the HTML document@footnote{The La@TeX{} export
6106 will not use images for displaying La@TeX{} fragments but include these
6107 fragments directly into the La@TeX{} code.}. For this to work you
6108 need to be on a system with a working La@TeX{} installation. You also
6109 need the @file{dvipng} program, available at
6110 @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
6111 will be used when processing a fragment can be configured with the
6112 variable @code{org-format-latex-header}.
6114 La@TeX{} fragments don't need any special marking at all.  The following
6115 snippets will be identified as La@TeX{} source code:
6116 @itemize @bullet
6117 @item
6118 Environments of any kind.  The only requirement is that the
6119 @code{\begin} statement appears on a new line, preceded by only
6120 whitespace.
6121 @item
6122 Text within the usual La@TeX{} math delimiters.  To avoid conflicts with
6123 currency specifications, single @samp{$} characters are only recognized
6124 as math delimiters if the enclosed text contains at most two line breaks,
6125 is directly attached to the @samp{$} characters with no whitespace in
6126 between, and if the closing @samp{$} is followed by whitespace or
6127 punctuation.  For the other delimiters, there is no such restriction, so
6128 when in doubt, use @samp{\(...\)} as inline math delimiters.
6129 @end itemize
6131 @noindent For example:
6133 @example
6134 \begin@{equation@}                          % arbitrary environments,
6135 x=\sqrt@{b@}                                % even tables, figures
6136 \end@{equation@}                            % etc
6138 If $a^2=b$ and \( b=2 \), then the solution must be
6139 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
6140 @end example
6142 @noindent
6143 If you need any of the delimiter ASCII sequences for other purposes, you
6144 can configure the option @code{org-format-latex-options} to deselect the
6145 ones you do not wish to have interpreted by the La@TeX{} converter.
6147 @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
6148 @section Processing LaTeX fragments
6149 @cindex LaTeX fragments, preview
6151 La@TeX{} fragments can be processed to produce a preview images of the
6152 typeset expressions:
6154 @table @kbd
6155 @kindex C-c C-x C-l
6156 @item C-c C-x C-l
6157 Produce a preview image of the La@TeX{} fragment at point and overlay it
6158 over the source code.  If there is no fragment at point, process all
6159 fragments in the current entry (between two headlines).  When called
6160 with a prefix argument, process the entire subtree.  When called with
6161 two prefix arguments, or when the cursor is before the first headline,
6162 process the entire buffer.
6163 @kindex C-c C-c
6164 @item C-c C-c
6165 Remove the overlay preview images.
6166 @end table
6168 During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
6169 converted into images and inlined into the document if the following
6170 setting is active:
6172 @lisp
6173 (setq org-export-with-LaTeX-fragments t)
6174 @end lisp
6176 @node CDLaTeX mode,  , Processing LaTeX fragments, Embedded LaTeX
6177 @section Using CDLaTeX to enter math
6178 @cindex CDLaTeX
6180 CDLaTeX-mode is a minor mode that is normally used in combination with a
6181 major La@TeX{} mode like AUCTeX in order to speed-up insertion of
6182 environments and math templates.  Inside Org-mode, you can make use of
6183 some of the features of cdlatex-mode.  You need to install
6184 @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
6185 AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
6186 Don't turn cdlatex-mode itself under Org-mode, but use the light
6187 version @code{org-cdlatex-mode} that comes as part of Org-mode.  Turn it
6188 on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
6189 Org-mode files with
6191 @lisp
6192 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
6193 @end lisp
6195 When this mode is enabled, the following features are present (for more
6196 details see the documentation of cdlatex-mode):
6197 @itemize @bullet
6198 @kindex C-c @{
6199 @item
6200 Environment templates can be inserted with @kbd{C-c @{}.
6201 @item
6202 @kindex @key{TAB}
6203 The @key{TAB} key will do template expansion if the cursor is inside a
6204 La@TeX{} fragment@footnote{Org-mode has a method to test if the cursor is
6205 inside such a fragment, see the documentation of the function
6206 @code{org-inside-LaTeX-fragment-p}.}.  For example, @key{TAB} will
6207 expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
6208 correctly inside the first brace.  Another @key{TAB} will get you into
6209 the second brace.  Even outside fragments, @key{TAB} will expand
6210 environment abbreviations at the beginning of a line.  For example, if
6211 you write @samp{equ} at the beginning of a line and press @key{TAB},
6212 this abbreviation will be expanded to an @code{equation} environment.
6213 To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
6214 @item
6215 @kindex _
6216 @kindex ^
6217 Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
6218 characters together with a pair of braces.  If you use @key{TAB} to move
6219 out of the braces, and if the braces surround only a single character or
6220 macro, they are removed again (depending on the variable
6221 @code{cdlatex-simplify-sub-super-scripts}).
6222 @item
6223 @kindex `
6224 Pressing the backquote @kbd{`} followed by a character inserts math
6225 macros, also outside La@TeX{} fragments.  If you wait more than 1.5 seconds
6226 after the backquote, a help window will pop up.
6227 @item
6228 @kindex '
6229 Pressing the normal quote @kbd{'} followed by another character modifies
6230 the symbol before point with an accent or a font.  If you wait more than
6231 1.5 seconds after the backquote, a help window will pop up.  Character
6232 modification will work only inside La@TeX{} fragments, outside the quote
6233 is normal.
6234 @end itemize
6236 @node Exporting, Publishing, Embedded LaTeX, Top
6237 @chapter Exporting
6238 @cindex exporting
6240 Org-mode documents can be exported into a variety of other formats.  For
6241 printing and sharing of notes, ASCII export produces a readable and
6242 simple version of an Org-mode file.  HTML export allows you to publish a
6243 notes file on the web, while the XOXO format provides a solid base for
6244 exchange with a broad range of other applications. La@TeX{} export lets
6245 you use Org-mode and its structured editing functions to easily create
6246 La@TeX{} files.  To incorporate entries with associated times like
6247 deadlines or appointments into a desktop calendar program like iCal,
6248 Org-mode can also produce extracts in the iCalendar format.  Currently
6249 Org-mode only supports export, not import of these different formats.
6251 When exporting, Org-mode uses special conventions to enrich the output
6252 produced.  @xref{Text interpretation}, for more details.
6254 @table @kbd
6255 @kindex C-c C-e
6256 @item C-c C-e
6257 Dispatcher for export and publishing commands.  Displays a help-window
6258 listing the additional key(s) needed to launch an export or publishing
6259 command.
6260 @end table
6262 @menu
6263 * ASCII export::                Exporting to plain ASCII
6264 * HTML export::                 Exporting to HTML
6265 * LaTeX export::                Exporting to LaTeX
6266 * XOXO export::                 Exporting to XOXO
6267 * iCalendar export::            Exporting in iCalendar format
6268 * Text interpretation::         How the exporter looks at the file
6269 @end menu
6271 @node ASCII export, HTML export, Exporting, Exporting
6272 @section ASCII export
6273 @cindex ASCII export
6275 ASCII export produces a simple and very readable version of an Org-mode
6276 file.
6278 @cindex region, active
6279 @cindex active region
6280 @cindex transient-mark-mode
6281 @table @kbd
6282 @kindex C-c C-e a
6283 @item C-c C-e a
6284 Export as ASCII file.  For an org file @file{myfile.org}, the ASCII file
6285 will be @file{myfile.txt}.  The file will be overwritten without
6286 warning.  If there is an active region, only the region will be
6287 exported. If the selected region is a single tree, the tree head will
6288 become the document title.  If the tree head entry has or inherits an
6289 @code{:EXPORT_FILE_NAME:} property, that name will be used for the
6290 export. 
6291 @kindex C-c C-e v a
6292 @item C-c C-e v a
6293 Export only the visible part of the document.
6294 @end table
6296 @cindex headline levels, for exporting
6297 In the exported version, the first 3 outline levels will become
6298 headlines, defining a general document structure.  Additional levels
6299 will be exported as itemized lists.  If you want that transition to occur
6300 at a different level, specify it with a prefix argument.  For example,
6302 @example
6303 @kbd{C-1 C-c C-e a}
6304 @end example
6306 @noindent
6307 creates only top level headlines and does the rest as items.  When
6308 headlines are converted to items, the indentation of the text following
6309 the headline is changed to fit nicely under the item.  This is done with
6310 the assumption that the first bodyline indicates the base indentation of
6311 the body text.  Any indentation larger than this is adjusted to preserve
6312 the layout relative to the first line.  Should there be lines with less
6313 indentation than the first, these are left alone.
6315 @node HTML export, LaTeX export, ASCII export, Exporting
6316 @section HTML export
6317 @cindex HTML export
6319 Org-mode contains an HTML (XHTML 1.0 strict) exporter with extensive
6320 HTML formatting, in ways similar to John Grubers @emph{markdown}
6321 language, but with additional support for tables.
6323 @menu
6324 * HTML Export commands::        How to invoke LaTeX export
6325 * Quoting HTML tags::           Using direct HTML in Org-mode
6326 * Links::                       Transformation of links for HTML
6327 * Images::                      How to include images
6328 * CSS support::                 Changing the appearence of the output
6329 @end menu
6331 @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
6332 @subsection HTML export commands
6334 @cindex region, active
6335 @cindex active region
6336 @cindex transient-mark-mode
6337 @table @kbd
6338 @kindex C-c C-e h
6339 @item C-c C-e h
6340 Export as HTML file @file{myfile.html}.  For an org file
6341 @file{myfile.org}, the ASCII file will be @file{myfile.html}.  The file
6342 will be overwritten without warning.  If there is an active region, only
6343 the region will be exported. If the selected region is a single tree,
6344 the tree head will become the document title.  If the tree head entry
6345 has or inherits an @code{:EXPORT_FILE_NAME:} property, that name will be
6346 used for the export.
6347 @kindex C-c C-e b
6348 @item C-c C-e b
6349 Export as HTML file and immediately open it with a browser.
6350 @kindex C-c C-e H
6351 @item C-c C-e H
6352 Export to a temporary buffer, do not create a file.
6353 @kindex C-c C-e R
6354 @item C-c C-e R
6355 Export the active region to a temporary buffer.  With prefix arg, do not
6356 produce file header and foot, but just the plain HTML section for the
6357 region.  This is good for cut-and-paste operations.
6358 @kindex C-c C-e v h
6359 @kindex C-c C-e v b
6360 @kindex C-c C-e v H
6361 @kindex C-c C-e v R
6362 @item C-c C-e v h
6363 @item C-c C-e v b
6364 @item C-c C-e v H
6365 @item C-c C-e v R
6366 Export only the visible part of the document.
6367 @item M-x org-export-region-as-html
6368 Convert the region to HTML under the assumption that it was org-mode
6369 syntax before.  This is a global command that can be invoked in any
6370 buffer.
6371 @item M-x org-replace-region-by-HTML
6372 Replace the active region (assumed to be in Org-mode syntax) by HTML
6373 code.
6374 @end table
6376 @cindex headline levels, for exporting
6377 In the exported version, the first 3 outline levels will become
6378 headlines, defining a general document structure.  Additional levels
6379 will be exported as itemized lists.  If you want that transition to occur
6380 at a different level, specify it with a prefix argument.  For example,
6382 @example
6383 @kbd{C-2 C-c C-e b}
6384 @end example
6386 @noindent
6387 creates two levels of headings and does the rest as items.
6389 @node Quoting HTML tags, Links, HTML Export commands, HTML export
6390 @subsection Quoting HTML tags
6392 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
6393 @samp{&gt;} in HTML export.  If you want to include simple HTML tags
6394 which should be interpreted as such, mark them with @samp{@@} as in
6395 @samp{@@<b>bold text@@</b>}.  Note that this really works only for
6396 simple tags.  For more extensive HTML that should be copied verbatim to
6397 the exported file use either
6399 @example
6400 #+HTML: Literal HTML code for export
6401 @end example
6403 @noindent or
6405 @example
6406 #+BEGIN_HTML
6407 All lines between these markers are exported literally
6408 #+END_HTML
6409 @end example
6412 @node Links, Images, Quoting HTML tags, HTML export
6413 @subsection Links
6415 @cindex links, in HTML export
6416 @cindex internal links, in HTML export
6417 @cindex external links, in HTML export
6418 Internal links (@pxref{Internal links}) will continue to work in HTML
6419 files only if they match a dedicated @samp{<<target>>}.  Automatic links
6420 created by radio targets (@pxref{Radio targets}) will also work in the
6421 HTML file.  Links to external files will still work if the HTML file is
6422 in the same directory as the Org-mode file.  Links to other @file{.org}
6423 files will be translated into HTML links under the assumption that an
6424 HTML version also exists of the linked file.  For information related to
6425 linking files while publishing them to a publishing directory see
6426 @ref{Publishing links}.
6428 @node Images, CSS support, Links, HTML export
6429 @subsection Images
6431 @cindex images, inline in HTML
6432 @cindex inlining images in HTML
6433 HTML export can inline images given as links in the Org-mode file, and
6434 it can make an image the clickable part of a link.  By
6435 default@footnote{but see the variable
6436 @code{org-export-html-inline-images}}, images are inlined if a link does
6437 not have a description.  So @samp{[[file:myimg.jpg]]} will be inlined,
6438 while @samp{[[file:myimg.jpg][the image]]} will just produce a link
6439 @samp{the image} that points to the image.  If the description part
6440 itself is a @code{file:} link or a @code{http:} URL pointing to an
6441 image, this image will be inlined and activated so that clicking on the
6442 image will activate the link.  For example, to include a thumbnail that
6443 will link to a high resolution version of the image, you could use:
6445 @example
6446 [[file:highres.jpg][file:thumb.jpg]]
6447 @end example
6449 @noindent
6450 and you could use @code{http} addresses just as well.
6452 @node CSS support,  , Images, HTML export
6453 @subsection CSS support
6455 You can also give style information for the exported file.  The HTML
6456 exporter assigns the following CSS classes to appropriate parts of the
6457 document - your style specifications may change these:
6458 @example
6459 .todo           @r{TODO keywords}
6460 .done           @r{the DONE keyword}
6461 .timestamp      @r{time stamp}
6462 .timestamp-kwd  @r{keyword associated with a time stamp, like SCHEDULED}
6463 .tag            @r{tag in a headline}
6464 .target         @r{target for links}
6465 @end example
6467 The default style specification can be configured through the option
6468 @code{org-export-html-style}.  If you want to use a file-local style,
6469 you may use file variables, best wrapped into a COMMENT section at the
6470 end of the outline tree.  For example@footnote{Under Emacs 21, the
6471 continuation lines for a variable value should have no @samp{#} at the
6472 start of the line.}:
6474 @example
6475 * COMMENT html style specifications
6477 # Local Variables:
6478 # org-export-html-style: "   <style type=\"text/css\">
6479 #       p @{font-weight: normal; color: gray; @}
6480 #       h1 @{color: black; @}
6481 #   </style>"
6482 # End:
6483 @end example
6485 Remember to execute @kbd{M-x normal-mode} after changing this to make
6486 the new style visible to Emacs.  This command restarts org-mode for the
6487 current buffer and forces Emacs to re-evaluate the local variables
6488 section in the buffer.
6490 @c FIXME: More about header and footer styles
6491 @c FIXME: Talk about links and targets.
6493 @node LaTeX export, XOXO export, HTML export, Exporting
6494 @section LaTeX export
6495 @cindex LaTeX export
6497 Org-mode contains a La@TeX{} exporter written by Bastien Guerry.
6499 @menu
6500 * LaTeX export commands::       How to invoke LaTeX export
6501 * Quoting LaTeX code::          Incorporating literal LaTeX code
6502 * Sectioning structure::        
6503 @end menu
6505 @node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
6506 @subsection LaTeX export commands
6508 @table @kbd
6509 @kindex C-c C-e l
6510 @item C-c C-e l
6511 Export as La@TeX{} file @file{myfile.tex}.
6512 @kindex C-c C-e L
6513 @item C-c C-e L
6514 Export to a temporary buffer, do not create a file.
6515 @kindex C-c C-e v l
6516 @kindex C-c C-e v L
6517 @item C-c C-e v l
6518 @item C-c C-e v L
6519 Export only the visible part of the document.
6520 @item M-x org-export-region-as-latex
6521 Convert the region to La@TeX{} under the assumption that it was org-mode
6522 syntax before.  This is a global command that can be invoked in any
6523 buffer.
6524 @item M-x org-replace-region-by-latex
6525 Replace the active region (assumed to be in Org-mode syntax) by La@TeX{}
6526 code.
6527 @end table
6529 @cindex headline levels, for exporting
6530 In the exported version, the first 3 outline levels will become
6531 headlines, defining a general document structure.  Additional levels
6532 will be exported as description lists.  The exporter can ignore them or
6533 convert them to a custom string depending on
6534 @code{org-latex-low-levels}.
6536 If you want that transition to occur at a different level, specify it
6537 with a prefix argument. For example,
6539 @example
6540 @kbd{C-2 C-c C-e l}
6541 @end example
6543 @noindent
6544 creates two levels of headings and does the rest as items.
6546 @node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export
6547 @subsection Quoting LaTeX code
6549 Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
6550 inserted into the La@TeX{} file.  Forthermore, you can add special code
6551 that should only be present in La@TeX{} export with the following
6552 constructs:
6554 @example
6555 #+LaTeX: Literal LaTeX code for export
6556 @end example
6558 @noindent or
6560 @example
6561 #+BEGIN_LaTeX
6562 All lines between these markers are exported literally
6563 #+END_LaTeX
6564 @end example
6568 @node   Sectioning structure,  , Quoting LaTeX code, LaTeX export
6569 @subsection Sectioning structure
6570 @cindex LaTeX class
6571 @cindex LaTeX sectioning structure
6573 By default, the La@TeX{} output uses the class @code{article}.
6575 You can change this globally by setting a different value for
6576 @code{org-export-latex-default-class} or locally by adding an option
6577 like @code{#+LaTeX_CLASS: myclass} in your file.  The class should be
6578 listed in @code{org-export-latex-classes}, where you can also define the
6579 sectioning structure for each class.
6582 @node XOXO export, iCalendar export, LaTeX export, Exporting
6583 @section XOXO export
6584 @cindex XOXO export
6586 Org-mode contains an exporter that produces XOXO-style output.
6587 Currently, this exporter only handles the general outline structure and
6588 does not interpret any additional Org-mode features.
6590 @table @kbd
6591 @kindex C-c C-e x
6592 @item C-c C-e x
6593 Export as XOXO file @file{myfile.html}.
6594 @kindex C-c C-e v
6595 @item C-c C-e v x
6596 Export only the visible part of the document.
6597 @end table
6599 @node iCalendar export, Text interpretation, XOXO export, Exporting
6600 @section iCalendar export
6601 @cindex iCalendar export
6603 Some people like to use Org-mode for keeping track of projects, but
6604 still prefer a standard calendar application for anniversaries and
6605 appointments.  In this case it can be useful to have deadlines and
6606 other time-stamped items in Org-mode files show up in the calendar
6607 application.  Org-mode can export calendar information in the standard
6608 iCalendar format.  If you also want to have TODO entries included in the
6609 export, configure the variable @code{org-icalendar-include-todo}.
6611 @table @kbd
6612 @kindex C-c C-e i
6613 @item C-c C-e i
6614 Create iCalendar entries for the current file and store them in the same
6615 directory, using a file extension @file{.ics}.
6616 @kindex C-c C-e I
6617 @item C-c C-e I
6618 Like @kbd{C-c C-e i}, but do this for all files in
6619 @code{org-agenda-files}.  For each of these files, a separate iCalendar
6620 file will be written.
6621 @kindex C-c C-e c
6622 @item C-c C-e c
6623 Create a single large iCalendar file from all files in
6624 @code{org-agenda-files} and write it to the file given by
6625 @code{org-combined-agenda-icalendar-file}.
6626 @end table
6628 The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
6629 the selected entries have them.  If not, the summary will be derived
6630 from the headline, and the description from the body (limited to
6631 @code{org-icalendar-include-body} characters).  
6633 How this calendar is best read and updated, depends on the application
6634 you are using.  The FAQ covers this issue.
6637 @node Text interpretation,  , iCalendar export, Exporting
6638 @section Text interpretation by the exporter
6640 The exporter backends interpret additional structure in the Org-mode file
6641 in order to produce better output.
6643 @menu
6644 * Comment lines::               Some lines will not be exported
6645 * Initial text::                Text before the first headline
6646 * Footnotes::                   Numbers like [1]
6647 * Quoted examples::             Inserting quoted chnuks of text            
6648 * Enhancing text::              Subscripts, symbols and more
6649 * Export options::              How to influence the export settings
6650 @end menu
6652 @node Comment lines, Initial text, Text interpretation, Text interpretation
6653 @subsection Comment lines
6654 @cindex comment lines
6655 @cindex exporting, not
6657 Lines starting with @samp{#} in column zero are treated as comments
6658 and will never be exported.  Also entire subtrees starting with the
6659 word @samp{COMMENT} will never be exported.
6661 @table @kbd
6662 @kindex C-c ;
6663 @item C-c ;
6664 Toggle the COMMENT keyword at the beginning of an entry.
6665 @end table
6667 @node Initial text, Footnotes, Comment lines, Text interpretation
6668 @subsection Text before the first headline
6670 Org-mode normally ignores any text before the first headline when
6671 exporting, leaving this region for internal links to speed up navigation
6672 etc.  However, in publishing-oriented files, you might want to have some
6673 text before the first headline, like a small introduction, special HTML
6674 code with a navigation bar, etc.  You can ask to have this part of the
6675 file exported as well by setting the variable
6676 @code{org-export-skip-text-before-1st-heading} to @code{nil}.  On a
6677 per-file basis, you can get the same effect with
6679 @example
6680 #+OPTIONS: skip:nil
6681 @end example
6683 The text before the first headline will be fully processed
6684 (@pxref{Enhancing text}), and the first non-comment line becomes the
6685 title of the exported document.  If you need to include literal HTML,
6686 use the special constructs described in @ref{Quoting HTML tags}.  The
6687 table of contents is normally inserted directly before the first
6688 headline of the file.  If you would like to get it to a different
6689 location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by
6690 itself at the desired location.
6692 Finally, if you want to use the space before the first headline for
6693 internal purposes, but @emph{still} want to place something before the
6694 first headline when exporting the file, you can use the @code{#+TEXT}
6695 construct:
6697 @example
6698 #+OPTIONS: skip:t
6699 #+TEXT: This text will go before the *first* headline.
6700 #+TEXT: We place the table of contents here:
6701 #+TEXT: [TABLE-OF-CONTENTS]
6702 #+TEXT: This goes between the table of contents and the first headline
6703 @end example
6705 @node Footnotes, Quoted examples, Initial text, Text interpretation
6706 @subsection Footnotes
6707 @cindex footnotes
6708 @cindex @file{footnote.el}
6710 Numbers in square brackets are treated as footnotes, so that you can use
6711 the Emacs package @file{footnote.el} to create footnotes.  For example:
6713 @example
6714 The org-mode homepage[1] clearly needs help from
6715 a good web designer.
6717 [1] The link is: http://orgmode.org
6718 @end example
6720 @noindent
6721 @kindex C-c !
6722 Note that the @file{footnote} package uses @kbd{C-c !} to invoke its
6723 commands.  This binding conflicts with the org-mode command for
6724 inserting inactive time stamps.  You could use the variable
6725 @code{footnote-prefix} to switch footnotes commands to another key.  Or,
6726 if you are too used to this binding, you could use
6727 @code{org-replace-disputed-keys} and @code{org-disputed-keys} to change
6728 the settings in Org-mode.
6730 @node Quoted examples, Enhancing text, Footnotes, Text interpretation
6731 @subsection Quoted examples
6732 @cindex quoted examples
6733 @cindex examples, quoted
6734 @cindex text, fixed width
6735 @cindex fixed width text
6737 When writing technical documents, you often need to insert examples that
6738 are not further interpreted by Org-mode.  For historical reasons, there
6739 are several ways to do this:
6741 @itemize @bullet
6742 @item
6743 If a headline starts with the word @samp{QUOTE}, the text below the
6744 headline will be typeset as fixed-width, to allow quoting of computer
6745 codes etc.
6746 @item
6747 Lines starting with @samp{:} are also typeset in fixed-width font. 
6748 @table @kbd
6749 @kindex C-c :
6750 @item C-c :
6751 Toggle fixed-width for entry (QUOTE) or region, see below.
6752 @end table
6753 @item
6754 Finally, text between
6755 @example
6756 #+BEGIN_EXAMPLE
6757 quoted text
6758 #+END_EXAMPLE
6759 @end example
6760 will also be exported in this way.
6761 @end itemize
6764 @node Enhancing text, Export options, Quoted examples, Text interpretation
6765 @subsection Enhancing text for export
6766 @cindex enhancing text
6767 @cindex richer text
6769 Some of the export backends of Org-mode allow for sophisticated text
6770 formatting, this is true in particular for the HTML and La@TeX{}
6771 backends.  Org-mode has a number of typing conventions that allow to
6772 produce a richly formatted output.
6774 @itemize @bullet
6776 @cindex hand-formatted lists
6777 @cindex lists, hand-formatted
6778 @item
6779 Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
6780 or @samp{2)} as enumerator will be recognized and transformed if the
6781 backend supports lists.  See @xref{Plain lists}.
6783 @cindex underlined text
6784 @cindex bold text
6785 @cindex italic text
6786 @cindex verbatim text
6787 @item
6788 You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
6789 and @code{~verbatim~}, and, if you must, @samp{+strikethrough+}.  Text
6790 in the code and verbatim string is not processed for org-mode specific
6791 syntax, it is exported verbatim.
6793 @cindex horizontal rules, in exported files
6794 @item
6795 A line consisting of only dashes, and at least 5 of them, will be
6796 exported as a horizontal line (@samp{<hr/>} in HTML).
6798 @cindex LaTeX fragments, export
6799 @cindex TeX macros, export
6800 @item
6801 Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML
6802 entities or images (@pxref{Embedded LaTeX}).
6804 @cindex tables, export
6805 @item
6806 Tables are transformed into native tables under the exporter, if the
6807 export backend supports this. Data fields before the first horizontal
6808 separator line will be formatted as table header fields.
6810 @cindex fixed width
6811 @item
6812 If a headline starts with the word @samp{QUOTE}, the text below the
6813 headline will be typeset as fixed-width, to allow quoting of computer
6814 codes etc.  Lines starting with @samp{:} are also typeset in fixed-width
6815 font. 
6816 @table @kbd
6817 @kindex C-c :
6818 @item C-c :
6819 Toggle fixed-width for entry (QUOTE) or region, see below.
6820 @end table
6821 Finally, text between
6822 @example
6823 #+BEGIN_EXAMPLE
6824 quoted text
6825 #+END_EXAMPLE
6826 @end example
6827 will also be exported in this way.
6829 @cindex linebreak, forced
6830 @item 
6831 A double backslash @emph{at the end of a line} enforces a line break at
6832 this position.
6834 @cindex HTML entities, LaTeX entities
6835 @item
6836 Strings like @code{\alpha} will be exported as @code{&alpha;}, in the
6837 HTML output.  These strings are exported as @code{$\alpha$} in the
6838 La@TeX{} output.  Similarly, @code{\nbsp} will become @code{&nbsp;} in
6839 HTML and in La@TeX{}.  This applies for a long list of entities, see
6840 the variable @code{org-html-entities} for the complete list.
6841 @c FIXME
6842 @end itemize
6844 If these conversions conflict with your habits of typing ASCII text,
6845 they can all be turned off with corresponding variables.  See the
6846 customization group @code{org-export-general}, and the following section
6847 which explains how to set export options with special lines in a
6848 buffer.
6851 @node Export options,  , Enhancing text, Text interpretation
6852 @subsection Export options
6853 @cindex options, for export
6855 @cindex completion, of option keywords
6856 The exporter recognizes special lines in the buffer which provide
6857 additional information.  These lines may be put anywhere in the file.
6858 The whole set of lines can be inserted into the buffer with @kbd{C-c
6859 C-e t}.  For individual lines, a good way to make sure the keyword is
6860 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
6861 (@pxref{Completion}).
6863 @table @kbd
6864 @kindex C-c C-e t
6865 @item C-c C-e t
6866 Insert template with export options, see example below.
6867 @end table
6869 @example
6870 #+TITLE:     the title to be shown (default is the buffer name)
6871 #+AUTHOR:    the author (default taken from @code{user-full-name})
6872 #+DATE:      A date, fixed, of a format string for @code{format-time-string}
6873 #+EMAIL:     his/her email address (default from @code{user-mail-address})
6874 #+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
6875 #+TEXT:      Some descriptive text to be inserted at the beginning.
6876 #+TEXT:      Several lines may be given.
6877 #+OPTIONS:   H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
6878 @end example
6880 @noindent
6881 The OPTIONS line is a compact form to specify export settings.  Here
6882 you can:
6883 @cindex headline levels
6884 @cindex section-numbers
6885 @cindex table of contents
6886 @cindex linebreak preservation
6887 @cindex quoted HTML tags
6888 @cindex fixed-width sections
6889 @cindex tables
6890 @cindex @TeX{}-like syntax for sub- and superscripts
6891 @cindex footnotes
6892 @cindex special strings
6893 @cindex emphasized text
6894 @cindex @TeX{} macros
6895 @cindex La@TeX{} fragments
6896 @cindex author info, in export
6897 @cindex time info, in export
6898 @example
6899 H:         @r{set the number of headline levels for export}
6900 num:       @r{turn on/off section-numbers}
6901 toc:       @r{turn on/off table of contents, or set level limit (integer)}
6902 \n:        @r{turn on/off linebreak-preservation}
6903 @@:         @r{turn on/off quoted HTML tags}
6904 ::         @r{turn on/off fixed-width sections}
6905 |:         @r{turn on/off tables}
6906 ^:         @r{turn on/off @TeX{}-like syntax for sub- and superscripts.  If}
6907            @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
6908            @r{the simple @code{a_b} will be left as it is.}
6909 -:         @r{turn on/off conversion of special strings.}
6910 f:         @r{turn on/off foototes like this[1].}
6911 *:         @r{turn on/off emphasized text (bold, italic, underlined)}
6912 TeX:       @r{turn on/off simple @TeX{} macros in plain text}
6913 LaTeX:     @r{turn on/off La@TeX{} fragments}
6914 skip:      @r{turn on/off skipping the text before the first heading}
6915 author:    @r{turn on/off inclusion of author name/email into exported file}
6916 timestamp: @r{turn on/off inclusion creation time into exported file}
6917 d:         @r{turn on/off inclusion of drawers}
6918 @end example
6920 These options take effect in both the HTML and La@TeX{} export, except
6921 for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
6922 @code{nil} for the La@TeX{} export.
6924 @node Publishing, Miscellaneous, Exporting, Top
6925 @chapter Publishing
6926 @cindex publishing
6928 Org-mode includes@footnote{@file{org-publish.el} is not distributed with
6929 Emacs 21, if you are still using Emacs 21, you need you need to download
6930 this file separately.} a publishing management system that allows you to
6931 configure automatic HTML conversion of @emph{projects} composed of
6932 interlinked org files.  This system is called @emph{org-publish}.  You can
6933 also configure org-publish to automatically upload your exported HTML
6934 pages and related attachments, such as images and source code files, to
6935 a web server. Org-publish turns org-mode into a web-site authoring tool.
6937 You can also use Org-publish to convert files into La@TeX{}, or even
6938 combine HTML and La@TeX{} conversion so that files are available in both
6939 formats on the server@footnote{Since La@TeX{} files on a server are not
6940 that helpful, you surely want to perform further conversion on them --
6941 e.g. convert them to @code{PDF} format.}.
6943 Org-publish has been contributed to Org-mode by David O'Toole.
6945 @menu
6946 * Configuration::               Defining projects
6947 * Sample configuration::        Example projects
6948 * Triggering publication::      Publication commands
6949 @end menu
6951 @node Configuration, Sample configuration, Publishing, Publishing
6952 @section Configuration
6954 Publishing needs significant configuration to specify files, destination
6955 and many other properties of a project.
6957 @menu
6958 * Project alist::               The central configuration variable
6959 * Sources and destinations::    From here to there
6960 * Selecting files::             What files are part of the project?
6961 * Publishing action::           Setting the function doing the publishing
6962 * Publishing options::          Tweaking HTML export
6963 * Publishing links::            Which links keep working after publishing?
6964 * Project page index::          Publishing a list of project files
6965 @end menu
6967 @node Project alist, Sources and destinations, Configuration, Configuration
6968 @subsection The variable @code{org-publish-project-alist}
6969 @cindex org-publish-project-alist
6970 @cindex projects, for publishing
6972 Org-publish is configured almost entirely through setting the value of
6973 one variable, called @code{org-publish-project-alist}.
6974 Each element of the list configures one project, and may be in one of
6975 the two following forms:
6977 @lisp
6978 ("project-name" :property value :property value ...)
6980 @r{or} 
6982 ("project-name" :components ("project-name" "project-name" ...))
6984 @end lisp
6986 In both cases, projects are configured by specifying property values.
6987 A project defines the set of files that will be published, as well as
6988 the publishing configuration to use when publishing those files.  When
6989 a project takes the second form listed above, the individual members
6990 of the ``components'' property are taken to be components of the
6991 project, which group together files requiring different publishing
6992 options. When you publish such a ``meta-project'' all the components
6993 will also publish.
6995 @node Sources and destinations, Selecting files, Project alist, Configuration
6996 @subsection Sources and destinations for files
6997 @cindex directories, for publishing
6999 Most properties are optional, but some should always be set. In
7000 particular, org-publish needs to know where to look for source files,
7001 and where to put published files.
7003 @multitable @columnfractions 0.3 0.7
7004 @item @code{:base-directory}
7005 @tab Directory containing publishing source files
7006 @item @code{:publishing-directory}
7007 @tab Directory (possibly remote) where output files will be published.
7008 @item @code{:preparation-function}
7009 @tab Function called before starting publishing process, for example to
7010 run @code{make} for updating files to be published.
7011 @end multitable
7012 @noindent
7014 @node Selecting files, Publishing action, Sources and destinations, Configuration
7015 @subsection Selecting files
7016 @cindex files, selecting for publishing
7018 By default, all files with extension @file{.org} in the base directory
7019 are considered part of the project.  This can be modified by setting the
7020 properties 
7021 @multitable @columnfractions 0.25 0.75
7022 @item @code{:base-extension}
7023 @tab Extension (without the dot!) of source files.  This actually is a
7024 regular expression.
7026 @item @code{:exclude} 
7027 @tab Regular expression to match file names that should not be
7028 published, even though they have been selected on the basis of their
7029 extension.
7031 @item @code{:include}
7032 @tab List of files to be included regardless of @code{:base-extension}
7033 and @code{:exclude}.
7034 @end multitable
7036 @node Publishing action, Publishing options, Selecting files, Configuration
7037 @subsection Publishing Action
7038 @cindex action, for publishing
7040 Publishing means that a file is copied to the destination directory and
7041 possibly transformed in the process.  The default transformation is to
7042 export Org-mode files as HTML files, and this is done by the function
7043 @code{org-publish-org-to-html} which calls the HTML exporter
7044 (@pxref{HTML export}). But you also can publish your files in La@TeX{} by
7045 using the function @code{org-publish-org-to-latex} instead. Other files
7046 like images only need to be copied to the publishing destination. For
7047 non-Org-mode files, you need to specify the publishing function.
7050 @multitable @columnfractions 0.3 0.7
7051 @item @code{:publishing-function}
7052 @tab Function executing the publication of a file.  This may also be a
7053 list of functions, which will all be called in turn.
7054 @end multitable
7056 The function must accept two arguments: a property list containing at
7057 least a @code{:publishing-directory} property, and the name of the file
7058 to be published.  It should take the specified file, make the necessary
7059 transformation (if any) and place the result into the destination folder.
7060 You can write your own publishing function, but @code{org-publish}
7061 provides one for attachments (files that only need to be copied):
7062 @code{org-publish-attachment}.
7064 @node Publishing options, Publishing links, Publishing action, Configuration
7065 @subsection Options for the HTML/LaTeX exporters
7066 @cindex options, for publishing
7068 The property list can be used to set many export options for the HTML
7069 and La@TeX{} exporters.  In most cases, these properties correspond to user
7070 variables in Org-mode.  The table below lists these properties along
7071 with the variable they belong to.  See the documentation string for the
7072 respective variable for details.
7074 @multitable @columnfractions 0.3 0.7
7075 @item @code{:language}              @tab @code{org-export-default-language}
7076 @item @code{:headline-levels}       @tab @code{org-export-headline-levels}
7077 @item @code{:section-numbers}       @tab @code{org-export-with-section-numbers}
7078 @item @code{:table-of-contents}     @tab @code{org-export-with-toc}
7079 @item @code{:archived-trees}        @tab @code{org-export-with-archived-trees}
7080 @item @code{:emphasize}             @tab @code{org-export-with-emphasize}
7081 @item @code{:sub-superscript}       @tab @code{org-export-with-sub-superscripts}
7082 @item @code{:special-strings}       @tab @code{org-export-with-special-strings}
7083 @item @code{:TeX-macros}            @tab @code{org-export-with-TeX-macros}
7084 @item @code{:LaTeX-fragments}       @tab @code{org-export-with-LaTeX-fragments}
7085 @item @code{:fixed-width}           @tab @code{org-export-with-fixed-width}
7086 @item @code{:timestamps}           .@tab @code{org-export-with-timestamps}
7087 @item @code{:tags}                 .@tab @code{org-export-with-tags}
7088 @item @code{:tables}                @tab @code{org-export-with-tables}
7089 @item @code{:table-auto-headline}   @tab @code{org-export-highlight-first-table-line}
7090 @item @code{:style}                 @tab @code{org-export-html-style}
7091 @item @code{:convert-org-links}     @tab @code{org-export-html-link-org-files-as-html}
7092 @item @code{:inline-images}         @tab @code{org-export-html-inline-images}
7093 @item @code{:expand-quoted-html}    @tab @code{org-export-html-expand}
7094 @item @code{:timestamp}             @tab @code{org-export-html-with-timestamp}
7095 @item @code{:publishing-directory}  @tab @code{org-export-publishing-directory}
7096 @item @code{:preamble}              @tab @code{org-export-html-preamble}
7097 @item @code{:postamble}             @tab @code{org-export-html-postamble}
7098 @item @code{:auto-preamble}         @tab @code{org-export-html-auto-preamble}
7099 @item @code{:auto-postamble}        @tab @code{org-export-html-auto-postamble}
7100 @item @code{:author}                @tab @code{user-full-name}
7101 @item @code{:email}                 @tab @code{user-mail-address}
7102 @end multitable
7104 If you use several email addresses, separate them by a semi-column.
7106 Most of the @code{org-export-with-*} variables have the same effect in
7107 both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
7108 @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
7109 La@TeX{} export.
7111 When a property is given a value in @code{org-publish-project-alist},
7112 its setting overrides the value of the corresponding user variable (if
7113 any) during publishing.  Options set within a file (@pxref{Export
7114 options}), however, override everything.
7116 @node Publishing links, Project page index, Publishing options, Configuration
7117 @subsection Links between published files
7118 @cindex links, publishing
7120 To create a link from one Org-mode file to another, you would use
7121 something like @samp{[[file:foo.org][The foo]]} or simply
7122 @samp{file:foo.org.} (@pxref{Hyperlinks}).  Upon publishing this link
7123 becomes a link to @file{foo.html}.  In this way, you can interlink the
7124 pages of your "org web" project and the links will work as expected when
7125 you publish them to HTML.
7127 You may also link to related files, such as images. Provided you are
7128 careful with relative pathnames, and provided you have also configured
7129 @code{org-publish} to upload the related files, these links will work
7130 too. @ref{Complex example} for an example of this usage.
7132 Sometime an Org-mode file to be published may contain links that are
7133 only valid in your production environment, but not in the publishing
7134 location.  In this case, use the property 
7136 @multitable @columnfractions 0.4 0.6
7137 @item @code{:link-validation-function}
7138 @tab Function to validate links
7139 @end multitable
7141 @noindent
7142 to define a function for checking link validity.  This function must
7143 accept two arguments, the file name and a directory relative to which
7144 the file name is interpreted in the production environment.  If this
7145 function returns @code{nil}, then the HTML generator will only insert a
7146 description into the HTML file, but no link.  One option for this
7147 function is @code{org-publish-validate-link} which checks if the given
7148 file is part of any project in @code{org-publish-project-alist}.
7150 @node Project page index,  , Publishing links, Configuration
7151 @subsection Project page index
7152 @cindex index, of published pages
7154 The following properties may be used to control publishing of an
7155 index of files or summary page for a given project.
7157 @multitable @columnfractions 0.25 0.75
7158 @item @code{:auto-index}
7159 @tab When non-nil, publish an index during org-publish-current-project or
7160 org-publish-all.
7162 @item @code{:index-filename}
7163 @tab Filename for output of index. Defaults to @file{index.org} (which
7164 becomes @file{index.html}).
7166 @item @code{:index-title}
7167 @tab Title of index page. Defaults to name of file.
7169 @item @code{:index-function}
7170 @tab Plugin function to use for generation of index.
7171 Defaults to @code{org-publish-org-index}, which generates a plain list
7172 of links to all files in the project.
7173 @end multitable
7175 @node Sample configuration, Triggering publication, Configuration, Publishing
7176 @section Sample configuration
7178 Below we provide two example configurations.  The first one is a simple
7179 project publishing only a set of Org-mode files.  The second example is
7180 more complex, with a multi-component project.
7182 @menu
7183 * Simple example::              One-component publishing
7184 * Complex example::             A multi-component publishing example
7185 @end menu
7187 @node Simple example, Complex example, Sample configuration, Sample configuration
7188 @subsection Example: simple publishing configuration
7190 This example publishes a set of Org-mode files to the @file{public_html}
7191 directory on the local machine.
7193 @lisp
7194 (setq org-publish-project-alist
7195       '(("org" 
7196          :base-directory "~/org/"
7197          :publishing-directory "~/public_html"
7198          :section-numbers nil
7199          :table-of-contents nil
7200          :style "<link rel=stylesheet 
7201                 href=\"../other/mystyle.css\"
7202                 type=\"text/css\">")))
7203 @end lisp
7205 @node Complex example,  , Simple example, Sample configuration
7206 @subsection Example: complex publishing configuration
7208 This more complicated example publishes an entire website, including
7209 org files converted to HTML, image files, emacs lisp source code, and
7210 stylesheets. The publishing-directory is remote and private files are
7211 excluded.
7213 To ensure that links are preserved, care should be taken to replicate
7214 your directory structure on the web server, and to use relative file
7215 paths. For example, if your org files are kept in @file{~/org} and your
7216 publishable images in @file{~/images}, you'd link to an image with
7218 @example
7219 file:../images/myimage.png
7220 @end example
7222 On the web server, the relative path to the image should be the
7223 same. You can accomplish this by setting up an "images" folder in the
7224 right place on the webserver, and publishing images to it.
7226 @lisp
7227 (setq org-publish-project-alist
7228       '(("orgfiles"
7229           :base-directory "~/org/"
7230           :base-extension "org"
7231           :publishing-directory "/ssh:user@@host:~/html/notebook/"
7232           :publishing-function org-publish-org-to-html
7233           :exclude "PrivatePage.org"   ;; regexp
7234           :headline-levels 3
7235           :section-numbers nil
7236           :table-of-contents nil
7237           :style "<link rel=stylesheet 
7238                   href=\"../other/mystyle.css\" type=\"text/css\">"
7239           :auto-preamble t
7240           :auto-postamble nil)
7241          
7242          ("images"
7243           :base-directory "~/images/"
7244           :base-extension "jpg\\|gif\\|png"
7245           :publishing-directory "/ssh:user@@host:~/html/images/"
7246           :publishing-function org-publish-attachment)
7248          ("other"
7249           :base-directory "~/other/"
7250           :base-extension "css\\|el"
7251           :publishing-directory "/ssh:user@@host:~/html/other/"
7252           :publishing-function org-publish-attachment)
7253          ("website" :components ("orgfiles" "images" "other"))))
7254 @end lisp
7256 @node Triggering publication,  , Sample configuration, Publishing
7257 @section Triggering publication
7259 Once org-publish is properly configured, you can publish with the
7260 following functions: 
7262 @table @kbd
7263 @item C-c C-e C
7264 Prompt for a specific project and publish all files that belong to it.
7265 @item C-c C-e P
7266 Publish the project containing the current file.
7267 @item C-c C-e F
7268 Publish only the current file.
7269 @item C-c C-e A
7270 Publish all projects.
7271 @end table
7273 Org uses timestamps to track when a file has changed. The above
7274 functions normally only publish changed files. You can override this and
7275 force publishing of all files by giving a prefix argument.
7277 @node Miscellaneous, Extensions and Hacking, Publishing, Top
7278 @chapter Miscellaneous
7280 @menu
7281 * Completion::                  M-TAB knows what you need
7282 * Customization::               Adapting Org-mode to your taste
7283 * In-buffer settings::          Overview of the #+KEYWORDS
7284 * The very busy C-c C-c key::   When in doubt, press C-c C-c
7285 * Clean view::                  Getting rid of leading stars in the outline
7286 * TTY keys::                    Using Org-mode on a tty
7287 * Interaction::                 Other Emacs packages
7288 * Bugs::                        Things which do not work perfectly
7289 @end menu
7291 @node Completion, Customization, Miscellaneous, Miscellaneous
7292 @section Completion
7293 @cindex completion, of @TeX{} symbols
7294 @cindex completion, of TODO keywords
7295 @cindex completion, of dictionary words
7296 @cindex completion, of option keywords
7297 @cindex completion, of tags
7298 @cindex completion, of property keys
7299 @cindex completion, of link abbreviations
7300 @cindex @TeX{} symbol completion
7301 @cindex TODO keywords completion
7302 @cindex dictionary word completion
7303 @cindex option keyword completion
7304 @cindex tag completion
7305 @cindex link abbreviations, completion of
7307 Org-mode supports in-buffer completion.  This type of completion does
7308 not make use of the minibuffer.  You simply type a few letters into
7309 the buffer and use the key to complete text right there.
7311 @table @kbd
7312 @kindex M-@key{TAB}
7313 @item M-@key{TAB}
7314 Complete word at point
7315 @itemize @bullet
7316 @item
7317 At the beginning of a headline, complete TODO keywords.
7318 @item
7319 After @samp{\}, complete @TeX{} symbols supported by the exporter.
7320 @item
7321 After @samp{*}, complete headlines in the current buffer so that they
7322 can be used in search links like @samp{[[*find this headline]]}.
7323 @item
7324 After @samp{:} in a headline, complete tags.  The list of tags is taken
7325 from the variable @code{org-tag-alist} (possibly set through the
7326 @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
7327 dynamically from all tags used in the current buffer.
7328 @item
7329 After @samp{:} and not in a headline, complete property keys.  The list
7330 of keys is constructed dynamically from all keys used in the current
7331 buffer.
7332 @item
7333 After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
7334 @item
7335 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
7336 @samp{OPTIONS} which set file-specific options for Org-mode.  When the
7337 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
7338 will insert example settings for this keyword.
7339 @item
7340 In the line after @samp{#+STARTUP: }, complete startup keywords,
7341 i.e. valid keys for this line.
7342 @item
7343 Elsewhere, complete dictionary words using ispell.
7344 @end itemize
7345 @end table
7347 @node Customization, In-buffer settings, Completion, Miscellaneous
7348 @section Customization
7349 @cindex customization
7350 @cindex options, for customization
7351 @cindex variables, for customization
7353 There are more than 180 variables that can be used to customize
7354 Org-mode.  For the sake of compactness of the manual, I am not
7355 describing the variables here.  A structured overview of customization
7356 variables is available with @kbd{M-x org-customize}.  Or select
7357 @code{Browse Org Group} from the @code{Org->Customization} menu.  Many
7358 settings can also be activated on a per-file basis, by putting special
7359 lines into the buffer (@pxref{In-buffer settings}).
7361 @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
7362 @section Summary of in-buffer settings
7363 @cindex in-buffer settings
7364 @cindex special keywords
7366 Org-mode uses special lines in the buffer to define settings on a
7367 per-file basis.  These lines start with a @samp{#+} followed by a
7368 keyword, a colon, and then individual words defining a setting.  Several
7369 setting words can be in the same line, but you can also have multiple
7370 lines for the keyword.  While these settings are described throughout
7371 the manual, here is a summary.  After changing any of those lines in the
7372 buffer, press @kbd{C-c C-c} with the cursor still in the line to
7373 activate the changes immediately.  Otherwise they become effective only
7374 when the file is visited again in a new Emacs session.
7376 @table @kbd
7377 @item #+ARCHIVE: %s_done::
7378 This line sets the archive location for the agenda file.  It applies for
7379 all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
7380 of the file.  The first such line also applies to any entries before it.
7381 The corresponding variable is @code{org-archive-location}.
7382 @item #+CATEGORY:
7383 This line sets the category for the agenda file.  The category applies
7384 for all subsequent lines until the next @samp{#+CATEGORY} line, or the
7385 end of the file.  The first such line also applies to any entries before it.
7386 @item #+COLUMNS: %25ITEM .....
7387 Set the default format for columns view.  This format applies when
7388 columns view is invoked in location where no @code{COLUMNS} property
7389 applies.
7390 @item #+CONSTANTS: name1=value1 ...
7391 Set file-local values for constants to be used in table formulas.  This
7392 line set the local variable @code{org-table-formula-constants-local}.
7393 The global version of this variable is
7394 @code{org-table-formula-constants}.
7395 @item #+DRAWERS: NAME1 .....
7396 Set the file-local set of drawers.  The corresponding global variable is
7397 @code{org-drawers}.
7398 @item #+LINK:  linkword replace
7399 These lines (several are allowed) specify link abbreviations.
7400 @xref{Link abbreviations}.  The corresponding variable is
7401 @code{org-link-abbrev-alist}.
7402 @item #+PRIORITIES: highest lowest default
7403 This line sets the limits and the default for the priorities.  All three
7404 must be either letters A-Z or numbers 0-9.  The highest priority must
7405 have a lower ASCII number that the lowest priority.
7406 @item #+PROPERTY: Property_Name Value
7407 This line sets a default inheritance value for entries in the current
7408 buffer, most useful for specifying the allowed values of a property.
7409 @item #+STARTUP:
7410 This line sets options to be used at startup of Org-mode, when an
7411 Org-mode file is being visited.  The first set of options deals with the
7412 initial visibility of the outline tree.  The corresponding variable for
7413 global default settings is @code{org-startup-folded}, with a default
7414 value @code{t}, which means @code{overview}.
7415 @cindex @code{overview}, STARTUP keyword
7416 @cindex @code{content}, STARTUP keyword
7417 @cindex @code{showall}, STARTUP keyword
7418 @example
7419 overview   @r{top-level headlines only}
7420 content    @r{all headlines}
7421 showall    @r{no folding at all, show everything}
7422 @end example
7423 Then there are options for aligning tables upon visiting a file.  This
7424 is useful in files containing narrowed table columns.  The corresponding
7425 variable is @code{org-startup-align-all-tables}, with a default value
7426 @code{nil}. 
7427 @cindex @code{align}, STARTUP keyword
7428 @cindex @code{noalign}, STARTUP keyword
7429 @example
7430 align      @r{align all tables}
7431 noalign    @r{don't align tables on startup}
7432 @end example
7433 Logging closing and reinstating TODO items, and clock intervals
7434 (variables @code{org-log-done}, @code{org-log-note-clock-out}, and
7435 @code{org-log-repeat}) can be configured using these options.
7436 @cindex @code{logdone}, STARTUP keyword
7437 @cindex @code{lognotedone}, STARTUP keyword
7438 @cindex @code{nologdone}, STARTUP keyword
7439 @cindex @code{lognoteclock-out}, STARTUP keyword
7440 @cindex @code{nolognoteclock-out}, STARTUP keyword
7441 @cindex @code{logrepeat}, STARTUP keyword
7442 @cindex @code{lognoterepeat}, STARTUP keyword
7443 @cindex @code{nologrepeat}, STARTUP keyword
7444 @example
7445 logdone            @r{record a timestamp when an item is marked DONE}
7446 lognotedone        @r{record timestamp and a note when DONE}
7447 nologdone          @r{don't record when items are marked DONE}
7448 logrepeat          @r{record a time when reinstating a repeating item}
7449 lognoterepeat      @r{record a note when reinstating a repeating item}
7450 nologrepeat        @r{do not record when reinstating repeating item}
7451 lognoteclock-out   @r{record a note when clocking out}
7452 nolognoteclock-out @r{don't record a note when clocking out}
7453 @end example
7454 Here are the options for hiding leading stars in outline headings.  The
7455 corresponding variables are @code{org-hide-leading-stars} and
7456 @code{org-odd-levels-only}, both with a default setting @code{nil}
7457 (meaning @code{showstars} and @code{oddeven}).
7458 @cindex @code{hidestars}, STARTUP keyword
7459 @cindex @code{showstars}, STARTUP keyword
7460 @cindex @code{odd}, STARTUP keyword
7461 @cindex @code{even}, STARTUP keyword
7462 @example
7463 hidestars  @r{make all but one of the stars starting a headline invisible.}
7464 showstars  @r{show all stars starting a headline}
7465 odd        @r{allow only odd outline levels (1,3,...)}
7466 oddeven    @r{allow all outline levels}
7467 @end example
7468 To turn on custom format overlays over time stamps (variables
7469 @code{org-put-time-stamp-overlays} and
7470 @code{org-time-stamp-overlay-formats}), use
7471 @cindex @code{customtime}, STARTUP keyword
7472 @example
7473 customtime @r{overlay custom time format}
7474 @end example
7475 The following options influence the table spreadsheet (variable
7476 @code{constants-unit-system}).
7477 @cindex @code{constcgs}, STARTUP keyword
7478 @cindex @code{constSI}, STARTUP keyword
7479 @example
7480 constcgs   @r{@file{constants.el} should use the c-g-s unit system}
7481 constSI    @r{@file{constants.el} should use the SI unit system}
7482 @end example
7483 @item #+TAGS:  TAG1(c1) TAG2(c2)
7484 These lines (several such lines are allowed) specify the valid tags in
7485 this file, and (potentially) the corresponding @emph{fast tag selection}
7486 keys.  The corresponding variable is @code{org-tag-alist}.
7487 @item #+TBLFM:
7488 This line contains the formulas for the table directly above the line.
7489 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:
7490 These lines provide settings for exporting files.  For more details see
7491 @ref{Export options}.
7492 @item #+SEQ_TODO:   #+TYP_TODO:
7493 These lines set the TODO keywords and their interpretation in the
7494 current file.  The corresponding variables are @code{org-todo-keywords}
7495 and @code{org-todo-interpretation}.
7496 @end table
7498 @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
7499 @section The very busy C-c C-c key
7500 @kindex C-c C-c
7501 @cindex C-c C-c, overview
7503 The key @kbd{C-c C-c} has many purposes in org-mode, which are all
7504 mentioned scattered throughout this manual.  One specific function of
7505 this key is to add @emph{tags} to a headline (@pxref{Tags}).  In many
7506 other circumstances it means something like @emph{Hey Org-mode, look
7507 here and update according to what you see here}.  Here is a summary of
7508 what this means in different contexts.
7510 @itemize @minus
7511 @item
7512 If there are highlights in the buffer from the creation of a sparse
7513 tree, or from clock display, remove these highlights.
7514 @item
7515 If the cursor is in one of the special @code{#+KEYWORD} lines, this
7516 triggers scanning the buffer for these lines and updating the
7517 information. 
7518 @item
7519 If the cursor is inside a table, realign the table.  This command
7520 works even if the automatic table editor has been turned off.
7521 @item
7522 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
7523 the entire table.
7524 @item
7525 If the cursor is inside a table created by the @file{table.el} package,
7526 activate that table.
7527 @item
7528 If the current buffer is a remember buffer, close the note and file it.
7529 With a prefix argument, file it, without further interaction, to the
7530 default location.
7531 @item
7532 If the cursor is on a @code{<<<target>>>}, update radio targets and
7533 corresponding links in this buffer.
7534 @item
7535 If the cursor is in a property line or at the start or end of a property
7536 drawer, offer property commands.
7537 @item
7538 If the cursor is in a plain list item with a checkbox, toggle the status
7539 of the checkbox.
7540 @item
7541 If the cursor is on a numbered item in a plain list, renumber the
7542 ordered list.
7543 @item
7544 If the cursor is on the @code{#+BEGIN} line of a dynamical block, the
7545 block is updated.
7546 @end itemize
7548 @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
7549 @section A cleaner outline view
7550 @cindex hiding leading stars
7551 @cindex clean outline view
7553 Some people find it noisy and distracting that the Org-mode headlines
7554 are starting with a potentially large number of stars.  For example
7555 the tree from @ref{Headlines}:
7557 @example
7558 * Top level headline
7559 ** Second level
7560 *** 3rd level
7561     some text
7562 *** 3rd level
7563     more text
7564 * Another top level headline
7565 @end example
7567 @noindent
7568 Unfortunately this is deeply ingrained into the code of Org-mode and
7569 cannot be easily changed.  You can, however, modify the display in such
7570 a way that all leading stars become invisible and the outline more easy
7571 to read.  To do this, customize the variable
7572 @code{org-hide-leading-stars} like this:
7574 @lisp
7575 (setq org-hide-leading-stars t)
7576 @end lisp
7578 @noindent
7579 or change this on a per-file basis with one of the lines (anywhere in
7580 the buffer)
7582 @example
7583 #+STARTUP: showstars
7584 #+STARTUP: hidestars
7585 @end example
7587 @noindent
7588 Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
7589 the modifications.
7591 With stars hidden, the tree becomes:
7593 @example
7594 * Top level headline
7595  * Second level
7596   * 3rd level
7597     some text
7598   * 3rd level
7599     more text
7600 * Another top level headline
7601 @end example
7603 @noindent
7604 Note that the leading stars are not truly replaced by whitespace, they
7605 are only fontified with the face @code{org-hide} that uses the
7606 background color as font color.  If you are not using either white or
7607 black background, you may have to customize this face to get the wanted
7608 effect.  Another possibility is to set this font such that the extra
7609 stars are @i{almost} invisible, for example using the color
7610 @code{grey90} on a white background.
7612 Things become cleaner still if you skip all the even levels and use only
7613 odd levels 1, 3, 5..., effectively adding two stars to go from one
7614 outline level to the next:
7616 @example
7617 * Top level headline
7618   * Second level
7619     * 3rd level
7620       some text
7621     * 3rd level
7622       more text
7623 * Another top level headline
7624 @end example
7626 @noindent
7627 In order to make the structure editing and export commands handle this
7628 convention correctly, use
7630 @lisp
7631 (setq org-odd-levels-only t)
7632 @end lisp
7634 @noindent
7635 or set this on a per-file basis with one of the following lines (don't
7636 forget to press @kbd{C-c C-c} with the cursor in the startup line to
7637 activate changes immediately).
7639 @example
7640 #+STARTUP: odd
7641 #+STARTUP: oddeven
7642 @end example
7644 You can convert an Org-mode file from single-star-per-level to the
7645 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
7646 RET} in that file.  The reverse operation is @kbd{M-x
7647 org-convert-to-oddeven-levels}.
7649 @node TTY keys, Interaction, Clean view, Miscellaneous
7650 @section Using org-mode on a tty
7651 @cindex tty keybindings
7653 Because Org-mode contains a large number of commands, by default much of
7654 Org-mode's core commands are bound to keys that are generally not
7655 accessible on a tty, such as the cursor keys (@key{left}, @key{right},
7656 @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
7657 together with modifiers like @key{Meta} and/or @key{Shift}.  To access
7658 these commands on a tty when special keys are unavailable, the following
7659 alternative bindings can be used.  The tty bindings below will likely be
7660 more cumbersome; you may find for some of the bindings below that a
7661 customized work-around suits you better.  For example, changing a time
7662 stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
7663 tty you would rather use @kbd{C-c .} to re-insert the timestamp.
7665 @multitable @columnfractions 0.15 0.2 0.2
7666 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
7667 @item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
7668 @item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
7669 @item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
7670 @item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
7671 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
7672 @item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
7673 @item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
7674 @item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
7675 @item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
7676 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
7677 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
7678 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
7679 @item @kbd{S-@key{left}}    @tab @kbd{C-c @key{left}}      @tab
7680 @item @kbd{S-@key{right}}   @tab @kbd{C-c @key{right}}     @tab
7681 @item @kbd{S-@key{up}}      @tab @kbd{C-c @key{up}}        @tab
7682 @item @kbd{S-@key{down}}    @tab @kbd{C-c @key{down}}      @tab
7683 @item @kbd{C-S-@key{left}}  @tab @kbd{C-c C-x @key{left}}  @tab
7684 @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
7685 @end multitable
7687 @node Interaction, Bugs, TTY keys, Miscellaneous
7688 @section Interaction with other packages
7689 @cindex packages, interaction with other
7690 Org-mode lives in the world of GNU Emacs and interacts in various ways
7691 with other code out there.
7693 @menu
7694 * Cooperation::                 Packages Org-mode cooperates with
7695 * Conflicts::                   Packages that lead to conflicts
7696 @end menu
7698 @node Cooperation, Conflicts, Interaction, Interaction
7699 @subsection Packages that Org-mode cooperates with
7701 @table @asis
7702 @cindex @file{calc.el}
7703 @item @file{calc.el} by Dave Gillespie
7704 Org-mode uses the calc package for implementing spreadsheet
7705 functionality in its tables (@pxref{The spreadsheet}).  Org-mode
7706 checks for the availability of calc by looking for the function
7707 @code{calc-eval} which should be autoloaded in your setup if calc has
7708 been installed properly.  As of Emacs 22, calc is part of the Emacs
7709 distribution.  Another possibility for interaction between the two
7710 packages is using calc for embedded calculations. @xref{Embedded Mode,
7711 , Embedded Mode, calc, GNU Emacs Calc Manual}.
7712 @cindex @file{constants.el}
7713 @item @file{constants.el} by Carsten Dominik
7714 In a table formula (@pxref{The spreadsheet}), it is possible to use
7715 names for natural constants or units.  Instead of defining your own
7716 constants in the variable @code{org-table-formula-constants}, install
7717 the @file{constants} package which defines a large number of constants
7718 and units, and lets you use unit prefixes like @samp{M} for
7719 @samp{Mega} etc.  You will need version 2.0 of this package, available
7720 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org-mode checks for
7721 the function @code{constants-get}, which has to be autoloaded in your
7722 setup.  See the installation instructions in the file
7723 @file{constants.el}.
7724 @item @file{cdlatex.el} by Carsten Dominik
7725 @cindex @file{cdlatex.el}
7726 Org-mode can make use of the cdlatex package to efficiently enter
7727 La@TeX{} fragments into Org-mode files. See @ref{CDLaTeX mode}.
7728 @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
7729 @cindex @file{imenu.el}
7730 Imenu allows menu access to an index of items in a file.  Org-mode
7731 supports imenu - all you need to do to get the index is the following:
7732 @lisp
7733 (add-hook 'org-mode-hook 
7734           (lambda () 'imenu-add-to-menubar "Imenu"))
7735 @end lisp
7736 By default the index is two levels deep - you can modify the depth using
7737 the option @code{org-imenu-depth}.
7738 @item @file{remember.el} by John Wiegley
7739 @cindex @file{remember.el}
7740 Org mode cooperates with remember, see @ref{Remember}.
7741 @file{Remember.el} is not part of Emacs, find it on the web.
7742 @item @file{speedbar.el} by Eric M. Ludlam
7743 @cindex @file{speedbar.el}
7744 Speedbar is a package that creates a special frame displaying files and
7745 index items in files.  Org-mode supports speedbar and allows you to
7746 drill into Org-mode files directly from the speedbar.  It also allows to
7747 restrict the scope of agenda commands to a file or a subtree by using
7748 the command @kbd{<} in the speedbar frame.
7749 @cindex @file{table.el}
7750 @item @file{table.el} by Takaaki Ota
7751 @kindex C-c C-c
7752 @cindex table editor, @file{table.el}
7753 @cindex @file{table.el}
7755 Complex ASCII tables with automatic line wrapping, column- and
7756 row-spanning, and alignment can be created using the Emacs table
7757 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
7758 and also part of Emacs 22).
7759 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org-mode
7760 will call @command{table-recognize-table} and move the cursor into the
7761 table.  Inside a table, the keymap of Org-mode is inactive.  In order
7762 to execute Org-mode-related commands, leave the table.
7764 @table @kbd
7765 @kindex C-c C-c
7766 @item C-c C-c
7767 Recognize @file{table.el} table.  Works when the cursor is in a
7768 table.el table.
7770 @kindex C-c ~
7771 @item C-c ~
7772 Insert a table.el table.  If there is already a table at point, this
7773 command converts it between the table.el format and the Org-mode
7774 format.  See the documentation string of the command
7775 @code{org-convert-table} for the restrictions under which this is
7776 possible.
7777 @end table
7778 @file{table.el} is part of Emacs 22.
7779 @cindex @file{footnote.el}
7780 @item @file{footnote.el} by Steven L. Baur
7781 Org-mode recognizes numerical footnotes as provided by this package
7782 (@pxref{Footnotes}).
7783 @end table
7785 @node Conflicts,  , Cooperation, Interaction
7786 @subsection Packages that lead to conflicts with Org-mode
7788 @table @asis
7790 @cindex @file{allout.el}
7791 @item @file{allout.el} by Ken Manheimer
7792 Startup of Org-mode may fail with the error message
7793 @code{(wrong-type-argument keymapp nil)} when there is an outdated
7794 version @file{allout.el} on the load path, for example the version
7795 distributed with Emacs 21.x.  Upgrade to Emacs 22 and this problem will
7796 disappear.  If for some reason you cannot do this, make sure that org.el
7797 is loaded @emph{before} @file{allout.el}, for example by putting
7798 @code{(require 'org)} early enough into your @file{.emacs} file.
7800 @cindex @file{CUA.el}
7801 @item @file{CUA.el} by Kim. F. Storm
7802 Keybindings in Org-mode conflict with the @kbd{S-<cursor>} keys used by
7803 CUA-mode (as well as pc-select-mode and s-region-mode) to select and
7804 extend the region.  If you want to use one of these packages along with
7805 Org-mode, configure the variable @code{org-replace-disputed-keys}.  When
7806 set, Org-mode will move the following keybindings in Org-mode files, and
7807 in the agenda buffer (but not during date selection).
7809 @example
7810 S-UP    -> M-p             S-DOWN  -> M-n
7811 S-LEFT  -> M--             S-RIGHT -> M-+
7812 @end example
7814 Yes, these are unfortunately more difficult to remember.  If you want
7815 to have other replacement keys, look at the variable
7816 @code{org-disputed-keys}.
7817 @item @file{windmove.el} by Hovav Shacham
7818 @cindex @file{windmove.el}
7819 Also this package uses the @kbd{S-<cursor>} keys, so everything written
7820 in the paragraph above about CUA mode also applies here.
7822 @cindex @file{footnote.el}
7823 @item @file{footnote.el} by Steven L. Baur
7824 Org-mode supports the syntax of the footnote package, but only the
7825 numerical footnote markers.  Also, the default key for footnote
7826 commands, @kbd{C-c !} is already used by Org-mode.  You could use the
7827 variable @code{footnote-prefix} to switch footnotes commands to another
7828 key.  Or, you could use @code{org-replace-disputed-keys} and
7829 @code{org-disputed-keys} to change the settings in Org-mode.
7831 @end table
7834 @node Bugs,  , Interaction, Miscellaneous
7835 @section Bugs
7836 @cindex bugs
7838 Here is a list of things that should work differently, but which I
7839 have found too hard to fix.
7841 @itemize @bullet
7842 @item
7843 If a table field starts with a link, and if the corresponding table
7844 column is narrowed (@pxref{Narrow columns}) to a width too small to
7845 display the link, the field would look entirely empty even though it is
7846 not.  To prevent this, Org-mode throws an error.  The work-around is to
7847 make the column wide enough to fit the link, or to add some text (at
7848 least 2 characters) before the link in the same field.
7849 @item
7850 Narrowing table columns does not work on XEmacs, because the
7851 @code{format} function does not transport text properties.
7852 @item
7853 Text in an entry protected with the @samp{QUOTE} keyword should not
7854 autowrap.
7855 @item
7856 When the application called by @kbd{C-c C-o} to open a file link fails
7857 (for example because the application does not exist or refuses to open
7858 the file), it does so silently.  No error message is displayed.
7859 @item
7860 Recalculating a table line applies the formulas from left to right.
7861 If a formula uses @emph{calculated} fields further down the row,
7862 multiple recalculation may be needed to get all fields consistent.  You
7863 may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
7864 recalculate until convergence.
7865 @item
7866 A single letter cannot be made bold, for example @samp{*a*}.
7867 @item
7868 The exporters work well, but could be made more efficient.
7869 @end itemize
7872 @node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
7873 @appendix Extensions, Hooks and Hacking
7875 This appendix lists extensions for Org-mode written by other authors.
7876 It also covers some aspects where users can extend the functionality of
7877 Org-mode.
7879 @menu
7880 * Extensions::                  Existing 3rd-part extensions
7881 * Adding hyperlink types::      New custom link types
7882 * Tables in arbitrary syntax::  Orgtbl for LaTeX and other programs
7883 * Dynamic blocks::              Automatically filled blocks
7884 * Special agenda views::        Customized views
7885 * Using the property API::      Writing programs that use entry properties
7886 @end menu
7888 @node Extensions, Adding hyperlink types, Extensions and Hacking, Extensions and Hacking
7889 @section Third-party extensions for Org-mode
7890 @cindex extension, third-party
7892 The following extensions for Org-mode have been written by other people:
7894 @table @asis
7895 @cindex @file{org-publish.el}
7896 @item @file{org-publish.el} by David O'Toole
7897 This package provides facilities for publishing related sets of Org-mode
7898 files together with linked files like images as webpages.  It is
7899 highly configurable and can be used for other publishing purposes as
7900 well.  As of Org-mode version 4.30, @file{org-publish.el} is part of the
7901 Org-mode distribution.  It is not yet part of Emacs, however, a delay
7902 caused by the preparations for the 22.1 release.  In the mean time,
7903 @file{org-publish.el} can be downloaded from David's site:
7904 @url{http://dto.freeshell.org/e/org-publish.el}.
7905 @cindex @file{org-mouse.el}
7906 @item @file{org-mouse.el} by Piotr Zielinski
7907 This package implements extended mouse functionality for Org-mode.  It
7908 allows you to cycle visibility and to edit the document structure with
7909 the mouse.  Best of all, it provides a context-sensitive menu on
7910 @key{mouse-3} that changes depending on the context of a mouse-click.
7911 As of Org-mode version 4.53, @file{org-mouse.el} is part of the
7912 Org-mode distribution.  It is not yet part of Emacs, however, a delay
7913 caused by the preparations for the 22.1 release.  In the mean time,
7914 @file{org-mouse.el} can be downloaded from Piotr's site:
7915 @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}.
7916 @cindex @file{org-blog.el}
7917 @item @file{org-blog.el} by David O'Toole
7918 A blogging plug-in for @file{org-publish.el}.@*
7919 @url{http://dto.freeshell.org/notebook/OrgMode.html}.
7920 @cindex @file{blorg.el}
7921 @item @file{blorg.el} by Bastien Guerry
7922 Publish Org-mode files as
7923 blogs. @url{http://www.cognition.ens.fr/~guerry/blorg.html}.
7924 @cindex @file{org2rem.el}
7925 @item @file{org2rem.el} by Bastien Guerry
7926 Translates Org-mode files into something readable by
7927 Remind. @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
7928 @item @file{org-toc.el} by Bastien Guerry
7929 Produces a simple table of contents of an Org-mode file, for easy
7930 navigation. @url{http://www.cognition.ens.fr/~guerry/u/org-registry.el}.
7931 @item @file{org-registry.el} by Bastien Guerry
7932 Find which Org-file link to a certain document.
7933 @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
7934 @end table
7936 @page
7938 @node Adding hyperlink types, Tables in arbitrary syntax, Extensions, Extensions and Hacking
7939 @section Adding hyperlink types
7940 @cindex hyperlinks, adding new types
7942 Org-mode has a large number of hyperlink types built-in
7943 (@pxref{Hyperlinks}).  If you would like to add new link types, it
7944 provides an interface for doing so.  Lets look at an example file
7945 @file{org-man.el} that will add support for creating links like
7946 @samp{[[man:printf][The printf manpage]]} to show unix manual pages inside
7947 emacs:
7949 @lisp
7950 ;;; org-man.el - Support for links to manpages in Org-mode
7952 (require 'org)
7954 (org-add-link-type "man" 'org-man-open)
7955 (add-hook 'org-store-link-functions 'org-man-store-link)
7957 (defcustom org-man-command 'man
7958   "The Emacs command to be used to display a man page."
7959   :group 'org-link
7960   :type '(choice (const man) (const woman)))
7962 (defun org-man-open (path)
7963   "Visit the manpage on PATH.
7964 PATH should be a topic that can be thrown at the man command."
7965   (funcall org-man-command path))
7967 (defun org-man-store-link ()
7968   "Store a link to a manpage."
7969   (when (memq major-mode '(Man-mode woman-mode))
7970     ;; This is a man page, we do make this link
7971     (let* ((page (org-man-get-page-name))
7972            (link (concat "man:" page))
7973            (description (format "Manpage for %s" page)))
7974       (org-store-link-props
7975        :type "man"
7976        :link link
7977        :description description))))
7979 (defun org-man-get-page-name ()
7980   "Extract the page name from the buffer name."
7981   ;; This works for both `Man-mode' and `woman-mode'.
7982   (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
7983       (match-string 1 (buffer-name))
7984     (error "Cannot create link to this man page")))
7986 (provide 'org-man)
7988 ;;; org-man.el ends here
7989 @end lisp
7991 @noindent
7992 You would activate this new link type in @file{.emacs} with
7994 @lisp
7995 (require 'org-man)
7996 @end lisp
7998 @noindent
7999 Lets go through the file and see what it does.
8000 @enumerate
8001 @item 
8002 It does @code{(require 'org)} to make sure that @file{org.el} has been
8003 loaded.
8004 @item
8005 The next line calls @code{org-add-link-type} to define a new link type
8006 with prefix @samp{man}.  The call also contains the name of a function
8007 that will be called to follow such a link.
8008 @item
8009 The next line adds a function to @code{org-store-link-functions}, in
8010 order to allow the command @kbd{C-c l} to record a useful link in a
8011 buffer displaying a man page.
8012 @end enumerate
8014 The rest of the file defines the necessary variables and functions.
8015 First there is a customization variable that determines which emacs
8016 command should be used to display manpages.  There are two options,
8017 @code{man} and @code{woman}.  Then the function to follow a link is
8018 defined.  It gets the link path as an argument - in this case the link
8019 path is just a topic for the manual command.  The function calls the
8020 value of @code{org-man-command} to display the man page.
8022 Finally the function @code{org-man-store-link} is defined.  When you try
8023 to store a link with @kbd{C-c l}, also this function will be called to
8024 try to make a link.  The function must first decide if it is supposed to
8025 create the link for this buffer type, we do this by checking the value
8026 of the variable @code{major-mode}.  If not, the function must exit and
8027 retunr the value @code{nil}.  If yes, the link is created by getting the
8028 manual tpoic from the buffer name and prefixing it with the string
8029 @samp{man:}.  Then it must call the command @code{org-store-link-props}
8030 and set the @code{:type} and @code{:link} properties.  Optionally you
8031 can also set the @code{:description} property to provide a default for
8032 the link description when the link is later inserted into tan Org-mode
8033 buffer with @kbd{C-c C-l}.
8035 @node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Extensions and Hacking
8036 @section Tables and Lists in arbitrary syntax
8037 @cindex tables, in other modes
8038 @cindex lists, in other modes
8039 @cindex orgtbl-mode
8041 Since Orgtbl-mode can be used as a minor mode in arbitrary buffers, a
8042 frequent feature request has been to make it work with native tables in
8043 specific languages, for example La@TeX{}.  However, this is extremely
8044 hard to do in a general way, would lead to a customization nightmare,
8045 and would take away much of the simplicity of the Orgtbl-mode table
8046 editor.
8049 This appendix describes a different approach.  We keep the Orgtbl-mode
8050 table in its native format (the @i{source table}), and use a custom
8051 function to @i{translate} the table to the correct syntax, and to
8052 @i{install} it in the right location (the @i{target table}).  This puts
8053 the burden of writing conversion functions on the user, but it allows
8054 for a very flexible system.
8056 Bastien added the ability to do the same with lists.  You can use Org's
8057 facilities to edit and structure lists by turning @code{orgstruct-mode}
8058 on, then locally exporting such lists in another format (HTML, La@TeX{}
8059 or TeXInfo.)
8062 @menu
8063 * Radio tables::                Sending and receiving
8064 * A LaTeX example::             Step by step, almost a tutorial
8065 * Translator functions::        Copy and modify
8066 * Radio lists::                 Doing the same for lists.
8067 @end menu
8069 @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
8070 @subsection Radio tables
8071 @cindex radio tables
8073 To define the location of the target table, you first need to create two
8074 lines that are comments in the current mode, but contain magic words for
8075 Orgtbl-mode to find.  Orgtbl-mode will insert the translated table
8076 between these lines, replacing whatever was there before.  For example:
8078 @example
8079 /* BEGIN RECEIVE ORGTBL table_name */
8080 /* END RECEIVE ORGTBL table_name */
8081 @end example
8083 @noindent
8084 Just above the source table, we put a special line that tells
8085 Orgtbl-mode how to translate this table and where to install it.  For
8086 example:
8087 @example
8088 #+ORGTBL: SEND table_name translation_function arguments....
8089 @end example
8091 @noindent
8092 @code{table_name} is the reference name for the table that is also used
8093 in the receiver lines. @code{translation_function} is the Lisp function
8094 that does the translation.  Furthermore, the line can contain a list of
8095 arguments (alternating key and value) at the end.  The arguments will be
8096 passed as a property list to the translation function for
8097 interpretation.  A few standard parameters are already recognized and
8098 acted upon before the translation function is called:
8100 @table @code
8101 @item :skip N
8102 Skip the first N lines of the table. Hlines do count!
8103 @item :skipcols (n1 n2 ...)
8104 List of columns that should be skipped.  If the table has a column with
8105 calculation marks, that column is automatically discarded as well.
8106 Please note that the translator function sees the table @emph{after} the
8107 removal of these columns, the function never knows that there have been
8108 additional columns.
8109 @end table
8111 @noindent
8112 The one problem remaining is how to keep the source table in the buffer
8113 without disturbing the normal workings of the file, for example during
8114 compilation of a C file or processing of a La@TeX{} file.  There are a
8115 number of different solutions:
8117 @itemize @bullet
8118 @item
8119 The table could be placed in a block comment if that is supported by the
8120 language.  For example, in C-mode you could wrap the table between
8121 @samp{/*} and @samp{*/} lines.
8122 @item 
8123 Sometimes it is possible to put the table after some kind of @i{END}
8124 statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
8125 in La@TeX{}.
8126 @item
8127 You can just comment the table line by line whenever you want to process
8128 the file, and uncomment it whenever you need to edit the table.  This
8129 only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
8130 make this comment-toggling very easy, in particular if you bind it to a
8131 key.
8132 @end itemize
8134 @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
8135 @subsection A LaTeX example of radio tables
8136 @cindex LaTeX, and orgtbl-mode
8138 The best way to wrap the source table in La@TeX{} is to use the
8139 @code{comment} environment provided by @file{comment.sty}.  It has to be
8140 activated by placing @code{\usepackage@{comment@}} into the document
8141 header.  Orgtbl-mode can insert a radio table skeleton@footnote{By
8142 default this works only for La@TeX{}, HTML, and TeXInfo.  Configure the
8143 variable @code{orgtbl-radio-tables} to install templates for other
8144 modes.}  with the command @kbd{M-x orgtbl-insert-radio-table}.  You will
8145 be prompted for a table name, lets say we use @samp{salesfigures}.  You
8146 will then get the following template:
8148 @example
8149 % BEGIN RECEIVE ORGTBL salesfigures
8150 % END RECEIVE ORGTBL salesfigures
8151 \begin@{comment@}
8152 #+ORGTBL: SEND salesfigures orgtbl-to-latex
8153 | | |
8154 \end@{comment@}
8155 @end example
8157 @noindent
8158 The @code{#+ORGTBL: SEND} line tells orgtbl-mode to use the function
8159 @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
8160 into the receiver location with name @code{salesfigures}.  You may now
8161 fill in the table, feel free to use the spreadsheet features@footnote{If
8162 the @samp{#+TBLFM} line contains an odd number of dollar characters,
8163 this may cause problems with font-lock in latex-mode.  As shown in the
8164 example you can fix this by adding an extra line inside the
8165 @code{comment} environment that is used to balance the dollar
8166 expressions.  If you are using AUCTeX with the font-latex library, a
8167 much better solution is to add the @code{comment} environment to the
8168 variable @code{LaTeX-verbatim-environments}.}:
8170 @example
8171 % BEGIN RECEIVE ORGTBL salesfigures
8172 % END RECEIVE ORGTBL salesfigures
8173 \begin@{comment@}
8174 #+ORGTBL: SEND salesfigures orgtbl-to-latex
8175 | Month | Days | Nr sold | per day |
8176 |-------+------+---------+---------|
8177 | Jan   |   23 |      55 |     2.4 |
8178 | Feb   |   21 |      16 |     0.8 |
8179 | March |   22 |     278 |    12.6 |
8180 #+TBLFM: $4=$3/$2;%.1f
8181 % $ (optional extra dollar to keep font-lock happy, see footnote)
8182 \end@{comment@}
8183 @end example
8185 @noindent
8186 When you are done, press @kbd{C-c C-c} in the table to get the converted
8187 table inserted between the two marker lines.
8189 Now lets assume you want to make the table header by hand, because you
8190 want to control how columns are aligned etc.  In this case we make sure
8191 that the table translator does skip the first 2 lines of the source
8192 table, and tell the command to work as a @i{splice}, i.e. to not produce
8193 header and footer commands of the target table:
8195 @example
8196 \begin@{tabular@}@{lrrr@}
8197 Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
8198 % BEGIN RECEIVE ORGTBL salesfigures
8199 % END RECEIVE ORGTBL salesfigures
8200 \end@{tabular@}
8202 \begin@{comment@}
8203 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
8204 | Month | Days | Nr sold | per day |
8205 |-------+------+---------+---------|
8206 | Jan   |   23 |      55 |     2.4 |
8207 | Feb   |   21 |      16 |     0.8 |
8208 | March |   22 |     278 |    12.6 |
8209 #+TBLFM: $4=$3/$2;%.1f
8210 \end@{comment@}
8211 @end example
8213 The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
8214 Orgtbl-mode.  It uses a @code{tabular} environment to typeset the table
8215 and marks horizontal lines with @code{\hline}.  Furthermore, it
8216 interprets the following parameters:
8218 @table @code
8219 @item :splice nil/t
8220 When set to t, return only table body lines, don't wrap them into a
8221 tabular environment.  Default is nil.
8223 @item :fmt fmt
8224 A format to be used to wrap each field, should contain @code{%s} for the
8225 original field value.  For example, to wrap each field value in dollars,
8226 you could use @code{:fmt "$%s$"}.  This may also be a property list with
8227 column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
8229 @item :efmt efmt
8230 Use this format to print numbers with exponentials.  The format should
8231 have @code{%s} twice for inserting mantissa and exponent, for example
8232 @code{"%s\\times10^@{%s@}"}.  The default is @code{"%s\\,(%s)"}.  This
8233 may also be a property list with column numbers and formats, for example
8234 @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}.  After
8235 @code{efmt} has been applied to a value, @code{fmt} will also be
8236 applied.
8237 @end table
8239 @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
8240 @subsection Translator functions
8241 @cindex HTML, and orgtbl-mode
8242 @cindex translator function
8244 Orgtbl-mode has several translator functions built-in:
8245 @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and
8246 @code{orgtbl-to-texinfo}.  Except for @code{orgtbl-to-html}@footnote{The
8247 HTML translator uses the same code that produces tables during HTML
8248 export.}, these all use a generic translator, @code{orgtbl-to-generic}.
8249 For example, @code{orgtbl-to-latex} itself is a very short function that
8250 computes the column definitions for the @code{tabular} environment,
8251 defines a few field and line separators and then hands over to the
8252 generic translator.  Here is the entire code:
8254 @lisp
8255 @group
8256 (defun orgtbl-to-latex (table params)
8257   "Convert the orgtbl-mode TABLE to LaTeX."
8258   (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
8259                                org-table-last-alignment ""))
8260          (params2
8261           (list
8262            :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
8263            :tend "\\end@{tabular@}"
8264            :lstart "" :lend " \\\\" :sep " & "
8265            :efmt "%s\\,(%s)" :hline "\\hline")))
8266     (orgtbl-to-generic table (org-combine-plists params2 params))))
8267 @end group
8268 @end lisp
8270 As you can see, the properties passed into the function (variable
8271 @var{PARAMS}) are combined with the ones newly defined in the function
8272 (variable @var{PARAMS2}).  The ones passed into the function (i.e. the
8273 ones set by the @samp{ORGTBL SEND} line) take precedence.  So if you
8274 would like to use the La@TeX{} translator, but wanted the line endings to
8275 be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
8276 overrule the default with
8278 @example
8279 #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
8280 @end example
8282 For a new language, you can either write your own converter function in
8283 analogy with the La@TeX{} translator, or you can use the generic function
8284 directly.  For example, if you have a language where a table is started
8285 with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
8286 started with @samp{!BL!}, ended with @samp{!EL!} and where the field
8287 separator is a TAB, you could call the generic translator like this (on
8288 a single line!):
8290 @example
8291 #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
8292                               :lstart "!BL! " :lend " !EL!" :sep "\t"
8293 @end example
8295 @noindent
8296 Please check the documentation string of the function
8297 @code{orgtbl-to-generic} for a full list of parameters understood by
8298 that function and remember that you can pass each of them into
8299 @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
8300 using the generic function.
8302 Of course you can also write a completely new function doing complicated
8303 things the generic translator cannot do.  A translator function takes
8304 two arguments.  The first argument is the table, a list of lines, each
8305 line either the symbol @code{hline} or a list of fields.  The second
8306 argument is the property list containing all parameters specified in the
8307 @samp{#+ORGTBL: SEND} line.  The function must return a single string
8308 containing the formatted table.  If you write a generally useful
8309 translator, please post it on @code{emacs-orgmode@@gnu.org} so that
8310 others can benefit from your work.
8312 @node  Radio lists,  , Translator functions, Tables in arbitrary syntax
8313 @subsection Radio lists
8314 @cindex radio lists
8315 @cindex org-list-insert-radio-list
8317 Sending and receiving radio lists works exactly the same way than
8318 sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
8319 need to load the @code{org-export-latex.el} package to use radio lists
8320 since the relevant code is there for now.}.  As for radio tables, you
8321 can insert radio lists templates in HTML, La@TeX{} and TeXInfo modes by
8322 calling @code{org-list-insert-radio-list}.
8324 Here are the differences with radio tables:
8326 @itemize @minus
8327 @item
8328 Use @code{ORGLST} instead of @code{ORGTBL}.
8329 @item
8330 The available translation functions for radio lists don't take
8331 parameters.
8332 @item 
8333 `C-c C-c' will work when pressed on the first item of the list.
8334 @end itemize
8336 Here is a La@TeX{} example.  Let's say that you have this in your
8337 La@TeX{} file:
8339 @example
8340 % BEGIN RECEIVE ORGLST to-buy
8341 % END RECEIVE ORGLST to-buy
8342 \begin@{comment@}
8343 #+ORGLIST: SEND to-buy orgtbl-to-latex
8344 - a new house
8345 - a new computer
8346   + a new keyboard
8347   + a new mouse
8348 - a new life
8349 \end@{comment@}
8350 @end example
8352 Pressing `C-c C-c' on @code{a new house} and will insert the converted
8353 La@TeX{} list between the two marker lines.
8355 @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Extensions and Hacking
8356 @section Dynamic blocks
8357 @cindex dynamic blocks
8359 Org-mode documents can contain @emph{dynamic blocks}.  These are
8360 specially marked regions that are updated by some user-written function.
8361 A good example for such a block is the clock table inserted by the
8362 command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
8364 Dynamic block are enclosed by a BEGIN-END structure that assigns a name
8365 to the block and can also specify parameters for the function producing
8366 the content of the block.
8368 @example
8369 #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
8371 #+END:
8372 @end example
8374 Dynamic blocks are updated with the following commands
8376 @table @kbd
8377 @kindex C-c C-x C-u
8378 @item C-c C-x C-u
8379 Update dynamic block at point.
8380 @kindex C-u C-c C-x C-u
8381 @item C-u C-c C-x C-u
8382 Update all dynamic blocks in the current file.
8383 @end table
8385 Updating a dynamic block means to remove all the text between BEGIN and
8386 END, parse the BEGIN line for parameters and then call the specific
8387 writer function for this block to insert the new content.  For a block
8388 with name @code{myblock}, the writer function is
8389 @code{org-dblock-write:myblock} with as only parameter a property list
8390 with the parameters given in the begin line.  Here is a trivial example
8391 of a block that keeps track of when the block update function was last
8392 run:
8394 @example
8395 #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
8397 #+END:
8398 @end example
8400 @noindent
8401 The corresponding block writer function could look like this:
8403 @lisp
8404 (defun org-dblock-write:block-update-time (params)
8405    (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
8406      (insert "Last block update at: "
8407              (format-time-string fmt (current-time)))))
8408 @end lisp
8410 If you want to make sure that all dynamic blocks are always up-to-date,
8411 you could add the function @code{org-update-all-dblocks} to a hook, for
8412 example @code{before-save-hook}.  @code{org-update-all-dblocks} is
8413 written in a way that is does nothing in buffers that are not in Org-mode.
8415 @node Special agenda views, Using the property API, Dynamic blocks, Extensions and Hacking
8416 @section Special Agenda Views
8417 @cindex agenda views, user-defined
8419 Org-mode provides a special hook that can be used to narrow down the
8420 selection made by any of the agenda views.  You may specify a function
8421 that is used at each match to verify if the match should indeed be part
8422 of the agenda view, and if not, how much should be skipped.
8424 Let's say you want to produce a list of projects that contain a WAITING
8425 tag anywhere in the project tree.  Let's further assume that you have
8426 marked all tree headings that define a project with the todo keyword
8427 PROJECT.  In this case you would run a todo search for the keyword
8428 PROJECT, but skip the match unless there is a WAITING tag anywhere in
8429 the subtree belonging to the project line.
8431 To achieve this, you must write a function that searches the subtree for
8432 the tag.  If the tag is found, the function must return @code{nil} to
8433 indicate that this match should not be skipped.  If there is no such
8434 tag, return the location of the end of the subtree, to indicate that
8435 search should continue from there.
8437 @lisp
8438 (defun my-skip-unless-waiting ()
8439   "Skip trees that are not waiting"
8440   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
8441     (if (re-search-forward ":waiting:" subtree-end t)
8442         nil          ; tag found, do not skip
8443       subtree-end))) ; tag not found, continue after end of subtree
8444 @end lisp
8446 Now you may use this function in an agenda custom command, for example
8447 like this:
8449 @lisp
8450 (org-add-agenda-custom-command
8451  '("b" todo "PROJECT"
8452    ((org-agenda-skip-function 'my-org-waiting-projects)
8453     (org-agenda-overriding-header "Projects waiting for something: "))))
8454 @end lisp
8456 Note that this also binds @code{org-agenda-overriding-header} to get a
8457 meaningful header in the agenda view.
8459 You may also put a Lisp form into @code{org-agenda-skip-function}.  In
8460 particular, you may use the functions @code{org-agenda-skip-entry-if}
8461 and @code{org-agenda-skip-subtree-if} in this form, for example:
8463 @table @code
8464 @item '(org-agenda-skip-entry-if 'scheduled)
8465 Skip current entry if it has been scheduled.
8466 @item '(org-agenda-skip-entry-if 'notscheduled)
8467 Skip current entry if it has not been scheduled.
8468 @item '(org-agenda-skip-entry-if 'deadline)
8469 Skip current entry if it has a deadline.
8470 @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
8471 Skip current entry if it has a deadline, or if it is scheduled.
8472 @item '(org-agenda-skip-entry 'regexp "regular expression")
8473 Skip current entry if the regular expression matches in the entry.
8474 @item '(org-agenda-skip-entry 'notregexp "regular expression")
8475 Skip current entry unless the regular expression matches.
8476 @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
8477 Same as above, but check and skip the entire subtree.
8478 @end table
8480 Therefore we could also have written the search for WAITING projects
8481 like this, even without defining a special function:
8483 @lisp
8484 (org-add-agenda-custom-command
8485  '("b" todo "PROJECT"
8486    ((org-agenda-skip-function '(org-agenda-skip-subtree-if
8487                                 'regexp ":waiting:"))
8488     (org-agenda-overriding-header "Projects waiting for something: "))))
8489 @end lisp
8492 @node Using the property API,  , Special agenda views, Extensions and Hacking
8493 @section Using the property API
8494 @cindex API, for properties
8495 @cindex properties, API
8497 Here is a description of the functions that can be used to work with
8498 properties.
8500 @defun org-entry-properties &optional pom which
8501 Get all properties of the entry at point-or-marker POM.
8502 This includes the TODO keyword, the tags, time strings for deadline,
8503 scheduled, and clocking, and any additional properties defined in the
8504 entry.  The return value is an alist, keys may occur multiple times
8505 if the property key was used several times.
8506 POM may also be nil, in which case the current entry is used.
8507 If WHICH is nil or `all', get all properties.  If WHICH is
8508 `special' or `standard', only get that subclass.
8509 @end defun
8510 @defun org-entry-get pom property &optional inherit
8511 Get value of PROPERTY for entry at point-or-marker POM.
8512 If INHERIT is non-nil and the entry does not have the property,
8513 then also check higher levels of the hierarchy.  This function ignores
8514 the value of @code{org-use-property-inheritance} and requires the
8515 explicit INHERIT flag.
8516 @end defun
8518 @defun org-entry-delete pom property
8519 Delete the property PROPERTY from entry at point-or-marker POM.
8520 @end defun
8522 @defun org-entry-put pom property value
8523 Set PROPERTY to VALUE for entry at point-or-marker POM.
8524 @end defun
8526 @defun org-buffer-property-keys &optional include-specials
8527 Get all property keys in the current buffer.
8528 @end defun
8530 @defun org-insert-property-drawer
8531 Insert a property drawer at point.
8532 @end defun
8534 @node History and Acknowledgments, Main Index, Extensions and Hacking, Top
8535 @appendix History and Acknowledgments
8536 @cindex acknowledgments
8537 @cindex history
8538 @cindex thanks
8540 Org-mode was borne in 2003, out of frustration over the user interface
8541 of the Emacs outline-mode.  I was trying to organize my notes and
8542 projects, and using Emacs seemed to be the natural way to go.  However,
8543 having to remember eleven different commands with two or three keys per
8544 command, only to hide and unhide parts of the outline tree, that seemed
8545 entirely unacceptable to me.  Also, when using outlines to take notes, I
8546 constantly want to restructure the tree, organizing it parallel to my
8547 thoughts and plans.  @emph{Visibility cycling} and @emph{structure
8548 editing} were originally implemented in the package
8549 @file{outline-magic.el}, but quickly moved to the more general
8550 @file{org.el}.  As this environment became comfortable for project
8551 planning, the next step was adding @emph{TODO entries}, basic @emph{time
8552 stamps}, and @emph{table support}.  These areas highlight the two main
8553 goals that Org-mode still has today: To create a new, outline-based,
8554 plain text mode with innovative and intuitive editing features, and to
8555 incorporate project planning functionality directly into a notes file.
8557 Since the first release, literally thousands of emails to me or on
8558 @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
8559 reports, feedback, new ideas, and sometimes patches and add-on code.
8560 Many thanks to everyone who has helped to improve this package.  I am
8561 trying to keep here a list of the people who had significant influence
8562 in shaping one or more aspects of Org-mode.  The list may not be
8563 complete, if I have forgotten someone, please accept my apologies and
8564 let me know.
8566 @itemize @bullet
8568 @item
8569 @i{Russel Adams} came up with the idea for drawers.
8570 @item
8571 @i{Thomas Baumann} contributed the code for links to the MH-E email
8572 system.
8573 @item
8574 @i{Alex Bochannek} provided a patch for rounding time stamps.
8575 @item
8576 @i{Charles Cave}'s suggestion sparked the implementation of templates
8577 for Remember.
8578 @item
8579 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
8580 specified time.
8581 @item
8582 @i{Gregory Chernov} patched support for lisp forms into table
8583 calculations and improved XEmacs compatibility, in particular by porting
8584 @file{nouline.el} to XEmacs.
8585 @item
8586 @i{Sacha Chua} suggested to copy some linking code from Planner.
8587 @item
8588 @i{Eddward DeVilla} proposed and tested checkbox statistics.  He also
8589 came up with the idea of properties, and that there should be an API for
8590 them.
8591 @item
8592 @i{Kees Dullemond} used to edit projects lists directly in HTML and so
8593 inspired some of the early development, including HTML export.  He also
8594 asked for a way to narrow wide table columns.
8595 @item
8596 @i{Christian Egli} converted the documentation into TeXInfo format,
8597 patched CSS formatting into the HTML exporter, and inspired the agenda.
8598 @item
8599 @i{David Emery} provided a patch for custom CSS support in exported
8600 HTML agendas.
8601 @item
8602 @i{Nic Ferrier} contributed mailcap and XOXO support.
8603 @item
8604 @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
8605 @item
8606 @i{John Foerch} figured out how to make incremental search show context
8607 around a match in a hidden outline tree.
8608 @item
8609 @i{Niels Giesen} had the idea to automatically archive DONE trees.
8610 @item
8611 @i{Bastien Guerry} wrote the La@TeX{} exporter and has been prolific
8612 with patches, ideas, and bug reports.
8613 @item
8614 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
8615 @item
8616 @i{Scott Jaderholm} proposed footnotes, control over whitespace between
8617 folded entries, and column view for properties.
8618 @item
8619 @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it.  He also
8620 provided frequent feedback and some patches.
8621 @item
8622 @i{Jason F. McBrayer} suggested agenda export to CSV format.
8623 @item
8624 @i{Max Mikhanosha} came up with the idea of refiling.
8625 @item
8626 @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
8627 basis.
8628 @item
8629 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
8630 happy.
8631 @item
8632 @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file
8633 and to be able to quickly restrict the agenda to a subtree.
8634 @item
8635 @i{Todd Neal} provided patches for links to Info files and elisp forms.
8636 @item
8637 @i{Tim O'Callaghan} suggested in-file links, search options for general
8638 file links, and TAGS.
8639 @item
8640 @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
8641 into Japanese.
8642 @item
8643 @i{Oliver Oppitz} suggested multi-state TODO items.
8644 @item
8645 @i{Scott Otterson} sparked the introduction of descriptive text for
8646 links, among other things.
8647 @item
8648 @i{Pete Phillips} helped during the development of the TAGS feature, and
8649 provided frequent feedback.
8650 @item
8651 @i{T.V. Raman} reported bugs and suggested improvements.
8652 @item
8653 @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
8654 control.
8655 @item
8656 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
8657 @item
8658 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
8659 conflict with @file{allout.el}.
8660 @item
8661 @i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords.
8662 @item
8663 @i{Philip Rooke} created the Org-mode reference card and provided lots
8664 of feedback.
8665 @item
8666 @i{Christian Schlauer} proposed angular brackets around links, among
8667 other things.
8668 @item
8669 Linking to VM/BBDB/GNUS was inspired by @i{Tom Shannon}'s
8670 @file{organizer-mode.el}.
8671 @item
8672 @i{Daniel Sinder} came up with the idea of internal archiving by locking
8673 subtrees.
8674 @item
8675 @i{Dale Smith} proposed link abbreviations.
8676 @item
8677 @i{Adam Spiers} asked for global linking commands and inspired the link
8678 extension system.  support mairix.
8679 @item
8680 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
8681 chapter about publishing.
8682 @item
8683 @i{J@"urgen Vollmer} contributed code generating the table of contents
8684 in HTML output.
8685 @item
8686 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
8687 keyword.
8688 @item
8689 @i{David Wainberg} suggested archiving, and improvements to the linking
8690 system.
8691 @item
8692 @i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}.  The
8693 development of Org-mode was fully independent, and both systems are
8694 really different beasts in their basic ideas and implementation details.
8695 I later looked at John's code, however, and learned from his
8696 implementation of (i) links where the link itself is hidden and only a
8697 description is shown, and (ii) popping up a calendar to select a date.
8698 John has also contributed a number of great ideas directly to Org-mode.
8699 @item
8700 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
8701 linking to GNUS.
8702 @item
8703 @i{Roland Winkler} requested additional keybindings to make Org-mode
8704 work on a tty.
8705 @item
8706 @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
8707 and contributed various ideas and code snippets.
8708 @end itemize
8711 @node Main Index, Key Index, History and Acknowledgments, Top
8712 @unnumbered The Main Index
8714 @printindex cp
8716 @node Key Index,  , Main Index, Top
8717 @unnumbered Key Index
8719 @printindex ky
8721 @bye
8723 @ignore
8724    arch-tag: 7893d1fe-cc57-4d13-b5e5-f494a1bcc7ac
8725 @end ignore