]> code.delx.au - gnu-emacs/blob - man/org.texi
(Rectangles): Add index entry for marking a rectangle.
[gnu-emacs] / man / org.texi
1 \input texinfo
2 @c %**start of header
3 @c @setfilename org
4 @setfilename ../info/org
5 @settitle Org Mode Manual
6
7 @set VERSION 4.10
8 @set DATE March 2006
9
10 @dircategory Emacs
11 @direntry
12 * Org Mode: (org). outline-based notes management and organizer
13 @end direntry
14
15 @c Version and Contact Info
16 @set MAINTAINERSITE @uref{http://www.astro.uva.nl/~dominik/Tools/org/,maintainers webpage}
17 @set MAINTAINER Carsten Dominik
18 @set MAINTAINEREMAIL @email{dominik@@science.uva.nl}
19 @set MAINTAINERCONTACT @uref{mailto:dominik@@science.uva.nl,contact the maintainer}
20 @c %**end of header
21 @finalout
22
23 @c Macro definitions
24
25 @c FIXME: does not look good in html
26 @c Subheadings inside a table. Need a difference between info and the rest.
27 @macro tsubheading{text}
28 @ifinfo
29 @subsubheading \text\
30 @end ifinfo
31 @ifnotinfo
32 @item @b{\text\}
33 @end ifnotinfo
34 @end macro
35
36 @copying
37 This manual is for Org-mode (version @value{VERSION}).
38
39 Copyright @copyright{} 2004, 2005, 2006 Free Software Foundation
40
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.''
49
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
55
56 @titlepage
57 @title Org Mode Manual
58
59 @subtitle Release @value{VERSION}
60 @author by Carsten Dominik
61
62 @c The following two commands start the copyright page.
63 @page
64 @vskip 0pt plus 1filll
65 @insertcopying
66 @end titlepage
67
68 @c Output the table of contents at the beginning.
69 @contents
70
71 @ifnottex
72 @node Top, Introduction, (dir), (dir)
73 @top Org Mode Manual
74
75 @insertcopying
76 @end ifnottex
77
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 * Agenda Views:: Collecting information into views
86 * Exporting:: Sharing and publishing of notes
87 * Miscellaneous:: All the rest which did not fit elsewhere
88 * Index:: The fast road to specific information
89 * Key Index:: Key bindings and where they are described
90
91 @detailmenu
92 --- The Detailed Node Listing ---
93
94 Introduction
95
96 * Summary:: Brief summary of what Org-mode does
97 * Installation and Activation:: How to install Org-mode
98 * Feedback:: Bug reports, ideas, patches etc.
99
100 Document Structure
101
102 * Outlines:: Org-mode is based on outline-mode
103 * Headlines:: How to typeset org-tree headlines
104 * Visibility cycling:: Show and hide, much simplified
105 * Motion:: Jumping to other headlines
106 * Structure editing:: Changing sequence and level of headlines
107 * Archiving:: Move done task trees to a different place
108 * Sparse trees:: Matches embedded in context
109 * Tags:: Tagging headlines and matching sets of tags
110 * Plain Lists:: Editing hand-formatted lists
111
112 Tables
113
114 * Built-in table editor:: Simple tables
115 * Table calculations:: Compute a field from other fields
116 * orgtbl-mode:: The table editor as minor mode
117 * table.el:: Complex tables
118
119 Calculations in tables
120
121 * Formula syntax:: How to write a formula
122 * Column formulas:: Formulas valid for all fields in a column
123 * Advanced features:: Field names, parameters and automatic recalc
124 * Named-field formulas:: Formulas valid in single fields
125 * Editing/debugging formulas:: Changing a stored formula
126 * Appetizer:: Taste the power of calc
127
128 Hyperlinks
129
130 * Internal Links:: Links to other places in the current file
131 * External Links:: URL-like links to the world
132 * Managing links:: Creating, inserting and following
133 * Search Options:: Linking to a specific location
134 * Remember:: Org-trees store quick notes
135
136 Internal Links
137
138 * Radio targets:: Make targets trigger links in plain text.
139 * CamelCase links:: Activating CamelCase words as links
140
141 TODO items
142
143 * TODO basics:: Marking and displaying TODO entries
144 * Progress Logging:: Document your productivity
145 * TODO extensions:: Workflow and assignments
146 * Priorities:: Some things are more important than others
147
148 Extended use of TODO keywords
149
150 * Workflow states:: From TODO to DONE in steps
151 * TODO types:: I do this, Fred the rest
152 * Per file keywords:: Different files, different requirements
153
154 Timestamps
155
156 * Time stamps:: Assigning a time to a tree entry
157 * Creating timestamps:: Commands which insert timestamps
158
159 Agenda Views
160
161 * Agenda files:: Files being searched for agenda information
162 * Agenda dispatcher:: Keyboard access to agenda views
163 * Weekly/Daily Agenda:: The calendar page with current tasks
164 * Global TODO list:: All unfinished action items
165 * Matching headline tags:: Structured information with fine-tuned search
166 * Timeline:: Time-sorted view for single file
167 * Agenda commands:: Remote editing of org trees
168
169 The weekly/daily agenda
170
171 * Categories:: Not all tasks are equal
172 * Time-of-day specifications:: How the agenda knows the time
173 * Calendar/Diary integration:: Integrating Anniversaries and more
174 * Sorting of agenda items:: The order of things
175
176 Exporting
177
178 * ASCII export:: Export as a structured ASCII file
179 * HTML export:: Export as an HTML file
180 * iCalendar export:: Create calendar entries.
181
182 HTML export
183
184 * HTML formatting:: Interpretation of the buffer content
185 * Export options:: How to influence exports
186 * Comment lines:: Lines which will not be exported
187
188 Miscellaneous
189
190 * Completion:: M-TAB knows what you need
191 * Customization:: Adapting Org-mode to your taste
192 * Clean view:: Getting rid of leading stars in the outline
193 * TTY keys:: Using Org-mode on a tty
194 * FAQ:: Frequently asked questions
195 * Interaction:: Other Emacs packages
196 * Bugs:: Things which do not work perfectly
197 * Acknowledgments:: These people provided feedback and more
198
199 @end detailmenu
200 @end menu
201
202 @node Introduction, Document Structure, Top, Top
203 @chapter Introduction
204 @cindex introduction
205
206 @menu
207 * Summary:: Brief summary of what Org-mode does
208 * Installation and Activation:: How to install Org-mode
209 * Feedback:: Bug reports, ideas, patches etc.
210 @end menu
211
212 @node Summary, Installation and Activation, Introduction, Introduction
213 @section Summary
214 @cindex summary
215
216 Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
217 project planning with a fast and effective plain-text system.
218
219 Org-mode develops organizational tasks around NOTES files that contain
220 information about projects as plain text. Org-mode is implemented on
221 top of outline-mode, which makes it possible to keep the content of
222 large files well structured. Visibility cycling and structure editing
223 help to work with the tree. Tables are easily created with a built-in
224 table editor. Org-mode supports ToDo items, deadlines, time stamps,
225 and scheduling. It dynamically compiles entries into an agenda that
226 utilizes and smoothly integrates much of the Emacs calendar and diary.
227 Plain text URL-like links connect to websites, emails, Usenet
228 messages, BBDB entries, and any files related to the projects. For
229 printing and sharing of notes, an Org-mode file can be exported as a
230 structured ASCII file, as HTML, or (todo and agenda items only) as an
231 iCalendar file.
232
233 Org-mode keeps simple things simple. When first fired up, it should
234 feel like a simple but easy to use outliner. Complexity is not
235 imposed, but a large amount of functionality is available when you
236 need it. Org-mode can be used on different levels and in different
237 ways, for example
238
239 @example
240 @r{@bullet{} as an outline extension with visibility cycling and structure editing}
241 @r{@bullet{} as an ASCII system and table editor for taking structured notes}
242 @r{@bullet{} as an ASCII table editor with spreadsheet-like capabilities}
243 @r{@bullet{} as a simple hypertext system, with HTML export}
244 @r{@bullet{} as a TODO list editor}
245 @r{@bullet{} as a full agenda and planner with deadlines and work scheduling}
246 @end example
247
248 The Org-mode table editor can be integrated into any major mode by
249 activating the minor Orgtbl-mode.
250
251 There is a website for Org-mode which provides links to the newest
252 version of Org-mode, as well as additional information, screen shots
253 and example files. This page is located at
254 @uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
255
256 @page
257
258 @node Installation and Activation, Feedback, Summary, Introduction
259 @section Installation and Activation
260 @cindex installation
261 @cindex autoload
262 @cindex global keybindings
263 @cindex keybindings, global
264
265 If Org-mode is part of the Emacs distribution or an XEmacs package,
266 you only need to copy the following lines to your @file{.emacs} file.
267 The last two lines define @emph{global} keys for the commands
268 @command{org-store-link} and @command{org-agenda} - please
269 choose suitable keys yourself.
270
271 @lisp
272 ;; The following lines are always needed. Choose your own keys.
273 (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
274 (define-key global-map "\C-cl" 'org-store-link)
275 (define-key global-map "\C-ca" 'org-agenda)
276 @end lisp
277
278 If you have downloaded Org-mode from the Web, you must byte-compile
279 @file{org.el} and put it on your load path. In addition to the Emacs
280 Lisp lines above, you also need to add the following lines to
281 @file{.emacs}:
282
283 @lisp
284 ;; These lines only if org-mode is not part of the X/Emacs distribution.
285 (autoload 'org-mode "org" "Org mode" t)
286 (autoload 'org-diary "org" "Diary entries from Org mode")
287 (autoload 'org-agenda "org" "Multi-file agenda from Org mode" t)
288 (autoload 'org-store-link "org" "Store a link to the current location" t)
289 (autoload 'orgtbl-mode "org" "Org tables as a minor mode" t)
290 (autoload 'turn-on-orgtbl "org" "Org tables as a minor mode")
291 @end lisp
292
293 @cindex org-mode, turning on
294 With this setup, all files with extension @samp{.org} will be put into
295 Org-mode. As an alternative, make the first line of a file look like
296 this:
297
298 @example
299 MY PROJECTS -*- mode: org; -*-
300 @end example
301
302 @noindent which will select Org-mode for this buffer no matter what
303 the file's name is. See also the variable
304 @code{org-insert-mode-line-in-empty-file'}.
305
306 @node Feedback, , Installation and Activation, Introduction
307 @section Feedback
308 @cindex feedback
309 @cindex bug reports
310 @cindex maintainer
311 @cindex author
312
313 If you find problems with Org-mode, or if you have questions, remarks,
314 or ideas about it, please contact the maintainer Carsten Dominik at
315 @value{MAINTAINEREMAIL}.
316
317 For bug reports, please provide as much information as possible,
318 including the version information of Emacs (@kbd{C-h v emacs-version
319 @key{RET}}) and Org-mode (@kbd{M-x org-version}), as well as the
320 Org-mode related setup in @file{.emacs}. If an error occurs, a
321 traceback can be very useful. Often a small example file helps, along
322 with clear information about:
323 @enumerate
324 @item What exactly did you do?
325 @item What did you expect to happen?
326 @item What happened instead?
327 @end enumerate
328 @noindent Thanks for helping to improve this mode.
329
330 @node Document Structure, Tables, Introduction, Top
331 @chapter Document Structure
332 @cindex document structure
333 @cindex structure of document
334
335 Org-mode is based on outline mode and provides flexible commands to
336 edit the structure of the document.
337
338 @menu
339 * Outlines:: Org-mode is based on outline-mode
340 * Headlines:: How to typeset org-tree headlines
341 * Visibility cycling:: Show and hide, much simplified
342 * Motion:: Jumping to other headlines
343 * Structure editing:: Changing sequence and level of headlines
344 * Archiving:: Move done task trees to a different place
345 * Sparse trees:: Matches embedded in context
346 * Tags:: Tagging headlines and matching sets of tags
347 * Plain Lists:: Editing hand-formatted lists
348 @end menu
349
350 @node Outlines, Headlines, Document Structure, Document Structure
351 @section Outlines
352 @cindex outlines
353 @cindex outline-mode
354
355 Org-mode is implemented on top of outline-mode. Outlines allow to
356 organize a document in a hierarchical structure, which (at least for
357 me) is the best representation of notes and thoughts. Overview over
358 this structure is achieved by folding (hiding) large parts of the
359 document to show only the general document structure and the parts
360 currently being worked on. Org-mode greatly simplifies the use of
361 outlines by compressing the entire show/hide functionality into a
362 single command @command{org-cycle}, which is bound to the @key{TAB}
363 key.
364
365 @node Headlines, Visibility cycling, Outlines, Document Structure
366 @section Headlines
367 @cindex headlines
368 @cindex outline tree
369
370 Headlines define the structure of an outline tree. The Headlines in
371 Org-mode start with one or more stars, on the left margin. For
372 example
373
374 @example
375 * Top level headline
376 ** Second level
377 *** 3rd level
378 some text
379 *** 3rd level
380 more text
381 * Another top level headline
382 @end example
383 @noindent Some people find the many stars too noisy and would prefer an
384 outline that has whitespace followed by a single star as headline
385 starters. @ref{Clean view} describes a setup to realize this.
386
387 @node Visibility cycling, Motion, Headlines, Document Structure
388 @section Visibility cycling
389 @cindex cycling, visibility
390 @cindex visibility cycling
391 @cindex trees, visibility
392 @cindex show hidden text
393 @cindex hide text
394
395 Outlines make it possible to hide parts of the text in the buffer.
396 Org-mode uses a single command bound to the @key{TAB} key to change
397 the visibility in the buffer.
398
399 @cindex subtree visibility states
400 @cindex folded, subtree visibility state
401 @cindex children, subtree visibility state
402 @cindex subtree, subtree visibility state
403 @table @kbd
404 @kindex @key{TAB}
405 @item @key{TAB}
406 Rotate current subtree between the states
407 @example
408 ,-> FOLDED -> CHILDREN -> SUBTREE --.
409 '-----------------------------------'
410 @end example
411 At the beginning of the buffer (or when called with @kbd{C-u}), this does
412 the same as the command @kbd{S-@key{TAB}} below.
413
414 @cindex global visibility states
415 @cindex overview, global visibility state
416 @cindex contents, global visibility state
417 @cindex show all, global visibility state
418 @kindex S-@key{TAB}
419 @item S-@key{TAB}
420 Rotate the entire buffer between the states
421 @example
422 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
423 '--------------------------------------'
424 @end example
425 Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field.
426
427 @cindex show all, command
428 @kindex C-c C-a
429 @item C-c C-a
430 Show all.
431 @end table
432
433 When Emacs first visits an Org-mode file, the global state is set to
434 OVERVIEW, i.e. only the top level headlines are visible. This can be
435 configured through the variable @code{org-startup-folded}, or on a
436 per-file basis by adding one of the following lines anywhere in the
437 buffer:
438
439 @example
440 #+STARTUP: fold
441 #+STARTUP: nofold
442 #+STARTUP: content
443 @end example
444
445 @node Motion, Structure editing, Visibility cycling, Document Structure
446 @section Motion
447 @cindex motion, between headlines
448 @cindex jumping, to headlines
449 @cindex headline navigation
450 The following commands jump to other headlines in the buffer.
451
452 @table @kbd
453 @kindex C-c C-n
454 @item C-c C-n
455 Next heading.
456 @kindex C-c C-p
457 @item C-c C-p
458 Previous heading.
459 @kindex C-c C-f
460 @item C-c C-f
461 Next heading same level.
462 @kindex C-c C-b
463 @item C-c C-b
464 Previous heading same level.
465 @kindex C-c C-u
466 @item C-c C-u
467 Backward to higher level heading.
468 @kindex C-c C-j
469 @item C-c C-j
470 Jump to a different place without changing the current outline
471 visibility. Shows the document structure in a temporary buffer, where
472 you can use visibility cycling (@key{TAB}) to find your destination.
473 After pressing @key{RET}, the cursor moves to the selected location in
474 the original buffer, and the headings hierarchy above it is made
475 visible.
476 @end table
477
478 @node Structure editing, Archiving, Motion, Document Structure
479 @section Structure editing
480 @cindex structure editing
481 @cindex headline, promotion and demotion
482 @cindex promotion, of subtrees
483 @cindex demotion, of subtrees
484 @cindex subtree, cut and paste
485 @cindex pasting, of subtrees
486 @cindex cutting, of subtrees
487 @cindex copying, of subtrees
488 @cindex subtrees, cut and paste
489
490 @table @kbd
491 @kindex M-@key{RET}
492 @item M-@key{RET}
493 Insert new heading with same level as current. If the cursor is in a
494 plain list item, a new item is created. To force creation of a new
495 headline, use a prefix arg, or first press @key{RET} to get to the
496 beginning of the next line.
497 @kindex M-S-@key{RET}
498 @item M-S-@key{RET}
499 Insert new TODO entry with same level as current heading.
500 @kindex M-@key{left}
501 @item M-@key{left}
502 Promote current heading by one level
503 @kindex M-@key{right}
504 @item M-@key{right}
505 Demote current heading by one level
506 @kindex M-S-@key{left}
507 @item M-S-@key{left}
508 Promote the current subtree by one level
509 @kindex M-S-@key{right}
510 @item M-S-@key{right}
511 Demote the current subtree by one level
512 @kindex M-S-@key{up}
513 @item M-S-@key{up}
514 Move subtree up (swap with previous subtree of same
515 level)
516 @kindex M-S-@key{down}
517 @item M-S-@key{down}
518 Move subtree down (swap with next subtree of same level)
519 @kindex C-c C-x C-w
520 @kindex C-c C-x C-k
521 @item C-c C-x C-w
522 @itemx C-c C-x C-k
523 Kill subtree, i.e. remove it from buffer but save in kill ring.
524 @kindex C-c C-x M-w
525 @item C-c C-x M-w
526 Copy subtree to kill ring.
527 @kindex C-c C-x C-y
528 @item C-c C-x C-y
529 Yank subtree from kill ring. This does modify the level of the subtree to
530 make sure the tree fits in nicely at the yank position. The yank
531 level can also be specified with a prefix arg, or by yanking after a
532 headline marker like @samp{****}.
533 @end table
534
535 @cindex region, active
536 @cindex active region
537 @cindex transient-mark-mode
538 When there is an active region (transient-mark-mode), promotion and
539 demotion work on all headlines in the region. To select a region of
540 headlines, it is best to place both point and mark at the beginning of a
541 line, mark at the beginning of the first headline, and point at the line
542 just after the last headline to change. Note that when the cursor is
543 inside a table (@pxref{Tables}), the Meta-Cursor keys have different
544 functionality.
545
546 @node Archiving, Sparse trees, Structure editing, Document Structure
547 @section Archiving
548 @cindex archiving
549 @cindex filing subtrees
550
551 When a project represented by a (sub)tree is finished, you may want
552 to move the tree to an archive place, either in the same file under a
553 special top-level heading, or even to a different file.
554 @table @kbd
555 @kindex C-c $
556 @item @kbd{C-c $}
557 Archive the subtree starting at the cursor position to the location
558 given by @code{org-archive-location}.
559 @end table
560
561 @cindex archive locations
562 The default archive is a file in the same directory as the current
563 file, with the name derived by appending @file{_archive} to the
564 current file name. For information and examples on how to change
565 this, see the documentation string of the variable
566 @code{org-archive-location}. If you are also using the Org-mode
567 agenda, archiving to a different file is a good way to keep archived
568 trees from contributing agenda items.
569
570 @node Sparse trees, Tags, Archiving, Document Structure
571 @section Sparse trees
572 @cindex sparse trees
573 @cindex trees, sparse
574 @cindex folding, sparse trees
575 @cindex occur, command
576
577 An important feature of Org-mode is the ability to construct
578 @emph{sparse trees} for selected information in an outline tree. A
579 sparse tree means that the entire document is folded as much as
580 possible, but the selected information is made visible along with the
581 headline structure above it@footnote{See also the variables
582 @code{org-show-hierarchy-above} and
583 @code{org-show-following-heading}.}. Just try it out and you will see
584 immediately how it works.
585
586 Org-mode contains several commands creating such trees. The most
587 basic one is @command{org-occur}:
588
589 @table @kbd
590 @kindex C-c /
591 @item C-c /
592 Occur. Prompts for a regexp and shows a sparse tree with all matches.
593 If the match is in a headline, the headline is made visible. If the
594 match is in the body of an entry, headline and body are made visible.
595 In order to provide minimal context, also the full hierarchy of
596 headlines above the match is shown, as well as the headline following
597 the match. Each match is also highlighted, the highlights disappear
598 when the buffer is changed with an editing command.
599 @end table
600 @noindent
601 For frequently used sparse trees of specific search strings, you can
602 use the variable @code{org-agenda-custom-commands} to define fast
603 keyboard access to specific sparse trees. These commands will then be
604 accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
605 For example
606 @lisp
607 (setq org-agenda-custom-commands
608 '(("f" occur-tree "FIXME")))
609 @end lisp
610 @noindent will define the key @kbd{C-c a f} as a shortcut for creating
611 a sparse tree matching the string @samp{FIXME}.
612
613 Other commands are using sparse trees as well. For example @kbd{C-c
614 C-v} creates a sparse TODO tree (@pxref{TODO basics}).
615
616 @kindex C-c C-x v
617 @cindex printing sparse trees
618 @cindex visible text, printing
619 To print a sparse tree, you can use the Emacs command
620 @code{ps-print-buffer-with-faces} which does not print invisible parts
621 of the document @footnote{This does not work under XEmacs, because
622 XEmacs uses selective display for outlining, not text properties}.
623 Or you can use the command @kbd{C-c C-x v} to copy the visible part of
624 the document to another file (extension @file{.txt}) which then can be
625 printed in any desired way.
626
627 @node Tags, Plain Lists, Sparse trees, Document Structure
628 @section Tags
629 @cindex tags
630 @cindex headline tagging
631 @cindex matching, tags
632 @cindex sparse tree, tag based
633
634 If you wish to implement a tag system to cross-correlate information,
635 this can be done as well in Org-mode. Every headline can contain a
636 list of tags, at the end of the headline. Tags are normal words
637 containing letters, numbers, @samp{_}, and @samp{@@}. Tags must be
638 preceded and followed by a single colon; like @samp{:WORK:}. Several
639 tags can be specified like @samp{:WORK:URGENT:}.
640
641 @cindex inheritance, of tags
642 Tags make use of the hierarchical structure of outline trees. If a
643 heading has a certain tag, all subheadings will inherit the tag as
644 well. For example, in the list
645
646 @example
647 * Meeting with the French group :WORK:
648 ** Summary by Frank :BOSS:NOTES:
649 *** TODO Prepare slides for him :ACTION:
650 @end example
651 @noindent
652 the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
653 @samp{:NOTES:}, and @samp{:ACTION:}. When executing tag searches and
654 Org-mode finds that a certain headline matches the search criterion,
655 it will not check any sublevel headline, assuming that these likely
656 also match, and that the list of matches can become very long. You
657 can influence inheritance and searching using the variables
658 @code{org-use-tag-inheritance} and
659 @code{org-tags-match-list-sublevels}.
660
661 @kindex M-@key{TAB}
662 Tags can simply be typed into the buffer. After a colon,
663 @kbd{M-@key{TAB}} offers completion on all tags being used in the
664 current buffer. There are also special commands for inserting tags,
665 and for executing searches based on tags.
666
667 @table @kbd
668 @kindex C-c C-c
669 @item C-c C-c
670 @cindex completion, of tags
671 Enter new tags for the current headline. The minibuffer will prompt
672 for a list of tags and offer completion with respect to all other tags
673 used in the current buffer. Several tags, separated by colons, may be
674 specified at the prompt. After pressing @key{RET}, the tags will
675 be inserted and aligned to @code{org-tags-column}. When called with a
676 @kbd{C-u} prefix, align all tags in the current buffer to that column,
677 just to make things look nice. TAGS are automatically realigned after
678 promotion, demotion, and TODO state changes (@pxref{TODO basics}).
679 @kindex C-c \
680 @item C-c \
681 Create a sparse tree with all headlines matching a tags search.
682 @kindex C-c a m
683 @item C-c a m
684 Create a global list of tag matches from all agenda files.
685 @xref{Matching headline tags}.
686 @kindex C-c a M
687 @item C-c a M
688 Create a global list of tag matches from all agenda files, but check
689 only TODO items and force checking subitems (see variable
690 @code{org-tags-match-list-sublevels}).
691 @end table
692
693 A tags search string can use Boolean operators @samp{&} for AND and
694 @samp{|} for OR. @samp{&} binds more strongly than
695 @samp{|}. Parenthesis are currently no implemented. A tag may also be
696 preceded by @samp{-}, to select against it, and @samp{+} is syntactic
697 sugar for positive selection. The AND operator @samp{&} is optional
698 when @samp{+} or @samp{-} is present. For example, @samp{+WORK-BOSS}
699 would select all headlines that are tagged @samp{:WORK:}, but discard
700 those also tagged @samp{:BOSS:}. The search string @samp{WORK|LAPTOP}
701 selects all lines tagged @samp{:WORK:} or @samp{:LAPTOP:}. The string
702 @samp{WORK|LAPTOP&NIGHT} requires that the @samp{:LAPTOP:} lines are
703 also tagged @samp{NIGHT}.
704
705 @node Plain Lists, , Tags, Document Structure
706 @section Plain Lists
707 @cindex plain lists
708 @cindex lists, plain
709 @cindex lists, ordered
710 @cindex ordered lists
711
712 Headlines define the structure of the Org-mode file, and also lists
713 (for example TODO items (@pxref{TODO items}) should be created using
714 headline levels. However, when taking notes, the plain text is
715 sometimes easier to read with hand-formatted lists. Org-mode supports
716 editing such lists, and the HTML exporter (@pxref{Exporting}) does
717 parse and format them.
718
719 Org-mode knows ordered and unordered lists. Unordered list items start
720 with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
721 bullet, lines must be indented or they will be seen as top-level
722 headlines. Also, when you are hiding leading stars to get a clean
723 outline view, plain list items starting with a star are visually
724 indistinguishable from true headlines. In short: Even though @samp{*}
725 is supported, it may be better to not use it for plain list items} as
726 bullets. Ordered list items start with @samp{1.} or @samp{1)}. Items
727 belonging to the same list must have the same indentation on the first
728 line. In particular, if an ordered list reaches number @samp{10.}, also
729 the 2--digit numbers must be written left-aligned with the other numbers
730 in the list. Indentation also determines the end of a list item. It
731 ends before the next line that is indented like the bullet/number, or
732 less. For example:
733
734 @example
735 ** Lord of the Rings
736 My favorite scenes are (in this order)
737 1. Eowyns fight with the witch king
738 + this was already my favorite scene in the book
739 + I really like Miranda Otto.
740 2. The attack of the Rohirrim
741 3. Peter Jackson being shot by Legolas
742 - on DVD only
743 He makes a really funny face when it happens.
744 @end example
745
746 Org-mode supports these lists by tuning filling and wrapping commands
747 to correctly deal with them. Furthermore, the following commands act
748 on items when the cursor is in the first line of an item (the line
749 with the bullet or number).
750
751 @table @kbd
752 @kindex @key{TAB}
753 @item @key{TAB}
754 Items can be folded just like headline levels if you set the variable
755 @code{org-cycle-include-plain-lists}. The level of an item is then
756 given by the indentation of the bullet/number. However, items are
757 always subordinate to real headlines, the hierarchies remain
758 completely separated.
759 @kindex M-@key{RET}
760 @item M-@key{RET}
761 Insert new item at current level. With prefix arg, for a new heading.
762 @kindex M-S-@key{up}
763 @kindex M-S-@key{down}
764 @item M-S-@key{up}
765 @itemx M-S-@key{down}
766 Move the item including subitems up/down (swap with previous/next item
767 of same indentation). If the list is ordered, renumbering is
768 automatic.
769 @kindex M-S-@key{left}
770 @kindex M-S-@key{right}
771 @item M-S-@key{left}
772 @itemx M-S-@key{right}
773 Decrease/increase the indentation of the item, including subitems.
774 Initially, the item tree is selected based on current indentation.
775 When these commands are executed several times in direct succession,
776 the initially selected region is used, even if the new indentation
777 would imply a different hierarchy. To use the new hierarchy, break
778 the command chain with a cursor motion or so.
779 @kindex C-c C-c
780 @item C-c C-c
781 Renumber the ordered list at the cursor.
782 @end table
783
784 @node Tables, Hyperlinks, Document Structure, Top
785 @chapter Tables
786 @cindex tables
787 @cindex editing tables
788
789 Org-mode has a very fast and intuitive table editor built-in.
790 Spreadsheet-like calculations are supported in connection with the
791 Emacs @file{calc} package.
792
793 @menu
794 * Built-in table editor:: Simple tables
795 * Table calculations:: Compute a field from other fields
796 * orgtbl-mode:: The table editor as minor mode
797 * table.el:: Complex tables
798 @end menu
799
800 @node Built-in table editor, Table calculations, Tables, Tables
801 @section The built-in table editor
802 @cindex table editor, builtin
803
804 Org-mode makes it easy to format tables in plain ASCII. Any line with
805 @samp{|} as the first non-white character is considered part of a
806 table. @samp{|} is also the column separator. A table might look
807 like this:
808
809 @example
810 | Name | Phone | Age |
811 |-------+-------+-----|
812 | Peter | 1234 | 17 |
813 | Anna | 4321 | 25 |
814 @end example
815
816 A table is re-aligned automatically each time you press @key{TAB} or
817 @key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
818 the next field (@key{RET} to the next row) and creates new table rows
819 at the end of the table or before horizontal lines. The indentation
820 of the table is set by the first line. Any line starting with
821 @samp{|-} is considered as a horizontal separator line and will be
822 expanded on the next re-align to span the whole table width. So, to
823 create the above table, you would only type
824
825 @example
826 |Name|Phone|Age
827 |-
828 @end example
829 @noindent and then press @key{TAB} to align the table and start filling in
830 fields.
831
832 When typing text into a field, Org-mode treats @key{DEL},
833 @key{Backspace}, and all character keys in a special way, so that
834 inserting and deleting avoids shifting other fields. Also, when
835 typing @emph{immediately after the cursor was moved into a new field
836 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
837 field is automatically made blank. If this behavior is too
838 unpredictable for you, configure the variables
839 @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
840
841 @table @kbd
842 @tsubheading{Creation and conversion}
843 @item M-x org-table-create
844 Creates an empty Org-mode table. However, it is much easier to just
845 start typing, like @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}
846
847 @kindex C-c C-c
848 @item C-c C-c
849 Convert region to table. Works when the cursor is not in an existing
850 table, and when there is a region defined. If every line contains at
851 least one TAB character, the function assumes that the material is tab
852 separated. If not, lines are split at whitespace into fields. You
853 can use a prefix argument to indicate how many consecutive spaces are
854 at least required to indicate a field separator (default: just one).
855
856 @tsubheading{Re-aligning and field motion}
857 @kindex C-c C-c
858 @item C-c C-c
859 Re-align the table without moving the cursor.
860
861 @kindex @key{TAB}
862 @item @key{TAB}
863 Re-align the table, move to the next field. Creates a new row if
864 necessary.
865
866 @kindex S-@key{TAB}
867 @item S-@key{TAB}
868 Re-align, move to previous field.
869
870 @kindex @key{RET}
871 @item @key{RET}
872 Re-align the table and move down to next row. Creates a new row if
873 necessary. At the beginning or end of a line, @key{RET} still does
874 NEWLINE, so it can be used to split a table.
875
876 @tsubheading{Column and row editing}
877 @kindex M-@key{left}
878 @kindex M-@key{right}
879 @item M-@key{left}
880 @itemx M-@key{right}
881 Move the current column left/right
882
883 @kindex M-S-@key{left}
884 @item M-S-@key{left}
885 Kill the current column.
886
887 @kindex M-S-@key{right}
888 @item M-S-@key{right}
889 Insert a new column to the left of the cursor position.
890
891 @kindex M-@key{up}
892 @kindex M-@key{down}
893 @item M-@key{up}
894 @itemx M-@key{down}
895 Move the current row up/down
896
897 @kindex M-S-@key{up}
898 @item M-S-@key{up}
899 Kill the current row or horizontal line.
900
901 @kindex M-S-@key{down}
902 @item M-S-@key{down}
903 Insert a new row above (with arg: below) the current row.
904
905 @kindex C-c -
906 @item C-c -
907 Insert a horizontal line below current row. With prefix arg, the line
908 is created above the current line.
909
910 @kindex C-c ^
911 @item C-c ^
912 Sort the table lines in the region. Point and mark must be in the first
913 and last line to be included, and must be in the column that should be
914 used for sorting. The command prompts for numerical versus
915 alphanumerical sorting.
916
917 @tsubheading{Regions}
918 @kindex C-c C-x M-w
919 @item C-c C-x M-w
920 Copy a rectangular region from a table to a special clipboard. Point
921 and mark determine edge fields of the rectangle. The process ignores
922 horizontal separator lines.
923 @kindex C-c C-x C-w
924 @item C-c C-x C-w
925 Copy a rectangular region from a table to a special clipboard, and
926 blank all fields in the rectangle. So this is the ``cut'' operation.
927 @kindex C-c C-x C-y
928 @item C-c C-x C-y
929 Paste a rectangular region into a table.
930 The upper right corner ends up in the current field. All involved fields
931 will be overwritten. If the rectangle does not fit into the present table,
932 the table is enlarged as needed. The process ignores horizontal separator
933 lines.
934 @kindex C-c C-q
935 @item C-c C-q
936 Wrap several fields in a column like a paragraph. If there is an active
937 region, and both point and mark are in the same column, the text in the
938 column is wrapped to minimum width for the given number of lines. A
939 prefix ARG may be used to change the number of desired lines. If there
940 is no region, the current field is split at the cursor position and the
941 text fragment to the right of the cursor is prepended to the field one
942 line down. If there is no region, but you specify a prefix ARG, the
943 current field gets blank, and the content is appended to the field
944 above.
945
946 @tsubheading{Calculations}
947 @cindex formula, in tables
948 @cindex calculations, in tables
949 @kindex C-c =
950 @item C-c =
951 Install a new formula for the current column and replace current field
952 with the result of the formula.
953
954 @kindex C-u C-c =
955 @item C-u C-c =
956 Install a new formula for the current field, which must be a named
957 field. Evaluate the formula and replace the field content with the
958 result.
959
960 @kindex C-c '
961 @item C-c '
962 Edit all formulas associated with the current table in a separate
963 buffer.
964
965 @kindex C-c *
966 @item C-c *
967 Recalculate the current row by applying the stored formulas from left
968 to right. When called with a @kbd{C-u} prefix, recalculate the
969 entire table, starting with the first non-header line (i.e. below the
970 first horizontal separator line). For details, see @ref{Table calculations}.
971
972 @kindex C-#
973 @item C-#
974 Rotate the calculation mark in first column through the states
975 @samp{}, @samp{#}, @samp{*}, @samp{!}, @samp{$}. For the meaning of
976 these marks see @ref{Advanced features}. When there is an active
977 region, change all marks in the region.
978
979 @kindex C-c ?
980 @item C-c ?
981 Which table column is the cursor in? Displays number >0 in echo
982 area.
983
984 @cindex region, active
985 @cindex active region
986 @cindex transient-mark-mode
987 @kindex C-c +
988 @item C-c +
989 Sum the numbers in the current column, or in the rectangle defined by
990 the active region. The result is shown in the echo area and can
991 be inserted with @kbd{C-y}.
992
993 @kindex S-@key{RET}
994 @item S-@key{RET}
995 When current field is empty, copy from first non-empty field above.
996 When not empty, copy current field down to next row and move cursor
997 along with it. Depending on the variable
998 @code{org-table-copy-increment}, integer field values will be
999 incremented during copy. This key is also used by CUA-mode
1000 (@pxref{Interaction}).
1001
1002 @tsubheading{Miscellaneous}
1003 @kindex C-c |
1004 @item C-c |
1005 Toggle the visibility of vertical lines in tables. The lines are
1006 still there, only made invisible with a text property. Any @samp{|}
1007 added by hand will become invisible on the next align.
1008
1009 @item M-x org-table-import
1010 Import a file as a table. The table should be TAB- or whitespace
1011 separated. Useful for example to import an Excel table or data from a
1012 database, because these programs generally can write TAB-separated text
1013 files. This command works by inserting the file into the buffer and
1014 then converting the region to a table. Any prefix argument is passed on
1015 to the converter, which uses it to determine the separator.
1016
1017 @item M-x org-table-export
1018 Export the table as a TAB-separated file. Useful for data exchange with
1019 for example Excel or database programs.
1020
1021 @end table
1022
1023 If you don't like the automatic table editor because it gets into your
1024 way in lines which you would like to start with @samp{|}, you can turn
1025 it off with
1026 @lisp
1027 (setq org-enable-table-editor nil)
1028 @end lisp
1029 @noindent The only table command which then still works is
1030 @kbd{C-c C-c} to do a manual re-align.
1031
1032 @node Table calculations, orgtbl-mode, Built-in table editor, Tables
1033 @section Calculations in tables
1034 @cindex calculations, in tables
1035 @cindex spreadsheet capabilities
1036 @cindex @file{calc} package
1037
1038 The table editor makes use of the Emacs @file{calc} package to
1039 implement spreadsheet-like capabilities. Org-mode has two levels of
1040 complexity for table calculations. On the basic level, tables do only
1041 horizontal computations, so a field can be computed from other fields
1042 @emph{in the same row}, and Org-mode assumes that there is only one
1043 formula for each column. This is very efficient to work with and
1044 enough for many tasks. On the complex level, columns and individual
1045 fields can be named for easier referencing in formulas, individual
1046 named fields can have their own formula associated with them, and
1047 recalculation can be automated.
1048
1049 @menu
1050 * Formula syntax:: How to write a formula
1051 * Column formulas:: Formulas valid for all fields in a column
1052 * Advanced features:: Field names, parameters and automatic recalc
1053 * Named-field formulas:: Formulas valid in single fields
1054 * Editing/debugging formulas:: Changing a stored formula
1055 * Appetizer:: Taste the power of calc
1056 @end menu
1057
1058 @node Formula syntax, Column formulas, Table calculations, Table calculations
1059 @subsection Formula syntax
1060 @cindex formula syntax
1061 @cindex syntax, of formulas
1062
1063 A formula can be any algebraic expression understood by the Emacs
1064 @file{calc} package. Note that @file{calc} has the slightly
1065 non-standard conversion that @samp{/} has lower precedence than
1066 @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}. Before
1067 evaluation by @code{calc-eval} (@pxref{Calling Calc from Your Lisp
1068 Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU Emacs
1069 Calc Manual}), variable substitution takes place:
1070
1071 @example
1072 $ @r{refers to the current field}
1073 $3 @r{refers to the field in column 3 of the current row}
1074 $3..$7 @r{a vector of the fields in columns 3-7 of current row}
1075 $P1..$P3 @r{vector of column range, using column names}
1076 &2 @r{second data field above the current, in same column}
1077 &5-2 @r{vector from fifth to second field above current}
1078 &III-II @r{vector of fields between 2nd and 3rd hline above}
1079 &III @r{vector of fields between third hline above and current field}
1080 $name @r{a named field, parameter or constant}
1081 @end example
1082
1083 @cindex vectors, in table calculations
1084 The range vectors can be directly fed into the calc vector functions
1085 like @samp{vmean} and @samp{vsum}.
1086
1087 @cindex name, of column or field
1088 @cindex constants, in calculations
1089 @samp{$name} is interpreted as the name of a column, parameter or
1090 constant. Constants are defined globally through the variable
1091 @code{org-table-formula-constants}. If you have the
1092 @file{constants.el} package, it will also be used to resolve
1093 constants, including natural constants like @samp{$h} for Planck's
1094 constant, units like @samp{$km} for kilometers. Column names and
1095 parameters can be specified in special table lines. These are
1096 described below, see @ref{Advanced features}.
1097
1098 @cindex format specifier
1099 @cindex mode, for @file{calc}
1100 A formula can contain an optional mode string after a semicolon. This
1101 string consists of flags to influence calc's modes@footnote{By
1102 default, Org-mode uses the standard calc modes (precision 12, angular
1103 units degrees, fraction and symbolic modes off). However, the display
1104 format has been changed to @code{(float 5)} to keep tables compact.
1105 The default settings can be configured using the variable
1106 @code{org-calc-default-modes}.} during execution, e.g. @samp{p20} to
1107 switch the internal precision to 20 digits, @samp{n3}, @samp{s3},
1108 @samp{e2} or @samp{f4} to switch to normal, scientific, engineering,
1109 or fix display format, respectively, and @samp{D}, @samp{R}, @samp{F},
1110 and @samp{S} to turn on degrees, radians, fraction and symbolic modes,
1111 respectively. In addition, you may provide a @code{printf} format
1112 specifier to reformat the final result. A few examples:
1113 @example
1114 $1+$2 @r{Sum of first and second field}
1115 $1+$2;%.2f @r{Same, format result to two decimals}
1116 exp($2)+exp($1) @r{Math functions can be used}
1117 $;%.1f @r{Reformat current cell to 1 decimal}
1118 ($3-32)*5/9 @r{Degrees F -> C conversion}
1119 $c/$1/$cm @r{Hz -> cm conversion, using @file{constants.el}}
1120 tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
1121 sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
1122 vmean($2..$7) @r{Compute column range mean, using vector function}
1123 vsum(&III) @r{Sum numbers from 3rd hline above to here}
1124 taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
1125 @end example
1126
1127 @node Column formulas, Advanced features, Formula syntax, Table calculations
1128 @subsection Column formulas
1129 @cindex column formula
1130 @cindex formula, for table column
1131
1132 To apply a formula to a field, type it directly into the field,
1133 preceded by an equal sign, like @samp{=$1+$2}. When you press
1134 @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
1135 field, the formula will be stored as the formula for the current
1136 column, evaluated and the current field replaced with the result. If
1137 the field contains only @samp{=}, the previously stored formula for
1138 this column is used.
1139
1140 For each column, Org-mode will remember the most recently used
1141 formula. The information is stored in a special line starting with
1142 @samp{#+TBLFM} directly below the table. When adding/deleting/moving
1143 columns with the appropriate commands, the stored equations will be
1144 modified accordingly. When a column used in a calculation is removed,
1145 references to this column become invalid and will cause an error upon
1146 applying the equation.
1147
1148 Instead of typing an equation into the field, you may also use the
1149 command @kbd{C-c =}. It prompts for a formula (with default taken
1150 from the @samp{#+TBLFM:} line) and applies it to the current field. A
1151 numerical prefix (e.g. @kbd{C-5 C-c =}) will apply it to that many
1152 subsequent fields in the current column.
1153
1154 @cindex recomputing table fields
1155 To recompute all the fields in a line, use the command @kbd{C-c *}.
1156 It re-applies all stored equations to the current row, from left to
1157 right. With a @kbd{C-u} prefix, this will be done to every line in
1158 the table, so use this command it you want to make sure the entire
1159 table is up-to-date. @kbd{C-u C-c C-c} is another way to update the
1160 entire table. Global updating does not touch the line(s) above the
1161 first horizontal separator line, assuming that this is the table
1162 header.
1163
1164 @node Advanced features, Named-field formulas, Column formulas, Table calculations
1165 @subsection Advanced features
1166
1167 If you want want the recalculation of fields to happen automatically,
1168 or if you want to be able to assign a formula to an individual field
1169 (instead of an entire column) you need to reserve the first column of
1170 the table for special marking characters. Here is an example of a
1171 table that collects exam results of students and makes use of these
1172 features:
1173 @example
1174 @group
1175 |---+---------+--------+--------+--------+-------+------|
1176 | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
1177 |---+---------+--------+--------+--------+-------+------|
1178 | ! | | P1 | P2 | P3 | Tot | |
1179 | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
1180 | ^ | | m1 | m2 | m3 | mt | |
1181 |---+---------+--------+--------+--------+-------+------|
1182 | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
1183 | # | Sara | 6 | 14 | 19 | 39 | 7.8 |
1184 | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
1185 |---+---------+--------+--------+--------+-------+------|
1186 | | Average | | | | 29.7 | |
1187 | ^ | | | | | at | |
1188 | $ | max=50 | | | | | |
1189 |---+---------+--------+--------+--------+-------+------|
1190 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(&II);%.1f
1191 @end group
1192 @end example
1193
1194 @noindent @b{Important}: Please note that for these special tables,
1195 recalculating the table with @kbd{C-u C-c *} does only affect rows
1196 which are marked @samp{#} or @samp{*}, and named fields. The column
1197 formulas are not applied in rows with empty first field.
1198
1199 @cindex marking characters, tables
1200 The marking characters have the following meaning:
1201 @table @samp
1202 @item !
1203 The fields in this line define names for the columns, so that you may
1204 refer to a column as @samp{$Tot} instead of @samp{$6}.
1205 @item ^
1206 This row defines names for the fields @emph{above} the row. With such
1207 a definition, any formula in the table may use @samp{$m1} to refer to
1208 the value @samp{10}. Also, named fields can have their own formula
1209 associated with them.
1210 @item _
1211 Similar to @samp{^}, but defines names for the fields in the row
1212 @emph{below}.
1213 @item $
1214 Fields in this row can define @emph{parameters} for formulas. For
1215 example, if a field in a @samp{$} row contains @samp{max=50}, then
1216 formulas in this table can refer to the value 50 using @samp{$max}.
1217 Parameters work exactly like constants, only that they can be defined on
1218 a per-table basis. Changing a parameter and then recalculating the
1219 table can be useful.
1220 @item #
1221 Fields in this row are automatically recalculated when pressing
1222 @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
1223 is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
1224 lines will be left alone by this command.
1225 @item *
1226 Selects this line for global recalculation with @kbd{C-u C-c *}, but
1227 not for automatic recalculation. Use this when automatic
1228 recalculation slows down editing too much.
1229 @item
1230 Unmarked lines are exempted from recalculation with @kbd{C-u C-c *}.
1231 All lines that should be recalculated should be marked with @samp{#}
1232 or @samp{*}.
1233 @end table
1234
1235 @node Named-field formulas, Editing/debugging formulas, Advanced features, Table calculations
1236 @subsection Named-field formulas
1237 @cindex named field formula
1238 @cindex formula, for named table field
1239
1240 A named field can have its own formula associated with it. In the
1241 example above, this is used for the @samp{at} field that contains
1242 the average result of the students. To enter a formula for a named
1243 field, just type it onto the buffer, preceded by @samp{:=}. Or use
1244 @kbd{C-u C-c =}. This equation will be stored below the table like
1245 @samp{$name=...}. Any recalculation in the table (even if only
1246 requested for the current line) will also update all named field
1247 formulas.
1248
1249 @node Editing/debugging formulas, Appetizer, Named-field formulas, Table calculations
1250 @subsection Editing and debugging formulas
1251 @cindex formula editing
1252 @cindex editing, of table formulas
1253
1254 To edit a column or field formula, you can use the commands @kbd{C-c
1255 =} and @kbd{C-u C-c =}, respectively. The currently active expression
1256 is then presented as default in the minibuffer, were it may be edited.
1257
1258 Note that making a table field blank does not remove the formula
1259 associated with the field - during the next recalculation the field
1260 will be filled again. To remove a formula from a field, you have to
1261 give an empty reply when prompted for the formula, or to edit the
1262 @samp{#+TBLFM} line.
1263
1264 @kindex C-c C-c
1265 You may edit the @samp{#+TBLFM} directly and re-apply
1266 the changed equations with @kbd{C-c C-c} in that line, or with the
1267 normal recalculation commands in the table.
1268
1269 @kindex C-c '
1270 @kindex C-c C-c
1271 @kindex C-c C-q
1272 @kindex C-c ?
1273 In particular for large tables with many formulas, it is convenient to
1274 use the command @kbd{C-c '} to edit the formulas of the current table
1275 in a separate buffer. That buffer will show the formulas one per
1276 line, and you are free to edit, add and remove formulas. Press
1277 @kbd{C-c ?} on a @samp{$...} expression to get information about its
1278 interpretation. Exiting the buffer with @kbd{C-c C-c} only stores the
1279 modified formulas below the table. Exiting with @kbd{C-u C-c C-c}
1280 also applies them to the entire table. @kbd{C-c C-q} exits without
1281 installing the changes.
1282
1283 When the evaluation of a formula leads to an error, the field content
1284 becomes the string @samp{#ERROR}. If you would like see what is going
1285 on during variable substitution and calculation in order to find a
1286 bug, turn on formula debugging in the menu and repeat the calculation
1287 by pressing, for example by pressing @kbd{C-c = @key{RET}} in a field.
1288 Detailed information will be displayed.
1289
1290 @node Appetizer, , Editing/debugging formulas, Table calculations
1291 @subsection Appetizer
1292
1293 Finally, just to wet your appetite on what can be done with the fantastic
1294 @file{calc} package, here is a table that computes the Taylor series
1295 for a couple of functions (homework: try that with Excel :-)
1296
1297 @example
1298 @group
1299 |---+-------------+---+-----+--------------------------------------|
1300 | | Func | n | x | Result |
1301 |---+-------------+---+-----+--------------------------------------|
1302 | # | exp(x) | 1 | x | 1 + x |
1303 | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
1304 | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
1305 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
1306 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
1307 | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
1308 |---+-------------+---+-----+--------------------------------------|
1309 #+TBLFM: $5=taylor($2,$4,$3);n3
1310 @end group
1311 @end example
1312
1313 @node orgtbl-mode, table.el, Table calculations, Tables
1314 @section The Orgtbl minor mode
1315 @cindex orgtbl-mode
1316 @cindex minor mode for tables
1317
1318 If you like the intuitive way the Org-mode table editor works, you
1319 might want to use it also in other modes like text-mode or mail-mode.
1320 The minor mode Orgtbl-mode makes this possible. You can always toggle
1321 the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
1322 example in mail mode, use
1323 @lisp
1324 (add-hook 'mail-mode-hook 'turn-on-orgtbl)
1325 @end lisp
1326
1327 @node table.el, , orgtbl-mode, Tables
1328 @section The @file{table.el} package
1329 @kindex C-c C-c
1330 @cindex table editor, @file{table.el}
1331 @cindex @file{table.el}
1332
1333 Complex ASCII tables with automatic line wrapping, column- and
1334 row-spanning, and alignment can be created using the Emacs table
1335 package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
1336 and also part of Emacs 22).
1337 When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org-mode
1338 will call @command{table-recognize-table} and move the cursor into the
1339 table. Inside a table, the keymap of Org-mode is inactive. In order
1340 to execute Org-mode-related commands, leave the table.
1341
1342 @table @kbd
1343 @kindex C-c C-c
1344 @item C-c C-c
1345 Recognize @file{table.el} table. Works when the cursor is in a
1346 table.el table.
1347
1348 @kindex C-c ~
1349 @item C-c ~
1350 Insert a table.el table. If there is already a table at point, this
1351 command converts it between the table.el format and the Org-mode
1352 format. See the documentation string of the command
1353 @code{org-convert-table} for the restrictions under which this is
1354 possible.
1355 @end table
1356
1357 @node Hyperlinks, TODO items, Tables, Top
1358 @chapter Hyperlinks
1359 @cindex hyperlinks
1360
1361 Just like HMTL, Org-mode provides links inside a file, and external
1362 links to other files, Usenet articles, emails and much more.
1363
1364 @menu
1365 * Internal Links:: Links to other places in the current file
1366 * External Links:: URL-like links to the world
1367 * Managing links:: Creating, inserting and following
1368 * Search Options:: Linking to a specific location
1369 * Remember:: Org-trees store quick notes
1370 @end menu
1371
1372 @node Internal Links, External Links, Hyperlinks, Hyperlinks
1373 @section Internal Links
1374 @cindex internal links
1375 @cindex links, internal
1376 @cindex CamelCase links
1377
1378 Strings inside double brackets like @samp{[[My Target]]} are links
1379 that lead to a text search in the current file. The link can be
1380 followed with @kbd{C-c C-o} or with a mouse click (@pxref{Managing
1381 links}). The preferred match for such a link is a dedicated target:
1382 The same string in double angular brackets. Targets may be located
1383 anywhere, often it is convenient to put them into a comment line, for
1384 example
1385 @example
1386 # <<My Target>>
1387 @end example
1388
1389 If no dedicated target exists, Org-mode will search for the words in
1390 the link, in the above example for @samp{my target}. Links starting
1391 with a star like @samp{*My Target} restrict the search to headlines.
1392 When searching, Org-mode will first try an exact match, but then move
1393 on to more and more lenient searches. For example, the link
1394 @samp{[[*My Targets]]} will find any of the following
1395 @example
1396 ** My targets
1397 ** TODO my targets are bright
1398 ** my 20 targets are
1399 @end example
1400 It is therefore often not necessary to set a dedicated target. To
1401 insert a link targeting a headline, in-buffer completion can be used.
1402 Just type a star followed by a few optional letters into the buffer
1403 and press @kbd{M-@key{TAB}}. All headlines in the current buffer will
1404 be offered as completions. @xref{Managing links}, for more commands
1405 creating links.
1406
1407 Following a link pushes a mark onto Org-mode's own mark ring. You can
1408 return to the previous position with @kbd{C-c &}. Using this command
1409 several times in direct succession goes back to positions recorded
1410 earlier.
1411
1412 @menu
1413 * Radio targets:: Make targets trigger links in plain text.
1414 * CamelCase links:: Activating CamelCase words as links
1415 @end menu
1416
1417 @node Radio targets, CamelCase links, Internal Links, Internal Links
1418 @subsection Radio targets
1419
1420 You can configure Org-mode to link any occurrences of certain target
1421 names in normal text. So without explicitly creating a link, the text
1422 connects to the target radioing its position. Radio targets are
1423 enclosed by triple angular brackets. For example, a target
1424 @samp{<<<My Target>>>} causes each occurrence of @samp{my target} in
1425 normal text to become activated as a link. The Org-mode file is
1426 scanned automatically for radio targets only when the file is first
1427 loaded into Emacs. To update the target list during editing, press
1428 @kbd{C-c C-c} with the cursor on or at a target.
1429
1430 @node CamelCase links, , Radio targets, Internal Links
1431 @subsection CamelCase words as links
1432 @cindex completion, of CamelCase links
1433 @cindex CamelCase links, completion of
1434
1435 As an alternative to @samp{[[...]]} links, Org-mode also supports
1436 CamelCase words as links. This feature is not turned on by default
1437 because of the occasional inconsistencies this system suffers from.
1438 To activate CamelCase words as links, and to make headline completion
1439 offer CamelCase version of headlines, the following customization is
1440 needed:
1441 @lisp
1442 (setq org-activate-camels t
1443 org-file-link-context-use-camel-case t)
1444 @end lisp
1445
1446 @node External Links, Managing links, Internal Links, Hyperlinks
1447 @section External Links
1448 @cindex links, external
1449 @cindex external links
1450 @cindex links, external
1451 @cindex GNUS links
1452 @cindex BBDB links
1453 @cindex URL links
1454 @cindex file links
1455 @cindex VM links
1456 @cindex RMAIL links
1457 @cindex WANDERLUST links
1458 @cindex MH-E links
1459 @cindex USENET links
1460 @cindex SHELL links
1461
1462 Org-mode supports links to files, websites, Usenet and email messages;
1463 and BBDB database entries. Links are just plain-text URL-like
1464 locators, optionally enclosed by angular brackets. The following list
1465 shows examples for each link type.
1466
1467 @example
1468 <http://www.astro.uva.nl/~dominik> @r{on the web}
1469 <file:/home/dominik/images/jupiter.jpg> @r{file, absolute path}
1470 <file:papers/last.pdf> @r{file, relative path}
1471 <news:comp.emacs> @r{Usenet link}
1472 <mailto:adent@@galaxy.net> @r{Mail link}
1473 <vm:folder> @r{VM folder link}
1474 <vm:folder#id> @r{VM message link}
1475 <vm://myself@@some.where.org/folder#id> @r{VM on remote machine}
1476 <wl:folder> @r{WANDERLUST folder link}
1477 <wl:folder#id> @r{WANDERLUST message link}
1478 <mhe:folder> @r{MH-E folder link}
1479 <mhe:folder#id> @r{MH-E message link}
1480 <rmail:folder> @r{RMAIL folder link}
1481 <rmail:folder#id> @r{RMAIL message link}
1482 <gnus:group> @r{GNUS group link}
1483 <gnus:group#id> @r{GNUS article link}
1484 <bbdb:Richard Stallman> @r{BBDB link}
1485 <shell:ls *.org>@footnote{Note that @samp{<} and @samp{>} cannot be part of a link, and therefore of a shell command. If you need redirection, use @@@{ and @@@} instead.} @r{A shell command}
1486 @end example
1487
1488 A link may contain space characters and is terminated by @samp{>} or by
1489 the end of a line. In tables, the end of a table field also terminates
1490 a link. Angle brackets around a link are not required, but are
1491 recommended to avoid problems with punctuation and other text following
1492 the link. See also the variable @code{org-allow-space-in-links}.
1493
1494
1495 @node Managing links, Search Options, External Links, Hyperlinks
1496 @section Managing links
1497
1498 Org-mode provides methods to create a link in the correct syntax, to
1499 insert it into an org-mode file, and to follow the link.
1500
1501 @table @kbd
1502 @kindex C-c l
1503 @cindex storing links
1504 @item C-c l
1505 Store a link to the current location. This is a @emph{global} command
1506 which can be used in any buffer to create a link. The link will be
1507 stored for later insertion into an Org-mode buffer (see below). For
1508 VM, RMAIL, WANDERLUST, GNUS and BBDB buffers, the link will point to
1509 the current article/entry. For W3 and W3M buffer, the link goes to
1510 the current URL. For Org-mode files, the current headline is
1511 targeted. For any other files, the link will point to the file, with
1512 a search string (@pxref{Search Options}) pointing to the
1513 contents of the current line. If there is an active region, the
1514 selected words will form the basis of the search string. The key
1515 binding @kbd{C-c l} is only a suggestion - see @ref{Installation and
1516 Activation}.
1517
1518 @kindex C-c C-l
1519 @cindex link completion
1520 @cindex file name completion
1521 @cindex completion, of links
1522 @cindex completion, of file names
1523 @cindex inserting links
1524 @item C-c C-l
1525 Insert a link. This prompts for a link to be inserted into the
1526 buffer. You can just type a link, using one of the link type prefixes
1527 mentioned in the examples above. Through completion, all links stored
1528 during the current session can be accessed. When called with prefix
1529 arg, you can use file name completion to enter a file link. The link
1530 will be formatted as given in the variable @code{org-link-format} and
1531 inserted into the buffer. Note that you don't have to use this
1532 command to insert a link. Links in Org-mode are plain text, and you
1533 can type or paste them straight into the buffer.
1534
1535 @cindex following links
1536 @kindex C-c C-o
1537 @item C-c C-o
1538 Open link at point. This will launch a web browser for URLs (using
1539 @command{browse-url-at-point}), run vm/gnus/bbdb for the corresponding
1540 links, and execute the command in a shell link. When the cursor is on
1541 a CamelCase link, this commands runs the corresponding search. When
1542 the cursor is on a TAGS list in a headline, it creates the
1543 corresponding TAGS view. Furthermore, it will visit text files in
1544 @samp{file:} links with Emacs and select a suitable application for
1545 non-text files. Classification of files is based on file extension
1546 only. See option @code{org-file-apps}. If there is no link at point,
1547 the current subtree will be searched for one. If you want to override
1548 the default application and visit the file with Emacs, use a @kbd{C-u}
1549 prefix. If the cursor is on a time stamp, compiles the agenda for
1550 that date.
1551
1552 @strong{IMPORTANT}: Be careful not to use any dangerous commands in a
1553 shell link.
1554
1555 @kindex mouse-2
1556 @kindex mouse-1
1557 @item mouse-2
1558 @itemx mouse-1
1559 On links, @kbd{mouse-2} will open the link just like @kbd{C-c C-o}
1560 would. Under Emacs 22, also @kbd{mouse-1} will follow a link.
1561
1562 @kindex mouse-3
1563 @item mouse-3
1564 Like @kbd{mouse-2}, but force file links to be opened with Emacs.
1565
1566 @cindex mark ring
1567 @kindex C-c %
1568 @item C-c %
1569 Push the current position onto the mark ring, to be able to return
1570 easily. Commands following an internal link do this automatically.
1571
1572 @cindex links, returning to
1573 @kindex C-c &
1574 @item C-c &
1575 Jump back to a recorded position. A position is recorded by the
1576 commands following internal links, and by @kbd{C-c %}. Using this
1577 command several times in direct succession moves through a ring of
1578 previously recorded positions.
1579 @end table
1580
1581
1582 @node Search Options, Remember, Managing links, Hyperlinks
1583 @section Search options in file links
1584 @cindex search option in file links
1585 @cindex file links, searching
1586
1587 File links can contain additional information to make Emacs jump to a
1588 particular location in the file when following a link. This can be a
1589 line number or a search option after a double@footnote{For backward
1590 compatibility, line numbers can also follow a single colon.} colon.
1591 For example:
1592 @example
1593 <file:~/code/main.c::255>
1594 <file:~/xx.org::My Target>
1595 <file:~/xx.org::*My Target>
1596 <file:~/xx.org::/regexp/>
1597 @end example
1598 @noindent Here is what these options do.
1599
1600 @table @code
1601 @item 255
1602 Jump to line 255.
1603 @item My Target
1604 Search for a link target @samp{<<My Target>>}, or do a text search for
1605 @samp{my target}, similar to the search in internal links, see
1606 @ref{Internal Links}.
1607 @item *My Target
1608 In an Org-mode file, restrict search to headlines.
1609 @item /regexp/
1610 Do a regular expression search for @code{regexp}. This uses the Emacs
1611 command @code{occur} to list all matches in a separate window. If the
1612 target file is in Org-mode, @code{org-occur} is used to create a
1613 sparse tree with the matches.
1614 @c If the target file is a directory,
1615 @c @code{grep} will be used to search all files in the directory.
1616 @end table
1617
1618 As a degenerate case, a file link with an empty file name can be used
1619 to search the current file. For example, @code{<file:::find me>} does
1620 a search for @samp{find me} in the current file, just like
1621 @samp{[[find me]]} would.
1622
1623 @node Remember, , Search Options, Hyperlinks
1624 @section Remember
1625 @cindex @file{remember.el}
1626
1627 Another way to create org entries with links to other files is through
1628 the @emph{Remember} package by John Wiegley. @emph{Remember} lets you
1629 store quick notes with little interruption of your work flow. See
1630 @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
1631 information. The notes produced by @emph{Remember} can be stored in
1632 different ways, and Org-mode files are a good target. Org-mode allows
1633 to file away notes either to a default file, or directly to the
1634 correct location in your Org-mode outline tree. The following
1635 customization@footnote{The two autoload forms are only necessary if
1636 @file{org.el} is not part of the Emacs distribution or an XEmacs
1637 package.} will tell @emph{Remember} to use org files as target, and to
1638 create annotations compatible with Org-mode links.
1639
1640 @example
1641 (autoload 'org-remember-annotation "org")
1642 (autoload 'org-remember-handler "org")
1643 (setq org-directory "~/path/to/my/orgfiles/")
1644 (setq org-default-notes-file "~/.notes")
1645 (setq remember-annotation-functions '(org-remember-annotation))
1646 (setq remember-handler-functions '(org-remember-handler))
1647 @end example
1648
1649 When you compose a note with remember, you have to press @kbd{C-c C-c}
1650 to exit remember-mode and to file away the note. The handler first
1651 prompts for a target file - if you press @key{RET}, the value of
1652 @code{org-default-notes-file} is used. Then the command offers the
1653 headings tree of the selected file. You can either immediately press
1654 @key{RET} to get the note appended to the file. Or you can use
1655 vertical cursor motion (@key{up} and @key{down}) and visibility
1656 cycling (@key{TAB}) to find a better place. Pressing @key{RET} or
1657 @key{left} or @key{right} leads to the following result.
1658
1659 @multitable @columnfractions 0.2 0.1 0.7
1660 @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
1661 @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file
1662 @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor
1663 @item @tab @key{left} @tab as same level, before current heading
1664 @item @tab @key{right} @tab as same level, after current heading
1665 @item not on headline @tab @key{RET}
1666 @tab at cursor position, level taken from context.
1667 Or use prefix arg to specify level manually.
1668 @end multitable
1669
1670 So a fast way to store the note is to press @kbd{C-c C-c @key{RET}
1671 @key{RET}} to append it to the default file. Even shorter would be
1672 @kbd{C-u C-c C-c}, which does the same without even showing the tree.
1673 But with little extra effort, you can push it directly to the correct
1674 location.
1675
1676 Before inserting the text into a tree, the function ensures that the
1677 text has a headline, i.e. a first line that starts with a @samp{*}.
1678 If not, a headline is constructed from the current date and some
1679 additional data. If the variable @code{org-adapt-indentation} is
1680 non-nil, the entire text is also indented so that it starts in the
1681 same column as the headline (after the asterisks).
1682
1683 @node TODO items, Timestamps, Hyperlinks, Top
1684 @chapter TODO items
1685 @cindex TODO items
1686
1687 Org-mode does not maintain TODO lists as a separate document. TODO
1688 items are an integral part of the notes file, because TODO items
1689 usually come up while taking notes! With Org-mode, you simply mark
1690 any entry in a tree as being a TODO item. In this way, the
1691 information is not duplicated, and the entire context from which the
1692 item emerged is always present when you check.
1693
1694 Of course, this technique causes TODO items to be scattered throughout
1695 your file. Org-mode provides methods to give you an overview over all
1696 things you have to do.
1697
1698 @menu
1699 * TODO basics:: Marking and displaying TODO entries
1700 * Progress Logging:: Document your productivity
1701 * TODO extensions:: Workflow and assignments
1702 * Priorities:: Some things are more important than others
1703 @end menu
1704
1705 @node TODO basics, Progress Logging, TODO items, TODO items
1706 @section Basic TODO functionality
1707
1708 Any headline can become a TODO item by starting it with the word TODO,
1709 for example
1710
1711 @example
1712 *** TODO Write letter to Sam Fortune
1713 @end example
1714
1715 @noindent
1716 The most important commands to work with TODO entries are:
1717
1718 @table @kbd
1719 @kindex C-c C-t
1720 @cindex cycling, of TODO states
1721 @item C-c C-t
1722 Rotate the TODO state of the current item between
1723 @example
1724 ,-> (unmarked) -> TODO -> DONE --.
1725 '--------------------------------'
1726 @end example
1727 The same rotation can also be done ``remotely'' from the timeline and
1728 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
1729 @kindex C-c C-v
1730 @cindex sparse tree, for TODO
1731 @item C-c C-v
1732 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds
1733 the entire buffer, but shows all TODO items and the headings hierarchy
1734 above them. With prefix arg, show also the DONE entries. With
1735 numerical prefix N, show the tree for the Nth keyword in the variable
1736 @code{org-todo-keywords}.
1737 @kindex C-c a t
1738 @item C-c a t
1739 Show the global TODO list. This collects the TODO items from all
1740 agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in
1741 @code{agenda-mode}, so there are commands to examine and manipulate
1742 the TODO entries directly from that buffer (@pxref{Agenda commands}).
1743 @xref{Global TODO list}, for more information.
1744 @item @code{org-agenda-include-all-todo}
1745 If you would like to have all your TODO items listed as part of your
1746 agenda, customize the variable @code{org-agenda-include-all-todo}.
1747 @end table
1748
1749 @node Progress Logging, TODO extensions, TODO basics, TODO items
1750 @section Progress Logging
1751 @cindex progress logging
1752 @cindex logging, of progress
1753 If you want to keep track of @emph{when} a certain TODO item was
1754 finished, turn on logging with
1755 @lisp
1756 (setq org-log-done t)
1757 @end lisp
1758 @noindent
1759 Then each time you turn a TODO entry into DONE using either @kbd{C-c
1760 C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line
1761 @samp{CLOSED: [timestamp]} will be inserted just after the headline.
1762 If you turn the entry back into a TODO item again through further
1763 state cycling, that line will be removed again. In the timeline
1764 (@pxref{Timeline}) and in the agenda (@pxref{Weekly/Daily Agenda}),
1765 you can then use the @kbd{L} key to display the TODO items closed on
1766 each day, giving you an overview of what has been done on a day.
1767
1768 @node TODO extensions, Priorities, Progress Logging, TODO items
1769 @section Extended use of TODO keywords
1770 @cindex extended TODO keywords
1771
1772 The default implementation of TODO entries is just two states: TODO
1773 and DONE. You can, however, use the TODO feature for more
1774 complicated things by configuring the variables
1775 @code{org-todo-keywords} and @code{org-todo-interpretation}. Using
1776 special setup, you can even use TODO keywords in different ways in
1777 different org files.
1778
1779 @menu
1780 * Workflow states:: From TODO to DONE in steps
1781 * TODO types:: I do this, Fred the rest
1782 * Per file keywords:: Different files, different requirements
1783 @end menu
1784
1785 @node Workflow states, TODO types, TODO extensions, TODO extensions
1786 @subsection TODO keywords as workflow states
1787 @cindex TODO workflow
1788 @cindex workflow states as TODO keywords
1789
1790 You can use TODO keywords to indicate different states in the process
1791 of working on an item, for example
1792
1793 @lisp
1794 (setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE")
1795 org-todo-interpretation 'sequence)
1796 @end lisp
1797
1798 @cindex completion, of TODO keywords
1799 Changing these variables becomes only effective in a new Emacs session.
1800 With this setup, the command @kbd{C-c C-t} will cycle an entry from
1801 TODO to FEEDBACK, then to VERIFY, and finally to DONE. You may also
1802 use a prefix argument to quickly select a specific state. For example
1803 @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
1804 If you define many keywords, you can use in-buffer completion (see
1805 @ref{Completion}) to insert these words into the buffer.
1806
1807 @node TODO types, Per file keywords, Workflow states, TODO extensions
1808 @subsection TODO keywords as types
1809 @cindex TODO types
1810 @cindex names as TODO keywords
1811 @cindex types as TODO keywords
1812
1813 The second possibility is to use TODO keywords to indicate different
1814 types of action items. For example, you might want to indicate that
1815 items are for ``work'' or ``home''. If you are into David Allen's
1816 @emph{Getting Things DONE}, you might want to use todo types
1817 @samp{NEXTACTION}, @samp{WAITING}, @samp{MAYBE}. Or, when you work
1818 with several people on a single project, you might want to assign
1819 action items directly to persons, by using their names as TODO
1820 keywords. This would be set up like this:
1821
1822 @lisp
1823 (setq org-todo-keywords '("Fred" "Sara" "Lucy" "Mike" "DONE")
1824 org-todo-interpretation 'type)
1825 @end lisp
1826
1827 In this case, different keywords do not indicate a sequence, but
1828 rather different types. So it is normally not useful to change from
1829 one type to another. Therefore, in this case the behavior of the
1830 command @kbd{C-c C-t} is changed slightly@footnote{This is also true
1831 for the @kbd{t} command in the timeline and agenda buffers.}. When
1832 used several times in succession, it will still cycle through all
1833 names. But when you return to the item after some time and execute
1834 @kbd{C-c C-t} again, it will switch from each name directly to DONE.
1835 Use prefix arguments or completion to quickly select a specific name.
1836 You can also review the items of a specific TODO type in a sparse tree
1837 by using a numeric prefix to @kbd{C-c C-v}. For example, to see all
1838 things Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect
1839 collect Lucy's items from all agenda files into a single buffer, you
1840 would use the prefix arg as well when creating the global todo list:
1841 @kbd{C-3 C-c t}.
1842
1843 @node Per file keywords, , TODO types, TODO extensions
1844 @subsection Setting up TODO keywords for individual files
1845 @cindex keyword options
1846 @cindex per file keywords
1847
1848 It can be very useful to use different aspects of the TODO mechanism
1849 in different files, which is not possible with the global settings
1850 described above. For file-local settings, you need to add special
1851 lines to the file which set the keywords and interpretation for that
1852 file only. For example, to set one of the two examples discussed
1853 above, you need one of the following lines, starting in column zero
1854 anywhere in the file:
1855
1856 @example
1857 #+SEQ_TODO: TODO FEEDBACK VERIFY DONE
1858 #+TYP_TODO: Fred Sara Lucy Mike DONE
1859 @end example
1860
1861 @cindex Completion, of option keywords
1862 @kindex M-@key{TAB}
1863 @noindent To make sure you are using the correct keyword, type
1864 @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
1865
1866 @cindex DONE, final TODO keyword
1867 Remember that the last keyword must always mean that the item is DONE
1868 (you may use a different word, though). Also note that in each file,
1869 only one of the two aspects of TODO keywords can be used. After
1870 changing one of these lines, use @kbd{C-c C-c} with the cursor still
1871 in the line to make the changes known to Org-mode@footnote{Org-mode
1872 parses these lines only when Org-mode is activated after visiting a
1873 file. @kbd{C-c C-c} with the cursor in a line starting with @samp{#+}
1874 is simply restarting Org-mode, making sure that these changes will be
1875 respected.}.
1876
1877 If you want to use very many keywords, for example when working with a
1878 large group of people, you may split the names over several lines:
1879
1880 @example
1881 #+TYP_TODO: Fred Sara Lucy Mike
1882 #+TYP_TODO: Luis George Jules Jessica
1883 #+TYP_TODO: Kim Arnold Peter
1884 #+TYP_TODO: DONE
1885 @end example
1886
1887 @node Priorities, , TODO extensions, TODO items
1888 @section Priorities
1889 @cindex priorities
1890
1891 If you use Org-mode extensively to organize your work, you may end up
1892 with a number of TODO entries so large that you'd like to prioritize
1893 them. This can be done by placing a @emph{priority cookie} into the
1894 headline, like this
1895
1896 @example
1897 *** TODO [#A] Write letter to Sam Fortune
1898 @end example
1899
1900 @noindent
1901 With its standard setup, Org-mode supports priorities @samp{A},
1902 @samp{B}, and @samp{C}. @samp{A} is the highest priority. An entry
1903 without a cookie is treated as priority @samp{B}. Priorities make a
1904 difference only in the agenda (@pxref{Weekly/Daily Agenda}).
1905
1906 @table @kbd
1907 @kindex @kbd{C-c ,}
1908 @item @kbd{C-c ,}
1909 Set the priority of the current item. The command prompts for a
1910 priority character @samp{A}, @samp{B} or @samp{C}. When you press
1911 @key{SPC} instead, the priority cookie is removed from the headline.
1912 The priorities can also be changed ``remotely'' from the timeline and
1913 agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
1914
1915 @kindex S-@key{up}
1916 @kindex S-@key{down}
1917 @item S-@key{up}
1918 @itemx S-@key{down}
1919 Increase/decrease priority of current item. Note that these keys are
1920 also used to modify time stamps (@pxref{Creating timestamps}).
1921 Furthermore, these keys are also used by CUA-mode
1922 (@pxref{Interaction}).
1923 @end table
1924
1925 @node Timestamps, Agenda Views, TODO items, Top
1926 @chapter Timestamps
1927
1928 Items can be labeled with timestamps to make them useful for project
1929 planning.
1930
1931 @menu
1932 * Time stamps:: Assigning a time to a tree entry
1933 * Creating timestamps:: Commands which insert timestamps
1934 @end menu
1935
1936
1937 @node Time stamps, Creating timestamps, Timestamps, Timestamps
1938 @section Time stamps, deadlines and scheduling
1939 @cindex time stamps
1940 @cindex ranges, time
1941 @cindex date stamps
1942 @cindex deadlines
1943 @cindex scheduling
1944
1945 A time stamp is a specification of a date (possibly with time) in a
1946 special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16
1947 Tue 09:39>}. A time stamp can appear anywhere in the headline or body
1948 of an org-tree entry. Its presence allows to show entries on specific
1949 dates in the agenda (@pxref{Weekly/Daily Agenda}). We distinguish:
1950
1951 @table @var
1952 @cindex timestamp
1953 @item TIMESTAMP
1954 A simple time stamp just assigns a date/time to an item. In the
1955 timeline and agenda displays, the headline of the entry will be shown
1956 exactly on that date.
1957
1958 @item TIMERANGE
1959 @cindex timerange
1960 Two time stamps connected by @samp{--} denote a time range. The
1961 headline will be shown on the first and last day of the range, and on
1962 any dates that are displayed and fall in the range. Here is an
1963 example:
1964
1965 @example
1966 ** Meeting in Amsterdam
1967 <2004-08-23 Mon>--<2004-08-26 Thu>
1968 @end example
1969
1970 @item DEADLINE
1971 @cindex DEADLINE keyword
1972 If a time stamp is preceded by the word @samp{DEADLINE:}, the task
1973 (most likely a TODO item) is supposed to be finished on that date, and
1974 it will be listed then. In addition, the compilation for @emph{today}
1975 will carry a warning about the approaching or missed deadline,
1976 starting @code{org-deadline-warning-days} before the due date, and
1977 continuing until the entry is marked DONE. An example:
1978
1979 @example
1980 *** TODO write article about the Earth for the Guide
1981 The editor in charge is <bbdb:Ford Prefect>
1982 DEADLINE: <2004-02-29 Sun>
1983 @end example
1984
1985 @item SCHEDULED
1986 @cindex SCHEDULED keyword
1987 If a time stamp is preceded by the word @samp{SCHEDULED:}, it means
1988 you are planning to start working on that task on the given date. The
1989 headline will be listed under the given date. In addition, a reminder
1990 that the scheduled date has passed will be present in the compilation
1991 for @emph{today}, until the entry is marked DONE. I.e., the
1992 task will automatically be forwarded.
1993 @end table
1994
1995 @node Creating timestamps, , Time stamps, Timestamps
1996 @section Creating timestamps
1997 @cindex creating timestamps
1998 @cindex timestamps, creating
1999
2000 For Org-mode to recognize time stamps, they need to be in the specific
2001 format. All commands listed below produce time stamps in the correct
2002 format.
2003
2004 @table @kbd
2005 @kindex C-c .
2006 @item C-c .
2007 Prompt for a date and insert a corresponding time stamp. When the
2008 cursor is at a previously used time stamp, it is updated to NOW. When
2009 this command is used twice in succession, a time range is inserted.
2010
2011 @kindex C-u C-c .
2012 @item C-u C-c .
2013 Like @kbd{C-c .}, but use the alternative format which contains date
2014 and time.
2015
2016 @kindex C-c !
2017 @item C-c !
2018 Like @kbd{C-c .}, but insert an inactive time stamp not triggering the
2019 agenda.
2020
2021 @kindex C-c <
2022 @item C-c <
2023 Insert a time stamp corresponding to the cursor date in the Calendar.
2024
2025 @kindex C-c >
2026 @item C-c >
2027 Access the Emacs calendar for the current date. If there is a
2028 timestamp in the current line, goto the corresponding date
2029 instead.
2030
2031 @kindex C-c C-o
2032 @item C-c C-o
2033 Access the agenda for the date given by the time stamp at point
2034 (@pxref{Weekly/Daily Agenda}).
2035
2036 @kindex C-c C-d
2037 @item C-c C-d
2038 Insert @samp{DEADLINE} keyword along with a stamp.
2039 @kindex C-c C-w
2040 @cindex sparse tree, for deadlines
2041 @item C-c C-w
2042 Create a sparse tree with all deadlines that are either past-due, or
2043 which will become due within @code{org-deadline-warning-days}.
2044 With @kbd{C-u} prefix, show all deadlines in the file. With a numeric
2045 prefix, check that many days. For example, @kbd{C-1 C-c C-w} shows
2046 all deadlines due tomorrow.
2047
2048 @kindex C-c C-s
2049 @item C-c C-s
2050 Insert @samp{SCHEDULED} keyword along with a stamp.
2051
2052 @kindex S-@key{left}
2053 @kindex S-@key{right}
2054 @item S-@key{left}
2055 @itemx S-@key{right}
2056 Change date at cursor by one day. These key bindings conflict with
2057 CUA-mode (@pxref{Interaction}).
2058
2059 @kindex S-@key{up}
2060 @kindex S-@key{down}
2061 @item S-@key{up}
2062 @itemx S-@key{down}
2063 Change the item under the cursor in a timestamp. The cursor can be on
2064 a year, month, day, hour or minute. Note that if the cursor is not at
2065 a time stamp, these same keys modify the priority of an item.
2066 (@pxref{Priorities}). The key bindings also conflict with CUA-mode
2067 (@pxref{Interaction}).
2068
2069
2070 @kindex C-c C-y
2071 @cindex evaluate time range
2072 @item C-c C-y
2073 Evaluate a time range by computing the difference between start and
2074 end. With prefix arg, insert result after the time range (in a table:
2075 into the following column).
2076 @end table
2077
2078 @cindex date, reading in minibuffer
2079 @cindex time, reading in minibuffer
2080 @cindex calendar, for selecting date
2081 When Org-mode prompts for a date/time, the function reading your input
2082 will replace anything you choose not to specify with the current date
2083 and time. For details, see the documentation string of
2084 @command{org-read-date}. Also, a calender will pop up to allow
2085 selecting a date. The calendar can be fully controlled from the
2086 minibuffer, and a date can be selected with the following commands:
2087
2088 @table @kbd
2089 @kindex <
2090 @item <
2091 Scroll calendar backwards by one month.
2092 @kindex >
2093 @item >
2094 Scroll calendar forwards by one month.
2095 @kindex mouse-1
2096 @item mouse-1
2097 Select date by clicking on it.
2098 @kindex S-@key{right}
2099 @item S-@key{right}
2100 One day forward.
2101 @kindex S-@key{left}
2102 @item S-@key{left}
2103 One day back.
2104 @kindex S-@key{down}
2105 @item S-@key{down}
2106 One week forward.
2107 @kindex S-@key{up}
2108 @item S-@key{up}
2109 One week back.
2110 @kindex M-S-@key{right}
2111 @item M-S-@key{right}
2112 One month forward.
2113 @kindex M-S-@key{left}
2114 @item M-S-@key{left}
2115 One month back.
2116 @kindex @key{RET}
2117 @item @key{RET}
2118 Choose date in calendar (only if nothing typed into minibuffer).
2119 @end table
2120
2121 @node Agenda Views, Exporting, Timestamps, Top
2122 @chapter Agenda Views
2123 @cindex agenda views
2124
2125 Due to the way Org-mode works, TODO items and time-stamped items can
2126 be scattered throughout a file or even a number of files. To get an
2127 overview over open action items, or over events that are important for
2128 a particular date, this information must be collected, sorted and
2129 displayed in an organized way.
2130
2131 Org-mode can select items based on various criteria, and display them
2132 in a separate buffer. Three different views are provided:
2133 @itemize @bullet
2134 @item
2135 an @emph{agenda} that is like a calendar and shows information
2136 for specific dates
2137 @item
2138 a @emph{TODO list} that covers all unfinished
2139 action items, and
2140 @item
2141 a @emph{tags view} that shows information based on
2142 the tags associated with headlines in the outline tree.
2143 @end itemize
2144 @noindent
2145 The extracted information is displayed in a special @emph{agenda
2146 buffer}. This buffer is read-only, but provides commands to visit the
2147 corresponding locations in the original Org-mode files, and even to
2148 edit these files remotely.
2149
2150 @menu
2151 * Agenda files:: Files being searched for agenda information
2152 * Agenda dispatcher:: Keyboard access to agenda views
2153 * Weekly/Daily Agenda:: The calendar page with current tasks
2154 * Global TODO list:: All unfinished action items
2155 * Matching headline tags:: Structured information with fine-tuned search
2156 * Timeline:: Time-sorted view for single file
2157 * Agenda commands:: Remote editing of org trees
2158 @end menu
2159
2160 @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
2161 @section Agenda files
2162
2163 The information to be shown is collected from all @emph{agenda files},
2164 the files listed in the variable @code{org-agenda-files}. Thus even
2165 if you only work with a single Org-mode file, this file should be put
2166 into that list@footnote{When using the dispatcher pressing @kbd{1}
2167 before selecting a command will actually limit the command to the
2168 current file, and ignore @code{org-agenda-files} until the next
2169 dispatcher command.}. You can customize @code{org-agenda-files}, but
2170 the easiest way to maintain it is through the following commands
2171
2172 @cindex files, adding to agenda list
2173 @table @kbd
2174 @kindex C-c [
2175 @item C-c [
2176 Add current file to the list of agenda files. The file is added to
2177 the front of the list. If it was already in the list, it is moved to
2178 the front. With prefix arg, file is added/moved to the end.
2179 @kindex C-c ]
2180 @item C-c ]
2181 Remove current file from the list of agenda files.
2182 @kindex C-,
2183 @item C-,
2184 Cycle through agenda file list.
2185 @end table
2186 @noindent
2187 The Org menu contains the current list of files and can be used
2188 to visit any of them.
2189
2190 @node Agenda dispatcher, Weekly/Daily Agenda, Agenda files, Agenda Views
2191 @section The agenda dispatcher
2192 @cindex agenda dispatcher
2193 @cindex dispatching agenda commands
2194 @cindex custom agenda commands
2195 @cindex agenda commands, custom
2196 The views are created through a dispatcher that should be bound to a
2197 global key, for example @kbd{C-c a} (@pxref{Installation and
2198 Activation}). In the following we will assume that @kbd{C-c a} is
2199 indeed how the dispatcher is accessed and list keyboard access to
2200 commands accordingly. After pressing @kbd{C-c a}, an additional
2201 letter is required to execute a command. The dispatcher offers the
2202 following default commands:
2203 @table @kbd
2204 @item a
2205 Create the calendar-like agenda (@pxref{Weekly/Daily Agenda}).
2206 @item t / T
2207 Create a list of all TODO items (@pxref{Global TODO list}).
2208 @item m / M
2209 Create a list of headline matching a TAGS expression (@pxref{Matching
2210 headline tags}).
2211 @end table
2212
2213 You can also define custom commands that will be accessible through
2214 the dispatcher, just like the default commands. Custom commands are
2215 global searches for tags and specific TODO keywords, or a variety of
2216 sparse tree creating commands (@pxref{Sparse trees}). As sparse trees
2217 are only defined for a single org-mode file, these latter commands act
2218 on the current buffer instead of the list of agenda files.
2219
2220 @kindex C-c a C
2221 Custom commands are configured in the variable
2222 @code{org-agenda-custom-commands}. You can customize this variable,
2223 for example by pressing @kbd{C-c a C}. You can also directly set it
2224 with Emacs Lisp in @file{.emacs}. For example:
2225 @lisp
2226 (setq org-agenda-custom-commands
2227 '(("w" todo "WAITING")
2228 ("u" tags "+BOSS-URGENT")
2229 ("U" tags-tree "+BOSS-URGENT")
2230 ("f" occur-tree "\\<FIXME\\>")))
2231 @end lisp
2232 @noindent will define @kbd{C-c a w} as a global search for
2233 TODO entries with @samp{WAITING} as todo keyword, @kbd{C-c a u} as a
2234 global tags search for headlines marked @samp{:BOSS:} but not
2235 @samp{:URGENT:}, @kbd{C-c a U} to do the same search but only in the
2236 current buffer and display the result as a sparse tree, and @kbd{C-c a
2237 f} to create a sparse tree with all entries containing the word
2238 @samp{FIXME}. For more information, look at the documentation string
2239 of the variable @code{org-agenda-custom-commands}.
2240
2241 @node Weekly/Daily Agenda, Global TODO list, Agenda dispatcher, Agenda Views
2242 @section The weekly/daily agenda
2243 @cindex agenda
2244
2245 The purpose of the weekly/daily @emph{agenda} is to act like a page of
2246 a paper agenda, showing all the tasks for the current week or day.
2247
2248 @table @kbd
2249 @cindex org-agenda, command
2250 @kindex C-c a a
2251 @item C-c a a
2252 Compile an agenda for the current week from a list of org files. The
2253 agenda shows the entries for each day. With a @kbd{C-u} prefix (or
2254 when the variable @code{org-agenda-include-all-todo} is @code{t}), all
2255 unfinished TODO items (also those without a date) are also listed at
2256 the beginning of the buffer, before the first date.@*
2257 @end table
2258
2259 Remote editing from the agenda buffer means for example that you can
2260 change the dates of deadlines and appointments from the agenda buffer.
2261 The commands available in the Agenda buffer are listed in @ref{Agenda
2262 commands}.
2263
2264 @menu
2265 * Categories:: Not all tasks are equal
2266 * Time-of-day specifications:: How the agenda knows the time
2267 * Calendar/Diary integration:: Integrating Anniversaries and more
2268 * Sorting of agenda items:: The order of things
2269 @end menu
2270
2271 @node Categories, Time-of-day specifications, Weekly/Daily Agenda, Weekly/Daily Agenda
2272 @subsection Categories
2273
2274 @cindex category
2275 In the agenda buffer, each entry is preceded by a @emph{category},
2276 which is derived from the file name. The category can also be set
2277 with a special line anywhere in the buffer, looking like this:
2278 @example
2279 #+CATEGORY: Thesis
2280 @end example
2281 If there are several such lines in a file, each specifies the category
2282 for the text below it. The display in the agenda buffer looks best if
2283 the category is not longer than 10 characters.
2284
2285 @node Time-of-day specifications, Calendar/Diary integration, Categories, Weekly/Daily Agenda
2286 @subsection Time-of-Day Specifications
2287
2288 Org-mode checks each agenda item for a time-of-day specification. The
2289 time can be part of the time stamp that triggered inclusion into the
2290 agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time
2291 ranges can be specified with two time stamps, like
2292 @c
2293 @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
2294
2295 In the headline of the entry itself, a time(range) may also appear as
2296 plain text (like @samp{12:45} or a @samp{8:30-1pm}. If the agenda
2297 integrates the Emacs diary (@pxref{Calendar/Diary integration}), time
2298 specifications in diary entries are recognized as well.
2299
2300 For agenda display, Org-mode extracts the time and displays it in a
2301 standard 24 hour format as part of the prefix. The example times in
2302 the previous paragraphs would end up in the agenda like this:
2303
2304 @example
2305 8:30-13:00 Arthur Dent lies in front of the bulldozer
2306 12:45...... Ford Prefect arrives and takes Arthur to the pub
2307 19:00...... The Vogon reads his poem
2308 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
2309 @end example
2310
2311 If the agenda is in single-day mode, or for the display of today, the
2312 timed entries are embedded in a time grid, like
2313
2314 @example
2315 8:00...... ------------------
2316 8:30-13:00 Arthur Dent lies in front of the bulldozer
2317 10:00...... ------------------
2318 12:00...... ------------------
2319 12:45...... Ford Prefect arrives and takes Arthur to the pub
2320 14:00...... ------------------
2321 16:00...... ------------------
2322 18:00...... ------------------
2323 19:00...... The Vogon reads his poem
2324 20:00...... ------------------
2325 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
2326 @end example
2327
2328 The time grid can be turned on and off with the variable
2329 @code{org-agenda-use-time-grid}, and can be configured with
2330 @code{org-agenda-time-grid}.
2331
2332
2333 @node Calendar/Diary integration, Sorting of agenda items, Time-of-day specifications, Weekly/Daily Agenda
2334 @subsection Calendar/Diary integration
2335 @cindex calendar integration
2336 @cindex diary integration
2337
2338 Emacs contains the calendar and diary by Edward M. Reingold. The
2339 calendar displays a three-month calendar with holidays from different
2340 countries and cultures. The diary allows to keep track of
2341 anniversaries, lunar phases, sunrise/set, recurrent appointments
2342 (weekly, monthly) and more. In this way, it is quite complementary to
2343 Org-mode. It can be very useful to combine output from Org-mode with
2344 the diary.
2345
2346 In order to include entries from the Emacs diary into Org-mode's
2347 agenda, you only need to customize the variable
2348
2349 @lisp
2350 (setq org-agenda-include-diary t)
2351 @end lisp
2352 @noindent
2353
2354 @noindent After that, everything will happen automatically. All diary
2355 entries including holidays, anniversaries etc will be included in the
2356 agenda buffer created by Org-mode. @key{SPC}, @key{TAB}, and
2357 @key{RET} can be used from the agenda buffer to jump to the diary
2358 file, in order to edit existing diary entries. The @kbd{i} command to
2359 insert new entries for the current date works in the agenda buffer, as
2360 well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
2361 Sunrise/Sunset times, show lunar phases and to convert to other
2362 calendars, respectively. @kbd{c} can be used to switch back and forth
2363 between calendar and agenda.
2364
2365 @node Sorting of agenda items, , Calendar/Diary integration, Weekly/Daily Agenda
2366 @subsection Sorting of agenda items
2367 @cindex sorting, of agenda items
2368 @cindex priorities, of agenda items
2369 The entries for each day are sorted. The default order is to first
2370 collect all items containing an explicit time-of-day specification.
2371 These entries will be shown at the beginning of the list, as a
2372 @emph{schedule} for the day. After that, items remain grouped in
2373 categories, in the sequence given by @code{org-agenda-files}. Within
2374 each category, items are sorted by priority (@pxref{Priorities}).
2375
2376 The priority is a numerical quantity composed of the base priority
2377 (2000 for priority @samp{A}, 1000 for @samp{B}, and 0 for @samp{C}),
2378 plus additional increments for overdue scheduled or deadline items.
2379
2380 Sorting can be customized using the variable
2381 @code{org-agenda-sorting-strategy}.
2382
2383
2384 @node Global TODO list, Matching headline tags, Weekly/Daily Agenda, Agenda Views
2385 @section The global TODO list
2386 @cindex global TODO list
2387 @cindex TODO list, global
2388
2389 The global TODO list contains all unfinished TODO items, formatted and
2390 collected into a single place.
2391
2392 @table @kbd
2393 @kindex C-c a t
2394 @item C-c a t
2395 Show the global TODO list. This collects the TODO items from all
2396 agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in
2397 @code{agenda-mode}, so there are commands to examine and manipulate
2398 the TODO entries directly from that buffer (@pxref{Agenda commands}).
2399 @xref{Global TODO list}, for more information.
2400 @kindex C-c a T
2401 @item C-c a T
2402 Like the above, but allow to select a specific TODO keyword. You can
2403 also do this by specifying a prefix argument to @kbd{C-c a t}. With a
2404 @kbd{C-u} prefix you are prompted for a keyword. With a numeric
2405 prefix, the Nth keyword in @code{org-todo-keywords} is selected.
2406 @kindex r
2407 The @kbd{r} key in the agenda buffer regenerates it, and you can give
2408 a prefix argument to this command to change the selected TODO keyword,
2409 for example @kbd{3 r}. If you often need a search for a specific
2410 keyword, define a custom command for it (@pxref{Agenda dispatcher}).
2411 @end table
2412
2413 Remote editing of TODO items means that you can change the state of a
2414 TODO entry with a single key press. The commands available in the
2415 TODO list are described in @ref{Agenda commands}.
2416
2417 @node Matching headline tags, Timeline, Global TODO list, Agenda Views
2418 @section Matching headline tags
2419 @cindex matching, of tags
2420 @cindex tags view
2421
2422 If headlines in the agenda files are marked with @emph{tags}
2423 (@pxref{Tags}), you can select headlines based on the tags that apply
2424 to them and collect them into an agenda buffer.
2425
2426 @table @kbd
2427 @kindex C-c a m
2428 @item C-c a m
2429 Produce a list of all headlines that match a given set of tags. The
2430 command prompts for a selection criterion, which is a boolean logic
2431 expression with tags, like @samp{+WORK+URGENT-WITHBOSS} or
2432 @samp{WORK|HOME} (@pxref{Tags}). If you often need a specific search,
2433 define a custom command for it (@pxref{Agenda dispatcher}).
2434 @kindex C-c a M
2435 @item C-c a M
2436 Like @kbd{C-c a m}, but only select headlines that are also TODO items
2437 and force checking subitems (see variable
2438 @code{org-tags-match-list-sublevels}.
2439 @end table
2440
2441 The commands available in the tags list are described in @ref{Agenda
2442 commands}.
2443
2444 @node Timeline, Agenda commands, Matching headline tags, Agenda Views
2445 @section Timeline for a single file
2446 @cindex single file summary
2447 @cindex agenda, for single file
2448 @cindex timeline, single file
2449 @cindex time-sorted view
2450
2451 The timeline is not really an agenda view, because it only summarizes
2452 items from a single Org-mode file. But it also uses the agenda buffer
2453 and provides similar commands, so we discuss it here. The timeline
2454 shows all time-stamped items in a single Org-mode file (or the
2455 selected part of it), in @emph{time-sorted view}. The main purpose of
2456 this command is to give an overview over events in a project.
2457
2458 @table @kbd
2459 @kindex C-c C-r
2460 @item C-c C-r
2461 Show a time-sorted view of the org file, with all time-stamped items.
2462 When called with a @kbd{C-u} prefix, all unfinished TODO entries
2463 (scheduled or not) are also listed under the current date.
2464 @end table
2465 @noindent
2466
2467 The commands available in the timeline buffer are listed in
2468 @ref{Agenda commands}.
2469
2470 @node Agenda commands, , Timeline, Agenda Views
2471 @section Commands in the agenda buffer
2472 @cindex commands, in agenda buffer
2473
2474 Entries in the agenda buffer are linked back to the org file or diary
2475 file where they originate. You are not allowed to edit the agenda
2476 buffer itself, but commands are provided to show and jump to the
2477 original entry location, and to edit the org-files ``remotely'' from
2478 the agenda buffer. In this way, all information is stored only once,
2479 and you don't risk that your agenda and note files diverge.
2480
2481 Some commands can be executed with mouse clicks on agenda lines. For
2482 the other commands, the cursor needs to be in the desired line.
2483
2484 @table @kbd
2485 @tsubheading{Motion}
2486 @kindex n
2487 @item n
2488 Next line (same as @key{up}).
2489 @kindex p
2490 @item p
2491 Previous line (same as @key{down}).
2492 @tsubheading{View/GoTo org file}
2493 @kindex mouse-3
2494 @kindex @key{SPC}
2495 @item mouse-3
2496 @itemx @key{SPC}
2497 Display the original location of the item in another window.
2498
2499 @kindex L
2500 @item L
2501 Display original location and recenter that window.
2502
2503 @kindex mouse-2
2504 @kindex mouse-1
2505 @kindex @key{TAB}
2506 @item mouse-2
2507 @itemx mouse-1
2508 @itemx @key{TAB}
2509 Go to the original location of the item in another window. Under Emacs
2510 22, also @kbd{mouse-1} will works for this.
2511
2512 @kindex @key{RET}
2513 @itemx @key{RET}
2514 Go to the original location of the item and delete other windows.
2515
2516 @kindex f
2517 @item f
2518 Toggle Follow mode. In Follow mode, as you move the cursor through
2519 the agenda buffer, the other window always shows the corresponding
2520 location in the org file.
2521
2522 @kindex l
2523 @item l
2524 Toggle Logbook mode. In Logbook mode, entries that where marked DONE while
2525 logging was on (variable @code{org-log-done}) are shown in the agenda.
2526
2527 @tsubheading{Change display}
2528 @kindex o
2529 @item o
2530 Delete other windows.
2531
2532 @kindex w
2533 @item w
2534 Switch to weekly view (7 days displayed together)
2535
2536 @kindex d
2537 @item d
2538 Switch to daily view (just one day displayed)
2539
2540 @kindex D
2541 @item D
2542 Toggle the inclusion of diary entries. See @ref{Calendar/Diary integration}.
2543
2544 @kindex g
2545 @item g
2546 Toggle the time grid on and off. See also the variables
2547 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
2548
2549 @kindex r
2550 @item r
2551 Recreate the agenda buffer, for example to reflect the changes
2552 after modification of the time stamps of items with S-@key{left} and
2553 S-@key{right}. When the buffer is the global todo list, a prefix
2554 argument is interpreted to create a selective list for a specific TODO
2555 keyword.
2556
2557 @kindex @key{right}
2558 @item @key{right}
2559 Display the following @code{org-agenda-ndays} days. For example, if
2560 the display covers a week, switch to the following week. With prefix
2561 arg, go forward that many times @code{org-agenda-ndays} days.
2562
2563 @kindex @key{left}
2564 @item @key{left}
2565 Display the previous dates.
2566
2567 @kindex .
2568 @item .
2569 Goto today.
2570
2571 @tsubheading{Remote editing}
2572
2573 @item 0-9
2574 Digit argument.
2575
2576 @kindex t
2577 @item t
2578 Change the TODO state of the item, both in the agenda and in the
2579 original org file.
2580
2581 @kindex T
2582 @item T
2583 Show all tags assiciated with the current item. Because of
2584 inheritance, this may be more than the tags listed in the line itself.
2585
2586 @kindex :
2587 @item :
2588 Set tags for the current headline.
2589
2590 @kindex ,
2591 @item ,
2592 Set the priority for the current item. Org-mode prompts for the
2593 priority character. If you reply with @key{SPC}, the priority cookie
2594 is removed from the entry.
2595
2596 @kindex P
2597 @item p
2598 Display weighted priority of current item.
2599
2600 @kindex +
2601 @kindex S-@key{up}
2602 @item +
2603 @itemx S-@key{up}
2604 Increase the priority of the current item. The priority is changed in
2605 the original buffer, but the agenda is not resorted. Use the @kbd{r}
2606 key for this.
2607
2608 @kindex -
2609 @kindex S-@key{down}
2610 @item -
2611 @itemx S-@key{down}
2612 Decrease the priority of the current item.
2613
2614 @kindex S-@key{right}
2615 @item S-@key{right}
2616 Change the time stamp associated with the current line by one day into
2617 the future. With prefix argument, change it by that many days. For
2618 example, @kbd{3 6 5 S-@key{right}} will change it by a year. The
2619 stamp is changed in the original org file, but the change is not
2620 directly reflected in the agenda buffer. Use the
2621 @kbd{r} key to update the buffer.
2622
2623 @kindex S-@key{left}
2624 @item S-@key{left}
2625 Change the time stamp associated with the current line by one day
2626 into the past.
2627
2628 @kindex >
2629 @item >
2630 Change the time stamp associated with the current line to today.
2631 The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
2632 on my keyboard.
2633
2634 @cindex diary entries, creating from agenda
2635 @kindex i
2636 @item i
2637 Insert a new entry into the diary. Prompts for the type of entry
2638 (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
2639 entry in the diary, just like @kbd{i d} etc. would do in the calendar.
2640 The date is taken from the cursor position.
2641
2642 @tsubheading{Calendar commands}
2643 @kindex c
2644 @item c
2645 Open the Emacs calendar and move to the date at the agenda cursor.
2646
2647 @item c
2648 When in the calendar, compute and show the Org-mode agenda for the
2649 date at the cursor.
2650
2651 @kindex M
2652 @item M
2653 Show the phases of the moon for three month around current date.
2654
2655 @kindex S
2656 @item S
2657 Show sunrise and sunset times. The geographical location must be set
2658 with calendar variables, see documentation of the Emacs calendar.
2659
2660 @kindex C
2661 @item C
2662 Convert the date at cursor into many other cultural and historic
2663 calendars.
2664
2665 @kindex H
2666 @item H
2667 Show holidays for three month around the cursor date.
2668
2669 @kindex C-c C-x C-c
2670 @item C-c C-x C-c
2671 Export a single iCalendar file containing entries from all agenda files.
2672
2673 @tsubheading{Quit and Exit}
2674 @kindex q
2675 @item q
2676 Quit Agenda, remove the agenda buffer.
2677
2678 @kindex x
2679 @cindex agenda files, removing buffers
2680 @item x
2681 Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
2682 for the compilation of the agenda. Buffers created by the user to
2683 visit org files will not be removed.
2684
2685 @end table
2686
2687 @node Exporting, Miscellaneous, Agenda Views, Top
2688 @chapter Exporting
2689 @cindex exporting
2690
2691 For printing and sharing of notes, Org-mode documents can be exported
2692 as ASCII or HTML files. To incorporate entries with associated times
2693 like deadlines or appointments into a desktop calendar program like
2694 iCal, Org-mode can also produce extracts in the iCalendar format.
2695
2696 @menu
2697 * ASCII export:: Export as a structured ASCII file
2698 * HTML export:: Export as an HTML file
2699 * iCalendar export:: Create calendar entries.
2700 @end menu
2701
2702 @node ASCII export, HTML export, Exporting, Exporting
2703 @section ASCII export
2704 @cindex ASCII export
2705
2706 @cindex region, active
2707 @cindex active region
2708 @cindex transient-mark-mode
2709 @table @kbd
2710 @kindex C-c C-x a
2711 @item C-c C-x a
2712 Export as ASCII file. If there is an active region, only the region
2713 will be exported. For an org file @file{myfile.org}, the ASCII file
2714 will be @file{myfile.txt}. The file will be overwritten without
2715 warning.
2716 @end table
2717
2718 @cindex headline levels, for exporting
2719 In the exported version, the first 3 outline levels will become
2720 headlines, defining a general document structure. Additional levels
2721 will be exported as itemize lists. If you want that transition to occur
2722 at a different level, specify it with a prefix argument. For example,
2723 @example
2724 @kbd{C-1 C-c C-x a org-export-as-ascii}
2725 @end example
2726 @noindent
2727 creates only top level headlines and does the rest as items. Lines
2728 starting with @samp{#} and subtrees starting with the word @samp{COMMENT}
2729 will not be exported.
2730
2731 @node HTML export, iCalendar export, ASCII export, Exporting
2732 @section HTML export
2733 @cindex HTML export
2734
2735 Org-mode contains an HTML exporter with extensive HTML formatting, in
2736 ways similar to John Grubers @emph{markdown} language, but with
2737 additional support for tables.
2738
2739 @cindex region, active
2740 @cindex active region
2741 @cindex transient-mark-mode
2742 @table @kbd
2743 @kindex C-c C-x h
2744 @item C-c C-x h
2745 Export as HTML file @file{myfile.html}.
2746 @kindex C-c C-x b
2747 @item C-c C-x b
2748 Export as HTML file and open it with a browser.
2749 @kindex C-c C-x t
2750 @item C-c C-x t
2751 Insert template with export options, see below.
2752 @kindex C-c :
2753 @item C-c :
2754 Toggle fixed-width for entry (QUOTE) or region, see below.
2755 @end table
2756
2757 @cindex headline levels, for exporting
2758 In the exported version, the first 3 outline levels will become
2759 headlines, defining a general document structure. Additional levels
2760 will be exported as itemize lists. If you want that transition to occur
2761 at a different level, specify it with a prefix argument. For example,
2762 @example
2763 @kbd{C-2 C-c C-x b}
2764 @end example
2765 @noindent
2766 creates two levels of headings and does the rest as items.
2767
2768 @menu
2769 * HTML formatting:: Interpretation of the buffer content
2770 * Export options:: How to influence exports
2771 * Comment lines:: Lines which will not be exported
2772 @end menu
2773
2774 @node HTML formatting, Export options, HTML export, HTML export
2775 @subsection HTML formatting
2776
2777 Not all text is transferred literally to the exported HTML file. The
2778 exporter implements the following interpretation:
2779
2780 @itemize @bullet
2781
2782 @cindex hand-formatted lists
2783 @cindex lists, hand-formatted
2784 @item
2785 Hand-formatted lists with @samp{-}, @samp{*} or @samp{+} as
2786 bullet, or with @samp{1.} or @samp{2)} as enumerator will be recognized and
2787 transformed into HTML lists. See @xref{Plain Lists}.
2788
2789 @cindex underlined text
2790 @cindex bold text
2791 @cindex italic text
2792 @item
2793 You can make words @b{*bold*}, @i{/italic/}, and _underlined_
2794
2795 @cindex @TeX{} interpretation
2796 @item
2797 Simple @TeX{}-like math constructs are interpreted:
2798
2799 @cindex completion, of @TeX{} symbols
2800 @itemize @minus
2801 @item
2802 @samp{10^22} and @samp{J_n} are super- and subscripts. You can quote
2803 @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}
2804 @item
2805 @samp{\alpha} indicates a Greek letter, @samp{\to} an arrow. You can
2806 use completion for these macros, just type @samp{\} and maybe a few
2807 letters, and press @kbd{M-@key{TAB}} to see possible completions.
2808 @end itemize
2809
2810 @cindex tables, export to HTML
2811 @item
2812 Tables are transformed into HTML tables. Data fields before the first
2813 horizontal separator line will be formatted as table header fields.
2814
2815 @cindex fixed width
2816 @item
2817 If a headline starts with the word @samp{QUOTE}, the text below the
2818 headline will be typeset as fixed-width, to allow quoting of computer
2819 codes etc. Lines starting with @samp{:} are also typeset in
2820 fixed-width font.
2821
2822 @cindex HTML tags
2823 @item
2824 If you want to include HTML tags which should be interpreted as such,
2825 mark them with a @samp{@@} like in @samp{@@<b>bold text@@</b>}.
2826 Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
2827 @samp{&gt;} in HTML export.
2828 @end itemize
2829
2830 If these conversions conflict with your habits of typing ASCII text,
2831 they can all be turned off with corresponding variables.
2832
2833 @node Export options, Comment lines, HTML formatting, HTML export
2834 @subsection Export options
2835 @cindex options, for export
2836
2837 @cindex completion, of option keywords
2838 The exporter recognizes special lines in the buffer which provide
2839 additional information. These lines may be put anywhere in the file.
2840 The whole set of lines can be inserted into the buffer with @kbd{C-c
2841 C-x t}. For individual lines, a good way to make sure the keyword is
2842 correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
2843 (@pxref{Completion}).
2844
2845 @example
2846 #+TITLE: the title to be shown (default is the buffer name)
2847 #+AUTHOR: the author (default taken from @code{user-full-name})
2848 #+EMAIL: his/her email address (default from @code{user-mail-address})
2849 #+LANGUAGE: language for HTML, e.g. @samp{en} (@code{org-export-default-language})
2850 #+TEXT: Some descriptive text to be inserted at the beginning.
2851 #+TEXT: Several lines may be given.
2852 #+OPTIONS: H:2 num:t toc:t \n:nil @:t ::t |:t ^:t *:nil TeX:t
2853 @end example
2854 @noindent
2855 The OPTIONS line is a compact form to specify export settings. Here
2856 you can
2857 @cindex headline levels
2858 @cindex section-numbers
2859 @cindex table of contents
2860 @cindex linebreak preservation
2861 @cindex quoted html tags
2862 @cindex fixed-width sections
2863 @cindex tables
2864 @cindex @TeX{}-like syntax for sub- and superscripts
2865 @cindex emphasized text
2866 @cindex @TeX{} macros
2867 @example
2868 H: @r{set the number of headline levels for export}
2869 num: @r{turn on/off section-numbers}
2870 toc: @r{turn on/off table of contents}
2871 \n: @r{turn on/off linebreak-preservation}
2872 @@: @r{turn on/off quoted html tags}
2873 :: @r{turn on/off fixed-width sections}
2874 |: @r{turn on/off tables}
2875 ^: @r{turn on/off @TeX{}-like syntax for sub- and superscripts.}
2876 *: @r{turn on/off emphasized text (bold, italic, underlined)}
2877 TeX: @r{turn on/off @TeX{} macros}
2878 @end example
2879
2880 You can also give style information for the exported file. The
2881 default specification can be configured through the option
2882 @code{org-export-html-style}. If you want to use a file-local style,
2883 you may use file variables, best wrapped into a COMMENT section at the
2884 end of the outline tree. For example:
2885
2886 @example
2887 * COMMENT HTML style specifications
2888
2889 # Local Variables:
2890 # org-export-html-style: " <style type=\"text/css\">
2891 p @{font-weight: normal; color: gray; @}
2892 h1 @{color: black; @}
2893 </style>"
2894 # End: ***
2895 @end example
2896
2897 Remember to execute @kbd{M-x normal-mode} after changing this to make
2898 the new style visible to Emacs.
2899
2900 @node Comment lines, , Export options, HTML export
2901 @subsection Comment lines
2902 @cindex comment lines
2903 @cindex exporting, not
2904
2905 Lines starting with @samp{#} in column zero are treated as comments
2906 and will never be exported. Also entire subtrees starting with the
2907 word @samp{COMMENT} will never be exported. Finally, any text before
2908 the first headline will not be exported either. This applies also for
2909 ASCII export.
2910
2911 @table @kbd
2912 @kindex C-c ;
2913 @item C-c ;
2914 Toggle the COMMENT keyword at the beginning of an entry.
2915 @end table
2916
2917 @node iCalendar export, , HTML export, Exporting
2918 @section iCalendar export
2919 @cindex iCalendar export
2920
2921 Some people like to use Org-mode for keeping track of projects, but
2922 still prefer a standard calendar application for anniversaries and
2923 appointments. In this case it can be useful to have deadlines and
2924 other time-stamped items in Org-mode files show up in the calendar
2925 application. Org-mode can export calendar information in the standard
2926 iCalendar format.
2927
2928 @table @kbd
2929 @kindex C-c C-x i
2930 @item C-c C-x i
2931 Create iCalendar entries for the current file and store them in the same
2932 directory, using a file extension @file{.ics}.
2933 @kindex C-c C-x C-i
2934 @item C-c C-x C-i
2935 Like @kbd{C-c C-x i}, but do this for all files in
2936 @code{org-agenda-files}. For each of these files, a separate iCalendar
2937 file will be written.
2938 @kindex C-c C-x c
2939 @item C-c C-x c
2940 Create a single large iCalendar file from all files in
2941 @code{org-agenda-files} and write it to the file given by
2942 @code{org-combined-agenda-icalendar-file}.
2943 @end table
2944
2945 How this calendar is best read and updated, depends on the application
2946 you are using. For example, when using iCal under Apple MacOS X, you
2947 could create a new calendar @samp{OrgMode} (the default name for the
2948 calendar created by @kbd{C-c C-x c}, see the variables
2949 @code{org-icalendar-combined-name} and
2950 @code{org-combined-agenda-icalendar-file}). Then set Org-mode to
2951 overwrite the corresponding file
2952 @file{~/Library/Calendars/OrgMode.ics}. You may even use AppleScript
2953 to make iCal re-read the calendar files each time a new version of
2954 @file{OrgMode.ics} is produced. Here is the setup needed for this:
2955
2956 @cindex applescript, for calendar update
2957 @lisp
2958 (setq org-combined-agenda-icalendar-file
2959 "~/Library/Calendars/OrgMode.ics")
2960 (add-hook 'org-after-save-iCalendar-file-hook
2961 (lambda ()
2962 (shell-command
2963 "osascript -e 'tell application \"iCal\" to reload calendars'")))
2964 @end lisp
2965
2966 @node Miscellaneous, Index, Exporting, Top
2967 @chapter Miscellaneous
2968
2969 @menu
2970 * Completion:: M-TAB knows what you need
2971 * Customization:: Adapting Org-mode to your taste
2972 * Clean view:: Getting rid of leading stars in the outline
2973 * TTY keys:: Using Org-mode on a tty
2974 * FAQ:: Frequently asked questions
2975 * Interaction:: Other Emacs packages
2976 * Bugs:: Things which do not work perfectly
2977 * Acknowledgments:: These people provided feedback and more
2978 @end menu
2979
2980 @node Completion, Customization, Miscellaneous, Miscellaneous
2981 @section Completion
2982 @cindex completion, of @TeX{} symbols
2983 @cindex completion, of TODO keywords
2984 @cindex completion, of dictionary words
2985 @cindex completion, of option keywords
2986 @cindex completion, of CamelCase links
2987 @cindex completion, of tags
2988 @cindex @TeX{} symbol completion
2989 @cindex TODO keywords completion
2990 @cindex dictionary word completion
2991 @cindex option keyword completion
2992 @cindex CamelCase link completion
2993 @cindex tag completion
2994
2995 Org-mode supports in-buffer completion. This type of completion does
2996 not make use of the minibuffer. You simply type a few letters into
2997 the buffer and use the key to complete text right there.
2998
2999 @table @kbd
3000 @kindex M-@key{TAB}
3001 @item M-@key{TAB}
3002 Complete word at point
3003 @itemize @bullet
3004 @item
3005 At the beginning of a headline, complete TODO keywords.
3006 @item
3007 After @samp{\}, complete @TeX{} symbols supported by the exporter.
3008 @item
3009 After @samp{*}, complete CamelCase versions of all headlines in the
3010 buffer.
3011 @item
3012 After @samp{:}, complete tags used elsewhere in the buffer.
3013 @item
3014 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
3015 @samp{OPTIONS} which set file-specific options for Org-mode. When the
3016 option keyword is already complete, pressing @kbd{M-@key{TAB}} again
3017 will insert example settings for this keyword.
3018 @item
3019 Elsewhere, complete dictionary words using ispell.
3020 @end itemize
3021 @end table
3022
3023
3024 @node Customization, Clean view, Completion, Miscellaneous
3025 @section Customization
3026 @cindex customization
3027 @cindex options, for customization
3028 @cindex variables, for customization
3029
3030 There are more than 100 variables that can be used to customize
3031 Org-mode. For the sake of compactness of the manual, we are not
3032 describing the variables here. A structured overview of customization
3033 variables is available with @kbd{M-x org-customize}. Or select
3034 @code{Browse Org Group} from the @code{Org->Customization} menu.
3035
3036 @node Clean view, TTY keys, Customization, Miscellaneous
3037 @section A cleaner outline view
3038 @cindex hiding leading stars
3039 @cindex clean outline view
3040
3041 Some people find it noisy and distracting that the Org-mode headlines
3042 are starting with a potentially large number of stars. For example in
3043 the example tree from @ref{Headlines}:
3044
3045 @example
3046 * Top level headline
3047 ** Second level
3048 *** 3rd level
3049 some text
3050 *** 3rd level
3051 more text
3052 * Another top level headline
3053 @end example
3054
3055 @noindent
3056 Unfortunately this is deeply ingrained into the code of Org-mode and
3057 cannot be easily changed. You can, however, modify the display in such
3058 a way that all leading stars become invisible and the outline more easy
3059 to read. To do this, customize the variable
3060 @code{org-hide-leading-stars} like this:
3061
3062 @lisp
3063 (setq org-hide-leading-stars t)
3064 @end lisp
3065
3066 @noindent
3067 or change this on a per-file basis with one of the lines (anywhere in
3068 the buffer)
3069
3070 @example
3071 #+STARTUP: showstars
3072 #+STARTUP: hidestars
3073 @end example
3074 @noindent
3075 Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
3076 the modifications.
3077
3078 With stars hidden, the tree becomes:
3079
3080 @example
3081 * Top level headline
3082 * Second level
3083 * 3rd level
3084 some text
3085 * 3rd level
3086 more text
3087 * Another top level headline
3088 @end example
3089
3090 @noindent
3091 Note that the leading stars are not truly replaced by whitespace, they
3092 are only fontified with the face @code{org-hide} that uses the
3093 background color as font color. If are are not using either white or
3094 black background, you may have to customize this face to get the wanted
3095 effect. Another possibility is to set this font such that the extra
3096 stars are @i{almost} invisible, for example using the color
3097 @code{grey90} on a white background.
3098
3099 Things become cleaner still if you skip all the even levels and use only
3100 odd levels 1, 3, 5..., effectively adding two stars to go from one
3101 outline level to the next:
3102
3103 @example
3104 * Top level headline
3105 * Second level
3106 * 3rd level
3107 some text
3108 * 3rd level
3109 more text
3110 * Another top level headline
3111 @end example
3112
3113 @noindent
3114 In order to make the structure editing and export commands handle this
3115 convention correctly, use
3116
3117 @lisp
3118 (setq org-odd-levels-only t)
3119 @end lisp
3120
3121 @noindent
3122 or set this on a per-file basis with one of the following lines (don't
3123 forget to press @kbd{C-c C-c} with the cursor in the startup line to
3124 activate changes immediately).
3125
3126 @example
3127 #+STARTUP: odd
3128 #+STARTUP: oddeven
3129 @end example
3130
3131 You can convert an Org-mode file from single-star-per-level to
3132 double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
3133 RET} in that file. There is no command for the back conversion because
3134 such a command might merge levels and in this way destroy the
3135 structure of the tree.
3136 @c FIXME: Maybe we should have such a command...
3137
3138 @node TTY keys, FAQ, Clean view, Miscellaneous
3139 @section Using org-mode on a tty
3140 @cindex tty keybindings
3141
3142 Org-mode uses a number of keys that are not accessible on a tty. This
3143 applies to most special keys like cursor keys, @key{TAB} and
3144 @key{RET}, when these are combined with modifier keys like @key{Meta}
3145 and/or @key{Shift}. Org-mode uses these bindings because it needs to
3146 provide keys for a large number of commands, and because these keys
3147 appeared particularly easy to remember. In order to still be able to
3148 access the core functionality of Org-mode on a tty, alternative
3149 bindings are provided. Here is a complete list of these bindings,
3150 which are obviously more cumbersome to use. Note that sometimes a
3151 work-around can be better. For example changing a time stamp is
3152 really only fun with @kbd{S-@key{cursor}} keys. On a tty you would
3153 rather use @kbd{C-c .} to re-insert the timestamp.
3154
3155 @multitable @columnfractions 0.15 0.2 0.2
3156 @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
3157 @item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab
3158 @item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{@key{Esc} @key{left}}
3159 @item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab
3160 @item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{@key{Esc} @key{right}}
3161 @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab
3162 @item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{@key{Esc} @key{up}}
3163 @item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab
3164 @item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{@key{Esc} @key{down}}
3165 @item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab
3166 @item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab
3167 @item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{@key{Esc} @key{RET}}
3168 @item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab
3169 @item @kbd{S-@key{left}} @tab @kbd{C-c C-x @key{left}} @tab
3170 @item @kbd{S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
3171 @item @kbd{S-@key{up}} @tab @kbd{C-c C-x @key{up}} @tab
3172 @item @kbd{S-@key{down}} @tab @kbd{C-c C-x @key{down}} @tab
3173 @end multitable
3174
3175 @node FAQ, Interaction, TTY keys, Miscellaneous
3176 @section Frequently asked questions
3177 @cindex FAQ
3178
3179 @enumerate
3180 @item @b{Org-mode seems to be a useful default mode for the various
3181 @file{README} files I have scattered through my directories. How do I
3182 turn it on for all @file{README} files?}
3183 @example
3184 (add-to-list 'auto-mode-alist '("README$" . org-mode))
3185 @end example
3186
3187 @item @b{All these stars are driving me mad, I just find the Emacs
3188 outlines unreadable. Can't you just put white space and a single star as a
3189 starter for headlines?}@*
3190 See @ref{Clean view}.
3191
3192 @item @b{I would like to have two windows on the same Org-mode
3193 file, but with different outline visibility. Is that possible?}@*
3194 @cindex @code{make-indirect-buffer}
3195 @cindex indirect buffers
3196 In GNU Emacs, you may use @emph{indirect buffers} which do exactly
3197 this. See the documentation on the command
3198 @code{make-indirect-buffer}. In XEmacs, this is currently not
3199 possible because of the different outline implementation.
3200
3201 @item @b{Is there an easy way to insert links to web locations?}@*
3202 @cindex URL, paste into buffer
3203 Sure, just type or paste them into the buffer. A plain-text URL-like
3204 string is directly interpreted as a link.
3205
3206 @item @b{When I export my TODO list, every TODO item becomes a
3207 separate section. How do I enforce these items to be exported as an
3208 itemized list?}@*
3209 If you plan to use ASCII or HTML export, make sure things you want to
3210 be exported as item lists are level 4 at least, even if that does mean
3211 there is a level jump. For example
3212
3213 @example
3214 * Todays top priorities
3215 **** TODO write a letter to xyz
3216 **** TODO Finish the paper
3217 **** Pick up kids at the school
3218 @end example
3219
3220 Alternatively, if you need a specific value for the heading/item
3221 transition in a particular file, use the @samp{+OPTIONS} line to
3222 configure the @samp{H} switch.
3223
3224 @example
3225 +OPTIONS: H:2; ...
3226 @end example
3227
3228 @item @b{I would like to export only a subtree of my file to HTML. How?}@*
3229 @cindex exporting a subtree
3230 If you want to export a subtree, mark the subtree as region and then
3231 export. Marking can be done with @kbd{C-c @@ C-x C-x}, for example.
3232
3233 @item @b{Org-mode takes over the S-cursor keys. I also want to use
3234 CUA-mode, is there a way to fix this conflict?}@*
3235 Yes, see @ref{Interaction}
3236
3237 @item @b{Is there an easy way to insert an empty table template with a
3238 default number of rows and columns?}@*
3239 @cindex table, empty template
3240 To insert an empty table template, just type @samp{|-} and use
3241 @key{TAB}. The default size can be changed with the variable
3242 @code{org-table-default-size}. However, just starting to type the
3243 first line is usually much easier.
3244
3245 @item @b{One of my table columns has started to fill up with
3246 @samp{#ERROR}. What is going on?}@*
3247 Org-mode tried to compute the column from other fields using a
3248 formula stored in the @samp{#+TBLFMT:} line just below the table, and
3249 the evaluation of the formula fails. Fix the fields used in the
3250 formula, or fix the formula, or remove it!
3251
3252 @item @b{When I am in the last column of a table and just above a
3253 horizontal line in the table, pressing TAB creates a new table line
3254 @i{before} the horizontal line. How can I quickly move to the line
3255 @i{below} the horizontal line instead?}@*
3256 Press @key{down} (to get on the separator line) and then @key{TAB}.
3257 Or configure the variable @code{org-table-tab-jumps-over-hlines}.
3258
3259 @item @b{How can I change the indentation of an entire table without
3260 fixing every line by hand?}@*
3261 @cindex indentation, of tables
3262 The indentation of a table is set by the first line. So just fix the
3263 indentation of the first line and realign with @key{TAB}.
3264
3265 @item @b{Is it possible to include entries from org-mode files into my
3266 emacs diary?}@*
3267 Since the org-mode agenda is much more powerful and can contain the
3268 diary (@pxref{Calendar/Diary integration}), you should think twice
3269 before deciding to do this. Inegrating org-mode information into the
3270 diary is, however, possible. The following steps are necessary:
3271 Autoload the function @command{org-diary} as shown above under
3272 @ref{Installation and Activation}. You also need to use @emph{fancy
3273 diary display} by setting in @file{.emacs}:
3274
3275 @lisp
3276 (add-hook 'diary-display-hook 'fancy-diary-display)
3277 @end lisp
3278
3279 Then include the following line into your @file{~/diary} file, in
3280 order to get the entries from all files listed in the variable
3281 @code{org-agenda-files}:
3282
3283 @example
3284 &%%(org-diary)
3285 @end example
3286 @noindent
3287 You may also select specific files with
3288
3289 @example
3290 &%%(org-diary) ~/path/to/some/org-file.org
3291 &%%(org-diary) ~/path/to/another/org-file.org
3292 @end example
3293
3294 If you now launch the calendar and press @kbd{d} to display a diary,
3295 the headlines of entries containing a timestamp, date range, schedule,
3296 or deadline referring to the selected date will be listed. Just like
3297 in Org-mode's agenda view, the diary for @emph{today} contains
3298 additional entries for overdue deadlines and scheduled items. See
3299 also the documentation of the @command{org-diary} function.
3300
3301 @end enumerate
3302
3303
3304 @node Interaction, Bugs, FAQ, Miscellaneous
3305 @section Interaction with other packages
3306 @cindex packages, interaction with other
3307 Org-mode can cooperate with the following packages:
3308
3309 @table @asis
3310 @cindex @file{org-mouse.el}
3311 @item @file{org-mouse.el} by Piotr Zielinski
3312 This package implements extended mouse functionality for Org-mode. It
3313 allows to cycle visibility and to edit the document structure with the
3314 mouse. It also provides a context-sensitive menu that changes depending
3315 on the context of a mouse-click. Use a search engine to find this
3316 package on the web.
3317 @cindex @file{table.el}
3318 @item @file{table.el} by Takaaki Ota
3319 Org mode cooperates with table.el, see @ref{table.el}. @file{table.el}
3320 is part of Emacs 22.
3321 @cindex @file{calc.el}
3322 @item @file{calc.el} by Dave Gillespie
3323 Org-mode uses the calc package for implementing spreadsheet
3324 functionality in its tables (@pxref{Table calculations}). Org-modes
3325 checks for the availability of calc by looking for the function
3326 @code{calc-eval} which should be autoloaded in your setup if calc has
3327 been installed properly. As of Emacs 22, calc is part of the Emacs
3328 distribution. Another possibility for interaction between the two
3329 packages is using calc for embedded calculations. @xref{Embedded Mode,
3330 , Embedded Mode, calc, GNU Emacs Calc Manual}.
3331 @cindex @file{constants.el}
3332 @item @file{constants.el} by Carsten Dominik
3333 In a table formula (@pxref{Table calculations}), it is possible to use
3334 names for natural constants or units. Instead of defining you own
3335 constants in the variable @code{org-table-formula-constants}, install
3336 the @file{constants} package which defines a large number of constants
3337 and units, and lets you use unit prefixes like @samp{M} for
3338 @samp{Mega} etc. You will need version 2.0 of this package, available
3339 at @url{http://www.astro.uva.nl/~dominik/Tools}. Org-mode checks for
3340 the function @code{constants-get}, which has to be autoloaded in your
3341 setup. See the installation instructions in the file
3342 @file{constants.el}.
3343 @cindex @file{remember.el}
3344 @cindex @file{CUA.el}
3345 @item @file{CUA.el} by Kim. F. Storm
3346 Keybindings in Org-mode conflict with the @kbd{S-<cursor>} keys
3347 used by CUA-mode (as well as pc-select-mode and s-region-mode) to
3348 select and extend the region. If you want to use one of these
3349 packages along with Org-mode, configure the variable
3350 @code{org-CUA-compatible}. When set, Org-mode will move the following
3351 keybindings in org-mode files, and in the agenda buffer (but not
3352 during date selection).
3353 @example
3354 S-UP -> M-p S-DOWN -> M-n
3355 S-LEFT -> M-- S-RIGHT -> M-+
3356 S-RET -> C-S-RET
3357 @end example
3358 Yes, these are unfortunately more difficult to remember. If you want
3359 to have other replacement keys, look at the variable
3360 @code{org-disputed-keys}.
3361 @item @file{remember.el} by John Wiegley
3362 Org mode cooperates with remember, see @ref{Remember}.
3363 @file{Remember.el} is not part of Emacs, find it on the web.
3364 @cindex @file{planner.el}
3365 @item @file{planner.el} by John Wiegley
3366 Planner is another tool to plan work and keep track of tasks. Planner
3367 uses a multi-file approach with project pages and day pages. Is based
3368 on Emacs-Wiki. If Planner is your primary tool, it can be useful to
3369 display the agenda entries resulting from org files in day-pages of
3370 the planner. This can be done through the diary of the calendar:
3371 Integrate org files into the diary as described above, and then turn
3372 on the diary support of planner. Planner is not part of Emacs, find it
3373 on the web.
3374 @end table
3375
3376 @node Bugs, Acknowledgments, Interaction, Miscellaneous
3377 @section Bugs
3378 @cindex bugs
3379
3380 Here is a list of things which should work differently, but which I
3381 have found too hard to fix.
3382
3383 @itemize @bullet
3384 @item
3385 Text in an entry protected with the @samp{QUOTE} keyword should not
3386 autowrap.
3387 @item
3388 When the application called by @kbd{C-c C-o} to open a file link fails
3389 (for example because the application does not exits or refuses to open
3390 the file), it does so silently. No error message is displayed.
3391 @item
3392 Plain list items should be able to hold a TODO item. Unfortunately this
3393 has so many technical problems that I will only consider this change for
3394 the next major release (5.0).
3395 @item
3396 The remote-editing commands in the agenda buffer cannot be undone with
3397 @code{undo} called from within the agenda buffer. But you can go to
3398 the corresponding buffer (using @key{TAB} or @key{RET} and execute
3399 @code{undo} there.
3400 @item
3401 Recalculating a table line applies the formulas from left to right.
3402 If a formula uses @emph{calculated} fields further down the row,
3403 multiple recalculation may be needed to get all fields consistent.
3404 @item
3405 Under XEmacs, if Org-mode entries are included into the diary, it is
3406 not possible to jump back from the diary to the org file. Apparently,
3407 the text properties are lost when the fancy-diary-display is used.
3408 However, from Org-mode's timeline and agenda buffers (created with
3409 @kbd{C-c C-r} and @kbd{C-c a}), things do work correctly.
3410 @item
3411 You can only make a single word boldface or italic. To emphasize
3412 several words in a row, each must have the emphasize markers, like in
3413 @samp{*three* *bold* *words*}.
3414 @item
3415 The exporters work well, but could be made more efficient.
3416 @end itemize
3417
3418 @page
3419
3420 @node Acknowledgments, , Bugs, Miscellaneous
3421 @section Acknowledgments
3422 @cindex acknowledgments
3423 @cindex thanks
3424
3425 Org-mode was written by Carsten Dominik, who still maintains it at the
3426 Org-mode homepage @uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
3427 The following people (in alphabetic order) have helped the development
3428 along with ideas, suggestions and patches. Many thanks to all of you,
3429 Org-mode would not be what it is without your input.
3430
3431 @itemize @bullet
3432 @item
3433 Thomas Baumann contributed the code for links to the MH-E email system.
3434 @item
3435 Pavel Chalmoviansky reported bugs and suggested improvements
3436 related to the agenda treatment of items with specified time.
3437 @item
3438 Sacha Chua, the current maintainer of Planner, suggested to copy
3439 linking code from Planner (I took code for RMAIL and Wanderlust).
3440 @item
3441 Christian Egli converted the documentation into TeXInfo format and
3442 patched basic CSS formatting support into the HTML exporter. He also
3443 inspired the agenda by showing me his plans for a multifile summary.
3444 @item
3445 Kai Grossjohann pointed out that a number of key bindings in Org-mode
3446 conflict with other packages.
3447 @item
3448 Stefan Monnier provided a patch with lots of little fixes to keep the
3449 Emacs-Lisp compiler happy.
3450 @item
3451 Tim O'Callaghan suggested in-file links, search options for
3452 general file links, and TAGS.
3453 @item
3454 Oliver Oppitz suggested multi-state TODO items.
3455 @item
3456 Pete Phillips helped the development of the TAGS feature with beta
3457 testing and suggestions.
3458 @item
3459 Matthias Rempe (Oelde) provided ideas, a patch introducing Windows
3460 NT/2000 support, and quality control.
3461 @item
3462 Kevin Rogers contributed code to access VM files on remote hosts.
3463 @item
3464 Philip Rooke created the Org-mode reference card. He also helped with
3465 beta testing and contributed a number of very useful ideas.
3466 @item
3467 Christian Schlauer proposed angular brackets around links, among other
3468 things.
3469 @item
3470 Linking to VM/BBDB/GNUS was inspired by Tom Shannon's
3471 @file{organizer-mode.el}.
3472 @item
3473 Juergen Vollmer contributed code generating the table of contents
3474 in HTML output, and other export improvements.
3475 @item
3476 Chris Wallace provided a patch implementing the @samp{QUOTE} keyword.
3477 @item
3478 David Wainberg suggested the archiving mechanism and shaped the
3479 internal link system with many suggestions and ideas.
3480 @item
3481 Scheduling TODO items was inspired by John Wiegley's @file{planner.el}.
3482 @item
3483 Carsten Wimmer suggested some changes and helped fix a bug in linking
3484 to GNUS.
3485 @item
3486 Roland Winkler pointed out that additional keybindings are needed to
3487 use Org-mode on a tty.
3488 @item
3489 Piotr Zielinski wrote @file{org-mouse.el} and pointed out to me that
3490 Emacs 22 can be made to follow links using mouse-1 clicks.
3491 @c @item
3492 @c Nic Ferrier and Christian Egli implemented XML export.
3493 @end itemize
3494
3495 @node Index, Key Index, Miscellaneous, Top
3496 @chapter Index
3497
3498 @printindex cp
3499
3500 @node Key Index, , Index, Top
3501 @chapter Key Index
3502
3503 @printindex ky
3504
3505 @bye
3506
3507 @ignore
3508 arch-tag: 7893d1fe-cc57-4d13-b5e5-f494a1bcc7ac
3509 @end ignore