Release 4.36
[org-mode.git] / org.texi
blob27970a1aea89acbf71d2676cc06d93c5b4412698
1 \input texinfo
3 @c %**start of header
4 @setfilename ../info/org
5 @settitle Org Mode Manual
7 @set VERSION 4.36
8 @set DATE June 2006
10 @dircategory Emacs
11 @direntry
12 * Org Mode: (org).      outline-based notes management and organizer
13 @end direntry
15 @c Version and Contact Info
16 @set MAINTAINERSITE @uref{http://www.astro.uva.nl/~dominik/Tools/org/,maintainers webpage}
17 @set AUTHOR Carsten Dominik
18 @set MAINTAINER Carsten Dominik
19 @set MAINTAINEREMAIL @email{dominik@@science.uva.nl}
20 @set MAINTAINERCONTACT @uref{mailto:dominik@@science.uva.nl,contact the maintainer}
21 @c %**end of header
22 @finalout
24 @c Macro definitions
26 @c Subheadings inside a table.
27 @macro tsubheading{text}
28 @ifinfo
29 @subsubheading \text\
30 @end ifinfo
31 @ifnotinfo
32 @item @b{\text\}
33 @end ifnotinfo
34 @end macro
36 @copying
37 This manual is for Org-mode (version @value{VERSION}).
39 Copyright @copyright{} 2004, 2005, 2006 Free Software Foundation
41 @quotation
42 Permission is granted to copy, distribute and/or modify this document
43 under the terms of the GNU Free Documentation License, Version 1.1 or
44 any later version published by the Free Software Foundation; with no
45 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
46 and with the Back-Cover Texts as in (a) below.  A copy of the
47 license is included in the section entitled ``GNU Free Documentation
48 License.''
50 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
51 this GNU Manual, like GNU software.  Copies published by the Free
52 Software Foundation raise funds for GNU development.''
53 @end quotation
54 @end copying
56 @titlepage
57 @title Org Mode Manual
59 @subtitle Release @value{VERSION}
60 @author by Carsten Dominik
62 @c The following two commands start the copyright page.
63 @page
64 @vskip 0pt plus 1filll
65 @insertcopying
66 @end titlepage
68 @c Output the table of contents at the beginning.
69 @contents
71 @ifnottex
72 @node Top, Introduction, (dir), (dir)
73 @top Org Mode Manual
75 @insertcopying
76 @end ifnottex
78 @menu
79 * Introduction::                Getting started
80 * Document structure::          A tree works like your brain
81 * Tables::                      Pure magic for quick formatting
82 * Hyperlinks::                  Notes in context
83 * TODO items::                  Every tree branch can be a TODO item
84 * Timestamps::                  Assign date and time to items
85 * Tags::                        Tagging headlines and matching sets of tags
86 * Agenda views::                Collecting information into views
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 * Index::                       The fast road to specific information
91 * Key Index::                   Key bindings and where they are described
93 @detailmenu
94  --- The Detailed Node Listing ---
96 Introduction
98 * Summary::                     Brief summary of what Org-mode does
99 * Installation and activation::  How to install Org-mode
100 * Feedback::                    Bug reports, ideas, patches etc.
102 Document Structure
104 * Outlines::                    Org-mode is based on outline-mode
105 * Headlines::                   How to typeset org-tree headlines
106 * Visibility cycling::          Show and hide, much simplified
107 * Motion::                      Jumping to other headlines
108 * Structure editing::           Changing sequence and level of headlines
109 * Archiving::                   Move done task trees to a different place
110 * Sparse trees::                Matches embedded in context
111 * Plain lists::                 Editing hand-formatted lists
113 Tables
115 * Built-in table editor::       Simple tables
116 * Narrow columns::              Stop wasting space in tables   
117 * Table calculations::          Compute a field from other fields
118 * orgtbl-mode::                 The table editor as minor mode
119 * table.el::                    Complex tables
121 Calculations in tables
123 * Formula syntax::              How to write a formula
124 * Lisp formulas::               An alternative way to write formulas
125 * Column formulas::             Formulas valid for all fields in a column
126 * Advanced features::           Field names, parameters and automatic recalc
127 * Named-field formulas::        Formulas valid in single fields
128 * Editing/debugging formulas::  Changing a stored formula
129 * Appetizer::                   Taste the power of calc
131 Hyperlinks
133 * Link format::                 How links in Org-mode are formatted
134 * Internal links::              Links to other places in the current file
135 * External links::              URL-like links to the world
136 * Handling links::              Creating, inserting and following
137 * Search options::              Linking to a specific location
138 * Custom searches::             When the default search is not enough
139 * Remember::                    Org-trees store quick notes
141 Internal links
143 * Radio targets::               Make targets trigger links in plain text.
144 * CamelCase links::             Activating CamelCase words as links
146 TODO items
148 * TODO basics::                 Marking and displaying TODO entries
149 * Progress logging::            Document your productivity
150 * TODO extensions::             Workflow and assignments
151 * Priorities::                  Some things are more important than others
153 Extended use of TODO keywords
155 * Workflow states::             From TODO to DONE in steps
156 * TODO types::                  I do this, Fred the rest
157 * Per file keywords::           Different files, different requirements
159 Timestamps
161 * Time stamps::                 Assigning a time to a tree entry
162 * Creating timestamps::         Commands which insert timestamps
164 Tags
166 * Tag inheritance::             Tags use the tree structure of the outline
167 * Setting tags::                How to assign tags to a headline
168 * Tag searches::                Searching for combinations of tags
170 Agenda Views
172 * Agenda files::                Files being searched for agenda information
173 * Agenda dispatcher::           Keyboard access to agenda views
174 * Weekly/Daily agenda::         The calendar page with current tasks
175 * Global TODO list::            All unfinished action items
176 * Matching headline tags::      Structured information with fine-tuned search
177 * Timeline::                    Time-sorted view for single file
178 * Agenda commands::             Remote editing of org trees
180 The weekly/daily agenda
182 * Categories::                  Not all tasks are equal
183 * Time-of-day specifications::  How the agenda knows the time
184 * Calendar/Diary integration::  Integrating Anniversaries and more
185 * Sorting of agenda items::     The order of things
187 Exporting
189 * ASCII export::                Exporting to plain ASCII
190 * HTML export::                 Exporting to HTML
191 * XOXO export::                 Exporting to XOXO
192 * iCalendar export::            Exporting in iCalendar format
193 * Text interpretation::         How the exporter looks at the file
195 Text interpretation by the exporter
197 * Comment lines::               Some lines will not be exported
198 * Enhancing text::              Subscripts, symbols and more
199 * Export options::              How to influence the export settings
201 Publishing
203 * Configuration::               Defining projects
204 * Sample configuration::        Example projects
205 * Triggering publication::      Publication commands
207 Configuration
209 * Project alist::               The central configuration variable
210 * File sources and destinations::  From here to there
211 * Selecting files::             What files are part of the project?
212 * Publishing action::           Setting the function doing the publishing
213 * Publishing options::          Tweaking HTML export
214 * Publishing links::            Which links keep working after publishing?
215 * Project page index::          Publishing a list of project files
217 Sample configuration
219 * Simple example::              One-component publishing
220 * Complex example::             A multi-component publishing example
222 Miscellaneous
224 * Completion::                  M-TAB knows what you need
225 * Customization::               Adapting Org-mode to your taste
226 * Summary of in-buffer settings::  Using special lines to set options
227 * The very busy C-c C-c key::   When in doubt, press C-c C-c
228 * Clean view::                  Getting rid of leading stars in the outline
229 * TTY keys::                    Using Org-mode on a tty
230 * FAQ::                         Frequently asked questions
231 * Interaction::                 Other Emacs packages
232 * Bugs::                        Things which do not work perfectly
233 * Acknowledgments::             These people provided feedback and more
235 Interaction with other packages
237 * Extensions::                  Third-party extensions for Org-mode
238 * Cooperation::                 Packages Org-mode cooperates with
239 * Conflicts::                   Packages that lead to conflicts
241 @end detailmenu
242 @end menu
244 @node Introduction, Document structure, Top, Top
245 @chapter Introduction
246 @cindex introduction
248 @menu
249 * Summary::                     Brief summary of what Org-mode does
250 * Installation and activation::  How to install Org-mode
251 * Feedback::                    Bug reports, ideas, patches etc.
252 @end menu
254 @node Summary, Installation and activation, Introduction, Introduction
255 @section Summary
256 @cindex summary
258 Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
259 project planning with a fast and effective plain-text system.
261 Org-mode develops organizational tasks around NOTES files that contain
262 information about projects as plain text.  Org-mode is implemented on
263 top of outline-mode, which makes it possible to keep the content of
264 large files well structured.  Visibility cycling and structure editing
265 help to work with the tree.  Tables are easily created with a built-in
266 table editor.  Org-mode supports ToDo items, deadlines, time stamps,
267 and scheduling.  It dynamically compiles entries into an agenda that
268 utilizes and smoothly integrates much of the Emacs calendar and diary.
269 Plain text URL-like links connect to websites, emails, Usenet
270 messages, BBDB entries, and any files related to the projects.  For
271 printing and sharing of notes, an Org-mode file can be exported as a
272 structured ASCII file, as HTML, or (todo and agenda items only) as an
273 iCalendar file.  It can also serve as a publishing tool for a set of
274 linked webpages.
276 Org-mode keeps simple things simple.  When first fired up, it should
277 feel like a straightforward, easy to use outliner.  Complexity is not
278 imposed, but a large amount of functionality is available when you need
279 it.  Org-mode can be used on different levels and in different ways, for
280 example:
282 @example
283 @r{@bullet{} as an outline extension with visibility cycling and structure editing}
284 @r{@bullet{} as an ASCII system and table editor for taking structured notes}
285 @r{@bullet{} as an ASCII table editor with spreadsheet-like capabilities}
286 @r{@bullet{} as a TODO list editor}
287 @r{@bullet{} as a full agenda and planner with deadlines and work scheduling}
288 @r{@bullet{} as a simple hypertext system, with HTML export}
289 @r{@bullet{} as a publishing tool to create a set of interlinked webpages}
290 @end example
292 The Org-mode table editor can be integrated into any major mode by
293 activating the minor Orgtbl-mode.
295 There is a website for Org-mode which provides links to the newest
296 version of Org-mode, as well as additional information, screen shots
297 and example files.  This page is located at
298 @uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
300 @page
302 @node Installation and activation, Feedback, Summary, Introduction
303 @section Installation and Activation
304 @cindex installation
305 @cindex autoload
306 @cindex global keybindings
307 @cindex keybindings, global
309 If Org-mode is part of the Emacs distribution or an XEmacs package,
310 you only need to copy the following lines to your @file{.emacs} file.
311 The last two lines define @emph{global} keys for the commands
312 @command{org-store-link} and @command{org-agenda} - please
313 choose suitable keys yourself.
315 @lisp
316 ;; The following lines are always needed.  Choose your own keys.
317 (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
318 (define-key global-map "\C-cl" 'org-store-link)
319 (define-key global-map "\C-ca" 'org-agenda)
320 @end lisp
322 Furthermore, you must activate @code{font-lock-mode} in org-mode
323 buffers, because significant functionality depends on font-locking being
324 active.  You can do this with either one of the following two lines:
325 @lisp
326 (global-font-lock-mode 1)                     ; for all buffers
327 (add-hook 'org-mode-hook 'turn-on-font-lock)  ; org-mode buffers only
328 @end lisp
330 If you have downloaded Org-mode from the Web, you must take additional
331 action:  Byte-compile @file{org.el} and @file{org-publish.el} and put
332 them together with @file{org-install.el} on your load path.  Then add to
333 @file{.emacs}:
335 @lisp
336 ;; This line only if org-mode is not part of the X/Emacs distribution.
337 (require 'org-install)
338 @end lisp
340 @cindex org-mode, turning on
341 With this setup, all files with extension @samp{.org} will be put into
342 Org-mode.  As an alternative, make the first line of a file look like
343 this:
345 @example
346 MY PROJECTS    -*- mode: org; -*-
347 @end example
349 @noindent which will select Org-mode for this buffer no matter what
350 the file's name is.  See also the variable
351 @code{org-insert-mode-line-in-empty-file}.
353 @node Feedback,  , Installation and activation, Introduction
354 @section Feedback
355 @cindex feedback
356 @cindex bug reports
357 @cindex maintainer
358 @cindex author
360 If you find problems with Org-mode, or if you have questions, remarks,
361 or ideas about it, please contact the maintainer @value{MAINTAINER} at
362 @value{MAINTAINEREMAIL}.
364 For bug reports, please provide as much information as possible,
365 including the version information of Emacs (@kbd{C-h v emacs-version
366 @key{RET}}) and Org-mode (@kbd{C-h v org-version @key{RET}}), as well as
367 the Org-mode related setup in @file{.emacs}.  If an error occurs, a
368 traceback can be very useful.  Often a small example file helps, along
369 with clear information about:
371 @enumerate
372 @item What exactly did you do?
373 @item What did you expect to happen?
374 @item What happened instead?
375 @end enumerate
376 @noindent Thank you for helping to improve this mode.
378 @node Document structure, Tables, Introduction, Top
379 @chapter Document Structure
380 @cindex document structure
381 @cindex structure of document
383 Org-mode is based on outline mode and provides flexible commands to
384 edit the structure of the document.
386 @menu
387 * Outlines::                    Org-mode is based on outline-mode
388 * Headlines::                   How to typeset org-tree headlines
389 * Visibility cycling::          Show and hide, much simplified
390 * Motion::                      Jumping to other headlines
391 * Structure editing::           Changing sequence and level of headlines
392 * Archiving::                   Move done task trees to a different place
393 * Sparse trees::                Matches embedded in context
394 * Plain lists::                 Editing hand-formatted lists
395 @end menu
397 @node Outlines, Headlines, Document structure, Document structure
398 @section Outlines
399 @cindex outlines
400 @cindex outline-mode
402 Org-mode is implemented on top of outline-mode.  Outlines allow to
403 organize a document in a hierarchical structure, which (at least for
404 me) is the best representation of notes and thoughts.  Overview over
405 this structure is achieved by folding (hiding) large parts of the
406 document to show only the general document structure and the parts
407 currently being worked on.  Org-mode greatly simplifies the use of
408 outlines by compressing the entire show/hide functionality into a
409 single command @command{org-cycle}, which is bound to the @key{TAB}
410 key.
412 @node Headlines, Visibility cycling, Outlines, Document structure
413 @section Headlines
414 @cindex headlines
415 @cindex outline tree
417 Headlines define the structure of an outline tree.  The headlines in
418 Org-mode start with one or more stars, on the left margin.  For
419 example:
421 @example
422 * Top level headline
423 ** Second level
424 *** 3rd level
425     some text
426 *** 3rd level
427     more text
428 * Another top level headline
429 @end example
431 @noindent Some people find the many stars too noisy and would prefer an
432 outline that has whitespace followed by a single star as headline
433 starters.  @ref{Clean view} describes a setup to realize this.
435 @node Visibility cycling, Motion, Headlines, Document structure
436 @section Visibility cycling
437 @cindex cycling, visibility
438 @cindex visibility cycling
439 @cindex trees, visibility
440 @cindex show hidden text
441 @cindex hide text
443 Outlines make it possible to hide parts of the text in the buffer.
444 Org-mode uses just two commands, bound to @key{TAB} and
445 @kbd{S-@key{TAB}} to change the visibility in the buffer.
447 @cindex subtree visibility states
448 @cindex subtree cycling
449 @cindex folded, subtree visibility state
450 @cindex children, subtree visibility state
451 @cindex subtree, subtree visibility state
452 @table @kbd
453 @kindex @key{TAB}
454 @item @key{TAB}
455 @emph{Subtree cycling}: Rotate current subtree between the states
457 @example
458 ,-> FOLDED -> CHILDREN -> SUBTREE --.
459 '-----------------------------------'
460 @end example
462 The cursor must be on a headline for this to work@footnote{see, however,
463 the option @code{org-cycle-emulate-tab}.}.  When the cursor is at the
464 beginning of the buffer and the first line is not a headline, then
465 @key{TAB} actually runs global cycling (see below)@footnote{see the
466 option @code{org-cycle-global-at-bob}.}.  Also when called with a prefix
467 argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
469 @cindex global visibility states
470 @cindex global cycling
471 @cindex overview, global visibility state
472 @cindex contents, global visibility state
473 @cindex show all, global visibility state
474 @kindex S-@key{TAB}
475 @item S-@key{TAB}
476 @itemx C-u @key{TAB}
477 @emph{Global cycling}: Rotate the entire buffer between the states
479 @example
480 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
481 '--------------------------------------'
482 @end example
484 Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field.
486 @cindex show all, command
487 @kindex C-c C-a
488 @item C-c C-a
489 Show all.
490 @end table
492 When Emacs first visits an Org-mode file, the global state is set to
493 OVERVIEW, i.e. only the top level headlines are visible.  This can be
494 configured through the variable @code{org-startup-folded}, or on a
495 per-file basis by adding one of the following lines anywhere in the
496 buffer:
498 @example
499 #+STARTUP: overview
500 #+STARTUP: content
501 #+STARTUP: showall
502 @end example
504 @node Motion, Structure editing, Visibility cycling, Document structure
505 @section Motion
506 @cindex motion, between headlines
507 @cindex jumping, to headlines
508 @cindex headline navigation
509 The following commands jump to other headlines in the buffer.
511 @table @kbd
512 @kindex C-c C-n
513 @item C-c C-n
514 Next heading.
515 @kindex C-c C-p
516 @item C-c C-p
517 Previous heading.
518 @kindex C-c C-f
519 @item C-c C-f
520 Next heading same level.
521 @kindex C-c C-b
522 @item C-c C-b
523 Previous heading same level.
524 @kindex C-c C-u
525 @item C-c C-u
526 Backward to higher level heading.
527 @kindex C-c C-j
528 @item C-c C-j
529 Jump to a different place without changing the current outline
530 visibility.  Shows the document structure in a temporary buffer, where
531 you can use visibility cycling (@key{TAB}) to find your destination.
532 After pressing @key{RET}, the cursor moves to the selected location in
533 the original buffer, and the headings hierarchy above it is made
534 visible.
535 @end table
537 @node Structure editing, Archiving, Motion, Document structure
538 @section Structure editing
539 @cindex structure editing
540 @cindex headline, promotion and demotion
541 @cindex promotion, of subtrees
542 @cindex demotion, of subtrees
543 @cindex subtree, cut and paste
544 @cindex pasting, of subtrees
545 @cindex cutting, of subtrees
546 @cindex copying, of subtrees
547 @cindex subtrees, cut and paste
549 @table @kbd
550 @kindex M-@key{RET}
551 @item M-@key{RET}
552 Insert new heading with same level as current.  If the cursor is in a
553 plain list item, a new item is created (@pxref{Plain lists}).  To force
554 creation of a new headline, use a prefix arg, or first press @key{RET}
555 to get to the beginning of the next line.  When this command is used in
556 the middle of a line, the line is split and the rest of the line becomes
557 the new headline.  If the command is used at the beginning of a
558 headline, the new headline is created before the current line.  If at
559 the beginning of any other line, the content of that line is made the
560 new heading.
561 @kindex M-S-@key{RET}
562 @item M-S-@key{RET}
563 Insert new TODO entry with same level as current heading.
564 @kindex M-@key{left}
565 @item M-@key{left}
566 Promote current heading by one level.
567 @kindex M-@key{right}
568 @item M-@key{right}
569 Demote current heading by one level.
570 @kindex M-S-@key{left}
571 @item M-S-@key{left}
572 Promote the current subtree by one level.
573 @kindex M-S-@key{right}
574 @item M-S-@key{right}
575 Demote the current subtree by one level.
576 @kindex M-S-@key{up}
577 @item M-S-@key{up}
578 Move subtree up (swap with previous subtree of same
579 level).
580 @kindex M-S-@key{down}
581 @item M-S-@key{down}
582 Move subtree down (swap with next subtree of same level).
583 @kindex C-c C-x C-w
584 @kindex C-c C-x C-k
585 @item C-c C-x C-w
586 @itemx C-c C-x C-k
587 Kill subtree, i.e. remove it from buffer but save in kill ring.
588 @kindex C-c C-x M-w
589 @item C-c C-x M-w
590 Copy subtree to kill ring.
591 @kindex C-c C-x C-y
592 @item C-c C-x C-y
593 Yank subtree from kill ring.  This does modify the level of the subtree to
594 make sure the tree fits in nicely at the yank position.  The yank
595 level can also be specified with a prefix arg, or by yanking after a
596 headline marker like @samp{****}.
597 @end table
599 @cindex region, active
600 @cindex active region
601 @cindex transient-mark-mode
602 When there is an active region (transient-mark-mode), promotion and
603 demotion work on all headlines in the region.  To select a region of
604 headlines, it is best to place both point and mark at the beginning of a
605 line, mark at the beginning of the first headline, and point at the line
606 just after the last headline to change.  Note that when the cursor is
607 inside a table (@pxref{Tables}), the Meta-Cursor keys have different
608 functionality.
610 @node Archiving, Sparse trees, Structure editing, Document structure
611 @section Archiving
612 @cindex archiving
613 @cindex filing subtrees
615 When a project represented by a (sub)tree is finished, you may want
616 to move the tree to an archive place, either in the same file under a
617 special top-level heading, or even to a different file.
618 @table @kbd
619 @kindex C-c $
620 @item @kbd{C-c $}
621 Archive the subtree starting at the cursor position to the location
622 given by @code{org-archive-location}.
623 @end table
625 @cindex archive locations
626 The default archive is a file in the same directory as the current
627 file, with the name derived by appending @file{_archive} to the
628 current file name.  For information and examples on how to change
629 this, see the documentation string of the variable
630 @code{org-archive-location}.  If you are also using the Org-mode
631 agenda, archiving to a different file is a good way to keep archived
632 trees from contributing agenda items.
634 @node Sparse trees, Plain lists, Archiving, Document structure
635 @section Sparse trees
636 @cindex sparse trees
637 @cindex trees, sparse
638 @cindex folding, sparse trees
639 @cindex occur, command
641 An important feature of Org-mode is the ability to construct
642 @emph{sparse trees} for selected information in an outline tree.  A
643 sparse tree means that the entire document is folded as much as
644 possible, but the selected information is made visible along with the
645 headline structure above it@footnote{See also the variables
646 @code{org-show-hierarchy-above} and
647 @code{org-show-following-heading}.}.  Just try it out and you will see
648 immediately how it works.
650 Org-mode contains several commands creating such trees.  The most
651 basic one is @command{org-occur}:
653 @table @kbd
654 @kindex C-c /
655 @item C-c /
656 Occur.  Prompts for a regexp and shows a sparse tree with all matches.
657 If the match is in a headline, the headline is made visible.  If the
658 match is in the body of an entry, headline and body are made visible.
659 In order to provide minimal context, also the full hierarchy of
660 headlines above the match is shown, as well as the headline following
661 the match.  Each match is also highlighted; the highlights disappear
662 when the buffer is changed with an editing command.
663 @end table
664 @noindent
665 For frequently used sparse trees of specific search strings, you can
666 use the variable @code{org-agenda-custom-commands} to define fast
667 keyboard access to specific sparse trees.  These commands will then be
668 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
669 For example:
671 @lisp
672 (setq org-agenda-custom-commands
673       '(("f" occur-tree "FIXME")))
674 @end lisp
676 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
677 a sparse tree matching the string @samp{FIXME}.
679 Other commands use sparse trees as well.  For example @kbd{C-c
680 C-v} creates a sparse TODO tree (@pxref{TODO basics}).
682 @kindex C-c C-x v
683 @cindex printing sparse trees
684 @cindex visible text, printing
685 To print a sparse tree, you can use the Emacs command
686 @code{ps-print-buffer-with-faces} which does not print invisible parts
687 of the document @footnote{This does not work under XEmacs, because
688 XEmacs uses selective display for outlining, not text properties.}.
689 Or you can use the command @kbd{C-c C-x v} to export only the visible
690 part of the document and print the resulting file.
693 @node Plain lists,  , Sparse trees, Document structure
694 @section Plain lists
695 @cindex plain lists
696 @cindex lists, plain
697 @cindex lists, ordered
698 @cindex ordered lists
700 Headlines define both the structure of the Org-mode file, and also lists
701 (for example, TODO items (@pxref{TODO items}) should be created using
702 headline levels).  When taking notes, however, the plain text is
703 sometimes easier to read with hand-formatted lists.  Org-mode supports
704 editing such lists, and the HTML exporter (@pxref{Exporting}) does
705 parse and format them.
707 Org-mode knows ordered and unordered lists.  Unordered list items start
708 with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
709 bullet, lines must be indented or they will be seen as top-level
710 headlines.  Also, when you are hiding leading stars to get a clean
711 outline view, plain list items starting with a star are visually
712 indistinguishable from true headlines.  In short: even though @samp{*}
713 is supported, it may be better not to use it for plain list items} as
714 bullets.  Ordered list items start with @samp{1.} or @samp{1)}.  Items
715 belonging to the same list must have the same indentation on the first
716 line.  In particular, if an ordered list reaches number @samp{10.}, then
717 the 2--digit numbers must be written left-aligned with the other numbers
718 in the list.  Indentation also determines the end of a list item.  It
719 ends before the next line that is indented like the bullet/number, or
720 less.  For example:
722 @example
723 @group
724 ** Lord of the Rings
725 My favorite scenes are (in this order)
726 1. Eowyns fight with the witch king
727    + this was already my favorite scene in the book
728    + I really like Miranda Otto.
729 2. The attack of the Rohirrim
730 3. Peter Jackson being shot by Legolas
731     - on DVD only
732    He makes a really funny face when it happens.
733 But in the end, not individual scenes matter but the film as a whole.
734 @end group
735 @end example
737 Org-mode supports these lists by tuning filling and wrapping commands
738 to deal with them correctly.  
740 @cindex checkboxes
741 Every item in a plain list can be made a checkbox by starting it with
742 the string @samp{[ ]}.  The checkbox status can conveniently be toggled
743 with @kbd{C-c C-c}.
745 @example
746 * Stupid mistakes when distributing a new version
747   - [ ] update also Emacs CVS
748   - [X] forget to update index.html on the website
749   - [X] leaving a `(debug)' form in the code
750 @end example
752 The following commands act on items when the cursor is in the first line
753 of an item (the line with the bullet or number).
755 @table @kbd
756 @kindex @key{TAB}
757 @item @key{TAB}
758 Items can be folded just like headline levels if you set the variable
759 @code{org-cycle-include-plain-lists}.  The level of an item is then
760 given by the indentation of the bullet/number.  Items are always
761 subordinate to real headlines, however; the hierarchies remain
762 completely separated.
763 @kindex M-@key{RET}
764 @item M-@key{RET}
765 Insert new item at current level.  With prefix arg, force a new heading
766 (@pxref{Structure editing}).  If this command is used in the middle of a
767 line, the line is @emph{split} and the rest of the line becomes the new
768 item.  If this command is executed in the @emph{whitespace before a bullet or
769 number}, the new item is created @emph{before} the current item.  If the
770 command is executed in the white space before the text that is part of
771 an item but does not contain the bullet, a bullet is added to the
772 current line.
773 @kindex M-S-@key{RET}
774 @item M-S-@key{RET}
775 Insert a new item with a checkbox.
776 @kindex S-@key{up}
777 @kindex S-@key{down}
778 @item S-@key{up}
779 @itemx S-@key{down}
780 Jump to the previous/next item in the current list.
781 @kindex M-S-@key{up}
782 @kindex M-S-@key{down}
783 @item M-S-@key{up}
784 @itemx M-S-@key{down}
785 Move the item including subitems up/down (swap with previous/next item
786 of same indentation).  If the list is ordered, renumbering is
787 automatic.
788 @kindex M-S-@key{left}
789 @kindex M-S-@key{right}
790 @item M-S-@key{left}
791 @itemx M-S-@key{right}
792 Decrease/increase the indentation of the item, including subitems.
793 Initially, the item tree is selected based on current indentation.
794 When these commands are executed several times in direct succession,
795 the initially selected region is used, even if the new indentation
796 would imply a different hierarchy.  To use the new hierarchy, break
797 the command chain with a cursor motion or so.
798 @kindex C-c C-c
799 @item C-c C-c
800 If there is a checkbox in the item line, toggle the state of the
801 checkbox.  Otherwise, if this is an ordered list, renumber the ordered
802 list at the cursor.
803 @end table
805 @node Tables, Hyperlinks, Document structure, Top
806 @chapter Tables
807 @cindex tables
808 @cindex editing tables
810 Org-mode has a very fast and intuitive table editor built-in.
811 Spreadsheet-like calculations are supported in connection with the
812 Emacs @file{calc} package.
814 @menu
815 * Built-in table editor::       Simple tables
816 * Narrow columns::              Stop wasting space in tables   
817 * Table calculations::          Compute a field from other fields
818 * orgtbl-mode::                 The table editor as minor mode
819 * table.el::                    Complex tables
820 @end menu
822 @node Built-in table editor, Narrow columns, Tables, Tables
823 @section The built-in table editor
824 @cindex table editor, builtin
826 Org-mode makes it easy to format tables in plain ASCII.  Any line with
827 @samp{|} as the first non-white character is considered part of a
828 table.  @samp{|} is also the column separator.  A table might look
829 like this:
831 @example
832 | Name  | Phone | Age |
833 |-------+-------+-----|
834 | Peter |  1234 |  17 |
835 | Anna  |  4321 |  25 |
836 @end example
838 A table is re-aligned automatically each time you press @key{TAB} or
839 @key{RET} or @kbd{C-c C-c} inside the table.  @key{TAB} also moves to
840 the next field (@key{RET} to the next row) and creates new table rows
841 at the end of the table or before horizontal lines.  The indentation
842 of the table is set by the first line.  Any line starting with
843 @samp{|-} is considered as a horizontal separator line and will be
844 expanded on the next re-align to span the whole table width.  So, to
845 create the above table, you would only type
847 @example
848 |Name|Phone|Age
850 @end example
852 @noindent and then press @key{TAB} to align the table and start filling in
853 fields.
855 When typing text into a field, Org-mode treats @key{DEL},
856 @key{Backspace}, and all character keys in a special way, so that
857 inserting and deleting avoids shifting other fields.  Also, when
858 typing @emph{immediately after the cursor was moved into a new field
859 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
860 field is automatically made blank.  If this behavior is too
861 unpredictable for you, configure the variables
862 @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
864 @table @kbd
865 @tsubheading{Creation and conversion}
866 @kindex C-c |
867 @item C-c |
868 Convert the active region to table. If every line contains at least one
869 TAB character, the function assumes that the material is tab separated.
870 If not, lines are split at whitespace into fields.  You can use a prefix
871 argument to indicate the minimum number of consecutive spaces required
872 to identify a field separator (default: just one).@* 
873 If there is no active region, this command creates an empty Org-mode
874 table.  But it's easier just to start typing, like
875 @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
877 @tsubheading{Re-aligning and field motion}
878 @kindex C-c C-c
879 @item C-c C-c
880 Re-align the table without moving the cursor.
882 @kindex @key{TAB}
883 @item @key{TAB}
884 Re-align the table, move to the next field.  Creates a new row if
885 necessary.
887 @kindex S-@key{TAB}
888 @item S-@key{TAB}
889 Re-align, move to previous field.
891 @kindex @key{RET}
892 @item @key{RET}
893 Re-align the table and move down to next row.  Creates a new row if
894 necessary.  At the beginning or end of a line, @key{RET} still does
895 NEWLINE, so it can be used to split a table.
897 @tsubheading{Column and row editing}
898 @kindex M-@key{left}
899 @kindex M-@key{right}
900 @item M-@key{left}
901 @itemx M-@key{right}
902 Move the current column left/right.
904 @kindex M-S-@key{left}
905 @item M-S-@key{left}
906 Kill the current column.
908 @kindex M-S-@key{right}
909 @item M-S-@key{right}
910 Insert a new column to the left of the cursor position.
912 @kindex M-@key{up}
913 @kindex M-@key{down}
914 @item M-@key{up}
915 @itemx M-@key{down}
916 Move the current row up/down.
918 @kindex M-S-@key{up}
919 @item M-S-@key{up}
920 Kill the current row or horizontal line.
922 @kindex M-S-@key{down}
923 @item M-S-@key{down}
924 Insert a new row above (with arg: below) the current row.
926 @kindex C-c -
927 @item C-c -
928 Insert a horizontal line below current row. With prefix arg, the line
929 is created above the current line.
931 @kindex C-c ^
932 @item C-c ^
933 Sort the table lines in the region.  Point and mark must be in the first
934 and last line to be included, and must be in the column that should be
935 used for sorting.  The command prompts for numerical versus
936 alphanumerical sorting.
938 @tsubheading{Regions}
939 @kindex C-c C-x M-w
940 @item C-c C-x M-w
941 Copy a rectangular region from a table to a special clipboard.  Point
942 and mark determine edge fields of the rectangle.  The process ignores
943 horizontal separator lines.
944 @kindex C-c C-x C-w
945 @item C-c C-x C-w
946 Copy a rectangular region from a table to a special clipboard, and
947 blank all fields in the rectangle.  So this is the ``cut'' operation.
948 @kindex C-c C-x C-y
949 @item C-c C-x C-y
950 Paste a rectangular region into a table.
951 The upper right corner ends up in the current field.  All involved fields
952 will be overwritten.  If the rectangle does not fit into the present table,
953 the table is enlarged as needed.  The process ignores horizontal separator
954 lines.
955 @kindex C-c C-q
956 @item C-c C-q
957 Wrap several fields in a column like a paragraph.  If there is an active
958 region, and both point and mark are in the same column, the text in the
959 column is wrapped to minimum width for the given number of lines.  A
960 prefix ARG may be used to change the number of desired lines.  If there
961 is no region, the current field is split at the cursor position and the
962 text fragment to the right of the cursor is prepended to the field one
963 line down. If there is no region, but you specify a prefix ARG, the
964 current field is made blank, and the content is appended to the field
965 above.
967 @tsubheading{Calculations}
968 @cindex formula, in tables
969 @cindex calculations, in tables
970 @kindex C-c =
971 @item C-c =
972 Install a new formula for the current column and replace current field
973 with the result of the formula.
975 @kindex C-u C-c =
976 @item C-u C-c =
977 Install a new formula for the current field, which must be a named
978 field.  Evaluate the formula and replace the field content with the
979 result.
981 @kindex C-c '
982 @item C-c '
983 Edit all formulas associated with the current table in a separate
984 buffer.
986 @kindex C-c *
987 @item C-c *
988 Recalculate the current row by applying the stored formulas from left
989 to right.  When called with a @kbd{C-u} prefix, recalculate the
990 entire table, starting with the first non-header line (i.e. below the
991 first horizontal separator line).  For details, see @ref{Table calculations}.
993 @kindex C-#
994 @item C-#
995 Rotate the calculation mark in first column through the states
996 @samp{}, @samp{#}, @samp{*}, @samp{!}, @samp{$}.  For the meaning of
997 these marks see @ref{Advanced features}.  When there is an active
998 region, change all marks in the region.
1000 @kindex C-c ?
1001 @item C-c ?
1002 Which table column is the cursor in?  Displays number >0 in echo
1003 area.
1005 @cindex region, active
1006 @cindex active region
1007 @cindex transient-mark-mode
1008 @kindex C-c +
1009 @item C-c +
1010 Sum the numbers in the current column, or in the rectangle defined by
1011 the active region.  The result is shown in the echo area and can
1012 be inserted with @kbd{C-y}.
1014 @kindex S-@key{RET}
1015 @item S-@key{RET}
1016 When current field is empty, copy from first non-empty field above.
1017 When not empty, copy current field down to next row and move cursor
1018 along with it.  Depending on the variable
1019 @code{org-table-copy-increment}, integer field values will be
1020 incremented during copy.  This key is also used by CUA-mode
1021 (@pxref{Cooperation}).
1023 @tsubheading{Miscellaneous}
1024 @kindex C-c `
1025 @item C-c `
1026 Edit the current field in a separate window.  This is useful for fields
1027 that are not fully visible (@pxref{Narrow columns}).  When called with a
1028 @kbd{C-u} prefix, just make the full field visible, so that it can be
1029 edited in place.
1031 @kindex C-c @key{TAB}
1032 @item C-c @key{TAB}
1033 This is an alias for @kbd{C-u C-c `} to make the current field fully
1034 visible.
1036 @item M-x org-table-import
1037 Import a file as a table.  The table should be TAB- or whitespace
1038 separated.  Useful, for example, to import an Excel table or data from a
1039 database, because these programs generally can write TAB-separated text
1040 files.  This command works by inserting the file into the buffer and
1041 then converting the region to a table.  Any prefix argument is passed on
1042 to the converter, which uses it to determine the separator.
1044 @item M-x org-table-export
1045 Export the table as a TAB-separated file.  Useful for data exchange with,
1046 for example, Excel or database programs.
1048 @end table
1050 If you don't like the automatic table editor because it gets in your
1051 way on lines which you would like to start with @samp{|}, you can turn
1052 it off with
1054 @lisp
1055 (setq org-enable-table-editor nil)
1056 @end lisp
1058 @noindent Then the only table command that still works is
1059 @kbd{C-c C-c} to do a manual re-align.
1061 @node Narrow columns, Table calculations, Built-in table editor, Tables
1062 @section Narrow columns
1063 @cindex narrow columns in tables
1065 The width of columns is automatically determined by the table editor.
1066 Sometimes a single field or a few fields need to carry more text,
1067 leading to inconveniently wide columns.  To limit@footnote{This feature
1068 does not work on XEmacs.} the width of a column, one field anywhere in
1069 the column may contain just the string @samp{<N>} where @samp{N} is an
1070 integer specifying the width of the column in characters.  The next
1071 re-align will then set the width of this column to no more than this
1072 value.
1074 @example
1075 |---+------------------------------|               |---+--------|
1076 |   |                              |               |   | <6>    |
1077 | 1 | one                          |               | 1 | one    |
1078 | 2 | two                          |     ----\     | 2 | two    |
1079 | 3 | This is a long chunk of text |     ----/     | 3 | This=> |
1080 | 4 | four                         |               | 4 | four   |
1081 |---+------------------------------|               |---+--------|
1082 @end example
1084 @noindent
1085 Fields that are wider become clipped and end in the string @samp{=>}.
1086 Note that the full text is still in the buffer, it is only invisible.
1087 To see the full text, hold the mouse over the field - a tooltip window
1088 will show the full content.  To edit such a field, use the command
1089 @kbd{C-c `} (that is @kbd{C-c} followed by the backquote).  This will
1090 open a new window with the full field.  Edit it and finish with @kbd{C-c
1091 C-c}.
1093 When visiting a file containing a table with narrowed columns, the
1094 necessary character hiding has not yet happened, and the table needs to
1095 be aligned before it looks nice.  Setting the option
1096 @code{org-startup-align-all-tables} will realign all tables in a file
1097 upon visiting, but also slow down startup.  You can also set this option
1098 on a per-file basis with:
1100 @example
1101 #+STARTUP: align
1102 #+STARTUP: noalign
1103 @end example
1105 @node Table calculations, orgtbl-mode, Narrow columns, Tables
1106 @section Calculations in tables
1107 @cindex calculations, in tables
1108 @cindex spreadsheet capabilities
1109 @cindex @file{calc} package
1111 The table editor makes use of the Emacs @file{calc} package to implement
1112 spreadsheet-like capabilities.  It can also evaluate Emacs Lisp forms to
1113 derive fields from other fields.  Org-mode has two levels of complexity
1114 for table calculations.  On the basic level, tables do only horizontal
1115 computations, so a field can be computed from other fields @emph{in the
1116 same row}, and Org-mode assumes that there is only one formula for each
1117 column.  This is very efficient to work with and enough for many tasks.
1118 On the complex level, columns and individual fields can be named for
1119 easier referencing in formulas, individual named fields can have their
1120 own formula associated with them, and recalculation can be automated.
1122 @menu
1123 * Formula syntax::              How to write a formula
1124 * Lisp formulas::               An alternative way to write formulas
1125 * Column formulas::             Formulas valid for all fields in a column
1126 * Advanced features::           Field names, parameters and automatic recalc
1127 * Named-field formulas::        Formulas valid in single fields
1128 * Editing/debugging formulas::  Changing a stored formula
1129 * Appetizer::                   Taste the power of calc
1130 @end menu
1132 @node Formula syntax, Lisp formulas, Table calculations, Table calculations
1133 @subsection Formula syntax
1134 @cindex formula syntax
1135 @cindex syntax, of formulas
1137 A formula can be any algebraic expression understood by the Emacs
1138 @file{calc} package.  Note that @file{calc} has the slightly
1139 non-standard convention that @samp{/} has lower precedence than
1140 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.  Before
1141 evaluation by @code{calc-eval} (@pxref{Calling Calc from Your
1142 Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU Emacs
1143 Calc Manual}), variable substitution takes place:
1145 @example
1146   $        @r{refers to the current field}
1147   $3       @r{refers to the field in column 3 of the current row}
1148   $3..$7   @r{a vector of the fields in columns 3-7 of current row}
1149   $P1..$P3 @r{vector of column range, using column names}
1150   &2       @r{second data field above the current, in same column}
1151   &5-2     @r{vector from fifth to second field above current}
1152   &III-II  @r{vector of fields between 2nd and 3rd hline above}
1153   &III     @r{vector of fields between third hline above and current field}
1154   $name    @r{a named field, parameter or constant}
1155 @end example
1157 @cindex vectors, in table calculations
1158 The range vectors can be directly fed into the calc vector functions
1159 like @samp{vmean} and @samp{vsum}.
1161 @cindex name, of column or field
1162 @cindex constants, in calculations
1163 @samp{$name} is interpreted as the name of a column, parameter or
1164 constant.  Constants are defined globally through the variable
1165 @code{org-table-formula-constants}.  If you have the
1166 @file{constants.el} package, it will also be used to resolve
1167 constants, including natural constants like @samp{$h} for Planck's
1168 constant, and units like @samp{$km} for kilometers.  Column names and
1169 parameters can be specified in special table lines.  These are
1170 described below, see @ref{Advanced features}.
1172 @cindex format specifier
1173 @cindex mode, for @file{calc}
1174 A formula can contain an optional mode string after a semicolon.  This
1175 string consists of flags to influence calc's modes@footnote{By
1176 default, Org-mode uses the standard calc modes (precision 12, angular
1177 units degrees, fraction and symbolic modes off).  The display format,
1178 however, has been changed to @code{(float 5)} to keep tables compact.
1179 The default settings can be configured using the variable
1180 @code{org-calc-default-modes}.} during execution, e.g.  @samp{p20} to
1181 switch the internal precision to 20 digits, @samp{n3}, @samp{s3},
1182 @samp{e2} or @samp{f4} to switch to normal, scientific, engineering,
1183 or fixed display format, respectively, and @samp{D}, @samp{R}, @samp{F},
1184 and @samp{S} to turn on degrees, radians, fraction and symbolic modes,
1185 respectively.  In addition, you may provide a @code{printf} format
1186 specifier to reformat the final result.  A few examples:
1188 @example
1189 $1+$2                @r{Sum of first and second field}
1190 $1+$2;%.2f           @r{Same, format result to two decimals}
1191 exp($2)+exp($1)      @r{Math functions can be used}
1192 $;%.1f               @r{Reformat current cell to 1 decimal}
1193 ($3-32)*5/9          @r{Degrees F -> C conversion}
1194 $c/$1/$cm            @r{Hz -> cm conversion, using @file{constants.el}}
1195 tan($1);Dp3s1        @r{Compute in degrees, precision 3, display SCI 1}
1196 sin($1);Dp3%.1e      @r{Same, but use printf specifier for display}
1197 vmean($2..$7)        @r{Compute column range mean, using vector function}
1198 vsum(&III)           @r{Sum numbers from 3rd hline above, up to here}
1199 taylor($3,x=7,2)     @r{taylor series of $3, at x=7, second degree}
1200 @end example
1202 @node Lisp formulas, Column formulas, Formula syntax, Table calculations
1203 @subsection Emacs Lisp forms as formulas
1204 @cindex Lisp forms, as table formulas
1206 It is also possible to write a formula in Emacs lisp; this can be useful
1207 for string manipulation and control structures.  If a formula starts
1208 with a single quote followed by an opening parenthesis, then it is
1209 evaluated as a lisp form.  The evaluation should return either a string
1210 or a number.  Just as with @file{calc} formulas, you can provide a
1211 format specifier after a semicolon.  A few examples:
1213 @example
1214 @r{swap the first two characters of the content of column 1}
1215 '(concat (substring "$1" 1 2) (substring "$1" 0 1) (substring "$1" 2))
1216 @r{Add columns 1 and 2, equivalent to the calc's @code{$1+$2}}
1217 '(+ $1 $2)
1218 @end example
1220 @node Column formulas, Advanced features, Lisp formulas, Table calculations
1221 @subsection Column formulas
1222 @cindex column formula
1223 @cindex formula, for table column
1225 To apply a formula to a field, type it directly into the field,
1226 preceded by an equal sign, like @samp{=$1+$2}.  When you press
1227 @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
1228 field, the formula will be stored as the formula for the current
1229 column, evaluated and the current field replaced with the result.  If
1230 the field contains only @samp{=}, the previously stored formula for
1231 this column is used.
1233 For each column, Org-mode will remember the most recently used
1234 formula.  The information is stored in a special line starting with
1235 @samp{#+TBLFM} directly below the table.  When adding/deleting/moving
1236 columns with the appropriate commands, the stored equations will be
1237 modified accordingly.  When a column used in a calculation is removed,
1238 references to this column become invalid and will cause an error upon
1239 applying the equation.
1241 Instead of typing an equation into the field, you may also use the
1242 command @kbd{C-c =}.  It prompts for a formula (with default taken
1243 from the @samp{#+TBLFM:} line) and applies it to the current field.  A
1244 numerical prefix (e.g. @kbd{C-5 C-c =}) will apply it to that many
1245 consecutive fields in the current column.
1247 @cindex recomputing table fields
1248 To recompute all the fields in a line, use the command @kbd{C-c *}.
1249 It re-applies all stored equations to the current row, from left to
1250 right.  With a @kbd{C-u} prefix, this will be done to every line in
1251 the table, so use this command it you want to make sure the entire
1252 table is up-to-date. @kbd{C-u C-c C-c} is another way to update the
1253 entire table.  Global updating does not touch the line(s) above the
1254 first horizontal separator line, assuming that this is the table
1255 header.
1257 @node Advanced features, Named-field formulas, Column formulas, Table calculations
1258 @subsection Advanced features
1260 If you want the recalculation of fields to happen automatically,
1261 or if you want to be able to assign a formula to an individual field
1262 (instead of an entire column) you need to reserve the first column of
1263 the table for special marking characters.  Here is an example of a
1264 table that collects exam results of students and makes use of these
1265 features:
1267 @example
1268 @group
1269 |---+---------+--------+--------+--------+-------+------|
1270 |   | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
1271 |---+---------+--------+--------+--------+-------+------|
1272 | ! |         |     P1 |     P2 |     P3 |   Tot |      |
1273 | # | Maximum |     10 |     15 |     25 |    50 | 10.0 |
1274 | ^ |         |     m1 |     m2 |     m3 |    mt |      |
1275 |---+---------+--------+--------+--------+-------+------|
1276 | # | Peter   |     10 |      8 |     23 |    41 |  8.2 |
1277 | # | Sara    |      6 |     14 |     19 |    39 |  7.8 |
1278 | # | Sam     |      2 |      4 |      3 |     9 |  1.8 |
1279 |---+---------+--------+--------+--------+-------+------|
1280 |   | Average |        |        |        |  29.7 |      |
1281 | ^ |         |        |        |        |    at |      |
1282 | $ | max=50  |        |        |        |       |      |
1283 |---+---------+--------+--------+--------+-------+------|
1284 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(&II);%.1f
1285 @end group
1286 @end example
1288 @noindent @b{Important}: Please note that for these special tables,
1289 recalculating the table with @kbd{C-u C-c *} will only affect rows
1290 that are marked @samp{#} or @samp{*}, and named fields.  The column
1291 formulas are not applied in rows with empty first field.
1293 @cindex marking characters, tables
1294 The marking characters have the following meaning:
1295 @table @samp
1296 @item !
1297 The fields in this line define names for the columns, so that you may
1298 refer to a column as @samp{$Tot} instead of @samp{$6}.
1299 @item ^
1300 This row defines names for the fields @emph{above} the row.  With such
1301 a definition, any formula in the table may use @samp{$m1} to refer to
1302 the value @samp{10}.  Also, named fields can have their own formula
1303 associated with them.
1304 @item _
1305 Similar to @samp{^}, but defines names for the fields in the row
1306 @emph{below}.
1307 @item $
1308 Fields in this row can define @emph{parameters} for formulas.  For
1309 example, if a field in a @samp{$} row contains @samp{max=50}, then
1310 formulas in this table can refer to the value 50 using @samp{$max}.
1311 Parameters work exactly like constants, only that they can be defined on
1312 a per-table basis.  Changing a parameter and then recalculating the
1313 table can be useful.
1314 @item #
1315 Fields in this row are automatically recalculated when pressing
1316 @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row.  Also, this row
1317 is selected for a global recalculation with @kbd{C-u C-c *}.  Unmarked
1318 lines will be left alone by this command.
1319 @item *
1320 Selects this line for global recalculation with @kbd{C-u C-c *}, but
1321 not for automatic recalculation.  Use this when automatic
1322 recalculation slows down editing too much.
1323 @item
1324 Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
1325 All lines that should be recalculated should be marked with @samp{#}
1326 or @samp{*}.
1327 @end table
1329 @node Named-field formulas, Editing/debugging formulas, Advanced features, Table calculations
1330 @subsection Named-field formulas
1331 @cindex named field formula
1332 @cindex formula, for named table field
1334 A named field can have its own formula associated with it.  In the
1335 example above, this is used for the @samp{at} field that contains
1336 the average result of the students.  To enter a formula for a named
1337 field, just type it into the buffer, preceded by @samp{:=}.  Or use
1338 @kbd{C-u C-c =}.  This equation will be stored below the table like
1339 @samp{$name=...}.  Any recalculation in the table (even if only
1340 requested for the current line) will also update all named field
1341 formulas.
1343 @node Editing/debugging formulas, Appetizer, Named-field formulas, Table calculations
1344 @subsection Editing and debugging formulas
1345 @cindex formula editing
1346 @cindex editing, of table formulas
1348 To edit a column or field formula, use the commands @kbd{C-c
1349 =} and @kbd{C-u C-c =}, respectively.  The currently active expression
1350 is then presented as default in the minibuffer, where it may be edited.
1352 Note that making a table field blank does not remove the formula
1353 associated with the field - during the next recalculation the field
1354 will be filled again.  To remove a formula from a field, you have to
1355 give an empty reply when prompted for the formula, or to edit the
1356 @samp{#+TBLFM} line.
1358 @kindex C-c C-c
1359 You may edit the @samp{#+TBLFM} directly and re-apply
1360 the changed equations with @kbd{C-c C-c} in that line, or with the
1361 normal recalculation commands in the table.
1363 @kindex C-c '
1364 @kindex C-c C-c
1365 @kindex C-c C-q
1366 @kindex C-c ?
1367 In particular for large tables with many formulas, it is convenient to
1368 use the command @kbd{C-c '} to edit the formulas of the current table
1369 in a separate buffer.  That buffer will show the formulas one per
1370 line, and you are free to edit, add and remove formulas.  Press
1371 @kbd{C-c ?} on a @samp{$...}  expression to get information about its
1372 interpretation.  Exiting the buffer with @kbd{C-c C-c} only stores the
1373 modified formulas below the table.  Exiting with @kbd{C-u C-c C-c}
1374 also applies them to the entire table.  @kbd{C-c C-q} exits without
1375 installing the changes.
1377 When the evaluation of a formula leads to an error, the field content
1378 becomes the string @samp{#ERROR}.  If you would like see what is going
1379 on during variable substitution and calculation in order to find a
1380 bug, turn on formula debugging in the menu and repeat the calculation,
1381 for example by pressing @kbd{C-c = @key{RET}} in a field.
1382 Detailed information will be displayed.
1384 @node Appetizer,  , Editing/debugging formulas, Table calculations
1385 @subsection Appetizer
1387 Finally, just to whet your appetite on what can be done with the fantastic
1388 @file{calc} package, here is a table that computes the Taylor series
1389 for a couple of functions (homework: try that with Excel :-)
1391 @example
1392 @group
1393 |---+-------------+---+-----+--------------------------------------|
1394 |   | Func        | n | x   | Result                               |
1395 |---+-------------+---+-----+--------------------------------------|
1396 | # | exp(x)      | 1 | x   | 1 + x                                |
1397 | # | exp(x)      | 2 | x   | 1 + x + x^2 / 2                      |
1398 | # | exp(x)      | 3 | x   | 1 + x + x^2 / 2 + x^3 / 6            |
1399 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
1400 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2    |
1401 | * | tan(x)      | 3 | x   | 0.0175 x + 1.77e-6 x^3               |
1402 |---+-------------+---+-----+--------------------------------------|
1403 #+TBLFM: $5=taylor($2,$4,$3);n3
1404 @end group
1405 @end example
1407 @node orgtbl-mode, table.el, Table calculations, Tables
1408 @section The Orgtbl minor mode
1409 @cindex orgtbl-mode
1410 @cindex minor mode for tables
1412 If you like the intuitive way the Org-mode table editor works, you
1413 might also want to use it in other modes like text-mode or mail-mode.
1414 The minor mode Orgtbl-mode makes this possible.  You can always toggle
1415 the mode with @kbd{M-x orgtbl-mode}.  To turn it on by default, for
1416 example in mail mode, use
1418 @lisp
1419 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
1420 @end lisp
1422 @node table.el,  , orgtbl-mode, Tables
1423 @section The @file{table.el} package
1424 @kindex C-c C-c
1425 @cindex table editor, @file{table.el}
1426 @cindex @file{table.el}
1428 Complex ASCII tables with automatic line wrapping, column- and
1429 row-spanning, and alignment can be created using the Emacs table
1430 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
1431 and also part of Emacs 22).
1432 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org-mode
1433 will call @command{table-recognize-table} and move the cursor into the
1434 table.  Inside a table, the keymap of Org-mode is inactive.  In order
1435 to execute Org-mode-related commands, leave the table.
1437 @table @kbd
1438 @kindex C-c C-c
1439 @item C-c C-c
1440 Recognize @file{table.el} table.  Works when the cursor is in a
1441 table.el table.
1443 @kindex C-c ~
1444 @item C-c ~
1445 Insert a table.el table.  If there is already a table at point, this
1446 command converts it between the table.el format and the Org-mode
1447 format.  See the documentation string of the command
1448 @code{org-convert-table} for the restrictions under which this is
1449 possible.
1450 @end table
1452 @node Hyperlinks, TODO items, Tables, Top
1453 @chapter Hyperlinks
1454 @cindex hyperlinks
1456 Just like HTML, Org-mode provides links inside a file, and external
1457 links to other files, Usenet articles, emails, and much more.
1459 @menu
1460 * Link format::                 How links in Org-mode are formatted
1461 * Internal links::              Links to other places in the current file
1462 * External links::              URL-like links to the world
1463 * Handling links::              Creating, inserting and following
1464 * Search options::              Linking to a specific location
1465 * Custom searches::             When the default search is not enough
1466 * Remember::                    Org-trees store quick notes
1467 @end menu
1469 @node Link format, Internal links, Hyperlinks, Hyperlinks
1470 @section Link format
1471 @cindex link format
1472 @cindex format, of links
1474 Org-mode will recognize plain URL-like links and activate them as
1475 clickable links.  The general link format, however, looks like this:
1477 @example
1478 [[link][description]]       @r{or alternatively}           [[link]]  
1479 @end example
1481 Once a link in the buffer is complete (all brackets present), Org-mode
1482 will change the display so that @samp{description} is displayed instead
1483 of @samp{[[link][description]]} and @samp{link} is displayed instead of
1484 @samp{[[link]]}.  Links will be highlighted in the face @code{org-link},
1485 which by default is an underlined face.  You can directly edit the
1486 visible part of a link.  Note that this can be either the @samp{link}
1487 part (if there is no description) or the @samp{description} part.  To
1488 edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
1489 cursor on the link.
1491 If you place the cursor at the beginning or just behind the end of the
1492 displayed text and press @key{BACKSPACE}, you will remove the
1493 (invisible) bracket at that location.  This makes the link incomplete
1494 and the internals are again displayed as plain text.  Inserting the
1495 missing bracket hides the link internals again.  To show the
1496 internal structure of all links, use the menu entry
1497 @code{Org->Hyperlinks->Literal links}.
1499 @node Internal links, External links, Link format, Hyperlinks
1500 @section Internal links
1501 @cindex internal links
1502 @cindex links, internal
1503 @cindex CamelCase links
1505 If the link does not look like a URL, it is considered to be internal in
1506 the current file.  Links such as @samp{[[My Target]]} or @samp{[[My
1507 Target][Find my target]]} lead to a text search in the current file.
1508 The link can be followed with @kbd{C-c C-o} when the cursor is on the
1509 link, or with a mouse click (@pxref{Handling links}).  The preferred
1510 match for such a link is a dedicated target: the same string in double
1511 angular brackets.  Targets may be located anywhere; often it is
1512 convenient to put them into a comment line. For example
1514 @example
1515 # <<My Target>>
1516 @end example
1518 @noindent In HTML export (@pxref{HTML export}), such targets will become
1519 named anchors for direct access through @samp{http} links@footnote{Note
1520 that text before the first headline will never be exported, so the first
1521 such target must be after the first headline.}.
1523 If no dedicated target exists, Org-mode will search for the words in the
1524 link.  In the above example the search would be for @samp{my target}.
1525 Links starting with a star like @samp{*My Target} restrict the search to
1526 headlines.  When searching, Org-mode will first try an exact match, but
1527 then move on to more and more lenient searches.  For example, the link
1528 @samp{[[*My Targets]]} will find any of the following:
1530 @example
1531 ** My targets
1532 ** TODO my targets are bright
1533 ** my 20 targets are
1534 @end example
1536 To insert a link targeting a headline, in-buffer completion can be used.
1537 Just type a star followed by a few optional letters into the buffer and
1538 press @kbd{M-@key{TAB}}.  All headlines in the current buffer will be
1539 offered as completions.  @xref{Handling links}, for more commands
1540 creating links.
1542 Following a link pushes a mark onto Org-mode's own mark ring.  You can
1543 return to the previous position with @kbd{C-c &}.  Using this command
1544 several times in direct succession goes back to positions recorded
1545 earlier.
1547 @menu
1548 * Radio targets::               Make targets trigger links in plain text.
1549 * CamelCase links::             Activating CamelCase words as links
1550 @end menu
1552 @node Radio targets, CamelCase links, Internal links, Internal links
1553 @subsection Radio targets
1555 You can configure Org-mode to link any occurrences of certain target
1556 names in normal text.  So without explicitly creating a link, the text
1557 connects to the target radioing its position.  Radio targets are
1558 enclosed by triple angular brackets.  For example, a target
1559 @samp{<<<My Target>>>} causes each occurrence of @samp{my target} in
1560 normal text to become activated as a link.  The Org-mode file is
1561 scanned automatically for radio targets only when the file is first
1562 loaded into Emacs.  To update the target list during editing, press
1563 @kbd{C-c C-c} with the cursor on or at a target.
1565 @node CamelCase links,  , Radio targets, Internal links
1566 @subsection CamelCase words as links
1567 @cindex completion, of CamelCase links
1568 @cindex CamelCase links, completion of
1570 Org-mode also supports CamelCase words as links.  This feature is not
1571 turned on by default because of the inconsistencies this system suffers
1572 from.  To activate CamelCase words as links, you need to customize
1573 the option @code{org-activate-links}.  A CamelCase word then leads to a
1574 text search such that @samp{CamelCaseLink} is equivalent to
1575 @samp{[[camel case link]]}.
1577 @node External links, Handling links, Internal links, Hyperlinks
1578 @section External links
1579 @cindex links, external
1580 @cindex external links
1581 @cindex links, external
1582 @cindex GNUS links
1583 @cindex BBDB links
1584 @cindex URL links
1585 @cindex file links
1586 @cindex VM links
1587 @cindex RMAIL links
1588 @cindex WANDERLUST links
1589 @cindex MH-E links
1590 @cindex USENET links
1591 @cindex SHELL links
1592 @cindex Info links
1593 @cindex elisp links
1595 Org-mode supports links to files, websites, Usenet and email messages,
1596 and BBDB database entries.  External links are URL-like locators.  They
1597 start with a short identifying string followed by a colon.  There can be
1598 no space after the colon.  The following list shows examples for each
1599 link type.
1601 @example
1602 http://www.astro.uva.nl/~dominik          @r{on the web}
1603 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
1604 file:papers/last.pdf                      @r{file, relative path}
1605 news:comp.emacs                           @r{Usenet link}
1606 mailto:adent@@galaxy.net                   @r{Mail link}
1607 vm:folder                                 @r{VM folder link}
1608 vm:folder#id                              @r{VM message link}
1609 vm://myself@@some.where.org/folder#id      @r{VM on remote machine}
1610 wl:folder                                 @r{WANDERLUST folder link}
1611 wl:folder#id                              @r{WANDERLUST message link}
1612 mhe:folder                                @r{MH-E folder link}
1613 mhe:folder#id                             @r{MH-E message link}
1614 rmail:folder                              @r{RMAIL folder link}
1615 rmail:folder#id                           @r{RMAIL message link}
1616 gnus:group                                @r{GNUS group link}
1617 gnus:group#id                             @r{GNUS article link}
1618 bbdb:Richard Stallman                     @r{BBDB link}
1619 shell:ls *.org                            @r{A shell command}
1620 elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
1621 @end example
1623 A link should be enclosed in double brackets and may contain a
1624 descriptive text to be displayed instead of the url (@pxref{Link
1625 format}), for example:
1627 @example
1628 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
1629 @end example
1631 @cindex angular brackets, around links
1632 @cindex plain text external links
1633 Org-mode also finds external links in the normal text and activates them
1634 as links.  If spaces must be part of the link (for example in
1635 @samp{bbdb:Richard Stallman}), or you need to remove ambiguities about the end of
1636 the link, enclose them in angular brackets.
1638 @node Handling links, Search options, External links, Hyperlinks
1639 @section Handling links
1641 Org-mode provides methods to create a link in the correct syntax, to
1642 insert it into an org-mode file, and to follow the link.
1644 @table @kbd
1645 @kindex C-c l
1646 @cindex storing links
1647 @item C-c l
1648 Store a link to the current location.  This is a @emph{global} command
1649 which can be used in any buffer to create a link.  The link will be
1650 stored for later insertion into an Org-mode buffer (see below).  For
1651 Org-mode files, if there is a @samp{<<target>>} at the cursor, the link
1652 points to the target.  Otherwise it points to the current headline.  For
1653 VM, RMAIL, WANDERLUST, MH-E, GNUS and BBDB buffers, the link will
1654 indicate the current article/entry.  For W3 and W3M buffers, the link
1655 goes to the current URL.  For any other files, the link will point to
1656 the file, with a search string (@pxref{Search options}) pointing to the
1657 contents of the current line.  If there is an active region, the
1658 selected words will form the basis of the search string.  If the
1659 automatically created link is not working correctly or accurately
1660 enough, you can write custom functions to select the search string and
1661 to do the search for particular file types - see @ref{Custom searches}.
1662 The key binding @kbd{C-c l} is only a suggestion - see @ref{Installation
1663 and activation}.
1665 @kindex C-c C-l
1666 @cindex link completion
1667 @cindex completion, of links
1668 @cindex inserting links
1669 @item C-c C-l
1670 Insert a link.  This prompts for a link to be inserted into the buffer.
1671 You can just type a link, using text for an internal link, or one of the
1672 link type prefixes mentioned in the examples above.  Through completion,
1673 all links stored during the current session can be accessed.  The link
1674 will be inserted into the buffer, along with a descriptive text.  Note
1675 that you don't have to use this command to insert a link.  Links in
1676 Org-mode are plain text, and you can type or paste them straight into
1677 the buffer.  By using this command, the links are automatically enclosed
1678 in double brackets, and you will be asked for the optional descriptive
1679 text.  If the link is a @samp{file:} link and the linked file is located
1680 in the same directory as the current file or a subdirectory of it, the
1681 path of the file will be inserted relative to the current directory.
1683 @kindex C-u C-c C-l
1684 @cindex file name completion
1685 @cindex completion, of file names
1686 @item C-u C-c C-l
1687 When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
1688 a file will be inserted and you may use file name completion to select
1689 the name of the file.  The path to the file is inserted relative to the
1690 directory of the current org file, if the linked file is in the current
1691 directory or in a subdirectory of it, or if the path is written relative
1692 to the current directory using @samp{../}.  Otherwise an absolute path
1693 is used, if possible with @samp{~/} for your home directory.  You can
1694 force an absolute path with two @kbd{C-u} prefixes.
1696 @item C-c C-l @r{with cursor on existing link}
1697 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
1698 link and description parts of the link.
1700 @cindex following links
1701 @kindex C-c C-o
1702 @item C-c C-o
1703 Open link at point.  This will launch a web browser for URLs (using
1704 @command{browse-url-at-point}), run vm/mh-e/wanderlust/rmail/gnus/bbdb
1705 for the corresponding links, and execute the command in a shell link.
1706 When the cursor is on an internal link, this commands runs the
1707 corresponding search.  When the cursor is on a TAG list in a headline,
1708 it creates the corresponding TAGS view.  If the cursor is on a time
1709 stamp, it compiles the agenda for that date.  Furthermore, it will visit
1710 text files in @samp{file:} links with Emacs and select a suitable
1711 application for non-text files.  Classification of files is based on
1712 file extension only.  See option @code{org-file-apps}.  If you want to
1713 override the default application and visit the file with Emacs, use a
1714 @kbd{C-u} prefix.
1716 @kindex mouse-2
1717 @kindex mouse-1
1718 @item mouse-2
1719 @itemx mouse-1
1720 On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
1721 would.  Under Emacs 22, also @kbd{mouse-1} will follow a link.
1723 @kindex mouse-3
1724 @item mouse-3
1725 Like @kbd{mouse-2}, but force file links to be opened with Emacs.
1727 @cindex mark ring
1728 @kindex C-c %
1729 @item C-c %
1730 Push the current position onto the mark ring, to be able to return
1731 easily. Commands following an internal link do this automatically.
1733 @cindex links, returning to
1734 @kindex C-c &
1735 @item C-c &
1736 Jump back to a recorded position.  A position is recorded by the
1737 commands following internal links, and by @kbd{C-c %}.  Using this
1738 command several times in direct succession moves through a ring of
1739 previously recorded positions.
1740 @end table
1743 @node Search options, Custom searches, Handling links, Hyperlinks
1744 @section Search options in file links
1745 @cindex search option in file links
1746 @cindex file links, searching
1748 File links can contain additional information to make Emacs jump to a
1749 particular location in the file when following a link.  This can be a
1750 line number or a search option after a double@footnote{For backward
1751 compatibility, line numbers can also follow a single colon.} colon. For
1752 example, when the command @kbd{C-c l} creates a link (@pxref{Handling
1753 links}) to a file, it encodes the words in the current line as a search
1754 string that can be used to find this line back later when following the
1755 link with @kbd{C-c C-o}. 
1757 Here is the syntax of the different ways to attach a search to a file
1758 link, together with an explanation:
1760 @example
1761 [[file:~/code/main.c::255]]
1762 [[file:~/xx.org::My Target]]
1763 [[file:~/xx.org::*My Target]]
1764 [[file:~/xx.org::/regexp/]]
1765 @end example
1767 @table @code
1768 @item 255
1769 Jump to line 255.
1770 @item My Target
1771 Search for a link target @samp{<<My Target>>}, or do a text search for
1772 @samp{my target}, similar to the search in internal links, see
1773 @ref{Internal links}.  In HTML export (@pxref{HTML export}), such a file
1774 link will become an HTML reference to the corresponding named anchor in
1775 the linked file.
1776 @item *My Target
1777 In an Org-mode file, restrict search to headlines.
1778 @item /regexp/
1779 Do a regular expression search for @code{regexp}.  This uses the Emacs
1780 command @code{occur} to list all matches in a separate window.  If the
1781 target file is in Org-mode, @code{org-occur} is used to create a
1782 sparse tree with the matches.
1783 @c If the target file is a directory,
1784 @c @code{grep} will be used to search all files in the directory.
1785 @end table
1787 As a degenerate case, a file link with an empty file name can be used
1788 to search the current file.  For example, @code{<file:::find me>} does
1789 a search for @samp{find me} in the current file, just as
1790 @samp{[[find me]]} would.
1792 @node Custom searches, Remember, Search options, Hyperlinks
1793 @section Custom Searches
1794 @cindex custom search strings
1796 The default mechanism for creating search strings and for doing the
1797 actual search related to a file link may not work correctly in all
1798 cases.  For example, BibTeX database files have many entries like
1799 @samp{year="1993"} which would not result in good search strings,
1800 because the only unique identification for a BibTeX entry is the
1801 citation key.
1803 If you come across such a problem, you can write custom functions to set
1804 the right search string for a particular file type, and to do the search
1805 for the string in the file.  Using @code{add-hook}, these functions need
1806 to be added to the hook variables
1807 @code{org-create-file-search-functions} and
1808 @code{org-execute-file-search-functions}.  See the docstring for these
1809 variables for more information.  Org-mode actually uses this mechanism
1810 for Bib@TeX{} database files, and you can use the corresponding code as
1811 an implementation example.  Search for @samp{BibTeX links} in the source
1812 file.
1815 @node Remember,  , Custom searches, Hyperlinks
1816 @section Remember
1817 @cindex @file{remember.el}
1819 Another way to create org entries with links to other files is through
1820 the @emph{Remember} package by John Wiegley.  @emph{Remember} lets you
1821 store quick notes with little interruption of your work flow.  See
1822 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
1823 information.  The notes produced by @emph{Remember} can be stored in
1824 different ways, and Org-mode files are a good target.  Org-mode allows
1825 you to file away notes either to a default file, or directly to the correct
1826 location in your Org-mode outline tree.  The following customization
1827 will tell @emph{Remember} to use org files as target, and to create
1828 annotations compatible with Org-mode links.
1830 @example
1831 (setq org-directory "~/path/to/my/orgfiles/")
1832 (setq org-default-notes-file "~/.notes")
1833 (setq remember-annotation-functions '(org-remember-annotation))
1834 (setq remember-handler-functions '(org-remember-handler))
1835 (add-hook 'remember-mode-hook 'org-remember-apply-template)
1836 @end example
1838 @cindex templates, for remember
1839 In combination with Org-mode, you can use templates to generate
1840 different types of remember notes.  For example, if you would like to
1841 use one template to create general TODO entries, and another one for
1842 journal entries, you could use:
1844 @example
1845 (setq org-remember-templates
1846       '((?t "* TODO %?\n  %i\n  %a" "~/org/TODO.org")
1847         (?j "* %U %?\n\n  %i\n  %a" "~/org/JOURNAL.org")))
1848 @end example
1850 @noindent In these entries, the character specifies how to select the
1851 template, the first string specifies the template, and the (optional)
1852 second string specifies a default file (overruling
1853 @code{org-default-notes-file}) as a target for this note.
1855 When you call @kbd{M-x remember} to remember something, org will prompt
1856 for a key to select the template and then prepare the buffer like
1857 @example
1858 * TODO
1859   <file:link to where you called remember>
1860 @end example
1862 @noindent or
1864 @example
1865 * [2006-03-21 Tue 15:37]
1867   <file:link to where you called remember>
1868 @end example
1870 @noindent See the variable @code{org-remember-templates} for more details.
1872 When you are finished composing a note with remember, you have to press
1873 @kbd{C-c C-c} to file the note away.  The handler first prompts for a
1874 target file - if you press @key{RET}, the value of
1875 @code{org-default-notes-file} is used.  Then the command offers the
1876 headings tree of the selected file.  You can either immediately press
1877 @key{RET} to get the note appended to the file.  Or you can use vertical
1878 cursor motion (@key{up} and @key{down}) and visibility cycling
1879 (@key{TAB}) to find a better place.  Pressing @key{RET} or @key{left} or
1880 @key{right} leads to the following result.
1882 @multitable @columnfractions 0.2 0.1 0.7
1883 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
1884 @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file
1885 @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor
1886 @item             @tab @key{left}  @tab as same level, before current heading
1887 @item             @tab @key{right} @tab as same level, after current heading
1888 @item not on headline @tab @key{RET}
1889       @tab at cursor position, level taken from context.
1890            Or use prefix arg to specify level manually.
1891 @end multitable
1893 So a fast way to store the note is to press @kbd{C-c C-c @key{RET}
1894 @key{RET}} to append it to the default file.  Even shorter would be
1895 @kbd{C-u C-c C-c}, which does the same without even showing the tree.
1896 But with little extra effort, you can push it directly to the correct
1897 location.
1899 Before inserting the text into a tree, the function ensures that the
1900 text has a headline, i.e. a first line that starts with a @samp{*}.
1901 If not, a headline is constructed from the current date and some
1902 additional data.  If the variable @code{org-adapt-indentation} is
1903 non-nil, the entire text is also indented so that it starts in the
1904 same column as the headline (after the asterisks).
1907 @node TODO items, Timestamps, Hyperlinks, Top
1908 @chapter TODO items
1909 @cindex TODO items
1911 Org-mode does not maintain TODO lists as a separate document.  TODO
1912 items are an integral part of the notes file, because TODO items
1913 usually come up while taking notes!  With Org-mode, you simply mark
1914 any entry in a tree as being a TODO item.  In this way, the
1915 information is not duplicated, and the entire context from which the
1916 item emerged is always present when you check.
1918 Of course, this technique causes TODO items to be scattered throughout
1919 your file.  Org-mode provides methods to give you an overview over all
1920 things you have to do.
1922 @menu
1923 * TODO basics::                 Marking and displaying TODO entries
1924 * Progress logging::            Document your productivity
1925 * TODO extensions::             Workflow and assignments
1926 * Priorities::                  Some things are more important than others
1927 @end menu
1929 @node TODO basics, Progress logging, TODO items, TODO items
1930 @section Basic TODO functionality
1932 Any headline can become a TODO item by starting it with the word TODO,
1933 for example:
1935 @example
1936 *** TODO Write letter to Sam Fortune
1937 @end example
1939 @noindent
1940 The most important commands to work with TODO entries are:
1942 @table @kbd
1943 @kindex C-c C-t
1944 @cindex cycling, of TODO states
1945 @item C-c C-t
1946 Rotate the TODO state of the current item between
1948 @example
1949 ,-> (unmarked) -> TODO -> DONE --.
1950 '--------------------------------'
1951 @end example
1953 The same rotation can also be done ``remotely'' from the timeline and
1954 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
1955 @kindex S-@key{right}
1956 @kindex S-@key{left}
1957 @item S-@key{right}
1958 @itemx S-@key{left}
1959 Select the following/preceding TODO state, similar to cycling.  Mostly
1960 useful if more than two TODO states are possible (@pxref{TODO extensions}).
1961 @kindex C-c C-v
1962 @cindex sparse tree, for TODO
1963 @item C-c C-v
1964 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
1965 the entire buffer, but shows all TODO items and the headings hierarchy
1966 above them.  With prefix arg, show also the DONE entries.  With
1967 numerical prefix N, show the tree for the Nth keyword in the variable
1968 @code{org-todo-keywords}.
1969 @kindex C-c a t
1970 @item C-c a t
1971 Show the global TODO list.  This collects the TODO items from all
1972 agenda files (@pxref{Agenda views}) into a single buffer.  The buffer is in
1973 @code{agenda-mode}, so there are commands to examine and manipulate
1974 the TODO entries directly from that buffer (@pxref{Agenda commands}).
1975 @xref{Global TODO list}, for more information.
1976 @c @item @code{org-agenda-include-all-todo}
1977 @c If you would like to have all your TODO items listed as part of your
1978 @c agenda, customize the variable @code{org-agenda-include-all-todo}.
1979 @end table
1981 @node Progress logging, TODO extensions, TODO basics, TODO items
1982 @section Progress Logging
1983 @cindex progress logging
1984 @cindex logging, of progress
1985 If you want to keep track of @emph{when} a certain TODO item was
1986 finished, turn on logging with
1988 @lisp
1989 (setq org-log-done t)
1990 @end lisp
1992 @noindent
1993 Then each time you turn a TODO entry into DONE using either @kbd{C-c
1994 C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line
1995 @samp{CLOSED: [timestamp]} will be inserted just after the headline.
1996 If you turn the entry back into a TODO item again through further
1997 state cycling, that line will be removed again.  In the timeline
1998 (@pxref{Timeline}) and in the agenda (@pxref{Weekly/Daily agenda}),
1999 you can then use the @kbd{L} key to display the TODO items closed on
2000 each day, giving you an overview of what has been done on a day.
2002 @node TODO extensions, Priorities, Progress logging, TODO items
2003 @section Extended use of TODO keywords
2004 @cindex extended TODO keywords
2006 The default implementation of TODO entries is just two states: TODO and
2007 DONE.  You can, however, use the TODO feature for more complicated
2008 things by configuring the variables @code{org-todo-keywords} and
2009 @code{org-todo-interpretation}.  Using special setup, you can even use
2010 TODO keywords in different ways in different org files.
2012 Note that @i{tags} are another way to classify headlines in general and
2013 TODO items in particular (@pxref{Tags}).
2015 @menu
2016 * Workflow states::             From TODO to DONE in steps
2017 * TODO types::                  I do this, Fred the rest
2018 * Per file keywords::           Different files, different requirements
2019 @end menu
2021 @node Workflow states, TODO types, TODO extensions, TODO extensions
2022 @subsection TODO keywords as workflow states
2023 @cindex TODO workflow
2024 @cindex workflow states as TODO keywords
2026 You can use TODO keywords to indicate different states in the process
2027 of working on an item, for example:
2029 @lisp
2030 (setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE")
2031       org-todo-interpretation 'sequence)
2032 @end lisp
2034 @cindex completion, of TODO keywords
2035 Changing these variables only becomes effective in a new Emacs session.
2036 With this setup, the command @kbd{C-c C-t} will cycle an entry from
2037 TODO to FEEDBACK, then to VERIFY, and finally to DONE.  You may also
2038 use a prefix argument to quickly select a specific state.  For example
2039 @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
2040 If you define many keywords, you can use in-buffer completion (see
2041 @ref{Completion}) to insert these words into the buffer.
2043 @node TODO types, Per file keywords, Workflow states, TODO extensions
2044 @subsection TODO keywords as types
2045 @cindex TODO types
2046 @cindex names as TODO keywords
2047 @cindex types as TODO keywords
2049 The second possibility is to use TODO keywords to indicate different
2050 types of action items.  For example, you might want to indicate that
2051 items are for ``work'' or ``home''.  If you are into David Allen's
2052 @emph{Getting Things DONE}, you might want to use todo types
2053 @samp{NEXTACTION}, @samp{WAITING}, @samp{MAYBE}.  Or, when you work
2054 with several people on a single project, you might want to assign
2055 action items directly to persons, by using their names as TODO
2056 keywords.  This would be set up like this:
2058 @lisp
2059 (setq org-todo-keywords '("Fred" "Sara" "Lucy" "Mike" "DONE")
2060       org-todo-interpretation 'type)
2061 @end lisp
2063 In this case, different keywords do not indicate a sequence, but
2064 rather different types.  So it is normally not useful to change from
2065 one type to another.  Therefore, in this case the behavior of the
2066 command @kbd{C-c C-t} is changed slightly@footnote{This is also true
2067 for the @kbd{t} command in the timeline and agenda buffers.}.  When
2068 used several times in succession, it will still cycle through all
2069 names.  But when you return to the item after some time and execute
2070 @kbd{C-c C-t} again, it will switch from each name directly to DONE.
2071 Use prefix arguments or completion to quickly select a specific name.
2072 You can also review the items of a specific TODO type in a sparse tree
2073 by using a numeric prefix to @kbd{C-c C-v}.  For example, to see all
2074 things Lucy has to do, you would use @kbd{C-3 C-c C-v}.  To collect
2075 Lucy's items from all agenda files into a single buffer, you
2076 would use the prefix arg as well when creating the global todo list:
2077 @kbd{C-3 C-c t}.
2079 @node Per file keywords,  , TODO types, TODO extensions
2080 @subsection Setting up TODO keywords for individual files
2081 @cindex keyword options
2082 @cindex per file keywords
2084 It can be very useful to use different aspects of the TODO mechanism
2085 in different files, which is not possible with the global settings
2086 described above.  For file-local settings, you need to add special
2087 lines to the file which set the keywords and interpretation for that
2088 file only.  For example, to set one of the two examples discussed
2089 above, you need one of the following lines, starting in column zero
2090 anywhere in the file:
2092 @example
2093 #+SEQ_TODO: TODO FEEDBACK VERIFY DONE
2094 #+TYP_TODO: Fred Sara Lucy Mike DONE
2095 @end example
2097 @cindex Completion, of option keywords
2098 @kindex M-@key{TAB}
2099 @noindent To make sure you are using the correct keyword, type
2100 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
2102 @cindex DONE, final TODO keyword
2103 Remember that the last keyword must always mean that the item is DONE
2104 (although you may use a different word).  Also note that in each file,
2105 only one of the two aspects of TODO keywords can be used.  After
2106 changing one of these lines, use @kbd{C-c C-c} with the cursor still
2107 in the line to make the changes known to Org-mode@footnote{Org-mode
2108 parses these lines only when Org-mode is activated after visiting a
2109 file.  @kbd{C-c C-c} with the cursor in a line starting with @samp{#+}
2110 is simply restarting Org-mode, making sure that these changes will be
2111 respected.}.
2113 If you want to use very many keywords, for example when working with a
2114 large group of people, you may split the names over several lines:
2116 @example
2117 #+TYP_TODO: Fred Sara Lucy Mike
2118 #+TYP_TODO: Luis George Jules Jessica
2119 #+TYP_TODO: Kim Arnold Peter
2120 #+TYP_TODO: DONE
2121 @end example
2123 @node Priorities,  , TODO extensions, TODO items
2124 @section Priorities
2125 @cindex priorities
2127 If you use Org-mode extensively to organize your work, you may end up
2128 with a number of TODO entries so large that you'd like to prioritize
2129 them.  This can be done by placing a @emph{priority cookie} into the
2130 headline, like this
2132 @example
2133 *** TODO [#A] Write letter to Sam Fortune
2134 @end example
2136 @noindent
2137 With its standard setup, Org-mode supports priorities @samp{A},
2138 @samp{B}, and @samp{C}.  @samp{A} is the highest priority.  An entry
2139 without a cookie is treated as priority @samp{B}.  Priorities make a
2140 difference only in the agenda (@pxref{Weekly/Daily agenda}).
2142 @table @kbd
2143 @kindex @kbd{C-c ,}
2144 @item @kbd{C-c ,}
2145 Set the priority of the current headline.  The command prompts for a
2146 priority character @samp{A}, @samp{B} or @samp{C}.  When you press
2147 @key{SPC} instead, the priority cookie is removed from the headline.
2148 The priorities can also be changed ``remotely'' from the timeline and
2149 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
2151 @kindex S-@key{up}
2152 @kindex S-@key{down}
2153 @item S-@key{up}
2154 @itemx S-@key{down}
2155 Increase/decrease priority of current headline.  Note that these keys
2156 are also used to modify time stamps (@pxref{Creating timestamps}).
2157 Furthermore, these keys are also used by CUA-mode (@pxref{Conflicts}).
2158 @end table
2160 @node Timestamps, Tags, TODO items, Top
2161 @chapter Timestamps
2163 Items can be labeled with timestamps to make them useful for project
2164 planning.
2166 @menu
2167 * Time stamps::                 Assigning a time to a tree entry
2168 * Creating timestamps::         Commands which insert timestamps
2169 @end menu
2172 @node Time stamps, Creating timestamps, Timestamps, Timestamps
2173 @section Time stamps, deadlines and scheduling
2174 @cindex time stamps
2175 @cindex ranges, time
2176 @cindex date stamps
2177 @cindex deadlines
2178 @cindex scheduling
2180 A time stamp is a specification of a date (possibly with time) in a
2181 special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16
2182 Tue 09:39>}.  A time stamp can appear anywhere in the headline or body
2183 of an org-tree entry.  Its presence allows entries to be shown on specific
2184 dates in the agenda (@pxref{Weekly/Daily agenda}).  We distinguish:
2186 @table @var
2187 @item Plain time stamp
2188 @cindex timestamp
2189 A simple time stamp just assigns a date/time to an item.  This is just
2190 like writing down an appointment in a paper agenda, or like writing down
2191 an event in a diary, when you want to take note of when something
2192 happened.  In the timeline and agenda displays, the headline of an entry
2193 associated with a plain time stamp will be shown exactly on that date.
2195 @item Time stamp range
2196 @cindex timerange
2197 Two time stamps connected by @samp{--} denote a time range.  The
2198 headline will be shown on the first and last day of the range, and on
2199 any dates that are displayed and fall in the range.  Here is an
2200 example:
2202 @example
2203 ** Meeting in Amsterdam
2204    <2004-08-23 Mon>--<2004-08-26 Thu>
2205 @end example
2207 @item Time stamp with SCHEDULED keyword
2208 @cindex SCHEDULED keyword
2209 If a time stamp is preceded by the word @samp{SCHEDULED:}, it means you
2210 are planning to start working on that task on the given date. So this is
2211 not about recording an event, but about planning your work.  The
2212 headline will be listed under the given date.  In addition, a reminder
2213 that the scheduled date has passed will be present in the compilation
2214 for @emph{today}, until the entry is marked DONE.  I.e., the task will
2215 automatically be forwarded until completed.
2217 @example
2218 *** TODO Call Trillian for a date on New Years Eve.
2219     SCHEDULED: <2004-12-25 Sat>
2220 @end example
2222 @item Time stamp with DEADLINE keyword
2223 @cindex DEADLINE keyword
2224 If a time stamp is preceded by the word @samp{DEADLINE:}, the task
2225 (most likely a TODO item) is supposed to be finished on that date, and
2226 it will be listed then.  In addition, the compilation for @emph{today}
2227 will carry a warning about the approaching or missed deadline,
2228 starting @code{org-deadline-warning-days} before the due date, and
2229 continuing until the entry is marked DONE.  An example:
2231 @example
2232 *** TODO write article about the Earth for the Guide
2233     The editor in charge is <bbdb:Ford Prefect>
2234     DEADLINE: <2004-02-29 Sun>
2235 @end example
2236 @item Time stamp with CLOSED keyword
2237 @cindex CLOSED keyword
2238 When @code{org-log-done} is non-nil, Org-mode will automatically insert
2239 a special time stamp each time a TODO entry is marked done
2240 (@pxref{Progress logging}).  This time stamp is enclosed in square
2241 brackets instead of angular brackets.
2242 @end table
2244 @node Creating timestamps,  , Time stamps, Timestamps
2245 @section Creating timestamps
2246 @cindex creating timestamps
2247 @cindex timestamps, creating
2249 For Org-mode to recognize time stamps, they need to be in the specific
2250 format.  All commands listed below produce time stamps in the correct
2251 format.
2253 @table @kbd
2254 @kindex C-c .
2255 @item C-c .
2256 Prompt for a date and insert a corresponding time stamp.  When the
2257 cursor is at a previously used time stamp, it is updated to NOW.  When
2258 this command is used twice in succession, a time range is inserted.
2260 @kindex C-u C-c .
2261 @item C-u C-c .
2262 Like @kbd{C-c .}, but use the alternative format which contains date
2263 and time.  The default time can be rounded to multiples of 5 minutes,
2264 see the option @code{org-time-stamp-rounding-minutes}.
2266 @kindex C-c !
2267 @item C-c !
2268 Like @kbd{C-c .}, but insert an inactive time stamp not triggering the
2269 agenda.
2271 @kindex C-c <
2272 @item C-c <
2273 Insert a time stamp corresponding to the cursor date in the Calendar.
2275 @kindex C-c >
2276 @item C-c >
2277 Access the Emacs calendar for the current date.  If there is a
2278 timestamp in the current line, goto the corresponding date
2279 instead.
2281 @kindex C-c C-o
2282 @item C-c C-o
2283 Access the agenda for the date given by the time stamp at point
2284 (@pxref{Weekly/Daily agenda}).
2286 @kindex C-c C-d
2287 @item C-c C-d
2288 Insert @samp{DEADLINE} keyword along with a stamp.  The insertion will
2289 happen in the line directly following the headline.  
2290 @c FIXME Any CLOSED timestamp will be removed.????????
2292 @kindex C-c C-w
2293 @cindex sparse tree, for deadlines
2294 @item C-c C-w
2295 Create a sparse tree with all deadlines that are either past-due, or
2296 which will become due within @code{org-deadline-warning-days}.
2297 With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
2298 prefix, check that many days.  For example, @kbd{C-1 C-c C-w} shows
2299 all deadlines due tomorrow.
2301 @kindex C-c C-s
2302 @item C-c C-s
2303 Insert @samp{SCHEDULED} keyword along with a stamp.  The insertion will
2304 happen in the line directly following the headline.  Any CLOSED
2305 timestamp will be removed.
2307 @kindex S-@key{left}
2308 @kindex S-@key{right}
2309 @item S-@key{left}
2310 @itemx S-@key{right}
2311 Change date at cursor by one day.  These key bindings conflict with
2312 CUA-mode (@pxref{Conflicts}).
2314 @kindex S-@key{up}
2315 @kindex S-@key{down}
2316 @item S-@key{up}
2317 @itemx S-@key{down}
2318 Change the item under the cursor in a timestamp.  The cursor can be on
2319 a year, month, day, hour or minute.  Note that if the cursor is not at
2320 a time stamp, these same keys modify the priority of an item.
2321 (@pxref{Priorities}). The key bindings also conflict with CUA-mode
2322 (@pxref{Conflicts}).
2325 @kindex C-c C-y
2326 @cindex evaluate time range
2327 @item C-c C-y
2328 Evaluate a time range by computing the difference between start and
2329 end.  With prefix arg, insert result after the time range (in a table:
2330 into the following column).
2331 @end table
2333 @cindex date, reading in minibuffer
2334 @cindex time, reading in minibuffer
2335 @cindex calendar, for selecting date
2336 When Org-mode prompts for a date/time, the function reading your input
2337 will replace anything you choose not to specify with the current date
2338 and time.  For details, see the documentation string of
2339 @command{org-read-date}.  Also, a calender will pop up to allow
2340 selecting a date.  The calendar can be fully controlled from the
2341 minibuffer, and a date can be selected with the following commands:
2343 @table @kbd
2344 @kindex <
2345 @item <
2346 Scroll calendar backwards by one month.
2347 @kindex >
2348 @item >
2349 Scroll calendar forwards by one month.
2350 @kindex mouse-1
2351 @item mouse-1
2352 Select date by clicking on it.
2353 @kindex S-@key{right}
2354 @item S-@key{right}
2355 One day forward.
2356 @kindex S-@key{left}
2357 @item S-@key{left}
2358 One day back.
2359 @kindex S-@key{down}
2360 @item S-@key{down}
2361 One week forward.
2362 @kindex S-@key{up}
2363 @item S-@key{up}
2364 One week back.
2365 @kindex M-S-@key{right}
2366 @item M-S-@key{right}
2367 One month forward.
2368 @kindex M-S-@key{left}
2369 @item M-S-@key{left}
2370 One month back.
2371 @kindex @key{RET}
2372 @item @key{RET}
2373 Choose date in calendar (only if nothing typed into minibuffer).
2374 @end table
2376 @node Tags, Agenda views, Timestamps, Top
2377 @chapter Tags
2378 @cindex tags
2379 @cindex headline tagging
2380 @cindex matching, tags
2381 @cindex sparse tree, tag based
2383 If you wish to implement a system of labels and contexts for
2384 cross-correlating information, an excellent way is to assign @i{tags} to
2385 headlines.  Org-mode has extensive support for using tags.
2387 Every headline can contain a list of tags, at the end of the headline.
2388 Tags are normal words containing letters, numbers, @samp{_}, and
2389 @samp{@@}.  Tags must be preceded and followed by a single colon; like
2390 @samp{:WORK:}.  Several tags can be specified like @samp{:WORK:URGENT:}.
2392 @menu
2393 * Tag inheritance::             Tags use the tree structure of the outline
2394 * Setting tags::                How to assign tags to a headline
2395 * Tag searches::                Searching for combinations of tags
2396 @end menu
2398 @node Tag inheritance, Setting tags, Tags, Tags
2399 @section Tag inheritance
2400 @cindex inheritance, of tags
2402 @i{Tags} make use of the hierarchical structure of outline trees.  If a
2403 heading has a certain tag, all subheadings will inherit the tag as
2404 well.  For example, in the list
2406 @example
2407 * Meeting with the French group      :WORK:
2408 ** Summary by Frank                  :BOSS:NOTES:
2409 *** TODO Prepare slides for him      :ACTION:
2410 @end example
2412 @noindent
2413 the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
2414 @samp{:NOTES:}, and @samp{:ACTION:}.  When executing tag searches and
2415 Org-mode finds that a certain headline matches the search criterion, it
2416 will not check any sublevel headline, assuming that these likely also
2417 match, and that the list of matches can become very long.  This may
2418 not be what you want, however, and you can influence inheritance and
2419 searching using the variables @code{org-use-tag-inheritance} and
2420 @code{org-tags-match-list-sublevels}.
2422 @node Setting tags, Tag searches, Tag inheritance, Tags
2423 @section Setting tags
2424 @cindex setting tags
2426 @kindex M-@key{TAB}
2427 Tags can simply be typed into the buffer at the end of a headline.
2428 After a colon, @kbd{M-@key{TAB}} offers completion on tags.  There is
2429 also a special command for inserting tags:
2431 @table @kbd
2432 @kindex C-c C-c
2433 @item C-c C-c
2434 @cindex completion, of tags
2435 Enter new tags for the current headline.  Org-mode will either offer
2436 completion or a special single-key interface for setting tags, see
2437 below.  After pressing @key{RET}, the tags will be inserted and aligned
2438 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
2439 tags in the current buffer will be aligned to that column, just to make
2440 things look nice.  TAGS are automatically realigned after promotion,
2441 demotion, and TODO state changes (@pxref{TODO basics}).
2442 @end table
2444 Org will support tag insertion based on a @emph{list of tags}.  By
2445 default this list is constructed dynamically, containing all tags
2446 currently used in the buffer.  You may also globally specify a hard list
2447 of tags with the variable @code{org-tag-alist}.  Finally you can set
2448 the allowed tags for a given file with lines like
2450 @example
2451 #+TAGS: @@WORK @@HOME @@TENNISCLUB
2452 #+TAGS: Laptop Car PC Sailboat
2453 @end example
2455 The default support method is minibuffer completion.  However, Org-mode
2456 also implements a much better method: @emph{fast tag selection}.  This
2457 method allows to select and deselect tags with a single key per tag.  To
2458 function efficiently, you should assign unique keys to all tags.  This
2459 can be done globally with
2461 @lisp
2462 (setq org-tag-alist '(("@@WORK" . ?w) ("@@HOME" . ?h) ("Laptop" . ?l)))
2463 @end lisp
2465 @noindent or on a per-file basis with
2467 @example
2468 #+TAGS: @@WORK(w)  @@HOME(h)  @@TENNISCLUB(t)  Laptop(l)  PC(p)
2469 @end example
2471 @noindent
2472 You can also group together tags that are mutually exclusive.  With
2473 curly braces@footnote{In @code{org-mode-alist} use
2474 @code{'(:startgroup)} and @code{'(:endgroup)}, respectively.  Several
2475 groups are allowed.}
2477 @example
2478 #+TAGS: @{ @@WORK(w)  @@HOME(h)  @@TENNISCLUB(t) @}  Laptop(l)  PC(p)
2479 @end example
2481 @noindent you indicate that at most one of @samp{@@WORK}, @samp{@@HOME},
2482 and @samp{@@SAILBOAT} should be selected.
2484 @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
2485 these lines to activate any changes.
2487 If at least one tag has a selection key, pressing @kbd{C-c C-c} will
2488 automatically present you with a special interface, listing inherited
2489 tags, the tags of the current headline, and a list of all legal tags
2490 with corresponding keys@footnote{Keys will automatically assigned to
2491 tags which have no configured keys.}.  Pressing keys for the tags will
2492 add or remove them from the list of tags in the current line.  Selecting
2493 a tag in a group of mutually exclusive tags will turn off any other tags
2494 from that group.  @key{SPC} clears all tags for this line, @kbd{RET}
2495 accepts the modified set, and @kbd{C-g} aborts without installing
2496 changes.  This method lets you assign tags to a headline with very few
2497 keys.  With the above setup, you could clear the current tags and set
2498 @samp{@@HOME}, @samp{Laptop} and @samp{PC} tags with just the following
2499 keys: @kbd{C-c C-c @key{SPC} h l p @key{RET}}.  Switching from
2500 @samp{@@HOME} to @samp{@@WORK} would be done with @kbd{C-c C-c w
2501 @key{RET}}.
2503 What if you have globally defined your preferred set of tags using the
2504 variable @code{org-tag-alist}, but would like to use a dynamic tag list
2505 in a specific file?  Just add an empty TAGS option line to that file:
2507 @example
2508 #+TAGS:
2509 @end example
2513 @node Tag searches,  , Setting tags, Tags
2514 @section Tag searches
2515 @cindex tag searches
2517 Once a tags system has been set up, it can be used to collect related
2518 information into special lists.
2520 @table @kbd
2521 @kindex C-c \
2522 @item C-c \
2523 Create a sparse tree with all headlines matching a tags search.
2524 @kindex C-c a m
2525 @item C-c a m
2526 Create a global list of tag matches from all agenda files.
2527 @xref{Matching headline tags}.
2528 @kindex C-c a M
2529 @item C-c a M
2530 Create a global list of tag matches from all agenda files, but check
2531 only TODO items and force checking subitems (see variable
2532 @code{org-tags-match-list-sublevels}).
2533 @end table
2535 A @i{tags} search string can use Boolean operators @samp{&} for AND and
2536 @samp{|} for OR.  @samp{&} binds more strongly than @samp{|}.
2537 Parenthesis are currently not implemented.  A tag may also be preceded
2538 by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
2539 positive selection.  The AND operator @samp{&} is optional when @samp{+}
2540 or @samp{-} is present.  For example, @samp{+WORK-BOSS} would select all
2541 headlines that are tagged @samp{:WORK:}, but discard those also tagged
2542 @samp{:BOSS:}.  The search string @samp{WORK|LAPTOP} selects all lines
2543 tagged @samp{:WORK:} or @samp{:LAPTOP:}.  The string
2544 @samp{WORK|LAPTOP&NIGHT} requires that the @samp{:LAPTOP:} lines are
2545 also tagged @samp{NIGHT}.
2547 @node Agenda views, Exporting, Tags, Top
2548 @chapter Agenda Views
2549 @cindex agenda views
2551 Due to the way Org-mode works, TODO items, time-stamped items, and
2552 tagged headlines can be scattered throughout a file or even a number of
2553 files.  To get an overview over open action items, or over events that
2554 are important for a particular date, this information must be collected,
2555 sorted and displayed in an organized way.
2557 Org-mode can select items based on various criteria, and display them
2558 in a separate buffer.  Three different views are provided:
2560 @itemize @bullet
2561 @item
2562 an @emph{agenda} that is like a calendar and shows information
2563 for specific dates
2564 @item
2565 a @emph{TODO list} that covers all unfinished
2566 action items, and
2567 @item
2568 a @emph{tags view} that shows information based on
2569 the tags associated with headlines in the outline tree.
2570 @end itemize
2572 @noindent
2573 The extracted information is displayed in a special @emph{agenda
2574 buffer}.  This buffer is read-only, but provides commands to visit the
2575 corresponding locations in the original Org-mode files, and even to
2576 edit these files remotely.
2578 @menu
2579 * Agenda files::                Files being searched for agenda information
2580 * Agenda dispatcher::           Keyboard access to agenda views
2581 * Weekly/Daily agenda::         The calendar page with current tasks
2582 * Global TODO list::            All unfinished action items
2583 * Matching headline tags::      Structured information with fine-tuned search
2584 * Timeline::                    Time-sorted view for single file
2585 * Agenda commands::             Remote editing of org trees
2586 @end menu
2588 @node Agenda files, Agenda dispatcher, Agenda views, Agenda views
2589 @section Agenda files
2591 The information to be shown is collected from all @emph{agenda files},
2592 the files listed in the variable @code{org-agenda-files}@footnote{If the
2593 value of that variable is not a list, but a single file name, then the
2594 list of agenda files will be maintained in that external file.}.  Thus even
2595 if you only work with a single Org-mode file, this file should be put
2596 into that list@footnote{When using the dispatcher pressing @kbd{1}
2597 before selecting a command will actually limit the command to the
2598 current file, and ignore @code{org-agenda-files} until the next
2599 dispatcher command.}.  You can customize @code{org-agenda-files}, but
2600 the easiest way to maintain it is through the following commands
2602 @cindex files, adding to agenda list
2603 @table @kbd
2604 @kindex C-c [
2605 @item C-c [
2606 Add current file to the list of agenda files.  The file is added to
2607 the front of the list.  If it was already in the list, it is moved to
2608 the front.  With prefix arg, file is added/moved to the end.
2609 @kindex C-c ]
2610 @item C-c ]
2611 Remove current file from the list of agenda files.
2612 @kindex C-,
2613 @item C-,
2614 Cycle through agenda file list, visiting one file after the other.
2615 @end table
2617 @noindent
2618 The Org menu contains the current list of files and can be used
2619 to visit any of them.
2621 @node Agenda dispatcher, Weekly/Daily agenda, Agenda files, Agenda views
2622 @section The agenda dispatcher
2623 @cindex agenda dispatcher
2624 @cindex dispatching agenda commands
2625 @cindex custom agenda commands
2626 @cindex agenda commands, custom
2627 The views are created through a dispatcher that should be bound to a
2628 global key, for example @kbd{C-c a} (@pxref{Installation and
2629 activation}).  In the following we will assume that @kbd{C-c a} is
2630 indeed how the dispatcher is accessed and list keyboard access to
2631 commands accordingly.  After pressing @kbd{C-c a}, an additional
2632 letter is required to execute a command.  The dispatcher offers the
2633 following default commands:
2634 @table @kbd
2635 @item a
2636 Create the calendar-like agenda (@pxref{Weekly/Daily agenda}).
2637 @item t / T
2638 Create a list of all TODO items (@pxref{Global TODO list}).
2639 @item m / M
2640 Create a list of headlines matching a TAGS expression (@pxref{Matching
2641 headline tags}).
2642 @end table
2644 You can also define custom commands that will be accessible through
2645 the dispatcher, just like the default commands.  Custom commands are
2646 global searches for tags and specific TODO keywords, or a variety of
2647 sparse tree creating commands (@pxref{Sparse trees}).  As sparse trees
2648 are only defined for a single org-mode file, these latter commands act
2649 on the current buffer instead of the list of agenda files.
2651 @kindex C-c a C
2652 Custom commands are configured in the variable
2653 @code{org-agenda-custom-commands}.  You can customize this variable,
2654 for example by pressing @kbd{C-c a C}.  You can also directly set it
2655 with Emacs Lisp in @file{.emacs}.  For example:
2657 @lisp
2658 (setq org-agenda-custom-commands
2659       '(("w" todo "WAITING")
2660         ("u" tags "+BOSS-URGENT")
2661         ("U" tags-tree "+BOSS-URGENT")
2662         ("f" occur-tree "\\<FIXME\\>")))
2663 @end lisp
2665 @noindent will define @kbd{C-c a w} as a global search for
2666 TODO entries with @samp{WAITING} as the TODO keyword, @kbd{C-c a u} as a
2667 global tags search for headlines marked @samp{:BOSS:} but not
2668 @samp{:URGENT:}, @kbd{C-c a U} to do the same search but only in the
2669 current buffer and display the result as a sparse tree, and @kbd{C-c a
2670 f} to create a sparse tree with all entries containing the word
2671 @samp{FIXME}.  For more information, look at the documentation string
2672 of the variable @code{org-agenda-custom-commands}.
2674 @node Weekly/Daily agenda, Global TODO list, Agenda dispatcher, Agenda views
2675 @section The weekly/daily agenda
2676 @cindex agenda
2678 The purpose of the weekly/daily @emph{agenda} is to act like a page of
2679 a paper agenda, showing all the tasks for the current week or day.
2681 @table @kbd
2682 @cindex org-agenda, command
2683 @kindex C-c a a
2684 @item C-c a a
2685 Compile an agenda for the current week from a list of org files.  The
2686 agenda shows the entries for each day.  With a @kbd{C-u} prefix (or
2687 when the variable @code{org-agenda-include-all-todo} is @code{t}), all
2688 unfinished TODO items (including those without a date) are also listed at
2689 the beginning of the buffer, before the first date.@*
2690 @end table
2692 Remote editing from the agenda buffer means, for example, that you can
2693 change the dates of deadlines and appointments from the agenda buffer.
2694 The commands available in the Agenda buffer are listed in @ref{Agenda
2695 commands}.
2697 @menu
2698 * Categories::                  Not all tasks are equal
2699 * Time-of-day specifications::  How the agenda knows the time
2700 * Calendar/Diary integration::  Integrating Anniversaries and more
2701 * Sorting of agenda items::     The order of things
2702 @end menu
2704 @node Categories, Time-of-day specifications, Weekly/Daily agenda, Weekly/Daily agenda
2705 @subsection Categories
2707 @cindex category
2708 In the agenda buffer, each entry is preceded by a @emph{category},
2709 which is derived from the file name.  The category can also be set
2710 with a special line anywhere in the buffer, looking like this:
2712 @example
2713 #+CATEGORY: Thesis
2714 @end example
2716 If there are several such lines in a file, each specifies the category
2717 for the text below it (but the first category also applies to any text
2718 before the first CATEGORY line).  The display in the agenda buffer looks
2719 best if the category is not longer than 10 characters.
2721 @node Time-of-day specifications, Calendar/Diary integration, Categories, Weekly/Daily agenda
2722 @subsection Time-of-Day Specifications
2724 Org-mode checks each agenda item for a time-of-day specification.  The
2725 time can be part of the time stamp that triggered inclusion into the
2726 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}.  Time
2727 ranges can be specified with two time stamps, like
2729 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
2731 In the headline of the entry itself, a time(range) may also appear as
2732 plain text (like @samp{12:45} or a @samp{8:30-1pm}.  If the agenda
2733 integrates the Emacs diary (@pxref{Calendar/Diary integration}), time
2734 specifications in diary entries are recognized as well.
2736 For agenda display, Org-mode extracts the time and displays it in a
2737 standard 24 hour format as part of the prefix.  The example times in
2738 the previous paragraphs would end up in the agenda like this:
2740 @example
2741     8:30-13:00 Arthur Dent lies in front of the bulldozer
2742    12:45...... Ford Prefect arrives and takes Arthur to the pub
2743    19:00...... The Vogon reads his poem
2744    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
2745 @end example
2747 If the agenda is in single-day mode, or for the display of today, the
2748 timed entries are embedded in a time grid, like
2750 @example
2751     8:00...... ------------------
2752     8:30-13:00 Arthur Dent lies in front of the bulldozer
2753    10:00...... ------------------
2754    12:00...... ------------------
2755    12:45...... Ford Prefect arrives and takes Arthur to the pub
2756    14:00...... ------------------
2757    16:00...... ------------------
2758    18:00...... ------------------
2759    19:00...... The Vogon reads his poem
2760    20:00...... ------------------
2761    20:30-22:15 Marwin escorts the Hitchhikers to the bridge
2762 @end example
2764 The time grid can be turned on and off with the variable
2765 @code{org-agenda-use-time-grid}, and can be configured with
2766 @code{org-agenda-time-grid}.
2769 @node Calendar/Diary integration, Sorting of agenda items, Time-of-day specifications, Weekly/Daily agenda
2770 @subsection Calendar/Diary integration
2771 @cindex calendar integration
2772 @cindex diary integration
2774 Emacs contains the calendar and diary by Edward M. Reingold.  The
2775 calendar displays a three-month calendar with holidays from different
2776 countries and cultures.  The diary allows you to keep track of
2777 anniversaries, lunar phases, sunrise/set, recurrent appointments
2778 (weekly, monthly) and more.  In this way, it is quite complementary to
2779 Org-mode.  It can be very useful to combine output from Org-mode with
2780 the diary.
2782 In order to include entries from the Emacs diary into Org-mode's
2783 agenda, you only need to customize the variable
2785 @lisp
2786 (setq org-agenda-include-diary t)
2787 @end lisp
2789 @noindent After that, everything will happen automatically.  All diary
2790 entries including holidays, anniversaries etc will be included in the
2791 agenda buffer created by Org-mode.  @key{SPC}, @key{TAB}, and
2792 @key{RET} can be used from the agenda buffer to jump to the diary
2793 file in order to edit existing diary entries.  The @kbd{i} command to
2794 insert new entries for the current date works in the agenda buffer, as
2795 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
2796 Sunrise/Sunset times, show lunar phases and to convert to other
2797 calendars, respectively.  @kbd{c} can be used to switch back and forth
2798 between calendar and agenda.
2800 @node Sorting of agenda items,  , Calendar/Diary integration, Weekly/Daily agenda
2801 @subsection Sorting of agenda items
2802 @cindex sorting, of agenda items
2803 @cindex priorities, of agenda items
2804 The entries for each day are sorted.  The default order is to first
2805 collect all items containing an explicit time-of-day specification.
2806 These entries will be shown at the beginning of the list, as a
2807 @emph{schedule} for the day.  After that, items remain grouped in
2808 categories, in the sequence given by @code{org-agenda-files}.  Within
2809 each category, items are sorted by priority (@pxref{Priorities}).
2811 The priority is a numerical quantity composed of the base priority
2812 (2000 for priority @samp{A}, 1000 for @samp{B}, and 0 for @samp{C}),
2813 plus additional increments for overdue scheduled or deadline items.
2815 Sorting can be customized using the variable
2816 @code{org-agenda-sorting-strategy}.
2819 @node Global TODO list, Matching headline tags, Weekly/Daily agenda, Agenda views
2820 @section The global TODO list
2821 @cindex global TODO list
2822 @cindex TODO list, global
2824 The global TODO list contains all unfinished TODO items, formatted and
2825 collected into a single place.
2827 @table @kbd
2828 @kindex C-c a t
2829 @item C-c a t
2830 Show the global TODO list.  This collects the TODO items from all
2831 agenda files (@pxref{Agenda views}) into a single buffer.  The buffer is in
2832 @code{agenda-mode}, so there are commands to examine and manipulate
2833 the TODO entries directly from that buffer (@pxref{Agenda commands}).
2834 @kindex C-c a T
2835 @item C-c a T
2836 Like the above, but allows selection of a specific TODO keyword.  You can
2837 also do this by specifying a prefix argument to @kbd{C-c a t}.  With a
2838 @kbd{C-u} prefix you are prompted for a keyword.  With a numeric
2839 prefix, the Nth keyword in @code{org-todo-keywords} is selected.
2840 @kindex r
2841 The @kbd{r} key in the agenda buffer regenerates it, and you can give
2842 a prefix argument to this command to change the selected TODO keyword,
2843 for example @kbd{3 r}.  If you often need a search for a specific
2844 keyword, define a custom command for it (@pxref{Agenda dispatcher}).
2845 @end table
2847 Remote editing of TODO items means that you can change the state of a
2848 TODO entry with a single key press.  The commands available in the
2849 TODO list are described in @ref{Agenda commands}.
2851 @node Matching headline tags, Timeline, Global TODO list, Agenda views
2852 @section Matching headline tags
2853 @cindex matching, of tags
2854 @cindex tags view
2856 If headlines in the agenda files are marked with @emph{tags}
2857 (@pxref{Tags}), you can select headlines based on the tags that apply
2858 to them and collect them into an agenda buffer.
2860 @table @kbd
2861 @kindex C-c a m
2862 @item C-c a m
2863 Produce a list of all headlines that match a given set of tags.  The
2864 command prompts for a selection criterion, which is a boolean logic
2865 expression with tags, like @samp{+WORK+URGENT-WITHBOSS} or
2866 @samp{WORK|HOME} (@pxref{Tags}).  If you often need a specific search,
2867 define a custom command for it (@pxref{Agenda dispatcher}).
2868 @kindex C-c a M
2869 @item C-c a M
2870 Like @kbd{C-c a m}, but only select headlines that are also TODO items
2871 and force checking subitems (see variable
2872 @code{org-tags-match-list-sublevels}.
2873 @end table
2875 The commands available in the tags list are described in @ref{Agenda
2876 commands}.
2878 @node Timeline, Agenda commands, Matching headline tags, Agenda views
2879 @section Timeline for a single file
2880 @cindex single file summary
2881 @cindex agenda, for single file
2882 @cindex timeline, single file
2883 @cindex time-sorted view
2885 The timeline is not really an agenda view, because it only summarizes
2886 items from a single Org-mode file.  But it also uses the agenda buffer
2887 and provides similar commands, so we discuss it here.  The timeline
2888 shows all time-stamped items in a single Org-mode file (or the
2889 selected part of it), in a @emph{time-sorted view}.  The main purpose of
2890 this command is to give an overview over events in a project.
2892 @table @kbd
2893 @kindex C-c C-r
2894 @item C-c C-r
2895 Show a time-sorted view of the org file, with all time-stamped items.
2896 When called with a @kbd{C-u} prefix, all unfinished TODO entries
2897 (scheduled or not) are also listed under the current date.
2898 @end table
2900 @noindent
2901 The commands available in the timeline buffer are listed in
2902 @ref{Agenda commands}.
2904 @node Agenda commands,  , Timeline, Agenda views
2905 @section Commands in the agenda buffer
2906 @cindex commands, in agenda buffer
2908 Entries in the agenda buffer are linked back to the org file or diary
2909 file where they originate.  You are not allowed to edit the agenda
2910 buffer itself, but commands are provided to show and jump to the
2911 original entry location, and to edit the org-files ``remotely'' from
2912 the agenda buffer.  In this way, all information is stored only once,
2913 removing the risk that your agenda and note files may diverge.
2915 Some commands can be executed with mouse clicks on agenda lines.  For
2916 the other commands, the cursor needs to be in the desired line.
2918 @table @kbd
2919 @tsubheading{Motion}
2920 @kindex n
2921 @item n
2922 Next line (same as @key{up}).
2923 @kindex p
2924 @item p
2925 Previous line (same as @key{down}).
2926 @tsubheading{View/GoTo org file}
2927 @kindex mouse-3
2928 @kindex @key{SPC}
2929 @item mouse-3
2930 @itemx @key{SPC}
2931 Display the original location of the item in another window.
2933 @kindex L
2934 @item L
2935 Display original location and recenter that window.
2937 @kindex mouse-2
2938 @kindex mouse-1
2939 @kindex @key{TAB}
2940 @item mouse-2
2941 @itemx mouse-1
2942 @itemx @key{TAB}
2943 Go to the original location of the item in another window.  Under Emacs
2944 22, @kbd{mouse-1} will also works for this.
2946 @kindex @key{RET}
2947 @itemx @key{RET}
2948 Go to the original location of the item and delete other windows.
2950 @kindex f
2951 @item f
2952 Toggle Follow mode.  In Follow mode, as you move the cursor through
2953 the agenda buffer, the other window always shows the corresponding
2954 location in the org file.  The initial setting for this mode in new
2955 agenda buffers can be set with the variable
2956 @code{org-agenda-start-with-follow-mode}.
2958 @kindex l
2959 @item l
2960 Toggle Logbook mode.  In Logbook mode, entries that where marked DONE while
2961 logging was on (variable @code{org-log-done}) are shown in the agenda.
2963 @tsubheading{Change display}
2964 @kindex o
2965 @item o
2966 Delete other windows.
2968 @kindex w
2969 @item w
2970 Switch to weekly view (7 days displayed together).
2972 @kindex d
2973 @item d
2974 Switch to daily view (just one day displayed).
2976 @kindex D
2977 @item D
2978 Toggle the inclusion of diary entries.  See @ref{Calendar/Diary integration}.
2980 @kindex g
2981 @item g
2982 Toggle the time grid on and off.  See also the variables
2983 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
2985 @kindex r
2986 @item r
2987 Recreate the agenda buffer, for example to reflect the changes
2988 after modification of the time stamps of items with S-@key{left} and
2989 S-@key{right}.  When the buffer is the global todo list, a prefix
2990 argument is interpreted to create a selective list for a specific TODO
2991 keyword.
2993 @kindex @key{right}
2994 @item @key{right}
2995 Display the following @code{org-agenda-ndays} days.  For example, if
2996 the display covers a week, switch to the following week.  With prefix
2997 arg, go forward that many times @code{org-agenda-ndays} days.
2999 @kindex @key{left}
3000 @item @key{left}
3001 Display the previous dates.
3003 @kindex .
3004 @item .
3005 Goto today.
3007 @tsubheading{Remote editing}
3009 @item 0-9
3010 Digit argument.
3012 @kindex t
3013 @item t
3014 Change the TODO state of the item, both in the agenda and in the
3015 original org file.
3017 @kindex T
3018 @item T
3019 Show all tags associated with the current item.  Because of
3020 inheritance, this may be more than the tags listed in the line itself.
3022 @kindex :
3023 @item :
3024 Set tags for the current headline.
3026 @kindex ,
3027 @item ,
3028 Set the priority for the current item.  Org-mode prompts for the
3029 priority character. If you reply with @key{SPC}, the priority cookie
3030 is removed from the entry.
3032 @kindex P
3033 @item p
3034 Display weighted priority of current item.
3036 @kindex +
3037 @kindex S-@key{up}
3038 @item +
3039 @itemx S-@key{up}
3040 Increase the priority of the current item.  The priority is changed in
3041 the original buffer, but the agenda is not resorted.  Use the @kbd{r}
3042 key for this.
3044 @kindex -
3045 @kindex S-@key{down}
3046 @item -
3047 @itemx S-@key{down}
3048 Decrease the priority of the current item.
3050 @kindex C-c C-s
3051 @item C-c C-s
3052 Schedule this item
3054 @kindex C-c C-d
3055 @item C-c C-d
3056 Set a deadline for this item.
3058 @kindex S-@key{right}
3059 @item S-@key{right}
3060 Change the time stamp associated with the current line by one day into
3061 the future.  With prefix argument, change it by that many days.  For
3062 example, @kbd{3 6 5 S-@key{right}} will change it by a year.  The
3063 stamp is changed in the original org file, but the change is not
3064 directly reflected in the agenda buffer.  Use the
3065 @kbd{r} key to update the buffer.
3067 @kindex S-@key{left}
3068 @item S-@key{left}
3069 Change the time stamp associated with the current line by one day
3070 into the past.
3072 @kindex >
3073 @item >
3074 Change the time stamp associated with the current line to today.
3075 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
3076 on my keyboard.
3078 @cindex diary entries, creating from agenda
3079 @kindex i
3080 @item i
3081 Insert a new entry into the diary.  Prompts for the type of entry
3082 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
3083 entry in the diary, just as @kbd{i d} etc. would do in the calendar.
3084 The date is taken from the cursor position.
3086 @tsubheading{Calendar commands}
3087 @kindex c
3088 @item c
3089 Open the Emacs calendar and move to the date at the agenda cursor.
3091 @item c
3092 When in the calendar, compute and show the Org-mode agenda for the
3093 date at the cursor.
3095 @kindex M
3096 @item M
3097 Show the phases of the moon for the three months around current date.
3099 @kindex S
3100 @item S
3101 Show sunrise and sunset times.  The geographical location must be set
3102 with calendar variables, see documentation of the Emacs calendar.
3104 @kindex C
3105 @item C
3106 Convert the date at cursor into many other cultural and historic
3107 calendars.
3109 @kindex H
3110 @item H
3111 Show holidays for three month around the cursor date.
3113 @kindex C-c C-x C-c
3114 @item C-c C-x C-c
3115 Export a single iCalendar file containing entries from all agenda files.
3117 @tsubheading{Quit and Exit}
3118 @kindex q
3119 @item q
3120 Quit agenda, remove the agenda buffer.
3122 @kindex x
3123 @cindex agenda files, removing buffers
3124 @item x
3125 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
3126 for the compilation of the agenda.  Buffers created by the user to
3127 visit org files will not be removed.
3129 @end table
3131 @node Exporting, Publishing, Agenda views, Top
3132 @chapter Exporting
3133 @cindex exporting
3135 Org-mode documents can be exported into a variety of other formats.  For
3136 printing and sharing of notes, ASCII export produces a readable and
3137 simple version of an Org-mode file.  HTML export allows you to publish a
3138 notes file on the web, while the XOXO format provides a solid base for
3139 exchange with a broad range of other applications.  To incorporate
3140 entries with associated times like deadlines or appointments into a
3141 desktop calendar program like iCal, Org-mode can also produce extracts
3142 in the iCalendar format.  Currently Org-mode only supports export, not
3143 import of these different formats.
3145 When exporting, Org-mode uses special conventions to enrich the output
3146 produced.  @xref{Text interpretation}, for more details.
3148 @menu
3149 * ASCII export::                Exporting to plain ASCII
3150 * HTML export::                 Exporting to HTML
3151 * XOXO export::                 Exporting to XOXO
3152 * iCalendar export::            Exporting in iCalendar format
3153 * Text interpretation::         How the exporter looks at the file
3154 @end menu
3156 @node ASCII export, HTML export, Exporting, Exporting
3157 @section ASCII export
3158 @cindex ASCII export
3160 ASCII export produces a simple and very readable version of an Org-mode
3161 file.
3163 @cindex region, active
3164 @cindex active region
3165 @cindex transient-mark-mode
3166 @table @kbd
3167 @kindex C-c C-x a
3168 @item C-c C-x a
3169 Export as ASCII file.  If there is an active region, only the region
3170 will be exported.  For an org file @file{myfile.org}, the ASCII file
3171 will be @file{myfile.txt}.  The file will be overwritten without
3172 warning.
3173 @kindex C-c C-x v a
3174 @item C-c C-x v a
3175 Export only the visible part of the document.
3176 @end table
3178 @cindex headline levels, for exporting
3179 In the exported version, the first 3 outline levels will become
3180 headlines, defining a general document structure.  Additional levels
3181 will be exported as itemized lists.  If you want that transition to occur
3182 at a different level, specify it with a prefix argument.  For example,
3184 @example
3185 @kbd{C-1 C-c C-x a}
3186 @end example
3188 @noindent
3189 creates only top level headlines and does the rest as items.  When
3190 headlines are converted to items, the indentation of the text following
3191 the headline is changed to fit nicely under the item.  This is done with
3192 the assumption that the first bodyline indicates the base indenation of
3193 the body text.  Any indenation larger than this is adjusted to preserve
3194 the layout relative to the first line.  Should there be lines with less
3195 indentation than the first, these are left alone.
3197 @node HTML export, XOXO export, ASCII export, Exporting
3198 @section HTML export
3199 @cindex HTML export
3201 Org-mode contains an HTML (XHTML 1.0 strict) exporter with extensive
3202 HTML formatting, in ways similar to John Grubers @emph{markdown}
3203 language, but with additional support for tables.
3205 @cindex region, active
3206 @cindex active region
3207 @cindex transient-mark-mode
3208 @table @kbd
3209 @kindex C-c C-x h
3210 @item C-c C-x h
3211 Export as HTML file @file{myfile.html}.
3212 @kindex C-c C-x b
3213 @item C-c C-x b
3214 Export as HTML file and open it with a browser.
3215 @kindex C-c C-x v h
3216 @kindex C-c C-x v b
3217 @item C-c C-x v h
3218 @item C-c C-x v b
3219 Export only the visible part of the document.
3220 @end table
3222 @cindex headline levels, for exporting
3223 In the exported version, the first 3 outline levels will become
3224 headlines, defining a general document structure.  Additional levels
3225 will be exported as itemized lists.  If you want that transition to occur
3226 at a different level, specify it with a prefix argument.  For example,
3228 @example
3229 @kbd{C-2 C-c C-x b}
3230 @end example
3232 @noindent
3233 creates two levels of headings and does the rest as items.
3235 If you want to include HTML tags which should be interpreted as such,
3236 mark them with @samp{@@} as in @samp{@@<b>bold text@@</b>}.
3237 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
3238 @samp{&gt;} in HTML export.
3240 @cindex links, in HTML export
3241 @cindex internal links, in HTML export
3242 @cindex external links, in HTML export
3243 Internal links (@pxref{Internal links}) will continue to work in HTML
3244 files only if they match a dedicated @samp{<<target>>}.  Automatic links
3245 created by radio targets (@pxref{Radio targets}) will also work in the
3246 HTML file.  Links to external files will still work if the HTML file is
3247 in the same directory as the Org-mode file.  Links to other @file{.org}
3248 files will be translated into HTML links under the assumption that an
3249 HTML version also exists of the linked file.  For information related to
3250 linking files while publishing them to a publishing directory see
3251 @ref{Publishing links}.
3253 You can also give style information for the exported file.  The HTML
3254 exporter assigns the following CSS classes to appropriate parts of the
3255 document - your style specifications may change these:
3256 @example
3257 .todo           @r{TODO keywords}
3258 .done           @r{the DONE keyword}
3259 .timestamp      @r{time stamp}
3260 .timestamp-kwd  @r{keyword associated with a time stamp, like SCHEDULED}
3261 .tag            @r{tag in a headline}
3262 .target         @r{target for links}
3263 @end example
3265 The default style specification can be configured through the option
3266 @code{org-export-html-style}.  If you want to use a file-local style,
3267 you may use file variables, best wrapped into a COMMENT section at the
3268 end of the outline tree.  For example:
3270 @example
3271 * COMMENT HTML style specifications
3273 # Local Variables:
3274 # org-export-html-style: "   <style type=\"text/css\">
3275 #       p @{font-weight: normal; color: gray; @}
3276 #       h1 @{color: black; @}
3277 #   </style>"
3278 # End:
3279 @end example
3281 Remember to execute @kbd{M-x normal-mode} after changing this to make
3282 the new style visible to Emacs.  This command restarts org-mode for the
3283 current buffer and forces Emacs to re-evaluate the local variables
3284 section in the buffer.
3286 @c FIXME: More about header and footer styles
3287 @c FIXME: Talk about links and targets.
3289 @node XOXO export, iCalendar export, HTML export, Exporting
3290 @section XOXO export
3291 @cindex XOXO export
3293 Org-mode contains an exporter that produces XOXO-style output.
3294 Currently, this exporter only handles the general outline structure and
3295 does not interpret any additional Org-mode features.
3297 @table @kbd
3298 @kindex C-c C-x C-x
3299 @item C-c C-x C-x
3300 Export as XOXO file @file{myfile.html}.
3301 @kindex C-c C-x v
3302 @item C-c C-x v x
3303 Export only the visible part of the document.
3304 @end table
3306 @node iCalendar export, Text interpretation, XOXO export, Exporting
3307 @section iCalendar export
3308 @cindex iCalendar export
3310 Some people like to use Org-mode for keeping track of projects, but
3311 still prefer a standard calendar application for anniversaries and
3312 appointments.  In this case it can be useful to have deadlines and
3313 other time-stamped items in Org-mode files show up in the calendar
3314 application.  Org-mode can export calendar information in the standard
3315 iCalendar format.
3317 @table @kbd
3318 @kindex C-c C-x i
3319 @item C-c C-x i
3320 Create iCalendar entries for the current file and store them in the same
3321 directory, using a file extension @file{.ics}.
3322 @kindex C-c C-x C-i
3323 @item C-c C-x C-i
3324 Like @kbd{C-c C-x i}, but do this for all files in
3325 @code{org-agenda-files}.  For each of these files, a separate iCalendar
3326 file will be written.
3327 @kindex C-c C-x c
3328 @item C-c C-x c
3329 Create a single large iCalendar file from all files in
3330 @code{org-agenda-files} and write it to the file given by
3331 @code{org-combined-agenda-icalendar-file}.
3332 @end table
3334 How this calendar is best read and updated, depends on the application
3335 you are using.  For example, when using iCal under Apple MacOS X, you
3336 could create a new calendar @samp{OrgMode} (the default name for the
3337 calendar created by @kbd{C-c C-x c}, see the variables
3338 @code{org-icalendar-combined-name} and
3339 @code{org-combined-agenda-icalendar-file}).  Then set Org-mode to
3340 overwrite the corresponding file
3341 @file{~/Library/Calendars/OrgMode.ics}.  You may even use AppleScript
3342 to make iCal re-read the calendar files each time a new version of
3343 @file{OrgMode.ics} is produced.  Here is the setup needed for this:
3345 @cindex applescript, for calendar update
3346 @lisp
3347 (setq org-combined-agenda-icalendar-file
3348     "~/Library/Calendars/OrgMode.ics")
3349 (add-hook 'org-after-save-iCalendar-file-hook
3350  (lambda ()
3351   (shell-command
3352    "osascript -e 'tell application \"iCal\" to reload calendars'")))
3353 @end lisp
3355 @node Text interpretation,  , iCalendar export, Exporting
3356 @section Text interpretation by the exporter
3358 The exporter backends interpret additional structure in the Org-mode file
3359 in order to produce better output.
3361 @menu
3362 * Comment lines::               Some lines will not be exported
3363 * Enhancing text::              Subscripts, symbols and more
3364 * Export options::              How to influence the export settings
3365 @end menu
3367 @node Comment lines, Enhancing text, Text interpretation, Text interpretation
3368 @subsection Comment lines
3369 @cindex comment lines
3370 @cindex exporting, not
3372 Lines starting with @samp{#} in column zero are treated as comments
3373 and will never be exported.  Also entire subtrees starting with the
3374 word @samp{COMMENT} will never be exported.  Finally, any text before
3375 the first headline will not be exported either.
3377 @table @kbd
3378 @kindex C-c ;
3379 @item C-c ;
3380 Toggle the COMMENT keyword at the beginning of an entry.
3381 @end table
3383 @node Enhancing text, Export options, Comment lines, Text interpretation
3384 @subsection Enhancing text for export
3385 @cindex enhancing text
3386 @cindex richer text
3388 Some of the export backends of Org-mode allow for sophisticated text
3389 formatting, this is true in particular for the HTML backend.  Org-mode
3390 has a number of typing conventions that allow to produce a richly
3391 formatted output.
3394 @itemize @bullet
3396 @cindex hand-formatted lists
3397 @cindex lists, hand-formatted
3398 @item
3399 Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
3400 or @samp{2)} as enumerator will be recognized and transformed if the
3401 backend supports lists.  See @xref{Plain lists}.
3403 @cindex underlined text
3404 @cindex bold text
3405 @cindex italic text
3406 @item
3407 You can make words @b{*bold*}, @i{/italic/}, and _underlined_
3409 @cindex @TeX{} interpretation
3410 @item
3411 Simple @TeX{}-like math constructs are interpreted:
3413 @cindex completion, of @TeX{} symbols
3414 @itemize @minus
3415 @item
3416 @samp{10^22} and @samp{J_n} are super- and subscripts.  You can quote
3417 @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}
3418 @item
3419 @samp{\alpha} indicates a Greek letter, @samp{\to} an arrow.  You can
3420 use completion for these macros, just type @samp{\} and maybe a few
3421 letters, and press @kbd{M-@key{TAB}} to see possible completions.
3422 @end itemize
3424 @cindex tables, export
3425 @item
3426 Tables are transformed into native tables under the exporter, if the
3427 export backend supports this. Data fields before the first horizontal
3428 separator line will be formatted as table header fields.
3430 @cindex fixed width
3431 @item
3432 If a headline starts with the word @samp{QUOTE}, the text below the
3433 headline will be typeset as fixed-width, to allow quoting of computer
3434 codes etc.  Lines starting with @samp{:} are also typeset in
3435 fixed-width font.
3436 @table @kbd
3437 @kindex C-c :
3438 @item C-c :
3439 Toggle fixed-width for entry (QUOTE) or region, see below.
3440 @end table
3442 @cindex linebreak, forced
3443 @item 
3444 A double backslash @emph{at the end of a line} enforces a line break at
3445 this position.
3446 @end itemize
3448 If these conversions conflict with your habits of typing ASCII text,
3449 they can all be turned off with corresponding variables (see the
3450 customization group @code{org-export-general}, and the following section
3451 which explains how to set export options with special lines in a
3452 buffer.
3454 @node Export options,  , Enhancing text, Text interpretation
3455 @subsection Export options
3456 @cindex options, for export
3458 @cindex completion, of option keywords
3459 The exporter recognizes special lines in the buffer which provide
3460 additional information.  These lines may be put anywhere in the file.
3461 The whole set of lines can be inserted into the buffer with @kbd{C-c
3462 C-x t}.  For individual lines, a good way to make sure the keyword is
3463 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
3464 (@pxref{Completion}).
3466 @table @kbd
3467 @kindex C-c C-x t
3468 @item C-c C-x t
3469 Insert template with export options, see example below.
3470 @end table
3472 @example
3473 #+TITLE:     the title to be shown (default is the buffer name)
3474 #+AUTHOR:    the author (default taken from @code{user-full-name})
3475 #+EMAIL:     his/her email address (default from @code{user-mail-address})
3476 #+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
3477 #+TEXT:      Some descriptive text to be inserted at the beginning.
3478 #+TEXT:      Several lines may be given.
3479 #+OPTIONS:   H:2  num:t  toc:t  \n:nil  @:t  ::t  |:t  ^:t  *:nil  TeX:t
3480 @end example
3482 @noindent
3483 The OPTIONS line is a compact form to specify export settings.  Here
3484 you can:
3485 @cindex headline levels
3486 @cindex section-numbers
3487 @cindex table of contents
3488 @cindex linebreak preservation
3489 @cindex quoted HTML tags
3490 @cindex fixed-width sections
3491 @cindex tables
3492 @cindex @TeX{}-like syntax for sub- and superscripts
3493 @cindex emphasized text
3494 @cindex @TeX{} macros
3495 @example
3496 H:      @r{set the number of headline levels for export}
3497 num:    @r{turn on/off section-numbers}
3498 toc:    @r{turn on/off table of contents}
3499 \n:     @r{turn on/off linebreak-preservation}
3500 @@:      @r{turn on/off quoted HTML tags}
3501 ::      @r{turn on/off fixed-width sections}
3502 |:      @r{turn on/off tables}
3503 ^:      @r{turn on/off @TeX{}-like syntax for sub- and superscripts.}
3504 *:      @r{turn on/off emphasized text (bold, italic, underlined)}
3505 TeX:    @r{turn on/off @TeX{} macros}
3506 @end example
3508 @node Publishing, Miscellaneous, Exporting, Top
3509 @chapter Publishing
3511 Org-mode includes@footnote{@file{org-publish.el} is not yet part of
3512 emacs, so if you are using @file{org.el} as it comes with Emacs, you
3513 need to download this file separately.  Also make sure org.el is at
3514 least version 4.27.} a publishing management system
3515 that allows you to configure automatic HTML conversion of
3516 @emph{projects} composed of interlinked org files.  This system is
3517 called @emph{org-publish}.  You can also configure org-publish to
3518 automatically upload your exported HTML pages and related attachments,
3519 such as images and source code files, to a web server.  Org-publish turns
3520 org-mode into a web-site authoring tool.
3522 Org-publish has been contributed to Org-mode by David O'Toole.
3524 @menu
3525 * Configuration::               Defining projects
3526 * Sample configuration::        Example projects
3527 * Triggering publication::      Publication commands
3528 @end menu
3530 @node Configuration, Sample configuration, Publishing, Publishing
3531 @section Configuration
3533 Publishing needs significant configuration to specify files, destination
3534 and many other properties of a project.
3536 @menu
3537 * Project alist::               The central configuration variable
3538 * File sources and destinations::  From here to there
3539 * Selecting files::             What files are part of the project?
3540 * Publishing action::           Setting the function doing the publishing
3541 * Publishing options::          Tweaking HTML export
3542 * Publishing links::            Which links keep working after publishing?
3543 * Project page index::          Publishing a list of project files
3544 @end menu
3546 @node Project alist, File sources and destinations, Configuration, Configuration
3547 @subsection The variable @code{org-publish-project-alist}
3549 Org-publish is configured almost entirely through setting the value of
3550 one variable, called @code{org-publish-project-alist}.
3551 Each element of the list configures one project, and may be in one of
3552 the two following forms:
3554 @lisp
3555 ("project-name"  :property value :property value ...)
3557 @r{or} 
3559 ("project-name"  :components ("project-name" "project-name" ...))
3561 @end lisp
3563 In both cases, projects are configured by specifying property values.
3564 A project defines the set of files that will be published, as well as
3565 the publishing configuration to use when publishing those files.  When
3566 a project takes the second form listed above, the individual members
3567 of the ``components'' property are taken to be components of the
3568 project, which group together files requiring different publishing
3569 options. When you publish such a ``meta-project'' all the components
3570 will also publish.
3572 @node File sources and destinations, Selecting files, Project alist, Configuration
3573 @subsection Sources and destinations for files
3575 Most properties are optional, but some should always be set. In
3576 particular, org-publish needs to know where to look for source files,
3577 and where to put published files.
3579 @multitable @columnfractions 0.3 0.7
3580 @item @code{:base-directory}
3581 @tab Directory containing publishing source files
3582 @item @code{:publishing-directory}
3583 @tab Directory (possibly remote) where output files will be published.
3584 @end multitable
3585 @noindent
3587 @node Selecting files, Publishing action, File sources and destinations, Configuration
3588 @subsection Selecting files
3590 By default, all files with extension @file{.org} in the base directory
3591 are considered part of the project.  This can be modified by setting the
3592 properties 
3593 @multitable @columnfractions 0.25 0.75
3594 @item @code{:base-extension}
3595 @tab Extension (without the dot!) of source files.  This actually is a
3596 regular expression.
3598 @item @code{:exclude} 
3599 @tab Regular expression to match file names that should not be
3600 published, even though they have been selected on the basis of their
3601 extension.
3603 @item @code{:include}
3604 @tab List of files to be included regardless of @code{:base-extension}
3605 and @code{:exclude}.
3606 @end multitable
3608 @node Publishing action, Publishing options, Selecting files, Configuration
3609 @subsection Publishing Action
3611 Publishing means that a file is copied to the destination directory and
3612 possibly transformed in the process.  The default transformation is to
3613 export Org-mode files as HTML files, and this is done by the function
3614 @code{org-publish-org-to-html} which calls the HTML exporter
3615 (@pxref{HTML export}).  Other files like images only need to be copied
3616 to the publishing destination.  For non-Org-mode files, you need to
3617 specify the publishing function.
3619 @multitable @columnfractions 0.3 0.7
3620 @item @code{:publishing-function}
3621 @tab Function executing the publication of a file.
3622 @end multitable
3624 The function must accept two arguments: a property list containing at
3625 least a @code{:publishing-directory} property, and the name of the file
3626 to be published.  It should take the specified file, make the necessary
3627 transformation (if any) and place the result into the destination folder.
3628 You can write your own publishing function, but @code{org-publish}
3629 provides one for attachments (files that only need to be copied):
3630 @code{org-publish-attachment}.
3632 @node Publishing options, Publishing links, Publishing action, Configuration
3633 @subsection Options for the HTML exporter
3635 The property list can be used to set many export options for the HTML
3636 exporter.  In most cases, these properties correspond to user variables
3637 in Org-mode.  The table below lists these properties along with the
3638 variable they belong to.  See the documentation string for the
3639 respective variable for details.
3641 @multitable @columnfractions 0.3 0.7
3642 @item @code{:language}              @tab @code{org-export-default-language}
3643 @item @code{:headline-levels}       @tab @code{org-export-headline-levels}
3644 @item @code{:section-numbers}       @tab @code{org-export-with-section-numbers}
3645 @item @code{:table-of-contents}     @tab @code{org-export-with-toc}
3646 @item @code{:emphasize}             @tab @code{org-export-with-emphasize}
3647 @item @code{:sub-superscript}       @tab @code{org-export-with-sub-superscripts}
3648 @item @code{:TeX-macros}            @tab @code{org-export-with-TeX-macros}
3649 @item @code{:fixed-width}           @tab @code{org-export-with-fixed-width}
3650 @item @code{:timestamps}           .@tab @code{org-export-with-timestamps}
3651 @item @code{:tags}                 .@tab @code{org-export-with-tags}
3652 @item @code{:tables}                @tab @code{org-export-with-tables}
3653 @item @code{:table-auto-headline}   @tab @code{org-export-highlight-first-table-line}
3654 @item @code{:style}                 @tab @code{org-export-html-style}
3655 @item @code{:convert-org-links}     @tab @code{org-export-html-link-org-files-as-html}
3656 @item @code{:inline-images}         @tab @code{org-export-html-inline-images}
3657 @item @code{:expand-quoted-html}    @tab @code{org-export-html-expand}
3658 @item @code{:timestamp}             @tab @code{org-export-html-with-timestamp}
3659 @item @code{:publishing-directory}  @tab @code{org-export-publishing-directory}
3660 @item @code{:preamble}              @tab @code{org-export-html-preamble}
3661 @item @code{:postamble}             @tab @code{org-export-html-postamble}
3662 @item @code{:auto-preamble}         @tab @code{org-export-html-auto-preamble}
3663 @item @code{:auto-postamble}        @tab @code{org-export-html-auto-postamble}
3664 @item @code{:author}                @tab @code{user-full-name}
3665 @item @code{:email}                 @tab @code{user-mail-address}
3666 @end multitable
3668 When a property is given a value in org-publish-project-alist, its
3669 setting overrides the value of the corresponding user variable (if any)
3670 during publishing.  options set within a file (@pxref{Export
3671 options}), however, override everything.
3673 @node Publishing links, Project page index, Publishing options, Configuration
3674 @subsection Links between published files
3676 To create a link from one Org-mode file to another, you would use
3677 something like @samp{[[file:foo.org][The foo]]} or simply
3678 @samp{file:foo.org.} (@pxref{Hyperlinks}).  Upon publishing this link
3679 becomes a link to @file{foo.html}.  In this way, you can interlink the
3680 pages of your "org web" project and the links will work as expected when
3681 you publish them to HTML.
3683 You may also link to related files, such as images. Provided you are
3684 careful with relative pathnames, and provided you have also configured
3685 org-publish to upload the related files, these links will work
3686 too. @ref{Complex example} for an example of this usage.
3688 @node Project page index,  , Publishing links, Configuration
3689 @subsection Project page index
3691 The following properties may be used to control publishing of an
3692 index of files or summary page for a given project.
3694 @multitable @columnfractions 0.25 0.75
3695 @item @code{:auto-index}
3696 @tab When non-nil, publish an index during org-publish-current-project or
3697 org-publish-all.
3699 @item @code{:index-filename}
3700 @tab Filename for output of index. Defaults to @file{index.org} (which
3701 becomes @file{index.html}).
3703 @item @code{:index-title}
3704 @tab Title of index page. Defaults to name of file.
3706 @item @code{:index-function}
3707 @tab Plugin function to use for generation of index.
3708 Defaults to @code{org-publish-org-index}, which generates a plain list
3709 of links to all files in the project.
3710 @end multitable
3712 @node Sample configuration, Triggering publication, Configuration, Publishing
3713 @section Sample configuration
3715 Below we provide two example configurations.  The first one is a simple
3716 project publishing only a set of Org-mode files.  The second example is
3717 more complex, with a multi-component project.
3719 @menu
3720 * Simple example::              One-component publishing
3721 * Complex example::             A multi-component publishing example
3722 @end menu
3724 @node Simple example, Complex example, Sample configuration, Sample configuration
3725 @subsection Example: simple publishing configuration
3727 This example publishes a set of Org-mode files to the @file{public_html}
3728 directory on the local machine.
3730 @lisp
3731 (setq org-publish-project-alist
3732       '(("org" 
3733          :base-directory "~/org/"
3734          :publishing-directory "~/public_html"
3735          :section-numbers nil
3736          :table-of-contents nil
3737          :style "<link rel=stylesheet 
3738                 href=\"../other/mystyle.css\"
3739                 type=\"text/css\">")))
3740 @end lisp
3742 @node Complex example,  , Simple example, Sample configuration
3743 @subsection Example: complex publishing configuration
3745 This more complicated example publishes an entire website, including
3746 org files converted to HTML, image files, emacs lisp source code, and
3747 stylesheets. The publishing-directory is remote and private files are
3748 excluded.
3750 To ensure that links are preserved, care should be taken to replicate
3751 your directory structure on the web server, and to use relative file
3752 paths. For example, if your org files are kept in @file{~/org} and your
3753 publishable images in @file{~/images}, you'd link to an image with
3755 @example
3756 file:../images/myimage.png
3757 @end example
3759 On the web server, the relative path to the image should be the
3760 same. You can accomplish this by setting up an "images" folder in the
3761 right place on the webserver, and publishing images to it.
3763 @lisp
3764 (setq org-publish-project-alist
3765       '(("orgfiles"
3766           :base-directory "~/org/"
3767           :base-extension "org"
3768           :publishing-directory "/ssh:user@@host:~/html/notebook/"
3769           :publishing-function org-publish-org-to-html
3770           :exclude "PrivatePage.org"   ;; regexp
3771           :headline-levels 3
3772           :section-numbers nil
3773           :table-of-contents nil
3774           :style "<link rel=stylesheet 
3775                   href=\"../other/mystyle.css\" type=\"text/css\">"
3776           :auto-preamble t
3777           :auto-postamble nil)
3778          
3779          ("images"
3780           :base-directory "~/images/"
3781           :base-extension "jpg\\|gif\\|png"
3782           :publishing-directory "/ssh:user@@host:~/html/images/"
3783           :publishing-function org-publish-attachment)
3785          ("other"
3786           :base-directory "~/other/"
3787           :base-extension "css\\|el"
3788           :publishing-directory "/ssh:user@@host:~/html/other/"
3789           :publishing-function org-publish-attachment)
3790          ("website" :components ("orgfiles" "images" "other"))))
3791 @end lisp
3793 @node Triggering publication,  , Sample configuration, Publishing
3794 @section Triggering publication
3796 Once org-publish is properly configured, you can publish with the
3797 following functions: 
3799 @table @kbd
3800 @item C-c C-e c
3801 Prompts for a specific project to publish.
3802 @item C-c C-e p
3803 Publishes the project the current file is part of. 
3804 @item C-c C-e f
3805 Publishes only the current file.
3806 @item C-c C-e a
3807 Publish all projects.
3808 @end table
3810 Org uses timestamps to track when a file has changed. The above
3811 functions normally only publish changed files. You can override this and
3812 force publishing of all files by giving a prefix argument. 
3814 @node Miscellaneous, Index, Publishing, Top
3815 @chapter Miscellaneous
3817 @menu
3818 * Completion::                  M-TAB knows what you need
3819 * Customization::               Adapting Org-mode to your taste
3820 * Summary of in-buffer settings::  Using special lines to set options
3821 * The very busy C-c C-c key::   When in doubt, press C-c C-c
3822 * Clean view::                  Getting rid of leading stars in the outline
3823 * TTY keys::                    Using Org-mode on a tty
3824 * FAQ::                         Frequently asked questions
3825 * Interaction::                 Other Emacs packages
3826 * Bugs::                        Things which do not work perfectly
3827 * Acknowledgments::             These people provided feedback and more
3828 @end menu
3830 @node Completion, Customization, Miscellaneous, Miscellaneous
3831 @section Completion
3832 @cindex completion, of @TeX{} symbols
3833 @cindex completion, of TODO keywords
3834 @cindex completion, of dictionary words
3835 @cindex completion, of option keywords
3836 @cindex completion, of CamelCase links
3837 @cindex completion, of tags
3838 @cindex @TeX{} symbol completion
3839 @cindex TODO keywords completion
3840 @cindex dictionary word completion
3841 @cindex option keyword completion
3842 @cindex CamelCase link completion
3843 @cindex tag completion
3845 Org-mode supports in-buffer completion.  This type of completion does
3846 not make use of the minibuffer.  You simply type a few letters into
3847 the buffer and use the key to complete text right there.
3849 @table @kbd
3850 @kindex M-@key{TAB}
3851 @item M-@key{TAB}
3852 Complete word at point
3853 @itemize @bullet
3854 @item
3855 At the beginning of a headline, complete TODO keywords.
3856 @item
3857 After @samp{\}, complete @TeX{} symbols supported by the exporter.
3858 @item
3859 After @samp{*}, complete CamelCase versions of all headlines in the
3860 buffer.
3861 @item
3862 After @samp{:}, complete tags used elsewhere in the buffer.
3863 @item
3864 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
3865 @samp{OPTIONS} which set file-specific options for Org-mode.  When the
3866 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
3867 will insert example settings for this keyword.
3868 @item
3869 Elsewhere, complete dictionary words using ispell.
3870 @end itemize
3871 @end table
3874 @node Customization, Summary of in-buffer settings, Completion, Miscellaneous
3875 @section Customization
3876 @cindex customization
3877 @cindex options, for customization
3878 @cindex variables, for customization
3880 There are more than 100 variables that can be used to customize
3881 Org-mode.  For the sake of compactness of the manual, we are not
3882 describing the variables here.  A structured overview of customization
3883 variables is available with @kbd{M-x org-customize}.  Or select
3884 @code{Browse Org Group} from the @code{Org->Customization} menu.  Many
3885 settings can also be activated on a per-file basis, by putting special
3886 lines into the buffer (@pxref{Summary of in-buffer settings}).
3888 @node Summary of in-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
3889 @section Summary of in-buffer settings
3890 @cindex in-buffer settings
3891 @cindex special keywords
3893 Org-mode uses special lines in the buffer to define settings on a
3894 per-file basis.  These lines start with a @samp{#+} followed by a
3895 keyword, a colon, and then individual words defining a setting.  Several
3896 setting words can be in the same line, but you can also have multiple
3897 lines for the keyword.  While these settings are described throughout
3898 the manual, here is a summary.  After changing any of those lines in the
3899 buffer, press @kbd{C-c C-c} with the cursor still in the line to
3900 activate the changes immediately.  Otherwise they become effective only
3901 when the file is visited again in a new Emacs session.
3903 @table @kbd
3904 @item #+STARTUP:
3905 This line sets options to be used at startup of org-mode, when an
3906 Org-mode file is being visited.  The first set of options deals with the
3907 initial visibility of the outline tree.  The corresponding variable for
3908 global default settings is @code{org-startup-folded}, with a default
3909 value @code{t}, which means @code{overview}.
3910 @example
3911 overview   @r{top-level headlines only}
3912 content    @r{all headlines}
3913 showall    @r{no folding at all, show everything}
3914 @end example
3915 Then there are options for aligning tables upon visiting a file.  This
3916 is useful in files containing narrowed table columns.  The corresponding
3917 variable is @code{org-startup-align-all-tables}, with a default value
3918 @code{nil}. 
3919 @example
3920 align      @r{align all tables}
3921 noalign    @r{don't align tables on startup}
3922 @end example
3923 Logging when a TODO item is marked DONE (variable @code{org-log-done})
3924 can be configured using these options.
3925 @example
3926 logging    @r{record a timestamp when an item is marked DONE}
3927 nologging  @r{don't record when items are marked DONE}
3928 @end example
3929 Here are the options for hiding leading stars in outline headings.  The
3930 corresponding variables are @code{org-hide-leading-stars} and
3931 @code{org-odd-levels-only}, both with a default setting @code{nil}
3932 (meaning @code{showstars} and @code{oddeven}).
3933 @example
3934 hidestars  @r{make all but one of the stars starting a headline invisible.}
3935 showstars  @r{show all stars starting a headline}
3936 odd        @r{allow only odd outline levels (1,3,...)}
3937 oddeven    @r{allow all outline levels}
3938 @end example
3939 @item #+SEQ_TODO:   #+TYP_TODO:
3940 These lines set the TODO keywords and their interpretation in the
3941 current file.  The corresponding variables are @code{org-todo-keywords}
3942 and @code{org-todo-interpretation}.
3943 @item #+TAGS:  TAG1(c1) TAG2(c2)
3944 These lines (several such lines are allowed) specify the legal tags in
3945 this file, and (potentially) the corresponding @emph{fast tag selection}
3946 keys.  The corresponding variable is @code{org-tag-alist}.
3947 @item #+CATEGORY:
3948 This line sets the category for the agenda file.  The category applies
3949 for all subsequent lines until the next @samp{#+CATEGORY} line, or the
3950 end of the file.
3951 @item #+TBLFM:
3952 This line contains the formulas for the table directly above the line.
3953 @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS:
3954 These lines provide settings for exporting files.  For more details see
3955 @ref{Export options}.
3956 @end table
3958 @node The very busy C-c C-c key, Clean view, Summary of in-buffer settings, Miscellaneous
3959 @section The very busy C-c C-c key
3960 @kindex C-c C-c
3962 The key @kbd{C-c C-c} has many purposes in org-mode, which are all
3963 mentioned scattered throughout this manual.  One specific function of
3964 this key is to add @emph{tags} to a headline (@pxref{Tags}).  In many
3965 other circumstances it means something like @emph{Hey Org-mode, look
3966 here and update according to what you see here}.  Here is a summary of what
3967 this means in different contexts.
3969 @itemize @minus
3970 @c @item
3971 @c If the cursor is in a headline, prompt for tags and insert them
3972 @c into the current line, aligned to `org-tags-column'.  When called
3973 @c with prefix arg, realign all tags in the current buffer.
3974 @item
3975 If the cursor is in one of the special @code{#+KEYWORD} lines, this
3976 triggers scanning the buffer for these lines and updating the
3977 information. 
3978 @item
3979 If the cursor is inside a table, realign the table.  This command
3980 works even if the automatic table editor has been turned off.
3981 @item
3982 If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
3983 the entire table.
3984 @item
3985 If the cursor is inside a table created by the @file{table.el} package,
3986 activate that table.
3987 @item
3988 If the current buffer is a remember buffer, close note and file it.
3989 with a prefix argument, file it without further interaction to the default
3990 location.
3991 @item
3992 If the cursor is on a @code{<<<target>>>}, update radio targets and
3993 corresponding links in this buffer.
3994 @item
3995 If the cursor is in a plain list item with a checkbox, toggle the status
3996 of the checkbox.
3997 @item
3998 If the cursor is on a numbered item in a plain list, renumber the
3999 ordered list.
4000 @end itemize
4002 @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
4003 @section A cleaner outline view
4004 @cindex hiding leading stars
4005 @cindex clean outline view
4007 Some people find it noisy and distracting that the Org-mode headlines
4008 are starting with a potentially large number of stars.  For example
4009 the tree from @ref{Headlines}:
4011 @example
4012 * Top level headline
4013 ** Second level
4014 *** 3rd level
4015     some text
4016 *** 3rd level
4017     more text
4018 * Another top level headline
4019 @end example
4021 @noindent
4022 Unfortunately this is deeply ingrained into the code of Org-mode and
4023 cannot be easily changed.  You can, however, modify the display in such
4024 a way that all leading stars become invisible and the outline more easy
4025 to read.  To do this, customize the variable
4026 @code{org-hide-leading-stars} like this:
4028 @lisp
4029 (setq org-hide-leading-stars t)
4030 @end lisp
4032 @noindent
4033 or change this on a per-file basis with one of the lines (anywhere in
4034 the buffer)
4036 @example
4037 #+STARTUP: showstars
4038 #+STARTUP: hidestars
4039 @end example
4041 @noindent
4042 Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
4043 the modifications.
4045 With stars hidden, the tree becomes:
4047 @example
4048 * Top level headline
4049  * Second level
4050   * 3rd level
4051     some text
4052   * 3rd level
4053     more text
4054 * Another top level headline
4055 @end example
4057 @noindent
4058 Note that the leading stars are not truly replaced by whitespace, they
4059 are only fontified with the face @code{org-hide} that uses the
4060 background color as font color.  If are are not using either white or
4061 black background, you may have to customize this face to get the wanted
4062 effect.  Another possibility is to set this font such that the extra
4063 stars are @i{almost} invisible, for example using the color
4064 @code{grey90} on a white background.
4066 Things become cleaner still if you skip all the even levels and use only
4067 odd levels 1, 3, 5..., effectively adding two stars to go from one
4068 outline level to the next:
4070 @example
4071 * Top level headline
4072   * Second level
4073     * 3rd level
4074       some text
4075     * 3rd level
4076       more text
4077 * Another top level headline
4078 @end example
4080 @noindent
4081 In order to make the structure editing and export commands handle this
4082 convention correctly, use
4084 @lisp
4085 (setq org-odd-levels-only t)
4086 @end lisp
4088 @noindent
4089 or set this on a per-file basis with one of the following lines (don't
4090 forget to press @kbd{C-c C-c} with the cursor in the startup line to
4091 activate changes immediately).
4093 @example
4094 #+STARTUP: odd
4095 #+STARTUP: oddeven
4096 @end example
4098 You can convert an Org-mode file from single-star-per-level to the
4099 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
4100 RET} in that file.  The reverse operation is @kbd{M-x
4101 org-convert-to-oddeven-levels}.
4103 @node TTY keys, FAQ, Clean view, Miscellaneous
4104 @section Using org-mode on a tty
4105 @cindex tty keybindings
4107 Org-mode uses a number of keys that are not accessible on a tty.  This
4108 applies to most special keys like cursor keys, @key{TAB} and
4109 @key{RET}, when these are combined with modifier keys like @key{Meta}
4110 and/or @key{Shift}.  Org-mode uses these bindings because it needs to
4111 provide keys for a large number of commands, and because these keys
4112 appeared particularly easy to remember.  In order to still be able to
4113 access the core functionality of Org-mode on a tty, alternative
4114 bindings are provided.  Here is a complete list of these bindings,
4115 which are obviously more cumbersome to use.  Note that sometimes a
4116 work-around can be better.  For example changing a time stamp is
4117 really only fun with @kbd{S-@key{cursor}} keys.  On a tty you would
4118 rather use @kbd{C-c .}  to re-insert the timestamp.
4120 @multitable @columnfractions 0.15 0.2 0.2
4121 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
4122 @item @kbd{S-@key{TAB}}     @tab @kbd{C-u @key{TAB}}       @tab
4123 @item @kbd{M-@key{left}}    @tab @kbd{C-c C-x l}           @tab @kbd{@key{Esc} @key{left}}
4124 @item @kbd{M-S-@key{left}}  @tab @kbd{C-c C-x L}           @tab
4125 @item @kbd{M-@key{right}}   @tab @kbd{C-c C-x r}           @tab @kbd{@key{Esc} @key{right}}
4126 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R}           @tab
4127 @item @kbd{M-@key{up}}      @tab @kbd{C-c C-x u}           @tab @kbd{@key{Esc} @key{up}}
4128 @item @kbd{M-S-@key{up}}    @tab @kbd{C-c C-x U}           @tab
4129 @item @kbd{M-@key{down}}    @tab @kbd{C-c C-x d}           @tab @kbd{@key{Esc} @key{down}}
4130 @item @kbd{M-S-@key{down}}  @tab @kbd{C-c C-x D}           @tab
4131 @item @kbd{S-@key{RET}}     @tab @kbd{C-c C-x c}           @tab
4132 @item @kbd{M-@key{RET}}     @tab @kbd{C-c C-x m}           @tab @kbd{@key{Esc} @key{RET}}
4133 @item @kbd{M-S-@key{RET}}   @tab @kbd{C-c C-x M}           @tab
4134 @item @kbd{S-@key{left}}    @tab @kbd{C-c C-x @key{left}}  @tab
4135 @item @kbd{S-@key{right}}   @tab @kbd{C-c C-x @key{right}} @tab
4136 @item @kbd{S-@key{up}}      @tab @kbd{C-c C-x @key{up}}    @tab
4137 @item @kbd{S-@key{down}}    @tab @kbd{C-c C-x @key{down}}  @tab
4138 @end multitable
4140 @node FAQ, Interaction, TTY keys, Miscellaneous
4141 @section Frequently asked questions
4142 @cindex FAQ
4144 @enumerate
4145 @cindex @code{keymapp nil} error
4146 @item @b{When I try to use Org-mode, I always get
4147 @code{(wrong-type-argument keymapp nil)}}.@*
4148 @cindex allout.el, conflict with
4149 This is a conflict with an outdated version of the @file{allout.el}.
4150 See @ref{Conflicts}.
4152 @item @b{Org-mode seems to be a useful default mode for the various
4153 @file{README} files I have scattered through my directories.  How do I
4154 turn it on for all @file{README} files?}
4156 @lisp
4157 (add-to-list 'auto-mode-alist '("README$" . org-mode))
4158 @end lisp
4160 @item @b{I would like to use editing features of org-mode in other
4161 modes, is this possible?}@*
4163 Not really.  For tables there is @code{orgtbl-mode} which implements the
4164 table editor as a minor mode.  For other features you need to switch to
4165 Org-mode temporarily, or prepare text in a different buffer.
4167 @item @b{Can I get the visibility-cycling features in outline-mode and
4168 outline-minor-mode?}@* 
4170 Yes, these functions are written in a way that they are independent of
4171 the outline setup.  The following setup provides standard Org-mode
4172 functionality in outline-mode on @key{TAB} and @kbd{S-@key{TAB}}.  For
4173 outline-minor-mode, we use @kbd{C-@key{TAB}} instead of @key{TAB},
4174 because @key{TAB} usually has mode-specific tasks.
4175 @lisp
4176 (add-hook 'outline-minor-mode-hook
4177   (lambda ()
4178     (define-key outline-minor-mode-map [(control tab)] 'org-cycle)
4179     (define-key outline-minor-mode-map [(shift tab)] 'org-global-cycle)))
4180 (add-hook 'outline-mode-hook
4181   (lambda ()
4182     (define-key outline-mode-map [(tab)] 'org-cycle)
4183     (define-key outline-mode-map [(shift tab)] 'org-global-cycle)))
4184 @end lisp
4186 Or check out @file{outline-magic.el}, which does this and also provides
4187 promotion and demotion functionality.  @file{outline-magic.el} is
4188 available at @url{http://www.astro.uva.nl/~dominik/Tools/OutlineMagic}.
4190 @item @b{Some of my links stopped working after I upgraded to a version
4191 4.20 or later.  Why is this, and how can I fix it?}@*
4193 These must be links in plain text, containing white space, such as
4194 @samp{bbdb:Richard Stallman}.  You need to protect these links by
4195 putting double brackets around them, like @samp{[[bbdb:Richard
4196 Stallman]]}.
4198 @item @b{I see that Org-mode now creates links using the double bracket
4199 convention that hides the link part and the brackets, only showing the
4200 description part.  How can I convert my old links to this new format?}@*
4202 Execute once in each Org-mode file: @kbd{M-x org-upgrade-old-links}.
4203 This replaces angular brackets with the new link format.
4205 @item @b{I don't care if you find the new bracket links great, I am
4206 attached to the old style using angular brackets and no hiding of the
4207 link text.  Please give them back to me, don't tell me it is not
4208 possible!}@*
4210 Would I let you down like that?  If you must, you can do this
4212 @lisp
4213 (setq org-link-style 'plain
4214       org-link-format "<%s>")
4215 @end lisp
4217 @item @b{When I am executing shell/elisp links I always get a 
4218 confirmation prompt and need to type @kbd{yes @key{RET}}, that's 4 key
4219 presses!  Can I get rid of this?}@*
4221 @cindex shell links, confirmation
4222 @cindex dangerous commands
4223 The confirmation is there to protect you from unwantingly execute
4224 potentially dangerous commands.  For example, imagine a link
4225 @samp{[[shell:rm -rf ~/*][Google Search]]}.  In an Org-mode buffer, this
4226 command would look like @samp{Google Search}, but really it would remove
4227 your home directory.  If you wish, you can make it easier to respond to
4228 the query by setting @code{org-confirm-shell-link-function} and/or
4229 @code{org-confirm-elisp-link-function} to @code{y-or-n-p}.  Then a
4230 single @kbd{y} keypress will be enough to confirm those links.  It is
4231 also possible to turn off this check entirely, but I do not recommend to
4232 do this.  Be warned.
4234 @item @b{All these stars are driving me mad, I just find the Emacs
4235 outlines unreadable. Can't you just put white space and a single star as a
4236 starter for headlines?}@*
4238 See @ref{Clean view}.
4240 @item @b{I would like to have two windows on the same Org-mode
4241 file, but with different outline visibility.  Is that possible?}@*
4243 @cindex @code{make-indirect-buffer}
4244 @cindex indirect buffers
4245 In GNU Emacs, you may use @emph{indirect buffers} which do exactly this.
4246 See the documentation on the command @code{make-indirect-buffer}.  In
4247 XEmacs, this is currently not possible because of the different outline
4248 implementation.
4250 @item @b{When I export my TODO list, every TODO item becomes a
4251 separate section.  How do I enforce these items to be exported as an
4252 itemized list?}@*
4254 If you plan to use ASCII or HTML export, make sure things you want to
4255 be exported as item lists are level 4 at least, even if that does mean
4256 there is a level jump.  For example:
4258 @example
4259 * Todays top priorities
4260 **** TODO write a letter to xyz
4261 **** TODO Finish the paper
4262 **** Pick up kids at the school
4263 @end example
4265 Alternatively, if you need a specific value for the heading/item
4266 transition in a particular file, use the @samp{+OPTIONS} line to
4267 configure the @samp{H} switch.
4269 @example
4270 +OPTIONS:   H:2; ...
4271 @end example
4273 @item @b{I would like to export only a subtree of my file to HTML.
4274 How?}@*
4276 @cindex exporting a subtree
4277 If you want to export a subtree, mark the subtree as region and then
4278 export.  Marking can be done with @kbd{C-c @@ C-x C-x}, for example.
4280 @item @b{Org-mode takes over the S-cursor keys.  I also want to use
4281 CUA-mode, is there a way to fix this conflict?}@*
4282 Yes, see @ref{Conflicts}.
4284 @item @b{One of my table columns has started to fill up with
4285 @samp{#ERROR}.  What is going on?}@*
4287 Org-mode tried to compute the column from other fields using a
4288 formula stored in the @samp{#+TBLFM:} line just below the table, and
4289 the evaluation of the formula fails.  Fix the fields used in the
4290 formula, or fix the formula, or remove it!
4292 @item @b{When I am in the last column of a table and just above a
4293 horizontal line in the table, pressing TAB creates a new table line
4294 @i{before} the horizontal line.  How can I quickly move to the line
4295 @i{below} the horizontal line instead?}@*
4297 Press @key{down} (to get on the separator line) and then @key{TAB}.
4298 Or configure the variable @code{org-table-tab-jumps-over-hlines}.
4300 @item @b{How can I change the indentation of an entire table without
4301 fixing every line by hand?}@*
4303 @cindex indentation, of tables
4304 The indentation of a table is set by the first line.  So just fix the
4305 indentation of the first line and realign with @key{TAB}.
4307 @item @b{Is it possible to include entries from org-mode files into my
4308 emacs diary?}@*
4310 Since the org-mode agenda is much more powerful and can contain the
4311 diary (@pxref{Calendar/Diary integration}), you should think twice
4312 before deciding to do this.  Integrating Org-mode information into the
4313 diary is, however, possible.  You need to turn on @emph{fancy diary
4314 display} by setting in @file{.emacs}:
4316 @lisp
4317 (add-hook 'diary-display-hook 'fancy-diary-display)
4318 @end lisp
4320 Then include the following line into your @file{~/diary} file, in
4321 order to get the entries from all files listed in the variable
4322 @code{org-agenda-files}:
4324 @example
4325 &%%(org-diary)
4326 @end example
4327 @noindent
4328 You may also select specific files with
4330 @example
4331 &%%(org-diary) ~/path/to/some/org-file.org
4332 &%%(org-diary) ~/path/to/another/org-file.org
4333 @end example
4335 If you now launch the calendar and press @kbd{d} to display a diary, the
4336 headlines of entries containing a timestamp, date range, schedule, or
4337 deadline referring to the selected date will be listed.  Just like
4338 Org-mode's agenda view, the diary for @emph{today} contains additional
4339 entries for overdue deadlines and scheduled items.  See also the
4340 documentation of the @command{org-diary} function.  Under XEmacs, it is
4341 not possible to jump back from the diary to the org, this works only in
4342 the agenda buffer.
4344 @end enumerate
4347 @node Interaction, Bugs, FAQ, Miscellaneous
4348 @section Interaction with other packages
4349 @cindex packages, interaction with other
4350 Org-mode lives in the world of GNU Emacs and interacts in various ways
4351 with other code out there.
4353 @menu
4354 * Extensions::                  Third-party extensions for Org-mode
4355 * Cooperation::                 Packages Org-mode cooperates with
4356 * Conflicts::                   Packages that lead to conflicts
4357 @end menu
4359 @node Extensions, Cooperation, Interaction, Interaction
4360 @subsection Third-party extensions for Org-mode
4362 The following extensions for Org-mode have been written by other people:
4364 @table @asis
4365 @cindex @file{org-mouse.el}
4366 @item @file{org-mouse.el} by Piotr Zielinski
4367 This package implements extended mouse functionality for Org-mode.  It
4368 allows you to cycle visibility and to edit the document structure with
4369 the mouse.  Best of all, it provides a context-sensitive menu on
4370 @key{mouse-3} that changes depending on the context of a mouse-click.
4371 @file{org-mouse.el} is freely available at @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}.
4372 @cindex @file{org-publish.el}
4373 @item @file{org-publish.el} by David O'Toole
4374 This package provides facilities for publishing related sets of Org-mode
4375 files together with linked files like images as a webpages.  It is
4376 highly configurable and can be used for other publishing purposes as
4377 well.  As of Org-mode version 4.30, @file{org-publish.el} is part of
4378 the Org-mode distribution.  It is not yet part of Emacs, however, due to
4379 a pending copyright assignment.  In the mean time, @file{org-publish.el}
4380 can be downloaded from David's site:
4381 @url{http://dto.freeshell.org/e/org-publish.el}.
4382 @end table
4384 @node Cooperation, Conflicts, Extensions, Interaction
4385 @subsection Packages that Org-mode cooperates with
4387 @table @asis
4388 @cindex @file{calc.el}
4389 @item @file{calc.el} by Dave Gillespie
4390 Org-mode uses the calc package for implementing spreadsheet
4391 functionality in its tables (@pxref{Table calculations}).  Org-modes
4392 checks for the availability of calc by looking for the function
4393 @code{calc-eval} which should be autoloaded in your setup if calc has
4394 been installed properly.  As of Emacs 22, calc is part of the Emacs
4395 distribution.  Another possibility for interaction between the two
4396 packages is using calc for embedded calculations. @xref{Embedded Mode,
4397 , Embedded Mode, calc, GNU Emacs Calc Manual}.
4398 @cindex @file{constants.el}
4399 @item @file{constants.el} by Carsten Dominik
4400 In a table formula (@pxref{Table calculations}), it is possible to use
4401 names for natural constants or units.  Instead of defining your own
4402 constants in the variable @code{org-table-formula-constants}, install
4403 the @file{constants} package which defines a large number of constants
4404 and units, and lets you use unit prefixes like @samp{M} for
4405 @samp{Mega} etc.  You will need version 2.0 of this package, available
4406 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org-mode checks for
4407 the function @code{constants-get}, which has to be autoloaded in your
4408 setup.  See the installation instructions in the file
4409 @file{constants.el}.
4410 @item @file{remember.el} by John Wiegley
4411 @cindex @file{remember.el}
4412 Org mode cooperates with remember, see @ref{Remember}.
4413 @file{Remember.el} is not part of Emacs, find it on the web.
4414 @cindex @file{table.el}
4415 @item @file{table.el} by Takaaki Ota
4416 Org mode cooperates with table.el, see @ref{table.el}.  @file{table.el}
4417 is part of Emacs 22.
4418 @end table
4420 @node Conflicts,  , Cooperation, Interaction
4421 @subsection Packages that lead to conflicts with Org-mode
4423 @table @asis
4425 @cindex @file{allout.el}
4426 @item @file{allout.el} by Ken Manheimer
4427 Startup of Org-mode may fail with the error message
4428 @code{(wrong-type-argument keymapp nil)} when there is an outdated
4429 version @file{allout.el} on the load path, for example the version
4430 distributed with Emacs 21.x.  Upgrade to Emacs 22 and this problem will
4431 disappear.  If for some reason you cannot do this, make sure that org.el
4432 is loaded @emph{before} @file{allout.el}, for example by putting
4433 @code{(require 'org)} early enough into your @file{.emacs} file.
4435 @cindex @file{CUA.el}
4436 @item @file{CUA.el} by Kim. F. Storm
4437 Keybindings in Org-mode conflict with the @kbd{S-<cursor>} keys
4438 used by CUA-mode (as well as pc-select-mode and s-region-mode) to
4439 select and extend the region.  If you want to use one of these
4440 packages along with Org-mode, configure the variable
4441 @code{org-CUA-compatible}.  When set, Org-mode will move the following
4442 keybindings in org-mode files, and in the agenda buffer (but not
4443 during date selection).
4445 @example
4446 S-UP    -> M-p             S-DOWN  -> M-n
4447 S-LEFT  -> M--             S-RIGHT -> M-+
4448 S-RET   -> C-S-RET
4449 @end example
4451 Yes, these are unfortunately more difficult to remember.  If you want
4452 to have other replacement keys, look at the variable
4453 @code{org-disputed-keys}.
4454 @item @file{windmove.el} by Hovav Shacham
4455 @cindex @file{windmove.el}
4456 Also this package uses the @kbd{S-<cursor>} keys, so everything written
4457 in the paragraph above about CUA mode also applies here.
4458 @end table
4461 @node Bugs, Acknowledgments, Interaction, Miscellaneous
4462 @section Bugs
4463 @cindex bugs
4465 Here is a list of things that should work differently, but which I
4466 have found too hard to fix.
4468 @itemize @bullet
4469 @item
4470 If a table field starts with a link, and if the corresponding table
4471 column is narrowed (@pxref{Narrow columns}) to a width too small to
4472 display the link, the field would look entirely empty even though it is
4473 not.  To prevent this, Org-mode throws an error.  The work-around is to
4474 make the column wide enough to fit the link, or to add some text (at
4475 least 2 characters) before the link in the same field.
4476 @item
4477 Narrowing table columns does not work on XEmacs, because the
4478 @code{format} function does not transport text properties.
4479 @item
4480 Text in an entry protected with the @samp{QUOTE} keyword should not
4481 autowrap.
4482 @item
4483 When the application called by @kbd{C-c C-o} to open a file link fails
4484 (for example because the application does not exist or refuses to open
4485 the file), it does so silently.  No error message is displayed.
4486 @item
4487 Plain list items should be able to hold a TODO item.  Unfortunately this
4488 has so many technical problems that I will only consider this change for
4489 the next major release (5.0).
4490 @item
4491 The remote-editing commands in the agenda buffer cannot be undone with
4492 @code{undo} called from within the agenda buffer.  But you can go to
4493 the corresponding buffer (using @key{TAB} or @key{RET} and execute
4494 @code{undo} there.
4495 @item
4496 Recalculating a table line applies the formulas from left to right.
4497 If a formula uses @emph{calculated} fields further down the row,
4498 multiple recalculation may be needed to get all fields consistent.
4499 @item
4500 Several words in a row may @b{*be made bold*}, but this does not work if
4501 the string is distributed over two lines.
4502 @item
4503 The exporters work well, but could be made more efficient.
4504 @end itemize
4506 @node Acknowledgments,  , Bugs, Miscellaneous
4507 @section Acknowledgments
4508 @cindex acknowledgments
4509 @cindex thanks
4511 Org-mode was created by @value{AUTHOR}, who still maintains it at the
4512 Org-mode homepage @uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
4513 The following people (in alphabetic order) have helped the development
4514 along with ideas, suggestions and patches.  Many thanks to all of you,
4515 Org-mode would not be what it is without your input.
4517 @itemize @bullet
4518 @item
4519 @i{Thomas Baumann} contributed the code for links to the MH-E email
4520 system.
4521 @item
4522 @i{Alex Bochannek} provided a patch for rounding time stamps.
4523 @item
4524 @i{Charles Cave}'s suggestion sparked the implementation of templates
4525 for Remember.
4526 @item
4527 @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
4528 specified time.
4529 @item
4530 @i{Gregory Chenov} patched support for lisp forms into table
4531 calculations and improved XEmacs compatibility.
4532 @item
4533 @i{Sacha Chua} suggested to copy some linking code from Planner.
4534 @item
4535 @i{Kees Dullemond} inspired the use of narrowed tabled columns.
4536 @item
4537 @i{Christian Egli} converted the documentation into TeXInfo format,
4538 patched CSS formatting into the HTML exporter, and inspired the agenda.
4539 @item
4540 @i{Nic Ferrier} contributed mailcap and XOXO support.
4541 @item
4542 @i{Kai Grossjohann} pointed out key-binding conflicts caused by
4543 Org-mode.
4544 @item
4545 @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
4546 happy.
4547 @item
4548 @i{Todd Neal} provided patches for links to Info files and elisp forms.
4549 @item
4550 @i{Tim O'Callaghan} suggested in-file links, search options for general
4551 file links, and TAGS.
4552 @item
4553 @i{Oliver Oppitz} suggested multi-state TODO items.
4554 @item
4555 @i{Scott Otterson} sparked the introduction of descriptive text for
4556 links, among other things.
4557 @item
4558 @i{Pete Phillips} helped the development of the TAGS feature.
4559 @item
4560 @i{T.V. Raman} reported bugs and suggested improvements.
4561 @item
4562 @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
4563 control.
4564 @item
4565 @i{Kevin Rogers} contributed code to access VM files on remote hosts.
4566 @item
4567 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
4568 conflict with @file{allout.el}.
4569 @item
4570 @i{Philip Rooke} created the Org-mode reference card and provided lots
4571 of feedback.
4572 @item
4573 @i{Christian Schlauer} proposed angular brackets around links, among
4574 other things.
4575 @item
4576 Linking to VM/BBDB/GNUS was inspired by @i{Tom Shannon}'s
4577 @file{organizer-mode.el}.
4578 @item
4579 @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
4580 chapter about publishing.
4581 @item
4582 @i{J@"urgen Vollmer} contributed code generating the table of contents
4583 in HTML output.
4584 @item
4585 @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
4586 keyword.
4587 @item
4588 @i{David Wainberg} suggested archiving, and improvements to the linking
4589 system.
4590 @item
4591 @i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}.  The
4592 development of Org-mode was fully independent, and both systems are
4593 really different beasts in their basic ideas and implementation details.
4594 I later looked at John's code, however, and learned from his
4595 implementation of (i) links where the link itself is hidden and only a
4596 description is shown, and (ii) popping up a calendar to select a date.
4597 @item
4598 @i{Carsten Wimmer} suggested some changes and helped fix a bug in
4599 linking to GNUS.
4600 @item
4601 @i{Roland Winkler} requested additional keybindings to make Org-mode
4602 work on a tty.
4603 @item
4604 @i{Piotr Zielinski} wrote @file{org-mouse.el} and showed how to follow
4605 links with mouse-1.
4606 @end itemize
4608 @node Index, Key Index, Miscellaneous, Top
4609 @chapter Index
4611 @printindex cp
4613 @node Key Index,  , Index, Top
4614 @chapter Key Index
4616 @printindex ky
4618 @bye
4620 @ignore
4621    arch-tag: 7893d1fe-cc57-4d13-b5e5-f494a1bcc7ac
4622 @end ignore