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