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