Release 4.58
[org-mode.git] / org.texi
blob11ecfb9b54d0123df894f8a28b1e5a42089993e6
1 \input texinfo
2 @c %**start of header
3 @setfilename ../info/org
4 @settitle Org Mode Manual
6 @set VERSION 4.58
7 @set DATE December 2006
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 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 * Table calculations::          Compute a field from other fields
126 * orgtbl-mode::                 The table editor as minor mode
127 * table.el::                    Complex tables
129 Calculations in tables
131 * Formula syntax::              How to write a formula
132 * Lisp formulas::               An alternative way to write formulas
133 * Column formulas::             Formulas valid for all fields in a column
134 * Advanced features::           Field names, parameters and automatic recalc
135 * Named-field formulas::        Formulas valid in single fields
136 * Editing/debugging formulas::  Changing a stored formula
137 * Appetizer::                   Taste the power of calc
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.
153 * CamelCase links::             Activating CamelCase words as links
155 TODO items
157 * TODO basics::                 Marking and displaying TODO entries
158 * TODO extensions::             Workflow and assignments
159 * Priorities::                  Some things are more important than others
160 * Breaking down tasks::         Splitting a task into managable pieces
161 * Checkboxes::                  Tick-off lists
163 Extended use of TODO keywords
165 * Workflow states::             From TODO to DONE in steps
166 * TODO types::                  I do this, Fred the rest
167 * Per file keywords::           Different files, different requirements
169 Timestamps
171 * Time stamps::                 Assigning a time to a tree entry
172 * Creating timestamps::         Commands which insert timestamps
173 * Custom time format::          If you cannot work with the ISO format
174 * Progress logging::            Documenting when what work was done.
176 Creating timestamps
178 * The date/time prompt::        How org-mode helps you entering date and time
180 Progress Logging
182 * Closing items::               When was this entry marked DONE?
183 * Clocking work time::          When exactly did you work on this item?
185 Tags
187 * Tag inheritance::             Tags use the tree structure of the outline
188 * Setting tags::                How to assign tags to a headline
189 * Tag searches::                Searching for combinations of tags
191 Agenda Views
193 * Agenda files::                Files being searched for agenda information
194 * Agenda dispatcher::           Keyboard access to agenda views
195 * Built-in agenda views::       What is available out of the box?
196 * Presentation and sorting::    How agenda items are prepared for display
197 * Agenda commands::             Remote editing of org trees
198 * Custom agenda views::         Defining special searches and views
200 The built-in agenda views
202 * Weekly/Daily agenda::         The calendar page with current tasks
203 * Global TODO list::            All unfinished action items
204 * Matching headline tags::      Structured information with fine-tuned search
205 * Timeline::                    Time-sorted view for single file
206 * Stuck projects::              Find projects you need to review
208 Presentation and sorting
210 * Categories::                  Not all tasks are equal
211 * Time-of-day specifications::  How the agenda knows the time
212 * Sorting of agenda items::     The order of things
214 Custom agenda views
216 * Storing searches::            Type once, use often
217 * Block agenda::                All the stuff you need in a single buffer
218 * Setting Options::             Changing the rules
219 * Batch processing::            Agenda views from the command line
221 Embedded LaTeX
223 * Math symbols::                TeX macros for symbols and Greek letters
224 * Subscripts and Superscripts::  Simple syntax for raising/lowering text
225 * LaTeX fragments::             Complex formulas made easy
226 * Processing LaTeX fragments::  Previewing LaTeX processing
227 * CDLaTeX mode::                Speed up entering of formulas
229 Exporting
231 * ASCII export::                Exporting to plain ASCII
232 * HTML export::                 Exporting to HTML
233 * XOXO export::                 Exporting to XOXO
234 * iCalendar export::            Exporting in iCalendar format
235 * Text interpretation::         How the exporter looks at the file
237 Text interpretation by the exporter
239 * Comment lines::               Some lines will not be exported
240 * Enhancing text::              Subscripts, symbols and more
241 * Export options::              How to influence the export settings
243 Publishing
245 * Configuration::               Defining projects
246 * Sample configuration::        Example projects
247 * Triggering publication::      Publication commands
249 Configuration
251 * Project alist::               The central configuration variable
252 * Sources and destinations::    From here to there
253 * Selecting files::             What files are part of the project?
254 * Publishing action::           Setting the function doing the publishing
255 * Publishing options::          Tweaking HTML export
256 * Publishing links::            Which links keep working after publishing?
257 * Project page index::          Publishing a list of project files
259 Sample configuration
261 * Simple example::              One-component publishing
262 * Complex example::             A multi-component publishing example
264 Miscellaneous
266 * Completion::                  M-TAB knows what you need
267 * Customization::               Adapting Org-mode to your taste
268 * In-buffer settings::          Overview of the #+KEYWORDS
269 * The very busy C-c C-c key::   When in doubt, press C-c C-c
270 * Clean view::                  Getting rid of leading stars in the outline
271 * TTY keys::                    Using Org-mode on a tty
272 * Interaction::                 Other Emacs packages
273 * Bugs::                        Things which do not work perfectly
275 Interaction with other packages
277 * Cooperation::                 Packages Org-mode cooperates with
278 * Conflicts::                   Packages that lead to conflicts
280 Extensions, Hooks and Hacking
282 * Extensions::                  Existing 3rd-part extensions
283 * Dynamic blocks::              Automatically filled blocks
284 * Special agenda views::        
286 @end detailmenu
287 @end menu
289 @node Introduction, Document structure, Top, Top
290 @chapter Introduction
291 @cindex introduction
293 @menu
294 * Summary::                     Brief summary of what Org-mode does
295 * Installation::                How to install a downloaded version of Org-mode
296 * Activation::                  How to activate Org-mode for certain buffers.
297 * Feedback::                    Bug reports, ideas, patches etc.
298 @end menu
300 @node Summary, Installation, Introduction, Introduction
301 @section Summary
302 @cindex summary
304 Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
305 project planning with a fast and effective plain-text system.
307 Org-mode develops organizational tasks around NOTES files that contain
308 lists or information about projects as plain text.  Org-mode is
309 implemented on top of outline-mode, which makes it possible to keep the
310 content of large files well structured.  Visibility cycling and
311 structure editing help to work with the tree.  Tables are easily created
312 with a built-in table editor.  Org-mode supports ToDo items, deadlines,
313 time stamps, and scheduling.  It dynamically compiles entries into an
314 agenda that utilizes and smoothly integrates much of the Emacs calendar
315 and diary.  Plain text URL-like links connect to websites, emails,
316 Usenet messages, BBDB entries, and any files related to the projects.
317 For printing and sharing of notes, an Org-mode file can be exported as a
318 structured ASCII file, as HTML, or (todo and agenda items only) as an
319 iCalendar file.  It can also serve as a publishing tool for a set of
320 linked webpages.
322 An important design aspect that distinguishes Org-mode from for example
323 Planner/Muse is that it encougages to store every piece of information
324 only once.  In Planner, you have project pages, day pages and possibly
325 other files, duplicating some information such as tasks.  In Org-mode,
326 you only have notes files.  In your notes you mark entries as tasks,
327 label them with tags and timestamps.  All necessary lists like a
328 schedule for the day, the agenda for a meeting, tasks lists selected by
329 tags etc are created dynamically when you need them.
331 Org-mode keeps simple things simple.  When first fired up, it should
332 feel like a straightforward, easy to use outliner.  Complexity is not
333 imposed, but a large amount of functionality is available when you need
334 it.  Org-mode can be used on different levels and in different ways, for
335 example:
337 @example
338 @r{@bullet{} as an outline extension with visibility cycling and structure editing}
339 @r{@bullet{} as an ASCII system and table editor for taking structured notes}
340 @r{@bullet{} as an ASCII table editor with spreadsheet-like capabilities}
341 @r{@bullet{} as a TODO list editor}
342 @r{@bullet{} as a full agenda and planner with deadlines and work scheduling}
343 @r{@bullet{} as an environment to implement David Allen's GTD system}
344 @r{@bullet{} as a simple hypertext system, with HTML export}
345 @r{@bullet{} as a publishing tool to create a set of interlinked webpages}
346 @end example
348 Org-mode's automatic, context sensitive table editor can be integrated
349 into any major mode by activating the minor Orgtbl-mode.
351 @cindex FAQ
352 There is a website for Org-mode which provides links to the newest
353 version of Org-mode, as well as additional information, frequently asked
354 questions (FAQ), links to tutorials etc.  This page is located at
355 @uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
357 @page
359 @node Installation, Activation, Summary, Introduction
360 @section Installation
361 @cindex installation
362 @cindex XEmacs
364 @b{Important:} If Org-mode is part of the Emacs distribution or an
365 XEmacs package, please skip this section and go directly to
366 @ref{Activation}.
368 If you have downloaded Org-mode from the Web, you must take the
369 following steps to install it: Go into the Org-mode distribution
370 directory and edit the top section of the file @file{Makefile}.  You
371 must set the name of the Emacs binary (likely either @file{emacs} or
372 @file{xemacs}), and the paths to the directories where local Lisp and
373 Info files are kept.  If you don't have access to the system-wide
374 directories, create your own two directories for these files, enter them
375 into the Makefile, and make sure Emacs finds the Lisp files by adding
376 the following line to @file{.emacs}:
378 @example
379 (setq load-path (cons "~/path/to/lispdir" load-path))
380 @end example
382 @b{XEmacs users now need to install the file @file{noutline.el} from
383 the @file{xemacs} subdirectory of the Org-mode distribution.  Use the
384 command:}
386 @example
387 @b{make install-noutline}
388 @end example
390 @noindent Now byte-compile and install the Lisp files with the shell
391 commands:
393 @example
394 make
395 make install
396 @end example
398 @noindent If you want to install the info documentation, use this command:
400 @example
401 make install-info
402 @end example
404 @noindent Then add to @file{.emacs}:
406 @lisp
407 ;; This line only if org-mode is not part of the X/Emacs distribution.
408 (require 'org-install)
409 @end lisp
411 @node Activation, Feedback, Installation, Introduction
412 @section Activation
413 @cindex activation
414 @cindex autoload
415 @cindex global keybindings
416 @cindex keybindings, global
418 Add the following lines to your @file{.emacs} file.  The last two lines
419 define @emph{global} keys for the commands @command{org-store-link} and
420 @command{org-agenda} - please choose suitable keys yourself.
422 @lisp
423 ;; The following lines are always needed.  Choose your own keys.
424 (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
425 (define-key global-map "\C-cl" 'org-store-link)
426 (define-key global-map "\C-ca" 'org-agenda)
427 @end lisp
429 Furthermore, you must activate @code{font-lock-mode} in org-mode
430 buffers, because significant functionality depends on font-locking being
431 active.  You can do this with either one of the following two lines
432 (XEmacs user must use the second option):
433 @lisp
434 (global-font-lock-mode 1)                     ; for all buffers
435 (add-hook 'org-mode-hook 'turn-on-font-lock)  ; org-mode buffers only
436 @end lisp
438 @cindex org-mode, turning on
439 With this setup, all files with extension @samp{.org} will be put
440 into Org-mode.  As an alternative, make the first line of a file look
441 like this:
443 @example
444 MY PROJECTS    -*- mode: org; -*-
445 @end example
447 @noindent which will select Org-mode for this buffer no matter what
448 the file's name is.  See also the variable
449 @code{org-insert-mode-line-in-empty-file}.
451 @node Feedback,  , Activation, Introduction
452 @section Feedback
453 @cindex feedback
454 @cindex bug reports
455 @cindex maintainer
456 @cindex author
458 If you find problems with Org-mode, or if you have questions, remarks,
459 or ideas about it, please contact the maintainer @value{MAINTAINER} at
460 @value{MAINTAINEREMAIL}.
462 For bug reports, please provide as much information as possible,
463 including the version information of Emacs (@kbd{C-h v emacs-version
464 @key{RET}}) and Org-mode (@kbd{C-h v org-version @key{RET}}), as well as
465 the Org-mode related setup in @file{.emacs}.  If an error occurs, a
466 backtrace can be very useful (see below on how to create one).  Often a
467 small example file helps, along with clear information about:
469 @enumerate
470 @item What exactly did you do?
471 @item What did you expect to happen?
472 @item What happened instead?
473 @end enumerate
474 @noindent Thank you for helping to improve this mode.
476 @subsubheading How to create a useful backtrace
478 @cindex backtrace of an error
479 If working with Org-mode produces an error with a message you don't
480 understand, you may have hit a bug.  The best way to report this is by
481 providing, in addition to what was mentioned above, a @emph{Backtrace}.
482 This is information from the built-in debugger about where and how the
483 error occurred.  Here is how to produce a useful backtrace:
485 @enumerate
486 @item
487 Start a fresh Emacs or XEmacs, and make sure that it will load the
488 original Lisp code in @file{org.el} instead of the compiled version in
489 @file{org.elc}.  The backtrace contains much more information if it is
490 produced with uncompiled code.  To do this, either rename @file{org.elc}
491 to something else before starting Emacs, or ask Emacs explicitly to load
492 @file{org.el} by using the command line
493 @example
494 emacs -l /path/to/org.el
495 @end example
496 @item
497 Go to the @code{Options} menu and select @code{Enter Debugger on Error}
498 (XEmacs has this option in the @code{Troubleshooting} sub-menu).
499 @item
500 Do whatever you have to do to hit the error.  Don't forget to
501 document the steps you take.
502 @item
503 When you hit the error, a @file{*Backtrace*} buffer will appear on the
504 screen.  Save this buffer to a file (for example using @kbd{C-x C-w}) and
505 attach it to your bug report.
506 @end enumerate
508 @node Document structure, Tables, Introduction, Top
509 @chapter Document Structure
510 @cindex document structure
511 @cindex structure of document
513 Org-mode is based on outline mode and provides flexible commands to
514 edit the structure of the document.
516 @menu
517 * Outlines::                    Org-mode is based on outline-mode
518 * Headlines::                   How to typeset org-tree headlines
519 * Visibility cycling::          Show and hide, much simplified
520 * Motion::                      Jumping to other headlines
521 * Structure editing::           Changing sequence and level of headlines
522 * Archiving::                   Move done task trees to a different place
523 * Sparse trees::                Matches embedded in context
524 * Plain lists::                 Additional structure within an entry
525 @end menu
527 @node Outlines, Headlines, Document structure, Document structure
528 @section Outlines
529 @cindex outlines
530 @cindex outline-mode
532 Org-mode is implemented on top of outline-mode.  Outlines allow to
533 organize a document in a hierarchical structure, which (at least for
534 me) is the best representation of notes and thoughts.  Overview over
535 this structure is achieved by folding (hiding) large parts of the
536 document to show only the general document structure and the parts
537 currently being worked on.  Org-mode greatly simplifies the use of
538 outlines by compressing the entire show/hide functionality into a
539 single command @command{org-cycle}, which is bound to the @key{TAB}
540 key.
542 @node Headlines, Visibility cycling, Outlines, Document structure
543 @section Headlines
544 @cindex headlines
545 @cindex outline tree
547 Headlines define the structure of an outline tree.  The headlines in
548 Org-mode start with one or more stars, on the left margin.  For
549 example:
551 @example
552 * Top level headline
553 ** Second level
554 *** 3rd level
555     some text
556 *** 3rd level
557     more text
558 * Another top level headline
559 @end example
561 @noindent Some people find the many stars too noisy and would prefer an
562 outline that has whitespace followed by a single star as headline
563 starters.  @ref{Clean view} describes a setup to realize this.
565 @node Visibility cycling, Motion, Headlines, Document structure
566 @section Visibility cycling
567 @cindex cycling, visibility
568 @cindex visibility cycling
569 @cindex trees, visibility
570 @cindex show hidden text
571 @cindex hide text
573 Outlines make it possible to hide parts of the text in the buffer.
574 Org-mode uses just two commands, bound to @key{TAB} and
575 @kbd{S-@key{TAB}} to change the visibility in the buffer.
577 @cindex subtree visibility states
578 @cindex subtree cycling
579 @cindex folded, subtree visibility state
580 @cindex children, subtree visibility state
581 @cindex subtree, subtree visibility state
582 @table @kbd
583 @kindex @key{TAB}
584 @item @key{TAB}
585 @emph{Subtree cycling}: Rotate current subtree between the states
587 @example
588 ,-> FOLDED -> CHILDREN -> SUBTREE --.
589 '-----------------------------------'
590 @end example
592 The cursor must be on a headline for this to work@footnote{see, however,
593 the option @code{org-cycle-emulate-tab}.}.  When the cursor is at the
594 beginning of the buffer and the first line is not a headline, then
595 @key{TAB} actually runs global cycling (see below)@footnote{see the
596 option @code{org-cycle-global-at-bob}.}.  Also when called with a prefix
597 argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
599 @cindex global visibility states
600 @cindex global cycling
601 @cindex overview, global visibility state
602 @cindex contents, global visibility state
603 @cindex show all, global visibility state
604 @kindex S-@key{TAB}
605 @item S-@key{TAB}
606 @itemx C-u @key{TAB}
607 @emph{Global cycling}: Rotate the entire buffer between the states
609 @example
610 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
611 '--------------------------------------'
612 @end example
614 Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field.
616 @cindex show all, command
617 @kindex C-c C-a
618 @item C-c C-a
619 Show all.
620 @kindex C-c C-r
621 @item C-c C-r
622 Reveal context around point, showing the current entry, the following
623 heading and the hierarchy above.  Useful for working near a location
624 exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda
625 command (@pxref{Agenda commands}).
626 @kindex C-c C-x b
627 @item C-c C-x b
628 Show the current subtree in an indirect buffer@footnote{The indirect
629 buffer (@pxref{Indirect Buffers,Indirect Buffers,Indirect Buffers,emacs,GNU
630 Emacs Manual}) will contain the entire buffer, but will
631 be narrowed to the current tree.  Editing the indirect buffer will also
632 change the original buffer, but without affecting visibility in that
633 buffer .}, in a separate, dedicated frame.  With positive numerical
634 prefix N, go up to level N before selecting the subtree.  With negative
635 prefix -N, go up N levels.  With @kbd{C-u} prefix, don't use the
636 dedicated frame, but another, new frame.
637 @end table
639 When Emacs first visits an Org-mode file, the global state is set to
640 OVERVIEW, i.e. only the top level headlines are visible.  This can be
641 configured through the variable @code{org-startup-folded}, or on a
642 per-file basis by adding one of the following lines anywhere in the
643 buffer:
645 @example
646 #+STARTUP: overview
647 #+STARTUP: content
648 #+STARTUP: showall
649 @end example
651 @node Motion, Structure editing, Visibility cycling, Document structure
652 @section Motion
653 @cindex motion, between headlines
654 @cindex jumping, to headlines
655 @cindex headline navigation
656 The following commands jump to other headlines in the buffer.
658 @table @kbd
659 @kindex C-c C-n
660 @item C-c C-n
661 Next heading.
662 @kindex C-c C-p
663 @item C-c C-p
664 Previous heading.
665 @kindex C-c C-f
666 @item C-c C-f
667 Next heading same level.
668 @kindex C-c C-b
669 @item C-c C-b
670 Previous heading same level.
671 @kindex C-c C-u
672 @item C-c C-u
673 Backward to higher level heading.
674 @kindex C-c C-j
675 @item C-c C-j
676 Jump to a different place without changing the current outline
677 visibility.  Shows the document structure in a temporary buffer, where
678 you can use visibility cycling (@key{TAB}) to find your destination.
679 After pressing @key{RET}, the cursor moves to the selected location in
680 the original buffer, and the headings hierarchy above it is made
681 visible.
682 @end table
684 @node Structure editing, Archiving, Motion, Document structure
685 @section Structure editing
686 @cindex structure editing
687 @cindex headline, promotion and demotion
688 @cindex promotion, of subtrees
689 @cindex demotion, of subtrees
690 @cindex subtree, cut and paste
691 @cindex pasting, of subtrees
692 @cindex cutting, of subtrees
693 @cindex copying, of subtrees
694 @cindex subtrees, cut and paste
696 @table @kbd
697 @kindex M-@key{RET}
698 @item M-@key{RET}
699 Insert new heading with same level as current.  If the cursor is in a
700 plain list item, a new item is created (@pxref{Plain lists}).  To force
701 creation of a new headline, use a prefix arg, or first press @key{RET}
702 to get to the beginning of the next line.  When this command is used in
703 the middle of a line, the line is split and the rest of the line becomes
704 the new headline.  If the command is used at the beginning of a
705 headline, the new headline is created before the current line.  If at
706 the beginning of any other line, the content of that line is made the
707 new heading.  If the command is used at the end of a folded subtree
708 (i.e. behind the ellipses at the end of a headline), then a headline
709 like the current one will be inserted after the end of the subtree.
710 @kindex M-S-@key{RET}
711 @item M-S-@key{RET}
712 Insert new TODO entry with same level as current heading.
713 @kindex M-@key{left}
714 @item M-@key{left}
715 Promote current heading by one level.
716 @kindex M-@key{right}
717 @item M-@key{right}
718 Demote current heading by one level.
719 @kindex M-S-@key{left}
720 @item M-S-@key{left}
721 Promote the current subtree by one level.
722 @kindex M-S-@key{right}
723 @item M-S-@key{right}
724 Demote the current subtree by one level.
725 @kindex M-S-@key{up}
726 @item M-S-@key{up}
727 Move subtree up (swap with previous subtree of same
728 level).
729 @kindex M-S-@key{down}
730 @item M-S-@key{down}
731 Move subtree down (swap with next subtree of same level).
732 @kindex C-c C-x C-w
733 @kindex C-c C-x C-k
734 @item C-c C-x C-w
735 @itemx C-c C-x C-k
736 Kill subtree, i.e. remove it from buffer but save in kill ring.
737 @kindex C-c C-x M-w
738 @item C-c C-x M-w
739 Copy subtree to kill ring.
740 @kindex C-c C-x C-y
741 @item C-c C-x C-y
742 Yank subtree from kill ring.  This does modify the level of the subtree to
743 make sure the tree fits in nicely at the yank position.  The yank
744 level can also be specified with a prefix arg, or by yanking after a
745 headline marker like @samp{****}.
746 @kindex C-c ^
747 @item C-c ^
748 Sort same-level entries.  When there is an active region, all entries in
749 the region will be sorted.  Otherwise the children of the current
750 headline are sorted.  The command prompts for the sorting method, which
751 can be alphabetically, numerically, by time (using the first time stamp
752 in each entry), and each of these in reverse order.  With a @kbd{C-u}
753 prefix, sorting will be case-sensitive.  With two @kbd{C-u C-u}
754 prefixes, duplicate entries will also be removed.
755 @end table
757 @cindex region, active
758 @cindex active region
759 @cindex transient-mark-mode
760 When there is an active region (transient-mark-mode), promotion and
761 demotion work on all headlines in the region.  To select a region of
762 headlines, it is best to place both point and mark at the beginning of a
763 line, mark at the beginning of the first headline, and point at the line
764 just after the last headline to change.  Note that when the cursor is
765 inside a table (@pxref{Tables}), the Meta-Cursor keys have different
766 functionality.
768 @node Archiving, Sparse trees, Structure editing, Document structure
769 @section Archiving
770 @cindex archiving
772 When a project represented by a (sub)tree is finished, you may want
773 to move the tree out of the way and to stop it from contributing to the
774 agenda.  Org-mode knows two ways of archiving.  You can mark a tree with
775 the ARCHIVE tag, or you can move an entire (sub)tree to a different
776 location.
778 @menu
779 * ARCHIVE tag::                 Marking a tree as inactive
780 * Moving subtrees::             Moving a tree to an archive file
781 @end menu
783 @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
784 @subsection The ARCHIVE tag
785 @cindex internal archiving
787 A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
788 its location in the outline tree, but behaves in the following way:
789 @itemize @minus
790 @item
791 It does not open when you attempt to do so with a visibility cycling
792 command (@pxref{Visibility cycling}).  You can force cycling archived
793 subtrees with @kbd{C-@key{TAB}}, or by setting the option
794 @code{org-cycle-open-archived-trees}.  Also normal outline commands like
795 @code{show-all} will open archived subtrees.
796 @item
797 During sparse tree construction (@pxref{Sparse trees}), matches in
798 archived subtrees are not exposed, unless you configure the option
799 @code{org-sparse-tree-open-archived-trees}.
800 @item
801 During agenda view construction (@pxref{Agenda views}), the content of
802 archived trees is ignored unless you configure the option
803 @code{org-agenda-skip-archived-trees}.
804 @item
805 Archived trees are not exported (@pxref{Exporting}), only the headline
806 is.  Configure the details using the variable
807 @code{org-export-with-archived-trees}.
808 @end itemize
810 The following commands help managing the ARCHIVE tag:
812 @table @kbd
813 @kindex C-c C-x C-a
814 @item C-c C-x C-a
815 Toggle the ARCHIVE tag for the current headline.  When the tag is set,
816 the headline changes to a shadowish face, and the subtree below it is
817 hidden.
818 @kindex C-u C-c C-x C-a
819 @item C-u C-c C-x C-a
820 Check if any direct children of the current headline should be archived.
821 To do this, each subtree is checked for open TODO entries.  If none are
822 found, the command offers to set the ARCHIVE tag for the child.  If the
823 cursor is @emph{not} on a headline when this command is invoked, the
824 level 1 trees will be checked.
825 @kindex C-@kbd{TAB}
826 @item C-@kbd{TAB}
827 Cycle a tree even if it is tagged with ARCHIVE.
828 @end table
830 @node Moving subtrees,  , ARCHIVE tag, Archiving
831 @subsection Moving subtrees
832 @cindex external archiving
834 Once an entire project is finished, you may want to move it to a
835 different location, either in the current file, or even in a different
836 file, the archive file.
838 @table @kbd
839 @kindex C-c $
840 @item C-c $
841 Archive the subtree starting at the cursor position to the location
842 given by @code{org-archive-location}.
843 @kindex C-u C-c $
844 @item C-u C-c $
845 Check if any direct children of the current headline could be moved to
846 the archive.  To do this, each subtree is checked for open TODO entries.
847 If none are found, the command offers to move it to the archive
848 location.  If the cursor is @emph{not} on a headline when this command
849 is invoked, the level 1 trees will be checked.
850 @end table
852 @cindex archive locations
853 The default archive location is a file in the same directory as the
854 current file, with the name derived by appending @file{_archive} to the
855 current file name.  For information and examples on how to change this,
856 see the documentation string of the variable
857 @code{org-archive-location}.
859 @node Sparse trees, Plain lists, Archiving, Document structure
860 @section Sparse trees
861 @cindex sparse trees
862 @cindex trees, sparse
863 @cindex folding, sparse trees
864 @cindex occur, command
866 An important feature of Org-mode is the ability to construct
867 @emph{sparse trees} for selected information in an outline tree.  A
868 sparse tree means that the entire document is folded as much as
869 possible, but the selected information is made visible along with the
870 headline structure above it@footnote{See also the variables
871 @code{org-show-hierarchy-above} and
872 @code{org-show-following-heading}.}.  Just try it out and you will see
873 immediately how it works.
875 Org-mode contains several commands creating such trees.  The most
876 basic one is @command{org-occur}:
878 @table @kbd
879 @kindex C-c /
880 @item C-c /
881 Occur.  Prompts for a regexp and shows a sparse tree with all matches.
882 If the match is in a headline, the headline is made visible.  If the
883 match is in the body of an entry, headline and body are made visible.
884 In order to provide minimal context, also the full hierarchy of
885 headlines above the match is shown, as well as the headline following
886 the match.  Each match is also highlighted; the highlights disappear
887 when the bufer is changes an editing command, or by pressing @kbd{C-c
888 C-c}.  When called with a @kbd{C-u} prefix argument, previous highlights
889 are kept, so several calls to this command can be stacked.
890 @end table
891 @noindent
892 For frequently used sparse trees of specific search strings, you can
893 use the variable @code{org-agenda-custom-commands} to define fast
894 keyboard access to specific sparse trees.  These commands will then be
895 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
896 For example:
898 @lisp
899 (setq org-agenda-custom-commands
900       '(("f" occur-tree "FIXME")))
901 @end lisp
903 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
904 a sparse tree matching the string @samp{FIXME}.
906 Other commands use sparse trees as well.  For example @kbd{C-c
907 C-v} creates a sparse TODO tree (@pxref{TODO basics}).
909 @kindex C-c C-e v
910 @cindex printing sparse trees
911 @cindex visible text, printing
912 To print a sparse tree, you can use the Emacs command
913 @code{ps-print-buffer-with-faces} which does not print invisible parts
914 of the document @footnote{This does not work under XEmacs, because
915 XEmacs uses selective display for outlining, not text properties.}.
916 Or you can use the command @kbd{C-c C-e v} to export only the visible
917 part of the document and print the resulting file.
919 @node Plain lists,  , Sparse trees, Document structure
920 @section Plain lists
921 @cindex plain lists
922 @cindex lists, plain
923 @cindex lists, ordered
924 @cindex ordered lists
926 Within an entry of the outline tree, hand-formatted lists can provide
927 additional structure.  They also provide a way to create lists of
928 checkboxes (@pxref{Checkboxes}).  Org-mode supports editing such lists,
929 and the HTML exporter (@pxref{Exporting}) does parse and format them.
931 Org-mode knows ordered and unordered lists.  Unordered list items start
932 with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
933 bullet, lines must be indented or they will be seen as top-level
934 headlines.  Also, when you are hiding leading stars to get a clean
935 outline view, plain list items starting with a star are visually
936 indistinguishable from true headlines.  In short: even though @samp{*}
937 is supported, it may be better not to use it for plain list items} as
938 bullets.  Ordered list items start with @samp{1.} or @samp{1)}.  Items
939 belonging to the same list must have the same indentation on the first
940 line.  In particular, if an ordered list reaches number @samp{10.}, then
941 the 2--digit numbers must be written left-aligned with the other numbers
942 in the list.  Indentation also determines the end of a list item.  It
943 ends before the next line that is indented like the bullet/number, or
944 less.  For example:
946 @example
947 @group
948 ** Lord of the Rings
949    My favorite scenes are (in this order)
950    1. The attack of the Rohirrim
951    2. Eowyns fight with the witch king
952       + this was already my favorite scene in the book
953       + I really like Miranda Otto.
954    3. Peter Jackson being shot by Legolas
955        - on DVD only
956       He makes a really funny face when it happens.
957    But in the end, not individual scenes matter but the film as a whole.
958 @end group
959 @end example
961 Org-mode supports these lists by tuning filling and wrapping commands to
962 deal with them correctly@footnote{Org-mode only changes the filling
963 settings for Emacs.  For XEmacs, you should use Kyle E. Jones'
964 @file{filladapt.el}.  To turn this on,  put into @file{.emacs}:
965 @example
966 (require 'filladapt)
967 @end example
970 The following commands act on items when the cursor is in the first line
971 of an item (the line with the bullet or number).
973 @table @kbd
974 @kindex @key{TAB}
975 @item @key{TAB}
976 Items can be folded just like headline levels if you set the variable
977 @code{org-cycle-include-plain-lists}.  The level of an item is then
978 given by the indentation of the bullet/number.  Items are always
979 subordinate to real headlines, however; the hierarchies remain
980 completely separated.
981 @kindex M-@key{RET}
982 @item M-@key{RET}
983 Insert new item at current level.  With prefix arg, force a new heading
984 (@pxref{Structure editing}).  If this command is used in the middle of a
985 line, the line is @emph{split} and the rest of the line becomes the new
986 item.  If this command is executed in the @emph{whitespace before a bullet or
987 number}, the new item is created @emph{before} the current item.  If the
988 command is executed in the white space before the text that is part of
989 an item but does not contain the bullet, a bullet is added to the
990 current line.
991 @kindex M-S-@key{RET}
992 @item M-S-@key{RET}
993 Insert a new item with a checkbox (@pxref{Checkboxes}).
994 @kindex S-@key{up}
995 @kindex S-@key{down}
996 @item S-@key{up}
997 @itemx S-@key{down}
998 Jump to the previous/next item in the current list.
999 @kindex M-S-@key{up}
1000 @kindex M-S-@key{down}
1001 @item M-S-@key{up}
1002 @itemx M-S-@key{down}
1003 Move the item including subitems up/down (swap with previous/next item
1004 of same indentation).  If the list is ordered, renumbering is
1005 automatic.
1006 @kindex M-S-@key{left}
1007 @kindex M-S-@key{right}
1008 @item M-S-@key{left}
1009 @itemx M-S-@key{right}
1010 Decrease/increase the indentation of the item, including subitems.
1011 Initially, the item tree is selected based on current indentation.
1012 When these commands are executed several times in direct succession,
1013 the initially selected region is used, even if the new indentation
1014 would imply a different hierarchy.  To use the new hierarchy, break
1015 the command chain with a cursor motion or so.
1016 @kindex C-c C-c
1017 @item C-c C-c
1018 If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
1019 state of the checkbox.  Otherwise, if this is an ordered list, renumber
1020 the ordered list at the cursor.
1021 @end table
1023 @node Tables, Hyperlinks, Document structure, Top
1024 @chapter Tables
1025 @cindex tables
1026 @cindex editing tables
1028 Org-mode has a very fast and intuitive table editor built-in.
1029 Spreadsheet-like calculations are supported in connection with the
1030 Emacs @file{calc} package.
1032 @menu
1033 * Built-in table editor::       Simple tables
1034 * Narrow columns::              Stop wasting space in tables   
1035 * Table calculations::          Compute a field from other fields
1036 * orgtbl-mode::                 The table editor as minor mode
1037 * table.el::                    Complex tables
1038 @end menu
1040 @node Built-in table editor, Narrow columns, Tables, Tables
1041 @section The built-in table editor
1042 @cindex table editor, builtin
1044 Org-mode makes it easy to format tables in plain ASCII.  Any line with
1045 @samp{|} as the first non-white character is considered part of a
1046 table.  @samp{|} is also the column separator.  A table might look
1047 like this:
1049 @example
1050 | Name  | Phone | Age |
1051 |-------+-------+-----|
1052 | Peter |  1234 |  17 |
1053 | Anna  |  4321 |  25 |
1054 @end example
1056 A table is re-aligned automatically each time you press @key{TAB} or
1057 @key{RET} or @kbd{C-c C-c} inside the table.  @key{TAB} also moves to
1058 the next field (@key{RET} to the next row) and creates new table rows
1059 at the end of the table or before horizontal lines.  The indentation
1060 of the table is set by the first line.  Any line starting with
1061 @samp{|-} is considered as a horizontal separator line and will be
1062 expanded on the next re-align to span the whole table width.  So, to
1063 create the above table, you would only type
1065 @example
1066 |Name|Phone|Age|
1068 @end example
1070 @noindent and then press @key{TAB} to align the table and start filling in
1071 fields.
1073 When typing text into a field, Org-mode treats @key{DEL},
1074 @key{Backspace}, and all character keys in a special way, so that
1075 inserting and deleting avoids shifting other fields.  Also, when
1076 typing @emph{immediately after the cursor was moved into a new field
1077 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
1078 field is automatically made blank.  If this behavior is too
1079 unpredictable for you, configure the variables
1080 @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
1082 @table @kbd
1083 @tsubheading{Creation and conversion}
1084 @kindex C-c |
1085 @item C-c |
1086 Convert the active region to table. If every line contains at least one
1087 TAB character, the function assumes that the material is tab separated.
1088 If not, lines are split at whitespace into fields.  You can use a prefix
1089 argument to indicate the minimum number of consecutive spaces required
1090 to identify a field separator (default: just one).@* 
1091 If there is no active region, this command creates an empty Org-mode
1092 table.  But it's easier just to start typing, like
1093 @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
1095 @tsubheading{Re-aligning and field motion}
1096 @kindex C-c C-c
1097 @item C-c C-c
1098 Re-align the table without moving the cursor.
1100 @kindex @key{TAB}
1101 @item @key{TAB}
1102 Re-align the table, move to the next field.  Creates a new row if
1103 necessary.
1105 @kindex S-@key{TAB}
1106 @item S-@key{TAB}
1107 Re-align, move to previous field.
1109 @kindex @key{RET}
1110 @item @key{RET}
1111 Re-align the table and move down to next row.  Creates a new row if
1112 necessary.  At the beginning or end of a line, @key{RET} still does
1113 NEWLINE, so it can be used to split a table.
1115 @tsubheading{Column and row editing}
1116 @kindex M-@key{left}
1117 @kindex M-@key{right}
1118 @item M-@key{left}
1119 @itemx M-@key{right}
1120 Move the current column left/right.
1122 @kindex M-S-@key{left}
1123 @item M-S-@key{left}
1124 Kill the current column.
1126 @kindex M-S-@key{right}
1127 @item M-S-@key{right}
1128 Insert a new column to the left of the cursor position.
1130 @kindex M-@key{up}
1131 @kindex M-@key{down}
1132 @item M-@key{up}
1133 @itemx M-@key{down}
1134 Move the current row up/down.
1136 @kindex M-S-@key{up}
1137 @item M-S-@key{up}
1138 Kill the current row or horizontal line.
1140 @kindex M-S-@key{down}
1141 @item M-S-@key{down}
1142 Insert a new row above (with arg: below) the current row.
1144 @kindex C-c -
1145 @item C-c -
1146 Insert a horizontal line below current row. With prefix arg, the line
1147 is created above the current line.
1149 @kindex C-c ^
1150 @item C-c ^
1151 Sort the table lines in the region.  The position of point indicates the
1152 column to be used for sorting, and the range of lines is the range
1153 between the nearest horizontal separator lines, or the entire table.  If
1154 point is before the first column, you will be prompted for the sorting
1155 column.  If there is an active region, the mark specifies the first line
1156 and the sorting column, while point should be in the last line to be
1157 included into the sorting.  The command prompts for the sorting type
1158 (alphabetically, numerically, or by time).  When called with a prefix
1159 argument, alphabetic sorting will be case-sensitive.
1161 @tsubheading{Regions}
1162 @kindex C-c C-x M-w
1163 @item C-c C-x M-w
1164 Copy a rectangular region from a table to a special clipboard.  Point
1165 and mark determine edge fields of the rectangle.  The process ignores
1166 horizontal separator lines.
1167 @kindex C-c C-x C-w
1168 @item C-c C-x C-w
1169 Copy a rectangular region from a table to a special clipboard, and
1170 blank all fields in the rectangle.  So this is the ``cut'' operation.
1171 @kindex C-c C-x C-y
1172 @item C-c C-x C-y
1173 Paste a rectangular region into a table.
1174 The upper right corner ends up in the current field.  All involved fields
1175 will be overwritten.  If the rectangle does not fit into the present table,
1176 the table is enlarged as needed.  The process ignores horizontal separator
1177 lines.
1178 @kindex C-c C-q
1179 @item C-c C-q
1180 Wrap several fields in a column like a paragraph.  If there is an active
1181 region, and both point and mark are in the same column, the text in the
1182 column is wrapped to minimum width for the given number of lines.  A
1183 prefix ARG may be used to change the number of desired lines.  If there
1184 is no region, the current field is split at the cursor position and the
1185 text fragment to the right of the cursor is prepended to the field one
1186 line down. If there is no region, but you specify a prefix ARG, the
1187 current field is made blank, and the content is appended to the field
1188 above.
1190 @tsubheading{Calculations}
1191 @cindex formula, in tables
1192 @cindex calculations, in tables
1193 @kindex C-c =
1194 @item C-c =
1195 Install a new formula for the current column and replace current field
1196 with the result of the formula.
1198 @kindex C-u C-c =
1199 @item C-u C-c =
1200 Install a new formula for the current field, which must be a named
1201 field.  Evaluate the formula and replace the field content with the
1202 result.
1204 @kindex C-c '
1205 @item C-c '
1206 Edit all formulas associated with the current table in a separate
1207 buffer.
1209 @kindex C-c *
1210 @item C-c *
1211 Recalculate the current row by applying the stored formulas from left
1212 to right.  When called with a @kbd{C-u} prefix, recalculate the
1213 entire table, starting with the first non-header line (i.e. below the
1214 first horizontal separator line).  For details, see @ref{Table calculations}.
1216 @kindex C-#
1217 @item C-#
1218 Rotate the calculation mark in first column through the states
1219 @samp{}, @samp{#}, @samp{*}, @samp{!}, @samp{$}.  For the meaning of
1220 these marks see @ref{Advanced features}.  When there is an active
1221 region, change all marks in the region.
1223 @kindex C-c ?
1224 @item C-c ?
1225 Which table column is the cursor in?  Displays number >0 in echo
1226 area.
1228 @cindex region, active
1229 @cindex active region
1230 @cindex transient-mark-mode
1231 @kindex C-c +
1232 @item C-c +
1233 Sum the numbers in the current column, or in the rectangle defined by
1234 the active region.  The result is shown in the echo area and can
1235 be inserted with @kbd{C-y}.
1237 @kindex S-@key{RET}
1238 @item S-@key{RET}
1239 When current field is empty, copy from first non-empty field above.
1240 When not empty, copy current field down to next row and move cursor
1241 along with it.  Depending on the variable
1242 @code{org-table-copy-increment}, integer field values will be
1243 incremented during copy.  This key is also used by CUA-mode
1244 (@pxref{Cooperation}).
1246 @tsubheading{Miscellaneous}
1247 @kindex C-c `
1248 @item C-c `
1249 Edit the current field in a separate window.  This is useful for fields
1250 that are not fully visible (@pxref{Narrow columns}).  When called with a
1251 @kbd{C-u} prefix, just make the full field visible, so that it can be
1252 edited in place.
1254 @kindex C-c @key{TAB}
1255 @item C-c @key{TAB}
1256 This is an alias for @kbd{C-u C-c `} to make the current field fully
1257 visible.
1259 @item M-x org-table-import
1260 Import a file as a table.  The table should be TAB- or whitespace
1261 separated.  Useful, for example, to import an Excel table or data from a
1262 database, because these programs generally can write TAB-separated text
1263 files.  This command works by inserting the file into the buffer and
1264 then converting the region to a table.  Any prefix argument is passed on
1265 to the converter, which uses it to determine the separator.
1267 @item M-x org-table-export
1268 Export the table as a TAB-separated file.  Useful for data exchange with,
1269 for example, Excel or database programs.
1271 @end table
1273 If you don't like the automatic table editor because it gets in your
1274 way on lines which you would like to start with @samp{|}, you can turn
1275 it off with
1277 @lisp
1278 (setq org-enable-table-editor nil)
1279 @end lisp
1281 @noindent Then the only table command that still works is
1282 @kbd{C-c C-c} to do a manual re-align.
1284 @node Narrow columns, Table calculations, Built-in table editor, Tables
1285 @section Narrow columns
1286 @cindex narrow columns in tables
1288 The width of columns is automatically determined by the table editor.
1289 Sometimes a single field or a few fields need to carry more text,
1290 leading to inconveniently wide columns.  To limit@footnote{This feature
1291 does not work on XEmacs.} the width of a column, one field anywhere in
1292 the column may contain just the string @samp{<N>} where @samp{N} is an
1293 integer specifying the width of the column in characters.  The next
1294 re-align will then set the width of this column to no more than this
1295 value.
1297 @example
1298 |---+------------------------------|               |---+--------|
1299 |   |                              |               |   | <6>    |
1300 | 1 | one                          |               | 1 | one    |
1301 | 2 | two                          |     ----\     | 2 | two    |
1302 | 3 | This is a long chunk of text |     ----/     | 3 | This=> |
1303 | 4 | four                         |               | 4 | four   |
1304 |---+------------------------------|               |---+--------|
1305 @end example
1307 @noindent
1308 Fields that are wider become clipped and end in the string @samp{=>}.
1309 Note that the full text is still in the buffer, it is only invisible.
1310 To see the full text, hold the mouse over the field - a tooltip window
1311 will show the full content.  To edit such a field, use the command
1312 @kbd{C-c `} (that is @kbd{C-c} followed by the backquote).  This will
1313 open a new window with the full field.  Edit it and finish with @kbd{C-c
1314 C-c}.
1316 When visiting a file containing a table with narrowed columns, the
1317 necessary character hiding has not yet happened, and the table needs to
1318 be aligned before it looks nice.  Setting the option
1319 @code{org-startup-align-all-tables} will realign all tables in a file
1320 upon visiting, but also slow down startup.  You can also set this option
1321 on a per-file basis with:
1323 @example
1324 #+STARTUP: align
1325 #+STARTUP: noalign
1326 @end example
1328 @node Table calculations, orgtbl-mode, Narrow columns, Tables
1329 @section Calculations in tables
1330 @cindex calculations, in tables
1331 @cindex spreadsheet capabilities
1332 @cindex @file{calc} package
1334 The table editor makes use of the Emacs @file{calc} package to implement
1335 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms to
1336 derive fields from other fields.  Org-mode has two levels of complexity
1337 for table calculations.  On the basic level, tables do only horizontal
1338 computations, so a field can be computed from other fields @emph{in the
1339 same row}, and Org-mode assumes that there is only one formula for each
1340 column.  This is very efficient to work with and enough for many tasks.
1341 On the complex level, columns and individual fields can be named for
1342 easier referencing in formulas, individual named fields can have their
1343 own formula associated with them, and recalculation can be automated.
1345 @menu
1346 * Formula syntax::              How to write a formula
1347 * Lisp formulas::               An alternative way to write formulas
1348 * Column formulas::             Formulas valid for all fields in a column
1349 * Advanced features::           Field names, parameters and automatic recalc
1350 * Named-field formulas::        Formulas valid in single fields
1351 * Editing/debugging formulas::  Changing a stored formula
1352 * Appetizer::                   Taste the power of calc
1353 @end menu
1355 @node Formula syntax, Lisp formulas, Table calculations, Table calculations
1356 @subsection Formula syntax
1357 @cindex formula syntax
1358 @cindex syntax, of formulas
1360 A formula can be any algebraic expression understood by the Emacs
1361 @file{calc} package.  Note that @file{calc} has the slightly
1362 non-standard convention that @samp{/} has lower precedence than
1363 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.  Before
1364 evaluation by @code{calc-eval} (@pxref{Calling Calc from
1365 Your Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU
1366 Emacs Calc Manual}),
1367 variable substitution takes place:
1369 @example
1370   $        @r{refers to the current field}
1371   $3       @r{refers to the field in column 3 of the current row}
1372   $3..$7   @r{a vector of the fields in columns 3-7 of current row}
1373   $P1..$P3 @r{vector of column range, using column names}
1374   &2       @r{second data field above the current, in same column}
1375   &5-2     @r{vector from fifth to second field above current}
1376   &III-II  @r{vector of fields between 2nd and 3rd hline above}
1377   &III     @r{vector of fields between third hline above and current field}
1378   $name    @r{a named field, parameter or constant}
1379 @end example
1381 @cindex vectors, in table calculations
1382 The range vectors can be directly fed into the calc vector functions
1383 like @samp{vmean} and @samp{vsum}.
1385 @cindex name, of column or field
1386 @cindex constants, in calculations
1387 @samp{$name} is interpreted as the name of a column, parameter or
1388 constant.  Constants are defined globally through the variable
1389 @code{org-table-formula-constants}.  If you have the
1390 @file{constants.el} package, it will also be used to resolve
1391 constants, including natural constants like @samp{$h} for Planck's
1392 constant, and units like @samp{$km} for kilometers.  Column names and
1393 parameters can be specified in special table lines.  These are
1394 described below, see @ref{Advanced features}.
1396 @cindex format specifier
1397 @cindex mode, for @file{calc}
1398 A formula can contain an optional mode string after a semicolon.  This
1399 string consists of flags to influence calc's modes@footnote{By
1400 default, Org-mode uses the standard calc modes (precision 12, angular
1401 units degrees, fraction and symbolic modes off).  The display format,
1402 however, has been changed to @code{(float 5)} to keep tables compact.
1403 The default settings can be configured using the variable
1404 @code{org-calc-default-modes}.} during execution, e.g.  @samp{p20} to
1405 switch the internal precision to 20 digits, @samp{n3}, @samp{s3},
1406 @samp{e2} or @samp{f4} to switch to normal, scientific, engineering,
1407 or fixed display format, respectively, and @samp{D}, @samp{R}, @samp{F},
1408 and @samp{S} to turn on degrees, radians, fraction and symbolic modes,
1409 respectively.  In addition, you may provide a @code{printf} format
1410 specifier to reformat the final result.  A few examples:
1412 @example
1413 $1+$2                @r{Sum of first and second field}
1414 $1+$2;%.2f           @r{Same, format result to two decimals}
1415 exp($2)+exp($1)      @r{Math functions can be used}
1416 $;%.1f               @r{Reformat current cell to 1 decimal}
1417 ($3-32)*5/9          @r{Degrees F -> C conversion}
1418 $c/$1/$cm            @r{Hz -> cm conversion, using @file{constants.el}}
1419 tan($1);Dp3s1        @r{Compute in degrees, precision 3, display SCI 1}
1420 sin($1);Dp3%.1e      @r{Same, but use printf specifier for display}
1421 vmean($2..$7)        @r{Compute column range mean, using vector function}
1422 vsum(&III)           @r{Sum numbers from 3rd hline above, up to here}
1423 taylor($3,x=7,2)     @r{taylor series of $3, at x=7, second degree}
1424 @end example
1426 @node Lisp formulas, Column formulas, Formula syntax, Table calculations
1427 @subsection Emacs Lisp forms as formulas
1428 @cindex Lisp forms, as table formulas
1430 It is also possible to write a formula in Emacs lisp; this can be useful
1431 for string manipulation and control structures.  If a formula starts
1432 with a single quote followed by an opening parenthesis, then it is
1433 evaluated as a lisp form.  The evaluation should return either a string
1434 or a number.  Just as with @file{calc} formulas, you can provide a
1435 format specifier after a semicolon.  A few examples:
1437 @example
1438 @r{swap the first two characters of the content of column 1}
1439 '(concat (substring "$1" 1 2) (substring "$1" 0 1) (substring "$1" 2))
1440 @r{Add columns 1 and 2, equivalent to the calc's @code{$1+$2}}
1441 '(+ $1 $2)
1442 @end example
1444 @node Column formulas, Advanced features, Lisp formulas, Table calculations
1445 @subsection Column formulas
1446 @cindex column formula
1447 @cindex formula, for table column
1449 To apply a formula to a field, type it directly into the field,
1450 preceded by an equal sign, like @samp{=$1+$2}.  When you press
1451 @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
1452 field, the formula will be stored as the formula for the current
1453 column, evaluated and the current field replaced with the result.  If
1454 the field contains only @samp{=}, the previously stored formula for
1455 this column is used.
1457 For each column, Org-mode will remember the most recently used
1458 formula.  The information is stored in a special line starting with
1459 @samp{#+TBLFM} directly below the table.  When adding/deleting/moving
1460 columns with the appropriate commands, the stored equations will be
1461 modified accordingly.  When a column used in a calculation is removed,
1462 references to this column become invalid and will cause an error upon
1463 applying the equation.
1465 Instead of typing an equation into the field, you may also use the
1466 command @kbd{C-c =}.  It prompts for a formula (with default taken
1467 from the @samp{#+TBLFM:} line) and applies it to the current field.  A
1468 numerical prefix (e.g. @kbd{C-5 C-c =}) will apply it to that many
1469 consecutive fields in the current column.
1471 @cindex recomputing table fields
1472 To recompute all the fields in a line, use the command @kbd{C-c *}.
1473 It re-applies all stored equations to the current row, from left to
1474 right.  With a @kbd{C-u} prefix, this will be done to every line in
1475 the table, so use this command it you want to make sure the entire
1476 table is up-to-date. @kbd{C-u C-c C-c} is another way to update the
1477 entire table.  Global updating does not touch the line(s) above the
1478 first horizontal separator line, assuming that this is the table
1479 header.
1481 @node Advanced features, Named-field formulas, Column formulas, Table calculations
1482 @subsection Advanced features
1484 If you want the recalculation of fields to happen automatically,
1485 or if you want to be able to assign a formula to an individual field
1486 (instead of an entire column) you need to reserve the first column of
1487 the table for special marking characters.  Here is an example of a
1488 table that collects exam results of students and makes use of these
1489 features:
1491 @example
1492 @group
1493 |---+---------+--------+--------+--------+-------+------|
1494 |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
1495 |---+---------+--------+--------+--------+-------+------|
1496 | ! |         |     P1 |     P2 |     P3 |   Tot |      |
1497 | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
1498 | ^ |         |     m1 |     m2 |     m3 |    mt |      |
1499 |---+---------+--------+--------+--------+-------+------|
1500 | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
1501 | # | Sara    |      6 |     14 |     19 |    39 |  7.8 |
1502 | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
1503 |---+---------+--------+--------+--------+-------+------|
1504 |   | Average |        |        |        |  29.7 |      |
1505 | ^ |         |        |        |        |    at |      |
1506 | $ | max=50  |        |        |        |       |      |
1507 |---+---------+--------+--------+--------+-------+------|
1508 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(&II);%.1f
1509 @end group
1510 @end example
1512 @noindent @b{Important}: Please note that for these special tables,
1513 recalculating the table with @kbd{C-u C-c *} will only affect rows
1514 that are marked @samp{#} or @samp{*}, and named fields.  The column
1515 formulas are not applied in rows with empty first field.
1517 @cindex marking characters, tables
1518 The marking characters have the following meaning:
1519 @table @samp
1520 @item !
1521 The fields in this line define names for the columns, so that you may
1522 refer to a column as @samp{$Tot} instead of @samp{$6}.
1523 @item ^
1524 This row defines names for the fields @emph{above} the row.  With such
1525 a definition, any formula in the table may use @samp{$m1} to refer to
1526 the value @samp{10}.  Also, named fields can have their own formula
1527 associated with them.
1528 @item _
1529 Similar to @samp{^}, but defines names for the fields in the row
1530 @emph{below}.
1531 @item $
1532 Fields in this row can define @emph{parameters} for formulas.  For
1533 example, if a field in a @samp{$} row contains @samp{max=50}, then
1534 formulas in this table can refer to the value 50 using @samp{$max}.
1535 Parameters work exactly like constants, only that they can be defined on
1536 a per-table basis.  Changing a parameter and then recalculating the
1537 table can be useful.
1538 @item #
1539 Fields in this row are automatically recalculated when pressing
1540 @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row.  Also, this row
1541 is selected for a global recalculation with @kbd{C-u C-c *}.  Unmarked
1542 lines will be left alone by this command.
1543 @item *
1544 Selects this line for global recalculation with @kbd{C-u C-c *}, but
1545 not for automatic recalculation.  Use this when automatic
1546 recalculation slows down editing too much.
1547 @item
1548 Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
1549 All lines that should be recalculated should be marked with @samp{#}
1550 or @samp{*}.
1551 @end table
1553 @node Named-field formulas, Editing/debugging formulas, Advanced features, Table calculations
1554 @subsection Named-field formulas
1555 @cindex named field formula
1556 @cindex formula, for named table field
1558 A named field can have its own formula associated with it.  In the
1559 example above, this is used for the @samp{at} field that contains
1560 the average result of the students.  To enter a formula for a named
1561 field, just type it into the buffer, preceded by @samp{:=}.  Or use
1562 @kbd{C-u C-c =}.  This equation will be stored below the table like
1563 @samp{$name=...}.  Any recalculation in the table (even if only
1564 requested for the current line) will also update all named field
1565 formulas.
1567 @node Editing/debugging formulas, Appetizer, Named-field formulas, Table calculations
1568 @subsection Editing and debugging formulas
1569 @cindex formula editing
1570 @cindex editing, of table formulas
1572 To edit a column or field formula, use the commands @kbd{C-c
1573 =} and @kbd{C-u C-c =}, respectively.  The currently active expression
1574 is then presented as default in the minibuffer, where it may be edited.
1576 Note that making a table field blank does not remove the formula
1577 associated with the field - during the next recalculation the field
1578 will be filled again.  To remove a formula from a field, you have to
1579 give an empty reply when prompted for the formula, or to edit the
1580 @samp{#+TBLFM} line.
1582 @kindex C-c C-c
1583 You may edit the @samp{#+TBLFM} directly and re-apply
1584 the changed equations with @kbd{C-c C-c} in that line, or with the
1585 normal recalculation commands in the table.
1587 @kindex C-c '
1588 @kindex C-c C-c
1589 @kindex C-c C-q
1590 @kindex C-c ?
1591 In particular for large tables with many formulas, it is convenient to
1592 use the command @kbd{C-c '} to edit the formulas of the current table
1593 in a separate buffer.  That buffer will show the formulas one per
1594 line, and you are free to edit, add and remove formulas.  Press
1595 @kbd{C-c ?} on a @samp{$...}  expression to get information about its
1596 interpretation.  Exiting the buffer with @kbd{C-c C-c} only stores the
1597 modified formulas below the table.  Exiting with @kbd{C-u C-c C-c}
1598 also applies them to the entire table.  @kbd{C-c C-q} exits without
1599 installing the changes.
1601 When the evaluation of a formula leads to an error, the field content
1602 becomes the string @samp{#ERROR}.  If you would like see what is going
1603 on during variable substitution and calculation in order to find a
1604 bug, turn on formula debugging in the menu and repeat the calculation,
1605 for example by pressing @kbd{C-c = @key{RET}} in a field.
1606 Detailed information will be displayed.
1608 @node Appetizer,  , Editing/debugging formulas, Table calculations
1609 @subsection Appetizer
1611 Finally, just to whet your appetite on what can be done with the fantastic
1612 @file{calc} package, here is a table that computes the Taylor series
1613 for a couple of functions (homework: try that with Excel :-)
1615 @example
1616 @group
1617 |---+-------------+---+-----+--------------------------------------|
1618 |   | Func        | n | x   | Result                               |
1619 |---+-------------+---+-----+--------------------------------------|
1620 | # | exp(x)      | 1 | x   | 1 + x                                |
1621 | # | exp(x)      | 2 | x   | 1 + x + x^2 / 2                      |
1622 | # | exp(x)      | 3 | x   | 1 + x + x^2 / 2 + x^3 / 6            |
1623 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
1624 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2    |
1625 | * | tan(x)      | 3 | x   | 0.0175 x + 1.77e-6 x^3               |
1626 |---+-------------+---+-----+--------------------------------------|
1627 #+TBLFM: $5=taylor($2,$4,$3);n3
1628 @end group
1629 @end example
1631 @node orgtbl-mode, table.el, Table calculations, Tables
1632 @section The Orgtbl minor mode
1633 @cindex orgtbl-mode
1634 @cindex minor mode for tables
1636 If you like the intuitive way the Org-mode table editor works, you
1637 might also want to use it in other modes like text-mode or mail-mode.
1638 The minor mode Orgtbl-mode makes this possible.  You can always toggle
1639 the mode with @kbd{M-x orgtbl-mode}.  To turn it on by default, for
1640 example in mail mode, use
1642 @lisp
1643 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
1644 @end lisp
1646 @node table.el,  , orgtbl-mode, Tables
1647 @section The @file{table.el} package
1648 @kindex C-c C-c
1649 @cindex table editor, @file{table.el}
1650 @cindex @file{table.el}
1652 Complex ASCII tables with automatic line wrapping, column- and
1653 row-spanning, and alignment can be created using the Emacs table
1654 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
1655 and also part of Emacs 22).
1656 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org-mode
1657 will call @command{table-recognize-table} and move the cursor into the
1658 table.  Inside a table, the keymap of Org-mode is inactive.  In order
1659 to execute Org-mode-related commands, leave the table.
1661 @table @kbd
1662 @kindex C-c C-c
1663 @item C-c C-c
1664 Recognize @file{table.el} table.  Works when the cursor is in a
1665 table.el table.
1667 @kindex C-c ~
1668 @item C-c ~
1669 Insert a table.el table.  If there is already a table at point, this
1670 command converts it between the table.el format and the Org-mode
1671 format.  See the documentation string of the command
1672 @code{org-convert-table} for the restrictions under which this is
1673 possible.
1674 @end table
1676 @node Hyperlinks, TODO items, Tables, Top
1677 @chapter Hyperlinks
1678 @cindex hyperlinks
1680 Just like HTML, Org-mode provides links inside a file, and external
1681 links to other files, Usenet articles, emails, and much more.
1683 @menu
1684 * Link format::                 How links in Org-mode are formatted
1685 * Internal links::              Links to other places in the current file
1686 * External links::              URL-like links to the world
1687 * Handling links::              Creating, inserting and following
1688 * Link abbreviations::          Shortcuts for writing complex links
1689 * Search options::              Linking to a specific location
1690 * Custom searches::             When the default search is not enough
1691 * Remember::                    Org-trees store quick notes
1692 @end menu
1694 @node Link format, Internal links, Hyperlinks, Hyperlinks
1695 @section Link format
1696 @cindex link format
1697 @cindex format, of links
1699 Org-mode will recognize plain URL-like links and activate them as
1700 clickable links.  The general link format, however, looks like this:
1702 @example
1703 [[link][description]]       @r{or alternatively}           [[link]]  
1704 @end example
1706 Once a link in the buffer is complete (all brackets present), Org-mode
1707 will change the display so that @samp{description} is displayed instead
1708 of @samp{[[link][description]]} and @samp{link} is displayed instead of
1709 @samp{[[link]]}.  Links will be highlighted in the face @code{org-link},
1710 which by default is an underlined face.  You can directly edit the
1711 visible part of a link.  Note that this can be either the @samp{link}
1712 part (if there is no description) or the @samp{description} part.  To
1713 edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
1714 cursor on the link.
1716 If you place the cursor at the beginning or just behind the end of the
1717 displayed text and press @key{BACKSPACE}, you will remove the
1718 (invisible) bracket at that location.  This makes the link incomplete
1719 and the internals are again displayed as plain text.  Inserting the
1720 missing bracket hides the link internals again.  To show the
1721 internal structure of all links, use the menu entry
1722 @code{Org->Hyperlinks->Literal links}.
1724 @node Internal links, External links, Link format, Hyperlinks
1725 @section Internal links
1726 @cindex internal links
1727 @cindex links, internal
1728 @cindex CamelCase links
1729 @cindex targets, for links
1731 If the link does not look like a URL, it is considered to be internal in
1732 the current file.  Links such as @samp{[[My Target]]} or @samp{[[My
1733 Target][Find my target]]} lead to a text search in the current file.
1734 The link can be followed with @kbd{C-c C-o} when the cursor is on the
1735 link, or with a mouse click (@pxref{Handling links}).  The preferred
1736 match for such a link is a dedicated target: the same string in double
1737 angular brackets.  Targets may be located anywhere; often it is
1738 convenient to put them into a comment line. For example
1740 @example
1741 # <<My Target>>
1742 @end example
1744 @noindent In HTML export (@pxref{HTML export}), such targets will become
1745 named anchors for direct access through @samp{http} links@footnote{Note
1746 that text before the first headline will never be exported, so the first
1747 such target must be after the first headline.}.
1749 If no dedicated target exists, Org-mode will search for the words in the
1750 link.  In the above example the search would be for @samp{my target}.
1751 Links starting with a star like @samp{*My Target} restrict the search to
1752 headlines.  When searching, Org-mode will first try an exact match, but
1753 then move on to more and more lenient searches.  For example, the link
1754 @samp{[[*My Targets]]} will find any of the following:
1756 @example
1757 ** My targets
1758 ** TODO my targets are bright
1759 ** my 20 targets are
1760 @end example
1762 To insert a link targeting a headline, in-buffer completion can be used.
1763 Just type a star followed by a few optional letters into the buffer and
1764 press @kbd{M-@key{TAB}}.  All headlines in the current buffer will be
1765 offered as completions.  @xref{Handling links}, for more commands
1766 creating links.
1768 Following a link pushes a mark onto Org-mode's own mark ring.  You can
1769 return to the previous position with @kbd{C-c &}.  Using this command
1770 several times in direct succession goes back to positions recorded
1771 earlier.
1773 @menu
1774 * Radio targets::               Make targets trigger links in plain text.
1775 * CamelCase links::             Activating CamelCase words as links
1776 @end menu
1778 @node Radio targets, CamelCase links, Internal links, Internal links
1779 @subsection Radio targets
1780 @cindex radio targets
1781 @cindex targets, radio
1782 @cindex links, radio targets
1784 You can configure Org-mode to link any occurrences of certain target
1785 names in normal text.  So without explicitly creating a link, the text
1786 connects to the target radioing its position.  Radio targets are
1787 enclosed by triple angular brackets.  For example, a target
1788 @samp{<<<My Target>>>} causes each occurrence of @samp{my target} in
1789 normal text to become activated as a link.  The Org-mode file is
1790 scanned automatically for radio targets only when the file is first
1791 loaded into Emacs.  To update the target list during editing, press
1792 @kbd{C-c C-c} with the cursor on or at a target.
1794 @node CamelCase links,  , Radio targets, Internal links
1795 @subsection CamelCase words as links
1796 @cindex completion, of CamelCase links
1797 @cindex CamelCase links, completion of
1799 Org-mode also supports CamelCase words as links.  This feature is not
1800 turned on by default because of the inconsistencies this system suffers
1801 from.  It is also possible that this feature will disappear entirely in
1802 a future version of Org-mode.  To activate CamelCase words as links, you
1803 need to customize the option @code{org-activate-links}.  A CamelCase
1804 word then leads to a text search such that @samp{CamelCaseLink} is
1805 equivalent to @samp{[[camel case link]]}.
1807 @node External links, Handling links, Internal links, Hyperlinks
1808 @section External links
1809 @cindex links, external
1810 @cindex external links
1811 @cindex links, external
1812 @cindex GNUS links
1813 @cindex BBDB links
1814 @cindex URL links
1815 @cindex file links
1816 @cindex VM links
1817 @cindex RMAIL links
1818 @cindex WANDERLUST links
1819 @cindex MH-E links
1820 @cindex USENET links
1821 @cindex SHELL links
1822 @cindex Info links
1823 @cindex elisp links
1825 Org-mode supports links to files, websites, Usenet and email messages,
1826 and BBDB database entries.  External links are URL-like locators.  They
1827 start with a short identifying string followed by a colon.  There can be
1828 no space after the colon.  The following list shows examples for each
1829 link type.
1831 @example
1832 http://www.astro.uva.nl/~dominik          @r{on the web}
1833 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
1834 file:papers/last.pdf                      @r{file, relative path}
1835 news:comp.emacs                           @r{Usenet link}
1836 mailto:adent@@galaxy.net                   @r{Mail link}
1837 vm:folder                                 @r{VM folder link}
1838 vm:folder#id                              @r{VM message link}
1839 vm://myself@@some.where.org/folder#id      @r{VM on remote machine}
1840 wl:folder                                 @r{WANDERLUST folder link}
1841 wl:folder#id                              @r{WANDERLUST message link}
1842 mhe:folder                                @r{MH-E folder link}
1843 mhe:folder#id                             @r{MH-E message link}
1844 rmail:folder                              @r{RMAIL folder link}
1845 rmail:folder#id                           @r{RMAIL message link}
1846 gnus:group                                @r{GNUS group link}
1847 gnus:group#id                             @r{GNUS article link}
1848 bbdb:Richard Stallman                     @r{BBDB link}
1849 shell:ls *.org                            @r{A shell command}
1850 elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
1851 @end example
1853 A link should be enclosed in double brackets and may contain a
1854 descriptive text to be displayed instead of the url (@pxref{Link
1855 format}), for example:
1857 @example
1858 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
1859 @end example
1861 @cindex angular brackets, around links
1862 @cindex plain text external links
1863 Org-mode also finds external links in the normal text and activates them
1864 as links.  If spaces must be part of the link (for example in
1865 @samp{bbdb:Richard Stallman}), or you need to remove ambiguities about the end of
1866 the link, enclose them in angular brackets.
1868 @node Handling links, Link abbreviations, External links, Hyperlinks
1869 @section Handling links
1870 @cindex links, handling
1872 Org-mode provides methods to create a link in the correct syntax, to
1873 insert it into an org-mode file, and to follow the link.
1875 @table @kbd
1876 @kindex C-c l
1877 @cindex storing links
1878 @item C-c l
1879 Store a link to the current location.  This is a @emph{global} command
1880 which can be used in any buffer to create a link.  The link will be
1881 stored for later insertion into an Org-mode buffer (see below).  For
1882 Org-mode files, if there is a @samp{<<target>>} at the cursor, the link
1883 points to the target.  Otherwise it points to the current headline.  For
1884 VM, RMAIL, WANDERLUST, MH-E, GNUS and BBDB buffers, the link will
1885 indicate the current article/entry.  For W3 and W3M buffers, the link
1886 goes to the current URL.  For any other files, the link will point to
1887 the file, with a search string (@pxref{Search options}) pointing to the
1888 contents of the current line.  If there is an active region, the
1889 selected words will form the basis of the search string.  If the
1890 automatically created link is not working correctly or accurately
1891 enough, you can write custom functions to select the search string and
1892 to do the search for particular file types - see @ref{Custom searches}.
1893 The key binding @kbd{C-c l} is only a suggestion - see @ref{Installation}.
1895 @kindex C-c C-l
1896 @cindex link completion
1897 @cindex completion, of links
1898 @cindex inserting links
1899 @item C-c C-l
1900 Insert a link.  This prompts for a link to be inserted into the buffer.
1901 You can just type a link, using text for an internal link, or one of the
1902 link type prefixes mentioned in the examples above.  Through completion,
1903 all links stored during the current session can be
1904 accessed@footnote{After insertion of a stored link, the link will be
1905 removed from the list of stored links.  To keep it in the list later
1906 use, use a triple @kbd{C-u} prefix to @kbd{C-c C-l}, or configure the
1907 option @code{org-keep-stored-link-after-insertion}.}.  The link
1908 will be inserted into the buffer, along with a descriptive text.  Note
1909 that you don't have to use this command to insert a link.  Links in
1910 Org-mode are plain text, and you can type or paste them straight into
1911 the buffer.  By using this command, the links are automatically enclosed
1912 in double brackets, and you will be asked for the optional descriptive
1913 text.  If the link is a @samp{file:} link and the linked file is located
1914 in the same directory as the current file or a subdirectory of it, the
1915 path of the file will be inserted relative to the current directory.
1917 @kindex C-u C-c C-l
1918 @cindex file name completion
1919 @cindex completion, of file names
1920 @item C-u C-c C-l
1921 When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
1922 a file will be inserted and you may use file name completion to select
1923 the name of the file.  The path to the file is inserted relative to the
1924 directory of the current org file, if the linked file is in the current
1925 directory or in a subdirectory of it, or if the path is written relative
1926 to the current directory using @samp{../}.  Otherwise an absolute path
1927 is used, if possible with @samp{~/} for your home directory.  You can
1928 force an absolute path with two @kbd{C-u} prefixes.
1930 @item C-c C-l @r{with cursor on existing link}
1931 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
1932 link and description parts of the link.
1934 @cindex following links
1935 @kindex C-c C-o
1936 @item C-c C-o
1937 Open link at point.  This will launch a web browser for URLs (using
1938 @command{browse-url-at-point}), run vm/mh-e/wanderlust/rmail/gnus/bbdb
1939 for the corresponding links, and execute the command in a shell link.
1940 When the cursor is on an internal link, this commands runs the
1941 corresponding search.  When the cursor is on a TAG list in a headline,
1942 it creates the corresponding TAGS view.  If the cursor is on a time
1943 stamp, it compiles the agenda for that date.  Furthermore, it will visit
1944 text and remote files in @samp{file:} links with Emacs and select a
1945 suitable application for local non-text files.  Classification of files
1946 is based on file extension only.  See option @code{org-file-apps}.  If
1947 you want to override the default application and visit the file with
1948 Emacs, use a @kbd{C-u} prefix.
1950 @kindex mouse-2
1951 @kindex mouse-1
1952 @item mouse-2
1953 @itemx mouse-1
1954 On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
1955 would.  Under Emacs 22, also @kbd{mouse-1} will follow a link.
1957 @kindex mouse-3
1958 @item mouse-3
1959 Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
1960 internal links to be displayed in another window@footnote{See the
1961 variable @code{org-display-internal-link-with-indirect-buffer}}.
1963 @cindex mark ring
1964 @kindex C-c %
1965 @item C-c %
1966 Push the current position onto the mark ring, to be able to return
1967 easily. Commands following an internal link do this automatically.
1969 @cindex links, returning to
1970 @kindex C-c &
1971 @item C-c &
1972 Jump back to a recorded position.  A position is recorded by the
1973 commands following internal links, and by @kbd{C-c %}.  Using this
1974 command several times in direct succession moves through a ring of
1975 previously recorded positions.
1976 @end table
1978 @node Link abbreviations, Search options, Handling links, Hyperlinks
1979 @section Link abbreviatons
1980 @cindex link abbreviations
1981 @cindex abbreviation, links
1983 Long URLs can be cumbersome to type, and often many similar links are
1984 needed in a document.  For this you can use link abbreviations.  An
1985 abbreviated link looks like this
1987 @example
1988 [[linkword::tag][description]]
1989 @end example
1991 @noindent
1992 where the tag is optional.  Such abbreviations are resolved according to
1993 the information in the variable @code{org-link-abbrev-alist} that
1994 relates the linkwords to replacement text.  Here is an example:
1996 @lisp
1997 @group
1998 (setq org-link-abbrev-alist
1999   '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
2000     ("google"   . "http://www.google.com/search?q=")
2001     ("ads"      . "http://adsabs.harvard.edu/cgi-bin/
2002                    nph-abs_connect?author=%s&db_key=AST")))
2003 @end group
2004 @end lisp
2006 If the replacement text contains the string @samp{%s}, it will be
2007 replaced with the tag.  Otherwise the tag will be appended to the string
2008 in order to create the link.  You may also specify a function that will
2009 be called with the tag as the only argument to create the link.
2011 With the above setting, you could link to a specific bug with
2012 @code{[[bugzilla::129]]}, search the web for OrgMode with
2013 @code{[[google::OrgMode]]} and find out what the Org-mode author is
2014 doing besides Emacs hacking with @code{[[ads::Dominik,C]]}.
2016 If you need special abbreviations just for a single Org-mode buffer, you
2017 can define them in the file with
2019 @example
2020 #+LINK: bugzilla  http://10.1.2.9/bugzilla/show_bug.cgi?id=
2021 #+LINK: google    http://www.google.com/search?q=%s
2022 @end example
2024 @noindent
2025 In-buffer completion @pxref{Completion} can be used after @samp{[} to
2026 complete link abbreviations.
2028 @node Search options, Custom searches, Link abbreviations, Hyperlinks
2029 @section Search options in file links
2030 @cindex search option in file links
2031 @cindex file links, searching
2033 File links can contain additional information to make Emacs jump to a
2034 particular location in the file when following a link.  This can be a
2035 line number or a search option after a double@footnote{For backward
2036 compatibility, line numbers can also follow a single colon.} colon. For
2037 example, when the command @kbd{C-c l} creates a link (@pxref{Handling
2038 links}) to a file, it encodes the words in the current line as a search
2039 string that can be used to find this line back later when following the
2040 link with @kbd{C-c C-o}. 
2042 Here is the syntax of the different ways to attach a search to a file
2043 link, together with an explanation:
2045 @example
2046 [[file:~/code/main.c::255]]
2047 [[file:~/xx.org::My Target]]
2048 [[file:~/xx.org::*My Target]]
2049 [[file:~/xx.org::/regexp/]]
2050 @end example
2052 @table @code
2053 @item 255
2054 Jump to line 255.
2055 @item My Target
2056 Search for a link target @samp{<<My Target>>}, or do a text search for
2057 @samp{my target}, similar to the search in internal links, see
2058 @ref{Internal links}.  In HTML export (@pxref{HTML export}), such a file
2059 link will become an HTML reference to the corresponding named anchor in
2060 the linked file.
2061 @item *My Target
2062 In an Org-mode file, restrict search to headlines.
2063 @item /regexp/
2064 Do a regular expression search for @code{regexp}.  This uses the Emacs
2065 command @code{occur} to list all matches in a separate window.  If the
2066 target file is in Org-mode, @code{org-occur} is used to create a
2067 sparse tree with the matches.
2068 @c If the target file is a directory,
2069 @c @code{grep} will be used to search all files in the directory.
2070 @end table
2072 As a degenerate case, a file link with an empty file name can be used
2073 to search the current file.  For example, @code{[[file:::find me]]} does
2074 a search for @samp{find me} in the current file, just as
2075 @samp{[[find me]]} would.
2077 @node Custom searches, Remember, Search options, Hyperlinks
2078 @section Custom Searches
2079 @cindex custom search strings
2080 @cindex search strings, custom
2082 The default mechanism for creating search strings and for doing the
2083 actual search related to a file link may not work correctly in all
2084 cases.  For example, BibTeX database files have many entries like
2085 @samp{year="1993"} which would not result in good search strings,
2086 because the only unique identification for a BibTeX entry is the
2087 citation key.
2089 If you come across such a problem, you can write custom functions to set
2090 the right search string for a particular file type, and to do the search
2091 for the string in the file.  Using @code{add-hook}, these functions need
2092 to be added to the hook variables
2093 @code{org-create-file-search-functions} and
2094 @code{org-execute-file-search-functions}.  See the docstring for these
2095 variables for more information.  Org-mode actually uses this mechanism
2096 for Bib@TeX{} database files, and you can use the corresponding code as
2097 an implementation example.  Search for @samp{BibTeX links} in the source
2098 file.
2101 @node Remember,  , Custom searches, Hyperlinks
2102 @section Remember
2103 @cindex @file{remember.el}
2105 Another way to create org entries with links to other files is through
2106 the @emph{Remember} package by John Wiegley.  @emph{Remember} lets you
2107 store quick notes with little interruption of your work flow.  See
2108 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
2109 information.  The notes produced by @emph{Remember} can be stored in
2110 different ways, and Org-mode files are a good target.  Org-mode allows
2111 you to file away notes either to a default file, or directly to the correct
2112 location in your Org-mode outline tree.  The following customization
2113 will tell @emph{Remember} to use org files as target, and to create
2114 annotations compatible with Org-mode links.
2116 @example
2117 (setq org-directory "~/path/to/my/orgfiles/")
2118 (setq org-default-notes-file "~/.notes")
2119 (setq remember-annotation-functions '(org-remember-annotation))
2120 (setq remember-handler-functions '(org-remember-handler))
2121 (add-hook 'remember-mode-hook 'org-remember-apply-template)
2122 @end example
2124 @cindex templates, for remember
2125 In combination with Org-mode, you can use templates to generate
2126 different types of remember notes.  For example, if you would like to
2127 use one template to create general TODO entries, and another one for
2128 journal entries, you could use:
2130 @example
2131 (setq org-remember-templates
2132       '((?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org")
2133         (?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")))
2134 @end example
2136 @noindent In these entries, the character specifies how to select the
2137 template, the first string specifies the template, and the (optional)
2138 second string specifies a default file (overruling
2139 @code{org-default-notes-file}) as a target for this note.
2141 When you call @kbd{M-x remember} to remember something, org will prompt
2142 for a key to select the template and then prepare the buffer like
2143 @example
2144 * TODO
2145   [[file:link to where you called remember]]
2146 @end example
2148 @noindent or
2150 @example
2151 * [2006-03-21 Tue 15:37]
2153   [[file:link to where you called remember]]
2154 @end example
2156 @noindent See the variable @code{org-remember-templates} for more details.
2158 When you are finished composing a note with remember, you have to press
2159 @kbd{C-c C-c} to file the note away.  The handler first prompts for a
2160 target file - if you press @key{RET}, the value of
2161 @code{org-default-notes-file} is used.  Then the command offers the
2162 headings tree of the selected file.  You can either immediately press
2163 @key{RET} to get the note appended to the file.  Or you can use vertical
2164 cursor motion (@key{up} and @key{down}) and visibility cycling
2165 (@key{TAB}) to find a better place.  Pressing @key{RET} or @key{left} or
2166 @key{right} leads to the following result.
2168 @multitable @columnfractions 0.2 0.1 0.7
2169 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
2170 @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file
2171 @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor
2172 @item             @tab @key{left}  @tab as same level, before current heading
2173 @item             @tab @key{right} @tab as same level, after current heading
2174 @item not on headline @tab @key{RET}
2175       @tab at cursor position, level taken from context.
2176            Or use prefix arg to specify level manually.
2177 @end multitable
2179 So a fast way to store the note is to press @kbd{C-c C-c @key{RET}
2180 @key{RET}} to append it to the default file.  Even shorter would be
2181 @kbd{C-u C-c C-c}, which does the same without even showing the tree.
2182 But with little extra effort, you can push it directly to the correct
2183 location.
2185 Before inserting the text into a tree, the function ensures that the
2186 text has a headline, i.e. a first line that starts with a @samp{*}.
2187 If not, a headline is constructed from the current date and some
2188 additional data.  If the variable @code{org-adapt-indentation} is
2189 non-nil, the entire text is also indented so that it starts in the
2190 same column as the headline (after the asterisks).
2193 @node TODO items, Timestamps, Hyperlinks, Top
2194 @chapter TODO items
2195 @cindex TODO items
2197 Org-mode does not maintain TODO lists as a separate document.  TODO
2198 items are an integral part of the notes file, because TODO items
2199 usually come up while taking notes!  With Org-mode, you simply mark
2200 any entry in a tree as being a TODO item.  In this way, the
2201 information is not duplicated, and the entire context from which the
2202 item emerged is always present when you check.
2204 Of course, this technique causes TODO items to be scattered throughout
2205 your file.  Org-mode provides methods to give you an overview over all
2206 things you have to do.
2208 @menu
2209 * TODO basics::                 Marking and displaying TODO entries
2210 * TODO extensions::             Workflow and assignments
2211 * Priorities::                  Some things are more important than others
2212 * Breaking down tasks::         Splitting a task into managable pieces
2213 * Checkboxes::                  Tick-off lists
2214 @end menu
2216 @node TODO basics, TODO extensions, TODO items, TODO items
2217 @section Basic TODO functionality
2219 Any headline can become a TODO item by starting it with the word TODO,
2220 for example:
2222 @example
2223 *** TODO Write letter to Sam Fortune
2224 @end example
2226 @noindent
2227 The most important commands to work with TODO entries are:
2229 @table @kbd
2230 @kindex C-c C-t
2231 @cindex cycling, of TODO states
2232 @item C-c C-t
2233 Rotate the TODO state of the current item between
2235 @example
2236 ,-> (unmarked) -> TODO -> DONE --.
2237 '--------------------------------'
2238 @end example
2240 The same rotation can also be done ``remotely'' from the timeline and
2241 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
2242 @kindex S-@key{right}
2243 @kindex S-@key{left}
2244 @item S-@key{right}
2245 @itemx S-@key{left}
2246 Select the following/preceding TODO state, similar to cycling.  Mostly
2247 useful if more than two TODO states are possible (@pxref{TODO extensions}).
2248 @kindex C-c C-v
2249 @cindex sparse tree, for TODO
2250 @item C-c C-v
2251 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
2252 the entire buffer, but shows all TODO items and the headings hierarchy
2253 above them.  With prefix arg, show also the DONE entries.  With
2254 numerical prefix N, show the tree for the Nth keyword in the variable
2255 @code{org-todo-keywords}.
2256 @kindex C-c a t
2257 @item C-c a t
2258 Show the global TODO list.  This collects the TODO items from all
2259 agenda files (@pxref{Agenda views}) into a single buffer.  The buffer is in
2260 @code{agenda-mode}, so there are commands to examine and manipulate
2261 the TODO entries directly from that buffer (@pxref{Agenda commands}).
2262 @xref{Global TODO list}, for more information.
2263 @c @item @code{org-agenda-include-all-todo}
2264 @c If you would like to have all your TODO items listed as part of your
2265 @c agenda, customize the variable @code{org-agenda-include-all-todo}.
2266 @end table
2269 @node TODO extensions, Priorities, TODO basics, TODO items
2270 @section Extended use of TODO keywords
2271 @cindex extended TODO keywords
2273 The default implementation of TODO entries is just two states: TODO and
2274 DONE.  You can, however, use the TODO feature for more complicated
2275 things by configuring the variables @code{org-todo-keywords} and
2276 @code{org-todo-interpretation}.  Using special setup, you can even use
2277 TODO keywords in different ways in different org files.
2279 Note that @i{tags} are another way to classify headlines in general and
2280 TODO items in particular (@pxref{Tags}).
2282 @menu
2283 * Workflow states::             From TODO to DONE in steps
2284 * TODO types::                  I do this, Fred the rest
2285 * Per file keywords::           Different files, different requirements
2286 @end menu
2288 @node Workflow states, TODO types, TODO extensions, TODO extensions
2289 @subsection TODO keywords as workflow states
2290 @cindex TODO workflow
2291 @cindex workflow states as TODO keywords
2293 You can use TODO keywords to indicate different states in the process
2294 of working on an item, for example:
2296 @lisp
2297 (setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE")
2298       org-todo-interpretation 'sequence)
2299 @end lisp
2301 @cindex completion, of TODO keywords
2302 Changing these variables only becomes effective in a new Emacs session.
2303 With this setup, the command @kbd{C-c C-t} will cycle an entry from
2304 TODO to FEEDBACK, then to VERIFY, and finally to DONE.  You may also
2305 use a prefix argument to quickly select a specific state.  For example
2306 @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
2307 If you define many keywords, you can use in-buffer completion (see
2308 @ref{Completion}) to insert these words into the buffer.
2310 @node TODO types, Per file keywords, Workflow states, TODO extensions
2311 @subsection TODO keywords as types
2312 @cindex TODO types
2313 @cindex names as TODO keywords
2314 @cindex types as TODO keywords
2316 The second possibility is to use TODO keywords to indicate different
2317 types of action items.  For example, you might want to indicate that
2318 items are for ``work'' or ``home''.  If you are into David Allen's
2319 @emph{Getting Things DONE}, you might want to use todo types
2320 @samp{NEXTACTION}, @samp{WAITING}, @samp{MAYBE}.  Or, when you work
2321 with several people on a single project, you might want to assign
2322 action items directly to persons, by using their names as TODO
2323 keywords.  This would be set up like this:
2325 @lisp
2326 (setq org-todo-keywords '("Fred" "Sara" "Lucy" "Mike" "DONE")
2327       org-todo-interpretation 'type)
2328 @end lisp
2330 In this case, different keywords do not indicate a sequence, but
2331 rather different types.  So it is normally not useful to change from
2332 one type to another.  Therefore, in this case the behavior of the
2333 command @kbd{C-c C-t} is changed slightly@footnote{This is also true
2334 for the @kbd{t} command in the timeline and agenda buffers.}.  When
2335 used several times in succession, it will still cycle through all
2336 names.  But when you return to the item after some time and execute
2337 @kbd{C-c C-t} again, it will switch from each name directly to DONE.
2338 Use prefix arguments or completion to quickly select a specific name.
2339 You can also review the items of a specific TODO type in a sparse tree
2340 by using a numeric prefix to @kbd{C-c C-v}.  For example, to see all
2341 things Lucy has to do, you would use @kbd{C-3 C-c C-v}.  To collect
2342 Lucy's items from all agenda files into a single buffer, you
2343 would use the prefix arg as well when creating the global todo list:
2344 @kbd{C-3 C-c t}.
2346 @node Per file keywords,  , TODO types, TODO extensions
2347 @subsection Setting up TODO keywords for individual files
2348 @cindex keyword options
2349 @cindex per file keywords
2351 It can be very useful to use different aspects of the TODO mechanism
2352 in different files, which is not possible with the global settings
2353 described above.  For file-local settings, you need to add special
2354 lines to the file which set the keywords and interpretation for that
2355 file only.  For example, to set one of the two examples discussed
2356 above, you need one of the following lines, starting in column zero
2357 anywhere in the file:
2359 @example
2360 #+SEQ_TODO: TODO FEEDBACK VERIFY DONE
2361 #+TYP_TODO: Fred Sara Lucy Mike DONE
2362 @end example
2364 @cindex Completion, of option keywords
2365 @kindex M-@key{TAB}
2366 @noindent To make sure you are using the correct keyword, type
2367 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
2369 @cindex DONE, final TODO keyword
2370 Remember that the last keyword must always mean that the item is DONE
2371 (although you may use a different word).  Also note that in each file,
2372 only one of the two aspects of TODO keywords can be used.  After
2373 changing one of these lines, use @kbd{C-c C-c} with the cursor still
2374 in the line to make the changes known to Org-mode@footnote{Org-mode
2375 parses these lines only when Org-mode is activated after visiting a
2376 file.  @kbd{C-c C-c} with the cursor in a line starting with @samp{#+}
2377 is simply restarting Org-mode for the current buffer.}.
2379 If you want to use very many keywords, for example when working with a
2380 large group of people, you may split the names over several lines:
2382 @example
2383 #+TYP_TODO: Fred Sara Lucy Mike
2384 #+TYP_TODO: Luis George Jules Jessica
2385 #+TYP_TODO: Kim Arnold Peter
2386 #+TYP_TODO: DONE
2387 @end example
2389 @node Priorities, Breaking down tasks, TODO extensions, TODO items
2390 @section Priorities
2391 @cindex priorities
2393 If you use Org-mode extensively to organize your work, you may end up
2394 with a number of TODO entries so large that you'd like to prioritize
2395 them.  This can be done by placing a @emph{priority cookie} into the
2396 headline, like this
2398 @example
2399 *** TODO [#A] Write letter to Sam Fortune
2400 @end example
2402 @noindent
2403 With its standard setup, Org-mode supports priorities @samp{A},
2404 @samp{B}, and @samp{C}.  @samp{A} is the highest priority.  An entry
2405 without a cookie is treated as priority @samp{B}.  Priorities make a
2406 difference only in the agenda (@pxref{Weekly/Daily agenda}).
2408 @table @kbd
2409 @kindex @kbd{C-c ,}
2410 @item @kbd{C-c ,}
2411 Set the priority of the current headline.  The command prompts for a
2412 priority character @samp{A}, @samp{B} or @samp{C}.  When you press
2413 @key{SPC} instead, the priority cookie is removed from the headline.
2414 The priorities can also be changed ``remotely'' from the timeline and
2415 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
2417 @kindex S-@key{up}
2418 @kindex S-@key{down}
2419 @item S-@key{up}
2420 @itemx S-@key{down}
2421 Increase/decrease priority of current headline.  Note that these keys
2422 are also used to modify time stamps (@pxref{Creating timestamps}).
2423 Furthermore, these keys are also used by CUA-mode (@pxref{Conflicts}).
2424 @end table
2426 @node Breaking down tasks, Checkboxes, Priorities, TODO items
2427 @section Breaking tasks down into subtasks
2428 @cindex tasks, breaking down
2430 It is often advisable to break down large tasks into smaller, managable
2431 subtasks.  You can do this by creating an outline tree below a TODO
2432 item, with detailed subtasks on the tree@footnote{To keep subtasks out
2433 of the global TODO list, see the
2434 @code{org-agenda-todo-list-sublevels}.}.  Another possibility is the use
2435 of checkboxes to identify (a hierarchy of) a large number of subtasks
2436 (@pxref{Checkboxes}).
2439 @node Checkboxes,  , Breaking down tasks, TODO items
2440 @section Checkboxes
2441 @cindex checkboxes
2443 Every item in a plain list (@pxref{Plain lists}) can be made a checkbox
2444 by starting it with the string @samp{[ ]}.  This feature is similar to
2445 TODO items (@pxref{TODO items}), but more lightweight.  Checkboxes are
2446 not included into the global TODO list, so they are often great to split
2447 a task into a number of simple steps.  Or you can use them in a shopping
2448 list.  To toggle a checkbox, use @kbd{C-c C-c}, or try Piotr Zielinski's
2449 @file{org-mouse.el}.  Here is an example of a checkbox list.
2451 @example
2452 * TODO Organize party [3/6]
2453   - call people [1/3]
2454     - [ ] Peter
2455     - [X] Sarah
2456     - [ ] Sam
2457   - [X] order food
2458   - [ ] think about what music to play
2459   - [X] talk to the neighbors
2460 @end example
2462 @cindex statistics, for checkboxes
2463 @cindex checkbox statistics
2464 The @samp{[3/6]} and @samp{[1/3]} in the first and second line are
2465 cookies indicating how many checkboxes are present in this entry, and
2466 how many of them have been checked off.  This can give you an idea on
2467 how many checkboxes remain, even without opening a folded entry.  The
2468 cookies can be placed into a headline or into (the first line of) a
2469 plain list item. Each cookie covers all checkboxes structurally below
2470 that headline/item.  You have to insert the cookie yourself by typing
2471 either @samp{[/]} or @samp{[%]}.  In the first case you get an @samp{n
2472 out of m} result, in the second case you get information about the
2473 percentage of checkboxes checked (in the above example, this would be
2474 @samp{[50%]} and @samp{[33%], respectively}).
2476 @noindent The following commands work with checkboxes:
2478 @table @kbd
2479 @kindex C-c C-c
2480 @item C-c C-c
2481 Toggle checkbox at point.
2482 @kindex C-c C-x C-b
2483 @item C-c C-x C-b
2484 Toggle checkbox at point.
2485 @itemize @minus
2486 @item
2487 If there is an active region, toggle the first checkbox in the region
2488 and set all remaining boxes to the same status as the first.  If you
2489 want to toggle all boxes in the region independently, use a prefix
2490 argument.
2491 @item
2492 If the cursor is in a headline, toggle checkboxes in the region between
2493 this headline and the next (so @emph{not} the entire subtree).
2494 @item
2495 If there is no active region, just toggle the checkbox at point.
2496 @end itemize
2497 @kindex M-S-@key{RET}
2498 @item M-S-@key{RET}
2499 Insert a new item with a checkbox.
2500 This works only if the cursor is already in a plain list item
2501 (@pxref{Plain lists}).
2502 @kindex C-c #
2503 @item C-c #
2504 Update the checkbox statistics in the current outline entry.  When
2505 called with a @kbd{C-u} prefix, update the entire file.  Checkbox
2506 statistic cookies are updated automatically if you toggle checkboxes
2507 with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}.  If you
2508 delete boxes or add/change them by hand, use this command to get things
2509 back into synch.  Or simply toggle any checkbox twice with @kbd{C-c C-c}.
2510 @end table
2512 @node Timestamps, Tags, TODO items, Top
2513 @chapter Timestamps
2514 @cindex time stamps
2515 @cindex date stamps
2517 Items can be labeled with timestamps to make them useful for project
2518 planning.
2520 @menu
2521 * Time stamps::                 Assigning a time to a tree entry
2522 * Creating timestamps::         Commands which insert timestamps
2523 * Custom time format::          If you cannot work with the ISO format
2524 * Progress logging::            Documenting when what work was done.
2525 @end menu
2528 @node Time stamps, Creating timestamps, Timestamps, Timestamps
2529 @section Time stamps, deadlines and scheduling
2530 @cindex time stamps
2531 @cindex ranges, time
2532 @cindex date stamps
2533 @cindex deadlines
2534 @cindex scheduling
2536 A time stamp is a specification of a date (possibly with time) in a
2537 special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16 Tue
2538 09:39>}@footnote{This is the standard ISO date/time format.  If you
2539 cannot get used to these, see @ref{Custom time format}}.  A time stamp
2540 can appear anywhere in the headline or body of an org-tree entry.  Its
2541 presence allows entries to be shown on specific dates in the agenda
2542 (@pxref{Weekly/Daily agenda}).  We distinguish:
2544 @table @var
2545 @item Plain time stamp
2546 @cindex timestamp
2547 A simple time stamp just assigns a date/time to an item.  This is just
2548 like writing down an appointment in a paper agenda, or like writing down
2549 an event in a diary, when you want to take note of when something
2550 happened.  In the timeline and agenda displays, the headline of an entry
2551 associated with a plain time stamp will be shown exactly on that date.
2553 @example
2554 * Meet Peter at the movies <2006-11-01 Wed 19:15>
2555 @end example
2557 @item Inactive time stamp
2558 @cindex timestamp, inactive
2559 @cindex inactive timestamp
2560 Just like a plain time stamp, but with square brackets instead of
2561 angular ones.  These time stamps are inactive in the sense that they do
2562 @emph{not} trigger an entry to show up in the agenda.
2564 @example
2565 * Gillian comes late for the fifth time [2006-11-01 Wed]
2566 @end example
2568 @item Time stamp range
2569 @cindex timerange
2570 Two time stamps connected by @samp{--} denote a time range.  The
2571 headline will be shown on the first and last day of the range, and on
2572 any dates that are displayed and fall in the range.  Here is an
2573 example:
2575 @example
2576 ** Meeting in Amsterdam
2577    <2004-08-23 Mon>--<2004-08-26 Thu>
2578 @end example
2580 @item Time stamp with SCHEDULED keyword
2581 @cindex SCHEDULED keyword
2582 If a time stamp is preceded by the word @samp{SCHEDULED:}, it means you
2583 are planning to start working on that task on the given date. So this is
2584 not about recording an event, but about planning your work.  The
2585 headline will be listed under the given date@footnote{It will still be
2586 listed on that date after it has been marked DONE.  If you don't like
2587 this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
2588 addition, a reminder that the scheduled date has passed will be present
2589 in the compilation for @emph{today}, until the entry is marked DONE.
2590 I.e., the task will automatically be forwarded until completed.
2592 @example
2593 *** TODO Call Trillian for a date on New Years Eve.
2594     SCHEDULED: <2004-12-25 Sat>
2595 @end example
2597 @item Time stamp with DEADLINE keyword
2598 @cindex DEADLINE keyword
2599 If a time stamp is preceded by the word @samp{DEADLINE:}, the task
2600 (most likely a TODO item) is supposed to be finished on that date, and
2601 it will be listed then.  In addition, the compilation for @emph{today}
2602 will carry a warning about the approaching or missed deadline,
2603 starting @code{org-deadline-warning-days} before the due date, and
2604 continuing until the entry is marked DONE.  An example:
2606 @example
2607 *** TODO write article about the Earth for the Guide
2608     The editor in charge is [[bbdb:Ford Prefect]]
2609     DEADLINE: <2004-02-29 Sun>
2610 @end example
2611 @item Time stamp with CLOSED keyword
2612 @cindex CLOSED keyword
2613 When @code{org-log-done} is non-nil, Org-mode will automatically insert
2614 a special time stamp each time a TODO entry is marked done
2615 (@pxref{Progress logging}).  This time stamp is enclosed in square
2616 brackets instead of angular brackets.
2618 @item Time range with CLOCK keyword
2619 @cindex CLOCK keyword
2620 When using the clock to time the work that is being done on specific
2621 items, time ranges preceded by the CLOCK keyword are inserted
2622 automatically into the file.  The time stamps are enclosed in square
2623 brackets instead of angular brackets.  @xref{Clocking work time}.
2624 @end table
2626 @node Creating timestamps, Custom time format, Time stamps, Timestamps
2627 @section Creating timestamps
2628 @cindex creating timestamps
2629 @cindex timestamps, creating
2631 For Org-mode to recognize time stamps, they need to be in the specific
2632 format.  All commands listed below produce time stamps in the correct
2633 format.
2635 @table @kbd
2636 @kindex C-c .
2637 @item C-c .
2638 Prompt for a date and insert a corresponding time stamp.  When the
2639 cursor is at a previously used time stamp, it is updated to NOW.  When
2640 this command is used twice in succession, a time range is inserted.
2642 @kindex C-u C-c .
2643 @item C-u C-c .
2644 Like @kbd{C-c .}, but use the alternative format which contains date
2645 and time.  The default time can be rounded to multiples of 5 minutes,
2646 see the option @code{org-time-stamp-rounding-minutes}.
2648 @kindex C-c !
2649 @item C-c !
2650 Like @kbd{C-c .}, but insert an inactive time stamp not triggering the
2651 agenda.
2653 @kindex C-c <
2654 @item C-c <
2655 Insert a time stamp corresponding to the cursor date in the Calendar.
2657 @kindex C-c >
2658 @item C-c >
2659 Access the Emacs calendar for the current date.  If there is a
2660 timestamp in the current line, goto the corresponding date
2661 instead.
2663 @kindex C-c C-o
2664 @item C-c C-o
2665 Access the agenda for the date given by the time stamp or -range at
2666 point (@pxref{Weekly/Daily agenda}).
2668 @kindex C-c C-d
2669 @item C-c C-d
2670 Insert @samp{DEADLINE} keyword along with a stamp.  The insertion will
2671 happen in the line directly following the headline.  
2672 @c FIXME Any CLOSED timestamp will be removed.????????
2674 @kindex C-c C-w
2675 @cindex sparse tree, for deadlines
2676 @item C-c C-w
2677 Create a sparse tree with all deadlines that are either past-due, or
2678 which will become due within @code{org-deadline-warning-days}.
2679 With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
2680 prefix, check that many days.  For example, @kbd{C-1 C-c C-w} shows
2681 all deadlines due tomorrow.
2683 @kindex C-c C-s
2684 @item C-c C-s
2685 Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
2686 happen in the line directly following the headline.  Any CLOSED
2687 timestamp will be removed.
2689 @kindex S-@key{left}
2690 @kindex S-@key{right}
2691 @item S-@key{left}
2692 @itemx S-@key{right}
2693 Change date at cursor by one day.  These key bindings conflict with
2694 CUA-mode (@pxref{Conflicts}).
2696 @kindex S-@key{up}
2697 @kindex S-@key{down}
2698 @item S-@key{up}
2699 @itemx S-@key{down}
2700 Change the item under the cursor in a timestamp.  The cursor can be on a
2701 year, month, day, hour or minute.  Note that if the cursor is in a
2702 headline and not at a time stamp, these same keys modify the priority of
2703 an item.  (@pxref{Priorities}). The key bindings also conflict with
2704 CUA-mode (@pxref{Conflicts}).
2707 @kindex C-c C-y
2708 @cindex evaluate time range
2709 @item C-c C-y
2710 Evaluate a time range by computing the difference between start and
2711 end.  With prefix arg, insert result after the time range (in a table:
2712 into the following column).
2713 @end table
2716 @menu
2717 * The date/time prompt::        How org-mode helps you entering date and time
2718 @end menu
2720 @node The date/time prompt,  , Creating timestamps, Creating timestamps
2721 @subsection The date/time prompt
2722 @cindex date, reading in minibuffer
2723 @cindex time, reading in minibuffer
2725 When Org-mode prompts for a date/time, the prompt suggests to enter an
2726 ISO date.  But it will in fact accept any string containing some date
2727 and/or time information.  You can, for example, use @kbd{C-y} to paste a
2728 (possibly multi-line) string copied from an email message.  Org-mode
2729 will find whatever information is in there and will replace anything not
2730 specified with the current date and time.  For example:
2732 @example
2733   3-2-5         --> 2003-02-05
2734   feb 15        --> currentyear-02-15
2735   sep 12 9      --> 2009-09-12
2736   12:45         --> today 12:45
2737   22 sept 0:34  --> currentyear-09-22 0:34
2738   12            --> currentyear-currentmonth-12
2739   Fri           --> nearest Friday (today or later)
2740   +4            --> 4 days from now (if +N is the only thing given)
2741 @end example
2743 The function understands English month and weekday abbreviations.  If
2744 you want to use unabbreviated names and/or other languages, configure
2745 the variables @code{parse-time-months} and @code{parse-time-weekdays}.
2747 @cindex calendar, for selecting date
2748 Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
2749 you don't need/want the calendar, configure the variable
2750 @code{org-popup-calendar-for-date-prompt}.}.  You can control the
2751 calendar fully from the minibuffer:
2753 @table @kbd
2754 @kindex <
2755 @item <
2756 Scroll calendar backwards by one month.
2757 @kindex >
2758 @item >
2759 Scroll calendar forwards by one month.
2760 @kindex mouse-1
2761 @item mouse-1
2762 Select date by clicking on it.
2763 @kindex S-@key{right}
2764 @item S-@key{right}
2765 One day forward.
2766 @kindex S-@key{left}
2767 @item S-@key{left}
2768 One day back.
2769 @kindex S-@key{down}
2770 @item S-@key{down}
2771 One week forward.
2772 @kindex S-@key{up}
2773 @item S-@key{up}
2774 One week back.
2775 @kindex M-S-@key{right}
2776 @item M-S-@key{right}
2777 One month forward.
2778 @kindex M-S-@key{left}
2779 @item M-S-@key{left}
2780 One month back.
2781 @kindex @key{RET}
2782 @item @key{RET}
2783 Choose date in calendar (only if nothing was typed into minibuffer).
2784 @end table
2786 @node Custom time format, Progress logging, Creating timestamps, Timestamps
2787 @section Custom time format
2788 @cindex custom date/time format
2789 @cindex time format, custom
2790 @cindex date format, custom
2792 Org-mode uses the standard ISO notation for dates and times as it is
2793 defined in ISO 8601.  If you cannot get used to this and require another
2794 representation of date and time to keep you happy, you can get it by
2795 customizing the variables @code{org-display-custom-times} and
2796 @code{org-time-stamp-custom-formats}.
2798 @table @kbd
2799 @kindex C-c C-x C-t
2800 @item C-c C-x C-t
2801 Toggle the display of custom formats for dates and times.
2802 @end table
2804 @noindent
2805 Org-mode needs the default format for scanning, so the custom date/time
2806 format does not @emph{replace} the default format - instead it is put
2807 @emph{over} the default format using text properties.  This has the
2808 following consequences:
2809 @itemize @bullet
2810 @item 
2811 You cannot place the cursor onto a time stamp anymore, only before or
2812 after.
2813 @item
2814 The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
2815 each component of a time stamp.  If the cursor is at the beginning of
2816 the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
2817 just like @kbd{S-@key{left}/@key{right}}.  At the end of the stamp, the
2818 time will be changed by one minute.
2819 @item
2820 When you delete a time stamp character-by-character, it will only
2821 disappear from the buffer after @emph{all} (invisible) characters
2822 belonging to the ISO timestamp have been removed.
2823 @item
2824 If the custom time stamp format is longer than the default and you are
2825 using dates in tables, table alignment will be messed up.  If the custom
2826 format is shorter, things do work as expected.
2827 @end itemize
2829 @node Progress logging,  , Custom time format, Timestamps
2830 @section Progress Logging
2831 @cindex progress logging
2832 @cindex logging, of progress
2834 Org-mode can automatically record a time stamp when you mark a TODO item
2835 as DONE.  You can also measure precisely the time you spent on specific
2836 items in a project by starting and stopping a clock when you start and
2837 stop working on an aspect of a project.
2839 @menu
2840 * Closing items::               When was this entry marked DONE?
2841 * Clocking work time::          When exactly did you work on this item?
2842 @end menu
2844 @node Closing items, Clocking work time, Progress logging, Progress logging
2845 @subsection Closing items
2847 If you want to keep track of @emph{when} a certain TODO item was
2848 finished, turn on logging with
2850 @lisp
2851 (setq org-log-done t)
2852 @end lisp
2854 @noindent
2855 Then each time you turn a TODO entry into DONE using either @kbd{C-c
2856 C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line
2857 @samp{CLOSED: [timestamp]} will be inserted just after the headline.
2858 If you turn the entry back into a TODO item again through further
2859 state cycling, that line will be removed again.  In the timeline
2860 (@pxref{Timeline}) and in the agenda (@pxref{Weekly/Daily agenda}),
2861 you can then use the @kbd{l} key to display the TODO items closed on
2862 each day, giving you an overview of what has been done on a day.
2863 See the variable @code{org-log-done} for the possibility to record an
2864 additional note together with a timestamp.
2866 @node Clocking work time,  , Closing items, Progress logging
2867 @subsection Clocking work time
2869 Org-mode allows you to clock the time you spent on specific tasks in a
2870 project.  When you start working on an item, you can start the clock.
2871 When you stop working on that task, or when you mark the task done, the
2872 clock is stopped and the corresponding time interval is recorded.  It
2873 also computes the total time spent on each subtree of a project.
2875 @table @kbd
2876 @kindex C-c C-x C-i
2877 @item C-c C-x C-i
2878 Start the clock on the current item (clock-in).  This inserts the CLOCK
2879 keyword together with a timestamp.
2880 @kindex C-c C-x C-o
2881 @item C-c C-x C-o
2882 Stop the clock (clock-out).  The inserts another timestamp at the same
2883 location where the clock was last started.  It also directly computes
2884 the resulting time in inserts it after the time range as @samp{=>
2885 HH:MM}.  See the variable @code{org-log-done} for the possibility to
2886 record an additional note together with the clock-out time stamp.
2887 @kindex C-c C-y
2888 @item C-c C-y
2889 Recompute the time interval after changing one of the time stamps.  This
2890 is only necessary if you edit the time stamps directly.  If you change
2891 them with @kbd{S-@key{cursor}} keys, the update is automatic.
2892 @kindex C-c C-t
2893 @item C-c C-t
2894 Changing the TODO state of an item to DONE automatically stops the clock
2895 if it is running in this same item.
2896 @kindex C-c C-x C-x
2897 @item C-c C-x C-x
2898 Cancel the current clock.  This is useful if a clock was started by
2899 mistake, or if you ended up working on something else.
2900 @kindex C-c C-x C-d
2901 @item C-c C-x C-d
2902 Display time summaries for each subtree in the current buffer.  This
2903 puts overlays at the end of each headline, showing the total time
2904 recorded under that heading, including the time of any subheadings. You
2905 can use visibility cycling to study the tree, but the overlays disappear
2906 when you change the buffer (see variable
2907 @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
2908 @kindex C-c C-x C-r
2909 @item C-c C-x C-r
2910 Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
2911 report as an org-mode table into the current file.
2912 @example
2913 #+BEGIN: clocktable :maxlevel 2 :emphasize nil
2915 #+END: clocktable
2916 @end example
2917 @noindent
2918 If such a block already exists, its content is replaced by the new
2919 table.  The @samp{BEGIN} line can specify options:
2920 @example
2921 :maxlevels   @r{Maximum level depth to which times are listed in the table.}
2922 :emphasize   @r{When @code{t}, emphasize level one and level two items}
2923 :block       @r{The time block to consider.  This block is specified relative}
2924              @r{to the current time and may be any of these keywords:}
2925              @r{@code{today}, @code{yesterday}, @code{thisweek}, @code{lastweek},}
2926              @r{@code{thismonth}, @code{lastmonth}, @code{thisyear}, or @code{lastyear}}.
2927 :tstart      @r{A time string specifying when to start considering times}
2928 :tend        @r{A time string specifying when to stop considering times}
2929 @end example
2930 So to get a clock summary for the current day, you could write
2931 @example
2932 #+BEGIN: clocktable :maxlevel 2 :block today
2934 #+END: clocktable
2935 @end example
2936 and to use a specific time range you could write@footnote{Note that all
2937 parameters must be specified in a single line - the line is broken here
2938 only to fit it onto the manual.}
2939 @example
2940 #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>" 
2941                     :tend "<2006-08-10 Thu 12:00>"
2943 #+END: clocktable
2944 @end example
2945 @kindex C-u C-c C-x C-u
2946 @item C-u C-c C-x C-u
2947 Update all dynamic blocks (@pxref{Dynamic blocks}).  This is useful if
2948 you have several clocktable blocks in a buffer.
2949 @end table
2951 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
2952 the agenda (@pxref{Weekly/Daily agenda}) to show which tasks have been
2953 worked on or closed during a day.
2955 @node Tags, Agenda views, Timestamps, Top
2956 @chapter Tags
2957 @cindex tags
2958 @cindex headline tagging
2959 @cindex matching, tags
2960 @cindex sparse tree, tag based
2962 If you wish to implement a system of labels and contexts for
2963 cross-correlating information, an excellent way is to assign @i{tags} to
2964 headlines.  Org-mode has extensive support for using tags.
2966 Every headline can contain a list of tags, at the end of the headline.
2967 Tags are normal words containing letters, numbers, @samp{_}, and
2968 @samp{@@}.  Tags must be preceded and followed by a single colon; like
2969 @samp{:WORK:}.  Several tags can be specified like @samp{:WORK:URGENT:}.
2971 @menu
2972 * Tag inheritance::             Tags use the tree structure of the outline
2973 * Setting tags::                How to assign tags to a headline
2974 * Tag searches::                Searching for combinations of tags
2975 @end menu
2977 @node Tag inheritance, Setting tags, Tags, Tags
2978 @section Tag inheritance
2979 @cindex inheritance, of tags
2980 @cindex sublevels, inclusion into tags match
2982 @i{Tags} make use of the hierarchical structure of outline trees.  If a
2983 heading has a certain tag, all subheadings will inherit the tag as
2984 well.  For example, in the list
2986 @example
2987 * Meeting with the French group      :WORK:
2988 ** Summary by Frank                  :BOSS:NOTES:
2989 *** TODO Prepare slides for him      :ACTION:
2990 @end example
2992 @noindent
2993 the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
2994 @samp{:NOTES:}, and @samp{:ACTION:}.  When executing tag searches and
2995 Org-mode finds that a certain headline matches the search criterion, it
2996 will not check any sublevel headline, assuming that these likely also
2997 match, and that the list of matches can become very long.  This may
2998 not be what you want, however, and you can influence inheritance and
2999 searching using the variables @code{org-use-tag-inheritance} and
3000 @code{org-tags-match-list-sublevels}.
3002 @node Setting tags, Tag searches, Tag inheritance, Tags
3003 @section Setting tags
3004 @cindex setting tags
3005 @cindex tags, setting
3007 @kindex M-@key{TAB}
3008 Tags can simply be typed into the buffer at the end of a headline.
3009 After a colon, @kbd{M-@key{TAB}} offers completion on tags.  There is
3010 also a special command for inserting tags:
3012 @table @kbd
3013 @kindex C-c C-c
3014 @item C-c C-c
3015 @cindex completion, of tags
3016 Enter new tags for the current headline.  Org-mode will either offer
3017 completion or a special single-key interface for setting tags, see
3018 below.  After pressing @key{RET}, the tags will be inserted and aligned
3019 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
3020 tags in the current buffer will be aligned to that column, just to make
3021 things look nice.  TAGS are automatically realigned after promotion,
3022 demotion, and TODO state changes (@pxref{TODO basics}).
3023 @end table
3025 Org will support tag insertion based on a @emph{list of tags}.  By
3026 default this list is constructed dynamically, containing all tags
3027 currently used in the buffer.  You may also globally specify a hard list
3028 of tags with the variable @code{org-tag-alist}.  Finally you can set
3029 the default tags for a given file with lines like
3031 @example
3032 #+TAGS: @@WORK @@HOME @@TENNISCLUB
3033 #+TAGS: Laptop Car PC Sailboat
3034 @end example
3036 If you have globally defined your preferred set of tags using the
3037 variable @code{org-tag-alist}, but would like to use a dynamic tag list
3038 in a specific file: Just add an empty TAGS option line to that file:
3040 @example
3041 #+TAGS:
3042 @end example
3044 The default support method for entering tags is minibuffer completion.
3045 However, Org-mode also implements a much better method: @emph{fast tag
3046 selection}.  This method allows to select and deselect tags with a
3047 single key per tag.  To function efficiently, you should assign unique
3048 keys to most tags.  This can be done globally with
3050 @lisp
3051 (setq org-tag-alist '(("@@WORK" . ?w) ("@@HOME" . ?h) ("Laptop" . ?l)))
3052 @end lisp
3054 @noindent or on a per-file basis with
3056 @example
3057 #+TAGS: @@WORK(w)  @@HOME(h)  @@TENNISCLUB(t)  Laptop(l)  PC(p)
3058 @end example
3060 @noindent
3061 You can also group together tags that are mutually exclusive.  With
3062 curly braces@footnote{In @code{org-mode-alist} use
3063 @code{'(:startgroup)} and @code{'(:endgroup)}, respectively.  Several
3064 groups are allowed.}
3066 @example
3067 #+TAGS: @{ @@WORK(w)  @@HOME(h)  @@TENNISCLUB(t) @}  Laptop(l)  PC(p)
3068 @end example
3070 @noindent you indicate that at most one of @samp{@@WORK}, @samp{@@HOME},
3071 and @samp{@@TENNISCLUB} should be selected.
3073 @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
3074 these lines to activate any changes.
3076 If at least one tag has a selection key, pressing @kbd{C-c C-c} will
3077 automatically present you with a special interface, listing inherited
3078 tags, the tags of the current headline, and a list of all legal tags
3079 with corresponding keys@footnote{Keys will automatically be assigned to
3080 tags which have no configured keys.}.  In this interface, you can use
3081 the following keys:
3083 @table @kbd
3084 @item a-z...
3085 Pressing keys assigned to tags will add or remove them from the list of
3086 tags in the current line.  Selecting a tag in a group of mutually
3087 exclusive tags will turn off any other tags from that group.
3088 @kindex @key{TAB}
3089 @item @key{TAB}
3090 Enter a tag in the minibuffer, even if the tag is not in the predefined
3091 list.  You will be able to complete on all tags present in the buffer.
3092 @kindex @key{SPC}
3093 @item @key{SPC}
3094 Clear all tags for this line.
3095 @kindex @key{RET}
3096 @item @key{RET}
3097 Accept the modified set.
3098 @item C-g
3099 Abort without installing changes.
3100 @item q
3101 If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
3102 @item !
3103 Turn off groups of mutually exclusive tags.  Use this to (as an
3104 exception) assign several tags from such a group.
3105 @item C-c
3106 Toggle auto-exit after the next change (see below).
3107 @end table
3109 @noindent
3110 This method lets you assign tags to a headline with very few keys.  With
3111 the above setup, you could clear the current tags and set @samp{@@HOME},
3112 @samp{Laptop} and @samp{PC} tags with just the following keys: @kbd{C-c
3113 C-c @key{SPC} h l p @key{RET}}.  Switching from @samp{@@HOME} to
3114 @samp{@@WORK} would be done with @kbd{C-c C-c w @key{RET}} or
3115 alternatively with @kbd{C-c C-c C-c w}.  Adding the non-predefined tag
3116 @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
3117 @key{RET} @key{RET}}.
3119 If you find that most of the time, you need only a single keypress to
3120 modify your list of tags, set the variable
3121 @code{org-fast-tag-selection-single-key}.  Then you no longer have to
3122 press @key{RET} to exit fast tag selection - it will immediately exit
3123 after the first change.  If you then occasionally need more keys, press
3124 @kbd{C-c} to turn off auto-exit for the current tag selection process.
3126 @node Tag searches,  , Setting tags, Tags
3127 @section Tag searches
3128 @cindex tag searches
3129 @cindex searching for tags
3131 Once a tags system has been set up, it can be used to collect related
3132 information into special lists.
3134 @table @kbd
3135 @kindex C-c \
3136 @item C-c \
3137 Create a sparse tree with all headlines matching a tags search.  With a
3138 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
3139 @kindex C-c a m
3140 @item C-c a m
3141 Create a global list of tag matches from all agenda files.
3142 @xref{Matching headline tags}.
3143 @kindex C-c a M
3144 @item C-c a M
3145 Create a global list of tag matches from all agenda files, but check
3146 only TODO items and force checking subitems (see variable
3147 @code{org-tags-match-list-sublevels}).
3148 @end table
3150 @cindex Boolean logic, for tag searches
3151 A @i{tags} search string can use Boolean operators @samp{&} for AND and
3152 @samp{|} for OR.  @samp{&} binds more strongly than @samp{|}.
3153 Parenthesis are currently not implemented.  A tag may also be preceded
3154 by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
3155 positive selection.  The AND operator @samp{&} is optional when @samp{+}
3156 or @samp{-} is present.  Examples:
3158 @table @samp
3159 @item +WORK-BOSS
3160 Select headlines tagged @samp{:WORK:}, but discard those also tagged
3161 @samp{:BOSS:}.
3162 @item WORK|LAPTOP
3163 Selects lines tagged @samp{:WORK:} or @samp{:LAPTOP:}.
3164 @item WORK|LAPTOP&NIGHT
3165 Like before, but require the @samp{:LAPTOP:} lines to be tagged also
3166 @samp{NIGHT}.
3167 @end table
3169 @cindex TODO keyword matching, with tags search
3170 If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
3171 can be useful to also match on the TODO keyword.  This can be done by
3172 adding a condition after a slash to a tags match.  The syntax is similar
3173 to the tag matches, but should be applied with consideration: For
3174 example, a positive selection on several TODO keywords can not
3175 meaningfully be combined with boolean AND.  However, @emph{negative
3176 selection} combined with AND can be meaningful.  To make sure that only
3177 lines are checked that actually have any TODO keyword, use @kbd{C-c a
3178 M}, or equivalently start the todo part after the slash with @samp{!}.
3179 Examples:
3181 @table @samp
3182 @item WORK/WAITING
3183 Select @samp{:WORK:}-tagged TODO lines with the specific TODO
3184 keyword @samp{WAITING}.
3185 @item WORK/!-WAITING-NEXT
3186 Select @samp{:WORK:}-tagged TODO lines that are neither @samp{WAITING}
3187 nor @samp{NEXT}
3188 @item WORK/+WAITING|+NEXT
3189 Select @samp{:WORK:}-tagged TODO lines that are either @samp{WAITING} or
3190 @samp{NEXT}.
3191 @end table
3193 @cindex regular expressions, with tags search
3194 Any element of the tag/todo match can be a regular expression - in this
3195 case it must be enclosed in curly braces.  For example,
3196 @samp{WORK+@{^BOSS.*@}} matches headlines that contain the tag
3197 @samp{WORK} and any tag @i{starting} with @samp{BOSS}.
3199 @cindex level, require for tags match
3200 You can also require a headline to be of a certain level, by writing
3201 instead of any TAG an expression like @samp{LEVEL=3}.  For example, a
3202 search @samp{+LEVEL=3+BOSS/-DONE} lists all level three headlines that
3203 have the tag BOSS and are @emph{not} marked witht the todo keyword DONE.
3205 @node Agenda views, Embedded LaTeX, Tags, Top
3206 @chapter Agenda Views
3207 @cindex agenda views
3209 Due to the way Org-mode works, TODO items, time-stamped items, and
3210 tagged headlines can be scattered throughout a file or even a number of
3211 files.  To get an overview over open action items, or over events that
3212 are important for a particular date, this information must be collected,
3213 sorted and displayed in an organized way.
3215 Org-mode can select items based on various criteria, and display them
3216 in a separate buffer.  Six different view types are provided:
3218 @itemize @bullet
3219 @item
3220 an @emph{agenda} that is like a calendar and shows information
3221 for specific dates,
3222 @item
3223 a @emph{TODO list} that covers all unfinished
3224 action items,
3225 @item
3226 a @emph{tags view}, showings headlines based on
3227 the tags associated them,
3228 @item
3229 a @emph{timeline view} that shows all events in a single Org-mode file,
3230 in time-sorted view,
3231 @item
3232 a @emph{stuck projects view} showing projects that currently don't move
3233 along, and
3234 @item
3235 @emph{custom views} that are special tag/keyword searches and
3236 combinations of different views.
3237 @end itemize
3239 @noindent
3240 The extracted information is displayed in a special @emph{agenda
3241 buffer}.  This buffer is read-only, but provides commands to visit the
3242 corresponding locations in the original Org-mode files, and even to
3243 edit these files remotely.  
3245 Two variables control how the agenda buffer is displayed and whether the
3246 window configuration is restored when the agenda exits:
3247 @code{org-agenda-window-setup} and
3248 @code{org-agenda-restore-windows-after-quit}.
3250 @menu
3251 * Agenda files::                Files being searched for agenda information
3252 * Agenda dispatcher::           Keyboard access to agenda views
3253 * Built-in agenda views::       What is available out of the box?
3254 * Presentation and sorting::    How agenda items are prepared for display
3255 * Agenda commands::             Remote editing of org trees
3256 * Custom agenda views::         Defining special searches and views
3257 @end menu
3259 @node Agenda files, Agenda dispatcher, Agenda views, Agenda views
3260 @section Agenda files
3261 @cindex agenda files
3262 @cindex files for agenda
3264 The information to be shown is collected from all @emph{agenda files},
3265 the files listed in the variable @code{org-agenda-files}@footnote{If the
3266 value of that variable is not a list, but a single file name, then the
3267 list of agenda files will be maintained in that external file.}.  Thus even
3268 if you only work with a single Org-mode file, this file should be put
3269 into that list@footnote{When using the dispatcher, pressing @kbd{1}
3270 before selecting a command will actually limit the command to the
3271 current file, and ignore @code{org-agenda-files} until the next
3272 dispatcher command.}.  You can customize @code{org-agenda-files}, but
3273 the easiest way to maintain it is through the following commands
3275 @cindex files, adding to agenda list
3276 @table @kbd
3277 @kindex C-c [
3278 @item C-c [
3279 Add current file to the list of agenda files.  The file is added to
3280 the front of the list.  If it was already in the list, it is moved to
3281 the front.  With prefix arg, file is added/moved to the end.
3282 @kindex C-c ]
3283 @item C-c ]
3284 Remove current file from the list of agenda files.
3285 @kindex C-,
3286 @item C-,
3287 Cycle through agenda file list, visiting one file after the other.
3288 @end table
3290 @noindent
3291 The Org menu contains the current list of files and can be used
3292 to visit any of them.
3294 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda views
3295 @section The agenda dispatcher
3296 @cindex agenda dispatcher
3297 @cindex dispatching agenda commands
3298 The views are created through a dispatcher that should be bound to a
3299 global key, for example @kbd{C-c a} (@pxref{Installation}).  In the
3300 following we will assume that @kbd{C-c a} is indeed how the dispatcher
3301 is accessed and list keyboard access to commands accordingly.  After
3302 pressing @kbd{C-c a}, an additional letter is required to execute a
3303 command.  The dispatcher offers the following default commands:
3304 @table @kbd
3305 @item a
3306 Create the calendar-like agenda (@pxref{Weekly/Daily agenda}).
3307 @item t @r{/} T
3308 Create a list of all TODO items (@pxref{Global TODO list}).
3309 @item m @r{/} M
3310 Create a list of headlines matching a TAGS expression (@pxref{Matching
3311 headline tags}).
3312 @item L
3313 Create the timeline view for the current buffer (@pxref{Timeline}).
3314 @item # @r{/} !
3315 Create a list of stuck projects (@pxref{Stuck projects}).
3316 @item 1
3317 Restrict an agenda command to the current buffer.  After pressing
3318 @kbd{1}, you still need to press the character selecting the command.
3319 @item 0
3320 If there is an active region, restrict the following agenda command to
3321 the region.  Otherwise, restrict it to the current subtree.  After
3322 pressing @kbd{0}, you still need to press the character selecting the
3323 command.
3324 @end table
3326 You can also define custom commands that will be accessible through the
3327 dispatcher, just like the default commands.  This includes the
3328 possibility to create extended agenda buffers that contain several
3329 blocks together, for example the weekly agenda, the global TODO list and
3330 a number of special tags matches.  @xref{Custom agenda views}.
3332 @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda views
3333 @section The built-in agenda views
3335 In this section we describe the built-in views.
3337 @menu
3338 * Weekly/Daily agenda::         The calendar page with current tasks
3339 * Global TODO list::            All unfinished action items
3340 * Matching headline tags::      Structured information with fine-tuned search
3341 * Timeline::                    Time-sorted view for single file
3342 * Stuck projects::              Find projects you need to review
3343 @end menu
3345 @node Weekly/Daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
3346 @subsection The weekly/daily agenda
3347 @cindex agenda
3348 @cindex weekly agenda
3349 @cindex daily agenda
3351 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
3352 paper agenda, showing all the tasks for the current week or day.
3354 @table @kbd
3355 @cindex org-agenda, command
3356 @kindex C-c a a
3357 @item C-c a a
3358 Compile an agenda for the current week from a list of org files.  The
3359 agenda shows the entries for each day.  With a @kbd{C-u} prefix (or
3360 when the variable @code{org-agenda-include-all-todo} is @code{t}), all
3361 unfinished TODO items (including those without a date) are also listed at
3362 the beginning of the buffer, before the first date.@*
3363 @end table
3365 Remote editing from the agenda buffer means, for example, that you can
3366 change the dates of deadlines and appointments from the agenda buffer.
3367 The commands available in the Agenda buffer are listed in @ref{Agenda
3368 commands}.
3370 @subsubheading Calendar/Diary integration
3371 @cindex calendar integration
3372 @cindex diary integration
3374 Emacs contains the calendar and diary by Edward M. Reingold.  The
3375 calendar displays a three-month calendar with holidays from different
3376 countries and cultures.  The diary allows you to keep track of
3377 anniversaries, lunar phases, sunrise/set, recurrent appointments
3378 (weekly, monthly) and more.  In this way, it is quite complementary to
3379 Org-mode.  It can be very useful to combine output from Org-mode with
3380 the diary.
3382 In order to include entries from the Emacs diary into Org-mode's
3383 agenda, you only need to customize the variable
3385 @lisp
3386 (setq org-agenda-include-diary t)
3387 @end lisp
3389 @noindent After that, everything will happen automatically.  All diary
3390 entries including holidays, anniversaries etc will be included in the
3391 agenda buffer created by Org-mode.  @key{SPC}, @key{TAB}, and
3392 @key{RET} can be used from the agenda buffer to jump to the diary
3393 file in order to edit existing diary entries.  The @kbd{i} command to
3394 insert new entries for the current date works in the agenda buffer, as
3395 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
3396 Sunrise/Sunset times, show lunar phases and to convert to other
3397 calendars, respectively.  @kbd{c} can be used to switch back and forth
3398 between calendar and agenda.
3401 @node Global TODO list, Matching headline tags, Weekly/Daily agenda, Built-in agenda views
3402 @subsection The global TODO list
3403 @cindex global TODO list
3404 @cindex TODO list, global
3406 The global TODO list contains all unfinished TODO items, formatted and
3407 collected into a single place.
3409 @table @kbd
3410 @kindex C-c a t
3411 @item C-c a t
3412 Show the global TODO list.  This collects the TODO items from all
3413 agenda files (@pxref{Agenda views}) into a single buffer.  The buffer is in
3414 @code{agenda-mode}, so there are commands to examine and manipulate
3415 the TODO entries directly from that buffer (@pxref{Agenda commands}).
3416 @kindex C-c a T
3417 @item C-c a T
3418 @cindex TODO keyword matching
3419 Like the above, but allows selection of a specific TODO keyword.  You can
3420 also do this by specifying a prefix argument to @kbd{C-c a t}.  With a
3421 @kbd{C-u} prefix you are prompted for a keyword.  With a numeric
3422 prefix, the Nth keyword in @code{org-todo-keywords} is selected.
3423 @kindex r
3424 The @kbd{r} key in the agenda buffer regenerates it, and you can give
3425 a prefix argument to this command to change the selected TODO keyword,
3426 for example @kbd{3 r}.  If you often need a search for a specific
3427 keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
3428 Matching specific TODO keywords can also be done as part of a tags
3429 search (@pxref{Tag searches}).
3430 @end table
3432 Remote editing of TODO items means that you can change the state of a
3433 TODO entry with a single key press.  The commands available in the
3434 TODO list are described in @ref{Agenda commands}.
3436 @cindex sublevels, inclusion into todo list
3437 Normally the global todo list simply shows all headlines with TODO
3438 keywords.  This list can become very long.  There are two ways to keep
3439 it more compact:
3440 @itemize @minus
3441 @item
3442 Some people view a TODO item that has been @emph{scheduled} for
3443 execution (@pxref{Time stamps}) as no longer @emph{open}.  Configure the
3444 variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
3445 items from the global TODO list.
3446 @item
3447 TODO items may have sublevels to break up the task into subtasks.  In
3448 such cases it may be enough to list only the highest level TODO headline
3449 and omit the sublevels from the global list.  Configure the variable
3450 @code{org-agenda-todo-list-sublevels} to get this behavior.
3451 @end itemize
3453 @node Matching headline tags, Timeline, Global TODO list, Built-in agenda views
3454 @subsection Matching headline tags
3455 @cindex matching, of tags
3456 @cindex tags view
3458 If headlines in the agenda files are marked with @emph{tags}
3459 (@pxref{Tags}), you can select headlines based on the tags that apply
3460 to them and collect them into an agenda buffer.
3462 @table @kbd
3463 @kindex C-c a m
3464 @item C-c a m
3465 Produce a list of all headlines that match a given set of tags.  The
3466 command prompts for a selection criterion, which is a boolean logic
3467 expression with tags, like @samp{+WORK+URGENT-WITHBOSS} or
3468 @samp{WORK|HOME} (@pxref{Tags}).  If you often need a specific search,
3469 define a custom command for it (@pxref{Agenda dispatcher}).
3470 @kindex C-c a M
3471 @item C-c a M
3472 Like @kbd{C-c a m}, but only select headlines that are also TODO items
3473 and force checking subitems (see variable
3474 @code{org-tags-match-list-sublevels}).  Matching specific todo keywords
3475 together with a tags match is also possible, see @ref{Tag searches}.
3476 @end table
3478 The commands available in the tags list are described in @ref{Agenda
3479 commands}.
3481 @node Timeline, Stuck projects, Matching headline tags, Built-in agenda views
3482 @subsection Timeline for a single file
3483 @cindex timeline, single file
3484 @cindex time-sorted view
3486 The timeline summarizes all time-stamped items from a single Org-mode
3487 file in a @emph{time-sorted view}.  The main purpose of this command is
3488 to give an overview over events in a project.
3490 @table @kbd
3491 @kindex C-a a L
3492 @item C-c a L
3493 Show a time-sorted view of the org file, with all time-stamped items.
3494 When called with a @kbd{C-u} prefix, all unfinished TODO entries
3495 (scheduled or not) are also listed under the current date.
3496 @end table
3498 @noindent
3499 The commands available in the timeline buffer are listed in
3500 @ref{Agenda commands}.
3503 @node Stuck projects,  , Timeline, Built-in agenda views
3504 @subsection Stuck projects
3506 If you are following a system like David Allen's GTD to organize your
3507 work, one of the ``duties'' you have is a regular review to make sure
3508 that all projects move along.  A @emph{stuck} project is a project that
3509 has no defined next actions, so it will never show up in the TODO lists
3510 Org-mode produces.  During the review, you need to identify such
3511 projects and define next actions for them.
3513 @table @kbd
3514 @kindex C-c a #
3515 @item C-c a #
3516 List projects that are stuck.
3517 @kindex C-c a !
3518 @item C-c a !
3519 Customize the variable @code{org-stuck-projects} to define what a stuck
3520 project is and how to find it.
3521 @end table
3523 You almost certainly will have to configure this view before it will
3524 work for you.  The built-in default assumes that all your projects are
3525 level-2 headlines, and that a project is not stuck if it has at least
3526 one entry marked with a todo keyword TODO or NEXT or NEXTACTION.
3528 Lets assume that you, in your own way of using Org-mode, identify
3529 projects with a tag PROJECT, and that you use a todo keyword MAYBE to
3530 indicate a project that should not be considered yet.  Lets further
3531 assume that the todo keyword DONE marks finished projects, and that NEXT
3532 and TODO indicate next actions.  Finally, the tag @@SHOP indicates
3533 shopping and is a next action even without the NEXT tag.  In this case
3534 you would start by identifying elegible projects with a tags/todo match
3535 @samp{+PROJECT/-MAYBE-DONE}, and then check for TODO, NEXT and @@SHOP in
3536 the subtree to identify projects that are not stuck.  The correct
3537 customization for this is
3539 @lisp
3540 (setq org-stuck-projects
3541       ("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")))
3542 @end lisp
3545 @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda views
3546 @section Presentation and sorting
3547 @cindex presentation, of agenda items
3549 Before displaying items in an agenda view, Org-mode visually prepares
3550 the items and sorts them.  Each item occupies a single line.  The line
3551 starts with a @emph{prefix} that contains the @emph{category}
3552 (@pxref{Categories}) of the item and other important information.  You can
3553 customize the prefix using the option @code{org-agenda-prefix-format}.
3554 The prefix is followed by a cleaned-up version of the outline headline
3555 associated with the item.
3557 @menu
3558 * Categories::                  Not all tasks are equal
3559 * Time-of-day specifications::  How the agenda knows the time
3560 * Sorting of agenda items::     The order of things
3561 @end menu
3563 @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
3564 @subsection Categories
3566 @cindex category
3567 The category is a broad label assigned to each agenda item.  By default,
3568 the category is simply derived from the file name, but you can also
3569 specify it with a special line in the buffer, like this:
3571 @example
3572 #+CATEGORY: Thesis
3573 @end example
3575 If there are several such lines in a file, each specifies the category
3576 for the text below it (but the first category also applies to any text
3577 before the first CATEGORY line).  The display in the agenda buffer looks
3578 best if the category is not longer than 10 characters.
3580 @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
3581 @subsection Time-of-Day Specifications
3582 @cindex time-of-day specification
3584 Org-mode checks each agenda item for a time-of-day specification.  The
3585 time can be part of the time stamp that triggered inclusion into the
3586 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}.  Time
3587 ranges can be specified with two time stamps, like
3589 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
3591 In the headline of the entry itself, a time(range) may also appear as
3592 plain text (like @samp{12:45} or a @samp{8:30-1pm}.  If the agenda
3593 integrates the Emacs diary (@pxref{Weekly/Daily agenda}), time
3594 specifications in diary entries are recognized as well.
3596 For agenda display, Org-mode extracts the time and displays it in a
3597 standard 24 hour format as part of the prefix.  The example times in
3598 the previous paragraphs would end up in the agenda like this:
3600 @example
3601     8:30-13:00 Arthur Dent lies in front of the bulldozer
3602    12:45...... Ford Prefect arrives and takes Arthur to the pub
3603    19:00...... The Vogon reads his poem
3604    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
3605 @end example
3607 @cindex time grid
3608 If the agenda is in single-day mode, or for the display of today, the
3609 timed entries are embedded in a time grid, like
3611 @example
3612     8:00...... ------------------
3613     8:30-13:00 Arthur Dent lies in front of the bulldozer
3614    10:00...... ------------------
3615    12:00...... ------------------
3616    12:45...... Ford Prefect arrives and takes Arthur to the pub
3617    14:00...... ------------------
3618    16:00...... ------------------
3619    18:00...... ------------------
3620    19:00...... The Vogon reads his poem
3621    20:00...... ------------------
3622    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
3623 @end example
3625 The time grid can be turned on and off with the variable
3626 @code{org-agenda-use-time-grid}, and can be configured with
3627 @code{org-agenda-time-grid}.
3629 @node Sorting of agenda items,  , Time-of-day specifications, Presentation and sorting
3630 @subsection Sorting of agenda items
3631 @cindex sorting, of agenda items
3632 @cindex priorities, of agenda items
3633 Before being inserted into a view, the items are sorted.  How this is
3634 done depends on the type of view.
3635 @itemize @bullet
3636 @item
3637 For the daily/weekly agenda, the items for each day are sorted.  The
3638 default order is to first collect all items containing an explicit
3639 time-of-day specification.  These entries will be shown at the beginning
3640 of the list, as a @emph{schedule} for the day.  After that, items remain
3641 grouped in categories, in the sequence given by @code{org-agenda-files}.
3642 Within each category, items are sorted by priority (@pxref{Priorities}),
3643 which is composed of the base priority (2000 for priority @samp{A}, 1000
3644 for @samp{B}, and 0 for @samp{C}), plus additional increments for
3645 overdue scheduled or deadline items.
3646 @item 
3647 For the TODO list, items remain in the order of categories, but within
3648 each category, sorting takes place according to priority
3649 (@pxref{Priorities}).
3650 @item
3651 For tags matches, items are not sorted at all, but just appear in the
3652 sequence in which they are found in the agenda files.
3653 @end itemize
3655 Sorting can be customized using the variable
3656 @code{org-agenda-sorting-strategy}.
3659 @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda views
3660 @section Commands in the agenda buffer
3661 @cindex commands, in agenda buffer
3663 Entries in the agenda buffer are linked back to the org file or diary
3664 file where they originate.  You are not allowed to edit the agenda
3665 buffer itself, but commands are provided to show and jump to the
3666 original entry location, and to edit the org-files ``remotely'' from
3667 the agenda buffer.  In this way, all information is stored only once,
3668 removing the risk that your agenda and note files may diverge.
3670 Some commands can be executed with mouse clicks on agenda lines.  For
3671 the other commands, the cursor needs to be in the desired line.
3673 @table @kbd
3674 @tsubheading{Motion}
3675 @cindex motion commands in agenda
3676 @kindex n
3677 @item n
3678 Next line (same as @key{up}).
3679 @kindex p
3680 @item p
3681 Previous line (same as @key{down}).
3682 @tsubheading{View/GoTo org file}
3683 @kindex mouse-3
3684 @kindex @key{SPC}
3685 @item mouse-3
3686 @itemx @key{SPC}
3687 Display the original location of the item in another window.
3689 @kindex L
3690 @item L
3691 Display original location and recenter that window.
3693 @kindex mouse-2
3694 @kindex mouse-1
3695 @kindex @key{TAB}
3696 @item mouse-2
3697 @itemx mouse-1
3698 @itemx @key{TAB}
3699 Go to the original location of the item in another window.  Under Emacs
3700 22, @kbd{mouse-1} will also works for this.
3702 @kindex @key{RET}
3703 @itemx @key{RET}
3704 Go to the original location of the item and delete other windows.
3706 @kindex f
3707 @item f
3708 Toggle Follow mode.  In Follow mode, as you move the cursor through
3709 the agenda buffer, the other window always shows the corresponding
3710 location in the org file.  The initial setting for this mode in new
3711 agenda buffers can be set with the variable
3712 @code{org-agenda-start-with-follow-mode}.
3714 @kindex b
3715 @item b
3716 Display the entire subtree of the current item in an indirect buffer, in
3717 a separate, dedicated frame.  With positive numerical prefix N, go up to
3718 level N before selecting the subtree.  With negative prefix -N, go up N
3719 levels.  With @kbd{C-u} prefix, don't use the dedicated frame, but
3720 another, new frame.
3722 @kindex l
3723 @item l
3724 Toggle Logbook mode.  In Logbook mode, entries that where marked DONE while
3725 logging was on (variable @code{org-log-done}) are shown in the agenda,
3726 as are entries that have been clocked on that day.
3728 @tsubheading{Change display}
3729 @cindex display changing, in agenda
3730 @kindex o
3731 @item o
3732 Delete other windows.
3734 @kindex w
3735 @item w
3736 Switch to weekly view (7 days displayed together).
3738 @kindex d
3739 @item d
3740 Switch to daily view (just one day displayed).
3742 @kindex D
3743 @item D
3744 Toggle the inclusion of diary entries.  See @ref{Weekly/Daily agenda}.
3746 @kindex g
3747 @item g
3748 Toggle the time grid on and off.  See also the variables
3749 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
3751 @kindex r
3752 @item r
3753 Recreate the agenda buffer, for example to reflect the changes
3754 after modification of the time stamps of items with S-@key{left} and
3755 S-@key{right}.  When the buffer is the global todo list, a prefix
3756 argument is interpreted to create a selective list for a specific TODO
3757 keyword.
3759 @kindex s
3760 @item s
3761 Save all Org-mode buffers in the current Emacs session.
3763 @kindex @key{right}
3764 @item @key{right}
3765 Display the following @code{org-agenda-ndays} days.  For example, if
3766 the display covers a week, switch to the following week.  With prefix
3767 arg, go forward that many times @code{org-agenda-ndays} days.
3769 @kindex @key{left}
3770 @item @key{left}
3771 Display the previous dates.
3773 @kindex .
3774 @item .
3775 Goto today.
3777 @tsubheading{Remote editing}
3778 @cindex remote editing, from agenda
3780 @item 0-9
3781 Digit argument.
3783 @cindex undoing remote-editing events
3784 @cindex remote editing, undo
3785 @kindex C-_
3786 @item C-_
3787 Undo a change due to a remote editing command.  The change is undone
3788 both in the agenda buffer and in the remote buffer.
3790 @kindex t
3791 @item t
3792 Change the TODO state of the item, both in the agenda and in the
3793 original org file.
3795 @kindex C-k
3796 @item C-k
3797 Delete the current agenda item along with the entire subtree belonging
3798 to it in the original Org-mode file.  If the text to be deleted remotely
3799 is longer than one line, the kill needs to be confirmed by the user.  See
3800 variable @code{org-agenda-confirm-kill}.
3802 @kindex $
3803 @item $
3804 Archive the subtree corresponding to the current headline.
3806 @kindex T
3807 @item T
3808 Show all tags associated with the current item.  Because of
3809 inheritance, this may be more than the tags listed in the line itself.
3811 @kindex :
3812 @item :
3813 Set tags for the current headline.
3815 @kindex a
3816 @item a
3817 Toggle the ARCHIVE tag for the current headline.
3819 @kindex ,
3820 @item ,
3821 Set the priority for the current item.  Org-mode prompts for the
3822 priority character. If you reply with @key{SPC}, the priority cookie
3823 is removed from the entry.
3825 @kindex P
3826 @item p
3827 Display weighted priority of current item.
3829 @kindex +
3830 @kindex S-@key{up}
3831 @item +
3832 @itemx S-@key{up}
3833 Increase the priority of the current item.  The priority is changed in
3834 the original buffer, but the agenda is not resorted.  Use the @kbd{r}
3835 key for this.
3837 @kindex -
3838 @kindex S-@key{down}
3839 @item -
3840 @itemx S-@key{down}
3841 Decrease the priority of the current item.
3843 @kindex C-c C-s
3844 @item C-c C-s
3845 Schedule this item
3847 @kindex C-c C-d
3848 @item C-c C-d
3849 Set a deadline for this item.
3851 @kindex S-@key{right}
3852 @item S-@key{right}
3853 Change the time stamp associated with the current line by one day into
3854 the future.  With prefix argument, change it by that many days.  For
3855 example, @kbd{3 6 5 S-@key{right}} will change it by a year.  The
3856 stamp is changed in the original org file, but the change is not
3857 directly reflected in the agenda buffer.  Use the
3858 @kbd{r} key to update the buffer.
3860 @kindex S-@key{left}
3861 @item S-@key{left}
3862 Change the time stamp associated with the current line by one day
3863 into the past.
3865 @kindex >
3866 @item >
3867 Change the time stamp associated with the current line to today.
3868 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
3869 on my keyboard.
3871 @kindex I
3872 @item I
3873 Start the clock on the current item.  If a clock is running already, it
3874 is stopped first.
3875 @kindex O
3876 @item O
3877 Stop the previously started clock.
3878 @kindex X
3879 @item X
3880 Cancel the currently running clock.
3882 @tsubheading{Calendar commands}
3883 @cindex calendar commands, from agenda
3884 @kindex c
3885 @item c
3886 Open the Emacs calendar and move to the date at the agenda cursor.
3888 @item c
3889 When in the calendar, compute and show the Org-mode agenda for the
3890 date at the cursor.
3892 @cindex diary entries, creating from agenda
3893 @kindex i
3894 @item i
3895 Insert a new entry into the diary.  Prompts for the type of entry
3896 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
3897 entry in the diary, just as @kbd{i d} etc. would do in the calendar.
3898 The date is taken from the cursor position.
3900 @kindex M
3901 @item M
3902 Show the phases of the moon for the three months around current date.
3904 @kindex S
3905 @item S
3906 Show sunrise and sunset times.  The geographical location must be set
3907 with calendar variables, see documentation of the Emacs calendar.
3909 @kindex C
3910 @item C
3911 Convert the date at cursor into many other cultural and historic
3912 calendars.
3914 @kindex H
3915 @item H
3916 Show holidays for three month around the cursor date.
3918 @c FIXME:  This should be a different key.
3919 @kindex C-c C-x C-c
3920 @item C-c C-x C-c
3921 Export a single iCalendar file containing entries from all agenda files.
3923 @tsubheading{Quit and Exit}
3924 @kindex q
3925 @item q
3926 Quit agenda, remove the agenda buffer.
3928 @kindex x
3929 @cindex agenda files, removing buffers
3930 @item x
3931 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
3932 for the compilation of the agenda.  Buffers created by the user to
3933 visit org files will not be removed.
3935 @end table
3938 @node Custom agenda views,  , Agenda commands, Agenda views
3939 @section Custom agenda views
3940 @cindex custom agenda views
3941 @cindex agenda views, custom
3943 Custom agenda commands serve two purposes: to store and quickly access
3944 frequently used TODO and tags searches, and to create special composite
3945 agenda buffers.  Custom agenda commands will be accessible through the
3946 dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
3948 @menu
3949 * Storing searches::            Type once, use often
3950 * Block agenda::                All the stuff you need in a single buffer
3951 * Setting Options::             Changing the rules
3952 * Batch processing::            Agenda views from the command line
3953 @end menu
3955 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
3956 @subsection Storing searches
3958 The first application of custom searches is the definition of keyboard
3959 shortcuts for frequently used searches, either creating an agenda
3960 buffer, or a sparse tree (the latter covering of course only the current
3961 buffer).
3962 @kindex C-c a C
3963 Custom commands are configured in the variable
3964 @code{org-agenda-custom-commands}.  You can customize this variable, for
3965 example by pressing @kbd{C-c a C}.  You can also directly set it with
3966 Emacs Lisp in @file{.emacs}.  The following example contains all valid
3967 search types:
3969 @lisp
3970 @group
3971 (setq org-agenda-custom-commands
3972       '(("w" todo "WAITING")
3973         ("W" todo-tree "WAITING")
3974         ("u" tags "+BOSS-URGENT")
3975         ("v" tags-todo "+BOSS-URGENT")
3976         ("U" tags-tree "+BOSS-URGENT")
3977         ("f" occur-tree "\\<FIXME\\>")))
3978 @end group
3979 @end lisp
3981 @noindent
3982 The initial single-character string in each entry defines the character
3983 you have to press after the dispatcher command @kbd{C-c a} in order to
3984 access the command.   The second parameter is the search type, followed
3985 by the string or regular expression to be used for the matching.  The
3986 example above will therefore define:
3988 @table @kbd
3989 @item C-c a w
3990 as a global search for TODO entries with @samp{WAITING} as the TODO
3991 keyword
3992 @item C-c a W
3993 as the same search, but only in the current buffer and displaying the
3994 results as a sparse tree
3995 @item C-c a u
3996 as a global tags search for headlines marked @samp{:BOSS:} but not
3997 @samp{:URGENT:}
3998 @item C-c a v
3999 as the same search as @kbd{C-c a u}, but limiting the search to
4000 headlines that are also TODO items
4001 @item C-c a U
4002 as the same search as @kbd{C-c a u}, but only in the current buffer and
4003 displaying the result as a sparse tree
4004 @item C-c a f
4005 to create a sparse tree (again: current buffer only) with all entries
4006 containing the word @samp{FIXME}.
4007 @end table
4009 @node Block agenda, Setting Options, Storing searches, Custom agenda views
4010 @subsection Block agenda
4011 @cindex block agenda
4012 @cindex agenda, with block views
4014 Another possibility is the construction of agenda views that comprise
4015 the results of @emph{several} commands, each of which creates a block in
4016 the agenda buffer.  The available commands include @code{agenda} for the
4017 daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
4018 for the global todo list (as constructed with @kbd{C-c a t}), and the
4019 matching commands discussed above: @code{todo}, @code{tags}, and
4020 @code{tags-todo}.  Here are two examples:
4022 @lisp
4023 @group
4024 (setq org-agenda-custom-commands
4025       '(("h" "Agenda and Home-related tasks"
4026          ((agenda)
4027           (tags-todo "HOME")
4028           (tags "GARDEN")))
4029         ("o" "Agenda and Office-related tasks"
4030          ((agenda)
4031           (tags-todo "WORK")
4032           (tags "OFFICE")))))
4033 @end group
4034 @end lisp
4036 @noindent
4037 This will define @kbd{C-c a h} to create a multi-block view for stuff
4038 you need to attend to at home.  The resulting agenda buffer will contain
4039 your agenda for the current week, all TODO items that carry the tag
4040 @samp{HOME}, and also all lines tagged with @samp{GARDEN}.  Finally the
4041 command @kbd{C-c a o} provides a similar view for office tasks.
4044 @node Setting Options, Batch processing, Block agenda, Custom agenda views
4045 @subsection Setting Options for custom commands
4046 @cindex options, for custom agenda views
4048 Org-mode contains a number of variables regulating agenda construction
4049 and display.  The global variables define the behavior for all agenda
4050 commands, including the custom commands.  However, if you want to change
4051 some settings just for a single custom view, you can do so.  Setting
4052 options requires inserting a list of variable names and values at the
4053 right spot in @code{org-agenda-custom-commands}.  For example:
4055 @lisp
4056 @group
4057 (setq org-agenda-custom-commands
4058       '(("w" todo "WAITING"
4059          ((org-agenda-sorting-strategy '(priority-down))
4060           (org-agenda-prefix-format "  Mixed: ")))
4061         ("U" tags-tree "+BOSS-URGENT"
4062          ((org-show-following-heading nil)
4063           (org-show-hierarchy-above nil)))))
4064 @end group
4065 @end lisp
4067 @noindent
4068 Now the @kbd{C-c a w} command will sort the collected entries only by
4069 priority, and the prefix format is modified to just say @samp{  Mixed:}
4070 instead of giving the category of the entry.  The sparse tags tree of
4071 @kbd{C-c a U} will now turn out ultra-compact, because neither the
4072 headline hierarchy above the match, nor the headline following the match
4073 will be shown.
4075 For command sets creating a block agenda,
4076 @code{org-agenda-custom-commands} has two separate spots for setting
4077 options.  You can add options that should be valid for just a single
4078 command in the set, and options that should be valid for all commands in
4079 the set.  The former are just added to the command entry, the latter
4080 must come after the list of command entries.  Going back to the block
4081 agenda example (@pxref{Block agenda}), let's change the sorting strategy
4082 for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
4083 the results for GARDEN tags query in the opposite order,
4084 @code{priority-up}.  This would look like this:
4086 @lisp
4087 @group
4088 (setq org-agenda-custom-commands
4089       '(("h" "Agenda and Home-related tasks"
4090          ((agenda)
4091           (tags-todo "HOME")
4092           (tags "GARDEN" ((org-agenda-sorting-strategy '(priority-up)))))
4093          ((org-agenda-sorting-strategy '(priority-down))))
4094         ("o" "Agenda and Office-related tasks"
4095          ((agenda)
4096           (tags-todo "WORK")
4097           (tags "OFFICE")))))
4098 @end group
4099 @end lisp
4101 As you see, the values and parenthesis setting is a little complex.
4102 When in doubt, use the customize interface to set this variable - it
4103 fully supports its structure.  Just one caveat: When setting options in
4104 this interface, the @emph{values} are just lisp expressions.  So if the
4105 value is a string, you need to add the double quotes around the value
4106 yourself.
4108 @node Batch processing,  , Setting Options, Custom agenda views
4109 @subsection Creating agenda views in batch processing
4110 @cindex agenda, batch production
4112 If you want to print or otherwise reprocess agenda views, it can be
4113 useful to create an agenda from the command line.  This is the purpose
4114 of the function @code{org-batch-agenda}.  It takes as a parameter one of
4115 the strings that are the keys in @code{org-agenda-custom-commands}.  For
4116 example, to directly print the current TODO list, you could use
4118 @example
4119 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
4120 @end example
4122 @noindent
4123 You may also modify parameters on the fly like this:
4125 @example
4126 emacs -batch -l ~/.emacs                                      \
4127    -eval '(org-batch-agenda "a"                               \
4128             org-agenda-ndays 300                              \
4129             org-agenda-include-diary nil                      \
4130             org-agenda-files (quote ("~/org/project.org")))'  \
4131    | lpr
4132 @end example
4134 @noindent
4135 which will produce a 300 day agenda, fully restricted to the Org file
4136 @file{~/org/projects.org}, not even including the diary.
4138 @node Embedded LaTeX, Exporting, Agenda views, Top
4139 @chapter Embedded LaTeX
4140 @cindex @TeX{} interpretation
4141 @cindex La@TeX{} interpretation
4143 Plain ASCII is normally sufficient for almost all note taking.  One
4144 exception, however, are scientific notes which need to be able to
4145 contain mathematical symbols and the occasional formula.
4146 La@TeX{}@footnote{La@TeX{} is a macro system based on Donald E. Knuth's
4147 @TeX{} system.  Many of the features described here as ``La@TeX{}'' are
4148 really from @TeX{}, but for simplicity I am blurring this distinction.}
4149 is widely used to typeset scientific documents. Org-mode supports
4150 embedding La@TeX{} code into its files, because many academics are used
4151 to read La@TeX{} source code, and because it can be readily processed
4152 into images for HTML production.
4154 It is not necessary to mark La@TeX{} macros and code in any special way.
4155 If you observe a few conventions, Org-mode knows how to find it and what
4156 to do with it.
4158 @menu
4159 * Math symbols::                TeX macros for symbols and Greek letters
4160 * Subscripts and Superscripts::  Simple syntax for raising/lowering text
4161 * LaTeX fragments::             Complex formulas made easy
4162 * Processing LaTeX fragments::  Previewing LaTeX processing
4163 * CDLaTeX mode::                Speed up entering of formulas
4164 @end menu
4166 @node Math symbols, Subscripts and Superscripts, Embedded LaTeX, Embedded LaTeX
4167 @section Math symbols
4168 @cindex math symbols
4169 @cindex TeX macros
4171 You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
4172 to indicate the Greek letter, or @samp{\to} to indicate an arrow.
4173 Completion for these macros is available, just type @samp{\} and maybe a
4174 few letters, and press @kbd{M-@key{TAB}} to see possible completions.
4175 Unlike La@TeX{} code, Org-mode allows these macros to be present
4176 without surrounding math delimiters, for example:
4178 @example
4179 Angles are written as Greek letters \alpha, \beta and \gamma.
4180 @end example
4182 During HTML export (@pxref{HTML export}), these symbols are translated
4183 into the proper syntax for HTML, for the above examples this is
4184 @samp{&alpha;} and @samp{&rarr;}, respectively.
4186 @node Subscripts and Superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
4187 @section Subscripts and Superscripts
4188 @cindex subscript
4189 @cindex superscript
4191 Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
4192 and subscripts.  Again, these can be used without embedding them in
4193 math-mode delimiters.  To increase the readability of ASCII text, it is
4194 not necessary (but OK) to surround multi-character sub- and superscripts
4195 with curly braces.  For example
4197 @example
4198 The mass if the sun is M_sun = 1.989 x 10^30 kg.  The radius of
4199 the sun is R_@{sun@} = 6.96 x 10^8 m.
4200 @end example
4202 To avoid interpretation as raised or lowered text, you can quote
4203 @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
4205 During HTML export (@pxref{HTML export}), subscript and superscripts
4206 are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
4208 @node LaTeX fragments, Processing LaTeX fragments, Subscripts and Superscripts, Embedded LaTeX
4209 @section LaTeX fragments
4210 @cindex LaTeX fragments
4212 With symbols, sub- and superscripts, HTML is pretty much at its end when
4213 it comes to representing mathematical formulas@footnote{Yes, there is
4214 MathML, but that is not yet fully supported by many browsers, and there
4215 is no decent converter for turning LaTeX of ASCII representations of
4216 formulas into MathML.  So for the time being, converting formulas into
4217 images seems the way to go.}.  More complex
4218 expressions need a dedicated formula processor.  To this end, Org-mode
4219 can contain arbitrary La@TeX{} fragments.  It provides commands to
4220 preview the typeset result of these fragments, and upon export to HTML,
4221 all fragments will be converted to images and inlined into the HTML
4222 document.  For this to work you need to be on a system with a working
4223 La@TeX{} installation.  You also need the @file{dvipng} program,
4224 available at @url{http://sourceforge.net/projects/dvipng/}.
4226 La@TeX{} fragments don't need any special marking at all.  The following
4227 snippets will be identified as LaTeX source code:
4228 @itemize @bullet
4229 @item
4230 Environments of any kind.  The only requirement is that the
4231 @code{\begin} statement appears on a new line, preceded by only
4232 whitespace.
4233 @item
4234 Text within the usual La@TeX{} math delimiters.  To avoid conflicts with
4235 currency specifications, single @samp{$} characters are only recognized
4236 as math delimiters if the enclosed text contains at most two line breaks,
4237 is directly attached to the @samp{$} characters with no whitespace in
4238 between, and if the closing @samp{$} is followed by whitespace or
4239 punctuation.  For the other delimiters, there is no such restriction, so
4240 when in doubt, use @samp{\(...\)} as inline math delimiters.
4241 @end itemize
4243 @noindent For example:
4245 @example
4246 \begin@{equation@}                          % arbitrary environments,
4247 x=\sqrt@{b@}                                % even tables, figures
4248 \end@{equation@}                            % etc
4250 If $a^2=b$ and \( b=2 \), then the solution must be
4251 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
4252 @end example
4254 @noindent
4255 If you need any of the delimiter ASCII sequences for other purposes, you
4256 can configure the option @code{org-format-latex-options} to deselect the
4257 ones you do not wish to have interpreted by the La@TeX{} converter.
4259 @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
4260 @section Processing LaTeX fragments
4261 @cindex LaTeX fragments, preview
4263 La@TeX{} fragments can be processed to produce a preview images of the
4264 typeset expressions:
4266 @table @kbd
4267 @kindex C-c C-x C-l
4268 @item C-c C-x C-l
4269 Produce a preview image of the La@TeX{} fragment at point and overlay it
4270 over the source code.  If there is no fragment at point, process all
4271 fragments in the current entry (between two headlines).  When called
4272 with a prefix argument, process the entire subtree.  When called with
4273 two prefix arguments, or when the cursor is before the first headline,
4274 process the entire buffer.
4275 @kindex C-c C-c
4276 @item C-c C-c
4277 Remove the overlay preview images.
4278 @end table
4280 During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
4281 converted into images and inlined into the document if the following
4282 setting is active:
4284 @lisp
4285 (setq org-export-with-LaTeX-fragments t)
4286 @end lisp
4288 @node CDLaTeX mode,  , Processing LaTeX fragments, Embedded LaTeX
4289 @section Using CDLaTeX to enter math
4290 @cindex CDLaTeX
4292 CDLaTeX-mode is a minor mode that is normally used in combination with a
4293 major LaTeX mode like AUCTeX in order to speed-up insertion of
4294 environments and math templates.  Inside Org-mode, you can make use of
4295 some of the features of cdlatex-mode.  You need to install
4296 @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
4297 AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
4298 Don't turn cdlatex-mode itself under Org-mode, but use the light
4299 version @code{org-cdlatex-mode} that comes as part of Org-mode.  Turn it
4300 on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
4301 Org-mode files with
4303 @lisp
4304 (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
4305 @end lisp
4307 When this mode is enabled, the following features are present (for more
4308 details see the documentation of cdlatex-mode):
4309 @itemize @bullet
4310 @kindex C-c @{
4311 @item
4312 Environment templates can be inserted with @kbd{C-c @{}.
4313 @item
4314 @kindex @key{TAB}
4315 The @key{TAB} key will do template expansion if the cursor is inside a
4316 LaTeX fragment@footnote{Org-mode has a method to test if the cursor is
4317 inside such a fragment, see the documentation of the function
4318 @code{org-inside-LaTeX-fragment-p}.}.  For example, @key{TAB} will
4319 expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
4320 correctly inside the first brace.  Another @key{TAB} will get you into
4321 the second brace.  Even outside fragments, @key{TAB} will expand
4322 environment abbreviations at the beginning of a line.  For example, if
4323 you write @samp{equ} at the beginning of a line and press @key{TAB},
4324 this abbreviation will be expanded to an @code{equation} environment.
4325 To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
4326 @item
4327 @kindex _
4328 @kindex ^
4329 Pressing @kbd{_} and @kbd{^} inside a LaTeX fragment will insert these
4330 characters together with a pair of braces.  If you use @key{TAB} to move
4331 out of the braces, and if the braces surround only a single character or
4332 macro, they are removed again (depending on the variable
4333 @code{cdlatex-simplify-sub-super-scripts}).
4334 @item
4335 @kindex `
4336 Pressing the backquote @kbd{`} followed by a character inserts math
4337 macros, also outside LaTeX fragments.  If you wait more than 1.5 seconds
4338 after the backquote, a help window will pop up.
4339 @item
4340 @kindex '
4341 Pressing the normal quote @kbd{'} followed by another character modifies
4342 the symbol before point with an accent or a font.  If you wait more than
4343 1.5 seconds after the backquote, a help window will pop up.  Character
4344 modification will work only inside La@TeX{} fragments, outside the quote
4345 is normal.
4346 @end itemize
4348 @node Exporting, Publishing, Embedded LaTeX, Top
4349 @chapter Exporting
4350 @cindex exporting
4352 Org-mode documents can be exported into a variety of other formats.  For
4353 printing and sharing of notes, ASCII export produces a readable and
4354 simple version of an Org-mode file.  HTML export allows you to publish a
4355 notes file on the web, while the XOXO format provides a solid base for
4356 exchange with a broad range of other applications.  To incorporate
4357 entries with associated times like deadlines or appointments into a
4358 desktop calendar program like iCal, Org-mode can also produce extracts
4359 in the iCalendar format.  Currently Org-mode only supports export, not
4360 import of these different formats.
4362 When exporting, Org-mode uses special conventions to enrich the output
4363 produced.  @xref{Text interpretation}, for more details.
4365 @table @kbd
4366 @kindex C-c C-e
4367 @item C-c C-e
4368 Dispatcher for export and publishing commands.  Displays a help-window
4369 listing the additional key(s) needed to launch an export or publishing
4370 command.
4371 @end table
4373 @menu
4374 * ASCII export::                Exporting to plain ASCII
4375 * HTML export::                 Exporting to HTML
4376 * XOXO export::                 Exporting to XOXO
4377 * iCalendar export::            Exporting in iCalendar format
4378 * Text interpretation::         How the exporter looks at the file
4379 @end menu
4381 @node ASCII export, HTML export, Exporting, Exporting
4382 @section ASCII export
4383 @cindex ASCII export
4385 ASCII export produces a simple and very readable version of an Org-mode
4386 file.
4388 @cindex region, active
4389 @cindex active region
4390 @cindex transient-mark-mode
4391 @table @kbd
4392 @kindex C-c C-e a
4393 @item C-c C-e a
4394 Export as ASCII file.  If there is an active region, only the region
4395 will be exported.  For an org file @file{myfile.org}, the ASCII file
4396 will be @file{myfile.txt}.  The file will be overwritten without
4397 warning.
4398 @kindex C-c C-e v a
4399 @item C-c C-e v a
4400 Export only the visible part of the document.
4401 @end table
4403 @cindex headline levels, for exporting
4404 In the exported version, the first 3 outline levels will become
4405 headlines, defining a general document structure.  Additional levels
4406 will be exported as itemized lists.  If you want that transition to occur
4407 at a different level, specify it with a prefix argument.  For example,
4409 @example
4410 @kbd{C-1 C-c C-e a}
4411 @end example
4413 @noindent
4414 creates only top level headlines and does the rest as items.  When
4415 headlines are converted to items, the indentation of the text following
4416 the headline is changed to fit nicely under the item.  This is done with
4417 the assumption that the first bodyline indicates the base indentation of
4418 the body text.  Any indentation larger than this is adjusted to preserve
4419 the layout relative to the first line.  Should there be lines with less
4420 indentation than the first, these are left alone.
4422 @node HTML export, XOXO export, ASCII export, Exporting
4423 @section HTML export
4424 @cindex HTML export
4426 Org-mode contains an HTML (XHTML 1.0 strict) exporter with extensive
4427 HTML formatting, in ways similar to John Grubers @emph{markdown}
4428 language, but with additional support for tables.
4430 @cindex region, active
4431 @cindex active region
4432 @cindex transient-mark-mode
4433 @table @kbd
4434 @kindex C-c C-e h
4435 @item C-c C-e h
4436 Export as HTML file @file{myfile.html}.
4437 @kindex C-c C-e b
4438 @item C-c C-e b
4439 Export as HTML file and open it with a browser.
4440 @kindex C-c C-e v h
4441 @kindex C-c C-e v b
4442 @item C-c C-e v h
4443 @item C-c C-e v b
4444 Export only the visible part of the document.
4445 @end table
4447 @cindex headline levels, for exporting
4448 In the exported version, the first 3 outline levels will become
4449 headlines, defining a general document structure.  Additional levels
4450 will be exported as itemized lists.  If you want that transition to occur
4451 at a different level, specify it with a prefix argument.  For example,
4453 @example
4454 @kbd{C-2 C-c C-e b}
4455 @end example
4457 @noindent
4458 creates two levels of headings and does the rest as items.
4460 If you want to include HTML tags which should be interpreted as such,
4461 mark them with @samp{@@} as in @samp{@@<b>bold text@@</b>}.
4462 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
4463 @samp{&gt;} in HTML export.
4465 @cindex links, in HTML export
4466 @cindex internal links, in HTML export
4467 @cindex external links, in HTML export
4468 Internal links (@pxref{Internal links}) will continue to work in HTML
4469 files only if they match a dedicated @samp{<<target>>}.  Automatic links
4470 created by radio targets (@pxref{Radio targets}) will also work in the
4471 HTML file.  Links to external files will still work if the HTML file is
4472 in the same directory as the Org-mode file.  Links to other @file{.org}
4473 files will be translated into HTML links under the assumption that an
4474 HTML version also exists of the linked file.  For information related to
4475 linking files while publishing them to a publishing directory see
4476 @ref{Publishing links}.
4478 You can also give style information for the exported file.  The HTML
4479 exporter assigns the following CSS classes to appropriate parts of the
4480 document - your style specifications may change these:
4481 @example
4482 .todo           @r{TODO keywords}
4483 .done           @r{the DONE keyword}
4484 .timestamp      @r{time stamp}
4485 .timestamp-kwd  @r{keyword associated with a time stamp, like SCHEDULED}
4486 .tag            @r{tag in a headline}
4487 .target         @r{target for links}
4488 @end example
4490 The default style specification can be configured through the option
4491 @code{org-export-html-style}.  If you want to use a file-local style,
4492 you may use file variables, best wrapped into a COMMENT section at the
4493 end of the outline tree.  For example:
4495 @example
4496 * COMMENT HTML style specifications
4498 # Local Variables:
4499 # org-export-html-style: "   <style type=\"text/css\">
4500 #       p @{font-weight: normal; color: gray; @}
4501 #       h1 @{color: black; @}
4502 #   </style>"
4503 # End:
4504 @end example
4506 Remember to execute @kbd{M-x normal-mode} after changing this to make
4507 the new style visible to Emacs.  This command restarts org-mode for the
4508 current buffer and forces Emacs to re-evaluate the local variables
4509 section in the buffer.
4511 @c FIXME: More about header and footer styles
4512 @c FIXME: Talk about links and targets.
4514 @node XOXO export, iCalendar export, HTML export, Exporting
4515 @section XOXO export
4516 @cindex XOXO export
4518 Org-mode contains an exporter that produces XOXO-style output.
4519 Currently, this exporter only handles the general outline structure and
4520 does not interpret any additional Org-mode features.
4522 @table @kbd
4523 @kindex C-c C-e x
4524 @item C-c C-e x
4525 Export as XOXO file @file{myfile.html}.
4526 @kindex C-c C-e v
4527 @item C-c C-e v x
4528 Export only the visible part of the document.
4529 @end table
4531 @node iCalendar export, Text interpretation, XOXO export, Exporting
4532 @section iCalendar export
4533 @cindex iCalendar export
4535 Some people like to use Org-mode for keeping track of projects, but
4536 still prefer a standard calendar application for anniversaries and
4537 appointments.  In this case it can be useful to have deadlines and
4538 other time-stamped items in Org-mode files show up in the calendar
4539 application.  Org-mode can export calendar information in the standard
4540 iCalendar format.
4542 @table @kbd
4543 @kindex C-c C-e i
4544 @item C-c C-e i
4545 Create iCalendar entries for the current file and store them in the same
4546 directory, using a file extension @file{.ics}.
4547 @kindex C-c C-e I
4548 @item C-c C-e I
4549 Like @kbd{C-c C-e i}, but do this for all files in
4550 @code{org-agenda-files}.  For each of these files, a separate iCalendar
4551 file will be written.
4552 @kindex C-c C-e c
4553 @item C-c C-e c
4554 Create a single large iCalendar file from all files in
4555 @code{org-agenda-files} and write it to the file given by
4556 @code{org-combined-agenda-icalendar-file}.
4557 @end table
4559 How this calendar is best read and updated, depends on the application
4560 you are using.  For example, when using iCal under Apple MacOS X, you
4561 could create a new calendar @samp{OrgMode} (the default name for the
4562 calendar created by @kbd{C-c C-e c}, see the variables
4563 @code{org-icalendar-combined-name} and
4564 @code{org-combined-agenda-icalendar-file}).  Then set Org-mode to
4565 overwrite the corresponding file
4566 @file{~/Library/Calendars/OrgMode.ics}.  You may even use AppleScript
4567 to make iCal re-read the calendar files each time a new version of
4568 @file{OrgMode.ics} is produced.  Here is the setup needed for this:
4570 @cindex applescript, for calendar update
4571 @lisp
4572 (setq org-combined-agenda-icalendar-file
4573     "~/Library/Calendars/OrgMode.ics")
4574 (add-hook 'org-after-save-iCalendar-file-hook
4575  (lambda ()
4576   (shell-command
4577    "osascript -e 'tell application \"iCal\" to reload calendars'")))
4578 @end lisp
4580 @node Text interpretation,  , iCalendar export, Exporting
4581 @section Text interpretation by the exporter
4583 The exporter backends interpret additional structure in the Org-mode file
4584 in order to produce better output.
4586 @menu
4587 * Comment lines::               Some lines will not be exported
4588 * Enhancing text::              Subscripts, symbols and more
4589 * Export options::              How to influence the export settings
4590 @end menu
4592 @node Comment lines, Enhancing text, Text interpretation, Text interpretation
4593 @subsection Comment lines
4594 @cindex comment lines
4595 @cindex exporting, not
4597 Lines starting with @samp{#} in column zero are treated as comments
4598 and will never be exported.  Also entire subtrees starting with the
4599 word @samp{COMMENT} will never be exported.  Finally, any text before
4600 the first headline will not be exported either.
4602 @table @kbd
4603 @kindex C-c ;
4604 @item C-c ;
4605 Toggle the COMMENT keyword at the beginning of an entry.
4606 @end table
4608 @node Enhancing text, Export options, Comment lines, Text interpretation
4609 @subsection Enhancing text for export
4610 @cindex enhancing text
4611 @cindex richer text
4613 Some of the export backends of Org-mode allow for sophisticated text
4614 formatting, this is true in particular for the HTML backend.  Org-mode
4615 has a number of typing conventions that allow to produce a richly
4616 formatted output.
4618 @itemize @bullet
4620 @cindex hand-formatted lists
4621 @cindex lists, hand-formatted
4622 @item
4623 Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
4624 or @samp{2)} as enumerator will be recognized and transformed if the
4625 backend supports lists.  See @xref{Plain lists}.
4627 @cindex underlined text
4628 @cindex bold text
4629 @cindex italic text
4630 @item
4631 You can make words @b{*bold*}, @i{/italic/}, _underlined_,
4632 @code{=code=}, and @samp{+strikethrough+}.
4634 @cindex LaTeX fragments, export
4635 @cindex TeX macros, export
4636 @item
4637 Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML
4638 entities or images (@pxref{Embedded LaTeX}).
4640 @cindex tables, export
4641 @item
4642 Tables are transformed into native tables under the exporter, if the
4643 export backend supports this. Data fields before the first horizontal
4644 separator line will be formatted as table header fields.
4646 @cindex fixed width
4647 @item
4648 If a headline starts with the word @samp{QUOTE}, the text below the
4649 headline will be typeset as fixed-width, to allow quoting of computer
4650 codes etc.  Lines starting with @samp{:} are also typeset in
4651 fixed-width font.
4652 @table @kbd
4653 @kindex C-c :
4654 @item C-c :
4655 Toggle fixed-width for entry (QUOTE) or region, see below.
4656 @end table
4658 @cindex linebreak, forced
4659 @item 
4660 A double backslash @emph{at the end of a line} enforces a line break at
4661 this position.
4662 @end itemize
4664 If these conversions conflict with your habits of typing ASCII text,
4665 they can all be turned off with corresponding variables (see the
4666 customization group @code{org-export-general}, and the following section
4667 which explains how to set export options with special lines in a
4668 buffer.
4671 @node Export options,  , Enhancing text, Text interpretation
4672 @subsection Export options
4673 @cindex options, for export
4675 @cindex completion, of option keywords
4676 The exporter recognizes special lines in the buffer which provide
4677 additional information.  These lines may be put anywhere in the file.
4678 The whole set of lines can be inserted into the buffer with @kbd{C-c
4679 C-e t}.  For individual lines, a good way to make sure the keyword is
4680 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
4681 (@pxref{Completion}).
4683 @table @kbd
4684 @kindex C-c C-e t
4685 @item C-c C-e t
4686 Insert template with export options, see example below.
4687 @end table
4689 @example
4690 #+TITLE:     the title to be shown (default is the buffer name)
4691 #+AUTHOR:    the author (default taken from @code{user-full-name})
4692 #+EMAIL:     his/her email address (default from @code{user-mail-address})
4693 #+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
4694 #+TEXT:      Some descriptive text to be inserted at the beginning.
4695 #+TEXT:      Several lines may be given.
4696 #+OPTIONS:   H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t *:nil TeX:t LaTeX:t
4697 @end example
4699 @noindent
4700 The OPTIONS line is a compact form to specify export settings.  Here
4701 you can:
4702 @cindex headline levels
4703 @cindex section-numbers
4704 @cindex table of contents
4705 @cindex linebreak preservation
4706 @cindex quoted HTML tags
4707 @cindex fixed-width sections
4708 @cindex tables
4709 @cindex @TeX{}-like syntax for sub- and superscripts
4710 @cindex emphasized text
4711 @cindex @TeX{} macros
4712 @cindex La@TeX{} fragments
4713 @example
4714 H:      @r{set the number of headline levels for export}
4715 num:    @r{turn on/off section-numbers}
4716 toc:    @r{turn on/off table of contents}
4717 \n:     @r{turn on/off linebreak-preservation}
4718 @@:      @r{turn on/off quoted HTML tags}
4719 ::      @r{turn on/off fixed-width sections}
4720 |:      @r{turn on/off tables}
4721 ^:      @r{turn on/off @TeX{}-like syntax for sub- and superscripts.}
4722 *:      @r{turn on/off emphasized text (bold, italic, underlined)}
4723 TeX:    @r{turn on/off simple @TeX{} macros in plain text}
4724 LaTeX:  @r{turn on/off La@TeX{} fragments}
4725 @end example
4727 @node Publishing, Miscellaneous, Exporting, Top
4728 @chapter Publishing
4729 @cindex publishing
4731 Org-mode includes@footnote{@file{org-publish.el} is not yet part of
4732 Emacs, so if you are using @file{org.el} as it comes with Emacs, you
4733 need to download this file separately.  Also make sure org.el is at
4734 least version 4.27.} a publishing management system
4735 that allows you to configure automatic HTML conversion of
4736 @emph{projects} composed of interlinked org files.  This system is
4737 called @emph{org-publish}.  You can also configure org-publish to
4738 automatically upload your exported HTML pages and related attachments,
4739 such as images and source code files, to a web server.  Org-publish turns
4740 org-mode into a web-site authoring tool.
4742 Org-publish has been contributed to Org-mode by David O'Toole.
4744 @menu
4745 * Configuration::               Defining projects
4746 * Sample configuration::        Example projects
4747 * Triggering publication::      Publication commands
4748 @end menu
4750 @node Configuration, Sample configuration, Publishing, Publishing
4751 @section Configuration
4753 Publishing needs significant configuration to specify files, destination
4754 and many other properties of a project.
4756 @menu
4757 * Project alist::               The central configuration variable
4758 * Sources and destinations::    From here to there
4759 * Selecting files::             What files are part of the project?
4760 * Publishing action::           Setting the function doing the publishing
4761 * Publishing options::          Tweaking HTML export
4762 * Publishing links::            Which links keep working after publishing?
4763 * Project page index::          Publishing a list of project files
4764 @end menu
4766 @node Project alist, Sources and destinations, Configuration, Configuration
4767 @subsection The variable @code{org-publish-project-alist}
4768 @cindex org-publish-project-alist
4769 @cindex projects, for publishing
4771 Org-publish is configured almost entirely through setting the value of
4772 one variable, called @code{org-publish-project-alist}.
4773 Each element of the list configures one project, and may be in one of
4774 the two following forms:
4776 @lisp
4777 ("project-name"  :property value :property value ...)
4779 @r{or} 
4781 ("project-name"  :components ("project-name" "project-name" ...))
4783 @end lisp
4785 In both cases, projects are configured by specifying property values.
4786 A project defines the set of files that will be published, as well as
4787 the publishing configuration to use when publishing those files.  When
4788 a project takes the second form listed above, the individual members
4789 of the ``components'' property are taken to be components of the
4790 project, which group together files requiring different publishing
4791 options. When you publish such a ``meta-project'' all the components
4792 will also publish.
4794 @node Sources and destinations, Selecting files, Project alist, Configuration
4795 @subsection Sources and destinations for files
4796 @cindex directories, for publishing
4798 Most properties are optional, but some should always be set. In
4799 particular, org-publish needs to know where to look for source files,
4800 and where to put published files.
4802 @multitable @columnfractions 0.3 0.7
4803 @item @code{:base-directory}
4804 @tab Directory containing publishing source files
4805 @item @code{:publishing-directory}
4806 @tab Directory (possibly remote) where output files will be published.
4807 @item @code{:preparation-function}
4808 @tab Function called before starting publishing process, for example to
4809 run @code{make} for updating files to be published.
4810 @end multitable
4811 @noindent
4813 @node Selecting files, Publishing action, Sources and destinations, Configuration
4814 @subsection Selecting files
4815 @cindex files, selecting for publishing
4817 By default, all files with extension @file{.org} in the base directory
4818 are considered part of the project.  This can be modified by setting the
4819 properties 
4820 @multitable @columnfractions 0.25 0.75
4821 @item @code{:base-extension}
4822 @tab Extension (without the dot!) of source files.  This actually is a
4823 regular expression.
4825 @item @code{:exclude} 
4826 @tab Regular expression to match file names that should not be
4827 published, even though they have been selected on the basis of their
4828 extension.
4830 @item @code{:include}
4831 @tab List of files to be included regardless of @code{:base-extension}
4832 and @code{:exclude}.
4833 @end multitable
4835 @node Publishing action, Publishing options, Selecting files, Configuration
4836 @subsection Publishing Action
4837 @cindex action, for publishing
4839 Publishing means that a file is copied to the destination directory and
4840 possibly transformed in the process.  The default transformation is to
4841 export Org-mode files as HTML files, and this is done by the function
4842 @code{org-publish-org-to-html} which calls the HTML exporter
4843 (@pxref{HTML export}).  Other files like images only need to be copied
4844 to the publishing destination.  For non-Org-mode files, you need to
4845 specify the publishing function.
4847 @multitable @columnfractions 0.3 0.7
4848 @item @code{:publishing-function}
4849 @tab Function executing the publication of a file.  This may also be a
4850 list of functions, which will all be called in turn.
4851 @end multitable
4853 The function must accept two arguments: a property list containing at
4854 least a @code{:publishing-directory} property, and the name of the file
4855 to be published.  It should take the specified file, make the necessary
4856 transformation (if any) and place the result into the destination folder.
4857 You can write your own publishing function, but @code{org-publish}
4858 provides one for attachments (files that only need to be copied):
4859 @code{org-publish-attachment}.
4861 @node Publishing options, Publishing links, Publishing action, Configuration
4862 @subsection Options for the HTML exporter
4863 @cindex options, for publishing
4865 The property list can be used to set many export options for the HTML
4866 exporter.  In most cases, these properties correspond to user variables
4867 in Org-mode.  The table below lists these properties along with the
4868 variable they belong to.  See the documentation string for the
4869 respective variable for details.
4871 @multitable @columnfractions 0.3 0.7
4872 @item @code{:language}              @tab @code{org-export-default-language}
4873 @item @code{:headline-levels}       @tab @code{org-export-headline-levels}
4874 @item @code{:section-numbers}       @tab @code{org-export-with-section-numbers}
4875 @item @code{:table-of-contents}     @tab @code{org-export-with-toc}
4876 @item @code{:archived-trees}        @tab @code{org-export-with-archived-trees}
4877 @item @code{:emphasize}             @tab @code{org-export-with-emphasize}
4878 @item @code{:sub-superscript}       @tab @code{org-export-with-sub-superscripts}
4879 @item @code{:TeX-macros}            @tab @code{org-export-with-TeX-macros}
4880 @item @code{:LaTeX-fragments}       @tab @code{org-export-with-LaTeX-fragments}
4881 @item @code{:fixed-width}           @tab @code{org-export-with-fixed-width}
4882 @item @code{:timestamps}           .@tab @code{org-export-with-timestamps}
4883 @item @code{:tags}                 .@tab @code{org-export-with-tags}
4884 @item @code{:tables}                @tab @code{org-export-with-tables}
4885 @item @code{:table-auto-headline}   @tab @code{org-export-highlight-first-table-line}
4886 @item @code{:style}                 @tab @code{org-export-html-style}
4887 @item @code{:convert-org-links}     @tab @code{org-export-html-link-org-files-as-html}
4888 @item @code{:inline-images}         @tab @code{org-export-html-inline-images}
4889 @item @code{:expand-quoted-html}    @tab @code{org-export-html-expand}
4890 @item @code{:timestamp}             @tab @code{org-export-html-with-timestamp}
4891 @item @code{:publishing-directory}  @tab @code{org-export-publishing-directory}
4892 @item @code{:preamble}              @tab @code{org-export-html-preamble}
4893 @item @code{:postamble}             @tab @code{org-export-html-postamble}
4894 @item @code{:auto-preamble}         @tab @code{org-export-html-auto-preamble}
4895 @item @code{:auto-postamble}        @tab @code{org-export-html-auto-postamble}
4896 @item @code{:author}                @tab @code{user-full-name}
4897 @item @code{:email}                 @tab @code{user-mail-address}
4898 @end multitable
4900 When a property is given a value in org-publish-project-alist, its
4901 setting overrides the value of the corresponding user variable (if any)
4902 during publishing.  options set within a file (@pxref{Export
4903 options}), however, override everything.
4905 @node Publishing links, Project page index, Publishing options, Configuration
4906 @subsection Links between published files
4907 @cindex links, publishing
4909 To create a link from one Org-mode file to another, you would use
4910 something like @samp{[[file:foo.org][The foo]]} or simply
4911 @samp{file:foo.org.} (@pxref{Hyperlinks}).  Upon publishing this link
4912 becomes a link to @file{foo.html}.  In this way, you can interlink the
4913 pages of your "org web" project and the links will work as expected when
4914 you publish them to HTML.
4916 You may also link to related files, such as images. Provided you are
4917 careful with relative pathnames, and provided you have also configured
4918 org-publish to upload the related files, these links will work
4919 too. @ref{Complex example} for an example of this usage.
4921 Sometime an Org-mode file to be published may contain links that are
4922 only valid in your production environment, but not in the publishing
4923 location.  In this case, use the property 
4925 @multitable @columnfractions 0.4 0.6
4926 @item @code{:link-validation-function}
4927 @tab Function to validate links
4928 @end multitable
4930 @noindent
4931 to define a function for checking link validity.  This function must
4932 accept two arguments, the file name and a directory relative to which
4933 the file name is interpreted in the production environment.  If this
4934 function returns @code{nil}, then the HTML generator will only insert a
4935 description into the HTML file, but no link.  One option for this
4936 function is @code{org-publish-validate-link} which checks if the given
4937 file is part of any project in @code{org-publish-project-alist}.
4939 @node Project page index,  , Publishing links, Configuration
4940 @subsection Project page index
4941 @cindex index, of published pages
4943 The following properties may be used to control publishing of an
4944 index of files or summary page for a given project.
4946 @multitable @columnfractions 0.25 0.75
4947 @item @code{:auto-index}
4948 @tab When non-nil, publish an index during org-publish-current-project or
4949 org-publish-all.
4951 @item @code{:index-filename}
4952 @tab Filename for output of index. Defaults to @file{index.org} (which
4953 becomes @file{index.html}).
4955 @item @code{:index-title}
4956 @tab Title of index page. Defaults to name of file.
4958 @item @code{:index-function}
4959 @tab Plugin function to use for generation of index.
4960 Defaults to @code{org-publish-org-index}, which generates a plain list
4961 of links to all files in the project.
4962 @end multitable
4964 @node Sample configuration, Triggering publication, Configuration, Publishing
4965 @section Sample configuration
4967 Below we provide two example configurations.  The first one is a simple
4968 project publishing only a set of Org-mode files.  The second example is
4969 more complex, with a multi-component project.
4971 @menu
4972 * Simple example::              One-component publishing
4973 * Complex example::             A multi-component publishing example
4974 @end menu
4976 @node Simple example, Complex example, Sample configuration, Sample configuration
4977 @subsection Example: simple publishing configuration
4979 This example publishes a set of Org-mode files to the @file{public_html}
4980 directory on the local machine.
4982 @lisp
4983 (setq org-publish-project-alist
4984       '(("org" 
4985          :base-directory "~/org/"
4986          :publishing-directory "~/public_html"
4987          :section-numbers nil
4988          :table-of-contents nil
4989          :style "<link rel=stylesheet 
4990                 href=\"../other/mystyle.css\"
4991                 type=\"text/css\">")))
4992 @end lisp
4994 @node Complex example,  , Simple example, Sample configuration
4995 @subsection Example: complex publishing configuration
4997 This more complicated example publishes an entire website, including
4998 org files converted to HTML, image files, emacs lisp source code, and
4999 stylesheets. The publishing-directory is remote and private files are
5000 excluded.
5002 To ensure that links are preserved, care should be taken to replicate
5003 your directory structure on the web server, and to use relative file
5004 paths. For example, if your org files are kept in @file{~/org} and your
5005 publishable images in @file{~/images}, you'd link to an image with
5007 @example
5008 file:../images/myimage.png
5009 @end example
5011 On the web server, the relative path to the image should be the
5012 same. You can accomplish this by setting up an "images" folder in the
5013 right place on the webserver, and publishing images to it.
5015 @lisp
5016 (setq org-publish-project-alist
5017       '(("orgfiles"
5018           :base-directory "~/org/"
5019           :base-extension "org"
5020           :publishing-directory "/ssh:user@@host:~/html/notebook/"
5021           :publishing-function org-publish-org-to-html
5022           :exclude "PrivatePage.org"   ;; regexp
5023           :headline-levels 3
5024           :section-numbers nil
5025           :table-of-contents nil
5026           :style "<link rel=stylesheet 
5027                   href=\"../other/mystyle.css\" type=\"text/css\">"
5028           :auto-preamble t
5029           :auto-postamble nil)
5030          
5031          ("images"
5032           :base-directory "~/images/"
5033           :base-extension "jpg\\|gif\\|png"
5034           :publishing-directory "/ssh:user@@host:~/html/images/"
5035           :publishing-function org-publish-attachment)
5037          ("other"
5038           :base-directory "~/other/"
5039           :base-extension "css\\|el"
5040           :publishing-directory "/ssh:user@@host:~/html/other/"
5041           :publishing-function org-publish-attachment)
5042          ("website" :components ("orgfiles" "images" "other"))))
5043 @end lisp
5045 @node Triggering publication,  , Sample configuration, Publishing
5046 @section Triggering publication
5048 Once org-publish is properly configured, you can publish with the
5049 following functions: 
5051 @table @kbd
5052 @item C-c C-e c
5053 Prompt for a specific project and publish all files that belong to it.
5054 @item C-c C-e p
5055 Publish the project containing the current file.
5056 @item C-c C-e f
5057 Publish only the current file.
5058 @item C-c C-e a
5059 Publish all projects.
5060 @end table
5062 Org uses timestamps to track when a file has changed. The above
5063 functions normally only publish changed files. You can override this and
5064 force publishing of all files by giving a prefix argument.
5066 @node Miscellaneous, Extensions and Hacking, Publishing, Top
5067 @chapter Miscellaneous
5069 @menu
5070 * Completion::                  M-TAB knows what you need
5071 * Customization::               Adapting Org-mode to your taste
5072 * In-buffer settings::          Overview of the #+KEYWORDS
5073 * The very busy C-c C-c key::   When in doubt, press C-c C-c
5074 * Clean view::                  Getting rid of leading stars in the outline
5075 * TTY keys::                    Using Org-mode on a tty
5076 * Interaction::                 Other Emacs packages
5077 * Bugs::                        Things which do not work perfectly
5078 @end menu
5080 @node Completion, Customization, Miscellaneous, Miscellaneous
5081 @section Completion
5082 @cindex completion, of @TeX{} symbols
5083 @cindex completion, of TODO keywords
5084 @cindex completion, of dictionary words
5085 @cindex completion, of option keywords
5086 @cindex completion, of CamelCase links
5087 @cindex completion, of tags
5088 @cindex @TeX{} symbol completion
5089 @cindex TODO keywords completion
5090 @cindex dictionary word completion
5091 @cindex option keyword completion
5092 @cindex CamelCase link completion
5093 @cindex tag completion
5095 Org-mode supports in-buffer completion.  This type of completion does
5096 not make use of the minibuffer.  You simply type a few letters into
5097 the buffer and use the key to complete text right there.
5099 @table @kbd
5100 @kindex M-@key{TAB}
5101 @item M-@key{TAB}
5102 Complete word at point
5103 @itemize @bullet
5104 @item
5105 At the beginning of a headline, complete TODO keywords.
5106 @item
5107 After @samp{\}, complete @TeX{} symbols supported by the exporter.
5108 @item
5109 After @samp{*}, complete headlines in the current buffer so that they
5110 can be used in search links like @samp{[[*find this headline]]}.
5111 @item
5112 After @samp{:}, complete tags.  The list of tags is taken from the
5113 variable @code{org-tag-alist} (possibly set through the @samp{#+TAGS}
5114 in-buffer option, @pxref{Setting tags}), or it is created dynamically
5115 from all tags used in the current buffer.
5116 @item
5117 After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
5118 @item
5119 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
5120 @samp{OPTIONS} which set file-specific options for Org-mode.  When the
5121 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
5122 will insert example settings for this keyword.
5123 @item
5124 In the line after @samp{#+STARTUP: }, complete startup keywords,
5125 i.e. valid keys for this line.
5126 @item
5127 Elsewhere, complete dictionary words using ispell.
5128 @end itemize
5129 @end table
5131 @node Customization, In-buffer settings, Completion, Miscellaneous
5132 @section Customization
5133 @cindex customization
5134 @cindex options, for customization
5135 @cindex variables, for customization
5137 There are more than 170 variables that can be used to customize
5138 Org-mode.  For the sake of compactness of the manual, I am not
5139 describing the variables here.  A structured overview of customization
5140 variables is available with @kbd{M-x org-customize}.  Or select
5141 @code{Browse Org Group} from the @code{Org->Customization} menu.  Many
5142 settings can also be activated on a per-file basis, by putting special
5143 lines into the buffer (@pxref{In-buffer settings}).
5145 @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
5146 @section Summary of in-buffer settings
5147 @cindex in-buffer settings
5148 @cindex special keywords
5150 Org-mode uses special lines in the buffer to define settings on a
5151 per-file basis.  These lines start with a @samp{#+} followed by a
5152 keyword, a colon, and then individual words defining a setting.  Several
5153 setting words can be in the same line, but you can also have multiple
5154 lines for the keyword.  While these settings are described throughout
5155 the manual, here is a summary.  After changing any of those lines in the
5156 buffer, press @kbd{C-c C-c} with the cursor still in the line to
5157 activate the changes immediately.  Otherwise they become effective only
5158 when the file is visited again in a new Emacs session.
5160 @table @kbd
5161 @item #+STARTUP:
5162 This line sets options to be used at startup of org-mode, when an
5163 Org-mode file is being visited.  The first set of options deals with the
5164 initial visibility of the outline tree.  The corresponding variable for
5165 global default settings is @code{org-startup-folded}, with a default
5166 value @code{t}, which means @code{overview}.
5167 @example
5168 overview   @r{top-level headlines only}
5169 content    @r{all headlines}
5170 showall    @r{no folding at all, show everything}
5171 @end example
5172 Then there are options for aligning tables upon visiting a file.  This
5173 is useful in files containing narrowed table columns.  The corresponding
5174 variable is @code{org-startup-align-all-tables}, with a default value
5175 @code{nil}. 
5176 @example
5177 align      @r{align all tables}
5178 noalign    @r{don't align tables on startup}
5179 @end example
5180 Logging when a TODO item is marked DONE (variable @code{org-log-done})
5181 can be configured using these options.
5182 @example
5183 logging    @r{record a timestamp when an item is marked DONE}
5184 nologging  @r{don't record when items are marked DONE}
5185 @end example
5186 Here are the options for hiding leading stars in outline headings.  The
5187 corresponding variables are @code{org-hide-leading-stars} and
5188 @code{org-odd-levels-only}, both with a default setting @code{nil}
5189 (meaning @code{showstars} and @code{oddeven}).
5190 @example
5191 hidestars  @r{make all but one of the stars starting a headline invisible.}
5192 showstars  @r{show all stars starting a headline}
5193 odd        @r{allow only odd outline levels (1,3,...)}
5194 oddeven    @r{allow all outline levels}
5195 @end example
5196 To turn on custom format overlays over time stamps (variables
5197 @code{org-put-time-stamp-overlays} and
5198 @code{org-time-stamp-overlay-formats}), use
5199 @example
5200 customtime @r{overlay custom time format}
5201 @end example
5202 @item #+SEQ_TODO:   #+TYP_TODO:
5203 These lines set the TODO keywords and their interpretation in the
5204 current file.  The corresponding variables are @code{org-todo-keywords}
5205 and @code{org-todo-interpretation}.
5206 @item #+TAGS:  TAG1(c1) TAG2(c2)
5207 These lines (several such lines are allowed) specify the legal tags in
5208 this file, and (potentially) the corresponding @emph{fast tag selection}
5209 keys.  The corresponding variable is @code{org-tag-alist}.
5210 @item #+LINK:  linkword replace
5211 These lines (several are allowed) specify link abbreviations.
5212 @xref{Link abbreviations}.  The corresponding variable is
5213 @code{org-link-abbrev-alist}.
5214 @item #+CATEGORY:
5215 This line sets the category for the agenda file.  The category applies
5216 for all subsequent lines until the next @samp{#+CATEGORY} line, or the
5217 end of the file.
5218 @item #+TBLFM:
5219 This line contains the formulas for the table directly above the line.
5220 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS:
5221 These lines provide settings for exporting files.  For more details see
5222 @ref{Export options}.
5223 @end table
5225 @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
5226 @section The very busy C-c C-c key
5227 @kindex C-c C-c
5228 @cindex C-c C-c, overview
5230 The key @kbd{C-c C-c} has many purposes in org-mode, which are all
5231 mentioned scattered throughout this manual.  One specific function of
5232 this key is to add @emph{tags} to a headline (@pxref{Tags}).  In many
5233 other circumstances it means something like @emph{Hey Org-mode, look
5234 here and update according to what you see here}.  Here is a summary of
5235 what this means in different contexts.
5237 @itemize @minus
5238 @item
5239 If there are highlights in the buffer from the creation of a sparse
5240 tree, or from clock display, remove these highlights.
5241 @item
5242 If the cursor is in one of the special @code{#+KEYWORD} lines, this
5243 triggers scanning the buffer for these lines and updating the
5244 information. 
5245 @item
5246 If the cursor is inside a table, realign the table.  This command
5247 works even if the automatic table editor has been turned off.
5248 @item
5249 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
5250 the entire table.
5251 @item
5252 If the cursor is inside a table created by the @file{table.el} package,
5253 activate that table.
5254 @item
5255 If the current buffer is a remember buffer, close the note and file it.
5256 With a prefix argument, file it, without further interaction, to the
5257 default location.
5258 @item
5259 If the cursor is on a @code{<<<target>>>}, update radio targets and
5260 corresponding links in this buffer.
5261 @item
5262 If the cursor is in a plain list item with a checkbox, toggle the status
5263 of the checkbox.
5264 @item
5265 If the cursor is on a numbered item in a plain list, renumber the
5266 ordered list.
5267 @end itemize
5269 @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
5270 @section A cleaner outline view
5271 @cindex hiding leading stars
5272 @cindex clean outline view
5274 Some people find it noisy and distracting that the Org-mode headlines
5275 are starting with a potentially large number of stars.  For example
5276 the tree from @ref{Headlines}:
5278 @example
5279 * Top level headline
5280 ** Second level
5281 *** 3rd level
5282     some text
5283 *** 3rd level
5284     more text
5285 * Another top level headline
5286 @end example
5288 @noindent
5289 Unfortunately this is deeply ingrained into the code of Org-mode and
5290 cannot be easily changed.  You can, however, modify the display in such
5291 a way that all leading stars become invisible and the outline more easy
5292 to read.  To do this, customize the variable
5293 @code{org-hide-leading-stars} like this:
5295 @lisp
5296 (setq org-hide-leading-stars t)
5297 @end lisp
5299 @noindent
5300 or change this on a per-file basis with one of the lines (anywhere in
5301 the buffer)
5303 @example
5304 #+STARTUP: showstars
5305 #+STARTUP: hidestars
5306 @end example
5308 @noindent
5309 Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
5310 the modifications.
5312 With stars hidden, the tree becomes:
5314 @example
5315 * Top level headline
5316  * Second level
5317   * 3rd level
5318     some text
5319   * 3rd level
5320     more text
5321 * Another top level headline
5322 @end example
5324 @noindent
5325 Note that the leading stars are not truly replaced by whitespace, they
5326 are only fontified with the face @code{org-hide} that uses the
5327 background color as font color.  If you are not using either white or
5328 black background, you may have to customize this face to get the wanted
5329 effect.  Another possibility is to set this font such that the extra
5330 stars are @i{almost} invisible, for example using the color
5331 @code{grey90} on a white background.
5333 Things become cleaner still if you skip all the even levels and use only
5334 odd levels 1, 3, 5..., effectively adding two stars to go from one
5335 outline level to the next:
5337 @example
5338 * Top level headline
5339   * Second level
5340     * 3rd level
5341       some text
5342     * 3rd level
5343       more text
5344 * Another top level headline
5345 @end example
5347 @noindent
5348 In order to make the structure editing and export commands handle this
5349 convention correctly, use
5351 @lisp
5352 (setq org-odd-levels-only t)
5353 @end lisp
5355 @noindent
5356 or set this on a per-file basis with one of the following lines (don't
5357 forget to press @kbd{C-c C-c} with the cursor in the startup line to
5358 activate changes immediately).
5360 @example
5361 #+STARTUP: odd
5362 #+STARTUP: oddeven
5363 @end example
5365 You can convert an Org-mode file from single-star-per-level to the
5366 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
5367 RET} in that file.  The reverse operation is @kbd{M-x
5368 org-convert-to-oddeven-levels}.
5370 @node TTY keys, Interaction, Clean view, Miscellaneous
5371 @section Using org-mode on a tty
5372 @cindex tty keybindings
5374 Org-mode uses a number of keys that are not accessible on a tty.  This
5375 applies to most special keys like cursor keys, @key{TAB} and
5376 @key{RET}, when these are combined with modifier keys like @key{Meta}
5377 and/or @key{Shift}.  Org-mode uses these bindings because it needs to
5378 provide keys for a large number of commands, and because these keys
5379 appeared particularly easy to remember.  In order to still be able to
5380 access the core functionality of Org-mode on a tty, alternative
5381 bindings are provided.  Here is a complete list of these bindings,
5382 which are obviously more cumbersome to use.  Note that sometimes a
5383 work-around can be better.  For example changing a time stamp is
5384 really only fun with @kbd{S-@key{cursor}} keys.  On a tty you would
5385 rather use @kbd{C-c .}  to re-insert the timestamp.
5387 @multitable @columnfractions 0.15 0.2 0.2
5388 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
5389 @item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
5390 @item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
5391 @item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
5392 @item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
5393 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
5394 @item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
5395 @item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
5396 @item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
5397 @item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
5398 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
5399 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
5400 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
5401 @item @kbd{S-@key{left}}    @tab @kbd{C-c C-x @key{left}}  @tab
5402 @item @kbd{S-@key{right}}   @tab @kbd{C-c C-x @key{right}} @tab
5403 @item @kbd{S-@key{up}}      @tab @kbd{C-c C-x @key{up}}    @tab
5404 @item @kbd{S-@key{down}}    @tab @kbd{C-c C-x @key{down}}  @tab
5405 @end multitable
5407 @node Interaction, Bugs, TTY keys, Miscellaneous
5408 @section Interaction with other packages
5409 @cindex packages, interaction with other
5410 Org-mode lives in the world of GNU Emacs and interacts in various ways
5411 with other code out there.
5413 @menu
5414 * Cooperation::                 Packages Org-mode cooperates with
5415 * Conflicts::                   Packages that lead to conflicts
5416 @end menu
5418 @node Cooperation, Conflicts, Interaction, Interaction
5419 @subsection Packages that Org-mode cooperates with
5421 @table @asis
5422 @cindex @file{calc.el}
5423 @item @file{calc.el} by Dave Gillespie
5424 Org-mode uses the calc package for implementing spreadsheet
5425 functionality in its tables (@pxref{Table calculations}).  Org-modes
5426 checks for the availability of calc by looking for the function
5427 @code{calc-eval} which should be autoloaded in your setup if calc has
5428 been installed properly.  As of Emacs 22, calc is part of the Emacs
5429 distribution.  Another possibility for interaction between the two
5430 packages is using calc for embedded calculations. @xref{Embedded Mode,
5431 , Embedded Mode, calc, GNU Emacs Calc Manual}.
5432 @cindex @file{constants.el}
5433 @item @file{constants.el} by Carsten Dominik
5434 In a table formula (@pxref{Table calculations}), it is possible to use
5435 names for natural constants or units.  Instead of defining your own
5436 constants in the variable @code{org-table-formula-constants}, install
5437 the @file{constants} package which defines a large number of constants
5438 and units, and lets you use unit prefixes like @samp{M} for
5439 @samp{Mega} etc.  You will need version 2.0 of this package, available
5440 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org-mode checks for
5441 the function @code{constants-get}, which has to be autoloaded in your
5442 setup.  See the installation instructions in the file
5443 @file{constants.el}.
5444 @item @file{cdlatex.el} by Carsten Dominik
5445 @cindex @file{cdlatex.el}
5446 Org-mode can make use of the cdlatex package to efficiently enter
5447 La@TeX{} fragments into Org-mode files. See @ref{CDLaTeX mode}.
5448 @item @file{remember.el} by John Wiegley
5449 @cindex @file{remember.el}
5450 Org mode cooperates with remember, see @ref{Remember}.
5451 @file{Remember.el} is not part of Emacs, find it on the web.
5452 @cindex @file{table.el}
5453 @item @file{table.el} by Takaaki Ota
5454 Org mode cooperates with table.el, see @ref{table.el}.  @file{table.el}
5455 is part of Emacs 22.
5456 @end table
5458 @node Conflicts,  , Cooperation, Interaction
5459 @subsection Packages that lead to conflicts with Org-mode
5461 @table @asis
5463 @cindex @file{allout.el}
5464 @item @file{allout.el} by Ken Manheimer
5465 Startup of Org-mode may fail with the error message
5466 @code{(wrong-type-argument keymapp nil)} when there is an outdated
5467 version @file{allout.el} on the load path, for example the version
5468 distributed with Emacs 21.x.  Upgrade to Emacs 22 and this problem will
5469 disappear.  If for some reason you cannot do this, make sure that org.el
5470 is loaded @emph{before} @file{allout.el}, for example by putting
5471 @code{(require 'org)} early enough into your @file{.emacs} file.
5473 @cindex @file{CUA.el}
5474 @item @file{CUA.el} by Kim. F. Storm
5475 Keybindings in Org-mode conflict with the @kbd{S-<cursor>} keys
5476 used by CUA-mode (as well as pc-select-mode and s-region-mode) to
5477 select and extend the region.  If you want to use one of these
5478 packages along with Org-mode, configure the variable
5479 @code{org-CUA-compatible}.  When set, Org-mode will move the following
5480 keybindings in org-mode files, and in the agenda buffer (but not
5481 during date selection).
5483 @example
5484 S-UP    -> M-p             S-DOWN  -> M-n
5485 S-LEFT  -> M--             S-RIGHT -> M-+
5486 S-RET   -> C-S-RET
5487 @end example
5489 Yes, these are unfortunately more difficult to remember.  If you want
5490 to have other replacement keys, look at the variable
5491 @code{org-disputed-keys}.
5492 @item @file{windmove.el} by Hovav Shacham
5493 @cindex @file{windmove.el}
5494 Also this package uses the @kbd{S-<cursor>} keys, so everything written
5495 in the paragraph above about CUA mode also applies here.
5496 @end table
5499 @node Bugs,  , Interaction, Miscellaneous
5500 @section Bugs
5501 @cindex bugs
5503 Here is a list of things that should work differently, but which I
5504 have found too hard to fix.
5506 @itemize @bullet
5507 @item
5508 If a table field starts with a link, and if the corresponding table
5509 column is narrowed (@pxref{Narrow columns}) to a width too small to
5510 display the link, the field would look entirely empty even though it is
5511 not.  To prevent this, Org-mode throws an error.  The work-around is to
5512 make the column wide enough to fit the link, or to add some text (at
5513 least 2 characters) before the link in the same field.
5514 @item
5515 Narrowing table columns does not work on XEmacs, because the
5516 @code{format} function does not transport text properties.
5517 @item
5518 Text in an entry protected with the @samp{QUOTE} keyword should not
5519 autowrap.
5520 @item
5521 When the application called by @kbd{C-c C-o} to open a file link fails
5522 (for example because the application does not exist or refuses to open
5523 the file), it does so silently.  No error message is displayed.
5524 @item
5525 Recalculating a table line applies the formulas from left to right.
5526 If a formula uses @emph{calculated} fields further down the row,
5527 multiple recalculation may be needed to get all fields consistent.
5528 @item
5529 A single letter cannot be made bold, for example @samp{*a*}.
5530 @item
5531 The exporters work well, but could be made more efficient.
5532 @end itemize
5535 @node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
5536 @appendix Extensions, Hooks and Hacking
5538 This appendix lists extensions for Org-mode written by other authors.
5539 It also covers some aspects where users can extend the functionality of
5540 Org-mode.
5542 @menu
5543 * Extensions::                  Existing 3rd-part extensions
5544 * Dynamic blocks::              Automatically filled blocks
5545 * Special agenda views::        
5546 @end menu
5548 @node Extensions, Dynamic blocks, Extensions and Hacking, Extensions and Hacking
5549 @section Third-party extensions for Org-mode
5551 The following extensions for Org-mode have been written by other people:
5553 @table @asis
5554 @cindex @file{org-publish.el}
5555 @item @file{org-publish.el} by David O'Toole
5556 This package provides facilities for publishing related sets of Org-mode
5557 files together with linked files like images as a webpages.  It is
5558 highly configurable and can be used for other publishing purposes as
5559 well.  As of Org-mode version 4.30, @file{org-publish.el} is part of the
5560 Org-mode distribution.  It is not yet part of Emacs, however, a delay
5561 caused by the preparations for the 22.1 release.  In the mean time,
5562 @file{org-publish.el} can be downloaded from David's site:
5563 @url{http://dto.freeshell.org/e/org-publish.el}.
5564 @cindex @file{org-mouse.el}
5565 @item @file{org-mouse.el} by Piotr Zielinski
5566 This package implements extended mouse functionality for Org-mode.  It
5567 allows you to cycle visibility and to edit the document structure with
5568 the mouse.  Best of all, it provides a context-sensitive menu on
5569 @key{mouse-3} that changes depending on the context of a mouse-click.
5570 As of Org-mode version 4.53, @file{org-mouse.el} is part of the
5571 Org-mode distribution.  It is not yet part of Emacs, however, a delay
5572 caused by the preparations for the 22.1 release.  In the mean time,
5573 @file{org-mouse.el} can be downloaded from Piotr's site:
5574 @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}.
5575 @cindex @file{org-blog.el}
5576 @item @file{org-blog.el} by David O'Toole
5577 A blogging plug-in for @file{org-publish.el}.@*
5578 @url{http://dto.freeshell.org/notebook/OrgMode.html}.
5579 @cindex @file{blorg.el}
5580 @item @file{blorg.el} by  Bastien Guerry
5581 Publish Org-mode files as
5582 blogs. @url{http://www.cognition.ens.fr/~guerry/blorg.html}.
5583 @end table
5585 @node Dynamic blocks, Special agenda views, Extensions, Extensions and Hacking
5586 @section Dynamic blocks
5588 Org-mode documents can contain @emph{dynamic blocks}.  These are
5589 specially marked regions that are updated by some user-written
5590 function.  A good example for such a block is the clock table inserted
5591 by the command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
5593 Dynamic block are enclosed by a BEGIN-END structure that assigns a name
5594 to the block and can also specify parameters for the function producing
5595 the content of the block.
5597 @example
5598 #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
5600 #+END:
5601 @end example
5603 Dynamic blocks are updated with the following commands
5605 @table @kbd
5606 @kindex C-c C-x C-u
5607 @item C-c C-x C-u
5608 Update dynamic block at point.
5609 @kindex C-u C-c C-x C-u
5610 @item C-u C-c C-x C-u
5611 Update all dynamic blocks in the current file.
5612 @end table
5614 Updating a dynamic block means to remove all the text between BEGIN and
5615 END, parse the BEGIN line for parameters and then call the specific
5616 writer function for this block to insert the new content.  For a block
5617 with name @code{myblock}, the writer function is
5618 @code{org-dblock-write:myblock} with as only parameter a property list
5619 with the parameters given in the begin line.  Here is a trivial example
5620 of a block that keeps track of when the block update function was last
5621 run:
5623 @example
5624 #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
5626 #+END:
5627 @end example
5629 @noindent
5630 The corresponding block writer function could look like this:
5632 @lisp
5633 (defun org-dblock-write:block-update-time (params)
5634    (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
5635      (insert "Last block update at: "
5636              (format-time-string fmt (current-time)))))
5637 @end lisp
5639 If you want to make sure that all dynamic blocks are always up-to-date,
5640 you could add the function @code{org-update-all-dblocks} to a hook, for
5641 example @code{before-save-hook}.  @code{org-update-all-dblocks} is
5642 written in a way that is does nothing in buffers that are not in Org-mode.
5644 @node Special agenda views,  , Dynamic blocks, Extensions and Hacking
5645 @section Special Agenda Views
5647 Org-mode provides a special hook that can be used to narrow down the
5648 selection made by any of the agenda views.  You may specify a function
5649 that is used at each match to verify if the match should indeed be part
5650 of the agenda view, and if not, how much should be skipped.
5652 Let's say you want to produce a list of projects that contain a WAITING
5653 tag anywhere in the project tree.  Let's further assume that you have
5654 marked all tree headings that define a project with the todo keyword
5655 PROJECT.  In this case you would run a todo search for the keyword
5656 PROJECT, but skip the match unless there is a WAITING tag anywhere in
5657 the subtree belonging to the project line..
5659 To achieve this, you must write a function that searches the subtree for
5660 the tag.  If the tag is found, the function must return @code{nil} to
5661 indicate that this match should not be skipped.  If there is no such
5662 tag, return the location of the end of the subtree, to indicate that
5663 search should continue from there.
5665 @lisp
5666 (defun my-skip-unless-waiting ()
5667   "Skip trees that are not waiting"
5668   (let ((subtree-end (save-excursion (org-end-of-subtree t))))
5669     (if (re-search-forward ":WAITING:" subtree-end t)
5670         nil          ; tag found, do not skip
5671       subtree-end))) ; tag not found, continue after end of subtree
5672 @end lisp
5674 Furthermore you must write a command that uses @code{let} to temporarily
5675 puts this function into the variable @code{org-agenda-skip-function},
5676 sets the header string for the agenda buffer, and calls the todo-list
5677 generator while asking for the specific TODO keyword PROJECT.  The
5678 function must also accept one argument MATCH, but it can choose to
5679 ignore it@footnote{MATCH must be present in case you want to define a
5680 custom command for producing this special list.  Custom commands always
5681 supply the MATCH argument, but it can be empty if you do not specify it
5682 while defining the command(@pxref{Custom agenda
5683 views}).} (as we do in the example below).  Here is the example:
5685 @lisp
5686 (defun my-org-waiting-projects (&optional match)
5687   "Produce a list of projects that contain a WAITING tag.
5688 MATCH is being ignored."
5689   (interactive)
5690   (let ((org-agenda-skip-function 'my-skip-unless-waiting)
5691         (org-agenda-overriding-header "Projects waiting for something: "))
5692     ;; make the list
5693     (org-todo-list "PROJECT")))
5694 @end lisp
5697 @node History and Acknowledgments, Index, Extensions and Hacking, Top
5698 @appendix History and Acknowledgments
5699 @cindex acknowledgments
5700 @cindex history
5701 @cindex thanks
5703 Org-mode was borne in 2003, out of frustration over the user interface
5704 of the Emacs outline-mode.  All I wanted was to make working with an
5705 outline tree possible without having to remember more than 10 commands
5706 just for hiding and unhiding parts of the outline tree, and to allow to
5707 restructure a tree easily.  Visibility cycling and structure editing
5708 were originally implemented in the package @file{outline-magic.el}, but
5709 quickly moved to the more general @file{org.el}.  TODO entries, basic
5710 time stamps, and table support were added next, and highlight the two
5711 main goals that Org-mode still has today: To create a new,
5712 outline-based, plain text mode with innovative and intuitive editing
5713 features, and to incorporate project planning functionality directly
5714 into a notes file.
5716 Since the first release, hundreds of emails to me or on
5717 @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
5718 reports, feedback, new ideas, and sometimes even patches and add-on
5719 code.  Many thanks to everyone who has helped to improve this package.
5720 I am trying to keep here a list of the people who had significant
5721 influence in shaping one or more aspects of Org-mode.  The list may not
5722 be complete, if I have forgotten someone, please accept my apologies and
5723 let me know.
5725 @itemize @bullet
5727 @item
5728 @i{Thomas Baumann} contributed the code for links to the MH-E email
5729 system.
5730 @item
5731 @i{Alex Bochannek} provided a patch for rounding time stamps.
5732 @item
5733 @i{Charles Cave}'s suggestion sparked the implementation of templates
5734 for Remember.
5735 @item
5736 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
5737 specified time.
5738 @item
5739 @i{Gregory Chernov} patched support for lisp forms into table
5740 calculations and improved XEmacs compatibility, in particular by porting
5741 @file{nouline.el} to XEmacs.
5742 @item
5743 @i{Sacha Chua} suggested to copy some linking code from Planner.
5744 @item
5745 @i{Eddward DeVilla} proposed and tested checkbox statistics.
5746 @item
5747 @i{Kees Dullemond} inspired the use of narrowed tabled columns.
5748 @item
5749 @i{Christian Egli} converted the documentation into TeXInfo format,
5750 patched CSS formatting into the HTML exporter, and inspired the agenda.
5751 @item
5752 @i{Nic Ferrier} contributed mailcap and XOXO support.
5753 @item
5754 @i{Niels Giessen} had the idea to automatically archive DONE trees.
5755 @item
5756 @i{Bastien Guerry} provided extensive feedback.
5757 @item
5758 @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
5759 @item
5760 @i{Leon Liu} asked for embedded LaTeX and tested it.
5761 @item
5762 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
5763 happy.
5764 @item
5765 @i{Todd Neal} provided patches for links to Info files and elisp forms.
5766 @item
5767 @i{Tim O'Callaghan} suggested in-file links, search options for general
5768 file links, and TAGS.
5769 @item
5770 @i{Oliver Oppitz} suggested multi-state TODO items.
5771 @item
5772 @i{Scott Otterson} sparked the introduction of descriptive text for
5773 links, among other things.
5774 @item
5775 @i{Pete Phillips} helped during the development of the TAGS feature, and
5776 provided frequent feedback.
5777 @item
5778 @i{T.V. Raman} reported bugs and suggested improvements.
5779 @item
5780 @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
5781 control.
5782 @item
5783 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
5784 @item
5785 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
5786 conflict with @file{allout.el}.
5787 @item
5788 @i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords.
5789 @item
5790 @i{Philip Rooke} created the Org-mode reference card and provided lots
5791 of feedback.
5792 @item
5793 @i{Christian Schlauer} proposed angular brackets around links, among
5794 other things.
5795 @item
5796 Linking to VM/BBDB/GNUS was inspired by @i{Tom Shannon}'s
5797 @file{organizer-mode.el}.
5798 @item
5799 @i{Daniel Sinder} came up with the idea of internal archiving by locking
5800 subtrees.
5801 @item
5802 @i{Dale Smith} proposed link abbreviations.
5803 @item
5804 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
5805 chapter about publishing.
5806 @item
5807 @i{J@"urgen Vollmer} contributed code generating the table of contents
5808 in HTML output.
5809 @item
5810 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
5811 keyword.
5812 @item
5813 @i{David Wainberg} suggested archiving, and improvements to the linking
5814 system.
5815 @item
5816 @i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}.  The
5817 development of Org-mode was fully independent, and both systems are
5818 really different beasts in their basic ideas and implementation details.
5819 I later looked at John's code, however, and learned from his
5820 implementation of (i) links where the link itself is hidden and only a
5821 description is shown, and (ii) popping up a calendar to select a date.
5822 @item
5823 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
5824 linking to GNUS.
5825 @item
5826 @i{Roland Winkler} requested additional keybindings to make Org-mode
5827 work on a tty.
5828 @item
5829 @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
5830 and contributed various ideas and code snippets.
5831 @end itemize
5834 @node Index, Key Index, History and Acknowledgments, Top
5835 @unnumbered Index
5837 @printindex cp
5839 @node Key Index,  , Index, Top
5840 @unnumbered Key Index
5842 @printindex ky
5844 @bye
5846 @ignore
5847    arch-tag: 7893d1fe-cc57-4d13-b5e5-f494a1bcc7ac
5848 @end ignore