Release 4.72
[org-mode.git] / org.texi
blob9b2b84d7f2c1aa54751407396759c490475070e9
1 \input texinfo
2 @c %**start of header
3 @setfilename ../info/org
4 @settitle Org Mode Manual
6 @set VERSION 4.72
7 @set DATE April 2007
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://www.astro.uva.nl/~dominik/Tools/org/,maintainers webpage}
16 @set AUTHOR Carsten Dominik
17 @set MAINTAINER Carsten Dominik
18 @set MAINTAINEREMAIL @email{dominik at science dot uva dot nl}
19 @set MAINTAINERCONTACT @uref{mailto:dominik at science dot uva dot nl,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 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 * Timestamps::                  Assign date and time to items
84 * Tags::                        Tagging headlines and matching sets of tags
85 * Agenda views::                Collecting information into views
86 * Embedded LaTeX::              LaTeX fragments and formulas
87 * Exporting::                   Sharing and publishing of notes
88 * Publishing::                  Create a web site of linked Org-mode files
89 * Miscellaneous::               All the rest which did not fit elsewhere
90 * Extensions and Hacking::      It is possible to write add-on code
91 * History and Acknowledgments::  How Org-mode came into being 
92 * Index::                       The fast road to specific information
93 * Key Index::                   Key bindings and where they are described
95 @detailmenu
96  --- The Detailed Node Listing ---
98 Introduction
100 * Summary::                     Brief summary of what Org-mode does
101 * Installation::                How to install a downloaded version of Org-mode
102 * Activation::                  How to activate Org-mode for certain buffers.
103 * Feedback::                    Bug reports, ideas, patches etc.
105 Document Structure
107 * Outlines::                    Org-mode is based on outline-mode
108 * Headlines::                   How to typeset org-tree headlines
109 * Visibility cycling::          Show and hide, much simplified
110 * Motion::                      Jumping to other headlines
111 * Structure editing::           Changing sequence and level of headlines
112 * Archiving::                   Move done task trees to a different place
113 * Sparse trees::                Matches embedded in context
114 * Plain lists::                 Additional structure within an entry
116 Archiving
118 * ARCHIVE tag::                 Marking a tree as inactive
119 * Moving subtrees::             Moving a tree to an archive file
121 Tables
123 * Built-in table editor::       Simple tables
124 * Narrow columns::              Stop wasting space in tables   
125 * orgtbl-mode::                 The table editor as minor mode
126 * The spreadsheet::             The table editor has spreadsheet capabilities.
128 The spreadsheet
130 * References::                  How to refer to another field or range
131 * Formula syntax for Calc::     Using Calc to compute stuff
132 * Formula syntax for Lisp::     Writing formulas in Emacs Lisp
133 * Field formulas::              Formulas valid for a single field
134 * Column formulas::             Formulas valid for an entire column
135 * Editing and debugging formulas::  Fixing formulas
136 * Updating the table::          Recomputing all dependent fields
137 * Advanced features::           Field names, parameters and automatic recalc
139 Hyperlinks
141 * Link format::                 How links in Org-mode are formatted
142 * Internal links::              Links to other places in the current file
143 * External links::              URL-like links to the world
144 * Handling links::              Creating, inserting and following
145 * Link abbreviations::          Shortcuts for writing complex links
146 * Search options::              Linking to a specific location
147 * Custom searches::             When the default search is not enough
148 * Remember::                    Org-trees store quick notes
150 Internal links
152 * Radio targets::               Make targets trigger links in plain text.
154 Remember
156 * Setting up remember::         Some code for .emacs to get things going
157 * Remember templates::          Define the outline of different note types
158 * Storing notes::               Directly get the note to where it belongs
160 TODO items
162 * TODO basics::                 Marking and displaying TODO entries
163 * TODO extensions::             Workflow and assignments
164 * Priorities::                  Some things are more important than others
165 * Breaking down tasks::         Splitting a task into manageable pieces
166 * Checkboxes::                  Tick-off lists
168 Extended use of TODO keywords
170 * Workflow states::             From TODO to DONE in steps
171 * TODO types::                  I do this, Fred the rest
172 * Multiple sets in one file::   Mixing it all, and still finding your way
173 * Per file keywords::           Different files, different requirements
175 Timestamps
177 * Time stamps::                 Assigning a time to a tree entry
178 * Creating timestamps::         Commands which insert timestamps
179 * Custom time format::          If you cannot work with the ISO format
180 * Repeating items::             Deadlines that come back again and again
181 * Progress logging::            Documenting when what work was done.
183 Creating timestamps
185 * The date/time prompt::        How org-mode helps you entering date and time
187 Progress Logging
189 * Closing items::               When was this entry marked DONE?
190 * Tracking TODO state changes::  When did the status change?
191 * Clocking work time::          When exactly did you work on this item?
193 Tags
195 * Tag inheritance::             Tags use the tree structure of the outline
196 * Setting tags::                How to assign tags to a headline
197 * Tag searches::                Searching for combinations of tags
199 Agenda Views
201 * Agenda files::                Files being searched for agenda information
202 * Agenda dispatcher::           Keyboard access to agenda views
203 * Built-in agenda views::       What is available out of the box?
204 * Presentation and sorting::    How agenda items are prepared for display
205 * Agenda commands::             Remote editing of org trees
206 * Custom agenda views::         Defining special searches and views
208 The built-in agenda views
210 * Weekly/Daily agenda::         The calendar page with current tasks
211 * Global TODO list::            All unfinished action items
212 * Matching headline tags::      Structured information with fine-tuned search
213 * Timeline::                    Time-sorted view for single file
214 * Stuck projects::              Find projects you need to review
216 Presentation and sorting
218 * Categories::                  Not all tasks are equal
219 * Time-of-day specifications::  How the agenda knows the time
220 * Sorting of agenda items::     The order of things
222 Custom agenda views
224 * Storing searches::            Type once, use often
225 * Block agenda::                All the stuff you need in a single buffer
226 * Setting Options::             Changing the rules
227 * Batch processing::            Agenda views from the command line
229 Embedded LaTeX
231 * Math symbols::                TeX macros for symbols and Greek letters
232 * Subscripts and Superscripts::  Simple syntax for raising/lowering text
233 * LaTeX fragments::             Complex formulas made easy
234 * Processing LaTeX fragments::  Previewing LaTeX processing
235 * CDLaTeX mode::                Speed up entering of formulas
237 Exporting
239 * ASCII export::                Exporting to plain ASCII
240 * HTML export::                 Exporting to HTML
241 * XOXO export::                 Exporting to XOXO
242 * iCalendar export::            Exporting in iCalendar format
243 * Text interpretation::         How the exporter looks at the file
245 HTML export
247 * Export commands::             How to invoke HTML export
248 * Quoting HTML tags::           Using direct HTML in Org-mode
249 * Links::                       How hyperlinks get transferred to HTML
250 * Images::                      To inline or not to inline?
251 * CSS support::                 Style specifications
253 Text interpretation by the exporter
255 * Comment lines::               Some lines will not be exported
256 * Initial text::                Text before the first headline
257 * Enhancing text::              Subscripts, symbols and more
258 * Export options::              How to influence the export settings
260 Publishing
262 * Configuration::               Defining projects
263 * Sample configuration::        Example projects
264 * Triggering publication::      Publication commands
266 Configuration
268 * Project alist::               The central configuration variable
269 * Sources and destinations::    From here to there
270 * Selecting files::             What files are part of the project?
271 * Publishing action::           Setting the function doing the publishing
272 * Publishing options::          Tweaking HTML export
273 * Publishing links::            Which links keep working after publishing?
274 * Project page index::          Publishing a list of project files
276 Sample configuration
278 * Simple example::              One-component publishing
279 * Complex example::             A multi-component publishing example
281 Miscellaneous
283 * Completion::                  M-TAB knows what you need
284 * Customization::               Adapting Org-mode to your taste
285 * In-buffer settings::          Overview of the #+KEYWORDS
286 * The very busy C-c C-c key::   When in doubt, press C-c C-c
287 * Clean view::                  Getting rid of leading stars in the outline
288 * TTY keys::                    Using Org-mode on a tty
289 * Interaction::                 Other Emacs packages
290 * Bugs::                        Things which do not work perfectly
292 Interaction with other packages
294 * Cooperation::                 Packages Org-mode cooperates with
295 * Conflicts::                   Packages that lead to conflicts
297 Extensions, Hooks and Hacking
299 * Extensions::                  Existing 3rd-part extensions
300 * Tables in arbitrary syntax::  Orgtbl for LaTeX and other programs
301 * Dynamic blocks::              Automatically filled blocks
302 * Special agenda views::        Customized views
304 Tables in arbitrary syntax
306 * Radio tables::                Sending and receiving
307 * A LaTeX example::             Step by step, almost a tutorial
308 * Translator functions::        Copy and modify
310 @end detailmenu
311 @end menu
313 @node Introduction, Document structure, Top, Top
314 @chapter Introduction
315 @cindex introduction
317 @menu
318 * Summary::                     Brief summary of what Org-mode does
319 * Installation::                How to install a downloaded version of Org-mode
320 * Activation::                  How to activate Org-mode for certain buffers.
321 * Feedback::                    Bug reports, ideas, patches etc.
322 @end menu
324 @node Summary, Installation, Introduction, Introduction
325 @section Summary
326 @cindex summary
328 Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
329 project planning with a fast and effective plain-text system.
331 Org-mode develops organizational tasks around NOTES files that contain
332 lists or information about projects as plain text.  Org-mode is
333 implemented on top of outline-mode, which makes it possible to keep the
334 content of large files well structured.  Visibility cycling and
335 structure editing help to work with the tree.  Tables are easily created
336 with a built-in table editor.  Org-mode supports ToDo items, deadlines,
337 time stamps, and scheduling.  It dynamically compiles entries into an
338 agenda that utilizes and smoothly integrates much of the Emacs calendar
339 and diary.  Plain text URL-like links connect to websites, emails,
340 Usenet messages, BBDB entries, and any files related to the projects.
341 For printing and sharing of notes, an Org-mode file can be exported as a
342 structured ASCII file, as HTML, or (todo and agenda items only) as an
343 iCalendar file.  It can also serve as a publishing tool for a set of
344 linked webpages.
346 An important design aspect that distinguishes Org-mode from for example
347 Planner/Muse is that it encourages to store every piece of information
348 only once.  In Planner, you have project pages, day pages and possibly
349 other files, duplicating some information such as tasks.  In Org-mode,
350 you only have notes files.  In your notes you mark entries as tasks,
351 label them with tags and timestamps.  All necessary lists like a
352 schedule for the day, the agenda for a meeting, tasks lists selected by
353 tags etc are created dynamically when you need them.
355 Org-mode keeps simple things simple.  When first fired up, it should
356 feel like a straightforward, easy to use outliner.  Complexity is not
357 imposed, but a large amount of functionality is available when you need
358 it.  Org-mode can be used on different levels and in different ways, for
359 example as:
361 @example
362 @r{@bullet{} outline extension with visibility cycling and structure editing}
363 @r{@bullet{} ASCII system and table editor for taking structured notes}
364 @r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
365 @r{@bullet{} TODO list editor}
366 @r{@bullet{} full agenda and planner with deadlines and work scheduling}
367 @r{@bullet{} environment to implement David Allen's GTD system}
368 @r{@bullet{} simple hypertext system, with HTML export}
369 @r{@bullet{} publishing tool to create a set of interlinked webpages}
370 @end example
372 Org-mode's automatic, context sensitive table editor with spreadsheet
373 capabilities can be integrated into any major mode by activating the
374 minor Orgtbl-mode.  Using a translation step, it can be used to maintain
375 tables in arbitrary file types, for example in LaTeX.
377 @cindex FAQ
378 There is a website for Org-mode which provides links to the newest
379 version of Org-mode, as well as additional information, frequently asked
380 questions (FAQ), links to tutorials etc.  This page is located at
381 @uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
383 @page
386 @node Installation, Activation, Summary, Introduction
387 @section Installation
388 @cindex installation
389 @cindex XEmacs
391 @b{Important:} @i{If Org-mode is part of the Emacs distribution or an
392 XEmacs package, please skip this section and go directly to
393 @ref{Activation}.}
395 If you have downloaded Org-mode from the Web, you must take the
396 following steps to install it: Go into the Org-mode distribution
397 directory and edit the top section of the file @file{Makefile}.  You
398 must set the name of the Emacs binary (likely either @file{emacs} or
399 @file{xemacs}), and the paths to the directories where local Lisp and
400 Info files are kept.  If you don't have access to the system-wide
401 directories, create your own two directories for these files, enter them
402 into the Makefile, and make sure Emacs finds the Lisp files by adding
403 the following line to @file{.emacs}:
405 @example
406 (setq load-path (cons "~/path/to/lispdir" load-path))
407 @end example
409 @b{XEmacs users now need to install the file @file{noutline.el} from
410 the @file{xemacs} subdirectory of the Org-mode distribution.  Use the
411 command:}
413 @example
414 @b{make install-noutline}
415 @end example
417 @noindent Now byte-compile and install the Lisp files with the shell
418 commands:
420 @example
421 make
422 make install
423 @end example
425 @noindent If you want to install the info documentation, use this command:
427 @example
428 make install-info
429 @end example
431 @noindent Then add to @file{.emacs}:
433 @lisp
434 ;; This line only if org-mode is not part of the X/Emacs distribution.
435 (require 'org-install)
436 @end lisp
438 @node Activation, Feedback, Installation, Introduction
439 @section Activation
440 @cindex activation
441 @cindex autoload
442 @cindex global keybindings
443 @cindex keybindings, global
445 @iftex
446 @b{Important:} @i{If you use copy-and-paste to copy lisp code from the
447 PDF documentation to your .emacs file, the single quote character comes
448 out incorrectly and the code will not work.  You need to fix the single
449 quotes by hand, or copy from Info documentation.}
450 @end iftex
452 Add the following lines to your @file{.emacs} file.  The last two lines
453 define @emph{global} keys for the commands @command{org-store-link} and
454 @command{org-agenda} - please choose suitable keys yourself.
456 @lisp
457 ;; The following lines are always needed.  Choose your own keys.
458 (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
459 (define-key global-map "\C-cl" 'org-store-link)
460 (define-key global-map "\C-ca" 'org-agenda)
461 @end lisp
463 Furthermore, you must activate @code{font-lock-mode} in org-mode
464 buffers, because significant functionality depends on font-locking being
465 active.  You can do this with either one of the following two lines
466 (XEmacs user must use the second option):
467 @lisp
468 (global-font-lock-mode 1)                     ; for all buffers
469 (add-hook 'org-mode-hook 'turn-on-font-lock)  ; org-mode buffers only
470 @end lisp
472 @cindex org-mode, turning on
473 With this setup, all files with extension @samp{.org} will be put
474 into Org-mode.  As an alternative, make the first line of a file look
475 like this:
477 @example
478 MY PROJECTS    -*- mode: org; -*-
479 @end example
481 @noindent which will select Org-mode for this buffer no matter what
482 the file's name is.  See also the variable
483 @code{org-insert-mode-line-in-empty-file}.
485 @node Feedback,  , Activation, Introduction
486 @section Feedback
487 @cindex feedback
488 @cindex bug reports
489 @cindex maintainer
490 @cindex author
492 If you find problems with Org-mode, or if you have questions, remarks,
493 or ideas about it, please contact the maintainer @value{MAINTAINER} at
494 @value{MAINTAINEREMAIL}.
496 For bug reports, please provide as much information as possible,
497 including the version information of Emacs (@kbd{C-h v emacs-version
498 @key{RET}}) and Org-mode (@kbd{C-h v org-version @key{RET}}), as well as
499 the Org-mode related setup in @file{.emacs}.  If an error occurs, a
500 backtrace can be very useful (see below on how to create one).  Often a
501 small example file helps, along with clear information about:
503 @enumerate
504 @item What exactly did you do?
505 @item What did you expect to happen?
506 @item What happened instead?
507 @end enumerate
508 @noindent Thank you for helping to improve this mode.
510 @subsubheading How to create a useful backtrace
512 @cindex backtrace of an error
513 If working with Org-mode produces an error with a message you don't
514 understand, you may have hit a bug.  The best way to report this is by
515 providing, in addition to what was mentioned above, a @emph{Backtrace}.
516 This is information from the built-in debugger about where and how the
517 error occurred.  Here is how to produce a useful backtrace:
519 @enumerate
520 @item
521 Start a fresh Emacs or XEmacs, and make sure that it will load the
522 original Lisp code in @file{org.el} instead of the compiled version in
523 @file{org.elc}.  The backtrace contains much more information if it is
524 produced with uncompiled code.  To do this, either rename @file{org.elc}
525 to something else before starting Emacs, or ask Emacs explicitly to load
526 @file{org.el} by using the command line
527 @example
528 emacs -l /path/to/org.el
529 @end example
530 @item
531 Go to the @code{Options} menu and select @code{Enter Debugger on Error}
532 (XEmacs has this option in the @code{Troubleshooting} sub-menu).
533 @item
534 Do whatever you have to do to hit the error.  Don't forget to
535 document the steps you take.
536 @item
537 When you hit the error, a @file{*Backtrace*} buffer will appear on the
538 screen.  Save this buffer to a file (for example using @kbd{C-x C-w}) and
539 attach it to your bug report.
540 @end enumerate
542 @node Document structure, Tables, Introduction, Top
543 @chapter Document Structure
544 @cindex document structure
545 @cindex structure of document
547 Org-mode is based on outline mode and provides flexible commands to
548 edit the structure of the document.
550 @menu
551 * Outlines::                    Org-mode is based on outline-mode
552 * Headlines::                   How to typeset org-tree headlines
553 * Visibility cycling::          Show and hide, much simplified
554 * Motion::                      Jumping to other headlines
555 * Structure editing::           Changing sequence and level of headlines
556 * Archiving::                   Move done task trees to a different place
557 * Sparse trees::                Matches embedded in context
558 * Plain lists::                 Additional structure within an entry
559 @end menu
561 @node Outlines, Headlines, Document structure, Document structure
562 @section Outlines
563 @cindex outlines
564 @cindex outline-mode
566 Org-mode is implemented on top of outline-mode.  Outlines allow to
567 organize a document in a hierarchical structure, which (at least for
568 me) is the best representation of notes and thoughts.  Overview over
569 this structure is achieved by folding (hiding) large parts of the
570 document to show only the general document structure and the parts
571 currently being worked on.  Org-mode greatly simplifies the use of
572 outlines by compressing the entire show/hide functionality into a
573 single command @command{org-cycle}, which is bound to the @key{TAB}
574 key.
576 @node Headlines, Visibility cycling, Outlines, Document structure
577 @section Headlines
578 @cindex headlines
579 @cindex outline tree
581 Headlines define the structure of an outline tree.  The headlines in
582 Org-mode start with one or more stars, on the left margin@footnote{See
583 the variable @code{org-special-ctrl-a} to configure special behavior of
584 @kbd{C-a} in headlines.}.  For example:
586 @example
587 * Top level headline
588 ** Second level
589 *** 3rd level
590     some text
591 *** 3rd level
592     more text
594 * Another top level headline
595 @end example
597 @noindent Some people find the many stars too noisy and would prefer an
598 outline that has whitespace followed by a single star as headline
599 starters.  @ref{Clean view} describes a setup to realize this.
601 An empty line after the end of a subtree is considered part of it and
602 will be hidden when the subtree is folded.  However, if you leave at
603 least two empty lines, one empty line will remain visible after folding
604 the subtree, in order to structure the collapsed view.  See the
605 variable @code{org-cycle-separator-lines} for modifying this behavior.
607 @node Visibility cycling, Motion, Headlines, Document structure
608 @section Visibility cycling
609 @cindex cycling, visibility
610 @cindex visibility cycling
611 @cindex trees, visibility
612 @cindex show hidden text
613 @cindex hide text
615 Outlines make it possible to hide parts of the text in the buffer.
616 Org-mode uses just two commands, bound to @key{TAB} and
617 @kbd{S-@key{TAB}} to change the visibility in the buffer.
619 @cindex subtree visibility states
620 @cindex subtree cycling
621 @cindex folded, subtree visibility state
622 @cindex children, subtree visibility state
623 @cindex subtree, subtree visibility state
624 @table @kbd
625 @kindex @key{TAB}
626 @item @key{TAB}
627 @emph{Subtree cycling}: Rotate current subtree between the states
629 @example
630 ,-> FOLDED -> CHILDREN -> SUBTREE --.
631 '-----------------------------------'
632 @end example
634 The cursor must be on a headline for this to work@footnote{see, however,
635 the option @code{org-cycle-emulate-tab}.}.  When the cursor is at the
636 beginning of the buffer and the first line is not a headline, then
637 @key{TAB} actually runs global cycling (see below)@footnote{see the
638 option @code{org-cycle-global-at-bob}.}.  Also when called with a prefix
639 argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
641 @cindex global visibility states
642 @cindex global cycling
643 @cindex overview, global visibility state
644 @cindex contents, global visibility state
645 @cindex show all, global visibility state
646 @kindex S-@key{TAB}
647 @item S-@key{TAB}
648 @itemx C-u @key{TAB}
649 @emph{Global cycling}: Rotate the entire buffer between the states
651 @example
652 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
653 '--------------------------------------'
654 @end example
656 When @kbd{S-@key{TAB}} is called with a numerical prefix N, the CONTENTS
657 view up to headlines of level N will be shown.
658 Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field.
660 @cindex show all, command
661 @kindex C-c C-a
662 @item C-c C-a
663 Show all.
664 @kindex C-c C-r
665 @item C-c C-r
666 Reveal context around point, showing the current entry, the following
667 heading and the hierarchy above.  Useful for working near a location
668 exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda
669 command (@pxref{Agenda commands}).  With prefix arg show, on each
670 level, all sibling headings.
671 @kindex C-c C-x b
672 @item C-c C-x b
673 Show the current subtree in an indirect buffer@footnote{The indirect
674 buffer
675 @ifinfo
676 (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
677 @end ifinfo
678 @ifnotinfo
679 (see the Emacs manual for more information about indirect buffers)
680 @end ifnotinfo
681 will contain the entire buffer, but will be narrowed to the current
682 tree.  Editing the indirect buffer will also change the original buffer,
683 but without affecting visibility in that buffer.}.  With numerical
684 prefix ARG, go up to this level and then take that tree.  If ARG is
685 negative, go up that many levels.  With @kbd{C-u} prefix, do not remove
686 the previously used indirect buffer.
687 @end table
689 When Emacs first visits an Org-mode file, the global state is set to
690 OVERVIEW, i.e. only the top level headlines are visible.  This can be
691 configured through the variable @code{org-startup-folded}, or on a
692 per-file basis by adding one of the following lines anywhere in the
693 buffer:
695 @example
696 #+STARTUP: overview
697 #+STARTUP: content
698 #+STARTUP: showall
699 @end example
701 @node Motion, Structure editing, Visibility cycling, Document structure
702 @section Motion
703 @cindex motion, between headlines
704 @cindex jumping, to headlines
705 @cindex headline navigation
706 The following commands jump to other headlines in the buffer.
708 @table @kbd
709 @kindex C-c C-n
710 @item C-c C-n
711 Next heading.
712 @kindex C-c C-p
713 @item C-c C-p
714 Previous heading.
715 @kindex C-c C-f
716 @item C-c C-f
717 Next heading same level.
718 @kindex C-c C-b
719 @item C-c C-b
720 Previous heading same level.
721 @kindex C-c C-u
722 @item C-c C-u
723 Backward to higher level heading.
724 @kindex C-c C-j
725 @item C-c C-j
726 Jump to a different place without changing the current outline
727 visibility.  Shows the document structure in a temporary buffer, where
728 you can use the following keys to find your destination:
729 @example
730 @key{TAB}         @r{Cycle visibility.}
731 @key{down} / @key{up}   @r{Next/previous visible headline.}
732 n / p        @r{Next/previous visible headline.}
733 f / b        @r{Next/previous headline same level.}
734 u            @r{One level up.}
735 0-9          @r{Digit argument.}
736 @key{RET}         @r{Select this location.}
737 @end example
738 @end table
740 @node Structure editing, Archiving, Motion, Document structure
741 @section Structure editing
742 @cindex structure editing
743 @cindex headline, promotion and demotion
744 @cindex promotion, of subtrees
745 @cindex demotion, of subtrees
746 @cindex subtree, cut and paste
747 @cindex pasting, of subtrees
748 @cindex cutting, of subtrees
749 @cindex copying, of subtrees
750 @cindex subtrees, cut and paste
752 @table @kbd
753 @kindex M-@key{RET}
754 @item M-@key{RET}
755 Insert new heading with same level as current.  If the cursor is in a
756 plain list item, a new item is created (@pxref{Plain lists}).  To force
757 creation of a new headline, use a prefix arg, or first press @key{RET}
758 to get to the beginning of the next line.  When this command is used in
759 the middle of a line, the line is split and the rest of the line becomes
760 the new headline.  If the command is used at the beginning of a
761 headline, the new headline is created before the current line.  If at
762 the beginning of any other line, the content of that line is made the
763 new heading.  If the command is used at the end of a folded subtree
764 (i.e. behind the ellipses at the end of a headline), then a headline
765 like the current one will be inserted after the end of the subtree.
766 @kindex M-S-@key{RET}
767 @item M-S-@key{RET}
768 Insert new TODO entry with same level as current heading.
769 @kindex M-@key{left}
770 @item M-@key{left}
771 Promote current heading by one level.
772 @kindex M-@key{right}
773 @item M-@key{right}
774 Demote current heading by one level.
775 @kindex M-S-@key{left}
776 @item M-S-@key{left}
777 Promote the current subtree by one level.
778 @kindex M-S-@key{right}
779 @item M-S-@key{right}
780 Demote the current subtree by one level.
781 @kindex M-S-@key{up}
782 @item M-S-@key{up}
783 Move subtree up (swap with previous subtree of same
784 level).
785 @kindex M-S-@key{down}
786 @item M-S-@key{down}
787 Move subtree down (swap with next subtree of same level).
788 @kindex C-c C-x C-w
789 @kindex C-c C-x C-k
790 @item C-c C-x C-w
791 @itemx C-c C-x C-k
792 Kill subtree, i.e. remove it from buffer but save in kill ring.
793 @kindex C-c C-x M-w
794 @item C-c C-x M-w
795 Copy subtree to kill ring.
796 @kindex C-c C-x C-y
797 @item C-c C-x C-y
798 Yank subtree from kill ring.  This does modify the level of the subtree to
799 make sure the tree fits in nicely at the yank position.  The yank
800 level can also be specified with a prefix arg, or by yanking after a
801 headline marker like @samp{****}.
802 @kindex C-c ^
803 @item C-c ^
804 Sort same-level entries.  When there is an active region, all entries in
805 the region will be sorted.  Otherwise the children of the current
806 headline are sorted.  The command prompts for the sorting method, which
807 can be alphabetically, numerically, by time (using the first time stamp
808 in each entry), and each of these in reverse order.  With a @kbd{C-u}
809 prefix, sorting will be case-sensitive.  With two @kbd{C-u C-u}
810 prefixes, duplicate entries will also be removed.
811 @end table
813 @cindex region, active
814 @cindex active region
815 @cindex transient-mark-mode
816 When there is an active region (transient-mark-mode), promotion and
817 demotion work on all headlines in the region.  To select a region of
818 headlines, it is best to place both point and mark at the beginning of a
819 line, mark at the beginning of the first headline, and point at the line
820 just after the last headline to change.  Note that when the cursor is
821 inside a table (@pxref{Tables}), the Meta-Cursor keys have different
822 functionality.
824 @node Archiving, Sparse trees, Structure editing, Document structure
825 @section Archiving
826 @cindex archiving
828 When a project represented by a (sub)tree is finished, you may want
829 to move the tree out of the way and to stop it from contributing to the
830 agenda.  Org-mode knows two ways of archiving.  You can mark a tree with
831 the ARCHIVE tag, or you can move an entire (sub)tree to a different
832 location.
834 @menu
835 * ARCHIVE tag::                 Marking a tree as inactive
836 * Moving subtrees::             Moving a tree to an archive file
837 @end menu
839 @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
840 @subsection The ARCHIVE tag
841 @cindex internal archiving
843 A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
844 its location in the outline tree, but behaves in the following way:
845 @itemize @minus
846 @item
847 It does not open when you attempt to do so with a visibility cycling
848 command (@pxref{Visibility cycling}).  You can force cycling archived
849 subtrees with @kbd{C-@key{TAB}}, or by setting the option
850 @code{org-cycle-open-archived-trees}.  Also normal outline commands like
851 @code{show-all} will open archived subtrees.
852 @item
853 During sparse tree construction (@pxref{Sparse trees}), matches in
854 archived subtrees are not exposed, unless you configure the option
855 @code{org-sparse-tree-open-archived-trees}.
856 @item
857 During agenda view construction (@pxref{Agenda views}), the content of
858 archived trees is ignored unless you configure the option
859 @code{org-agenda-skip-archived-trees}.
860 @item
861 Archived trees are not exported (@pxref{Exporting}), only the headline
862 is.  Configure the details using the variable
863 @code{org-export-with-archived-trees}.
864 @end itemize
866 The following commands help managing the ARCHIVE tag:
868 @table @kbd
869 @kindex C-c C-x C-a
870 @item C-c C-x C-a
871 Toggle the ARCHIVE tag for the current headline.  When the tag is set,
872 the headline changes to a shadowish face, and the subtree below it is
873 hidden.
874 @kindex C-u C-c C-x C-a
875 @item C-u C-c C-x C-a
876 Check if any direct children of the current headline should be archived.
877 To do this, each subtree is checked for open TODO entries.  If none are
878 found, the command offers to set the ARCHIVE tag for the child.  If the
879 cursor is @emph{not} on a headline when this command is invoked, the
880 level 1 trees will be checked.
881 @kindex C-@kbd{TAB}
882 @item C-@kbd{TAB}
883 Cycle a tree even if it is tagged with ARCHIVE.
884 @end table
886 @node Moving subtrees,  , ARCHIVE tag, Archiving
887 @subsection Moving subtrees
888 @cindex external archiving
890 Once an entire project is finished, you may want to move it to a
891 different location, either in the current file, or even in a different
892 file, the archive file.
894 @table @kbd
895 @kindex C-c C-x C-s
896 @item C-c C-x C-s
897 Archive the subtree starting at the cursor position to the location
898 given by @code{org-archive-location}.
899 @kindex C-u C-c C-x C-s
900 @item C-u C-c C-x C-s
901 Check if any direct children of the current headline could be moved to
902 the archive.  To do this, each subtree is checked for open TODO entries.
903 If none are found, the command offers to move it to the archive
904 location.  If the cursor is @emph{not} on a headline when this command
905 is invoked, the level 1 trees will be checked.
906 @end table
908 @cindex archive locations
909 The default archive location is a file in the same directory as the
910 current file, with the name derived by appending @file{_archive} to the
911 current file name.  For information and examples on how to change this,
912 see the documentation string of the variable
913 @code{org-archive-location}.  There is also an in-buffer option for
914 setting this variable, for example
916 @example
917 #+ARCHIVE: %s_done::
918 @end example
920 @noindent
921 You may have several such lines in the buffer, they will then be valid
922 for the entries following the line (the first will also apply to any
923 text before it).
925 @node Sparse trees, Plain lists, Archiving, Document structure
926 @section Sparse trees
927 @cindex sparse trees
928 @cindex trees, sparse
929 @cindex folding, sparse trees
930 @cindex occur, command
932 An important feature of Org-mode is the ability to construct
933 @emph{sparse trees} for selected information in an outline tree.  A
934 sparse tree means that the entire document is folded as much as
935 possible, but the selected information is made visible along with the
936 headline structure above it@footnote{See also the variables
937 @code{org-show-hierarchy-above}, @code{org-show-following-heading}, and
938 @code{org-show-siblings} for detailed control on how much context is
939 shown around each match.}.  Just try it out and you will see immediately
940 how it works.
942 Org-mode contains several commands creating such trees.  The most
943 basic one is @command{org-occur}:
945 @table @kbd
946 @kindex C-c /
947 @item C-c /
948 Occur.  Prompts for a regexp and shows a sparse tree with all matches.
949 If the match is in a headline, the headline is made visible.  If the
950 match is in the body of an entry, headline and body are made visible.
951 In order to provide minimal context, also the full hierarchy of
952 headlines above the match is shown, as well as the headline following
953 the match.  Each match is also highlighted; the highlights disappear
954 when the buffer is changes an editing command, or by pressing @kbd{C-c
955 C-c}.  When called with a @kbd{C-u} prefix argument, previous highlights
956 are kept, so several calls to this command can be stacked.
957 @end table
958 @noindent
959 For frequently used sparse trees of specific search strings, you can
960 use the variable @code{org-agenda-custom-commands} to define fast
961 keyboard access to specific sparse trees.  These commands will then be
962 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
963 For example:
965 @lisp
966 (setq org-agenda-custom-commands
967       '(("f" occur-tree "FIXME")))
968 @end lisp
970 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
971 a sparse tree matching the string @samp{FIXME}.
973 Other commands use sparse trees as well.  For example @kbd{C-c
974 C-v} creates a sparse TODO tree (@pxref{TODO basics}).
976 @kindex C-c C-e v
977 @cindex printing sparse trees
978 @cindex visible text, printing
979 To print a sparse tree, you can use the Emacs command
980 @code{ps-print-buffer-with-faces} which does not print invisible parts
981 of the document @footnote{This does not work under XEmacs, because
982 XEmacs uses selective display for outlining, not text properties.}.
983 Or you can use the command @kbd{C-c C-e v} to export only the visible
984 part of the document and print the resulting file.
986 @node Plain lists,  , Sparse trees, Document structure
987 @section Plain lists
988 @cindex plain lists
989 @cindex lists, plain
990 @cindex lists, ordered
991 @cindex ordered lists
993 Within an entry of the outline tree, hand-formatted lists can provide
994 additional structure.  They also provide a way to create lists of
995 checkboxes (@pxref{Checkboxes}).  Org-mode supports editing such lists,
996 and the HTML exporter (@pxref{Exporting}) does parse and format them.
998 Org-mode knows ordered and unordered lists.  Unordered list items start
999 with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
1000 bullet, lines must be indented or they will be seen as top-level
1001 headlines.  Also, when you are hiding leading stars to get a clean
1002 outline view, plain list items starting with a star are visually
1003 indistinguishable from true headlines.  In short: even though @samp{*}
1004 is supported, it may be better not to use it for plain list items.} as
1005 bullets.  Ordered list items start with @samp{1.} or @samp{1)}.  Items
1006 belonging to the same list must have the same indentation on the first
1007 line.  In particular, if an ordered list reaches number @samp{10.}, then
1008 the 2--digit numbers must be written left-aligned with the other numbers
1009 in the list.  Indentation also determines the end of a list item.  It
1010 ends before the next line that is indented like the bullet/number, or
1011 less.  Empty lines are part of the previous item, so you can have
1012 several paragraphs in one item.  If you would like an emtpy line to
1013 terminate all currently open plain lists, configure the variable
1014 @code{org-empty-line-terminates-plain-lists}.  Here is an for example:
1016 @example
1017 @group
1018 ** Lord of the Rings
1019    My favorite scenes are (in this order)
1020    1. The attack of the Rohirrim
1021    2. Eowyns fight with the witch king
1022       + this was already my favorite scene in the book
1023       + I really like Miranda Otto.
1024    3. Peter Jackson being shot by Legolas
1025        - on DVD only
1026       He makes a really funny face when it happens.
1027    But in the end, not individual scenes matter but the film as a whole.
1028 @end group
1029 @end example
1031 Org-mode supports these lists by tuning filling and wrapping commands to
1032 deal with them correctly@footnote{Org-mode only changes the filling
1033 settings for Emacs.  For XEmacs, you should use Kyle E. Jones'
1034 @file{filladapt.el}.  To turn this on,  put into @file{.emacs}:
1035 @example
1036 (require 'filladapt)
1037 @end example
1040 The following commands act on items when the cursor is in the first line
1041 of an item (the line with the bullet or number).
1043 @table @kbd
1044 @kindex @key{TAB}
1045 @item @key{TAB}
1046 Items can be folded just like headline levels if you set the variable
1047 @code{org-cycle-include-plain-lists}.  The level of an item is then
1048 given by the indentation of the bullet/number.  Items are always
1049 subordinate to real headlines, however; the hierarchies remain
1050 completely separated.
1051 @kindex M-@key{RET}
1052 @item M-@key{RET}
1053 Insert new item at current level.  With prefix arg, force a new heading
1054 (@pxref{Structure editing}).  If this command is used in the middle of a
1055 line, the line is @emph{split} and the rest of the line becomes the new
1056 item.  If this command is executed in the @emph{whitespace before a bullet or
1057 number}, the new item is created @emph{before} the current item.  If the
1058 command is executed in the white space before the text that is part of
1059 an item but does not contain the bullet, a bullet is added to the
1060 current line.
1061 @kindex M-S-@key{RET}
1062 @item M-S-@key{RET}
1063 Insert a new item with a checkbox (@pxref{Checkboxes}).
1064 @kindex S-@key{up}
1065 @kindex S-@key{down}
1066 @item S-@key{up}
1067 @itemx S-@key{down}
1068 Jump to the previous/next item in the current list.
1069 @kindex M-S-@key{up}
1070 @kindex M-S-@key{down}
1071 @item M-S-@key{up}
1072 @itemx M-S-@key{down}
1073 Move the item including subitems up/down (swap with previous/next item
1074 of same indentation).  If the list is ordered, renumbering is
1075 automatic.
1076 @kindex M-S-@key{left}
1077 @kindex M-S-@key{right}
1078 @item M-S-@key{left}
1079 @itemx M-S-@key{right}
1080 Decrease/increase the indentation of the item, including subitems.
1081 Initially, the item tree is selected based on current indentation.
1082 When these commands are executed several times in direct succession,
1083 the initially selected region is used, even if the new indentation
1084 would imply a different hierarchy.  To use the new hierarchy, break
1085 the command chain with a cursor motion or so.
1086 @kindex C-c C-c
1087 @item C-c C-c
1088 If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
1089 state of the checkbox.  Otherwise, if this is an ordered list, renumber
1090 the ordered list at the cursor.
1091 @end table
1093 @node Tables, Hyperlinks, Document structure, Top
1094 @chapter Tables
1095 @cindex tables
1096 @cindex editing tables
1098 Org-mode has a very fast and intuitive table editor built-in.
1099 Spreadsheet-like calculations are supported in connection with the
1100 Emacs @file{calc} package.
1102 @menu
1103 * Built-in table editor::       Simple tables
1104 * Narrow columns::              Stop wasting space in tables   
1105 * orgtbl-mode::                 The table editor as minor mode
1106 * The spreadsheet::             The table editor has spreadsheet capabilities.
1107 @end menu
1109 @node Built-in table editor, Narrow columns, Tables, Tables
1110 @section The built-in table editor
1111 @cindex table editor, built-in
1113 Org-mode makes it easy to format tables in plain ASCII.  Any line with
1114 @samp{|} as the first non-white character is considered part of a
1115 table.  @samp{|} is also the column separator.  A table might look
1116 like this:
1118 @example
1119 | Name  | Phone | Age |
1120 |-------+-------+-----|
1121 | Peter |  1234 |  17 |
1122 | Anna  |  4321 |  25 |
1123 @end example
1125 A table is re-aligned automatically each time you press @key{TAB} or
1126 @key{RET} or @kbd{C-c C-c} inside the table.  @key{TAB} also moves to
1127 the next field (@key{RET} to the next row) and creates new table rows
1128 at the end of the table or before horizontal lines.  The indentation
1129 of the table is set by the first line.  Any line starting with
1130 @samp{|-} is considered as a horizontal separator line and will be
1131 expanded on the next re-align to span the whole table width.  So, to
1132 create the above table, you would only type
1134 @example
1135 |Name|Phone|Age|
1137 @end example
1139 @noindent and then press @key{TAB} to align the table and start filling in
1140 fields.
1142 When typing text into a field, Org-mode treats @key{DEL},
1143 @key{Backspace}, and all character keys in a special way, so that
1144 inserting and deleting avoids shifting other fields.  Also, when
1145 typing @emph{immediately after the cursor was moved into a new field
1146 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
1147 field is automatically made blank.  If this behavior is too
1148 unpredictable for you, configure the variables
1149 @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
1151 @table @kbd
1152 @tsubheading{Creation and conversion}
1153 @kindex C-c |
1154 @item C-c |
1155 Convert the active region to table. If every line contains at least one
1156 TAB character, the function assumes that the material is tab separated.
1157 If not, lines are split at whitespace into fields.  You can use a prefix
1158 argument to indicate the minimum number of consecutive spaces required
1159 to identify a field separator (default: just one).@* 
1160 If there is no active region, this command creates an empty Org-mode
1161 table.  But it's easier just to start typing, like
1162 @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
1164 @tsubheading{Re-aligning and field motion}
1165 @kindex C-c C-c
1166 @item C-c C-c
1167 Re-align the table without moving the cursor.
1169 @kindex @key{TAB}
1170 @item @key{TAB}
1171 Re-align the table, move to the next field.  Creates a new row if
1172 necessary.
1174 @kindex S-@key{TAB}
1175 @item S-@key{TAB}
1176 Re-align, move to previous field.
1178 @kindex @key{RET}
1179 @item @key{RET}
1180 Re-align the table and move down to next row.  Creates a new row if
1181 necessary.  At the beginning or end of a line, @key{RET} still does
1182 NEWLINE, so it can be used to split a table.
1184 @tsubheading{Column and row editing}
1185 @kindex M-@key{left}
1186 @kindex M-@key{right}
1187 @item M-@key{left}
1188 @itemx M-@key{right}
1189 Move the current column left/right.
1191 @kindex M-S-@key{left}
1192 @item M-S-@key{left}
1193 Kill the current column.
1195 @kindex M-S-@key{right}
1196 @item M-S-@key{right}
1197 Insert a new column to the left of the cursor position.
1199 @kindex M-@key{up}
1200 @kindex M-@key{down}
1201 @item M-@key{up}
1202 @itemx M-@key{down}
1203 Move the current row up/down.
1205 @kindex M-S-@key{up}
1206 @item M-S-@key{up}
1207 Kill the current row or horizontal line.
1209 @kindex M-S-@key{down}
1210 @item M-S-@key{down}
1211 Insert a new row above (with arg: below) the current row.
1213 @kindex C-c -
1214 @item C-c -
1215 Insert a horizontal line below current row. With prefix arg, the line
1216 is created above the current line.
1218 @kindex C-c ^
1219 @item C-c ^
1220 Sort the table lines in the region.  The position of point indicates the
1221 column to be used for sorting, and the range of lines is the range
1222 between the nearest horizontal separator lines, or the entire table.  If
1223 point is before the first column, you will be prompted for the sorting
1224 column.  If there is an active region, the mark specifies the first line
1225 and the sorting column, while point should be in the last line to be
1226 included into the sorting.  The command prompts for the sorting type
1227 (alphabetically, numerically, or by time).  When called with a prefix
1228 argument, alphabetic sorting will be case-sensitive.
1230 @tsubheading{Regions}
1231 @kindex C-c C-x M-w
1232 @item C-c C-x M-w
1233 Copy a rectangular region from a table to a special clipboard.  Point
1234 and mark determine edge fields of the rectangle.  The process ignores
1235 horizontal separator lines.
1237 @kindex C-c C-x C-w
1238 @item C-c C-x C-w
1239 Copy a rectangular region from a table to a special clipboard, and
1240 blank all fields in the rectangle.  So this is the ``cut'' operation.
1242 @kindex C-c C-x C-y
1243 @item C-c C-x C-y
1244 Paste a rectangular region into a table.
1245 The upper right corner ends up in the current field.  All involved fields
1246 will be overwritten.  If the rectangle does not fit into the present table,
1247 the table is enlarged as needed.  The process ignores horizontal separator
1248 lines.
1250 @kindex C-c C-q
1251 @item C-c C-q
1252 Wrap several fields in a column like a paragraph.  If there is an active
1253 region, and both point and mark are in the same column, the text in the
1254 column is wrapped to minimum width for the given number of lines.  A
1255 prefix ARG may be used to change the number of desired lines.  If there
1256 is no region, the current field is split at the cursor position and the
1257 text fragment to the right of the cursor is prepended to the field one
1258 line down. If there is no region, but you specify a prefix ARG, the
1259 current field is made blank, and the content is appended to the field
1260 above.
1262 @tsubheading{Calculations}
1263 @cindex formula, in tables
1264 @cindex calculations, in tables
1265 @cindex region, active
1266 @cindex active region
1267 @cindex transient-mark-mode
1268 @kindex C-c +
1269 @item C-c +
1270 Sum the numbers in the current column, or in the rectangle defined by
1271 the active region.  The result is shown in the echo area and can
1272 be inserted with @kbd{C-y}.
1274 @kindex S-@key{RET}
1275 @item S-@key{RET}
1276 When current field is empty, copy from first non-empty field above.
1277 When not empty, copy current field down to next row and move cursor
1278 along with it.  Depending on the variable
1279 @code{org-table-copy-increment}, integer field values will be
1280 incremented during copy.  This key is also used by CUA-mode
1281 (@pxref{Cooperation}).
1283 @tsubheading{Miscellaneous}
1284 @kindex C-c `
1285 @item C-c `
1286 Edit the current field in a separate window.  This is useful for fields
1287 that are not fully visible (@pxref{Narrow columns}).  When called with a
1288 @kbd{C-u} prefix, just make the full field visible, so that it can be
1289 edited in place.
1291 @kindex C-c @key{TAB}
1292 @item C-c @key{TAB}
1293 This is an alias for @kbd{C-u C-c `} to make the current field fully
1294 visible.
1296 @item M-x org-table-import
1297 Import a file as a table.  The table should be TAB- or whitespace
1298 separated.  Useful, for example, to import an Excel table or data from a
1299 database, because these programs generally can write TAB-separated text
1300 files.  This command works by inserting the file into the buffer and
1301 then converting the region to a table.  Any prefix argument is passed on
1302 to the converter, which uses it to determine the separator.
1304 @item M-x org-table-export
1305 Export the table as a TAB-separated file.  Useful for data exchange with,
1306 for example, Excel or database programs.
1307 @end table
1309 If you don't like the automatic table editor because it gets in your
1310 way on lines which you would like to start with @samp{|}, you can turn
1311 it off with
1313 @lisp
1314 (setq org-enable-table-editor nil)
1315 @end lisp
1317 @noindent Then the only table command that still works is
1318 @kbd{C-c C-c} to do a manual re-align.
1320 @node Narrow columns, orgtbl-mode, Built-in table editor, Tables
1321 @section Narrow columns
1322 @cindex narrow columns in tables
1324 The width of columns is automatically determined by the table editor.
1325 Sometimes a single field or a few fields need to carry more text,
1326 leading to inconveniently wide columns.  To limit@footnote{This feature
1327 does not work on XEmacs.} the width of a column, one field anywhere in
1328 the column may contain just the string @samp{<N>} where @samp{N} is an
1329 integer specifying the width of the column in characters.  The next
1330 re-align will then set the width of this column to no more than this
1331 value.
1333 @example
1334 @group
1335 |---+------------------------------|               |---+--------|
1336 |   |                              |               |   | <6>    |
1337 | 1 | one                          |               | 1 | one    |
1338 | 2 | two                          |     ----\     | 2 | two    |
1339 | 3 | This is a long chunk of text |     ----/     | 3 | This=> |
1340 | 4 | four                         |               | 4 | four   |
1341 |---+------------------------------|               |---+--------|
1342 @end group
1343 @end example
1345 @noindent
1346 Fields that are wider become clipped and end in the string @samp{=>}.
1347 Note that the full text is still in the buffer, it is only invisible.
1348 To see the full text, hold the mouse over the field - a tool-tip window
1349 will show the full content.  To edit such a field, use the command
1350 @kbd{C-c `} (that is @kbd{C-c} followed by the backquote).  This will
1351 open a new window with the full field.  Edit it and finish with @kbd{C-c
1352 C-c}.
1354 When visiting a file containing a table with narrowed columns, the
1355 necessary character hiding has not yet happened, and the table needs to
1356 be aligned before it looks nice.  Setting the option
1357 @code{org-startup-align-all-tables} will realign all tables in a file
1358 upon visiting, but also slow down startup.  You can also set this option
1359 on a per-file basis with:
1361 @example
1362 #+STARTUP: align
1363 #+STARTUP: noalign
1364 @end example
1366 @node orgtbl-mode, The spreadsheet, Narrow columns, Tables
1367 @section The Orgtbl minor mode
1368 @cindex orgtbl-mode
1369 @cindex minor mode for tables
1371 If you like the intuitive way the Org-mode table editor works, you
1372 might also want to use it in other modes like text-mode or mail-mode.
1373 The minor mode Orgtbl-mode makes this possible.  You can always toggle
1374 the mode with @kbd{M-x orgtbl-mode}.  To turn it on by default, for
1375 example in mail mode, use
1377 @lisp
1378 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
1379 @end lisp
1381 Furthermore, with some special setup, it is possible to maintain tables
1382 in arbitrary syntax with Orgtbl-mode.  For example, it is possible to
1383 construct LaTeX tables with the underlying ease and power of
1384 Orgtbl-mode, including spreadsheet capabilities.  For details, see
1385 @ref{Tables in arbitrary syntax}.
1387 @node The spreadsheet,  , orgtbl-mode, Tables
1388 @section The spreadsheet
1389 @cindex calculations, in tables
1390 @cindex spreadsheet capabilities
1391 @cindex @file{calc} package
1393 The table editor makes use of the Emacs @file{calc} package to implement
1394 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms to
1395 derive fields from other fields.  While fully featured, Org-mode's
1396 implementation is not identical to other spreadsheets.  For example,
1397 Org-mode knows the concept of a @emph{column formula} that will be
1398 applied to all non-header fields in a column without having to copy the
1399 formula to each relevant field.
1401 @menu
1402 * References::                  How to refer to another field or range
1403 * Formula syntax for Calc::     Using Calc to compute stuff
1404 * Formula syntax for Lisp::     Writing formulas in Emacs Lisp
1405 * Field formulas::              Formulas valid for a single field
1406 * Column formulas::             Formulas valid for an entire column
1407 * Editing and debugging formulas::  Fixing formulas
1408 * Updating the table::          Recomputing all dependent fields
1409 * Advanced features::           Field names, parameters and automatic recalc
1410 @end menu
1412 @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
1413 @subsection References
1414 @cindex references
1416 To compute fields in the table from other fields, formulas must
1417 reference other fields or ranges.  In Org-mode, fields can be referenced
1418 by name, by absolute coordinates, and by relative coordinates.  To find
1419 out what the coordinates of a field are, press @kbd{C-c ?} in that
1420 field, or press @kbd{C-c @}} to toggle the display of a grid.
1422 @subsubheading Field references
1423 @cindex field references
1424 @cindex references, to fields
1426 Formulas can reference the value of another field in two ways.  Like in
1427 any other spreadsheet, you may reference fields with a letter/number
1428 combination like @code{B3}, meaning the 2nd field in the 3rd row.
1429 @c Such references are always fixed to that field, they don't change
1430 @c when you copy and paste a formula to a different field.  So
1431 @c Org-mode's @code{B3} behaves like @code{$B$3} in other spreadsheets.
1433 @noindent
1434 Org-mode also uses another, more general operator that looks like this:
1435 @example
1436 @@row$column
1437 @end example
1439 @noindent
1440 Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
1441 or relative to the current column like @samp{+1} or @samp{-2}.
1443 The row specification only counts data lines and ignores horizontal
1444 separator lines (hlines).  You can use absolute row numbers
1445 @samp{1}...@samp{N}, and row numbers relative to the current row like
1446 @samp{+3} or @samp{-1}.  Or specify the row relative to one of the
1447 hlines: @samp{I} refers to the first hline, @samp{II} to the second etc.
1448 @samp{-I} refers to the first such line above the current line,
1449 @samp{+I} to the first such line below the current line.  You can also
1450 write @samp{III+2} which is the second data line after the third hline
1451 in the table.  Relative row numbers like @samp{-3} will not cross hlines
1452 if the current line is too close to the hline.  Instead, the value
1453 directly at the hline is used.
1455 @samp{0} refers to the current row and column.  Also, if you omit
1456 either the column or the row part of the reference, the current
1457 row/column is implied. 
1459 Org-mode's references with @emph{unsigned} numbers are fixed references
1460 in the sense that if you use the same reference in the formula for two
1461 different fields, the same field will be referenced each time.
1462 Org-mode's references with @emph{signed} numbers are floating
1463 references because the same reference operator can reference different
1464 fields depending on the field being calculated by the formula.
1466 Here are a few examples:
1468 @example
1469 @@2$3      @r{2nd row, 3rd column}
1470 C2        @r{same as previous}
1471 $5        @r{column 5 in the current row}
1472 E&        @r{same as previous}
1473 @@2        @r{current column, row 2}
1474 @@-1$-3    @r{the field one row up, three columns to the left}
1475 @@-I$2     @r{field just under hline above current row, column 2}
1476 @end example
1478 @subsubheading Range references
1479 @cindex range references
1480 @cindex references, to ranges
1482 You may reference a rectangular range of fields by specifying two field
1483 references connected by two dots @samp{..}.  If both fields are in the
1484 current row, you may simply use @samp{$2..$7}, but if at least one field
1485 is in a different row, you need to use the general @code{@@row$column}
1486 format at least for the first field (i.e the reference must start with
1487 @samp{@@} in order to be interpreted correctly).  Examples:
1489 @example
1490 $1..$3        @r{First three fields in the current row.}
1491 $P..$Q        @r{Range, using column names (see under Advanced)}
1492 @@2$1..@@4$3    @r{6 fields between these two fields.}
1493 A2..C4        @r{Same as above.}
1494 @@-1$-2..@@-1   @r{3 numbers from the column to the left, 2 up to current row}
1495 @end example
1497 @noindent Range references return a vector of values that can be fed
1498 into Calc vector functions.  Empty fields in ranges are normally
1499 suppressed, so that the vector contains only the non-empty fields (but
1500 see the @samp{E} mode switch below).  If there are no non-empty fields,
1501 @samp{[0]} is returned to avoid syntax errors in formulas.
1503 @subsubheading Named references
1504 @cindex named references
1505 @cindex references, named
1506 @cindex name, of column or field
1507 @cindex constants, in calculations
1509 @samp{$name} is interpreted as the name of a column, parameter or
1510 constant.  Constants are defined globally through the variable
1511 @code{org-table-formula-constants}.  If you have the @file{constants.el}
1512 package, it will also be used to resolve constants, including natural
1513 constants like @samp{$h} for Planck's constant, and units like
1514 @samp{$km} for kilometers@footnote{@file{Constant.el} can supply the
1515 values of constants in two different unit systems, @code{SI} and
1516 @code{cgs}.  Which one is used depends on the value of the variable
1517 @code{constants-unit-system}.  You can use the @code{#+STARTUP} options
1518 @code{constSI} and @code{constcgs} to set this value for the current
1519 buffer.}.  Column names and parameters can be specified in special table
1520 lines.  These are described below, see @ref{Advanced features}.  All
1521 names must start with a letter, and further consist of letters and
1522 numbers.
1524 @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
1525 @subsection Formula syntax for Calc
1526 @cindex formula syntax, Calc
1527 @cindex syntax, of formulas
1529 A formula can be any algebraic expression understood by the Emacs
1530 @file{Calc} package.  @b{Note that @file{calc} has the
1531 non-standard convention that @samp{/} has lower precedence than
1532 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.}  Before
1533 evaluation by @code{calc-eval} (@pxref{Calling Calc from
1534 Your Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU
1535 Emacs Calc Manual}),
1536 variable substitution takes place according to the rules described above.
1537 @cindex vectors, in table calculations
1538 The range vectors can be directly fed into the calc vector functions
1539 like @samp{vmean} and @samp{vsum}.
1541 @cindex format specifier
1542 @cindex mode, for @file{calc}
1543 A formula can contain an optional mode string after a semicolon.  This
1544 string consists of flags to influence Calc and other modes during
1545 execution.  By default, Org-mode uses the standard calc modes (precision
1546 12, angular units degrees, fraction and symbolic modes off.  The display
1547 format, however, has been changed to @code{(float 5)} to keep tables
1548 compact.  The default settings can be configured using the variable
1549 @code{org-calc-default-modes}.
1551 @example
1552 p20           @r{switch the internal precision to 20 digits}
1553 n3 s3 e2 f4   @r{normal, scientific, engineering, or fixed display format}
1554 D R           @r{angle modes: degrees, radians}
1555 F S           @r{fraction and symbolic modes}
1556 N             @r{interpret all fields as numbers, use 0 for non-numbers}
1557 T             @r{force text interpretation}
1558 E             @r{keep empty fields in ranges}
1559 @end example
1561 @noindent
1562 In addition, you may provide a @code{printf} format specifier to
1563 reformat the final result.  A few examples:
1565 @example
1566 $1+$2                @r{Sum of first and second field}
1567 $1+$2;%.2f           @r{Same, format result to two decimals}
1568 exp($2)+exp($1)      @r{Math functions can be used}
1569 $0;%.1f              @r{Reformat current cell to 1 decimal}
1570 ($3-32)*5/9          @r{Degrees F -> C conversion}
1571 $c/$1/$cm            @r{Hz -> cm conversion, using @file{constants.el}}
1572 tan($1);Dp3s1        @r{Compute in degrees, precision 3, display SCI 1}
1573 sin($1);Dp3%.1e      @r{Same, but use printf specifier for display}
1574 vmean($2..$7)        @r{Compute column range mean, using vector function}
1575 vmean($2..$7);EN     @r{Same, but treat empty fields as 0}
1576 taylor($3,x=7,2)     @r{taylor series of $3, at x=7, second degree}
1577 @end example
1579 Calc also contains a complete set of logical operations.  For example
1581 @example
1582 if($1<20,teen,string(""))  @r{``teen'' if age $1 less than 20, else empty}
1583 @end example
1585 @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
1586 @subsection Emacs Lisp forms as formulas
1587 @cindex Lisp forms, as table formulas
1589 It is also possible to write a formula in Emacs Lisp; this can be useful
1590 for string manipulation and control structures, if the Calc's
1591 functionality is not enough.  If a formula starts with a single quote
1592 followed by an opening parenthesis, then it is evaluated as a lisp form.
1593 The evaluation should return either a string or a number.  Just as with
1594 @file{calc} formulas, you can specify modes and a printf format after a
1595 semicolon.  A reference will be replaced with a string (in double
1596 quotes) containing the field.  If you provide the @samp{N} mode switch,
1597 all referenced elements will be numbers.  Ranges are inserted as
1598 space-separated fields, so you can embed them in list or vector syntax.
1599 A few examples, note how the @samp{N} mode is used when we do
1600 computations in lisp.
1602 @example
1603 @r{Swap the first two characters of the content of column 1}
1604   '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
1605 @r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
1606   '(+ $1 $2);N
1607 @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
1608   '(apply '+ '($1..$4));N
1609 @end example
1611 @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
1612 @subsection Field formulas
1613 @cindex field formula
1614 @cindex formula, for individual table field
1616 To assign a formula to a particular field, type it directly into the
1617 field, preceded by @samp{:=}, for example @samp{:=$1+$2}.  When you
1618 press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
1619 the field, the formula will be stored as the formula for this field,
1620 evaluated, and the current field replaced with the result.
1622 Formulas are stored in a special line starting with @samp{#+TBLFM:}
1623 directly below the table.  If you typed the equation in the 4th field of
1624 the 3rd data line in the table, the formula will look like
1625 @samp{@@3$4=$1+$2}.  When inserting/deleting/swapping column and rows
1626 with the appropriate commands, @i{absolute references} (but not relative
1627 ones) in stored formulas are modified in order to still reference the
1628 same field.  Of cause this is not true if you edit the table structure
1629 with normal editing commands - then you must fix the equations yourself.
1631 Instead of typing an equation into the field, you may also use the
1632 following command
1634 @table @kbd
1635 @kindex C-u C-c =
1636 @item C-u C-c =
1637 Install a new formula for the current field.  The command prompts for a
1638 formula, with default taken from the @samp{#+TBLFM:} line, applies
1639 it to the current field and stores it.
1640 @end table
1642 @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
1643 @subsection Column formulas
1644 @cindex column formula
1645 @cindex formula, for table column
1647 Often in a table, the same formula should be used for all fields in a
1648 particular column.  Instead of having to copy the formula to all fields
1649 in that column, org-mode allows to assign a single formula to an entire
1650 column.  If the table contains horizontal separator hlines, everything
1651 before the first such line is considered part of the table @emph{header}
1652 and will not be modified by column formulas.
1654 To assign a formula to a column, type it directly into any field in the
1655 column, preceded by an equal sign, like @samp{=$1+$2}.  When you press
1656 @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
1657 field, the formula will be stored as the formula for the current column,
1658 evaluated and the current field replaced with the result.  If the field
1659 contains only @samp{=}, the previously stored formula for this column is
1660 used.  For each column, Org-mode will only remember the most recently
1661 used formula.  In the @samp{TBLFM:} line, column formulas will look like
1662 @samp{$4=$1+$2}.
1664 Instead of typing an equation into the field, you may also use the
1665 following command:
1667 @table @kbd
1668 @kindex C-c =
1669 @item C-c =
1670 Install a new formula for the current column and replace current field
1671 with the result of the formula.  The command prompts for a formula, with
1672 default taken from the @samp{#+TBLFM} line, applies it to the current
1673 field and stores it.  With a numerical prefix (e.g. @kbd{C-5 C-c =})
1674 will apply it to that many consecutive fields in the current column.
1675 @end table
1678 @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
1679 @subsection Editing and Debugging formulas
1680 @cindex formula editing
1681 @cindex editing, of table formulas
1683 You can edit individual formulas in the minibuffer or directly in the
1684 field.  Org-mode can also prepare a special buffer with all active
1685 formulas of a table.  When offering a formula for editing, Org-mode
1686 converts references to the standard format (like @code{B3} or @code{D&})
1687 if possible.  If you prefer to only work with the internal format (like
1688 @code{@@3$2} or @code{$4}), configure the variable
1689 @code{org-table-use-standard-references}.
1691 @table @kbd
1692 @kindex C-c =
1693 @kindex C-u C-c =
1694 @item C-c =
1695 @itemx C-u C-c =
1696 Edit the formula associated with the current column/field in the
1697 minibuffer.  See @ref{Column formulas} and @ref{Field formulas}.
1698 @kindex C-u C-u C-c =
1699 @item C-u C-u C-c =
1700 Re-insert the active formula (either a
1701 field formula, or a column formula) into the current field, so that you
1702 can edit it directly in the field.  The advantage over editing in the
1703 minibuffer is that you can use the command @kbd{C-c ?}.
1704 @kindex C-c ?
1705 @item C-c ?
1706 While editing a formula in a table field, highlight the field(s)
1707 referenced by the reference at the cursor position in the formula.
1708 @kindex C-c @}
1709 @item C-c @}
1710 Toggle the display of row and column numbers for a table, using
1711 overlays.  These are updated each time the table is aligned, you can
1712 force it with @kbd{C-c C-c}.
1713 @kindex C-c @{
1714 @item C-c @{
1715 Toggle the formula debugger on and off.  See below.
1716 @kindex C-c '
1717 @item C-c '
1718 Edit all formulas for the current table in a special buffer, where the
1719 formulas will be displayed one per line.  If the current field has an
1720 active formula, the cursor in the formula editor will mark it.
1721 While inside the special buffer, Org-mode will automatically highlight
1722 any field or range reference at the cursor position.  You may edit,
1723 remove and add formulas, and use the following commands:
1724 @table @kbd
1725 @kindex C-c C-c
1726 @kindex C-x C-s
1727 @item C-c C-c
1728 @itemx C-x C-s
1729 Exit the formula editor and store the modified formulas.  With @kbd{C-u}
1730 prefix, also apply the new formulas to the entire table.
1731 @kindex C-c C-q
1732 @item C-c C-q
1733 Exit the formula editor without installing changes.
1734 @kindex C-c C-r
1735 @item C-c C-r
1736 Toggle all references in the formula editor between standard (like
1737 @code{B3}) and internal (like @code{@@3$2}).
1738 @kindex @key{TAB}
1739 @item @key{TAB}
1740 Pretty-print or indent lisp formula at point.  When in a line containing
1741 a lisp formula, format the formula according to Emacs Lisp rules.
1742 Another @key{TAB} collapses the formula back again.  In the open
1743 formula, @key{TAB} re-indents just like in Emacs-lisp-mode.
1744 @kindex M-@key{TAB}
1745 @item M-@key{TAB}
1746 Complete Lisp symbols, just like in Emacs-lisp-mode.
1747 @kindex S-@key{up}
1748 @kindex S-@key{down}
1749 @kindex S-@key{left}
1750 @kindex S-@key{right}
1751 @item S-@key{up}/@key{down}/@key{left}/@key{right}
1752 Shift the reference at point.  For example, if the reference is
1753 @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
1754 This also works for relative references, and for hline references.
1755 @kindex M-S-@key{up}
1756 @kindex M-S-@key{down}
1757 @item M-S-@key{up}/@key{down}
1758 Move the test line for column formulas in the Org-mode buffer up and
1759 down.
1760 @kindex M-@key{up}
1761 @kindex M-@key{down}
1762 @item M-@key{up}/@key{down}
1763 Scroll the window displaying the table.
1764 @kindex C-c @}
1765 @item C-c @}
1766 Turn the coordinate grid in the table on and off.
1767 @end table
1768 @end table
1770 Making a table field blank does not remove the formula associated with
1771 the field, because that is stored in a different line (the @samp{TBLFM}
1772 line) - during the next recalculation the field will be filled again.
1773 To remove a formula from a field, you have to give an empty reply when
1774 prompted for the formula, or to edit the @samp{#+TBLFM} line.
1776 @kindex C-c C-c
1777 You may edit the @samp{#+TBLFM} directly and re-apply the changed
1778 equations with @kbd{C-c C-c} in that line, or with the normal
1779 recalculation commands in the table.
1781 @subsubheading Debugging formulas
1782 @cindex formula debugging
1783 @cindex debugging, of table formulas
1784 When the evaluation of a formula leads to an error, the field content
1785 becomes the string @samp{#ERROR}.  If you would like see what is going
1786 on during variable substitution and calculation in order to find a bug,
1787 turn on formula debugging in the @code{Tbl} menu and repeat the
1788 calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
1789 field.  Detailed information will be displayed.
1791 @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
1792 @subsection Updating the Table
1793 @cindex recomputing table fields
1794 @cindex updating, table
1796 Recalculation of a table is normally not automatic, but needs to be
1797 triggered by a command.  See @ref{Advanced features} for a way to make
1798 recalculation at least semi-automatically.
1800 In order to recalculate a line of a table or the entire table, use the
1801 following commands:
1803 @table @kbd
1804 @kindex C-c *
1805 @item C-c *
1806 Recalculate the current row by first applying the stored column formulas
1807 from left to right, and all field formulas in the current row.
1809 @kindex C-u C-c *
1810 @item C-u C-c *
1811 @kindex C-u C-c C-c
1812 @itemx C-u C-c C-c
1813 Recompute the entire table, line by line.  Any lines before the first
1814 hline are left alone, assuming that these are part of the table header.
1816 @kindex C-u C-u C-c *
1817 @item C-u C-u C-c *
1818 Iterate the table by recomputing it until no further changes occur.
1819 This may be necessary if some computed fields use the value of other
1820 fields that are computed @i{later} in the calculation sequence.
1821 @end table
1823 @node Advanced features,  , Updating the table, The spreadsheet
1824 @subsection Advanced features
1826 If you want the recalculation of fields to happen automatically, or if
1827 you want to be able to assign @i{names} to fields and columns, you need
1828 to reserve the first column of the table for special marking characters.
1829 @table @kbd
1830 @kindex C-#
1831 @item C-#
1832 Rotate the calculation mark in first column through the states @samp{},
1833 @samp{#}, @samp{*}, @samp{!}, @samp{$}.  The meaning of these characters
1834 is discussed below.  When there is an active region, change all marks in
1835 the region.
1836 @end table
1838 Here is an example of a table that collects exam results of students and
1839 makes use of these features:
1841 @example
1842 @group
1843 |---+---------+--------+--------+--------+-------+------|
1844 |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
1845 |---+---------+--------+--------+--------+-------+------|
1846 | ! |         |     P1 |     P2 |     P3 |   Tot |      |
1847 | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
1848 | ^ |         |     m1 |     m2 |     m3 |    mt |      |
1849 |---+---------+--------+--------+--------+-------+------|
1850 | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
1851 | # | Sara    |      6 |     14 |     19 |    39 |  7.8 |
1852 | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
1853 |---+---------+--------+--------+--------+-------+------|
1854 |   | Average |        |        |        |  29.7 |      |
1855 | ^ |         |        |        |        |    at |      |
1856 | $ | max=50  |        |        |        |       |      |
1857 |---+---------+--------+--------+--------+-------+------|
1858 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
1859 @end group
1860 @end example
1862 @noindent @b{Important}: Please note that for these special tables,
1863 recalculating the table with @kbd{C-u C-c *} will only affect rows that
1864 are marked @samp{#} or @samp{*}, and fields that have a formula assigned
1865 to the field itself.  The column formulas are not applied in rows with
1866 empty first field.
1868 @cindex marking characters, tables
1869 The marking characters have the following meaning:
1870 @table @samp
1871 @item !
1872 The fields in this line define names for the columns, so that you may
1873 refer to a column as @samp{$Tot} instead of @samp{$6}.
1874 @item ^
1875 This row defines names for the fields @emph{above} the row.  With such
1876 a definition, any formula in the table may use @samp{$m1} to refer to
1877 the value @samp{10}.  Also, if you assign a formula to a names field, it
1878 will be stored as @samp{$name=...}.
1879 @item _
1880 Similar to @samp{^}, but defines names for the fields in the row
1881 @emph{below}.
1882 @item $
1883 Fields in this row can define @emph{parameters} for formulas.  For
1884 example, if a field in a @samp{$} row contains @samp{max=50}, then
1885 formulas in this table can refer to the value 50 using @samp{$max}.
1886 Parameters work exactly like constants, only that they can be defined on
1887 a per-table basis.
1888 @item #
1889 Fields in this row are automatically recalculated when pressing
1890 @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row.  Also, this row
1891 is selected for a global recalculation with @kbd{C-u C-c *}.  Unmarked
1892 lines will be left alone by this command.
1893 @item *
1894 Selects this line for global recalculation with @kbd{C-u C-c *}, but
1895 not for automatic recalculation.  Use this when automatic
1896 recalculation slows down editing too much.
1897 @item
1898 Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
1899 All lines that should be recalculated should be marked with @samp{#}
1900 or @samp{*}.
1901 @item /
1902 Do not export this line.  Useful for lines that contain the narrowing
1903 @samp{<N>} markers.
1904 @end table
1906 Finally, just to whet your appetite on what can be done with the
1907 fantastic @file{calc} package, here is a table that computes the Taylor
1908 series of degree @code{n} at location @code{x} for a couple of functions
1909 (homework: try that with Excel :-)
1911 @example
1912 @group
1913 |---+-------------+---+-----+--------------------------------------|
1914 |   | Func        | n | x   | Result                               |
1915 |---+-------------+---+-----+--------------------------------------|
1916 | # | exp(x)      | 1 | x   | 1 + x                                |
1917 | # | exp(x)      | 2 | x   | 1 + x + x^2 / 2                      |
1918 | # | exp(x)      | 3 | x   | 1 + x + x^2 / 2 + x^3 / 6            |
1919 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
1920 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2    |
1921 | * | tan(x)      | 3 | x   | 0.0175 x + 1.77e-6 x^3               |
1922 |---+-------------+---+-----+--------------------------------------|
1923 #+TBLFM: $5=taylor($2,$4,$3);n3
1924 @end group
1925 @end example
1927 @node Hyperlinks, TODO items, Tables, Top
1928 @chapter Hyperlinks
1929 @cindex hyperlinks
1931 Just like HTML, Org-mode provides links inside a file, and external
1932 links to other files, Usenet articles, emails, and much more.
1934 @menu
1935 * Link format::                 How links in Org-mode are formatted
1936 * Internal links::              Links to other places in the current file
1937 * External links::              URL-like links to the world
1938 * Handling links::              Creating, inserting and following
1939 * Link abbreviations::          Shortcuts for writing complex links
1940 * Search options::              Linking to a specific location
1941 * Custom searches::             When the default search is not enough
1942 * Remember::                    Org-trees store quick notes
1943 @end menu
1945 @node Link format, Internal links, Hyperlinks, Hyperlinks
1946 @section Link format
1947 @cindex link format
1948 @cindex format, of links
1950 Org-mode will recognize plain URL-like links and activate them as
1951 clickable links.  The general link format, however, looks like this:
1953 @example
1954 [[link][description]]       @r{or alternatively}           [[link]]  
1955 @end example
1957 Once a link in the buffer is complete (all brackets present), Org-mode
1958 will change the display so that @samp{description} is displayed instead
1959 of @samp{[[link][description]]} and @samp{link} is displayed instead of
1960 @samp{[[link]]}.  Links will be highlighted in the face @code{org-link},
1961 which by default is an underlined face.  You can directly edit the
1962 visible part of a link.  Note that this can be either the @samp{link}
1963 part (if there is no description) or the @samp{description} part.  To
1964 edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
1965 cursor on the link.
1967 If you place the cursor at the beginning or just behind the end of the
1968 displayed text and press @key{BACKSPACE}, you will remove the
1969 (invisible) bracket at that location.  This makes the link incomplete
1970 and the internals are again displayed as plain text.  Inserting the
1971 missing bracket hides the link internals again.  To show the
1972 internal structure of all links, use the menu entry
1973 @code{Org->Hyperlinks->Literal links}.
1975 @node Internal links, External links, Link format, Hyperlinks
1976 @section Internal links
1977 @cindex internal links
1978 @cindex links, internal
1979 @cindex targets, for links
1981 If the link does not look like a URL, it is considered to be internal in
1982 the current file.  Links such as @samp{[[My Target]]} or @samp{[[My
1983 Target][Find my target]]} lead to a text search in the current file.
1984 The link can be followed with @kbd{C-c C-o} when the cursor is on the
1985 link, or with a mouse click (@pxref{Handling links}).  The preferred
1986 match for such a link is a dedicated target: the same string in double
1987 angular brackets.  Targets may be located anywhere; sometimes it is
1988 convenient to put them into a comment line. For example
1990 @example
1991 # <<My Target>>
1992 @end example
1994 @noindent In HTML export (@pxref{HTML export}), such targets will become
1995 named anchors for direct access through @samp{http} links@footnote{Note
1996 that text before the first headline will never be exported, so the first
1997 such target must be after the first headline.}.
1999 If no dedicated target exists, Org-mode will search for the words in the
2000 link.  In the above example the search would be for @samp{my target}.
2001 Links starting with a star like @samp{*My Target} restrict the search to
2002 headlines.  When searching, Org-mode will first try an exact match, but
2003 then move on to more and more lenient searches.  For example, the link
2004 @samp{[[*My Targets]]} will find any of the following:
2006 @example
2007 ** My targets
2008 ** TODO my targets are bright
2009 ** my 20 targets are
2010 @end example
2012 To insert a link targeting a headline, in-buffer completion can be used.
2013 Just type a star followed by a few optional letters into the buffer and
2014 press @kbd{M-@key{TAB}}.  All headlines in the current buffer will be
2015 offered as completions.  @xref{Handling links}, for more commands
2016 creating links.
2018 Following a link pushes a mark onto Org-mode's own mark ring.  You can
2019 return to the previous position with @kbd{C-c &}.  Using this command
2020 several times in direct succession goes back to positions recorded
2021 earlier.
2023 @menu
2024 * Radio targets::               Make targets trigger links in plain text.
2025 @end menu
2027 @node Radio targets,  , Internal links, Internal links
2028 @subsection Radio targets
2029 @cindex radio targets
2030 @cindex targets, radio
2031 @cindex links, radio targets
2033 You can configure Org-mode to link any occurrences of certain target
2034 names in normal text.  So without explicitly creating a link, the text
2035 connects to the target radioing its position.  Radio targets are
2036 enclosed by triple angular brackets.  For example, a target
2037 @samp{<<<My Target>>>} causes each occurrence of @samp{my target} in
2038 normal text to become activated as a link.  The Org-mode file is
2039 scanned automatically for radio targets only when the file is first
2040 loaded into Emacs.  To update the target list during editing, press
2041 @kbd{C-c C-c} with the cursor on or at a target.
2043 @node External links, Handling links, Internal links, Hyperlinks
2044 @section External links
2045 @cindex links, external
2046 @cindex external links
2047 @cindex links, external
2048 @cindex GNUS links
2049 @cindex BBDB links
2050 @cindex URL links
2051 @cindex file links
2052 @cindex VM links
2053 @cindex RMAIL links
2054 @cindex WANDERLUST links
2055 @cindex MH-E links
2056 @cindex USENET links
2057 @cindex SHELL links
2058 @cindex Info links
2059 @cindex elisp links
2061 Org-mode supports links to files, websites, Usenet and email messages,
2062 and BBDB database entries.  External links are URL-like locators.  They
2063 start with a short identifying string followed by a colon.  There can be
2064 no space after the colon.  The following list shows examples for each
2065 link type.
2067 @example
2068 http://www.astro.uva.nl/~dominik          @r{on the web}
2069 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
2070 file:papers/last.pdf                      @r{file, relative path}
2071 news:comp.emacs                           @r{Usenet link}
2072 mailto:adent@@galaxy.net                   @r{Mail link}
2073 vm:folder                                 @r{VM folder link}
2074 vm:folder#id                              @r{VM message link}
2075 vm://myself@@some.where.org/folder#id      @r{VM on remote machine}
2076 wl:folder                                 @r{WANDERLUST folder link}
2077 wl:folder#id                              @r{WANDERLUST message link}
2078 mhe:folder                                @r{MH-E folder link}
2079 mhe:folder#id                             @r{MH-E message link}
2080 rmail:folder                              @r{RMAIL folder link}
2081 rmail:folder#id                           @r{RMAIL message link}
2082 gnus:group                                @r{GNUS group link}
2083 gnus:group#id                             @r{GNUS article link}
2084 bbdb:Richard Stallman                     @r{BBDB link}
2085 shell:ls *.org                            @r{A shell command}
2086 elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
2087 @end example
2089 A link should be enclosed in double brackets and may contain a
2090 descriptive text to be displayed instead of the url (@pxref{Link
2091 format}), for example:
2093 @example
2094 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
2095 @end example
2097 @noindent
2098 If the description is a file name or URL that points to an image, HTML
2099 export (@pxref{HTML export}) will inline the image as a clickable
2100 button.  If there is no description at all and the link points to an
2101 image,
2102 that image will be inlined into the exported HTML file.
2104 @cindex angular brackets, around links
2105 @cindex plain text external links
2106 Org-mode also finds external links in the normal text and activates them
2107 as links.  If spaces must be part of the link (for example in
2108 @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
2109 about the end of the link, enclose them in angular brackets.
2111 @node Handling links, Link abbreviations, External links, Hyperlinks
2112 @section Handling links
2113 @cindex links, handling
2115 Org-mode provides methods to create a link in the correct syntax, to
2116 insert it into an org-mode file, and to follow the link.
2118 @table @kbd
2119 @kindex C-c l
2120 @cindex storing links
2121 @item C-c l
2122 Store a link to the current location.  This is a @emph{global} command
2123 which can be used in any buffer to create a link.  The link will be
2124 stored for later insertion into an Org-mode buffer (see below).  For
2125 Org-mode files, if there is a @samp{<<target>>} at the cursor, the link
2126 points to the target.  Otherwise it points to the current headline.  For
2127 VM, RMAIL, WANDERLUST, MH-E, GNUS and BBDB buffers, the link will
2128 indicate the current article/entry.  For W3 and W3M buffers, the link
2129 goes to the current URL.  For any other files, the link will point to
2130 the file, with a search string (@pxref{Search options}) pointing to the
2131 contents of the current line.  If there is an active region, the
2132 selected words will form the basis of the search string.  If the
2133 automatically created link is not working correctly or accurately
2134 enough, you can write custom functions to select the search string and
2135 to do the search for particular file types - see @ref{Custom searches}.
2136 The key binding @kbd{C-c l} is only a suggestion - see @ref{Installation}.
2138 @kindex C-c C-l
2139 @cindex link completion
2140 @cindex completion, of links
2141 @cindex inserting links
2142 @item C-c C-l
2143 Insert a link.  This prompts for a link to be inserted into the buffer.
2144 You can just type a link, using text for an internal link, or one of the
2145 link type prefixes mentioned in the examples above.  All links stored
2146 during the current session are part of the history for this prompt, so
2147 you can access them with @key{up} and @key{down}, or with
2148 completion@footnote{After insertion of a stored link, the link will be
2149 removed from the list of stored links.  To keep it in the list later
2150 use, use a triple @kbd{C-u} prefix to @kbd{C-c C-l}, or configure the
2151 option @code{org-keep-stored-link-after-insertion}.}.  The link will be
2152 inserted into the buffer, along with a descriptive text.  If some text
2153 was selected when this command is called, the selected text becomes the
2154 default description.@* Note that you don't have to use this command to
2155 insert a link.  Links in Org-mode are plain text, and you can type or
2156 paste them straight into the buffer.  By using this command, the links
2157 are automatically enclosed in double brackets, and you will be asked for
2158 the optional descriptive text.
2160 @c  If the link is a @samp{file:} link and
2161 @c the linked file is located in the same directory as the current file or
2162 @c a subdirectory of it, the path of the file will be inserted relative to
2163 @c the current directory.
2165 @kindex C-u C-c C-l
2166 @cindex file name completion
2167 @cindex completion, of file names
2168 @item C-u C-c C-l
2169 When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
2170 a file will be inserted and you may use file name completion to select
2171 the name of the file.  The path to the file is inserted relative to the
2172 directory of the current org file, if the linked file is in the current
2173 directory or in a subdirectory of it, or if the path is written relative
2174 to the current directory using @samp{../}.  Otherwise an absolute path
2175 is used, if possible with @samp{~/} for your home directory.  You can
2176 force an absolute path with two @kbd{C-u} prefixes.
2178 @item C-c C-l @r{(with cursor on existing link)}
2179 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
2180 link and description parts of the link.
2182 @cindex following links
2183 @kindex C-c C-o
2184 @item C-c C-o
2185 Open link at point.  This will launch a web browser for URLs (using
2186 @command{browse-url-at-point}), run vm/mh-e/wanderlust/rmail/gnus/bbdb
2187 for the corresponding links, and execute the command in a shell link.
2188 When the cursor is on an internal link, this commands runs the
2189 corresponding search.  When the cursor is on a TAG list in a headline,
2190 it creates the corresponding TAGS view.  If the cursor is on a time
2191 stamp, it compiles the agenda for that date.  Furthermore, it will visit
2192 text and remote files in @samp{file:} links with Emacs and select a
2193 suitable application for local non-text files.  Classification of files
2194 is based on file extension only.  See option @code{org-file-apps}.  If
2195 you want to override the default application and visit the file with
2196 Emacs, use a @kbd{C-u} prefix.
2198 @kindex mouse-2
2199 @kindex mouse-1
2200 @item mouse-2
2201 @itemx mouse-1
2202 On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
2203 would.  Under Emacs 22, also @kbd{mouse-1} will follow a link.
2205 @kindex mouse-3
2206 @item mouse-3
2207 Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
2208 internal links to be displayed in another window@footnote{See the
2209 variable @code{org-display-internal-link-with-indirect-buffer}}.
2211 @cindex mark ring
2212 @kindex C-c %
2213 @item C-c %
2214 Push the current position onto the mark ring, to be able to return
2215 easily. Commands following an internal link do this automatically.
2217 @cindex links, returning to
2218 @kindex C-c &
2219 @item C-c &
2220 Jump back to a recorded position.  A position is recorded by the
2221 commands following internal links, and by @kbd{C-c %}.  Using this
2222 command several times in direct succession moves through a ring of
2223 previously recorded positions.
2225 @kindex C-c C-x C-n
2226 @kindex C-c C-x C-p
2227 @cindex links, finding next/previous
2228 @item C-c C-x C-n
2229 @itemx C-c C-x C-p
2230 Move forward/backward to the next link in the buffer.  At the limit of
2231 the buffer, the search fails once, and then wraps around.  The key
2232 bindings for this are really too long, you might want to bind this also
2233 to @kbd{C-n} and @kbd{C-p}
2234 @lisp
2235 (add-hook 'org-load-hook
2236   (lambda ()
2237     (define-key 'org-mode-map "\C-n" 'org-next-link)
2238     (define-key 'org-mode-map "\C-p" 'org-previous-link)))
2239 @end lisp
2240 @end table
2242 @node Link abbreviations, Search options, Handling links, Hyperlinks
2243 @section Link abbreviations
2244 @cindex link abbreviations
2245 @cindex abbreviation, links
2247 Long URLs can be cumbersome to type, and often many similar links are
2248 needed in a document.  For this you can use link abbreviations.  An
2249 abbreviated link looks like this
2251 @example
2252 [[linkword:tag][description]]
2253 @end example
2255 @noindent
2256 where the tag is optional.  Such abbreviations are resolved according to
2257 the information in the variable @code{org-link-abbrev-alist} that
2258 relates the linkwords to replacement text.  Here is an example:
2260 @lisp
2261 @group
2262 (setq org-link-abbrev-alist
2263   '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
2264     ("google"   . "http://www.google.com/search?q=")
2265     ("ads"      . "http://adsabs.harvard.edu/cgi-bin/
2266                    nph-abs_connect?author=%s&db_key=AST")))
2267 @end group
2268 @end lisp
2270 If the replacement text contains the string @samp{%s}, it will be
2271 replaced with the tag.  Otherwise the tag will be appended to the string
2272 in order to create the link.  You may also specify a function that will
2273 be called with the tag as the only argument to create the link.
2275 With the above setting, you could link to a specific bug with
2276 @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
2277 @code{[[google:OrgMode]]} and find out what the Org-mode author is
2278 doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
2280 If you need special abbreviations just for a single Org-mode buffer, you
2281 can define them in the file with
2283 @example
2284 #+LINK: bugzilla  http://10.1.2.9/bugzilla/show_bug.cgi?id=
2285 #+LINK: google    http://www.google.com/search?q=%s
2286 @end example
2288 @noindent
2289 In-buffer completion @pxref{Completion} can be used after @samp{[} to
2290 complete link abbreviations.
2292 @node Search options, Custom searches, Link abbreviations, Hyperlinks
2293 @section Search options in file links
2294 @cindex search option in file links
2295 @cindex file links, searching
2297 File links can contain additional information to make Emacs jump to a
2298 particular location in the file when following a link.  This can be a
2299 line number or a search option after a double@footnote{For backward
2300 compatibility, line numbers can also follow a single colon.} colon. For
2301 example, when the command @kbd{C-c l} creates a link (@pxref{Handling
2302 links}) to a file, it encodes the words in the current line as a search
2303 string that can be used to find this line back later when following the
2304 link with @kbd{C-c C-o}. 
2306 Here is the syntax of the different ways to attach a search to a file
2307 link, together with an explanation:
2309 @example
2310 [[file:~/code/main.c::255]]
2311 [[file:~/xx.org::My Target]]
2312 [[file:~/xx.org::*My Target]]
2313 [[file:~/xx.org::/regexp/]]
2314 @end example
2316 @table @code
2317 @item 255
2318 Jump to line 255.
2319 @item My Target
2320 Search for a link target @samp{<<My Target>>}, or do a text search for
2321 @samp{my target}, similar to the search in internal links, see
2322 @ref{Internal links}.  In HTML export (@pxref{HTML export}), such a file
2323 link will become an HTML reference to the corresponding named anchor in
2324 the linked file.
2325 @item *My Target
2326 In an Org-mode file, restrict search to headlines.
2327 @item /regexp/
2328 Do a regular expression search for @code{regexp}.  This uses the Emacs
2329 command @code{occur} to list all matches in a separate window.  If the
2330 target file is in Org-mode, @code{org-occur} is used to create a
2331 sparse tree with the matches.
2332 @c If the target file is a directory,
2333 @c @code{grep} will be used to search all files in the directory.
2334 @end table
2336 As a degenerate case, a file link with an empty file name can be used
2337 to search the current file.  For example, @code{[[file:::find me]]} does
2338 a search for @samp{find me} in the current file, just as
2339 @samp{[[find me]]} would.
2341 @node Custom searches, Remember, Search options, Hyperlinks
2342 @section Custom Searches
2343 @cindex custom search strings
2344 @cindex search strings, custom
2346 The default mechanism for creating search strings and for doing the
2347 actual search related to a file link may not work correctly in all
2348 cases.  For example, BibTeX database files have many entries like
2349 @samp{year="1993"} which would not result in good search strings,
2350 because the only unique identification for a BibTeX entry is the
2351 citation key.
2353 If you come across such a problem, you can write custom functions to set
2354 the right search string for a particular file type, and to do the search
2355 for the string in the file.  Using @code{add-hook}, these functions need
2356 to be added to the hook variables
2357 @code{org-create-file-search-functions} and
2358 @code{org-execute-file-search-functions}.  See the docstring for these
2359 variables for more information.  Org-mode actually uses this mechanism
2360 for Bib@TeX{} database files, and you can use the corresponding code as
2361 an implementation example.  Search for @samp{BibTeX links} in the source
2362 file.
2365 @node Remember,  , Custom searches, Hyperlinks
2366 @section Remember
2367 @cindex @file{remember.el}
2369 Another way to create org entries with links to other files is through
2370 the @i{remember} package by John Wiegley.  @i{Remember} lets you store
2371 quick notes with little interruption of your work flow.  See
2372 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
2373 information.  The notes produced by @i{Remember} can be stored in
2374 different ways, and Org-mode files are a good target.  Org-mode
2375 significantly expands the possibilities of @i{remember}: You may define
2376 templates for different note types, and to associate target files and
2377 headlines with specific templates.  It also allows you to select the
2378 location where a note should be stored interactively, on the fly.
2380 @menu
2381 * Setting up remember::         Some code for .emacs to get things going
2382 * Remember templates::          Define the outline of different note types
2383 * Storing notes::               Directly get the note to where it belongs
2384 @end menu
2386 @node Setting up remember, Remember templates, Remember, Remember
2387 @subsection Setting up remember
2389 The following customization will tell @i{remember} to use org files as
2390 target, and to create annotations compatible with Org-mode links.
2392 @example
2393 (setq org-directory "~/path/to/my/orgfiles/")
2394 (setq org-default-notes-file "~/.notes")
2395 (setq remember-annotation-functions '(org-remember-annotation))
2396 (setq remember-handler-functions '(org-remember-handler))
2397 (add-hook 'remember-mode-hook 'org-remember-apply-template)
2398 @end example
2400 @node Remember templates, Storing notes, Setting up remember, Remember
2401 @subsection Remember templates
2402 @cindex templates, for remember
2404 In combination with Org-mode, you can use templates to generate
2405 different types of @i{remember} notes.  For example, if you would like
2406 to use one template to create general TODO entries, another one for
2407 journal entries, and a third one for collecting random ideas, you could
2408 use:
2410 @example
2411 (setq org-remember-templates
2412  '((?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org")
2413    (?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")
2414    (?i "* %^@{Title@}\n  %i\n  %a" "~/org/JOURNAL.org" "New Ideas")))
2415 @end example
2417 @noindent In these entries, the character specifies how to select the
2418 template.  The first string specifies the template.  Two more (optional)
2419 strings give the file in which, and the headline under which the new
2420 note should be stored.  The file defaults (if not present or @code{nil})
2421 to @code{org-default-notes-file}, the heading to
2422 @code{org-remember-default-headline}.  Both defaults help to get to the
2423 storing location quickly, but you can change the location interactively
2424 while storing the note.
2426 When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember
2427 something, org will prompt for a key to select the template (if you have
2428 more than one template) and then prepare the buffer like
2429 @example
2430 * TODO
2431   [[file:link to where you called remember]]
2432 @end example
2434 @noindent or
2436 @example
2437 * [2006-03-21 Tue 15:37]
2439   [[file:link to where you called remember]]
2440 @end example
2442 @noindent
2443 During expansion of the template, special @kbd{%}-escapes allow dynamic
2444 insertion of content:
2445 @example
2446 %^@{prompt@}  @r{prompt the user for a string and replace this sequence with it.}
2447 %t          @r{time stamp, date only}
2448 %T          @r{time stamp with date and time}
2449 %u, %U      @r{like the above, but inactive time stamps}
2450 %^t         @r{like @code{%t}, but prompt for date.  Similarly @code{%^T}, @code{%^u}, @code{%^U}}
2451             @r{You may define a prompt like @code{%^@{Birthday@}t}}
2452 %n          @r{user name (taken from @code{user-full-name})}
2453 %a          @r{annotation, normally the link created with @code{org-store-link}}
2454 %i          @r{initial content, the region when remember is called with C-u.}
2455             @r{The entire text will be indented like @code{%i} itself.}
2456 %:keyword   @r{specific information for certain link types, see below}
2457 @end example
2459 @noindent
2460 For specific link types, the following keywords will be defined:
2462 @example
2463 Link type          |  Available keywords
2464 -------------------+----------------------------------------------
2465 bbdb               |  %:name %:company
2466 vm, wl, mh, rmail  |  %:type %:subject %:message-id
2467                    |  %:from %:fromname %:fromaddress
2468                    |  %:to   %:toname   %:toaddress
2469                    |  %: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}.}}       
2470 gnus               |  %:group, @r{for messages also all email fields}
2471 w3, w3m            |  %:url
2472 info               |  %:file %:node
2473 calendar           |  %:date"
2474 @end example
2476 @noindent
2477 To place the cursor after template expansion use:
2479 @example
2480 %?          @r{After completing the template, position cursor here.}
2481 @end example
2483 @noindent
2484 If you change you mind about which template to use, call
2485 @code{org-remember} in the remember buffer.  You may then select a new
2486 template that will be filled with the previous context information.
2488 @node Storing notes,  , Remember templates, Remember
2489 @subsection Storing notes
2491 When you are finished preparing a note with @i{remember}, you have to press
2492 @kbd{C-c C-c} to file the note away.  The handler first prompts for a
2493 target file - if you press @key{RET}, the value specified for the
2494 template is used.  Then the command offers the headings tree of the
2495 selected file, with the cursor position at the default headline (if you
2496 had specified one in the template).  You can either immediately press
2497 @key{RET} to get the note placed there.  Or you can use the following
2498 keys to find a better location:
2499 @example
2500 @key{TAB}         @r{Cycle visibility.}
2501 @key{down} / @key{up}   @r{Next/previous visible headline.}
2502 n / p        @r{Next/previous visible headline.}
2503 f / b        @r{Next/previous headline same level.}
2504 u            @r{One level up.}
2505 @c 0-9          @r{Digit argument.}
2506 @end example
2507 @noindent
2508 Pressing @key{RET} or @key{left} or @key{right}
2509 then leads to the following result.
2511 @multitable @columnfractions 0.2 0.15 0.65
2512 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
2513 @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file
2514 @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor
2515 @item             @tab @key{left}/@key{right} @tab as same level, before/after current heading
2516 @item not on headline @tab @key{RET}
2517       @tab at cursor position, level taken from context.
2518 @end multitable
2520 So a fast way to store the note to its default location is to press
2521 @kbd{C-c C-c @key{RET} @key{RET}}.  Even shorter would be @kbd{C-u C-c
2522 C-c}, which does the same without even asking for a file or showing the
2523 tree.
2525 Before inserting the text into a tree, the function ensures that the
2526 text has a headline, i.e. a first line that starts with a @samp{*}.
2527 If not, a headline is constructed from the current date and some
2528 additional data.  If the variable @code{org-adapt-indentation} is
2529 non-nil, the entire text is also indented so that it starts in the
2530 same column as the headline (after the asterisks).
2533 @node TODO items, Timestamps, Hyperlinks, Top
2534 @chapter TODO items
2535 @cindex TODO items
2537 Org-mode does not maintain TODO lists as a separate document.  TODO
2538 items are an integral part of the notes file, because TODO items
2539 usually come up while taking notes!  With Org-mode, you simply mark
2540 any entry in a tree as being a TODO item.  In this way, the
2541 information is not duplicated, and the entire context from which the
2542 item emerged is always present when you check.
2544 Of course, this technique causes TODO items to be scattered throughout
2545 your file.  Org-mode provides methods to give you an overview over all
2546 things you have to do.
2548 @menu
2549 * TODO basics::                 Marking and displaying TODO entries
2550 * TODO extensions::             Workflow and assignments
2551 * Priorities::                  Some things are more important than others
2552 * Breaking down tasks::         Splitting a task into manageable pieces
2553 * Checkboxes::                  Tick-off lists
2554 @end menu
2556 @node TODO basics, TODO extensions, TODO items, TODO items
2557 @section Basic TODO functionality
2559 Any headline can become a TODO item by starting it with the word TODO,
2560 for example:
2562 @example
2563 *** TODO Write letter to Sam Fortune
2564 @end example
2566 @noindent
2567 The most important commands to work with TODO entries are:
2569 @table @kbd
2570 @kindex C-c C-t
2571 @cindex cycling, of TODO states
2572 @item C-c C-t
2573 Rotate the TODO state of the current item between
2575 @example
2576 ,-> (unmarked) -> TODO -> DONE --.
2577 '--------------------------------'
2578 @end example
2580 The same rotation can also be done ``remotely'' from the timeline and
2581 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
2582 @kindex S-@key{right}
2583 @kindex S-@key{left}
2584 @item S-@key{right}
2585 @itemx S-@key{left}
2586 Select the following/preceding TODO state, similar to cycling.  Mostly
2587 useful if more than two TODO states are possible (@pxref{TODO extensions}).
2588 @kindex C-c C-v
2589 @cindex sparse tree, for TODO
2590 @item C-c C-v
2591 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
2592 the entire buffer, but shows all TODO items and the headings hierarchy
2593 above them.  With prefix arg, search for a specific TODO.  You will be
2594 prompted for the keyword, and you can also give a list of keywords like
2595 @code{kwd1|kwd2|...}.  With numerical prefix N, show the tree for the
2596 Nth keyword in the variable @code{org-todo-keywords}.  With two prefix
2597 args, find all TODO and DONE entries.
2598 @kindex C-c a t
2599 @item C-c a t
2600 Show the global TODO list.  This collects the TODO items from all
2601 agenda files (@pxref{Agenda views}) into a single buffer.  The buffer is in
2602 @code{agenda-mode}, so there are commands to examine and manipulate
2603 the TODO entries directly from that buffer (@pxref{Agenda commands}).
2604 @xref{Global TODO list}, for more information.
2605 @c @item @code{org-agenda-include-all-todo}
2606 @c If you would like to have all your TODO items listed as part of your
2607 @c agenda, customize the variable @code{org-agenda-include-all-todo}.
2608 @end table
2610 @node TODO extensions, Priorities, TODO basics, TODO items
2611 @section Extended use of TODO keywords
2612 @cindex extended TODO keywords
2614 The default implementation of TODO entries is just two states: TODO and
2615 DONE.  You can use the TODO feature for more complicated things by
2616 configuring the variable @code{org-todo-keywords}.  With special setup,
2617 the TODO keyword system can work differently in different files.
2619 Note that @i{tags} are another way to classify headlines in general and
2620 TODO items in particular (@pxref{Tags}).
2622 @menu
2623 * Workflow states::             From TODO to DONE in steps
2624 * TODO types::                  I do this, Fred the rest
2625 * Multiple sets in one file::   Mixing it all, and still finding your way
2626 * Per file keywords::           Different files, different requirements
2627 @end menu
2629 @node Workflow states, TODO types, TODO extensions, TODO extensions
2630 @subsection TODO keywords as workflow states
2631 @cindex TODO workflow
2632 @cindex workflow states as TODO keywords
2634 You can use TODO keywords to indicate different @emph{sequential} states
2635 in the process of working on an item, for example@footnote{Changing
2636 this variable only becomes effective after restarting Org-mode in a
2637 buffer.}:
2639 @lisp
2640 (setq org-todo-keywords
2641   '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
2642 @end lisp
2644 The vertical bar separates the TODO keywords (states that @emph{need
2645 action}) from the DONE states (which need @emph{no further action}.  If
2646 you don't provide the separator bar, the last state is used as the DONE
2647 state.
2648 @cindex completion, of TODO keywords
2649 With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
2650 to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED.  You may
2651 also use a prefix argument to quickly select a specific state.  For
2652 example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
2653 If you define many keywords, you can use in-buffer completion (see
2654 @ref{Completion}) to insert these words into the buffer.  Changing a
2655 todo state can be logged with a timestamp, see @ref{Tracking TODO state
2656 changes} for more information.
2658 @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
2659 @subsection TODO keywords as types
2660 @cindex TODO types
2661 @cindex names as TODO keywords
2662 @cindex types as TODO keywords
2664 The second possibility is to use TODO keywords to indicate different
2665 @emph{types} of action items.  For example, you might want to indicate
2666 that items are for ``work'' or ``home''.  Or, when you work with several
2667 people on a single project, you might want to assign action items
2668 directly to persons, by using their names as TODO keywords.  This would
2669 be set up like this:
2671 @lisp
2672 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
2673 @end lisp
2675 In this case, different keywords do not indicate a sequence, but rather
2676 different types.  So the normal work flow would be to assign a task to a
2677 person, and later to mark it DONE.  Org-mode supports this style by
2678 adapting the workings of the command @kbd{C-c C-t}@footnote{This is also
2679 true for the @kbd{t} command in the timeline and agenda buffers.}.  When
2680 used several times in succession, it will still cycle through all names,
2681 in order to first select the right type for a task.  But when you return
2682 to the item after some time and execute @kbd{C-c C-t} again, it will
2683 switch from any name directly to DONE.  Use prefix arguments or
2684 completion to quickly select a specific name.  You can also review the
2685 items of a specific TODO type in a sparse tree by using a numeric prefix
2686 to @kbd{C-c C-v}.  For example, to see all things Lucy has to do, you
2687 would use @kbd{C-3 C-c C-v}.  To collect Lucy's items from all agenda
2688 files into a single buffer, you would use the prefix arg as well when
2689 creating the global todo list: @kbd{C-3 C-c t}.
2691 @node Multiple sets in one file, Per file keywords, TODO types, TODO extensions
2692 @subsection Multiple keyword sets in one file
2693 @cindex todo keyword sets
2695 Sometimes you may want to use different sets of TODO keywords in
2696 parallel.  For example, you may want to have the basic
2697 @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
2698 separate state indicating that an item has been canceled (so it is not
2699 DONE, but also does not require action).  Your setup would then look
2700 like this:
2702 @lisp
2703 (setq org-todo-keywords
2704       '((sequence "TODO" "|" "DONE")
2705         (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
2706         (sequence "|" "CANCELED")))
2707 @end lisp
2709 The keywords should all be different, this helps Org-mode to keep track
2710 of which subsequence should be used for a given entry.  In this setup,
2711 @kbd{C-c C-t} only operates within a subsequence, so it switches from
2712 @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
2713 (nothing) to @code{REPORT}.  Therefore you need a mechanism to initially
2714 select the correct sequence.  Besides the obvious ways like typing a
2715 keyword or using completion, you may also apply the following commands:
2717 @table @kbd
2718 @kindex C-S-@key{right}
2719 @kindex C-S-@key{left}
2720 @item C-S-@key{right}
2721 @itemx C-S-@key{left}
2722 These keys jump from one TODO subset to the next.  In the above example,
2723 @kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
2724 @code{REPORT}, and any of the words in the second row to @code{CANCELED}.
2725 @kindex S-@key{right}
2726 @kindex S-@key{left}
2727 @item S-@key{right}
2728 @itemx S-@key{left}
2729 @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
2730 @emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
2731 would switch from @code{DONE} to @code{REPORT} in the example above.
2732 @end table
2734 @node Per file keywords,  , Multiple sets in one file, TODO extensions
2735 @subsection Setting up keywords for individual files
2736 @cindex keyword options
2737 @cindex per file keywords
2739 It can be very useful to use different aspects of the TODO mechanism in
2740 different files.  For file-local settings, you need to add special lines
2741 to the file which set the keywords and interpretation for that file
2742 only.  For example, to set one of the two examples discussed above, you
2743 need one of the following lines, starting in column zero anywhere in the
2744 file:
2746 @example
2747 #+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
2748 @end example
2750 @example
2751 #+TYP_TODO: Fred Sara Lucy Mike | DONE
2752 @end example
2754 A setup for using several sets in parallel would be:
2756 @example
2757 #+SEQ_TODO: "TODO" "|" "DONE"
2758 #+SEQ_TODO: "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED"
2759 #+SEQ_TODO: "|" "CANCELED"
2760 @end example
2763 @cindex completion, of option keywords
2764 @kindex M-@key{TAB}
2765 @noindent To make sure you are using the correct keyword, type
2766 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
2768 @cindex DONE, final TODO keyword
2769 Remember that the keywords after the vertical bar (or the last keyword
2770 if no bar is there) must always mean that the item is DONE (although you
2771 may use a different word).  After changing one of these lines, use
2772 @kbd{C-c C-c} with the cursor still in the line to make the changes
2773 known to Org-mode@footnote{Org-mode parses these lines only when
2774 Org-mode is activated after visiting a file.  @kbd{C-c C-c} with the
2775 cursor in a line starting with @samp{#+} is simply restarting Org-mode
2776 for the current buffer.}.
2778 @node Priorities, Breaking down tasks, TODO extensions, TODO items
2779 @section Priorities
2780 @cindex priorities
2782 If you use Org-mode extensively to organize your work, you may end up
2783 with a number of TODO entries so large that you'd like to prioritize
2784 them.  This can be done by placing a @emph{priority cookie} into the
2785 headline, like this
2787 @example
2788 *** TODO [#A] Write letter to Sam Fortune
2789 @end example
2791 @noindent
2792 With its standard setup, Org-mode supports priorities @samp{A},
2793 @samp{B}, and @samp{C}.  @samp{A} is the highest priority.  An entry
2794 without a cookie is treated as priority @samp{B}.  Priorities make a
2795 difference only in the agenda (@pxref{Weekly/Daily agenda}).
2797 @table @kbd
2798 @kindex @kbd{C-c ,}
2799 @item @kbd{C-c ,}
2800 Set the priority of the current headline.  The command prompts for a
2801 priority character @samp{A}, @samp{B} or @samp{C}.  When you press
2802 @key{SPC} instead, the priority cookie is removed from the headline.
2803 The priorities can also be changed ``remotely'' from the timeline and
2804 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
2806 @kindex S-@key{up}
2807 @kindex S-@key{down}
2808 @item S-@key{up}
2809 @itemx S-@key{down}
2810 Increase/decrease priority of current headline.  Note that these keys
2811 are also used to modify time stamps (@pxref{Creating timestamps}).
2812 Furthermore, these keys are also used by CUA-mode (@pxref{Conflicts}).
2813 @end table
2815 @node Breaking down tasks, Checkboxes, Priorities, TODO items
2816 @section Breaking tasks down into subtasks
2817 @cindex tasks, breaking down
2819 It is often advisable to break down large tasks into smaller, manageable
2820 subtasks.  You can do this by creating an outline tree below a TODO
2821 item, with detailed subtasks on the tree@footnote{To keep subtasks out
2822 of the global TODO list, see the
2823 @code{org-agenda-todo-list-sublevels}.}.  Another possibility is the use
2824 of checkboxes to identify (a hierarchy of) a large number of subtasks
2825 (@pxref{Checkboxes}).
2828 @node Checkboxes,  , Breaking down tasks, TODO items
2829 @section Checkboxes
2830 @cindex checkboxes
2832 Every item in a plain list (@pxref{Plain lists}) can be made a checkbox
2833 by starting it with the string @samp{[ ]}.  This feature is similar to
2834 TODO items (@pxref{TODO items}), but more lightweight.  Checkboxes are
2835 not included into the global TODO list, so they are often great to split
2836 a task into a number of simple steps.  Or you can use them in a shopping
2837 list.  To toggle a checkbox, use @kbd{C-c C-c}, or try Piotr Zielinski's
2838 @file{org-mouse.el}.  Here is an example of a checkbox list.
2840 @example
2841 * TODO Organize party [3/6]
2842   - call people [1/3]
2843     - [ ] Peter
2844     - [X] Sarah
2845     - [ ] Sam
2846   - [X] order food
2847   - [ ] think about what music to play
2848   - [X] talk to the neighbors
2849 @end example
2851 @cindex statistics, for checkboxes
2852 @cindex checkbox statistics
2853 The @samp{[3/6]} and @samp{[1/3]} in the first and second line are
2854 cookies indicating how many checkboxes are present in this entry, and
2855 how many of them have been checked off.  This can give you an idea on
2856 how many checkboxes remain, even without opening a folded entry.  The
2857 cookies can be placed into a headline or into (the first line of) a
2858 plain list item. Each cookie covers all checkboxes structurally below
2859 that headline/item.  You have to insert the cookie yourself by typing
2860 either @samp{[/]} or @samp{[%]}.  In the first case you get an @samp{n
2861 out of m} result, in the second case you get information about the
2862 percentage of checkboxes checked (in the above example, this would be
2863 @samp{[50%]} and @samp{[33%], respectively}).
2865 @noindent The following commands work with checkboxes:
2867 @table @kbd
2868 @kindex C-c C-c
2869 @item C-c C-c
2870 Toggle checkbox at point.
2871 @kindex C-c C-x C-b
2872 @item C-c C-x C-b
2873 Toggle checkbox at point.
2874 @itemize @minus
2875 @item
2876 If there is an active region, toggle the first checkbox in the region
2877 and set all remaining boxes to the same status as the first.  If you
2878 want to toggle all boxes in the region independently, use a prefix
2879 argument.
2880 @item
2881 If the cursor is in a headline, toggle checkboxes in the region between
2882 this headline and the next (so @emph{not} the entire subtree).
2883 @item
2884 If there is no active region, just toggle the checkbox at point.
2885 @end itemize
2886 @kindex M-S-@key{RET}
2887 @item M-S-@key{RET}
2888 Insert a new item with a checkbox.
2889 This works only if the cursor is already in a plain list item
2890 (@pxref{Plain lists}).
2891 @kindex C-c #
2892 @item C-c #
2893 Update the checkbox statistics in the current outline entry.  When
2894 called with a @kbd{C-u} prefix, update the entire file.  Checkbox
2895 statistic cookies are updated automatically if you toggle checkboxes
2896 with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}.  If you
2897 delete boxes or add/change them by hand, use this command to get things
2898 back into synch.  Or simply toggle any checkbox twice with @kbd{C-c C-c}.
2899 @end table
2901 @node Timestamps, Tags, TODO items, Top
2902 @chapter Timestamps
2903 @cindex time stamps
2904 @cindex date stamps
2906 Items can be labeled with timestamps to make them useful for project
2907 planning.
2909 @menu
2910 * Time stamps::                 Assigning a time to a tree entry
2911 * Creating timestamps::         Commands which insert timestamps
2912 * Custom time format::          If you cannot work with the ISO format
2913 * Repeating items::             Deadlines that come back again and again
2914 * Progress logging::            Documenting when what work was done.
2915 @end menu
2918 @node Time stamps, Creating timestamps, Timestamps, Timestamps
2919 @section Time stamps, deadlines and scheduling
2920 @cindex time stamps
2921 @cindex ranges, time
2922 @cindex date stamps
2923 @cindex deadlines
2924 @cindex scheduling
2926 A time stamp is a specification of a date (possibly with time) in a
2927 special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16 Tue
2928 09:39>}@footnote{This is the standard ISO date/time format.  If you
2929 cannot get used to these, see @ref{Custom time format}}.  A time stamp
2930 can appear anywhere in the headline or body of an org-tree entry.  Its
2931 presence allows entries to be shown on specific dates in the agenda
2932 (@pxref{Weekly/Daily agenda}).  We distinguish:
2934 @table @var
2935 @item Plain time stamp
2936 @cindex timestamp
2937 A simple time stamp just assigns a date/time to an item.  This is just
2938 like writing down an appointment in a paper agenda, or like writing down
2939 an event in a diary, when you want to take note of when something
2940 happened.  In the timeline and agenda displays, the headline of an entry
2941 associated with a plain time stamp will be shown exactly on that date.
2943 @example
2944 * Meet Peter at the movies <2006-11-01 Wed 19:15>
2945 @end example
2947 @item Inactive time stamp
2948 @cindex timestamp, inactive
2949 @cindex inactive timestamp
2950 Just like a plain time stamp, but with square brackets instead of
2951 angular ones.  These time stamps are inactive in the sense that they do
2952 @emph{not} trigger an entry to show up in the agenda.
2954 @example
2955 * Gillian comes late for the fifth time [2006-11-01 Wed]
2956 @end example
2958 @item Time stamp range
2959 @cindex timerange
2960 Two time stamps connected by @samp{--} denote a time range.  The
2961 headline will be shown on the first and last day of the range, and on
2962 any dates that are displayed and fall in the range.  Here is an
2963 example:
2965 @example
2966 ** Meeting in Amsterdam
2967    <2004-08-23 Mon>--<2004-08-26 Thu>
2968 @end example
2970 @item Time stamp with SCHEDULED keyword
2971 @cindex SCHEDULED keyword
2972 If a time stamp is preceded by the word @samp{SCHEDULED:}, it means you
2973 are planning to start working on that task on the given date. So this is
2974 not about recording an event, but about planning your work.  The
2975 headline will be listed under the given date@footnote{It will still be
2976 listed on that date after it has been marked DONE.  If you don't like
2977 this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
2978 addition, a reminder that the scheduled date has passed will be present
2979 in the compilation for @emph{today}, until the entry is marked DONE.
2980 I.e., the task will automatically be forwarded until completed.
2982 @example
2983 *** TODO Call Trillian for a date on New Years Eve.
2984     SCHEDULED: <2004-12-25 Sat>
2985 @end example
2987 @item Time stamp with DEADLINE keyword
2988 @cindex DEADLINE keyword
2989 If a time stamp is preceded by the word @samp{DEADLINE:}, the task
2990 (most likely a TODO item) is supposed to be finished on that date, and
2991 it will be listed then.  In addition, the compilation for @emph{today}
2992 will carry a warning about the approaching or missed deadline,
2993 starting @code{org-deadline-warning-days} before the due date, and
2994 continuing until the entry is marked DONE.  An example:
2996 @example
2997 *** TODO write article about the Earth for the Guide
2998     The editor in charge is [[bbdb:Ford Prefect]]
2999     DEADLINE: <2004-02-29 Sun>
3000 @end example
3001 @item Time stamp with CLOSED keyword
3002 @cindex CLOSED keyword
3003 When @code{org-log-done} is non-nil, Org-mode will automatically insert
3004 a special time stamp each time a TODO entry is marked done
3005 (@pxref{Progress logging}).  This time stamp is enclosed in square
3006 brackets instead of angular brackets.
3008 @item Time range with CLOCK keyword
3009 @cindex CLOCK keyword
3010 When using the clock to time the work that is being done on specific
3011 items, time ranges preceded by the CLOCK keyword are inserted
3012 automatically into the file.  The time stamps are enclosed in square
3013 brackets instead of angular brackets.  @xref{Clocking work time}.
3014 @end table
3016 @node Creating timestamps, Custom time format, Time stamps, Timestamps
3017 @section Creating timestamps
3018 @cindex creating timestamps
3019 @cindex timestamps, creating
3021 For Org-mode to recognize time stamps, they need to be in the specific
3022 format.  All commands listed below produce time stamps in the correct
3023 format.
3025 @table @kbd
3026 @kindex C-c .
3027 @item C-c .
3028 Prompt for a date and insert a corresponding time stamp.  When the
3029 cursor is at a previously used time stamp, it is updated to NOW.  When
3030 this command is used twice in succession, a time range is inserted.
3032 @kindex C-u C-c .
3033 @item C-u C-c .
3034 Like @kbd{C-c .}, but use the alternative format which contains date
3035 and time.  The default time can be rounded to multiples of 5 minutes,
3036 see the option @code{org-time-stamp-rounding-minutes}.
3038 @kindex C-c !
3039 @item C-c !
3040 Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
3041 an agenda entry.
3043 @kindex C-c <
3044 @item C-c <
3045 Insert a time stamp corresponding to the cursor date in the Calendar.
3047 @kindex C-c >
3048 @item C-c >
3049 Access the Emacs calendar for the current date.  If there is a
3050 timestamp in the current line, goto the corresponding date
3051 instead.
3053 @kindex C-c C-o
3054 @item C-c C-o
3055 Access the agenda for the date given by the time stamp or -range at
3056 point (@pxref{Weekly/Daily agenda}).
3058 @kindex C-c C-d
3059 @item C-c C-d
3060 Insert @samp{DEADLINE} keyword along with a stamp.  The insertion will
3061 happen in the line directly following the headline.  
3062 @c FIXME Any CLOSED timestamp will be removed.????????
3064 @kindex C-c C-w
3065 @cindex sparse tree, for deadlines
3066 @item C-c C-w
3067 Create a sparse tree with all deadlines that are either past-due, or
3068 which will become due within @code{org-deadline-warning-days}.
3069 With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
3070 prefix, check that many days.  For example, @kbd{C-1 C-c C-w} shows
3071 all deadlines due tomorrow.
3073 @kindex C-c C-s
3074 @item C-c C-s
3075 Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
3076 happen in the line directly following the headline.  Any CLOSED
3077 timestamp will be removed.
3079 @kindex S-@key{left}
3080 @kindex S-@key{right}
3081 @item S-@key{left}
3082 @itemx S-@key{right}
3083 Change date at cursor by one day.  These key bindings conflict with
3084 CUA-mode (@pxref{Conflicts}).
3086 @kindex S-@key{up}
3087 @kindex S-@key{down}
3088 @item S-@key{up}
3089 @itemx S-@key{down}
3090 Change the item under the cursor in a timestamp.  The cursor can be on a
3091 year, month, day, hour or minute.  Note that if the cursor is in a
3092 headline and not at a time stamp, these same keys modify the priority of
3093 an item.  (@pxref{Priorities}). The key bindings also conflict with
3094 CUA-mode (@pxref{Conflicts}).
3096 @kindex C-c C-y
3097 @cindex evaluate time range
3098 @item C-c C-y
3099 Evaluate a time range by computing the difference between start and
3100 end.  With prefix arg, insert result after the time range (in a table:
3101 into the following column).
3102 @end table
3105 @menu
3106 * The date/time prompt::        How org-mode helps you entering date and time
3107 @end menu
3109 @node The date/time prompt,  , Creating timestamps, Creating timestamps
3110 @subsection The date/time prompt
3111 @cindex date, reading in minibuffer
3112 @cindex time, reading in minibuffer
3114 When Org-mode prompts for a date/time, the prompt suggests to enter an
3115 ISO date.  But it will in fact accept any string containing some date
3116 and/or time information.  You can, for example, use @kbd{C-y} to paste a
3117 (possibly multi-line) string copied from an email message.  Org-mode
3118 will find whatever information is in there and will replace anything not
3119 specified with the current date and time.  For example:
3121 @example
3122   3-2-5         --> 2003-02-05
3123   feb 15        --> currentyear-02-15
3124   sep 12 9      --> 2009-09-12
3125   12:45         --> today 12:45
3126   22 sept 0:34  --> currentyear-09-22 0:34
3127   12            --> currentyear-currentmonth-12
3128   Fri           --> nearest Friday (today or later)
3129   +4            --> 4 days from now (if +N is the only thing given)
3130 @end example
3132 The function understands English month and weekday abbreviations.  If
3133 you want to use unabbreviated names and/or other languages, configure
3134 the variables @code{parse-time-months} and @code{parse-time-weekdays}.
3136 @cindex calendar, for selecting date
3137 Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
3138 you don't need/want the calendar, configure the variable
3139 @code{org-popup-calendar-for-date-prompt}.}.  When you exit the date
3140 prompt, either by clicking on a date in the calendar, or by pressing
3141 @key{RET}, the date selected in the calendar will be combined with the
3142 information entered at the prompt.  You can control the calendar fully
3143 from the minibuffer:
3145 @table @kbd
3146 @kindex <
3147 @item <
3148 Scroll calendar backwards by one month.
3149 @kindex >
3150 @item >
3151 Scroll calendar forwards by one month.
3152 @kindex mouse-1
3153 @item mouse-1
3154 Select date by clicking on it.
3155 @kindex S-@key{right}
3156 @item S-@key{right}
3157 One day forward.
3158 @kindex S-@key{left}
3159 @item S-@key{left}
3160 One day back.
3161 @kindex S-@key{down}
3162 @item S-@key{down}
3163 One week forward.
3164 @kindex S-@key{up}
3165 @item S-@key{up}
3166 One week back.
3167 @kindex M-S-@key{right}
3168 @item M-S-@key{right}
3169 One month forward.
3170 @kindex M-S-@key{left}
3171 @item M-S-@key{left}
3172 One month back.
3173 @kindex @key{RET}
3174 @item @key{RET}
3175 Choose date in calendar (only if nothing was typed into minibuffer).
3176 @end table
3178 @node Custom time format, Repeating items, Creating timestamps, Timestamps
3179 @section Custom time format
3180 @cindex custom date/time format
3181 @cindex time format, custom
3182 @cindex date format, custom
3184 Org-mode uses the standard ISO notation for dates and times as it is
3185 defined in ISO 8601.  If you cannot get used to this and require another
3186 representation of date and time to keep you happy, you can get it by
3187 customizing the variables @code{org-display-custom-times} and
3188 @code{org-time-stamp-custom-formats}.
3190 @table @kbd
3191 @kindex C-c C-x C-t
3192 @item C-c C-x C-t
3193 Toggle the display of custom formats for dates and times.
3194 @end table
3196 @noindent
3197 Org-mode needs the default format for scanning, so the custom date/time
3198 format does not @emph{replace} the default format - instead it is put
3199 @emph{over} the default format using text properties.  This has the
3200 following consequences:
3201 @itemize @bullet
3202 @item 
3203 You cannot place the cursor onto a time stamp anymore, only before or
3204 after.
3205 @item
3206 The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
3207 each component of a time stamp.  If the cursor is at the beginning of
3208 the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
3209 just like @kbd{S-@key{left}/@key{right}}.  At the end of the stamp, the
3210 time will be changed by one minute.
3211 @item
3212 When you delete a time stamp character-by-character, it will only
3213 disappear from the buffer after @emph{all} (invisible) characters
3214 belonging to the ISO timestamp have been removed.
3215 @item
3216 If the custom time stamp format is longer than the default and you are
3217 using dates in tables, table alignment will be messed up.  If the custom
3218 format is shorter, things do work as expected.
3219 @end itemize
3221 @node Repeating items, Progress logging, Custom time format, Timestamps
3222 @section Repeating items
3223 @cindex TODO items, repeating
3224 @cindex deadlines, repeating
3225 @cindex scheduling, repeating
3227 Org-mode integrates with the Emacs calendar and diary to display cyclic
3228 appointments, anniversaries and other special entries in the agenda
3229 (@pxref{Weekly/Daily agenda}).  However, it can be useful to have
3230 certain deadlines and scheduling items to auto-repeat.  The advantage of
3231 a deadline or scheduled item is that the they produce warnings ahead of
3232 time and automatically forward themselves in the agenda until they are
3233 done.  The abstract difference is therefore between cyclic
3234 @i{appointments} and cyclic @i{action items}.  For appointments you
3235 should use the diary, for actions you can uses an org-mode deadline or
3236 scheduling time stamp together with a REPEAT cookie.  For example:
3238 @example
3239 * TODO Replace batteries in smoke detector REPEAT(+18m)
3240   SCHEDULED: <2007-01-01 Mon>
3242 * TODO Get dentist appointment REPEAT(+6m)
3243   SCHEDULED: <2006-12-19 Tue>
3245 * TODO Tax report to IRS REPEAT(+1y)
3246   DEADLINE: <2007-04-01 Sun>
3247 @end example
3249 Each time you try to mark one of these entries DONE using @kbd{C-c C-t},
3250 they will automatically switch back to the state TODO, and the
3251 deadline/scheduling will be shifted accordingly.  The time units
3252 recognized by org-mode are year (y), month (m), week (w), and day (d).
3253 Org-mode will also prompt you for a note and record the fact that you
3254 have closed this item in a note under the headline.
3256 One unusual property of these repeating items is that only one instance
3257 of each exist at any given time.  So if you look back or ahead in the
3258 agenda, you will not find past and future instances, only the current
3259 one will show up.  Use a cyclic diary entry if you need all past and
3260 future instances to be visible in the agenda.
3262 @c FIXME: Document that a note is always being taken.
3264 @node Progress logging,  , Repeating items, Timestamps
3265 @section Progress Logging
3266 @cindex progress logging
3267 @cindex logging, of progress
3269 Org-mode can automatically record a time stamp when you mark a TODO item
3270 as DONE, or even each time when you change the state of a TODO item.
3271 You can also measure precisely the time you spent on specific items in a
3272 project by starting and stopping a clock when you start and stop working
3273 on an aspect of a project.
3275 @menu
3276 * Closing items::               When was this entry marked DONE?
3277 * Tracking TODO state changes::  When did the status change?
3278 * Clocking work time::          When exactly did you work on this item?
3279 @end menu
3281 @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
3282 @subsection Closing items
3284 If you want to keep track of @emph{when} a certain TODO item was
3285 finished, turn on logging with@footnote{The corresponding in-buffer
3286 setting is: @code{#+STARTUP: logdone}}
3288 @lisp
3289 (setq org-log-done t)
3290 @end lisp
3292 @noindent
3293 Then each time you turn a TODO entry into DONE using either @kbd{C-c
3294 C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line
3295 @samp{CLOSED: [timestamp]} will be inserted just after the headline.  If
3296 you turn the entry back into a TODO item through further state cycling,
3297 that line will be removed again.  In the timeline (@pxref{Timeline}) and
3298 in the agenda (@pxref{Weekly/Daily agenda}), you can then use the
3299 @kbd{l} key to display the TODO items closed on each day, giving you an
3300 overview of what has been done on a day.  If you want to record a note
3301 along with the timestamp, use@footnote{The corresponding in-buffer
3302 setting is: @code{#+STARTUP: lognotedone}}
3304 @lisp
3305 (setq org-log-done '(done))
3306 @end lisp
3308 @node Tracking TODO state changes, Clocking work time, Closing items, Progress logging
3309 @subsection Tracking TODO state changes
3311 When TODO keywords are used as workflow states (@pxref{Workflow
3312 states}), you might want to keep track of when a state change occurred,
3313 and you may even want to attach notes to that state change.  With the
3314 setting
3316 @lisp
3317 (setq org-log-done '(state))
3318 @end lisp
3320 @noindent
3321 each state change will prompt you for a note that will be attached to
3322 the current headline.  Very likely you do not want this verbose tracking
3323 all the time, so it is probably better to configure this behavior with
3324 in-buffer options.  For example, if you are tracking purchases, put
3325 these into a separate file that starts with:
3327 @example
3328 #+SEQ_TODO: TODO ORDERED INVOICE PAYED RECEIVED SENT
3329 #+STARTUP: lognotestate
3330 @end example
3332 @node Clocking work time,  , Tracking TODO state changes, Progress logging
3333 @subsection Clocking work time
3335 Org-mode allows you to clock the time you spent on specific tasks in a
3336 project.  When you start working on an item, you can start the clock.
3337 When you stop working on that task, or when you mark the task done, the
3338 clock is stopped and the corresponding time interval is recorded.  It
3339 also computes the total time spent on each subtree of a project.
3341 @table @kbd
3342 @kindex C-c C-x C-i
3343 @item C-c C-x C-i
3344 Start the clock on the current item (clock-in).  This inserts the CLOCK
3345 keyword together with a timestamp.
3346 @kindex C-c C-x C-o
3347 @item C-c C-x C-o
3348 Stop the clock (clock-out).  The inserts another timestamp at the same
3349 location where the clock was last started.  It also directly computes
3350 the resulting time in inserts it after the time range as @samp{=>
3351 HH:MM}.  See the variable @code{org-log-done} for the possibility to
3352 record an additional note together with the clock-out time
3353 stamp@footnote{The corresponding in-buffer setting is: @code{#+STARTUP:
3354 lognoteclock-out}}.
3355 @kindex C-c C-y
3356 @item C-c C-y
3357 Recompute the time interval after changing one of the time stamps.  This
3358 is only necessary if you edit the time stamps directly.  If you change
3359 them with @kbd{S-@key{cursor}} keys, the update is automatic.
3360 @kindex C-c C-t
3361 @item C-c C-t
3362 Changing the TODO state of an item to DONE automatically stops the clock
3363 if it is running in this same item.
3364 @kindex C-c C-x C-x
3365 @item C-c C-x C-x
3366 Cancel the current clock.  This is useful if a clock was started by
3367 mistake, or if you ended up working on something else.
3368 @kindex C-c C-x C-d
3369 @item C-c C-x C-d
3370 Display time summaries for each subtree in the current buffer.  This
3371 puts overlays at the end of each headline, showing the total time
3372 recorded under that heading, including the time of any subheadings. You
3373 can use visibility cycling to study the tree, but the overlays disappear
3374 when you change the buffer (see variable
3375 @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
3376 @kindex C-c C-x C-r
3377 @item C-c C-x C-r
3378 Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
3379 report as an org-mode table into the current file.
3380 @example
3381 #+BEGIN: clocktable :maxlevel 2 :emphasize nil
3383 #+END: clocktable
3384 @end example
3385 @noindent
3386 If such a block already exists, its content is replaced by the new
3387 table.  The @samp{BEGIN} line can specify options:
3388 @example
3389 :maxlevels   @r{Maximum level depth to which times are listed in the table.}
3390 :emphasize   @r{When @code{t}, emphasize level one and level two items}
3391 :block       @r{The time block to consider.  This block is specified relative}
3392              @r{to the current time and may be any of these keywords:}
3393              @r{@code{today}, @code{yesterday}, @code{thisweek}, @code{lastweek},}
3394              @r{@code{thismonth}, @code{lastmonth}, @code{thisyear}, or @code{lastyear}}.
3395 :tstart      @r{A time string specifying when to start considering times}
3396 :tend        @r{A time string specifying when to stop considering times}
3397 @end example
3398 So to get a clock summary for the current day, you could write
3399 @example
3400 #+BEGIN: clocktable :maxlevel 2 :block today
3402 #+END: clocktable
3403 @end example
3404 and to use a specific time range you could write@footnote{Note that all
3405 parameters must be specified in a single line - the line is broken here
3406 only to fit it onto the manual.}
3407 @example
3408 #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>" 
3409                     :tend "<2006-08-10 Thu 12:00>"
3411 #+END: clocktable
3412 @end example
3413 @kindex C-u C-c C-x C-u
3414 @item C-u C-c C-x C-u
3415 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
3416 you have several clocktable blocks in a buffer.
3417 @end table
3419 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
3420 the agenda (@pxref{Weekly/Daily agenda}) to show which tasks have been
3421 worked on or closed during a day.
3423 @node Tags, Agenda views, Timestamps, Top
3424 @chapter Tags
3425 @cindex tags
3426 @cindex headline tagging
3427 @cindex matching, tags
3428 @cindex sparse tree, tag based
3430 If you wish to implement a system of labels and contexts for
3431 cross-correlating information, an excellent way is to assign @i{tags} to
3432 headlines.  Org-mode has extensive support for using tags.
3434 Every headline can contain a list of tags, at the end of the headline.
3435 Tags are normal words containing letters, numbers, @samp{_}, and
3436 @samp{@@}.  Tags must be preceded and followed by a single colon; like
3437 @samp{:WORK:}.  Several tags can be specified like @samp{:WORK:URGENT:}.
3439 @menu
3440 * Tag inheritance::             Tags use the tree structure of the outline
3441 * Setting tags::                How to assign tags to a headline
3442 * Tag searches::                Searching for combinations of tags
3443 @end menu
3445 @node Tag inheritance, Setting tags, Tags, Tags
3446 @section Tag inheritance
3447 @cindex inheritance, of tags
3448 @cindex sublevels, inclusion into tags match
3450 @i{Tags} make use of the hierarchical structure of outline trees.  If a
3451 heading has a certain tag, all subheadings will inherit the tag as
3452 well.  For example, in the list
3454 @example
3455 * Meeting with the French group      :WORK:
3456 ** Summary by Frank                  :BOSS:NOTES:
3457 *** TODO Prepare slides for him      :ACTION:
3458 @end example
3460 @noindent
3461 the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
3462 @samp{:NOTES:}, and @samp{:ACTION:}.  When executing tag searches and
3463 Org-mode finds that a certain headline matches the search criterion, it
3464 will not check any sublevel headline, assuming that these likely also
3465 match, and that the list of matches can become very long.  This may
3466 not be what you want, however, and you can influence inheritance and
3467 searching using the variables @code{org-use-tag-inheritance} and
3468 @code{org-tags-match-list-sublevels}.
3470 @node Setting tags, Tag searches, Tag inheritance, Tags
3471 @section Setting tags
3472 @cindex setting tags
3473 @cindex tags, setting
3475 @kindex M-@key{TAB}
3476 Tags can simply be typed into the buffer at the end of a headline.
3477 After a colon, @kbd{M-@key{TAB}} offers completion on tags.  There is
3478 also a special command for inserting tags:
3480 @table @kbd
3481 @kindex C-c C-c
3482 @item C-c C-c
3483 @cindex completion, of tags
3484 Enter new tags for the current headline.  Org-mode will either offer
3485 completion or a special single-key interface for setting tags, see
3486 below.  After pressing @key{RET}, the tags will be inserted and aligned
3487 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
3488 tags in the current buffer will be aligned to that column, just to make
3489 things look nice.  TAGS are automatically realigned after promotion,
3490 demotion, and TODO state changes (@pxref{TODO basics}).
3491 @end table
3493 Org will support tag insertion based on a @emph{list of tags}.  By
3494 default this list is constructed dynamically, containing all tags
3495 currently used in the buffer.  You may also globally specify a hard list
3496 of tags with the variable @code{org-tag-alist}.  Finally you can set
3497 the default tags for a given file with lines like
3499 @example
3500 #+TAGS: @@WORK @@HOME @@TENNISCLUB
3501 #+TAGS: Laptop Car PC Sailboat
3502 @end example
3504 If you have globally defined your preferred set of tags using the
3505 variable @code{org-tag-alist}, but would like to use a dynamic tag list
3506 in a specific file: Just add an empty TAGS option line to that file:
3508 @example
3509 #+TAGS:
3510 @end example
3512 The default support method for entering tags is minibuffer completion.
3513 However, Org-mode also implements a much better method: @emph{fast tag
3514 selection}.  This method allows to select and deselect tags with a
3515 single key per tag.  To function efficiently, you should assign unique
3516 keys to most tags.  This can be done globally with
3518 @lisp
3519 (setq org-tag-alist '(("@@WORK" . ?w) ("@@HOME" . ?h) ("Laptop" . ?l)))
3520 @end lisp
3522 @noindent or on a per-file basis with
3524 @example
3525 #+TAGS: @@WORK(w)  @@HOME(h)  @@TENNISCLUB(t)  Laptop(l)  PC(p)
3526 @end example
3528 @noindent
3529 You can also group together tags that are mutually exclusive.  With
3530 curly braces@footnote{In @code{org-mode-alist} use
3531 @code{'(:startgroup)} and @code{'(:endgroup)}, respectively.  Several
3532 groups are allowed.}
3534 @example
3535 #+TAGS: @{ @@WORK(w)  @@HOME(h)  @@TENNISCLUB(t) @}  Laptop(l)  PC(p)
3536 @end example
3538 @noindent you indicate that at most one of @samp{@@WORK}, @samp{@@HOME},
3539 and @samp{@@TENNISCLUB} should be selected.
3541 @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
3542 these lines to activate any changes.
3544 If at least one tag has a selection key, pressing @kbd{C-c C-c} will
3545 automatically present you with a special interface, listing inherited
3546 tags, the tags of the current headline, and a list of all legal tags
3547 with corresponding keys@footnote{Keys will automatically be assigned to
3548 tags which have no configured keys.}.  In this interface, you can use
3549 the following keys:
3551 @table @kbd
3552 @item a-z...
3553 Pressing keys assigned to tags will add or remove them from the list of
3554 tags in the current line.  Selecting a tag in a group of mutually
3555 exclusive tags will turn off any other tags from that group.
3556 @kindex @key{TAB}
3557 @item @key{TAB}
3558 Enter a tag in the minibuffer, even if the tag is not in the predefined
3559 list.  You will be able to complete on all tags present in the buffer.
3560 @kindex @key{SPC}
3561 @item @key{SPC}
3562 Clear all tags for this line.
3563 @kindex @key{RET}
3564 @item @key{RET}
3565 Accept the modified set.
3566 @item C-g
3567 Abort without installing changes.
3568 @item q
3569 If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
3570 @item !
3571 Turn off groups of mutually exclusive tags.  Use this to (as an
3572 exception) assign several tags from such a group.
3573 @item C-c
3574 Toggle auto-exit after the next change (see below).
3575 If you are using expert mode, the first @kbd{C-c} will display the
3576 selection window.
3577 @end table
3579 @noindent
3580 This method lets you assign tags to a headline with very few keys.  With
3581 the above setup, you could clear the current tags and set @samp{@@HOME},
3582 @samp{Laptop} and @samp{PC} tags with just the following keys: @kbd{C-c
3583 C-c @key{SPC} h l p @key{RET}}.  Switching from @samp{@@HOME} to
3584 @samp{@@WORK} would be done with @kbd{C-c C-c w @key{RET}} or
3585 alternatively with @kbd{C-c C-c C-c w}.  Adding the non-predefined tag
3586 @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
3587 @key{RET} @key{RET}}.
3589 If you find that most of the time, you need only a single keypress to
3590 modify your list of tags, set the variable
3591 @code{org-fast-tag-selection-single-key}.  Then you no longer have to
3592 press @key{RET} to exit fast tag selection - it will immediately exit
3593 after the first change.  If you then occasionally need more keys, press
3594 @kbd{C-c} to turn off auto-exit for the current tag selection process
3595 (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
3596 C-c}).  If you set the variable to the value @code{expert}, the special
3597 window is not even shown for single-key tag selection, it comes up only
3598 when you press an extra @kbd{C-c}.
3600 @node Tag searches,  , Setting tags, Tags
3601 @section Tag searches
3602 @cindex tag searches
3603 @cindex searching for tags
3605 Once a tags system has been set up, it can be used to collect related
3606 information into special lists.
3608 @table @kbd
3609 @kindex C-c \
3610 @item C-c \
3611 Create a sparse tree with all headlines matching a tags search.  With a
3612 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
3613 @kindex C-c a m
3614 @item C-c a m
3615 Create a global list of tag matches from all agenda files.
3616 @xref{Matching headline tags}.
3617 @kindex C-c a M
3618 @item C-c a M
3619 Create a global list of tag matches from all agenda files, but check
3620 only TODO items and force checking subitems (see variable
3621 @code{org-tags-match-list-sublevels}).
3622 @end table
3624 @cindex Boolean logic, for tag searches
3625 A @i{tags} search string can use Boolean operators @samp{&} for AND and
3626 @samp{|} for OR.  @samp{&} binds more strongly than @samp{|}.
3627 Parenthesis are currently not implemented.  A tag may also be preceded
3628 by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
3629 positive selection.  The AND operator @samp{&} is optional when @samp{+}
3630 or @samp{-} is present.  Examples:
3632 @table @samp
3633 @item +WORK-BOSS
3634 Select headlines tagged @samp{:WORK:}, but discard those also tagged
3635 @samp{:BOSS:}.
3636 @item WORK|LAPTOP
3637 Selects lines tagged @samp{:WORK:} or @samp{:LAPTOP:}.
3638 @item WORK|LAPTOP&NIGHT
3639 Like before, but require the @samp{:LAPTOP:} lines to be tagged also
3640 @samp{NIGHT}.
3641 @end table
3643 @cindex TODO keyword matching, with tags search
3644 If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
3645 can be useful to also match on the TODO keyword.  This can be done by
3646 adding a condition after a slash to a tags match.  The syntax is similar
3647 to the tag matches, but should be applied with consideration: For
3648 example, a positive selection on several TODO keywords can not
3649 meaningfully be combined with boolean AND.  However, @emph{negative
3650 selection} combined with AND can be meaningful.  To make sure that only
3651 lines are checked that actually have any TODO keyword, use @kbd{C-c a
3652 M}, or equivalently start the todo part after the slash with @samp{!}.
3653 Examples:
3655 @table @samp
3656 @item WORK/WAITING
3657 Select @samp{:WORK:}-tagged TODO lines with the specific TODO
3658 keyword @samp{WAITING}.
3659 @item WORK/!-WAITING-NEXT
3660 Select @samp{:WORK:}-tagged TODO lines that are neither @samp{WAITING}
3661 nor @samp{NEXT}
3662 @item WORK/+WAITING|+NEXT
3663 Select @samp{:WORK:}-tagged TODO lines that are either @samp{WAITING} or
3664 @samp{NEXT}.
3665 @end table
3667 @cindex regular expressions, with tags search
3668 Any element of the tag/todo match can be a regular expression - in this
3669 case it must be enclosed in curly braces.  For example,
3670 @samp{WORK+@{^BOSS.*@}} matches headlines that contain the tag
3671 @samp{WORK} and any tag @i{starting} with @samp{BOSS}.
3673 @cindex level, require for tags match
3674 You can also require a headline to be of a certain level, by writing
3675 instead of any TAG an expression like @samp{LEVEL=3}.  For example, a
3676 search @samp{+LEVEL=3+BOSS/-DONE} lists all level three headlines that
3677 have the tag BOSS and are @emph{not} marked with the todo keyword DONE.
3679 @node Agenda views, Embedded LaTeX, Tags, Top
3680 @chapter Agenda Views
3681 @cindex agenda views
3683 Due to the way Org-mode works, TODO items, time-stamped items, and
3684 tagged headlines can be scattered throughout a file or even a number of
3685 files.  To get an overview over open action items, or over events that
3686 are important for a particular date, this information must be collected,
3687 sorted and displayed in an organized way.
3689 Org-mode can select items based on various criteria, and display them
3690 in a separate buffer.  Six different view types are provided:
3692 @itemize @bullet
3693 @item
3694 an @emph{agenda} that is like a calendar and shows information
3695 for specific dates,
3696 @item
3697 a @emph{TODO list} that covers all unfinished
3698 action items,
3699 @item
3700 a @emph{tags view}, showings headlines based on
3701 the tags associated with them,
3702 @item
3703 a @emph{timeline view} that shows all events in a single Org-mode file,
3704 in time-sorted view,
3705 @item
3706 a @emph{stuck projects view} showing projects that currently don't move
3707 along, and
3708 @item
3709 @emph{custom views} that are special tag/keyword searches and
3710 combinations of different views.
3711 @end itemize
3713 @noindent
3714 The extracted information is displayed in a special @emph{agenda
3715 buffer}.  This buffer is read-only, but provides commands to visit the
3716 corresponding locations in the original Org-mode files, and even to
3717 edit these files remotely.  
3719 Two variables control how the agenda buffer is displayed and whether the
3720 window configuration is restored when the agenda exits:
3721 @code{org-agenda-window-setup} and
3722 @code{org-agenda-restore-windows-after-quit}.
3724 @menu
3725 * Agenda files::                Files being searched for agenda information
3726 * Agenda dispatcher::           Keyboard access to agenda views
3727 * Built-in agenda views::       What is available out of the box?
3728 * Presentation and sorting::    How agenda items are prepared for display
3729 * Agenda commands::             Remote editing of org trees
3730 * Custom agenda views::         Defining special searches and views
3731 @end menu
3733 @node Agenda files, Agenda dispatcher, Agenda views, Agenda views
3734 @section Agenda files
3735 @cindex agenda files
3736 @cindex files for agenda
3738 The information to be shown is collected from all @emph{agenda files},
3739 the files listed in the variable @code{org-agenda-files}@footnote{If the
3740 value of that variable is not a list, but a single file name, then the
3741 list of agenda files will be maintained in that external file.}.  Thus even
3742 if you only work with a single Org-mode file, this file should be put
3743 into that list@footnote{When using the dispatcher, pressing @kbd{1}
3744 before selecting a command will actually limit the command to the
3745 current file, and ignore @code{org-agenda-files} until the next
3746 dispatcher command.}.  You can customize @code{org-agenda-files}, but
3747 the easiest way to maintain it is through the following commands
3749 @cindex files, adding to agenda list
3750 @table @kbd
3751 @kindex C-c [
3752 @item C-c [
3753 Add current file to the list of agenda files.  The file is added to
3754 the front of the list.  If it was already in the list, it is moved to
3755 the front.  With prefix arg, file is added/moved to the end.
3756 @kindex C-c ]
3757 @item C-c ]
3758 Remove current file from the list of agenda files.
3759 @kindex C-,
3760 @kindex C-'
3761 @item C-,
3762 @itemx C-'
3763 Cycle through agenda file list, visiting one file after the other.
3764 @end table
3766 @noindent
3767 The Org menu contains the current list of files and can be used
3768 to visit any of them.
3770 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda views
3771 @section The agenda dispatcher
3772 @cindex agenda dispatcher
3773 @cindex dispatching agenda commands
3774 The views are created through a dispatcher that should be bound to a
3775 global key, for example @kbd{C-c a} (@pxref{Installation}).  In the
3776 following we will assume that @kbd{C-c a} is indeed how the dispatcher
3777 is accessed and list keyboard access to commands accordingly.  After
3778 pressing @kbd{C-c a}, an additional letter is required to execute a
3779 command.  The dispatcher offers the following default commands:
3780 @table @kbd
3781 @item a
3782 Create the calendar-like agenda (@pxref{Weekly/Daily agenda}).
3783 @item t @r{/} T
3784 Create a list of all TODO items (@pxref{Global TODO list}).
3785 @item m @r{/} M
3786 Create a list of headlines matching a TAGS expression (@pxref{Matching
3787 headline tags}).
3788 @item L
3789 Create the timeline view for the current buffer (@pxref{Timeline}).
3790 @item # @r{/} !
3791 Create a list of stuck projects (@pxref{Stuck projects}).
3792 @item 1
3793 Restrict an agenda command to the current buffer.  After pressing
3794 @kbd{1}, you still need to press the character selecting the command.
3795 @item 0
3796 If there is an active region, restrict the following agenda command to
3797 the region.  Otherwise, restrict it to the current subtree.  After
3798 pressing @kbd{0}, you still need to press the character selecting the
3799 command.
3800 @end table
3802 You can also define custom commands that will be accessible through the
3803 dispatcher, just like the default commands.  This includes the
3804 possibility to create extended agenda buffers that contain several
3805 blocks together, for example the weekly agenda, the global TODO list and
3806 a number of special tags matches.  @xref{Custom agenda views}.
3808 @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda views
3809 @section The built-in agenda views
3811 In this section we describe the built-in views.
3813 @menu
3814 * Weekly/Daily agenda::         The calendar page with current tasks
3815 * Global TODO list::            All unfinished action items
3816 * Matching headline tags::      Structured information with fine-tuned search
3817 * Timeline::                    Time-sorted view for single file
3818 * Stuck projects::              Find projects you need to review
3819 @end menu
3821 @node Weekly/Daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
3822 @subsection The weekly/daily agenda
3823 @cindex agenda
3824 @cindex weekly agenda
3825 @cindex daily agenda
3827 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
3828 paper agenda, showing all the tasks for the current week or day.
3830 @table @kbd
3831 @cindex org-agenda, command
3832 @kindex C-c a a
3833 @item C-c a a
3834 Compile an agenda for the current week from a list of org files.  The
3835 agenda shows the entries for each day.  With a @kbd{C-u} prefix (or
3836 when the variable @code{org-agenda-include-all-todo} is @code{t}), all
3837 unfinished TODO items (including those without a date) are also listed at
3838 the beginning of the buffer, before the first date.@*
3839 @end table
3841 Remote editing from the agenda buffer means, for example, that you can
3842 change the dates of deadlines and appointments from the agenda buffer.
3843 The commands available in the Agenda buffer are listed in @ref{Agenda
3844 commands}.
3846 @subsubheading Calendar/Diary integration
3847 @cindex calendar integration
3848 @cindex diary integration
3850 Emacs contains the calendar and diary by Edward M. Reingold.  The
3851 calendar displays a three-month calendar with holidays from different
3852 countries and cultures.  The diary allows you to keep track of
3853 anniversaries, lunar phases, sunrise/set, recurrent appointments
3854 (weekly, monthly) and more.  In this way, it is quite complementary to
3855 Org-mode.  It can be very useful to combine output from Org-mode with
3856 the diary.
3858 In order to include entries from the Emacs diary into Org-mode's
3859 agenda, you only need to customize the variable
3861 @lisp
3862 (setq org-agenda-include-diary t)
3863 @end lisp
3865 @noindent After that, everything will happen automatically.  All diary
3866 entries including holidays, anniversaries etc will be included in the
3867 agenda buffer created by Org-mode.  @key{SPC}, @key{TAB}, and
3868 @key{RET} can be used from the agenda buffer to jump to the diary
3869 file in order to edit existing diary entries.  The @kbd{i} command to
3870 insert new entries for the current date works in the agenda buffer, as
3871 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
3872 Sunrise/Sunset times, show lunar phases and to convert to other
3873 calendars, respectively.  @kbd{c} can be used to switch back and forth
3874 between calendar and agenda.
3877 @node Global TODO list, Matching headline tags, Weekly/Daily agenda, Built-in agenda views
3878 @subsection The global TODO list
3879 @cindex global TODO list
3880 @cindex TODO list, global
3882 The global TODO list contains all unfinished TODO items, formatted and
3883 collected into a single place.
3885 @table @kbd
3886 @kindex C-c a t
3887 @item C-c a t
3888 Show the global TODO list.  This collects the TODO items from all
3889 agenda files (@pxref{Agenda views}) into a single buffer.  The buffer is in
3890 @code{agenda-mode}, so there are commands to examine and manipulate
3891 the TODO entries directly from that buffer (@pxref{Agenda commands}).
3892 @kindex C-c a T
3893 @item C-c a T
3894 @cindex TODO keyword matching
3895 Like the above, but allows selection of a specific TODO keyword.  You
3896 can also do this by specifying a prefix argument to @kbd{C-c a t}.  With
3897 a @kbd{C-u} prefix you are prompted for a keyword, and you may also
3898 specify several keywords by separating them with @samp{|} as boolean OR
3899 operator.  With a numeric prefix, the Nth keyword in
3900 @code{org-todo-keywords} is selected.
3901 @kindex r
3902 The @kbd{r} key in the agenda buffer regenerates it, and you can give
3903 a prefix argument to this command to change the selected TODO keyword,
3904 for example @kbd{3 r}.  If you often need a search for a specific
3905 keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
3906 Matching specific TODO keywords can also be done as part of a tags
3907 search (@pxref{Tag searches}).
3908 @end table
3910 Remote editing of TODO items means that you can change the state of a
3911 TODO entry with a single key press.  The commands available in the
3912 TODO list are described in @ref{Agenda commands}.
3914 @cindex sublevels, inclusion into todo list
3915 Normally the global todo list simply shows all headlines with TODO
3916 keywords.  This list can become very long.  There are two ways to keep
3917 it more compact:
3918 @itemize @minus
3919 @item
3920 Some people view a TODO item that has been @emph{scheduled} for
3921 execution (@pxref{Time stamps}) as no longer @emph{open}.  Configure the
3922 variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
3923 items from the global TODO list.
3924 @item
3925 TODO items may have sublevels to break up the task into subtasks.  In
3926 such cases it may be enough to list only the highest level TODO headline
3927 and omit the sublevels from the global list.  Configure the variable
3928 @code{org-agenda-todo-list-sublevels} to get this behavior.
3929 @end itemize
3931 @node Matching headline tags, Timeline, Global TODO list, Built-in agenda views
3932 @subsection Matching headline tags
3933 @cindex matching, of tags
3934 @cindex tags view
3936 If headlines in the agenda files are marked with @emph{tags}
3937 (@pxref{Tags}), you can select headlines based on the tags that apply
3938 to them and collect them into an agenda buffer.
3940 @table @kbd
3941 @kindex C-c a m
3942 @item C-c a m
3943 Produce a list of all headlines that match a given set of tags.  The
3944 command prompts for a selection criterion, which is a boolean logic
3945 expression with tags, like @samp{+WORK+URGENT-WITHBOSS} or
3946 @samp{WORK|HOME} (@pxref{Tags}).  If you often need a specific search,
3947 define a custom command for it (@pxref{Agenda dispatcher}).
3948 @kindex C-c a M
3949 @item C-c a M
3950 Like @kbd{C-c a m}, but only select headlines that are also TODO items
3951 and force checking subitems (see variable
3952 @code{org-tags-match-list-sublevels}).  Matching specific todo keywords
3953 together with a tags match is also possible, see @ref{Tag searches}.
3954 @end table
3956 The commands available in the tags list are described in @ref{Agenda
3957 commands}.
3959 @node Timeline, Stuck projects, Matching headline tags, Built-in agenda views
3960 @subsection Timeline for a single file
3961 @cindex timeline, single file
3962 @cindex time-sorted view
3964 The timeline summarizes all time-stamped items from a single Org-mode
3965 file in a @emph{time-sorted view}.  The main purpose of this command is
3966 to give an overview over events in a project.
3968 @table @kbd
3969 @kindex C-a a L
3970 @item C-c a L
3971 Show a time-sorted view of the org file, with all time-stamped items.
3972 When called with a @kbd{C-u} prefix, all unfinished TODO entries
3973 (scheduled or not) are also listed under the current date.
3974 @end table
3976 @noindent
3977 The commands available in the timeline buffer are listed in
3978 @ref{Agenda commands}.
3981 @node Stuck projects,  , Timeline, Built-in agenda views
3982 @subsection Stuck projects
3984 If you are following a system like David Allen's GTD to organize your
3985 work, one of the ``duties'' you have is a regular review to make sure
3986 that all projects move along.  A @emph{stuck} project is a project that
3987 has no defined next actions, so it will never show up in the TODO lists
3988 Org-mode produces.  During the review, you need to identify such
3989 projects and define next actions for them.
3991 @table @kbd
3992 @kindex C-c a #
3993 @item C-c a #
3994 List projects that are stuck.
3995 @kindex C-c a !
3996 @item C-c a !
3997 Customize the variable @code{org-stuck-projects} to define what a stuck
3998 project is and how to find it.
3999 @end table
4001 You almost certainly will have to configure this view before it will
4002 work for you.  The built-in default assumes that all your projects are
4003 level-2 headlines, and that a project is not stuck if it has at least
4004 one entry marked with a todo keyword TODO or NEXT or NEXTACTION.
4006 Lets assume that you, in your own way of using Org-mode, identify
4007 projects with a tag PROJECT, and that you use a todo keyword MAYBE to
4008 indicate a project that should not be considered yet.  Lets further
4009 assume that the todo keyword DONE marks finished projects, and that NEXT
4010 and TODO indicate next actions.  The tag @@SHOP indicates shopping and
4011 is a next action even without the NEXT tag.  Finally, if the project
4012 contains the special word IGNORE anywhere, it should not be listed
4013 either.  In this case you would start by identifying eligible projects
4014 with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
4015 TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
4016 are not stuck.  The correct customization for this is
4018 @lisp
4019 (setq org-stuck-projects
4020       '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
4021                                "\\<IGNORE\\>"))
4022 @end lisp
4025 @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda views
4026 @section Presentation and sorting
4027 @cindex presentation, of agenda items
4029 Before displaying items in an agenda view, Org-mode visually prepares
4030 the items and sorts them.  Each item occupies a single line.  The line
4031 starts with a @emph{prefix} that contains the @emph{category}
4032 (@pxref{Categories}) of the item and other important information.  You can
4033 customize the prefix using the option @code{org-agenda-prefix-format}.
4034 The prefix is followed by a cleaned-up version of the outline headline
4035 associated with the item.
4037 @menu
4038 * Categories::                  Not all tasks are equal
4039 * Time-of-day specifications::  How the agenda knows the time
4040 * Sorting of agenda items::     The order of things
4041 @end menu
4043 @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
4044 @subsection Categories
4046 @cindex category
4047 The category is a broad label assigned to each agenda item.  By default,
4048 the category is simply derived from the file name, but you can also
4049 specify it with a special line in the buffer, like this:
4051 @example
4052 #+CATEGORY: Thesis
4053 @end example
4055 If there are several such lines in a file, each specifies the category
4056 for the text below it (but the first category also applies to any text
4057 before the first CATEGORY line).  The display in the agenda buffer looks
4058 best if the category is not longer than 10 characters.
4060 @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
4061 @subsection Time-of-Day Specifications
4062 @cindex time-of-day specification
4064 Org-mode checks each agenda item for a time-of-day specification.  The
4065 time can be part of the time stamp that triggered inclusion into the
4066 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}.  Time
4067 ranges can be specified with two time stamps, like
4069 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
4071 In the headline of the entry itself, a time(range) may also appear as
4072 plain text (like @samp{12:45} or a @samp{8:30-1pm}.  If the agenda
4073 integrates the Emacs diary (@pxref{Weekly/Daily agenda}), time
4074 specifications in diary entries are recognized as well.
4076 For agenda display, Org-mode extracts the time and displays it in a
4077 standard 24 hour format as part of the prefix.  The example times in
4078 the previous paragraphs would end up in the agenda like this:
4080 @example
4081     8:30-13:00 Arthur Dent lies in front of the bulldozer
4082    12:45...... Ford Prefect arrives and takes Arthur to the pub
4083    19:00...... The Vogon reads his poem
4084    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
4085 @end example
4087 @cindex time grid
4088 If the agenda is in single-day mode, or for the display of today, the
4089 timed entries are embedded in a time grid, like
4091 @example
4092     8:00...... ------------------
4093     8:30-13:00 Arthur Dent lies in front of the bulldozer
4094    10:00...... ------------------
4095    12:00...... ------------------
4096    12:45...... Ford Prefect arrives and takes Arthur to the pub
4097    14:00...... ------------------
4098    16:00...... ------------------
4099    18:00...... ------------------
4100    19:00...... The Vogon reads his poem
4101    20:00...... ------------------
4102    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
4103 @end example
4105 The time grid can be turned on and off with the variable
4106 @code{org-agenda-use-time-grid}, and can be configured with
4107 @code{org-agenda-time-grid}.
4109 @node Sorting of agenda items,  , Time-of-day specifications, Presentation and sorting
4110 @subsection Sorting of agenda items
4111 @cindex sorting, of agenda items
4112 @cindex priorities, of agenda items
4113 Before being inserted into a view, the items are sorted.  How this is
4114 done depends on the type of view.
4115 @itemize @bullet
4116 @item
4117 For the daily/weekly agenda, the items for each day are sorted.  The
4118 default order is to first collect all items containing an explicit
4119 time-of-day specification.  These entries will be shown at the beginning
4120 of the list, as a @emph{schedule} for the day.  After that, items remain
4121 grouped in categories, in the sequence given by @code{org-agenda-files}.
4122 Within each category, items are sorted by priority (@pxref{Priorities}),
4123 which is composed of the base priority (2000 for priority @samp{A}, 1000
4124 for @samp{B}, and 0 for @samp{C}), plus additional increments for
4125 overdue scheduled or deadline items.
4126 @item 
4127 For the TODO list, items remain in the order of categories, but within
4128 each category, sorting takes place according to priority
4129 (@pxref{Priorities}).
4130 @item
4131 For tags matches, items are not sorted at all, but just appear in the
4132 sequence in which they are found in the agenda files.
4133 @end itemize
4135 Sorting can be customized using the variable
4136 @code{org-agenda-sorting-strategy}.
4139 @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda views
4140 @section Commands in the agenda buffer
4141 @cindex commands, in agenda buffer
4143 Entries in the agenda buffer are linked back to the org file or diary
4144 file where they originate.  You are not allowed to edit the agenda
4145 buffer itself, but commands are provided to show and jump to the
4146 original entry location, and to edit the org-files ``remotely'' from
4147 the agenda buffer.  In this way, all information is stored only once,
4148 removing the risk that your agenda and note files may diverge.
4150 Some commands can be executed with mouse clicks on agenda lines.  For
4151 the other commands, the cursor needs to be in the desired line.
4153 @table @kbd
4154 @tsubheading{Motion}
4155 @cindex motion commands in agenda
4156 @kindex n
4157 @item n
4158 Next line (same as @key{up}).
4159 @kindex p
4160 @item p
4161 Previous line (same as @key{down}).
4162 @tsubheading{View/GoTo org file}
4163 @kindex mouse-3
4164 @kindex @key{SPC}
4165 @item mouse-3
4166 @itemx @key{SPC}
4167 Display the original location of the item in another window.
4169 @kindex L
4170 @item L
4171 Display original location and recenter that window.
4173 @kindex mouse-2
4174 @kindex mouse-1
4175 @kindex @key{TAB}
4176 @item mouse-2
4177 @itemx mouse-1
4178 @itemx @key{TAB}
4179 Go to the original location of the item in another window.  Under Emacs
4180 22, @kbd{mouse-1} will also works for this.
4182 @kindex @key{RET}
4183 @itemx @key{RET}
4184 Go to the original location of the item and delete other windows.
4186 @kindex f
4187 @item f
4188 Toggle Follow mode.  In Follow mode, as you move the cursor through
4189 the agenda buffer, the other window always shows the corresponding
4190 location in the org file.  The initial setting for this mode in new
4191 agenda buffers can be set with the variable
4192 @code{org-agenda-start-with-follow-mode}.
4194 @kindex b
4195 @item b
4196 Display the entire subtree of the current item in an indirect buffer.
4197 With numerical prefix ARG, go up to this level and then take that tree.
4198 If ARG is negative, go up that many levels.  With @kbd{C-u} prefix, do
4199 not remove the previously used indirect buffer.
4201 @kindex l
4202 @item l
4203 Toggle Logbook mode.  In Logbook mode, entries that where marked DONE while
4204 logging was on (variable @code{org-log-done}) are shown in the agenda,
4205 as are entries that have been clocked on that day.
4207 @tsubheading{Change display}
4208 @cindex display changing, in agenda
4209 @kindex o
4210 @item o
4211 Delete other windows.
4213 @kindex w
4214 @item w
4215 Switch to weekly view (7 days displayed together).
4217 @kindex d
4218 @item d
4219 Switch to daily view (just one day displayed).
4221 @kindex D
4222 @item D
4223 Toggle the inclusion of diary entries.  See @ref{Weekly/Daily agenda}.
4225 @kindex g
4226 @item g
4227 Toggle the time grid on and off.  See also the variables
4228 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
4230 @kindex r
4231 @item r
4232 Recreate the agenda buffer, for example to reflect the changes
4233 after modification of the time stamps of items with S-@key{left} and
4234 S-@key{right}.  When the buffer is the global todo list, a prefix
4235 argument is interpreted to create a selective list for a specific TODO
4236 keyword.
4238 @kindex s
4239 @item s
4240 Save all Org-mode buffers in the current Emacs session.
4242 @kindex @key{right}
4243 @item @key{right}
4244 Display the following @code{org-agenda-ndays} days.  For example, if
4245 the display covers a week, switch to the following week.  With prefix
4246 arg, go forward that many times @code{org-agenda-ndays} days.
4248 @kindex @key{left}
4249 @item @key{left}
4250 Display the previous dates.
4252 @kindex .
4253 @item .
4254 Goto today.
4256 @tsubheading{Remote editing}
4257 @cindex remote editing, from agenda
4259 @item 0-9
4260 Digit argument.
4262 @cindex undoing remote-editing events
4263 @cindex remote editing, undo
4264 @kindex C-_
4265 @item C-_
4266 Undo a change due to a remote editing command.  The change is undone
4267 both in the agenda buffer and in the remote buffer.
4269 @kindex t
4270 @item t
4271 Change the TODO state of the item, both in the agenda and in the
4272 original org file.
4274 @kindex C-k
4275 @item C-k
4276 Delete the current agenda item along with the entire subtree belonging
4277 to it in the original Org-mode file.  If the text to be deleted remotely
4278 is longer than one line, the kill needs to be confirmed by the user.  See
4279 variable @code{org-agenda-confirm-kill}.
4281 @kindex $
4282 @item $
4283 Archive the subtree corresponding to the current headline.
4285 @kindex T
4286 @item T
4287 Show all tags associated with the current item.  Because of
4288 inheritance, this may be more than the tags listed in the line itself.
4290 @kindex :
4291 @item :
4292 Set tags for the current headline.
4294 @kindex a
4295 @item a
4296 Toggle the ARCHIVE tag for the current headline.
4298 @kindex ,
4299 @item ,
4300 Set the priority for the current item.  Org-mode prompts for the
4301 priority character. If you reply with @key{SPC}, the priority cookie
4302 is removed from the entry.
4304 @kindex P
4305 @item P
4306 Display weighted priority of current item.
4308 @kindex +
4309 @kindex S-@key{up}
4310 @item +
4311 @itemx S-@key{up}
4312 Increase the priority of the current item.  The priority is changed in
4313 the original buffer, but the agenda is not resorted.  Use the @kbd{r}
4314 key for this.
4316 @kindex -
4317 @kindex S-@key{down}
4318 @item -
4319 @itemx S-@key{down}
4320 Decrease the priority of the current item.
4322 @kindex C-c C-s
4323 @item C-c C-s
4324 Schedule this item
4326 @kindex C-c C-d
4327 @item C-c C-d
4328 Set a deadline for this item.
4330 @kindex S-@key{right}
4331 @item S-@key{right}
4332 Change the time stamp associated with the current line by one day into
4333 the future.  With prefix argument, change it by that many days.  For
4334 example, @kbd{3 6 5 S-@key{right}} will change it by a year.  The
4335 stamp is changed in the original org file, but the change is not
4336 directly reflected in the agenda buffer.  Use the
4337 @kbd{r} key to update the buffer.
4339 @kindex S-@key{left}
4340 @item S-@key{left}
4341 Change the time stamp associated with the current line by one day
4342 into the past.
4344 @kindex >
4345 @item >
4346 Change the time stamp associated with the current line to today.
4347 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
4348 on my keyboard.
4350 @kindex I
4351 @item I
4352 Start the clock on the current item.  If a clock is running already, it
4353 is stopped first.
4355 @kindex O
4356 @item O
4357 Stop the previously started clock.
4359 @kindex X
4360 @item X
4361 Cancel the currently running clock.
4363 @tsubheading{Calendar commands}
4364 @cindex calendar commands, from agenda
4365 @kindex c
4366 @item c
4367 Open the Emacs calendar and move to the date at the agenda cursor.
4369 @item c
4370 When in the calendar, compute and show the Org-mode agenda for the
4371 date at the cursor.
4373 @cindex diary entries, creating from agenda
4374 @kindex i
4375 @item i
4376 Insert a new entry into the diary.  Prompts for the type of entry
4377 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
4378 entry in the diary, just as @kbd{i d} etc. would do in the calendar.
4379 The date is taken from the cursor position.
4381 @kindex M
4382 @item M
4383 Show the phases of the moon for the three months around current date.
4385 @kindex S
4386 @item S
4387 Show sunrise and sunset times.  The geographical location must be set
4388 with calendar variables, see documentation of the Emacs calendar.
4390 @kindex C
4391 @item C
4392 Convert the date at cursor into many other cultural and historic
4393 calendars.
4395 @kindex H
4396 @item H
4397 Show holidays for three month around the cursor date.
4399 @c FIXME:  This should be a different key.
4400 @kindex C-c C-x C-c
4401 @item C-c C-x C-c
4402 Export a single iCalendar file containing entries from all agenda files.
4404 @tsubheading{Quit and Exit}
4405 @kindex q
4406 @item q
4407 Quit agenda, remove the agenda buffer.
4409 @kindex x
4410 @cindex agenda files, removing buffers
4411 @item x
4412 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
4413 for the compilation of the agenda.  Buffers created by the user to
4414 visit org files will not be removed.
4415 @end table
4418 @node Custom agenda views,  , Agenda commands, Agenda views
4419 @section Custom agenda views
4420 @cindex custom agenda views
4421 @cindex agenda views, custom
4423 Custom agenda commands serve two purposes: to store and quickly access
4424 frequently used TODO and tags searches, and to create special composite
4425 agenda buffers.  Custom agenda commands will be accessible through the
4426 dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
4428 @menu
4429 * Storing searches::            Type once, use often
4430 * Block agenda::                All the stuff you need in a single buffer
4431 * Setting Options::             Changing the rules
4432 * Batch processing::            Agenda views from the command line
4433 @end menu
4435 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
4436 @subsection Storing searches
4438 The first application of custom searches is the definition of keyboard
4439 shortcuts for frequently used searches, either creating an agenda
4440 buffer, or a sparse tree (the latter covering of course only the current
4441 buffer).
4442 @kindex C-c a C
4443 Custom commands are configured in the variable
4444 @code{org-agenda-custom-commands}.  You can customize this variable, for
4445 example by pressing @kbd{C-c a C}.  You can also directly set it with
4446 Emacs Lisp in @file{.emacs}.  The following example contains all valid
4447 search types:
4449 @lisp
4450 @group
4451 (setq org-agenda-custom-commands
4452       '(("w" todo "WAITING")
4453         ("W" todo-tree "WAITING")
4454         ("u" tags "+BOSS-URGENT")
4455         ("v" tags-todo "+BOSS-URGENT")
4456         ("U" tags-tree "+BOSS-URGENT")
4457         ("f" occur-tree "\\<FIXME\\>")))
4458 @end group
4459 @end lisp
4461 @noindent
4462 The initial single-character string in each entry defines the character
4463 you have to press after the dispatcher command @kbd{C-c a} in order to
4464 access the command.   The second parameter is the search type, followed
4465 by the string or regular expression to be used for the matching.  The
4466 example above will therefore define:
4468 @table @kbd
4469 @item C-c a w
4470 as a global search for TODO entries with @samp{WAITING} as the TODO
4471 keyword
4472 @item C-c a W
4473 as the same search, but only in the current buffer and displaying the
4474 results as a sparse tree
4475 @item C-c a u
4476 as a global tags search for headlines marked @samp{:BOSS:} but not
4477 @samp{:URGENT:}
4478 @item C-c a v
4479 as the same search as @kbd{C-c a u}, but limiting the search to
4480 headlines that are also TODO items
4481 @item C-c a U
4482 as the same search as @kbd{C-c a u}, but only in the current buffer and
4483 displaying the result as a sparse tree
4484 @item C-c a f
4485 to create a sparse tree (again: current buffer only) with all entries
4486 containing the word @samp{FIXME}.
4487 @end table
4489 @node Block agenda, Setting Options, Storing searches, Custom agenda views
4490 @subsection Block agenda
4491 @cindex block agenda
4492 @cindex agenda, with block views
4494 Another possibility is the construction of agenda views that comprise
4495 the results of @emph{several} commands, each of which creates a block in
4496 the agenda buffer.  The available commands include @code{agenda} for the
4497 daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
4498 for the global todo list (as constructed with @kbd{C-c a t}), and the
4499 matching commands discussed above: @code{todo}, @code{tags}, and
4500 @code{tags-todo}.  Here are two examples:
4502 @lisp
4503 @group
4504 (setq org-agenda-custom-commands
4505       '(("h" "Agenda and Home-related tasks"
4506          ((agenda)
4507           (tags-todo "HOME")
4508           (tags "GARDEN")))
4509         ("o" "Agenda and Office-related tasks"
4510          ((agenda)
4511           (tags-todo "WORK")
4512           (tags "OFFICE")))))
4513 @end group
4514 @end lisp
4516 @noindent
4517 This will define @kbd{C-c a h} to create a multi-block view for stuff
4518 you need to attend to at home.  The resulting agenda buffer will contain
4519 your agenda for the current week, all TODO items that carry the tag
4520 @samp{HOME}, and also all lines tagged with @samp{GARDEN}.  Finally the
4521 command @kbd{C-c a o} provides a similar view for office tasks.
4524 @node Setting Options, Batch processing, Block agenda, Custom agenda views
4525 @subsection Setting Options for custom commands
4526 @cindex options, for custom agenda views
4528 Org-mode contains a number of variables regulating agenda construction
4529 and display.  The global variables define the behavior for all agenda
4530 commands, including the custom commands.  However, if you want to change
4531 some settings just for a single custom view, you can do so.  Setting
4532 options requires inserting a list of variable names and values at the
4533 right spot in @code{org-agenda-custom-commands}.  For example:
4535 @lisp
4536 @group
4537 (setq org-agenda-custom-commands
4538       '(("w" todo "WAITING"
4539          ((org-agenda-sorting-strategy '(priority-down))
4540           (org-agenda-prefix-format "  Mixed: ")))
4541         ("U" tags-tree "+BOSS-URGENT"
4542          ((org-show-following-heading nil)
4543           (org-show-hierarchy-above nil)))))
4544 @end group
4545 @end lisp
4547 @noindent
4548 Now the @kbd{C-c a w} command will sort the collected entries only by
4549 priority, and the prefix format is modified to just say @samp{  Mixed:}
4550 instead of giving the category of the entry.  The sparse tags tree of
4551 @kbd{C-c a U} will now turn out ultra-compact, because neither the
4552 headline hierarchy above the match, nor the headline following the match
4553 will be shown.
4555 For command sets creating a block agenda,
4556 @code{org-agenda-custom-commands} has two separate spots for setting
4557 options.  You can add options that should be valid for just a single
4558 command in the set, and options that should be valid for all commands in
4559 the set.  The former are just added to the command entry, the latter
4560 must come after the list of command entries.  Going back to the block
4561 agenda example (@pxref{Block agenda}), let's change the sorting strategy
4562 for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
4563 the results for GARDEN tags query in the opposite order,
4564 @code{priority-up}.  This would look like this:
4566 @lisp
4567 @group
4568 (setq org-agenda-custom-commands
4569       '(("h" "Agenda and Home-related tasks"
4570          ((agenda)
4571           (tags-todo "HOME")
4572           (tags "GARDEN" ((org-agenda-sorting-strategy '(priority-up)))))
4573          ((org-agenda-sorting-strategy '(priority-down))))
4574         ("o" "Agenda and Office-related tasks"
4575          ((agenda)
4576           (tags-todo "WORK")
4577           (tags "OFFICE")))))
4578 @end group
4579 @end lisp
4581 As you see, the values and parenthesis setting is a little complex.
4582 When in doubt, use the customize interface to set this variable - it
4583 fully supports its structure.  Just one caveat: When setting options in
4584 this interface, the @emph{values} are just lisp expressions.  So if the
4585 value is a string, you need to add the double quotes around the value
4586 yourself.
4588 @node Batch processing,  , Setting Options, Custom agenda views
4589 @subsection Creating agenda views in batch processing
4590 @cindex agenda, batch production
4592 If you want to print or otherwise reprocess agenda views, it can be
4593 useful to create an agenda from the command line.  This is the purpose
4594 of the function @code{org-batch-agenda}.  It takes as a parameter one of
4595 the strings that are the keys in @code{org-agenda-custom-commands}.  For
4596 example, to directly print the current TODO list, you could use
4598 @example
4599 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
4600 @end example
4602 @noindent
4603 You may also modify parameters on the fly like this:
4605 @example
4606 emacs -batch -l ~/.emacs                                      \
4607    -eval '(org-batch-agenda "a"                               \
4608             org-agenda-ndays 300                              \
4609             org-agenda-include-diary nil                      \
4610             org-agenda-files (quote ("~/org/project.org")))'  \
4611    | lpr
4612 @end example
4614 @noindent
4615 which will produce a 300 day agenda, fully restricted to the Org file
4616 @file{~/org/projects.org}, not even including the diary.
4618 @node Embedded LaTeX, Exporting, Agenda views, Top
4619 @chapter Embedded LaTeX
4620 @cindex @TeX{} interpretation
4621 @cindex La@TeX{} interpretation
4623 Plain ASCII is normally sufficient for almost all note taking.  One
4624 exception, however, are scientific notes which need to be able to
4625 contain mathematical symbols and the occasional formula.
4626 La@TeX{}@footnote{La@TeX{} is a macro system based on Donald E. Knuth's
4627 @TeX{} system.  Many of the features described here as ``La@TeX{}'' are
4628 really from @TeX{}, but for simplicity I am blurring this distinction.}
4629 is widely used to typeset scientific documents. Org-mode supports
4630 embedding La@TeX{} code into its files, because many academics are used
4631 to read La@TeX{} source code, and because it can be readily processed
4632 into images for HTML production.
4634 It is not necessary to mark La@TeX{} macros and code in any special way.
4635 If you observe a few conventions, Org-mode knows how to find it and what
4636 to do with it.
4638 @menu
4639 * Math symbols::                TeX macros for symbols and Greek letters
4640 * Subscripts and Superscripts::  Simple syntax for raising/lowering text
4641 * LaTeX fragments::             Complex formulas made easy
4642 * Processing LaTeX fragments::  Previewing LaTeX processing
4643 * CDLaTeX mode::                Speed up entering of formulas
4644 @end menu
4646 @node Math symbols, Subscripts and Superscripts, Embedded LaTeX, Embedded LaTeX
4647 @section Math symbols
4648 @cindex math symbols
4649 @cindex TeX macros
4651 You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
4652 to indicate the Greek letter, or @samp{\to} to indicate an arrow.
4653 Completion for these macros is available, just type @samp{\} and maybe a
4654 few letters, and press @kbd{M-@key{TAB}} to see possible completions.
4655 Unlike La@TeX{} code, Org-mode allows these macros to be present
4656 without surrounding math delimiters, for example:
4658 @example
4659 Angles are written as Greek letters \alpha, \beta and \gamma.
4660 @end example
4662 During HTML export (@pxref{HTML export}), these symbols are translated
4663 into the proper syntax for HTML, for the above examples this is
4664 @samp{&alpha;} and @samp{&rarr;}, respectively.
4666 @node Subscripts and Superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
4667 @section Subscripts and Superscripts
4668 @cindex subscript
4669 @cindex superscript
4671 Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
4672 and subscripts.  Again, these can be used without embedding them in
4673 math-mode delimiters.  To increase the readability of ASCII text, it is
4674 not necessary (but OK) to surround multi-character sub- and superscripts
4675 with curly braces.  For example
4677 @example
4678 The mass if the sun is M_sun = 1.989 x 10^30 kg.  The radius of
4679 the sun is R_@{sun@} = 6.96 x 10^8 m.
4680 @end example
4682 To avoid interpretation as raised or lowered text, you can quote
4683 @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
4685 During HTML export (@pxref{HTML export}), subscript and superscripts
4686 are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
4688 @node LaTeX fragments, Processing LaTeX fragments, Subscripts and Superscripts, Embedded LaTeX
4689 @section LaTeX fragments
4690 @cindex LaTeX fragments
4692 With symbols, sub- and superscripts, HTML is pretty much at its end when
4693 it comes to representing mathematical formulas@footnote{Yes, there is
4694 MathML, but that is not yet fully supported by many browsers, and there
4695 is no decent converter for turning LaTeX of ASCII representations of
4696 formulas into MathML.  So for the time being, converting formulas into
4697 images seems the way to go.}.  More complex
4698 expressions need a dedicated formula processor.  To this end, Org-mode
4699 can contain arbitrary La@TeX{} fragments.  It provides commands to
4700 preview the typeset result of these fragments, and upon export to HTML,
4701 all fragments will be converted to images and inlined into the HTML
4702 document.  For this to work you need to be on a system with a working
4703 La@TeX{} installation.  You also need the @file{dvipng} program,
4704 available at @url{http://sourceforge.net/projects/dvipng/}.  The LaTeX
4705 header that will be used when processing a fragment can be configured
4706 with the variable @code{org-format-latex-header}.
4708 La@TeX{} fragments don't need any special marking at all.  The following
4709 snippets will be identified as LaTeX source code:
4710 @itemize @bullet
4711 @item
4712 Environments of any kind.  The only requirement is that the
4713 @code{\begin} statement appears on a new line, preceded by only
4714 whitespace.
4715 @item
4716 Text within the usual La@TeX{} math delimiters.  To avoid conflicts with
4717 currency specifications, single @samp{$} characters are only recognized
4718 as math delimiters if the enclosed text contains at most two line breaks,
4719 is directly attached to the @samp{$} characters with no whitespace in
4720 between, and if the closing @samp{$} is followed by whitespace or
4721 punctuation.  For the other delimiters, there is no such restriction, so
4722 when in doubt, use @samp{\(...\)} as inline math delimiters.
4723 @end itemize
4725 @noindent For example:
4727 @example
4728 \begin@{equation@}                          % arbitrary environments,
4729 x=\sqrt@{b@}                                % even tables, figures
4730 \end@{equation@}                            % etc
4732 If $a^2=b$ and \( b=2 \), then the solution must be
4733 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
4734 @end example
4736 @noindent
4737 If you need any of the delimiter ASCII sequences for other purposes, you
4738 can configure the option @code{org-format-latex-options} to deselect the
4739 ones you do not wish to have interpreted by the La@TeX{} converter.
4741 @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
4742 @section Processing LaTeX fragments
4743 @cindex LaTeX fragments, preview
4745 La@TeX{} fragments can be processed to produce a preview images of the
4746 typeset expressions:
4748 @table @kbd
4749 @kindex C-c C-x C-l
4750 @item C-c C-x C-l
4751 Produce a preview image of the La@TeX{} fragment at point and overlay it
4752 over the source code.  If there is no fragment at point, process all
4753 fragments in the current entry (between two headlines).  When called
4754 with a prefix argument, process the entire subtree.  When called with
4755 two prefix arguments, or when the cursor is before the first headline,
4756 process the entire buffer.
4757 @kindex C-c C-c
4758 @item C-c C-c
4759 Remove the overlay preview images.
4760 @end table
4762 During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
4763 converted into images and inlined into the document if the following
4764 setting is active:
4766 @lisp
4767 (setq org-export-with-LaTeX-fragments t)
4768 @end lisp
4770 @node CDLaTeX mode,  , Processing LaTeX fragments, Embedded LaTeX
4771 @section Using CDLaTeX to enter math
4772 @cindex CDLaTeX
4774 CDLaTeX-mode is a minor mode that is normally used in combination with a
4775 major LaTeX mode like AUCTeX in order to speed-up insertion of
4776 environments and math templates.  Inside Org-mode, you can make use of
4777 some of the features of cdlatex-mode.  You need to install
4778 @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
4779 AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
4780 Don't turn cdlatex-mode itself under Org-mode, but use the light
4781 version @code{org-cdlatex-mode} that comes as part of Org-mode.  Turn it
4782 on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
4783 Org-mode files with
4785 @lisp
4786 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
4787 @end lisp
4789 When this mode is enabled, the following features are present (for more
4790 details see the documentation of cdlatex-mode):
4791 @itemize @bullet
4792 @kindex C-c @{
4793 @item
4794 Environment templates can be inserted with @kbd{C-c @{}.
4795 @item
4796 @kindex @key{TAB}
4797 The @key{TAB} key will do template expansion if the cursor is inside a
4798 LaTeX fragment@footnote{Org-mode has a method to test if the cursor is
4799 inside such a fragment, see the documentation of the function
4800 @code{org-inside-LaTeX-fragment-p}.}.  For example, @key{TAB} will
4801 expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
4802 correctly inside the first brace.  Another @key{TAB} will get you into
4803 the second brace.  Even outside fragments, @key{TAB} will expand
4804 environment abbreviations at the beginning of a line.  For example, if
4805 you write @samp{equ} at the beginning of a line and press @key{TAB},
4806 this abbreviation will be expanded to an @code{equation} environment.
4807 To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
4808 @item
4809 @kindex _
4810 @kindex ^
4811 Pressing @kbd{_} and @kbd{^} inside a LaTeX fragment will insert these
4812 characters together with a pair of braces.  If you use @key{TAB} to move
4813 out of the braces, and if the braces surround only a single character or
4814 macro, they are removed again (depending on the variable
4815 @code{cdlatex-simplify-sub-super-scripts}).
4816 @item
4817 @kindex `
4818 Pressing the backquote @kbd{`} followed by a character inserts math
4819 macros, also outside LaTeX fragments.  If you wait more than 1.5 seconds
4820 after the backquote, a help window will pop up.
4821 @item
4822 @kindex '
4823 Pressing the normal quote @kbd{'} followed by another character modifies
4824 the symbol before point with an accent or a font.  If you wait more than
4825 1.5 seconds after the backquote, a help window will pop up.  Character
4826 modification will work only inside La@TeX{} fragments, outside the quote
4827 is normal.
4828 @end itemize
4830 @node Exporting, Publishing, Embedded LaTeX, Top
4831 @chapter Exporting
4832 @cindex exporting
4834 Org-mode documents can be exported into a variety of other formats.  For
4835 printing and sharing of notes, ASCII export produces a readable and
4836 simple version of an Org-mode file.  HTML export allows you to publish a
4837 notes file on the web, while the XOXO format provides a solid base for
4838 exchange with a broad range of other applications.  To incorporate
4839 entries with associated times like deadlines or appointments into a
4840 desktop calendar program like iCal, Org-mode can also produce extracts
4841 in the iCalendar format.  Currently Org-mode only supports export, not
4842 import of these different formats.
4844 When exporting, Org-mode uses special conventions to enrich the output
4845 produced.  @xref{Text interpretation}, for more details.
4847 @table @kbd
4848 @kindex C-c C-e
4849 @item C-c C-e
4850 Dispatcher for export and publishing commands.  Displays a help-window
4851 listing the additional key(s) needed to launch an export or publishing
4852 command.
4853 @end table
4855 @menu
4856 * ASCII export::                Exporting to plain ASCII
4857 * HTML export::                 Exporting to HTML
4858 * XOXO export::                 Exporting to XOXO
4859 * iCalendar export::            Exporting in iCalendar format
4860 * Text interpretation::         How the exporter looks at the file
4861 @end menu
4863 @node ASCII export, HTML export, Exporting, Exporting
4864 @section ASCII export
4865 @cindex ASCII export
4867 ASCII export produces a simple and very readable version of an Org-mode
4868 file.
4870 @cindex region, active
4871 @cindex active region
4872 @cindex transient-mark-mode
4873 @table @kbd
4874 @kindex C-c C-e a
4875 @item C-c C-e a
4876 Export as ASCII file.  If there is an active region, only the region
4877 will be exported.  For an org file @file{myfile.org}, the ASCII file
4878 will be @file{myfile.txt}.  The file will be overwritten without
4879 warning.
4880 @kindex C-c C-e v a
4881 @item C-c C-e v a
4882 Export only the visible part of the document.
4883 @end table
4885 @cindex headline levels, for exporting
4886 In the exported version, the first 3 outline levels will become
4887 headlines, defining a general document structure.  Additional levels
4888 will be exported as itemized lists.  If you want that transition to occur
4889 at a different level, specify it with a prefix argument.  For example,
4891 @example
4892 @kbd{C-1 C-c C-e a}
4893 @end example
4895 @noindent
4896 creates only top level headlines and does the rest as items.  When
4897 headlines are converted to items, the indentation of the text following
4898 the headline is changed to fit nicely under the item.  This is done with
4899 the assumption that the first bodyline indicates the base indentation of
4900 the body text.  Any indentation larger than this is adjusted to preserve
4901 the layout relative to the first line.  Should there be lines with less
4902 indentation than the first, these are left alone.
4904 @node HTML export, XOXO export, ASCII export, Exporting
4905 @section HTML export
4906 @cindex HTML export
4908 Org-mode contains an HTML (XHTML 1.0 strict) exporter with extensive
4909 HTML formatting, in ways similar to John Grubers @emph{markdown}
4910 language, but with additional support for tables.
4912 @menu
4913 * Export commands::             How to invoke HTML export
4914 * Quoting HTML tags::           Using direct HTML in Org-mode
4915 * Links::                       How hyperlinks get transferred to HTML
4916 * Images::                      To inline or not to inline?
4917 * CSS support::                 Style specifications
4918 @end menu
4920 @node Export commands, Quoting HTML tags, HTML export, HTML export
4921 @subsection HTML export commands
4923 @cindex region, active
4924 @cindex active region
4925 @cindex transient-mark-mode
4926 @table @kbd
4927 @kindex C-c C-e h
4928 @item C-c C-e h
4929 Export as HTML file @file{myfile.html}.
4930 @kindex C-c C-e b
4931 @item C-c C-e b
4932 Export as HTML file and open it with a browser.
4933 @kindex C-c C-e H
4934 @item C-c C-e H
4935 Export to a temporary buffer, do not create a file.
4936 @kindex C-c C-e v h
4937 @kindex C-c C-e v b
4938 @kindex C-c C-e v H
4939 @item C-c C-e v h
4940 @item C-c C-e v b
4941 @item C-c C-e v H
4942 Export only the visible part of the document.
4943 @end table
4945 @cindex headline levels, for exporting
4946 In the exported version, the first 3 outline levels will become
4947 headlines, defining a general document structure.  Additional levels
4948 will be exported as itemized lists.  If you want that transition to occur
4949 at a different level, specify it with a prefix argument.  For example,
4951 @example
4952 @kbd{C-2 C-c C-e b}
4953 @end example
4955 @noindent
4956 creates two levels of headings and does the rest as items.
4958 @node Quoting HTML tags, Links, Export commands, HTML export
4959 @subsection Quoting HTML tags
4961 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
4962 @samp{&gt;} in HTML export.  If you want to include simple HTML tags
4963 which should be interpreted as such, mark them with @samp{@@} as in
4964 @samp{@@<b>bold text@@</b>}.  Note that this really works only for
4965 simple tags.  For more extensive HTML that should be copied verbatim to
4966 the exported file use either
4968 @example
4969 #+HTML: Literal HTML code for export
4970 @end example
4972 @noindent or
4974 @example
4975 #+BEGIN_HTML
4976 All lines between these markers are exported literally
4977 #+END_HTML
4978 @end example
4981 @node Links, Images, Quoting HTML tags, HTML export
4982 @subsection Links
4984 @cindex links, in HTML export
4985 @cindex internal links, in HTML export
4986 @cindex external links, in HTML export
4987 Internal links (@pxref{Internal links}) will continue to work in HTML
4988 files only if they match a dedicated @samp{<<target>>}.  Automatic links
4989 created by radio targets (@pxref{Radio targets}) will also work in the
4990 HTML file.  Links to external files will still work if the HTML file is
4991 in the same directory as the Org-mode file.  Links to other @file{.org}
4992 files will be translated into HTML links under the assumption that an
4993 HTML version also exists of the linked file.  For information related to
4994 linking files while publishing them to a publishing directory see
4995 @ref{Publishing links}.
4997 @node Images, CSS support, Links, HTML export
4998 @subsection Images
5000 @cindex images, inline in HTML
5001 @cindex inlining images in HTML
5002 HTML export can inline images given as links in the Org-mode file, and
5003 it can make an image the clickable part of a link.  By
5004 default@footnote{but see the variable
5005 @code{org-export-html-inline-images}}, images are inlined if a link does
5006 not have a description.  So @samp{[[file:myimg.jpg]]} will be inlined,
5007 while @samp{[[file:myimg.jpg][the image]]} will just produce a link
5008 @samp{the image} that points to the image.  If the description part
5009 itself is a @code{file:} link or a @code{http:} URL pointing to an
5010 image, this image will be inlined and activated so that clicking on the
5011 image will activate the link.  For example, to include a thumbnail that
5012 will link to a high resolution version of the image, you could use:
5014 @example
5015 [[file:highres.jpg][file:thumb.jpg]]
5016 @end example
5018 @noindent
5019 and you could use @code{http} addresses just as well.
5021 @node CSS support,  , Images, HTML export
5022 @subsection CSS support
5024 You can also give style information for the exported file.  The HTML
5025 exporter assigns the following CSS classes to appropriate parts of the
5026 document - your style specifications may change these:
5027 @example
5028 .todo           @r{TODO keywords}
5029 .done           @r{the DONE keyword}
5030 .timestamp      @r{time stamp}
5031 .timestamp-kwd  @r{keyword associated with a time stamp, like SCHEDULED}
5032 .tag            @r{tag in a headline}
5033 .target         @r{target for links}
5034 @end example
5036 The default style specification can be configured through the option
5037 @code{org-export-html-style}.  If you want to use a file-local style,
5038 you may use file variables, best wrapped into a COMMENT section at the
5039 end of the outline tree.  For example@footnote{Under Emacs 21, the
5040 continuation lines for a variable value should have no @samp{#} at the
5041 start of the line.}:
5043 @example
5044 * COMMENT html style specifications
5046 # Local Variables:
5047 # org-export-html-style: "   <style type=\"text/css\">
5048 #       p @{font-weight: normal; color: gray; @}
5049 #       h1 @{color: black; @}
5050 #   </style>"
5051 # End:
5052 @end example
5054 Remember to execute @kbd{M-x normal-mode} after changing this to make
5055 the new style visible to Emacs.  This command restarts org-mode for the
5056 current buffer and forces Emacs to re-evaluate the local variables
5057 section in the buffer.
5059 @c FIXME: More about header and footer styles
5060 @c FIXME: Talk about links and targets.
5062 @node XOXO export, iCalendar export, HTML export, Exporting
5063 @section XOXO export
5064 @cindex XOXO export
5066 Org-mode contains an exporter that produces XOXO-style output.
5067 Currently, this exporter only handles the general outline structure and
5068 does not interpret any additional Org-mode features.
5070 @table @kbd
5071 @kindex C-c C-e x
5072 @item C-c C-e x
5073 Export as XOXO file @file{myfile.html}.
5074 @kindex C-c C-e v
5075 @item C-c C-e v x
5076 Export only the visible part of the document.
5077 @end table
5079 @node iCalendar export, Text interpretation, XOXO export, Exporting
5080 @section iCalendar export
5081 @cindex iCalendar export
5083 Some people like to use Org-mode for keeping track of projects, but
5084 still prefer a standard calendar application for anniversaries and
5085 appointments.  In this case it can be useful to have deadlines and
5086 other time-stamped items in Org-mode files show up in the calendar
5087 application.  Org-mode can export calendar information in the standard
5088 iCalendar format.  If you also want to have TODO entries included in the
5089 export, configure the variable @code{org-icalendar-include-todo}.
5091 @table @kbd
5092 @kindex C-c C-e i
5093 @item C-c C-e i
5094 Create iCalendar entries for the current file and store them in the same
5095 directory, using a file extension @file{.ics}.
5096 @kindex C-c C-e I
5097 @item C-c C-e I
5098 Like @kbd{C-c C-e i}, but do this for all files in
5099 @code{org-agenda-files}.  For each of these files, a separate iCalendar
5100 file will be written.
5101 @kindex C-c C-e c
5102 @item C-c C-e c
5103 Create a single large iCalendar file from all files in
5104 @code{org-agenda-files} and write it to the file given by
5105 @code{org-combined-agenda-icalendar-file}.
5106 @end table
5108 How this calendar is best read and updated, depends on the application
5109 you are using.  The FAQ covers this issue.
5112 @node Text interpretation,  , iCalendar export, Exporting
5113 @section Text interpretation by the exporter
5115 The exporter backends interpret additional structure in the Org-mode file
5116 in order to produce better output.
5118 @menu
5119 * Comment lines::               Some lines will not be exported
5120 * Initial text::                Text before the first headline
5121 * Enhancing text::              Subscripts, symbols and more
5122 * Export options::              How to influence the export settings
5123 @end menu
5125 @node Comment lines, Initial text, Text interpretation, Text interpretation
5126 @subsection Comment lines
5127 @cindex comment lines
5128 @cindex exporting, not
5130 Lines starting with @samp{#} in column zero are treated as comments
5131 and will never be exported.  Also entire subtrees starting with the
5132 word @samp{COMMENT} will never be exported.
5134 @table @kbd
5135 @kindex C-c ;
5136 @item C-c ;
5137 Toggle the COMMENT keyword at the beginning of an entry.
5138 @end table
5140 @node Initial text, Enhancing text, Comment lines, Text interpretation
5141 @subsection Text before the first headline
5143 Org-mode normally ignores any text before the first headline when
5144 exporting, leaving this region for internal links to speed up navigation
5145 etc.  However, in publishing-oriented files, you might want to have some
5146 text before the first headline, like a small introduction, special HTML
5147 code with a navigation bar, etc.  You can ask to have this part of the
5148 file exported as well by setting the variable
5149 @code{org-export-skip-text-before-1st-heading} to @code{nil}.  On a
5150 per-file basis, you can get the same effect with
5152 @example
5153 #+OPTIONS: skip:nil
5154 @end example
5156 The text before the first headline will be fully processed
5157 (@pxref{Enhancing text}), and the first non-comment line becomes the
5158 title of the exported document.  If you need to include literal HTML,
5159 use the special constructs described in @ref{Quoting HTML tags}.  The
5160 table of contents is normally inserted directly before the first
5161 headline of the file.  If you would like to get it to a different
5162 location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by
5163 itself at the desired location.
5165 Finally, if you want to use the space before the first headline for
5166 internal purposes, but @emph{still} want to place something before the
5167 first headline when exporting the file, you can use the @code{#+TEXT}
5168 construct:
5170 @example
5171 #+OPTIONS: skip:t
5172 #+TEXT: This text will go before the *first* headline.
5173 #+TEXT: We place the table of contents here:
5174 #+TEXT: [TABLE-OF-CONTENTS]
5175 #+TEXT: This goes between the table of contents and the first headline
5176 @end example
5178 @node Enhancing text, Export options, Initial text, Text interpretation
5179 @subsection Enhancing text for export
5180 @cindex enhancing text
5181 @cindex richer text
5183 Some of the export backends of Org-mode allow for sophisticated text
5184 formatting, this is true in particular for the HTML backend.  Org-mode
5185 has a number of typing conventions that allow to produce a richly
5186 formatted output.
5188 @itemize @bullet
5190 @cindex hand-formatted lists
5191 @cindex lists, hand-formatted
5192 @item
5193 Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
5194 or @samp{2)} as enumerator will be recognized and transformed if the
5195 backend supports lists.  See @xref{Plain lists}.
5197 @cindex underlined text
5198 @cindex bold text
5199 @cindex italic text
5200 @item
5201 You can make words @b{*bold*}, @i{/italic/}, _underlined_,
5202 @code{=code=}, and even @samp{+strikethrough+}@footnote{but remember
5203 that strikethrough is typographically evil and should @i{never} be
5204 used.}.
5206 @cindex horizontal rules, in exported files
5207 @item
5208 A line consisting of only dashes, and at least 5 of them, will be
5209 exported as a horizontal line (@samp{<hr/>} in HTML).
5211 @cindex LaTeX fragments, export
5212 @cindex TeX macros, export
5213 @item
5214 Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML
5215 entities or images (@pxref{Embedded LaTeX}).
5217 @cindex tables, export
5218 @item
5219 Tables are transformed into native tables under the exporter, if the
5220 export backend supports this. Data fields before the first horizontal
5221 separator line will be formatted as table header fields.
5223 @cindex fixed width
5224 @item
5225 If a headline starts with the word @samp{QUOTE}, the text below the
5226 headline will be typeset as fixed-width, to allow quoting of computer
5227 codes etc.  Lines starting with @samp{:} are also typeset in
5228 fixed-width font.
5229 @table @kbd
5230 @kindex C-c :
5231 @item C-c :
5232 Toggle fixed-width for entry (QUOTE) or region, see below.
5233 @end table
5235 @cindex linebreak, forced
5236 @item 
5237 A double backslash @emph{at the end of a line} enforces a line break at
5238 this position.
5239 @end itemize
5241 If these conversions conflict with your habits of typing ASCII text,
5242 they can all be turned off with corresponding variables.  See the
5243 customization group @code{org-export-general}, and the following section
5244 which explains how to set export options with special lines in a
5245 buffer.
5248 @node Export options,  , Enhancing text, Text interpretation
5249 @subsection Export options
5250 @cindex options, for export
5252 @cindex completion, of option keywords
5253 The exporter recognizes special lines in the buffer which provide
5254 additional information.  These lines may be put anywhere in the file.
5255 The whole set of lines can be inserted into the buffer with @kbd{C-c
5256 C-e t}.  For individual lines, a good way to make sure the keyword is
5257 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
5258 (@pxref{Completion}).
5260 @table @kbd
5261 @kindex C-c C-e t
5262 @item C-c C-e t
5263 Insert template with export options, see example below.
5264 @end table
5266 @example
5267 #+TITLE:     the title to be shown (default is the buffer name)
5268 #+AUTHOR:    the author (default taken from @code{user-full-name})
5269 #+EMAIL:     his/her email address (default from @code{user-mail-address})
5270 #+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
5271 #+TEXT:      Some descriptive text to be inserted at the beginning.
5272 #+TEXT:      Several lines may be given.
5273 #+OPTIONS:   H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t *:nil TeX:t LaTeX:t skip:t
5274 @end example
5276 @noindent
5277 The OPTIONS line is a compact form to specify export settings.  Here
5278 you can:
5279 @cindex headline levels
5280 @cindex section-numbers
5281 @cindex table of contents
5282 @cindex linebreak preservation
5283 @cindex quoted HTML tags
5284 @cindex fixed-width sections
5285 @cindex tables
5286 @cindex @TeX{}-like syntax for sub- and superscripts
5287 @cindex emphasized text
5288 @cindex @TeX{} macros
5289 @cindex La@TeX{} fragments
5290 @example
5291 H:      @r{set the number of headline levels for export}
5292 num:    @r{turn on/off section-numbers}
5293 toc:    @r{turn on/off table of contents, or set level limit (integer)}
5294 \n:     @r{turn on/off linebreak-preservation}
5295 @@:      @r{turn on/off quoted HTML tags}
5296 ::      @r{turn on/off fixed-width sections}
5297 |:      @r{turn on/off tables}
5298 ^:      @r{turn on/off @TeX{}-like syntax for sub- and superscripts.  If}
5299         @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
5300         @r{the simple @code{a_b} will be left as it is.}
5301 *:      @r{turn on/off emphasized text (bold, italic, underlined)}
5302 TeX:    @r{turn on/off simple @TeX{} macros in plain text}
5303 LaTeX:  @r{turn on/off La@TeX{} fragments}
5304 skip:   @r{turn on/off skipping the text before the first heading}
5305 @end example
5307 @node Publishing, Miscellaneous, Exporting, Top
5308 @chapter Publishing
5309 @cindex publishing
5311 Org-mode includes@footnote{@file{org-publish.el} is not yet part of
5312 Emacs, so if you are using @file{org.el} as it comes with Emacs, you
5313 need to download this file separately.  Also make sure org.el is at
5314 least version 4.27.} a publishing management system
5315 that allows you to configure automatic HTML conversion of
5316 @emph{projects} composed of interlinked org files.  This system is
5317 called @emph{org-publish}.  You can also configure org-publish to
5318 automatically upload your exported HTML pages and related attachments,
5319 such as images and source code files, to a web server.  Org-publish turns
5320 org-mode into a web-site authoring tool.
5322 Org-publish has been contributed to Org-mode by David O'Toole.
5324 @menu
5325 * Configuration::               Defining projects
5326 * Sample configuration::        Example projects
5327 * Triggering publication::      Publication commands
5328 @end menu
5330 @node Configuration, Sample configuration, Publishing, Publishing
5331 @section Configuration
5333 Publishing needs significant configuration to specify files, destination
5334 and many other properties of a project.
5336 @menu
5337 * Project alist::               The central configuration variable
5338 * Sources and destinations::    From here to there
5339 * Selecting files::             What files are part of the project?
5340 * Publishing action::           Setting the function doing the publishing
5341 * Publishing options::          Tweaking HTML export
5342 * Publishing links::            Which links keep working after publishing?
5343 * Project page index::          Publishing a list of project files
5344 @end menu
5346 @node Project alist, Sources and destinations, Configuration, Configuration
5347 @subsection The variable @code{org-publish-project-alist}
5348 @cindex org-publish-project-alist
5349 @cindex projects, for publishing
5351 Org-publish is configured almost entirely through setting the value of
5352 one variable, called @code{org-publish-project-alist}.
5353 Each element of the list configures one project, and may be in one of
5354 the two following forms:
5356 @lisp
5357 ("project-name"  :property value :property value ...)
5359 @r{or} 
5361 ("project-name"  :components ("project-name" "project-name" ...))
5363 @end lisp
5365 In both cases, projects are configured by specifying property values.
5366 A project defines the set of files that will be published, as well as
5367 the publishing configuration to use when publishing those files.  When
5368 a project takes the second form listed above, the individual members
5369 of the ``components'' property are taken to be components of the
5370 project, which group together files requiring different publishing
5371 options. When you publish such a ``meta-project'' all the components
5372 will also publish.
5374 @node Sources and destinations, Selecting files, Project alist, Configuration
5375 @subsection Sources and destinations for files
5376 @cindex directories, for publishing
5378 Most properties are optional, but some should always be set. In
5379 particular, org-publish needs to know where to look for source files,
5380 and where to put published files.
5382 @multitable @columnfractions 0.3 0.7
5383 @item @code{:base-directory}
5384 @tab Directory containing publishing source files
5385 @item @code{:publishing-directory}
5386 @tab Directory (possibly remote) where output files will be published.
5387 @item @code{:preparation-function}
5388 @tab Function called before starting publishing process, for example to
5389 run @code{make} for updating files to be published.
5390 @end multitable
5391 @noindent
5393 @node Selecting files, Publishing action, Sources and destinations, Configuration
5394 @subsection Selecting files
5395 @cindex files, selecting for publishing
5397 By default, all files with extension @file{.org} in the base directory
5398 are considered part of the project.  This can be modified by setting the
5399 properties 
5400 @multitable @columnfractions 0.25 0.75
5401 @item @code{:base-extension}
5402 @tab Extension (without the dot!) of source files.  This actually is a
5403 regular expression.
5405 @item @code{:exclude} 
5406 @tab Regular expression to match file names that should not be
5407 published, even though they have been selected on the basis of their
5408 extension.
5410 @item @code{:include}
5411 @tab List of files to be included regardless of @code{:base-extension}
5412 and @code{:exclude}.
5413 @end multitable
5415 @node Publishing action, Publishing options, Selecting files, Configuration
5416 @subsection Publishing Action
5417 @cindex action, for publishing
5419 Publishing means that a file is copied to the destination directory and
5420 possibly transformed in the process.  The default transformation is to
5421 export Org-mode files as HTML files, and this is done by the function
5422 @code{org-publish-org-to-html} which calls the HTML exporter
5423 (@pxref{HTML export}).  Other files like images only need to be copied
5424 to the publishing destination.  For non-Org-mode files, you need to
5425 specify the publishing function.
5427 @multitable @columnfractions 0.3 0.7
5428 @item @code{:publishing-function}
5429 @tab Function executing the publication of a file.  This may also be a
5430 list of functions, which will all be called in turn.
5431 @end multitable
5433 The function must accept two arguments: a property list containing at
5434 least a @code{:publishing-directory} property, and the name of the file
5435 to be published.  It should take the specified file, make the necessary
5436 transformation (if any) and place the result into the destination folder.
5437 You can write your own publishing function, but @code{org-publish}
5438 provides one for attachments (files that only need to be copied):
5439 @code{org-publish-attachment}.
5441 @node Publishing options, Publishing links, Publishing action, Configuration
5442 @subsection Options for the HTML exporter
5443 @cindex options, for publishing
5445 The property list can be used to set many export options for the HTML
5446 exporter.  In most cases, these properties correspond to user variables
5447 in Org-mode.  The table below lists these properties along with the
5448 variable they belong to.  See the documentation string for the
5449 respective variable for details.
5451 @multitable @columnfractions 0.3 0.7
5452 @item @code{:language}              @tab @code{org-export-default-language}
5453 @item @code{:headline-levels}       @tab @code{org-export-headline-levels}
5454 @item @code{:section-numbers}       @tab @code{org-export-with-section-numbers}
5455 @item @code{:table-of-contents}     @tab @code{org-export-with-toc}
5456 @item @code{:archived-trees}        @tab @code{org-export-with-archived-trees}
5457 @item @code{:emphasize}             @tab @code{org-export-with-emphasize}
5458 @item @code{:sub-superscript}       @tab @code{org-export-with-sub-superscripts}
5459 @item @code{:TeX-macros}            @tab @code{org-export-with-TeX-macros}
5460 @item @code{:LaTeX-fragments}       @tab @code{org-export-with-LaTeX-fragments}
5461 @item @code{:fixed-width}           @tab @code{org-export-with-fixed-width}
5462 @item @code{:timestamps}           .@tab @code{org-export-with-timestamps}
5463 @item @code{:tags}                 .@tab @code{org-export-with-tags}
5464 @item @code{:tables}                @tab @code{org-export-with-tables}
5465 @item @code{:table-auto-headline}   @tab @code{org-export-highlight-first-table-line}
5466 @item @code{:style}                 @tab @code{org-export-html-style}
5467 @item @code{:convert-org-links}     @tab @code{org-export-html-link-org-files-as-html}
5468 @item @code{:inline-images}         @tab @code{org-export-html-inline-images}
5469 @item @code{:expand-quoted-html}    @tab @code{org-export-html-expand}
5470 @item @code{:timestamp}             @tab @code{org-export-html-with-timestamp}
5471 @item @code{:publishing-directory}  @tab @code{org-export-publishing-directory}
5472 @item @code{:preamble}              @tab @code{org-export-html-preamble}
5473 @item @code{:postamble}             @tab @code{org-export-html-postamble}
5474 @item @code{:auto-preamble}         @tab @code{org-export-html-auto-preamble}
5475 @item @code{:auto-postamble}        @tab @code{org-export-html-auto-postamble}
5476 @item @code{:author}                @tab @code{user-full-name}
5477 @item @code{:email}                 @tab @code{user-mail-address}
5478 @end multitable
5480 When a property is given a value in org-publish-project-alist, its
5481 setting overrides the value of the corresponding user variable (if any)
5482 during publishing.  options set within a file (@pxref{Export
5483 options}), however, override everything.
5485 @node Publishing links, Project page index, Publishing options, Configuration
5486 @subsection Links between published files
5487 @cindex links, publishing
5489 To create a link from one Org-mode file to another, you would use
5490 something like @samp{[[file:foo.org][The foo]]} or simply
5491 @samp{file:foo.org.} (@pxref{Hyperlinks}).  Upon publishing this link
5492 becomes a link to @file{foo.html}.  In this way, you can interlink the
5493 pages of your "org web" project and the links will work as expected when
5494 you publish them to HTML.
5496 You may also link to related files, such as images. Provided you are
5497 careful with relative pathnames, and provided you have also configured
5498 org-publish to upload the related files, these links will work
5499 too. @ref{Complex example} for an example of this usage.
5501 Sometime an Org-mode file to be published may contain links that are
5502 only valid in your production environment, but not in the publishing
5503 location.  In this case, use the property 
5505 @multitable @columnfractions 0.4 0.6
5506 @item @code{:link-validation-function}
5507 @tab Function to validate links
5508 @end multitable
5510 @noindent
5511 to define a function for checking link validity.  This function must
5512 accept two arguments, the file name and a directory relative to which
5513 the file name is interpreted in the production environment.  If this
5514 function returns @code{nil}, then the HTML generator will only insert a
5515 description into the HTML file, but no link.  One option for this
5516 function is @code{org-publish-validate-link} which checks if the given
5517 file is part of any project in @code{org-publish-project-alist}.
5519 @node Project page index,  , Publishing links, Configuration
5520 @subsection Project page index
5521 @cindex index, of published pages
5523 The following properties may be used to control publishing of an
5524 index of files or summary page for a given project.
5526 @multitable @columnfractions 0.25 0.75
5527 @item @code{:auto-index}
5528 @tab When non-nil, publish an index during org-publish-current-project or
5529 org-publish-all.
5531 @item @code{:index-filename}
5532 @tab Filename for output of index. Defaults to @file{index.org} (which
5533 becomes @file{index.html}).
5535 @item @code{:index-title}
5536 @tab Title of index page. Defaults to name of file.
5538 @item @code{:index-function}
5539 @tab Plugin function to use for generation of index.
5540 Defaults to @code{org-publish-org-index}, which generates a plain list
5541 of links to all files in the project.
5542 @end multitable
5544 @node Sample configuration, Triggering publication, Configuration, Publishing
5545 @section Sample configuration
5547 Below we provide two example configurations.  The first one is a simple
5548 project publishing only a set of Org-mode files.  The second example is
5549 more complex, with a multi-component project.
5551 @menu
5552 * Simple example::              One-component publishing
5553 * Complex example::             A multi-component publishing example
5554 @end menu
5556 @node Simple example, Complex example, Sample configuration, Sample configuration
5557 @subsection Example: simple publishing configuration
5559 This example publishes a set of Org-mode files to the @file{public_html}
5560 directory on the local machine.
5562 @lisp
5563 (setq org-publish-project-alist
5564       '(("org" 
5565          :base-directory "~/org/"
5566          :publishing-directory "~/public_html"
5567          :section-numbers nil
5568          :table-of-contents nil
5569          :style "<link rel=stylesheet 
5570                 href=\"../other/mystyle.css\"
5571                 type=\"text/css\">")))
5572 @end lisp
5574 @node Complex example,  , Simple example, Sample configuration
5575 @subsection Example: complex publishing configuration
5577 This more complicated example publishes an entire website, including
5578 org files converted to HTML, image files, emacs lisp source code, and
5579 stylesheets. The publishing-directory is remote and private files are
5580 excluded.
5582 To ensure that links are preserved, care should be taken to replicate
5583 your directory structure on the web server, and to use relative file
5584 paths. For example, if your org files are kept in @file{~/org} and your
5585 publishable images in @file{~/images}, you'd link to an image with
5587 @example
5588 file:../images/myimage.png
5589 @end example
5591 On the web server, the relative path to the image should be the
5592 same. You can accomplish this by setting up an "images" folder in the
5593 right place on the webserver, and publishing images to it.
5595 @lisp
5596 (setq org-publish-project-alist
5597       '(("orgfiles"
5598           :base-directory "~/org/"
5599           :base-extension "org"
5600           :publishing-directory "/ssh:user@@host:~/html/notebook/"
5601           :publishing-function org-publish-org-to-html
5602           :exclude "PrivatePage.org"   ;; regexp
5603           :headline-levels 3
5604           :section-numbers nil
5605           :table-of-contents nil
5606           :style "<link rel=stylesheet 
5607                   href=\"../other/mystyle.css\" type=\"text/css\">"
5608           :auto-preamble t
5609           :auto-postamble nil)
5610          
5611          ("images"
5612           :base-directory "~/images/"
5613           :base-extension "jpg\\|gif\\|png"
5614           :publishing-directory "/ssh:user@@host:~/html/images/"
5615           :publishing-function org-publish-attachment)
5617          ("other"
5618           :base-directory "~/other/"
5619           :base-extension "css\\|el"
5620           :publishing-directory "/ssh:user@@host:~/html/other/"
5621           :publishing-function org-publish-attachment)
5622          ("website" :components ("orgfiles" "images" "other"))))
5623 @end lisp
5625 @node Triggering publication,  , Sample configuration, Publishing
5626 @section Triggering publication
5628 Once org-publish is properly configured, you can publish with the
5629 following functions: 
5631 @table @kbd
5632 @item C-c C-e C
5633 Prompt for a specific project and publish all files that belong to it.
5634 @item C-c C-e P
5635 Publish the project containing the current file.
5636 @item C-c C-e F
5637 Publish only the current file.
5638 @item C-c C-e A
5639 Publish all projects.
5640 @end table
5642 Org uses timestamps to track when a file has changed. The above
5643 functions normally only publish changed files. You can override this and
5644 force publishing of all files by giving a prefix argument.
5646 @node Miscellaneous, Extensions and Hacking, Publishing, Top
5647 @chapter Miscellaneous
5649 @menu
5650 * Completion::                  M-TAB knows what you need
5651 * Customization::               Adapting Org-mode to your taste
5652 * In-buffer settings::          Overview of the #+KEYWORDS
5653 * The very busy C-c C-c key::   When in doubt, press C-c C-c
5654 * Clean view::                  Getting rid of leading stars in the outline
5655 * TTY keys::                    Using Org-mode on a tty
5656 * Interaction::                 Other Emacs packages
5657 * Bugs::                        Things which do not work perfectly
5658 @end menu
5660 @node Completion, Customization, Miscellaneous, Miscellaneous
5661 @section Completion
5662 @cindex completion, of @TeX{} symbols
5663 @cindex completion, of TODO keywords
5664 @cindex completion, of dictionary words
5665 @cindex completion, of option keywords
5666 @cindex completion, of tags
5667 @cindex completion, of link abbreviations
5668 @cindex @TeX{} symbol completion
5669 @cindex TODO keywords completion
5670 @cindex dictionary word completion
5671 @cindex option keyword completion
5672 @cindex tag completion
5673 @cindex link abbreviations, completion of
5675 Org-mode supports in-buffer completion.  This type of completion does
5676 not make use of the minibuffer.  You simply type a few letters into
5677 the buffer and use the key to complete text right there.
5679 @table @kbd
5680 @kindex M-@key{TAB}
5681 @item M-@key{TAB}
5682 Complete word at point
5683 @itemize @bullet
5684 @item
5685 At the beginning of a headline, complete TODO keywords.
5686 @item
5687 After @samp{\}, complete @TeX{} symbols supported by the exporter.
5688 @item
5689 After @samp{*}, complete headlines in the current buffer so that they
5690 can be used in search links like @samp{[[*find this headline]]}.
5691 @item
5692 After @samp{:}, complete tags.  The list of tags is taken from the
5693 variable @code{org-tag-alist} (possibly set through the @samp{#+TAGS}
5694 in-buffer option, @pxref{Setting tags}), or it is created dynamically
5695 from all tags used in the current buffer.
5696 @item
5697 After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
5698 @item
5699 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
5700 @samp{OPTIONS} which set file-specific options for Org-mode.  When the
5701 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
5702 will insert example settings for this keyword.
5703 @item
5704 In the line after @samp{#+STARTUP: }, complete startup keywords,
5705 i.e. valid keys for this line.
5706 @item
5707 Elsewhere, complete dictionary words using ispell.
5708 @end itemize
5709 @end table
5711 @node Customization, In-buffer settings, Completion, Miscellaneous
5712 @section Customization
5713 @cindex customization
5714 @cindex options, for customization
5715 @cindex variables, for customization
5717 There are more than 180 variables that can be used to customize
5718 Org-mode.  For the sake of compactness of the manual, I am not
5719 describing the variables here.  A structured overview of customization
5720 variables is available with @kbd{M-x org-customize}.  Or select
5721 @code{Browse Org Group} from the @code{Org->Customization} menu.  Many
5722 settings can also be activated on a per-file basis, by putting special
5723 lines into the buffer (@pxref{In-buffer settings}).
5725 @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
5726 @section Summary of in-buffer settings
5727 @cindex in-buffer settings
5728 @cindex special keywords
5730 Org-mode uses special lines in the buffer to define settings on a
5731 per-file basis.  These lines start with a @samp{#+} followed by a
5732 keyword, a colon, and then individual words defining a setting.  Several
5733 setting words can be in the same line, but you can also have multiple
5734 lines for the keyword.  While these settings are described throughout
5735 the manual, here is a summary.  After changing any of those lines in the
5736 buffer, press @kbd{C-c C-c} with the cursor still in the line to
5737 activate the changes immediately.  Otherwise they become effective only
5738 when the file is visited again in a new Emacs session.
5740 @table @kbd
5741 @item #+STARTUP:
5742 This line sets options to be used at startup of org-mode, when an
5743 Org-mode file is being visited.  The first set of options deals with the
5744 initial visibility of the outline tree.  The corresponding variable for
5745 global default settings is @code{org-startup-folded}, with a default
5746 value @code{t}, which means @code{overview}.
5747 @cindex @code{overview}, STARTUP keyword
5748 @cindex @code{content}, STARTUP keyword
5749 @cindex @code{showall}, STARTUP keyword
5750 @example
5751 overview   @r{top-level headlines only}
5752 content    @r{all headlines}
5753 showall    @r{no folding at all, show everything}
5754 @end example
5755 Then there are options for aligning tables upon visiting a file.  This
5756 is useful in files containing narrowed table columns.  The corresponding
5757 variable is @code{org-startup-align-all-tables}, with a default value
5758 @code{nil}. 
5759 @cindex @code{align}, STARTUP keyword
5760 @cindex @code{noalign}, STARTUP keyword
5761 @example
5762 align      @r{align all tables}
5763 noalign    @r{don't align tables on startup}
5764 @end example
5765 Logging TODO state changes and clock intervals (variable
5766 @code{org-log-done}) can be configured using these options.
5767 @cindex @code{logdone}, STARTUP keyword
5768 @cindex @code{nologging}, STARTUP keyword
5769 @cindex @code{lognotedone}, STARTUP keyword
5770 @cindex @code{lognoteclock-out}, STARTUP keyword
5771 @cindex @code{lognotestate}, STARTUP keyword
5772 @cindex @code{logrepeat}, STARTUP keyword
5773 @cindex @code{nologrepeat}, STARTUP keyword
5774 @example
5775 logging          @r{record a timestamp when an item is marked DONE}
5776 nologging        @r{don't record when items are marked DONE}
5777 lognotedone      @r{record timestamp and a note when DONE}
5778 lognotestate     @r{record timestamp, note when TODO state changes}
5779 logrepeat        @r{record a not when re-instating a repeating item}
5780 nologrepeat      @r{do not record when re-instating repeating item}
5781 lognoteclock-out @r{record timestamp and a note when clocking out}
5782 @end example
5783 Here are the options for hiding leading stars in outline headings.  The
5784 corresponding variables are @code{org-hide-leading-stars} and
5785 @code{org-odd-levels-only}, both with a default setting @code{nil}
5786 (meaning @code{showstars} and @code{oddeven}).
5787 @cindex @code{hidestars}, STARTUP keyword
5788 @cindex @code{showstars}, STARTUP keyword
5789 @cindex @code{odd}, STARTUP keyword
5790 @cindex @code{even}, STARTUP keyword
5791 @example
5792 hidestars  @r{make all but one of the stars starting a headline invisible.}
5793 showstars  @r{show all stars starting a headline}
5794 odd        @r{allow only odd outline levels (1,3,...)}
5795 oddeven    @r{allow all outline levels}
5796 @end example
5797 To turn on custom format overlays over time stamps (variables
5798 @code{org-put-time-stamp-overlays} and
5799 @code{org-time-stamp-overlay-formats}), use
5800 @cindex @code{customtime}, STARTUP keyword
5801 @example
5802 customtime @r{overlay custom time format}
5803 @end example
5804 The following options influence the table spreadsheet (variable
5805 @code{constants-unit-system}).
5806 @cindex @code{constcgs}, STARTUP keyword
5807 @cindex @code{constSI}, STARTUP keyword
5808 @example
5809 constcgs   @r{@file{constants.el} should use the c-g-s unit system}
5810 constSI    @r{@file{constants.el} should use the SI unit system}
5811 @end example
5812 @item #+SEQ_TODO:   #+TYP_TODO:
5813 These lines set the TODO keywords and their interpretation in the
5814 current file.  The corresponding variables are @code{org-todo-keywords}
5815 and @code{org-todo-interpretation}.
5816 @item #+TAGS:  TAG1(c1) TAG2(c2)
5817 These lines (several such lines are allowed) specify the legal tags in
5818 this file, and (potentially) the corresponding @emph{fast tag selection}
5819 keys.  The corresponding variable is @code{org-tag-alist}.
5820 @item #+LINK:  linkword replace
5821 These lines (several are allowed) specify link abbreviations.
5822 @xref{Link abbreviations}.  The corresponding variable is
5823 @code{org-link-abbrev-alist}.
5824 @item #+CATEGORY:
5825 This line sets the category for the agenda file.  The category applies
5826 for all subsequent lines until the next @samp{#+CATEGORY} line, or the
5827 end of the file.  The first such line also applies to any entries before it.
5828 @item #+ARCHIVE: %s_done::
5829 This line sets the archive location for the agenda file.  It applies for
5830 all subsequent lines until the next @samp{#+CATEGORY} line, or the end
5831 of the file.  The first such line also applies to any entries before it.
5832 The corresponding variable is @code{org-archive-location}.
5833 @item #+TBLFM:
5834 This line contains the formulas for the table directly above the line.
5835 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS:
5836 These lines provide settings for exporting files.  For more details see
5837 @ref{Export options}.
5838 @end table
5840 @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
5841 @section The very busy C-c C-c key
5842 @kindex C-c C-c
5843 @cindex C-c C-c, overview
5845 The key @kbd{C-c C-c} has many purposes in org-mode, which are all
5846 mentioned scattered throughout this manual.  One specific function of
5847 this key is to add @emph{tags} to a headline (@pxref{Tags}).  In many
5848 other circumstances it means something like @emph{Hey Org-mode, look
5849 here and update according to what you see here}.  Here is a summary of
5850 what this means in different contexts.
5852 @itemize @minus
5853 @item
5854 If there are highlights in the buffer from the creation of a sparse
5855 tree, or from clock display, remove these highlights.
5856 @item
5857 If the cursor is in one of the special @code{#+KEYWORD} lines, this
5858 triggers scanning the buffer for these lines and updating the
5859 information. 
5860 @item
5861 If the cursor is inside a table, realign the table.  This command
5862 works even if the automatic table editor has been turned off.
5863 @item
5864 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
5865 the entire table.
5866 @item
5867 If the cursor is inside a table created by the @file{table.el} package,
5868 activate that table.
5869 @item
5870 If the current buffer is a remember buffer, close the note and file it.
5871 With a prefix argument, file it, without further interaction, to the
5872 default location.
5873 @item
5874 If the cursor is on a @code{<<<target>>>}, update radio targets and
5875 corresponding links in this buffer.
5876 @item
5877 If the cursor is in a plain list item with a checkbox, toggle the status
5878 of the checkbox.
5879 @item
5880 If the cursor is on a numbered item in a plain list, renumber the
5881 ordered list.
5882 @end itemize
5884 @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
5885 @section A cleaner outline view
5886 @cindex hiding leading stars
5887 @cindex clean outline view
5889 Some people find it noisy and distracting that the Org-mode headlines
5890 are starting with a potentially large number of stars.  For example
5891 the tree from @ref{Headlines}:
5893 @example
5894 * Top level headline
5895 ** Second level
5896 *** 3rd level
5897     some text
5898 *** 3rd level
5899     more text
5900 * Another top level headline
5901 @end example
5903 @noindent
5904 Unfortunately this is deeply ingrained into the code of Org-mode and
5905 cannot be easily changed.  You can, however, modify the display in such
5906 a way that all leading stars become invisible and the outline more easy
5907 to read.  To do this, customize the variable
5908 @code{org-hide-leading-stars} like this:
5910 @lisp
5911 (setq org-hide-leading-stars t)
5912 @end lisp
5914 @noindent
5915 or change this on a per-file basis with one of the lines (anywhere in
5916 the buffer)
5918 @example
5919 #+STARTUP: showstars
5920 #+STARTUP: hidestars
5921 @end example
5923 @noindent
5924 Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
5925 the modifications.
5927 With stars hidden, the tree becomes:
5929 @example
5930 * Top level headline
5931  * Second level
5932   * 3rd level
5933     some text
5934   * 3rd level
5935     more text
5936 * Another top level headline
5937 @end example
5939 @noindent
5940 Note that the leading stars are not truly replaced by whitespace, they
5941 are only fontified with the face @code{org-hide} that uses the
5942 background color as font color.  If you are not using either white or
5943 black background, you may have to customize this face to get the wanted
5944 effect.  Another possibility is to set this font such that the extra
5945 stars are @i{almost} invisible, for example using the color
5946 @code{grey90} on a white background.
5948 Things become cleaner still if you skip all the even levels and use only
5949 odd levels 1, 3, 5..., effectively adding two stars to go from one
5950 outline level to the next:
5952 @example
5953 * Top level headline
5954   * Second level
5955     * 3rd level
5956       some text
5957     * 3rd level
5958       more text
5959 * Another top level headline
5960 @end example
5962 @noindent
5963 In order to make the structure editing and export commands handle this
5964 convention correctly, use
5966 @lisp
5967 (setq org-odd-levels-only t)
5968 @end lisp
5970 @noindent
5971 or set this on a per-file basis with one of the following lines (don't
5972 forget to press @kbd{C-c C-c} with the cursor in the startup line to
5973 activate changes immediately).
5975 @example
5976 #+STARTUP: odd
5977 #+STARTUP: oddeven
5978 @end example
5980 You can convert an Org-mode file from single-star-per-level to the
5981 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
5982 RET} in that file.  The reverse operation is @kbd{M-x
5983 org-convert-to-oddeven-levels}.
5985 @node TTY keys, Interaction, Clean view, Miscellaneous
5986 @section Using org-mode on a tty
5987 @cindex tty keybindings
5989 Org-mode uses a number of keys that are not accessible on a tty.  This
5990 applies to most special keys like cursor keys, @key{TAB} and
5991 @key{RET}, when these are combined with modifier keys like @key{Meta}
5992 and/or @key{Shift}.  Org-mode uses these bindings because it needs to
5993 provide keys for a large number of commands, and because these keys
5994 appeared particularly easy to remember.  In order to still be able to
5995 access the core functionality of Org-mode on a tty, alternative
5996 bindings are provided.  Here is a complete list of these bindings,
5997 which are obviously more cumbersome to use.  Note that sometimes a
5998 work-around can be better.  For example changing a time stamp is
5999 really only fun with @kbd{S-@key{cursor}} keys.  On a tty you would
6000 rather use @kbd{C-c .}  to re-insert the timestamp.
6002 @multitable @columnfractions 0.15 0.2 0.2
6003 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
6004 @item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
6005 @item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
6006 @item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
6007 @item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
6008 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
6009 @item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
6010 @item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
6011 @item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
6012 @item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
6013 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
6014 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
6015 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
6016 @item @kbd{S-@key{left}}    @tab @kbd{C-c @key{left}}      @tab
6017 @item @kbd{S-@key{right}}   @tab @kbd{C-c @key{right}}     @tab
6018 @item @kbd{S-@key{up}}      @tab @kbd{C-c @key{up}}        @tab
6019 @item @kbd{S-@key{down}}    @tab @kbd{C-c @key{down}}      @tab
6020 @item @kbd{C-S-@key{left}}  @tab @kbd{C-c C-x @key{left}}  @tab
6021 @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
6022 @end multitable
6024 @node Interaction, Bugs, TTY keys, Miscellaneous
6025 @section Interaction with other packages
6026 @cindex packages, interaction with other
6027 Org-mode lives in the world of GNU Emacs and interacts in various ways
6028 with other code out there.
6030 @menu
6031 * Cooperation::                 Packages Org-mode cooperates with
6032 * Conflicts::                   Packages that lead to conflicts
6033 @end menu
6035 @node Cooperation, Conflicts, Interaction, Interaction
6036 @subsection Packages that Org-mode cooperates with
6038 @table @asis
6039 @cindex @file{calc.el}
6040 @item @file{calc.el} by Dave Gillespie
6041 Org-mode uses the calc package for implementing spreadsheet
6042 functionality in its tables (@pxref{The spreadsheet}).  Org-mode
6043 checks for the availability of calc by looking for the function
6044 @code{calc-eval} which should be autoloaded in your setup if calc has
6045 been installed properly.  As of Emacs 22, calc is part of the Emacs
6046 distribution.  Another possibility for interaction between the two
6047 packages is using calc for embedded calculations. @xref{Embedded Mode,
6048 , Embedded Mode, calc, GNU Emacs Calc Manual}.
6049 @cindex @file{constants.el}
6050 @item @file{constants.el} by Carsten Dominik
6051 In a table formula (@pxref{The spreadsheet}), it is possible to use
6052 names for natural constants or units.  Instead of defining your own
6053 constants in the variable @code{org-table-formula-constants}, install
6054 the @file{constants} package which defines a large number of constants
6055 and units, and lets you use unit prefixes like @samp{M} for
6056 @samp{Mega} etc.  You will need version 2.0 of this package, available
6057 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org-mode checks for
6058 the function @code{constants-get}, which has to be autoloaded in your
6059 setup.  See the installation instructions in the file
6060 @file{constants.el}.
6061 @item @file{cdlatex.el} by Carsten Dominik
6062 @cindex @file{cdlatex.el}
6063 Org-mode can make use of the cdlatex package to efficiently enter
6064 La@TeX{} fragments into Org-mode files. See @ref{CDLaTeX mode}.
6065 @item @file{remember.el} by John Wiegley
6066 @cindex @file{remember.el}
6067 Org mode cooperates with remember, see @ref{Remember}.
6068 @file{Remember.el} is not part of Emacs, find it on the web.
6069 @cindex @file{table.el}
6070 @item @file{table.el} by Takaaki Ota
6071 @kindex C-c C-c
6072 @cindex table editor, @file{table.el}
6073 @cindex @file{table.el}
6075 Complex ASCII tables with automatic line wrapping, column- and
6076 row-spanning, and alignment can be created using the Emacs table
6077 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
6078 and also part of Emacs 22).
6079 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org-mode
6080 will call @command{table-recognize-table} and move the cursor into the
6081 table.  Inside a table, the keymap of Org-mode is inactive.  In order
6082 to execute Org-mode-related commands, leave the table.
6084 @table @kbd
6085 @kindex C-c C-c
6086 @item C-c C-c
6087 Recognize @file{table.el} table.  Works when the cursor is in a
6088 table.el table.
6090 @kindex C-c ~
6091 @item C-c ~
6092 Insert a table.el table.  If there is already a table at point, this
6093 command converts it between the table.el format and the Org-mode
6094 format.  See the documentation string of the command
6095 @code{org-convert-table} for the restrictions under which this is
6096 possible.
6097 @end table
6098 @file{table.el} is part of Emacs 22.
6099 @end table
6101 @node Conflicts,  , Cooperation, Interaction
6102 @subsection Packages that lead to conflicts with Org-mode
6104 @table @asis
6106 @cindex @file{allout.el}
6107 @item @file{allout.el} by Ken Manheimer
6108 Startup of Org-mode may fail with the error message
6109 @code{(wrong-type-argument keymapp nil)} when there is an outdated
6110 version @file{allout.el} on the load path, for example the version
6111 distributed with Emacs 21.x.  Upgrade to Emacs 22 and this problem will
6112 disappear.  If for some reason you cannot do this, make sure that org.el
6113 is loaded @emph{before} @file{allout.el}, for example by putting
6114 @code{(require 'org)} early enough into your @file{.emacs} file.
6116 @cindex @file{CUA.el}
6117 @item @file{CUA.el} by Kim. F. Storm
6118 Keybindings in Org-mode conflict with the @kbd{S-<cursor>} keys
6119 used by CUA-mode (as well as pc-select-mode and s-region-mode) to
6120 select and extend the region.  If you want to use one of these
6121 packages along with Org-mode, configure the variable
6122 @code{org-CUA-compatible}.  When set, Org-mode will move the following
6123 keybindings in org-mode files, and in the agenda buffer (but not
6124 during date selection).
6126 @example
6127 S-UP    -> M-p             S-DOWN  -> M-n
6128 S-LEFT  -> M--             S-RIGHT -> M-+
6129 @end example
6131 Yes, these are unfortunately more difficult to remember.  If you want
6132 to have other replacement keys, look at the variable
6133 @code{org-disputed-keys}.
6134 @item @file{windmove.el} by Hovav Shacham
6135 @cindex @file{windmove.el}
6136 Also this package uses the @kbd{S-<cursor>} keys, so everything written
6137 in the paragraph above about CUA mode also applies here.
6138 @end table
6140 @node Bugs,  , Interaction, Miscellaneous
6141 @section Bugs
6142 @cindex bugs
6144 Here is a list of things that should work differently, but which I
6145 have found too hard to fix.
6147 @itemize @bullet
6148 @item
6149 If a table field starts with a link, and if the corresponding table
6150 column is narrowed (@pxref{Narrow columns}) to a width too small to
6151 display the link, the field would look entirely empty even though it is
6152 not.  To prevent this, Org-mode throws an error.  The work-around is to
6153 make the column wide enough to fit the link, or to add some text (at
6154 least 2 characters) before the link in the same field.
6155 @item
6156 Narrowing table columns does not work on XEmacs, because the
6157 @code{format} function does not transport text properties.
6158 @item
6159 Text in an entry protected with the @samp{QUOTE} keyword should not
6160 autowrap.
6161 @item
6162 When the application called by @kbd{C-c C-o} to open a file link fails
6163 (for example because the application does not exist or refuses to open
6164 the file), it does so silently.  No error message is displayed.
6165 @item
6166 Recalculating a table line applies the formulas from left to right.
6167 If a formula uses @emph{calculated} fields further down the row,
6168 multiple recalculation may be needed to get all fields consistent.  You
6169 may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
6170 recalculate until convergence.
6171 @item
6172 A single letter cannot be made bold, for example @samp{*a*}.
6173 @item
6174 The exporters work well, but could be made more efficient.
6175 @end itemize
6178 @node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
6179 @appendix Extensions, Hooks and Hacking
6181 This appendix lists extensions for Org-mode written by other authors.
6182 It also covers some aspects where users can extend the functionality of
6183 Org-mode.
6185 @menu
6186 * Extensions::                  Existing 3rd-part extensions
6187 * Tables in arbitrary syntax::  Orgtbl for LaTeX and other programs
6188 * Dynamic blocks::              Automatically filled blocks
6189 * Special agenda views::        Customized views
6190 @end menu
6192 @node Extensions, Tables in arbitrary syntax, Extensions and Hacking, Extensions and Hacking
6193 @section Third-party extensions for Org-mode
6194 @cindex extension, third-party
6196 The following extensions for Org-mode have been written by other people:
6198 @table @asis
6199 @cindex @file{org-publish.el}
6200 @item @file{org-publish.el} by David O'Toole
6201 This package provides facilities for publishing related sets of Org-mode
6202 files together with linked files like images as webpages.  It is
6203 highly configurable and can be used for other publishing purposes as
6204 well.  As of Org-mode version 4.30, @file{org-publish.el} is part of the
6205 Org-mode distribution.  It is not yet part of Emacs, however, a delay
6206 caused by the preparations for the 22.1 release.  In the mean time,
6207 @file{org-publish.el} can be downloaded from David's site:
6208 @url{http://dto.freeshell.org/e/org-publish.el}.
6209 @cindex @file{org-mouse.el}
6210 @item @file{org-mouse.el} by Piotr Zielinski
6211 This package implements extended mouse functionality for Org-mode.  It
6212 allows you to cycle visibility and to edit the document structure with
6213 the mouse.  Best of all, it provides a context-sensitive menu on
6214 @key{mouse-3} that changes depending on the context of a mouse-click.
6215 As of Org-mode version 4.53, @file{org-mouse.el} is part of the
6216 Org-mode distribution.  It is not yet part of Emacs, however, a delay
6217 caused by the preparations for the 22.1 release.  In the mean time,
6218 @file{org-mouse.el} can be downloaded from Piotr's site:
6219 @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}.
6220 @cindex @file{org-blog.el}
6221 @item @file{org-blog.el} by David O'Toole
6222 A blogging plug-in for @file{org-publish.el}.@*
6223 @url{http://dto.freeshell.org/notebook/OrgMode.html}.
6224 @cindex @file{blorg.el}
6225 @item @file{blorg.el} by Bastien Guerry
6226 Publish Org-mode files as
6227 blogs. @url{http://www.cognition.ens.fr/~guerry/blorg.html}.
6228 @cindex @file{org2rem.el}
6229 @item @file{org2rem.el} by Bastien Guerry
6230 Translates Org-mode files into something readable by
6231 Remind. @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
6232 @end table
6234 @page
6236 @node Tables in arbitrary syntax, Dynamic blocks, Extensions, Extensions and Hacking
6237 @section Tables in arbitrary syntax
6238 @cindex tables, in other modes
6239 @cindex orgtbl-mode
6241 Since Orgtbl-mode can be used as a minor mode in arbitrary buffers, a
6242 frequent feature request has been to make it work with native tables in
6243 specific languages, for example LaTeX.  However, this is extremely hard
6244 to do in a general way, would lead to a customization nightmare, and
6245 would take away much of the simplicity of the Orgtbl-mode table editor.
6247 This appendix describes a different approach.  We keep the Orgtbl-mode
6248 table in its native format (the @i{source table}), and use a custom
6249 function to @i{translate} the table to the correct syntax, and to
6250 @i{install} it in the right location (the @i{target table}).  This puts
6251 the burden of writing conversion functions on the user, but it allows
6252 for a very flexible system.
6254 @menu
6255 * Radio tables::                Sending and receiving
6256 * A LaTeX example::             Step by step, almost a tutorial
6257 * Translator functions::        Copy and modify
6258 @end menu
6260 @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
6261 @subsection Radio tables
6262 @cindex radio tables
6264 To define the location of the target table, you first need to create two
6265 lines that are comments in the current mode, but contain magic words for
6266 Orgtbl-mode to find.  Orgtbl-mode will insert the translated table
6267 between these lines, replacing whatever was there before.  For example:
6269 @example
6270 /* BEGIN RECEIVE ORGTBL table_name */
6271 /* END RECEIVE ORGTBL table_name */
6272 @end example
6274 @noindent
6275 Just above the source table, we put a special line that tells
6276 Orgtbl-mode how to translate this table and where to install it.  For
6277 example:
6278 @example
6279 #+ORGTBL: SEND table_name translation_function arguments....
6280 @end example
6282 @noindent
6283 @code{table_name} is the reference name for the table that is also used
6284 in the receiver lines. @code{translation_function} is the Lisp function
6285 that does the translation.  Furthermore, the line can contain a list of
6286 arguments (alternating key and value) at the end.  The arguments will be
6287 passed as a property list to the translation function for
6288 interpretation.  A few standard parameters are already recognized and
6289 acted upon before the translation function is called:
6291 @table @code
6292 @item :skip N
6293 Skip the first N lines of the table. Hlines do count!
6294 @item :skipcols (n1 n2 ...)
6295 List of columns that should be skipped.  If the table has a column with
6296 calculation marks, that column is automatically discarded as well.
6297 Please note that the translator function sees the table @emph{after} the
6298 removal of these columns, the function never knows that there have been
6299 additional columns.
6300 @end table
6302 @noindent
6303 The one problem remaining is how to keep the source table in the buffer
6304 without disturbing the normal workings of the file, for example during
6305 compilation of a C file or processing of a LaTeX file.  There are a
6306 number of different solutions:
6308 @itemize @bullet
6309 @item
6310 The table could be placed in a block comment if that is supported by the
6311 language.  For example, in C-mode you could wrap the table between
6312 @samp{/*} and @samp{*/} lines.
6313 @item 
6314 Sometimes it is possible to put the table after some kind of @i{END}
6315 statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
6316 in LaTeX.
6317 @item
6318 You can just comment the table line by line whenever you want to process
6319 the file, and uncomment it whenever you need to edit the table.  This
6320 only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
6321 make this comment-toggling very easy, in particular if you bind it to a
6322 key.
6323 @end itemize
6325 @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
6326 @subsection A LaTeX example
6327 @cindex LaTeX, and orgtbl-mode
6329 The best way to wrap the source table in LaTeX is to use the
6330 @code{comment} environment provided by @file{comment.sty}.  It has to be
6331 activated by placing @code{\usepackage@{comment@}} into the document
6332 header.  Orgtbl-mode can insert a radio table skeleton@footnote{By
6333 default this works only for LaTeX, HTML, and TeXInfo.  Configure the
6334 variable @code{orgtbl-radio-tables} to install templates for other
6335 modes.}  with the command @kbd{M-x orgtbl-insert-radio-table}.  You will
6336 be prompted for a table name, lets say we use @samp{salesfigures}.  You
6337 will then get the following template:
6339 @example
6340 % BEGIN RECEIVE ORGTBL salesfigures
6341 % END RECEIVE ORGTBL salesfigures
6342 \begin@{comment@}
6343 #+ORGTBL: SEND salesfigures orgtbl-to-latex
6344 | | |
6345 \end@{comment@}
6346 @end example
6348 @noindent
6349 The @code{#+ORGTBL: SEND} line tells orgtbl-mode to use the function
6350 @code{orgtbl-to-latex} to convert the table into LaTeX and to put it
6351 into the receiver location with name @code{salesfigures}.  You may now
6352 fill in the table, feel free to use the spreadsheet features@footnote{If
6353 the @samp{#+TBLFM} line contains an odd number of dollar characters,
6354 this may cause problems with font-lock in latex-mode.  As shown in the
6355 example you can fix this by adding an extra line inside the
6356 @code{comment} environment that is used to balance the dollar
6357 expressions.  If you are using AUCTeX with the font-latex library, a
6358 much better solution is to add the @code{comment} environment to the
6359 variable @code{LaTeX-verbatim-environments}.}:
6361 @example
6362 % BEGIN RECEIVE ORGTBL salesfigures
6363 % END RECEIVE ORGTBL salesfigures
6364 \begin@{comment@}
6365 #+ORGTBL: SEND salesfigures orgtbl-to-latex
6366 | Month | Days | Nr sold | per day |
6367 |-------+------+---------+---------|
6368 | Jan   |   23 |      55 |     2.4 |
6369 | Feb   |   21 |      16 |     0.8 |
6370 | March |   22 |     278 |    12.6 |
6371 #+TBLFM: $4=$3/$2;%.1f
6372 % $ (optional extra dollar to keep font-lock happy, see footnote)
6373 \end@{comment@}
6374 @end example
6376 @noindent
6377 When you are done, press @kbd{C-c C-c} in the table to get the converted
6378 table inserted between the two marker lines.
6380 Now lets assume you want to make the table header by hand, because you
6381 want to control how columns are aligned etc.  In this case we make sure
6382 that the table translator does skip the first 2 lines of the source
6383 table, and tell the command to work as a @i{splice}, i.e. to not produce
6384 header and footer commands of the target table:
6386 @example
6387 \begin@{tabular@}@{lrrr@}
6388 Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
6389 % BEGIN RECEIVE ORGTBL salesfigures
6390 % END RECEIVE ORGTBL salesfigures
6391 \end@{tabular@}
6393 \begin@{comment@}
6394 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
6395 | Month | Days | Nr sold | per day |
6396 |-------+------+---------+---------|
6397 | Jan   |   23 |      55 |     2.4 |
6398 | Feb   |   21 |      16 |     0.8 |
6399 | March |   22 |     278 |    12.6 |
6400 #+TBLFM: $4=$3/$2;%.1f
6401 \end@{comment@}
6402 @end example
6404 The LaTeX translator function @code{orgtbl-to-latex} is already part of
6405 Orgtbl-mode.  It uses a @code{tabular} environment to typeset the table
6406 and marks horizontal lines with @code{\hline}.  Furthermore, it
6407 interprets the following parameters:
6409 @table @code
6410 @item :splice nil/t
6411 When set to t, return only table body lines, don't wrap them into a
6412 tabular environment.  Default is nil.
6414 @item :fmt fmt
6415 A format to be used to wrap each field, should contain @code{%s} for the
6416 original field value.  For example, to wrap each field value in dollars,
6417 you could use @code{:fmt "$%s$"}.  This may also be a property list with
6418 column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
6420 @item :efmt efmt
6421 Use this format to print numbers with exponentials.  The format should
6422 have @code{%s} twice for inserting mantissa and exponent, for example
6423 @code{"%s\\times10^@{%s@}"}.  The default is @code{"%s\\,(%s)"}.  This
6424 may also be a property list with column numbers and formats, for example
6425 @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}.  After
6426 @code{efmt} has been applied to a value, @code{fmt} will also be
6427 applied.
6428 @end table
6430 @node Translator functions,  , A LaTeX example, Tables in arbitrary syntax
6431 @subsection Translator functions
6432 @cindex HTML, and orgtbl-mode
6433 @cindex translator function
6435 Orgtbl-mode has several translator functions built-in:
6436 @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and
6437 @code{orgtbl-to-texinfo}.  Except for @code{orgtbl-to-html}@footnote{The
6438 HTML translator uses the same code that produces tables during HTML
6439 export.}, these all use a generic translator, @code{orgtbl-to-generic}.
6440 For example, @code{orgtbl-to-latex} itself is a very short function that
6441 computes the column definitions for the @code{tabular} environment,
6442 defines a few field and line separators and then hands over to the
6443 generic translator.  Here is the entire code:
6445 @lisp
6446 @group
6447 (defun orgtbl-to-latex (table params)
6448   "Convert the orgtbl-mode TABLE to LaTeX."
6449   (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
6450                                org-table-last-alignment ""))
6451          (params2
6452           (list
6453            :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
6454            :tend "\\end@{tabular@}"
6455            :lstart "" :lend " \\\\" :sep " & "
6456            :efmt "%s\\,(%s)" :hline "\\hline")))
6457     (orgtbl-to-generic table (org-combine-plists params2 params))))
6458 @end group
6459 @end lisp
6461 As you can see, the properties passed into the function (variable
6462 @var{PARAMS}) are combined with the ones newly defined in the function
6463 (variable @var{PARAMS2}).  The ones passed into the function (i.e. the
6464 ones set by the @samp{ORGTBL SEND} line) take precedence.  So if you
6465 would like to use the LaTeX translator, but wanted the line endings to
6466 be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
6467 overrule the default with
6469 @example
6470 #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
6471 @end example
6473 For a new language, you can either write your own converter function in
6474 analogy with the LaTeX translator, or you can use the generic function
6475 directly.  For example, if you have a language where a table is started
6476 with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
6477 started with @samp{!BL!}, ended with @samp{!EL!} and where the field
6478 separator is a TAB, you could call the generic translator like this (on
6479 a single line!):
6481 @example
6482 #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
6483                               :lstart "!BL! " :lend " !EL!" :sep "\t"
6484 @end example
6486 @noindent
6487 Please check the documentation string of the function
6488 @code{orgtbl-to-generic} for a full list of parameters understood by
6489 that function and remember that you can pass each of them into
6490 @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
6491 using the generic function.
6493 Of course you can also write a completely new function doing complicated
6494 things the generic translator cannot do.  A translator function takes
6495 two arguments.  The first argument is the table, a list of lines, each
6496 line either the symbol @code{hline} or a list of fields.  The second
6497 argument is the property list containing all parameters specified in the
6498 @samp{#+ORGTBL: SEND} line.  The function must return a single string
6499 containing the formatted table.  If you write a generally useful
6500 translator, please post it on @code{emacs-orgmode@@gnu.org} so that
6501 others can benefit from your work.
6503 @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Extensions and Hacking
6504 @section Dynamic blocks
6505 @cindex dynamic blocks
6507 Org-mode documents can contain @emph{dynamic blocks}.  These are
6508 specially marked regions that are updated by some user-written function.
6509 A good example for such a block is the clock table inserted by the
6510 command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
6512 Dynamic block are enclosed by a BEGIN-END structure that assigns a name
6513 to the block and can also specify parameters for the function producing
6514 the content of the block.
6516 @example
6517 #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
6519 #+END:
6520 @end example
6522 Dynamic blocks are updated with the following commands
6524 @table @kbd
6525 @kindex C-c C-x C-u
6526 @item C-c C-x C-u
6527 Update dynamic block at point.
6528 @kindex C-u C-c C-x C-u
6529 @item C-u C-c C-x C-u
6530 Update all dynamic blocks in the current file.
6531 @end table
6533 Updating a dynamic block means to remove all the text between BEGIN and
6534 END, parse the BEGIN line for parameters and then call the specific
6535 writer function for this block to insert the new content.  For a block
6536 with name @code{myblock}, the writer function is
6537 @code{org-dblock-write:myblock} with as only parameter a property list
6538 with the parameters given in the begin line.  Here is a trivial example
6539 of a block that keeps track of when the block update function was last
6540 run:
6542 @example
6543 #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
6545 #+END:
6546 @end example
6548 @noindent
6549 The corresponding block writer function could look like this:
6551 @lisp
6552 (defun org-dblock-write:block-update-time (params)
6553    (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
6554      (insert "Last block update at: "
6555              (format-time-string fmt (current-time)))))
6556 @end lisp
6558 If you want to make sure that all dynamic blocks are always up-to-date,
6559 you could add the function @code{org-update-all-dblocks} to a hook, for
6560 example @code{before-save-hook}.  @code{org-update-all-dblocks} is
6561 written in a way that is does nothing in buffers that are not in Org-mode.
6563 @node Special agenda views,  , Dynamic blocks, Extensions and Hacking
6564 @section Special Agenda Views
6565 @cindex agenda views, user-defined
6567 Org-mode provides a special hook that can be used to narrow down the
6568 selection made by any of the agenda views.  You may specify a function
6569 that is used at each match to verify if the match should indeed be part
6570 of the agenda view, and if not, how much should be skipped.
6572 Let's say you want to produce a list of projects that contain a WAITING
6573 tag anywhere in the project tree.  Let's further assume that you have
6574 marked all tree headings that define a project with the todo keyword
6575 PROJECT.  In this case you would run a todo search for the keyword
6576 PROJECT, but skip the match unless there is a WAITING tag anywhere in
6577 the subtree belonging to the project line.
6579 To achieve this, you must write a function that searches the subtree for
6580 the tag.  If the tag is found, the function must return @code{nil} to
6581 indicate that this match should not be skipped.  If there is no such
6582 tag, return the location of the end of the subtree, to indicate that
6583 search should continue from there.
6585 @lisp
6586 (defun my-skip-unless-waiting ()
6587   "Skip trees that are not waiting"
6588   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
6589     (if (re-search-forward ":WAITING:" subtree-end t)
6590         nil          ; tag found, do not skip
6591       subtree-end))) ; tag not found, continue after end of subtree
6592 @end lisp
6594 Furthermore you must write a command that uses @code{let} to temporarily
6595 put this function into the variable @code{org-agenda-skip-function},
6596 sets the header string for the agenda buffer, and calls the todo-list
6597 generator while asking for the specific TODO keyword PROJECT.  The
6598 function must also accept one argument MATCH, but it can choose to
6599 ignore it@footnote{MATCH must be present in case you want to define a
6600 custom command for producing this special list.  Custom commands always
6601 supply the MATCH argument, but it can be empty if you do not specify it
6602 while defining the command(@pxref{Custom agenda
6603 views}).} (as we do in the example below).  Here is the example:
6605 @lisp
6606 (defun my-org-waiting-projects (&optional match)
6607   "Produce a list of projects that contain a WAITING tag.
6608 MATCH is being ignored."
6609   (interactive)
6610   (let ((org-agenda-skip-function 'my-skip-unless-waiting)
6611         (org-agenda-overriding-header "Projects waiting for something: "))
6612     ;; make the list
6613     (org-todo-list "PROJECT")))
6614 @end lisp
6617 @node History and Acknowledgments, Index, Extensions and Hacking, Top
6618 @appendix History and Acknowledgments
6619 @cindex acknowledgments
6620 @cindex history
6621 @cindex thanks
6623 Org-mode was borne in 2003, out of frustration over the user interface
6624 of the Emacs outline-mode.  I was trying to organize my notes and
6625 projects, and using Emacs seemed to be the natural way to go.  However,
6626 having to remember eleven different commands with two or three keys per
6627 command, only to hide and unhide parts of the outline tree, that seemed
6628 entirely unacceptable to me.  Also, when using outlines to take notes, I
6629 constantly want to restructure the tree, organizing it parallel to my
6630 thoughts and plans.  @emph{Visibility cycling} and @emph{structure
6631 editing} were originally implemented in the package
6632 @file{outline-magic.el}, but quickly moved to the more general
6633 @file{org.el}.  As this environment became comfortable for project
6634 planning, the next step was adding @emph{TODO entries}, basic @emph{time
6635 stamps}, and @emph{table support}.  These areas highlight the two main
6636 goals that Org-mode still has today: To create a new, outline-based,
6637 plain text mode with innovative and intuitive editing features, and to
6638 incorporate project planning functionality directly into a notes file.
6640 Since the first release, hundreds of emails to me or on
6641 @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
6642 reports, feedback, new ideas, and sometimes patches and add-on code.
6643 Many thanks to everyone who has helped to improve this package.  I am
6644 trying to keep here a list of the people who had significant influence
6645 in shaping one or more aspects of Org-mode.  The list may not be
6646 complete, if I have forgotten someone, please accept my apologies and
6647 let me know.
6649 @itemize @bullet
6651 @item
6652 @i{Thomas Baumann} contributed the code for links to the MH-E email
6653 system.
6654 @item
6655 @i{Alex Bochannek} provided a patch for rounding time stamps.
6656 @item
6657 @i{Charles Cave}'s suggestion sparked the implementation of templates
6658 for Remember.
6659 @item
6660 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
6661 specified time.
6662 @item
6663 @i{Gregory Chernov} patched support for lisp forms into table
6664 calculations and improved XEmacs compatibility, in particular by porting
6665 @file{nouline.el} to XEmacs.
6666 @item
6667 @i{Sacha Chua} suggested to copy some linking code from Planner.
6668 @item
6669 @i{Eddward DeVilla} proposed and tested checkbox statistics.
6670 @item
6671 @i{Kees Dullemond} used to edit projects lists directly in HTML and so
6672 inspired some of the early development, including HTML export.  He also
6673 asked for a way to narrow wide table columns.
6674 @item
6675 @i{Christian Egli} converted the documentation into TeXInfo format,
6676 patched CSS formatting into the HTML exporter, and inspired the agenda.
6677 @item
6678 @i{Nic Ferrier} contributed mailcap and XOXO support.
6679 @item
6680 @i{John Foerch} figured out how to make incremental search show context
6681 around a match in a hidden outline tree.
6682 @item
6683 @i{Niels Giessen} had the idea to automatically archive DONE trees.
6684 @item
6685 @i{Bastien Guerry} provided extensive feedback and some patches, and
6686 translated David O'Toole's tutorial into French.
6687 @item
6688 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
6689 @item
6690 @i{Shidai Liu} ("Leo") asked for embedded LaTeX and tested it.  He also
6691 provided frequent feedback and some patches.
6692 @item
6693 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
6694 happy.
6695 @item
6696 @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file.
6697 @item
6698 @i{Todd Neal} provided patches for links to Info files and elisp forms.
6699 @item
6700 @i{Tim O'Callaghan} suggested in-file links, search options for general
6701 file links, and TAGS.
6702 @item
6703 @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
6704 into Japanese.
6705 @item
6706 @i{Oliver Oppitz} suggested multi-state TODO items.
6707 @item
6708 @i{Scott Otterson} sparked the introduction of descriptive text for
6709 links, among other things.
6710 @item
6711 @i{Pete Phillips} helped during the development of the TAGS feature, and
6712 provided frequent feedback.
6713 @item
6714 @i{T.V. Raman} reported bugs and suggested improvements.
6715 @item
6716 @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
6717 control.
6718 @item
6719 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
6720 @item
6721 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
6722 conflict with @file{allout.el}.
6723 @item
6724 @i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords.
6725 @item
6726 @i{Philip Rooke} created the Org-mode reference card and provided lots
6727 of feedback.
6728 @item
6729 @i{Christian Schlauer} proposed angular brackets around links, among
6730 other things.
6731 @item
6732 Linking to VM/BBDB/GNUS was inspired by @i{Tom Shannon}'s
6733 @file{organizer-mode.el}.
6734 @item
6735 @i{Daniel Sinder} came up with the idea of internal archiving by locking
6736 subtrees.
6737 @item
6738 @i{Dale Smith} proposed link abbreviations.
6739 @item
6740 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
6741 chapter about publishing.
6742 @item
6743 @i{J@"urgen Vollmer} contributed code generating the table of contents
6744 in HTML output.
6745 @item
6746 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
6747 keyword.
6748 @item
6749 @i{David Wainberg} suggested archiving, and improvements to the linking
6750 system.
6751 @item
6752 @i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}.  The
6753 development of Org-mode was fully independent, and both systems are
6754 really different beasts in their basic ideas and implementation details.
6755 I later looked at John's code, however, and learned from his
6756 implementation of (i) links where the link itself is hidden and only a
6757 description is shown, and (ii) popping up a calendar to select a date.
6758 @item
6759 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
6760 linking to GNUS.
6761 @item
6762 @i{Roland Winkler} requested additional keybindings to make Org-mode
6763 work on a tty.
6764 @item
6765 @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
6766 and contributed various ideas and code snippets.
6767 @end itemize
6770 @node Index, Key Index, History and Acknowledgments, Top
6771 @unnumbered Index
6773 @printindex cp
6775 @node Key Index,  , Index, Top
6776 @unnumbered Key Index
6778 @printindex ky
6780 @bye
6782 @ignore
6783    arch-tag: 7893d1fe-cc57-4d13-b5e5-f494a1bcc7ac
6784 @end ignore