Release 7.3
[org-mode/org-mode-NeilSmithlineMods.git] / doc / orgguide.texi
blobb67f7f1ea6847584e55bfdcda2c8adcaaf25f078
1 \input texinfo
2 @c %**start of header
3 @setfilename ../../info/orgguide
4 @settitle The compact Org-mode Guide
6 @set VERSION 7.3
7 @set DATE November 2010
9 @c Use proper quote and backtick for code sections in PDF output
10 @c Cf. Texinfo manual 14.2
11 @set txicodequoteundirected
12 @set txicodequotebacktick
14 @c Version and Contact Info
15 @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
16 @set AUTHOR Carsten Dominik
17 @set MAINTAINER Carsten Dominik
18 @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
19 @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
20 @c %**end of header
21 @finalout
23 @c Macro definitions
24 @iftex
25 @c @hyphenation{time-stamp time-stamps time-stamp-ing time-stamp-ed}
26 @end iftex
27 @macro Ie {}
28 I.e.,
29 @end macro
30 @macro ie {}
31 i.e.,
32 @end macro
33 @macro Eg {}
34 E.g.,
35 @end macro
36 @macro eg {}
37 e.g.,
38 @end macro
40 @c Subheadings inside a table.
41 @macro tsubheading{text}
42 @ifinfo
43 @subsubheading \text\
44 @end ifinfo
45 @ifnotinfo
46 @item @b{\text\}
47 @end ifnotinfo
48 @end macro
50 @macro seealso{text}
51 @noindent @b{Further reading}@*@noindent \text\
52 @end macro
53 @copying
55 Copyright @copyright{} 2010 Free Software Foundation
57 @quotation
58 Permission is granted to copy, distribute and/or modify this document
59 under the terms of the GNU Free Documentation License, Version 1.3 or
60 any later version published by the Free Software Foundation; with no
61 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
62 and with the Back-Cover Texts as in (a) below.  A copy of the license
63 is included in the section entitled ``GNU Free Documentation License.''
65 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
66 modify this GNU manual.  Buying copies from the FSF supports it in
67 developing GNU and promoting software freedom.''
69 This document is part of a collection distributed under the GNU Free
70 Documentation License.  If you want to distribute this document
71 separately from the collection, you can do so by adding a copy of the
72 license to the document, as described in section 6 of the license.
73 @end quotation
74 @end copying
76 @dircategory Emacs
77 @direntry
78 * Org Mode Guide: (orgguide).  Abbreviated Org-mode Manual
79 @end direntry
81 @titlepage
82 @title The compact Org-mode Guide
84 @subtitle Release @value{VERSION}
85 @author by Carsten Dominik
87 @c The following two commands start the copyright page.
88 @page
89 @vskip 0pt plus 1filll
90 @insertcopying
91 @end titlepage
93 @c Output the table of contents at the beginning.
94 @shortcontents
96 @ifnottex
97 @node Top, Introduction, (dir), (dir)
98 @top Org Mode Guide
100 @insertcopying
101 @end ifnottex
103 @menu
104 * Introduction::                Getting started
105 * Document Structure::          A tree works like your brain
106 * Tables::                      Pure magic for quick formatting
107 * Hyperlinks::                  Notes in context
108 * TODO Items::                  Every tree branch can be a TODO item
109 * Tags::                        Tagging headlines and matching sets of tags
110 * Properties::                  Properties
111 * Dates and Times::             Making items useful for planning
112 * Capture - Refile - Archive::  The ins and outs for projects
113 * Agenda Views::                Collecting information into views
114 * Markup::                      Prepare text for rich export
115 * Exporting::                   Sharing and publishing of notes
116 * Publishing::                  Create a web site of linked Org files
117 * Working With Source Code::    Source code snippets embedded in Org
118 * Miscellaneous::               All the rest which did not fit elsewhere
120 @detailmenu
121  --- The Detailed Node Listing ---
123 Introduction
125 * Preface::                     Welcome
126 * Installation::                How to install a downloaded version of Org
127 * Activation::                  How to activate Org for certain buffers
128 * Feedback::                    Bug reports, ideas, patches etc.
130 Document Structure
132 * Outlines::                    Org is based on Outline mode
133 * Headlines::                   How to typeset Org tree headlines
134 * Visibility cycling::          Show and hide, much simplified
135 * Motion::                      Jumping to other headlines
136 * Structure editing::           Changing sequence and level of headlines
137 * Sparse trees::                Matches embedded in context
138 * Plain lists::                 Additional structure within an entry
139 * Footnotes::                   How footnotes are defined in Org's syntax
141 Hyperlinks
143 * Link format::                 How links in Org are formatted
144 * Internal links::              Links to other places in the current file
145 * External links::              URL-like links to the world
146 * Handling links::              Creating, inserting and following
147 * Targeted links::              Point at a location in a file
149 TODO Items
151 * Using TODO states::           Setting and switching states
152 * Multi-state workflows::       More than just on/off
153 * Progress logging::            Dates and notes for progress
154 * Priorities::                  Some things are more important than others
155 * Breaking down tasks::         Splitting a task into manageable pieces
156 * Checkboxes::                  Tick-off lists
158 Progress logging
160 * Closing items::               When was this entry marked DONE?
161 * Tracking TODO state changes::  When did the status change?
163 Tags
165 * Tag inheritance::             Tags use the tree structure of the outline
166 * Setting tags::                How to assign tags to a headline
167 * Tag searches::                Searching for combinations of tags
169 Dates and Times
171 * Timestamps::                  Assigning a time to a tree entry
172 * Creating timestamps::         Commands which insert timestamps
173 * Deadlines and scheduling::    Planning your work
174 * Clocking work time::          Tracking how long you spend on a task
176 Capture - Refile - Archive
178 * Capture::                     
179 * Refiling notes::              Moving a tree from one place to another
180 * Archiving::                   What to do with finished projects
182 Capture
184 * Setting up a capture location::  Where notes will be stored
185 * Using capture::               Commands to invoke and terminate capture
186 * Capture templates::           Define the outline of different note types
188 Agenda Views
190 * Agenda files::                Files being searched for agenda information
191 * Agenda dispatcher::           Keyboard access to agenda views
192 * Built-in agenda views::       What is available out of the box?
193 * Agenda commands::             Remote editing of Org trees
194 * Custom agenda views::         Defining special searches and views
196 The built-in agenda views
198 * Weekly/daily agenda::         The calendar page with current tasks
199 * Global TODO list::            All unfinished action items
200 * Matching tags and properties::  Structured information with fine-tuned search
201 * Timeline::                    Time-sorted view for single file
202 * Search view::                 Find entries by searching for text
204 Markup for rich export
206 * Structural markup elements::  The basic structure as seen by the exporter
207 * Images and tables::           Tables and Images will be included
208 * Literal examples::            Source code examples with special formatting
209 * Include files::               Include additional files into a document
210 * Embedded LaTeX::              LaTeX can be freely used inside Org documents
212 Structural markup elements
214 * Document title::              Where the title is taken from
215 * Headings and sections::       The document structure as seen by the exporter
216 * Table of contents::           The if and where of the table of contents
217 * Paragraphs::                  Paragraphs
218 * Emphasis and monospace::      Bold, italic, etc.
219 * Comment lines::               What will *not* be exported
221 Exporting
223 * Export options::              Per-file export settings
224 * The export dispatcher::       How to access exporter commands
225 * ASCII/Latin-1/UTF-8 export::  Exporting to flat files with encoding
226 * HTML export::                 Exporting to HTML
227 * LaTeX and PDF export::        Exporting to La@TeX{}, and processing to PDF
228 * DocBook export::              Exporting to DocBook
229 * iCalendar export::            
231 Miscellaneous
233 * Completion::                  M-TAB knows what you need
234 * Clean view::                  Getting rid of leading stars in the outline
235 * MobileOrg::                   Org-mode on the iPhone
237 @end detailmenu
238 @end menu
240 @node Introduction, Document Structure, Top, Top
241 @chapter Introduction
243 @menu
244 * Preface::                     Welcome
245 * Installation::                How to install a downloaded version of Org
246 * Activation::                  How to activate Org for certain buffers
247 * Feedback::                    Bug reports, ideas, patches etc.
248 @end menu
250 @node Preface, Installation, Introduction, Introduction
251 @section Preface
253 Org is a mode for keeping notes, maintaining TODO lists, and doing project
254 planning with a fast and effective plain-text system.  It is also an
255 authoring and publishing system.
257 @i{This document is a much compressed derivative of the
258 @uref{http://orgmode.org/index.html#sec-4_1, comprehensive Org-mode manual}.
259 It contains all basic features and commands, along with important hints for
260 customization.  It is intended for beginners who would shy back from a 200
261 page manual because of sheer size.}
263 @node Installation, Activation, Preface, Introduction
264 @section Installation
266 @b{Important:} @i{If you are using a version of Org that is part of the Emacs
267 distribution or an XEmacs package, please skip this section and go directly
268 to @ref{Activation}.}
270 If you have downloaded Org from the Web, either as a distribution @file{.zip}
271 or @file{.tar} file, or as a Git archive, it is best to run it directly from
272 the distribution directory.  You need to add the @file{lisp} subdirectories
273 to the Emacs load path.  To do this, add the following line to @file{.emacs}:
275 @smallexample
276 (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
277 (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
278 @end smallexample
280 @noindent For speed you should byte-compile the Lisp files with the shell
281 command:
283 @smallexample
284 make
285 @end smallexample
287 Then add the following line to @file{.emacs}.  It is needed so that
288 Emacs can autoload functions that are located in files not immediately loaded
289 when Org-mode starts.
290 @smalllisp
291 (require 'org-install)
292 @end smalllisp
294 @node Activation, Feedback, Installation, Introduction
295 @section Activation
297 Add the following lines to your @file{.emacs} file.  The last three lines
298 define @emph{global} keys for some commands --- please choose suitable keys
299 yourself.
301 @smalllisp
302 ;; The following lines are always needed.  Choose your own keys.
303 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
304 (add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on
305 (global-set-key "\C-cl" 'org-store-link)
306 (global-set-key "\C-ca" 'org-agenda)
307 (global-set-key "\C-cb" 'org-iswitchb)
308 @end smalllisp
310 With this setup, all files with extension @samp{.org} will be put
311 into Org mode. 
313 @node Feedback,  , Activation, Introduction
314 @section Feedback
316 If you find problems with Org, or if you have questions, remarks, or ideas
317 about it, please mail to the Org mailing list @email{emacs-orgmode@@gnu.org}.
318 For information on how to submit bug reports, see the main manual.
320 @node Document Structure, Tables, Introduction, Top
321 @chapter Document Structure
323 Org is based on Outline mode and provides flexible commands to
324 edit the structure of the document.
326 @menu
327 * Outlines::                    Org is based on Outline mode
328 * Headlines::                   How to typeset Org tree headlines
329 * Visibility cycling::          Show and hide, much simplified
330 * Motion::                      Jumping to other headlines
331 * Structure editing::           Changing sequence and level of headlines
332 * Sparse trees::                Matches embedded in context
333 * Plain lists::                 Additional structure within an entry
334 * Footnotes::                   How footnotes are defined in Org's syntax
335 @end menu
337 @node Outlines, Headlines, Document Structure, Document Structure
338 @section Outlines
340 Org is implemented on top of Outline mode.  Outlines allow a
341 document to be organized in a hierarchical structure, which (at least
342 for me) is the best representation of notes and thoughts.  An overview
343 of this structure is achieved by folding (hiding) large parts of the
344 document to show only the general document structure and the parts
345 currently being worked on.  Org greatly simplifies the use of
346 outlines by compressing the entire show/hide functionality into a single
347 command, @command{org-cycle}, which is bound to the @key{TAB} key.
349 @node Headlines, Visibility cycling, Outlines, Document Structure
350 @section Headlines
352 Headlines define the structure of an outline tree.  The headlines in
353 Org start with one or more stars, on the left margin@footnote{See
354 the variable @code{org-special-ctrl-a/e} to configure special behavior
355 of @kbd{C-a} and @kbd{C-e} in headlines.}.  For example:
357 @smallexample
358 * Top level headline
359 ** Second level
360 *** 3rd level
361     some text
362 *** 3rd level
363     more text
365 * Another top level headline
366 @end smallexample
368 @noindent Some people find the many stars too noisy and would prefer an
369 outline that has whitespace followed by a single star as headline
370 starters.  @ref{Clean view}, describes a setup to realize this.
372 @node Visibility cycling, Motion, Headlines, Document Structure
373 @section Visibility cycling
375 Outlines make it possible to hide parts of the text in the buffer.
376 Org uses just two commands, bound to @key{TAB} and
377 @kbd{S-@key{TAB}} to change the visibility in the buffer.
379 @table @kbd
380 @item @key{TAB}
381 @emph{Subtree cycling}: Rotate current subtree among the states
383 @smallexample
384 ,-> FOLDED -> CHILDREN -> SUBTREE --.
385 '-----------------------------------'
386 @end smallexample
388 When called with a prefix argument (@kbd{C-u @key{TAB}}) or with the shift
389 key, global cycling is invoked.
391 @item S-@key{TAB} @r{and} C-u @key{TAB}
392 @emph{Global cycling}: Rotate the entire buffer among the states
394 @smallexample
395 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
396 '--------------------------------------'
397 @end smallexample
399 @item C-u C-u C-u @key{TAB}
400 Show all, including drawers.
401 @end table
403 When Emacs first visits an Org file, the global state is set to
404 OVERVIEW, i.e. only the top level headlines are visible.  This can be
405 configured through the variable @code{org-startup-folded}, or on a
406 per-file basis by adding a startup keyword @code{overview}, @code{content},
407 @code{showall}, like this:
409 @smallexample
410 #+STARTUP: content
411 @end smallexample
414 @node Motion, Structure editing, Visibility cycling, Document Structure
415 @section Motion
416 The following commands jump to other headlines in the buffer.
418 @table @kbd
419 @item C-c C-n
420 Next heading.
421 @item C-c C-p
422 Previous heading.
423 @item C-c C-f
424 Next heading same level.
425 @item C-c C-b
426 Previous heading same level.
427 @item C-c C-u
428 Backward to higher level heading.
429 @end table
431 @node Structure editing, Sparse trees, Motion, Document Structure
432 @section Structure editing
434 @table @kbd
435 @item M-@key{RET}
436 Insert new heading with same level as current.  If the cursor is in a plain
437 list item, a new item is created (@pxref{Plain lists}).  When this command is
438 used in the middle of a line, the line is split and the rest of the line
439 becomes the new headline@footnote{If you do not want the line to be split,
440 customize the variable @code{org-M-RET-may-split-line}.}.
441 @item M-S-@key{RET}
442 Insert new TODO entry with same level as current heading.
443 @item @key{TAB} @r{in new, empty entry}
444 In a new entry with no text yet, @key{TAB} will cycle through reasonable
445 levels.
446 @item M-@key{left}@r{/}@key{right}
447 Promote/demote current heading by one level.
448 @item M-S-@key{left}@r{/}@key{right}
449 Promote/demote the current subtree by one level.
450 @item M-S-@key{up}@r{/}@key{down}
451 Move subtree up/down (swap with previous/next subtree of same
452 level).
453 @item C-c C-w
454 Refile entry or region to a different location.  @xref{Refiling notes}.
455 @item C-x n s/w
456 Narrow buffer to current subtree / widen it again
457 @end table
459 When there is an active region (Transient Mark mode), promotion and
460 demotion work on all headlines in the region.
462 @node Sparse trees, Plain lists, Structure editing, Document Structure
463 @section Sparse trees
465 An important feature of Org mode is the ability to construct @emph{sparse
466 trees} for selected information in an outline tree, so that the entire
467 document is folded as much as possible, but the selected information is made
468 visible along with the headline structure above it@footnote{See also the
469 variables @code{org-show-hierarchy-above}, @code{org-show-following-heading},
470 @code{org-show-siblings}, and @code{org-show-entry-below} for detailed
471 control on how much context is shown around each match.}.  Just try it out
472 and you will see immediately how it works.
474 Org mode contains several commands creating such trees, all these
475 commands can be accessed through a dispatcher:
477 @table @kbd
478 @item C-c /
479 This prompts for an extra key to select a sparse-tree creating command.
480 @item C-c / r
481 Occur.  Prompts for a regexp and shows a sparse tree with all matches.  Each
482 match is also highlighted; the highlights disappear by pressing @kbd{C-c C-c}.
483 @end table
485 The other sparse tree commands select headings based on TODO keywords,
486 tags, or properties and will be discussed later in this manual.
488 @node Plain lists, Footnotes, Sparse trees, Document Structure
489 @section Plain lists
491 Within an entry of the outline tree, hand-formatted lists can provide
492 additional structure.  They also provide a way to create lists of
493 checkboxes (@pxref{Checkboxes}).  Org supports editing such lists,
494 and the HTML exporter (@pxref{Exporting}) parses and formats them.
496 Org knows ordered lists, unordered lists, and description lists.
497 @itemize @bullet
498 @item
499 @emph{Unordered} list items start with @samp{-}, @samp{+}, or
500 @samp{*} as bullets.
501 @item
502 @emph{Ordered} list items start with @samp{1.} or @samp{1)}.
503 @item
504 @emph{Description} list use @samp{ :: } to separate the @emph{term} from the
505 description.
506 @end itemize
508 Items belonging to the same list must have the same indentation on the first
509 line.  A list ends before the next line that is indented like the
510 bullet/number, or less.  It also ends before two blank lines. An example:
512 @smallexample
513 @group
514 ** Lord of the Rings
515    My favorite scenes are (in this order)
516    1. The attack of the Rohirrim
517    2. Eowyn's fight with the witch king
518       + this was already my favorite scene in the book
519       + I really like Miranda Otto.
520    Important actors in this film are:
521    - @b{Elijah Wood} :: He plays Frodo
522    - @b{Sean Austin} :: He plays Sam, Frodo's friend.
523 @end group
524 @end smallexample
526 The following commands act on items when the cursor is in the first line of
527 an item (the line with the bullet or number).
529 @table @kbd
530 @item @key{TAB}
531 Items can be folded just like headline levels.
532 @item M-@key{RET}
533 Insert new item at current level.  With a prefix argument, force a new
534 heading (@pxref{Structure editing}).
535 @item M-S-@key{RET}
536 Insert a new item with a checkbox (@pxref{Checkboxes}).
537 @item M-S-@key{up}@r{/}@key{down}
538 Move the item including subitems up/down (swap with previous/next item
539 of same indentation).  If the list is ordered, renumbering is
540 automatic.
541 @item M-@key{left}@r{/}M-@key{right}
542 Decrease/increase the indentation of an item, leaving children alone.
543 @item M-S-@key{left}@r{/}@key{right}
544 Decrease/increase the indentation of the item, including subitems.
545 @item C-c C-c
546 If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
547 state of the checkbox.  Also make sure all items have the same bullet type
548 and renumber ordered lists.
549 @item C-c -
550 Cycle the entire list level through the different itemize/enumerate bullets
551 (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}).
552 @end table
554 @node Footnotes,  , Plain lists, Document Structure
555 @section Footnotes
557 A footnote is defined in a paragraph that is started by a footnote marker in
558 square brackets in column 0, no indentation allowed.  The footnote reference
559 is simply the marker in square brackets, inside text.  For example:
561 @smallexample
562 The Org homepage[fn:1] now looks a lot better than it used to.
564 [fn:1] The link is: http://orgmode.org
565 @end smallexample
567 @noindent The following commands handle footnotes:
569 @table @kbd
570 @item C-c C-x f
571 The footnote action command.  When the cursor is on a footnote reference,
572 jump to the definition.  When it is at a definition, jump to the (first)
573 reference.  Otherwise, create a new footnote.  When this command is called
574 with a prefix argument, a menu of additional options including renumbering is
575 offered.
577 @item C-c C-c
578 Jump between definition and reference.
579 @end table
581 @seealso{
582 @uref{http://orgmode.org/manual/Document-Structure.html#Document-Structure,
583 Chapter 2 of the manual}@*
584 @uref{http://sachachua.com/wp/2008/01/outlining-your-notes-with-org/,
585 Sacha Chua's tutorial}}
588 @node Tables, Hyperlinks, Document Structure, Top
589 @chapter Tables
591 Org comes with a fast and intuitive table editor.  Spreadsheet-like
592 calculations are supported in connection with the Emacs @file{calc}
593 package
594 @ifinfo
595 (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
596 @end ifinfo
597 @ifnotinfo
598 (see the Emacs Calculator manual for more information about the Emacs
599 calculator).
600 @end ifnotinfo
602 Org makes it easy to format tables in plain ASCII.  Any line with
603 @samp{|} as the first non-whitespace character is considered part of a
604 table.  @samp{|} is also the column separator.  A table might look like
605 this:
607 @smallexample
608 | Name  | Phone | Age |
609 |-------+-------+-----|
610 | Peter |  1234 |  17 |
611 | Anna  |  4321 |  25 |
612 @end smallexample
614 A table is re-aligned automatically each time you press @key{TAB} or
615 @key{RET} or @kbd{C-c C-c} inside the table.  @key{TAB} also moves to
616 the next field (@key{RET} to the next row) and creates new table rows
617 at the end of the table or before horizontal lines.  The indentation
618 of the table is set by the first line.  Any line starting with
619 @samp{|-} is considered as a horizontal separator line and will be
620 expanded on the next re-align to span the whole table width.  So, to
621 create the above table, you would only type
623 @smallexample
624 |Name|Phone|Age|
626 @end smallexample
628 @noindent and then press @key{TAB} to align the table and start filling in
629 fields.  Even faster would be to type @code{|Name|Phone|Age} followed by
630 @kbd{C-c @key{RET}}.
632 When typing text into a field, Org treats @key{DEL},
633 @key{Backspace}, and all character keys in a special way, so that
634 inserting and deleting avoids shifting other fields.  Also, when
635 typing @emph{immediately after the cursor was moved into a new field
636 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
637 field is automatically made blank.
639 @table @kbd
640 @tsubheading{Creation and conversion}
641 @item C-c |
642 Convert the active region to table. If every line contains at least one
643 TAB character, the function assumes that the material is tab separated.
644 If every line contains a comma, comma-separated values (CSV) are assumed.
645 If not, lines are split at whitespace into fields.
647 If there is no active region, this command creates an empty Org
648 table.  But it's easier just to start typing, like
649 @kbd{|Name|Phone|Age C-c @key{RET}}.
651 @tsubheading{Re-aligning and field motion}
652 @item C-c C-c
653 Re-align the table without moving the cursor.
655 @item @key{TAB}
656 Re-align the table, move to the next field.  Creates a new row if
657 necessary.
659 @item S-@key{TAB}
660 Re-align, move to previous field.
662 @item @key{RET}
663 Re-align the table and move down to next row.  Creates a new row if
664 necessary.
666 @tsubheading{Column and row editing}
667 @item M-@key{left}
668 @itemx M-@key{right}
669 Move the current column left/right.
671 @item M-S-@key{left}
672 Kill the current column.
674 @item M-S-@key{right}
675 Insert a new column to the left of the cursor position.
677 @item M-@key{up}
678 @itemx M-@key{down}
679 Move the current row up/down.
681 @item M-S-@key{up}
682 Kill the current row or horizontal line.
684 @item M-S-@key{down}
685 Insert a new row above the current row.  With a prefix argument, the line is
686 created below the current one.
688 @item C-c -
689 Insert a horizontal line below current row.  With a prefix argument, the line
690 is created above the current line.
692 @item C-c @key{RET}
693 Insert a horizontal line below current row, and move the cursor into the row
694 below that line.
696 @item C-c ^
697 Sort the table lines in the region.  The position of point indicates the
698 column to be used for sorting, and the range of lines is the range
699 between the nearest horizontal separator lines, or the entire table.
701 @end table
703 @seealso{
704 @uref{http://orgmode.org/manual/Tables.html#Tables, Chapter 3 of the
705 manual}@*
706 @uref{http://orgmode.org/worg/org-tutorials/tables.php, Bastien's
707 table tutorial}@*
708 @uref{http://orgmode.org/worg/org-tutorials/org-spreadsheet-intro.php,
709 Bastien's spreadsheet tutorial}@*
710 @uref{http://orgmode.org/worg/org-tutorials/org-plot.php, Eric's plotting tutorial}}
712 @node Hyperlinks, TODO Items, Tables, Top
713 @chapter Hyperlinks
715 Like HTML, Org provides links inside a file, external links to
716 other files, Usenet articles, emails, and much more.
718 @menu
719 * Link format::                 How links in Org are formatted
720 * Internal links::              Links to other places in the current file
721 * External links::              URL-like links to the world
722 * Handling links::              Creating, inserting and following
723 * Targeted links::              Point at a location in a file
724 @end menu
726 @node Link format, Internal links, Hyperlinks, Hyperlinks
727 @section Link format
729 Org will recognize plain URL-like links and activate them as
730 clickable links.  The general link format, however, looks like this:
732 @smallexample
733 [[link][description]]       @r{or alternatively}           [[link]]
734 @end smallexample
736 @noindent
737 Once a link in the buffer is complete (all brackets present), Org will change
738 the display so that @samp{description} is displayed instead of
739 @samp{[[link][description]]} and @samp{link} is displayed instead of
740 @samp{[[link]]}.  To edit the invisible @samp{link} part, use @kbd{C-c
741 C-l} with the cursor on the link.
743 @node Internal links, External links, Link format, Hyperlinks
744 @section Internal links
746 If the link does not look like a URL, it is considered to be internal in the
747 current file.  The most important case is a link like
748 @samp{[[#my-custom-id]]} which will link to the entry with the
749 @code{CUSTOM_ID} property @samp{my-custom-id}.
751 Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]}
752 lead to a text search in the current file for the corresponding target which
753 looks like @samp{<<My Target>>}.
755 @node External links, Handling links, Internal links, Hyperlinks
756 @section External links
758 Org supports links to files, websites, Usenet and email messages,
759 BBDB database entries and links to both IRC conversations and their
760 logs.  External links are URL-like locators.  They start with a short
761 identifying string followed by a colon.  There can be no space after
762 the colon.  Here are some examples:
764 @smallexample
765 http://www.astro.uva.nl/~dominik          @r{on the web}
766 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
767 /home/dominik/images/jupiter.jpg          @r{same as above}
768 file:papers/last.pdf                      @r{file, relative path}
769 file:projects.org                         @r{another Org file}
770 docview:papers/last.pdf::NNN              @r{open file in doc-view mode at page NNN}
771 id:B7423F4D-2E8A-471B-8810-C40F074717E9   @r{Link to heading by ID}
772 news:comp.emacs                           @r{Usenet link}
773 mailto:adent@@galaxy.net                   @r{Mail link}
774 vm:folder                                 @r{VM folder link}
775 vm:folder#id                              @r{VM message link}
776 wl:folder#id                              @r{WANDERLUST message link}
777 mhe:folder#id                             @r{MH-E message link}
778 rmail:folder#id                           @r{RMAIL message link}
779 gnus:group#id                             @r{Gnus article link}
780 bbdb:R.*Stallman                          @r{BBDB link (with regexp)}
781 irc:/irc.com/#emacs/bob                   @r{IRC link}
782 info:org:External%20links                 @r{Info node link (with encoded space)}
783 @end smallexample
785 A link should be enclosed in double brackets and may contain a
786 descriptive text to be displayed instead of the URL (@pxref{Link
787 format}), for example:
789 @smallexample
790 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
791 @end smallexample
793 @noindent
794 If the description is a file name or URL that points to an image, HTML export
795 (@pxref{HTML export}) will inline the image as a clickable button.  If there
796 is no description at all and the link points to an image, that image will be
797 inlined into the exported HTML file.
799 @node Handling links, Targeted links, External links, Hyperlinks
800 @section Handling links
802 Org provides methods to create a link in the correct syntax, to
803 insert it into an Org file, and to follow the link.
805 @table @kbd
806 @item C-c l
807 Store a link to the current location.  This is a @emph{global} command (you
808 must create the key binding yourself) which can be used in any buffer to
809 create a link.  The link will be stored for later insertion into an Org
810 buffer (see below).
812 @item C-c C-l
813 Insert a link.  This prompts for a link to be inserted into the buffer.  You
814 can just type a link, or use history keys @key{up} and @key{down} to access
815 stored links.  You will be prompted for the description part of the link.
816 When called with a @kbd{C-u} prefix argument, file name completion is used to
817 link to a file.
819 @item C-c C-l @r{(with cursor on existing link)}
820 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
821 link and description parts of the link.
823 @item C-c C-o @r{or} mouse-1 @r{or} mouse-2
824 Open link at point.
825 @item C-c &
826 Jump back to a recorded position.  A position is recorded by the
827 commands following internal links, and by @kbd{C-c %}.  Using this
828 command several times in direct succession moves through a ring of
829 previously recorded positions.
831 @end table
833 @node Targeted links,  , Handling links, Hyperlinks
834 @section Targeted links
836 File links can contain additional information to make Emacs jump to a
837 particular location in the file when following a link.  This can be a
838 line number or a search option after a double colon.
840 Here is the syntax of the different ways to attach a search to a file
841 link, together with an explanation:
843 @smallexample
844 [[file:~/code/main.c::255]]                 @r{Find line 255}
845 [[file:~/xx.org::My Target]]                @r{Find @samp{<<My Target>>}}
846 [[file:~/xx.org::#my-custom-id]]            @r{Find entry with custom id}
847 @end smallexample
849 @seealso{
850 @uref{http://orgmode.org/manual/Hyperlinks.html#Hyperlinks, Chapter 4 of the
851 manual}}
853 @node TODO Items, Tags, Hyperlinks, Top
854 @chapter TODO Items
856 Org mode does not maintain TODO lists as separate documents@footnote{Of
857 course, you can make a document that contains only long lists of TODO items,
858 but this is not required.}.  Instead, TODO items are an integral part of the
859 notes file, because TODO items usually come up while taking notes!  With Org
860 mode, simply mark any entry in a tree as being a TODO item.  In this way,
861 information is not duplicated, and the entire context from which the TODO
862 item emerged is always present.
864 Of course, this technique for managing TODO items scatters them
865 throughout your notes file.  Org mode compensates for this by providing
866 methods to give you an overview of all the things that you have to do.
868 @menu
869 * Using TODO states::           Setting and switching states
870 * Multi-state workflows::       More than just on/off
871 * Progress logging::            Dates and notes for progress
872 * Priorities::                  Some things are more important than others
873 * Breaking down tasks::         Splitting a task into manageable pieces
874 * Checkboxes::                  Tick-off lists
875 @end menu
877 @node Using TODO states, Multi-state workflows, TODO Items, TODO Items
878 @section Using TODO states
880 Any headline becomes a TODO item when it starts with the word
881 @samp{TODO}, for example:
883 @smallexample
884 *** TODO Write letter to Sam Fortune
885 @end smallexample
887 @noindent
888 The most important commands to work with TODO entries are:
890 @table @kbd
891 @item C-c C-t
892 Rotate the TODO state of the current item among
894 @smallexample
895 ,-> (unmarked) -> TODO -> DONE --.
896 '--------------------------------'
897 @end smallexample
899 The same rotation can also be done ``remotely'' from the timeline and
900 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
902 @item S-@key{right}@r{/}@key{left}
903 Select the following/preceding TODO state, similar to cycling.
904 @item C-c / t
905 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds the
906 buffer, but shows all TODO items and the headings hierarchy above
907 them.
908 @item C-c a t
909 Show the global TODO list.  Collects the TODO items from all agenda files
910 (@pxref{Agenda Views}) into a single buffer.  @xref{Global TODO list}, for
911 more information.
912 @item S-M-@key{RET}
913 Insert a new TODO entry below the current one.
914 @end table
916 @noindent
917 Changing a TODO state can also trigger tag changes.  See the docstring of the
918 option @code{org-todo-state-tags-triggers} for details.
920 @node Multi-state workflows, Progress logging, Using TODO states, TODO Items
921 @section Multi-state workflows
923 You can use TODO keywords to indicate different @emph{sequential} states
924 in the process of working on an item, for example:
926 @smalllisp
927 (setq org-todo-keywords
928   '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
929 @end smalllisp
931 The vertical bar separates the TODO keywords (states that @emph{need
932 action}) from the DONE states (which need @emph{no further action}).  If
933 you don't provide the separator bar, the last state is used as the DONE
934 state.
935 With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
936 to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED.  
938 Sometimes you may want to use different sets of TODO keywords in
939 parallel.  For example, you may want to have the basic
940 @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
941 separate state indicating that an item has been canceled (so it is not
942 DONE, but also does not require action).  Your setup would then look
943 like this:
945 @smalllisp
946 (setq org-todo-keywords
947       '((sequence "TODO(t)" "|" "DONE(d)")
948         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
949         (sequence "|" "CANCELED(c)")))
950 @end smalllisp
952 The keywords should all be different, this helps Org mode to keep track of
953 which subsequence should be used for a given entry.  The example also shows
954 how to define keys for fast access of a particular state, by adding a letter
955 in parenthesis after each keyword - you will be prompted for the key after
956 @kbd{C-c C-t}.
958 To define TODO keywords that are valid only in a single file, use the
959 following text anywhere in the file.
961 @smallexample
962 #+TODO: TODO(t) | DONE(d)
963 #+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f)
964 #+TODO: | CANCELED(c)
965 @end smallexample
967 After changing one of these lines, use @kbd{C-c C-c} with the cursor still in
968 the line to make the changes known to Org mode.
970 @node Progress logging, Priorities, Multi-state workflows, TODO Items
971 @section Progress logging
973 Org mode can automatically record a timestamp and possibly a note when
974 you mark a TODO item as DONE, or even each time you change the state of
975 a TODO item.  This system is highly configurable, settings can be on a
976 per-keyword basis and can be localized to a file or even a subtree.  For
977 information on how to clock working time for a task, see @ref{Clocking
978 work time}.
980 @menu
981 * Closing items::               When was this entry marked DONE?
982 * Tracking TODO state changes::  When did the status change?
983 @end menu
985 @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
986 @unnumberedsubsec Closing items
988 The most basic logging is to keep track of @emph{when} a certain TODO
989 item was finished.  This is achieved with@footnote{The corresponding
990 in-buffer setting is: @code{#+STARTUP: logdone}}.
992 @smalllisp
993 (setq org-log-done 'time)
994 @end smalllisp
996 @noindent
997 Then each time you turn an entry from a TODO (not-done) state into any of the
998 DONE states, a line @samp{CLOSED: [timestamp]} will be inserted just after
999 the headline.  If you want to record a note along with the timestamp,
1000 use@footnote{The corresponding in-buffer setting is: @code{#+STARTUP:
1001 lognotedone}}
1003 @smalllisp
1004 (setq org-log-done 'note)
1005 @end smalllisp
1007 @noindent
1008 You will then be prompted for a note, and that note will be stored below
1009 the entry with a @samp{Closing Note} heading.
1011 @node Tracking TODO state changes,  , Closing items, Progress logging
1012 @unnumberedsubsec Tracking TODO state changes
1014 You might want to keep track of TODO state changes.  You can either record
1015 just a timestamp, or a time-stamped note for a change.  These records will be
1016 inserted after the headline as an itemized list.  When taking a lot of notes,
1017 you might want to get the notes out of the way into a drawer.  Customize the
1018 variable @code{org-log-into-drawer} to get this behavior.
1020 For state logging, Org mode expects configuration on a per-keyword basis.
1021 This is achieved by adding special markers @samp{!} (for a timestamp) and
1022 @samp{@@} (for a note) in parentheses after each keyword.  For example:
1023 @smallexample
1024 #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
1025 @end smallexample
1026 @noindent
1027 will define TODO keywords and fast access keys, and also request that a time
1028 is recorded when the entry is set to DONE, and that a note is recorded when
1029 switching to WAIT or CANCELED.  The same syntax works also when setting
1030 @code{org-todo-keywords}.
1032 @node Priorities, Breaking down tasks, Progress logging, TODO Items
1033 @section Priorities
1035 If you use Org mode extensively, you may end up with enough TODO items that
1036 it starts to make sense to prioritize them.  Prioritizing can be done by
1037 placing a @emph{priority cookie} into the headline of a TODO item, like this
1039 @smallexample
1040 *** TODO [#A] Write letter to Sam Fortune
1041 @end smallexample
1043 @noindent
1044 Org mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}.
1045 @samp{A} is the highest, @samp{B} the default if none is given.  Priorities
1046 make a difference only in the agenda.
1048 @table @kbd
1049 @item @kbd{C-c ,}
1050 Set the priority of the current headline.  Press @samp{A}, @samp{B} or
1051 @samp{C} to select a priority, or @key{SPC} to remove the cookie.
1053 @item S-@key{up}
1054 @itemx S-@key{down}
1055 Increase/decrease priority of current headline
1056 @end table
1058 @node Breaking down tasks, Checkboxes, Priorities, TODO Items
1059 @section Breaking tasks down into subtasks
1061 It is often advisable to break down large tasks into smaller, manageable
1062 subtasks.  You can do this by creating an outline tree below a TODO item,
1063 with detailed subtasks on the tree.  To keep the overview over the fraction
1064 of subtasks that are already completed, insert either @samp{[/]} or
1065 @samp{[%]} anywhere in the headline.  These cookies will be updated each time
1066 the TODO status of a child changes, or when pressing @kbd{C-c C-c} on the
1067 cookie.  For example:
1069 @smallexample
1070 * Organize Party [33%]
1071 ** TODO Call people [1/2]
1072 *** TODO Peter
1073 *** DONE Sarah
1074 ** TODO Buy food
1075 ** DONE Talk to neighbor
1076 @end smallexample
1078 @node Checkboxes,  , Breaking down tasks, TODO Items
1079 @section Checkboxes
1081 Every item in a plain list (@pxref{Plain lists}) can be made into a checkbox
1082 by starting it with the string @samp{[ ]}.  Checkboxes are not included into
1083 the global TODO list, so they are often great to split a task into a number
1084 of simple steps.
1085 Here is an example of a checkbox list.
1087 @smallexample
1088 * TODO Organize party [1/3]
1089   - [-] call people [1/2]
1090     - [ ] Peter
1091     - [X] Sarah
1092   - [X] order food
1093   - [ ] think about what music to play
1094 @end smallexample
1096 Checkboxes work hierarchically, so if a checkbox item has children that
1097 are checkboxes, toggling one of the children checkboxes will make the
1098 parent checkbox reflect if none, some, or all of the children are
1099 checked.
1101 @noindent The following commands work with checkboxes:
1103 @table @kbd
1104 @item C-c C-c
1105 Toggle checkbox status or (with prefix arg) checkbox presence at point.
1106 @item M-S-@key{RET}
1107 Insert a new item with a checkbox.
1108 This works only if the cursor is already in a plain list item
1109 (@pxref{Plain lists}).
1110 @end table
1112 @seealso{
1113 @uref{http://orgmode.org/manual/TODO-Items.html#TODO-Items, Chapter 5 of the manual}@*
1114 @uref{http://orgmode.org/worg/org-tutorials/orgtutorial_dto.php, David
1115 O'Toole's introductory tutorial}@*
1116 @uref{http://members.optusnet.com.au/~charles57/GTD/gtd_workflow.html,
1117 Charles Cave's GTD setup}}
1119 @node Tags, Properties, TODO Items, Top
1120 @chapter Tags
1122 An excellent way to implement labels and contexts for cross-correlating
1123 information is to assign @i{tags} to headlines.  Org mode has extensive
1124 support for tags.
1126 Every headline can contain a list of tags; they occur at the end of the
1127 headline.  Tags are normal words containing letters, numbers, @samp{_}, and
1128 @samp{@@}.  Tags must be preceded and followed by a single colon, e.g.,
1129 @samp{:work:}.  Several tags can be specified, as in @samp{:work:urgent:}.
1130 Tags will by default be in bold face with the same color as the headline.
1132 @menu
1133 * Tag inheritance::             Tags use the tree structure of the outline
1134 * Setting tags::                How to assign tags to a headline
1135 * Tag searches::                Searching for combinations of tags
1136 @end menu
1138 @node Tag inheritance, Setting tags, Tags, Tags
1139 @section Tag inheritance
1141 @i{Tags} make use of the hierarchical structure of outline trees.  If a
1142 heading has a certain tag, all subheadings will inherit the tag as
1143 well.  For example, in the list
1145 @smallexample
1146 * Meeting with the French group      :work:
1147 ** Summary by Frank                  :boss:notes:
1148 *** TODO Prepare slides for him      :action:
1149 @end smallexample
1151 @noindent
1152 the final heading will have the tags @samp{:work:}, @samp{:boss:},
1153 @samp{:notes:}, and @samp{:action:} even though the final heading is not
1154 explicitly marked with those tags.  You can also set tags that all entries in
1155 a file should inherit just as if these tags were defined in a hypothetical
1156 level zero that surrounds the entire file.  Use a line like this@footnote{As
1157 with all these in-buffer settings, pressing @kbd{C-c C-c} activates any
1158 changes in the line.}:
1160 @smallexample
1161 #+FILETAGS: :Peter:Boss:Secret:
1162 @end smallexample
1164 @node Setting tags, Tag searches, Tag inheritance, Tags
1165 @section Setting tags
1167 Tags can simply be typed into the buffer at the end of a headline.
1168 After a colon, @kbd{M-@key{TAB}} offers completion on tags.  There is
1169 also a special command for inserting tags:
1171 @table @kbd
1172 @item C-c C-q
1173 Enter new tags for the current headline.  Org mode will either offer
1174 completion or a special single-key interface for setting tags, see
1175 below.  After pressing @key{RET}, the tags will be inserted and aligned
1176 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
1177 tags in the current buffer will be aligned to that column, just to make
1178 things look nice.
1179 @item C-c C-c
1180 When the cursor is in a headline, this does the same as @kbd{C-c C-q}.
1181 @end table
1183 Org will support tag insertion based on a @emph{list of tags}.  By
1184 default this list is constructed dynamically, containing all tags
1185 currently used in the buffer.  You may also globally specify a hard list
1186 of tags with the variable @code{org-tag-alist}.  Finally you can set
1187 the default tags for a given file with lines like
1189 @smallexample
1190 #+TAGS: @@work @@home @@tennisclub
1191 #+TAGS: laptop car pc sailboat
1192 @end smallexample
1194 By default Org mode uses the standard minibuffer completion facilities for
1195 entering tags.  However, it also implements another, quicker, tag selection
1196 method called @emph{fast tag selection}.  This allows you to select and
1197 deselect tags with just a single key press.  For this to work well you should
1198 assign unique letters to most of your commonly used tags.  You can do this
1199 globally by configuring the variable @code{org-tag-alist} in your
1200 @file{.emacs} file.  For example, you may find the need to tag many items in
1201 different files with @samp{:@@home:}.  In this case you can set something
1202 like:
1204 @smalllisp
1205 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
1206 @end smalllisp
1208 @noindent If the tag is only relevant to the file you are working on, then you
1209 can instead set the TAGS option line as:
1211 @smallexample
1212 #+TAGS: @@work(w)  @@home(h)  @@tennisclub(t)  laptop(l)  pc(p)
1213 @end smallexample
1215 @node Tag searches,  , Setting tags, Tags
1216 @section Tag searches
1218 Once a system of tags has been set up, it can be used to collect related
1219 information into special lists.
1221 @table @kbd
1222 @item C-c \
1223 @itemx C-c / m
1224 Create a sparse tree with all headlines matching a tags search.  With a
1225 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
1226 @item C-c a m
1227 Create a global list of tag matches from all agenda files.
1228 @xref{Matching tags and properties}.
1229 @item C-c a M
1230 Create a global list of tag matches from all agenda files, but check
1231 only TODO items and force checking subitems (see variable
1232 @code{org-tags-match-list-sublevels}).
1233 @end table
1235 These commands all prompt for a match string which allows basic Boolean logic
1236 like @samp{+boss+urgent-project1}, to find entries with tags @samp{boss} and
1237 @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find entries
1238 which are tagged, like @samp{Kathy} or @samp{Sally}.  The full syntax of the
1239 search string is rich and allows also matching against TODO keywords, entry
1240 levels and properties.  For a complete description with many examples, see
1241 @ref{Matching tags and properties}.
1243 @seealso{
1244 @uref{http://orgmode.org/manual/Tags.html#Tags, Chapter 6 of the manual}@*
1245 @uref{http://sachachua.com/wp/2008/01/tagging-in-org-plus-bonus-code-for-timeclocks-and-tags/,
1246 Sacha Chua's article about tagging in Org-mode}}
1248 @node Properties, Dates and Times, Tags, Top
1249 @chapter Properties
1251 Properties are key-value pairs associates with and entry.  They live in a
1252 special drawer with the name @code{PROPERTIES}.  Each
1253 property is specified on a single line, with the key (surrounded by colons)
1254 first, and the value after it:
1256 @smallexample
1257 * CD collection
1258 ** Classic
1259 *** Goldberg Variations
1260     :PROPERTIES:
1261     :Title:     Goldberg Variations
1262     :Composer:  J.S. Bach
1263     :Publisher: Deutsche Grammophon
1264     :NDisks:    1
1265     :END:
1266 @end smallexample
1268 You may define the allowed values for a particular property @samp{:Xyz:}
1269 by setting a property @samp{:Xyz_ALL:}.  This special property is
1270 @emph{inherited}, so if you set it in a level 1 entry, it will apply to
1271 the entire tree.  When allowed values are defined, setting the
1272 corresponding property becomes easier and is less prone to typing
1273 errors.  For the example with the CD collection, we can predefine
1274 publishers and the number of disks in a box like this:
1276 @smallexample
1277 * CD collection
1278   :PROPERTIES:
1279   :NDisks_ALL:  1 2 3 4
1280   :Publisher_ALL: "Deutsche Grammophon" Philips EMI
1281   :END:
1282 @end smallexample
1283 or globally using @code{org-global-properties}, or file-wide like this:
1284 @smallexample
1285 #+PROPERTY: NDisks_ALL 1 2 3 4
1286 @end smallexample
1288 @table @kbd
1289 @item C-c C-x p
1290 Set a property.  This prompts for a property name and a value.
1291 @item C-c C-c d
1292 Remove a property from the current entry.
1293 @end table
1295 To create sparse trees and special lists with selection based on properties,
1296 the same commands are used as for tag searches (@pxref{Tag searches}).  The
1297 syntax for the search string is described in @ref{Matching tags and
1298 properties}.
1300 @table @kbd
1301 @end table
1303 @seealso{
1304 @uref{http://orgmode.org/manual/Properties-and-Columns.html#Properties-and-Columns,
1305 Chapter 7 of the manual}@*
1306 @uref{http://orgmode.org/worg/org-tutorials/org-column-view-tutorial.php,Bastien
1307 Guerry's column view tutorial}}
1309 @node Dates and Times, Capture - Refile - Archive, Properties, Top
1310 @chapter Dates and Times
1312 To assist project planning, TODO items can be labeled with a date and/or
1313 a time.  The specially formatted string carrying the date and time
1314 information is called a @emph{timestamp} in Org mode.
1316 @menu
1317 * Timestamps::                  Assigning a time to a tree entry
1318 * Creating timestamps::         Commands which insert timestamps
1319 * Deadlines and scheduling::    Planning your work
1320 * Clocking work time::          Tracking how long you spend on a task
1321 @end menu
1324 @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
1325 @section Timestamps
1327 A timestamp is a specification of a date (possibly with a time or a range of
1328 times) in a special format, either @samp{<2003-09-16 Tue>} or
1329 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue 12:00-12:30>}.  A
1330 timestamp can appear anywhere in the headline or body of an Org tree entry.
1331 Its presence causes entries to be shown on specific dates in the agenda
1332 (@pxref{Weekly/daily agenda}).  We distinguish:
1334 @noindent @b{Plain timestamp; Event; Appointment}@*
1335 A simple timestamp just assigns a date/time to an item.  This is just
1336 like writing down an appointment or event in a paper agenda.
1338 @smallexample
1339 * Meet Peter at the movies <2006-11-01 Wed 19:15>
1340 * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
1341 @end smallexample
1343 @noindent @b{Timestamp with repeater interval}@*
1344 A timestamp may contain a @emph{repeater interval}, indicating that it
1345 applies not only on the given date, but again and again after a certain
1346 interval of N days (d), weeks (w), months (m), or years (y).  The
1347 following will show up in the agenda every Wednesday:
1348 @smallexample
1349 * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
1350 @end smallexample
1352 @noindent @b{Diary-style sexp entries}@*
1353 For more complex date specifications, Org mode supports using the
1354 special sexp diary entries implemented in the Emacs calendar/diary
1355 package.  For example
1356 @smallexample
1357 * The nerd meeting on every 2nd Thursday of the month
1358   <%%(diary-float t 4 2)>
1359 @end smallexample
1361 @noindent @b{Time/Date range}@*
1362 Two timestamps connected by @samp{--} denote a range.
1363 @smallexample
1364 ** Meeting in Amsterdam
1365    <2004-08-23 Mon>--<2004-08-26 Thu>
1366 @end smallexample
1368 @noindent @b{Inactive timestamp}@*
1369 Just like a plain timestamp, but with square brackets instead of
1370 angular ones.  These timestamps are inactive in the sense that they do
1371 @emph{not} trigger an entry to show up in the agenda.
1373 @smallexample
1374 * Gillian comes late for the fifth time [2006-11-01 Wed]
1375 @end smallexample
1378 @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
1379 @section Creating timestamps
1381 For Org mode to recognize timestamps, they need to be in the specific
1382 format.  All commands listed below produce timestamps in the correct
1383 format.
1385 @table @kbd
1386 @item C-c .
1387 Prompt for a date and insert a corresponding timestamp.  When the cursor is
1388 at an existing timestamp in the buffer, the command is used to modify this
1389 timestamp instead of inserting a new one.  When this command is used twice in
1390 succession, a time range is inserted.  With a prefix, also add the current
1391 time. 
1393 @item C-c !
1394 Like @kbd{C-c .}, but insert an inactive timestamp that will not cause
1395 an agenda entry.
1397 @item S-@key{left}@r{/}@key{right}
1398 Change date at cursor by one day.
1400 @item S-@key{up}@r{/}@key{down}
1401 Change the item under the cursor in a timestamp.  The cursor can be on a
1402 year, month, day, hour or minute.  When the timestamp contains a time range
1403 like @samp{15:30-16:30}, modifying the first time will also shift the second,
1404 shifting the time block with constant length.  To change the length, modify
1405 the second time.
1406 @end table
1408 When Org mode prompts for a date/time, it will accept any string containing
1409 some date and/or time information, and intelligently interpret the string,
1410 deriving defaults for unspecified information from the current date and time.
1411 You can also select a date in the pop-up calendar.  See the manual for more
1412 information on how exactly the date/time prompt works.
1414 @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
1415 @section Deadlines and scheduling
1417 A timestamp may be preceded by special keywords to facilitate planning:
1419 @noindent @b{DEADLINE}@*
1420 Meaning: the task (most likely a TODO item, though not necessarily) is supposed
1421 to be finished on that date.
1422 @table @kbd
1423 @item C-c C-d
1424 Insert @samp{DEADLINE} keyword along with a stamp, in the line following the
1425 headline.
1426 @end table
1428 On the deadline date, the task will be listed in the agenda.  In
1429 addition, the agenda for @emph{today} will carry a warning about the
1430 approaching or missed deadline, starting
1431 @code{org-deadline-warning-days} before the due date, and continuing
1432 until the entry is marked DONE.  An example:
1434 @smallexample
1435 *** TODO write article about the Earth for the Guide
1436     The editor in charge is [[bbdb:Ford Prefect]]
1437     DEADLINE: <2004-02-29 Sun>
1438 @end smallexample
1441 @noindent @b{SCHEDULED}@*
1442 Meaning: you are @i{planning to start working} on that task on the given
1443 date@footnote{This is quite different from what is normally understood by
1444 @i{scheduling a meeting}, which is done in Org-mode by just inserting a time
1445 stamp without keyword.}.
1447 @table @kbd
1448 @item C-c C-s
1449 Insert @samp{SCHEDULED} keyword along with a stamp, in the line following the
1450 headline.
1451 @end table
1453 The headline will be listed under the given date@footnote{It will still
1454 be listed on that date after it has been marked DONE.  If you don't like
1455 this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
1456 addition, a reminder that the scheduled date has passed will be present
1457 in the compilation for @emph{today}, until the entry is marked DONE.
1458 I.e. the task will automatically be forwarded until completed.
1460 @smallexample
1461 *** TODO Call Trillian for a date on New Years Eve.
1462     SCHEDULED: <2004-12-25 Sat>
1463 @end smallexample
1465 Some tasks need to be repeated again and again.  Org mode helps to
1466 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
1467 or plain timestamp.  In the following example
1468 @smallexample
1469 ** TODO Pay the rent
1470    DEADLINE: <2005-10-01 Sat +1m>
1471 @end smallexample
1472 @noindent
1473 the @code{+1m} is a repeater; the intended interpretation is that the task
1474 has a deadline on <2005-10-01> and repeats itself every (one) month starting
1475 from that time.
1477 @node Clocking work time,  , Deadlines and scheduling, Dates and Times
1478 @section Clocking work time
1480 Org mode allows you to clock the time you spend on specific tasks in a
1481 project.
1483 @table @kbd
1484 @item C-c C-x C-i
1485 Start the clock on the current item (clock-in).  This inserts the CLOCK
1486 keyword together with a timestamp.  When called with a @kbd{C-u} prefix
1487 argument, select the task from a list of recently clocked tasks.
1489 @item C-c C-x C-o
1490 Stop the clock (clock-out).  This inserts another timestamp at the same
1491 location where the clock was last started.  It also directly computes
1492 the resulting time in inserts it after the time range as @samp{=>
1493 HH:MM}.
1494 @item C-c C-x C-e
1495 Update the effort estimate for the current clock task.
1496 @item C-c C-x C-x
1497 Cancel the current clock.  This is useful if a clock was started by
1498 mistake, or if you ended up working on something else.
1499 @item C-c C-x C-j
1500 Jump to the entry that contains the currently running clock.  With a
1501 @kbd{C-u} prefix arg, select the target task from a list of recently clocked
1502 tasks.
1503 @item C-c C-x C-r
1504 Insert a dynamic block containing a clock
1505 report as an Org-mode table into the current file.  When the cursor is
1506 at an existing clock table, just update it.
1507 @smallexample
1508 #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
1509 #+END: clocktable
1510 @end smallexample
1511 @noindent
1512 For details about how to customize this view, see @uref{http://orgmode.org/manual/Clocking-work-time.html#Clocking-work-time,the manual}.
1513 @item C-c C-c
1514 Update dynamic block at point.  The cursor needs to be in the
1515 @code{#+BEGIN} line of the dynamic block.
1516 @end table
1518 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
1519 the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
1520 worked on or closed during a day.
1522 @seealso{
1523 @uref{http://orgmode.org/manual/Dates-and-Times.html#Dates-and-Times,
1524 Chapter 8 of the manual}@*
1525 @uref{http://members.optusnet.com.au/~charles57/GTD/org_dates/, Charles
1526 Cave's Date and Time tutorial}@*
1527 @uref{http://doc.norang.ca/org-mode.html#Clocking, Bernt Hansen's clocking workflow}}
1529 @node Capture - Refile - Archive, Agenda Views, Dates and Times, Top
1530 @chapter Capture - Refile - Archive
1532 An important part of any organization system is the ability to quickly
1533 capture new ideas and tasks, and to associate reference material with them.
1534 Org defines a capture process to create tasks.  It stores files related to a
1535 task (@i{attachments}) in a special directory.  Once in the system, tasks and
1536 projects need to be moved around.  Moving completed project trees to an
1537 archive file keeps the system compact and fast.
1539 @menu
1540 * Capture::                     
1541 * Refiling notes::              Moving a tree from one place to another
1542 * Archiving::                   What to do with finished projects
1543 @end menu
1545 @node Capture, Refiling notes, Capture - Refile - Archive, Capture - Refile - Archive
1546 @section Capture
1548 Org's method for capturing new items is heavily inspired by John Wiegley
1549 excellent remember package.  It lets you store quick notes with little
1550 interruption of your work flow.  Org lets you define templates for new
1551 entries and associate them with different targets for storing notes.
1553 @menu
1554 * Setting up a capture location::  Where notes will be stored
1555 * Using capture::               Commands to invoke and terminate capture
1556 * Capture templates::           Define the outline of different note types
1557 @end menu
1559 @node Setting up a capture location, Using capture, Capture, Capture
1560 @unnumberedsubsec Setting up a capture location
1562 The following customization sets a default target@footnote{Using capture
1563 templates, you can define more fine-grained capture locations, see
1564 @ref{Capture templates}.} file for notes, and defines a global
1565 key@footnote{Please select your own key, @kbd{C-c c} is only a suggestion.}
1566 for capturing new stuff.
1568 @example
1569 (setq org-default-notes-file (concat org-directory "/notes.org"))
1570 (define-key global-map "\C-cc" 'org-capture)
1571 @end example
1573 @node Using capture, Capture templates, Setting up a capture location, Capture
1574 @unnumberedsubsec Using capture
1576 @table @kbd
1577 @item C-c c
1578 Start a capture process.  You will be placed into a narrowed indirect buffer
1579 to edit the item.
1580 @item C-c C-c
1581 Once you are done entering information into the capture buffer, 
1582 @kbd{C-c C-c} will return you to the window configuration before the capture
1583 process, so that you can resume your work without further distraction.
1584 @item C-c C-w
1585 Finalize by moving the entry to a refile location (@pxref{Refiling notes}).
1586 @item C-c C-k
1587 Abort the capture process and return to the previous state.
1588 @end table
1590 @node Capture templates,  , Using capture, Capture
1591 @unnumberedsubsec Capture templates
1593 You can use templates to generate different types of capture notes, and to
1594 store them in different places.  For example, if you would like
1595 to store new tasks under a heading @samp{Tasks} in file @file{TODO.org}, and
1596 journal entries in a date tree in @file{journal.org} you could
1597 use:
1599 @smallexample
1600 (setq org-capture-templates
1601  '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
1602         "* TODO %?\n  %i\n  %a")
1603    ("j" "Journal" entry (file+datetree "~/org/journal.org")
1604         "* %?\nEntered on %U\n  %i\n  %a")))
1605 @end smallexample
1607 @noindent In these entries, the first string is the key to reach the
1608 template, the second is a short description.  Then follows the type of the
1609 entry and a definition of the target location for storing the note.  Finally,
1610 the template itself, a string with %-escapes to fill in information based on
1611 time and context.
1613 When you call @kbd{M-x org-capture}, Org will prompt for a key to select the
1614 template (if you have more than one template) and then prepare the buffer like
1615 @smallexample
1616 * TODO
1617   [[file:@var{link to where you were when initiating capture}]]
1618 @end smallexample
1620 @noindent
1621 During expansion of the template, special @kbd{%}-escapes@footnote{If you
1622 need one of these sequences literally, escape the @kbd{%} with a backslash.}
1623 allow dynamic insertion of content.  Here is a small selection of the
1624 possibilities, consult the manual for more.
1625 @smallexample
1626 %a          @r{annotation, normally the link created with @code{org-store-link}}
1627 %i          @r{initial content, the region when remember is called with C-u.}
1628 %t          @r{timestamp, date only}
1629 %T          @r{timestamp with date and time}
1630 %u, %U      @r{like the above, but inactive timestamps}
1631 @end smallexample
1633 @node Refiling notes, Archiving, Capture, Capture - Refile - Archive
1634 @section Refiling notes
1636 When reviewing the captured data, you may want to refile some of the entries
1637 into a different list, for example into a project.  Cutting, finding the
1638 right location, and then pasting the note is cumbersome.  To simplify this
1639 process, you can use the following special command:
1641 @table @kbd
1642 @item C-c C-w
1643 Refile the entry or region at point.  This command offers possible locations
1644 for refiling the entry and lets you select one with completion.  The item (or
1645 all items in the region) is filed below the target heading as a subitem.@*
1646 By default, all level 1 headlines in the current buffer are considered to be
1647 targets, but you can have more complex definitions across a number of files.
1648 See the variable @code{org-refile-targets} for details.
1649 @item C-u C-c C-w
1650 Use the refile interface to jump to a heading.
1651 @item C-u C-u C-c C-w
1652 Jump to the location where @code{org-refile} last moved a tree to.
1653 @end table
1655 @node Archiving,  , Refiling notes, Capture - Refile - Archive
1656 @section Archiving
1658 When a project represented by a (sub)tree is finished, you may want
1659 to move the tree out of the way and to stop it from contributing to the
1660 agenda.  Archiving is important to keep your working files compact and global
1661 searches like the construction of agenda views fast.
1662 The most common archiving action is to move a project tree to another file,
1663 the archive file.
1665 @table @kbd
1666 @item C-c C-x C-a
1667 Archive the current entry using the command specified in the variable
1668 @code{org-archive-default-command}.
1669 @item C-c C-x C-s@ @r{or short} @ C-c $
1670 Archive the subtree starting at the cursor position to the location
1671 given by @code{org-archive-location}.
1672 @end table
1674 The default archive location is a file in the same directory as the
1675 current file, with the name derived by appending @file{_archive} to the
1676 current file name.  For information and examples on how to change this,
1677 see the documentation string of the variable
1678 @code{org-archive-location}.  There is also an in-buffer option for
1679 setting this variable, for example
1681 @smallexample
1682 #+ARCHIVE: %s_done::
1683 @end smallexample
1685 @seealso{
1686 @uref{http://orgmode.org/manual/Capture-_002d-Refile-_002d-Archive.html#Capture-_002d-Refile-_002d-Archive,
1687 Chapter 9 of the manual}@*
1688 @uref{http://members.optusnet.com.au/~charles57/GTD/remember.html, Charles
1689 Cave's remember tutorial}@*
1690 @uref{http://orgmode.org/worg/org-tutorials/org-protocol-custom-handler.php,
1691 Sebastian Rose's tutorial for capturing from a web browser}}@uref{}@*
1693 @node Agenda Views, Markup, Capture - Refile - Archive, Top
1694 @chapter Agenda Views
1696 Due to the way Org works, TODO items, time-stamped items, and tagged
1697 headlines can be scattered throughout a file or even a number of files.  To
1698 get an overview of open action items, or of events that are important for a
1699 particular date, this information must be collected, sorted and displayed in
1700 an organized way.  There are several different views, see below.
1702 The extracted information is displayed in a special @emph{agenda buffer}.
1703 This buffer is read-only, but provides commands to visit the corresponding
1704 locations in the original Org files, and even to edit these files remotely.
1705 Remote editing from the agenda buffer means, for example, that you can
1706 change the dates of deadlines and appointments from the agenda buffer.
1707 The commands available in the Agenda buffer are listed in @ref{Agenda
1708 commands}.
1710 @menu
1711 * Agenda files::                Files being searched for agenda information
1712 * Agenda dispatcher::           Keyboard access to agenda views
1713 * Built-in agenda views::       What is available out of the box?
1714 * Agenda commands::             Remote editing of Org trees
1715 * Custom agenda views::         Defining special searches and views
1716 @end menu
1718 @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
1719 @section Agenda files
1721 The information to be shown is normally collected from all @emph{agenda
1722 files}, the files listed in the variable
1723 @code{org-agenda-files}.
1725 @table @kbd
1726 @item C-c [
1727 Add current file to the list of agenda files.  The file is added to
1728 the front of the list.  If it was already in the list, it is moved to
1729 the front.  With a prefix argument, file is added/moved to the end.
1730 @item C-c ]
1731 Remove current file from the list of agenda files.
1732 @item C-,
1733 Cycle through agenda file list, visiting one file after the other.
1734 @end table
1736 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
1737 @section The agenda dispatcher
1738 The views are created through a dispatcher, which should be bound to a
1739 global key---for example @kbd{C-c a} (@pxref{Installation}).  After
1740 pressing @kbd{C-c a}, an additional letter is required to execute a
1741 command:
1742 @table @kbd
1743 @item a
1744 The calendar-like agenda (@pxref{Weekly/daily agenda}).
1745 @item t @r{/} T
1746 A list of all TODO items (@pxref{Global TODO list}).
1747 @item m @r{/} M
1748 A list of headlines matching a TAGS expression (@pxref{Matching
1749 tags and properties}).
1750 @item L
1751 The timeline view for the current buffer (@pxref{Timeline}).
1752 @item s
1753 A list of entries selected by a boolean expression of keywords
1754 and/or regular expressions that must or must not occur in the entry.
1755 @end table
1757 @node Built-in agenda views, Agenda commands, Agenda dispatcher, Agenda Views
1758 @section The built-in agenda views
1760 @menu
1761 * Weekly/daily agenda::         The calendar page with current tasks
1762 * Global TODO list::            All unfinished action items
1763 * Matching tags and properties::  Structured information with fine-tuned search
1764 * Timeline::                    Time-sorted view for single file
1765 * Search view::                 Find entries by searching for text
1766 @end menu
1768 @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
1769 @subsection The weekly/daily agenda
1771 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
1772 paper agenda, showing all the tasks for the current week or day.
1774 @table @kbd
1775 @item C-c a a
1776 Compile an agenda for the current week from a list of Org files.  The agenda
1777 shows the entries for each day.
1778 @end table
1780 Emacs contains the calendar and diary by Edward M. Reingold.  Org-mode
1781 understands the syntax of the diary and allows you to use diary sexp entries
1782 directly in Org files:
1784 @smallexample
1785 * Birthdays and similar stuff
1786 #+CATEGORY: Holiday
1787 %%(org-calendar-holiday)   ; special function for holiday names
1788 #+CATEGORY: Ann
1789 %%(diary-anniversary  5 14 1956)@footnote{Note that the order of the arguments (month, day, year) depends on the setting of @code{calendar-date-style}.} Arthur Dent is %d years old
1790 %%(diary-anniversary 10  2 1869) Mahatma Gandhi would be %d years old
1791 @end smallexample
1793 Org can interact with Emacs appointments notification facility.  To add all
1794 the appointments of your agenda files, use the command
1795 @code{org-agenda-to-appt}.  See the docstring for details.
1797 @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
1798 @subsection The global TODO list
1800 The global TODO list contains all unfinished TODO items formatted and
1801 collected into a single place.  Remote editing of TODO items lets you
1802 can change the state of a TODO entry with a single key press.  The commands
1803 available in the TODO list are described in @ref{Agenda commands}.
1805 @table @kbd
1806 @item C-c a t
1807 Show the global TODO list.  This collects the TODO items from all
1808 agenda files (@pxref{Agenda Views}) into a single buffer.
1809 @item C-c a T
1810 Like the above, but allows selection of a specific TODO keyword. 
1811 @end table
1813 @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
1814 @subsection Matching tags and properties
1816 If headlines in the agenda files are marked with @emph{tags} (@pxref{Tags}),
1817 or have properties (@pxref{Properties}), you can select headlines
1818 based on this metadata and collect them into an agenda buffer.  The match
1819 syntax described here also applies when creating sparse trees with @kbd{C-c /
1820 m}.  The commands available in the tags list are described in @ref{Agenda
1821 commands}.
1823 @table @kbd
1824 @item C-c a m
1825 Produce a list of all headlines that match a given set of tags.  The
1826 command prompts for a selection criterion, which is a boolean logic
1827 expression with tags, like @samp{+work+urgent-withboss} or
1828 @samp{work|home} (@pxref{Tags}).  If you often need a specific search,
1829 define a custom command for it (@pxref{Agenda dispatcher}).
1830 @item C-c a M
1831 Like @kbd{C-c a m}, but only select headlines that are also TODO items.
1832 @end table
1834 @subsubheading Match syntax
1836 A search string can use Boolean operators @samp{&} for AND and @samp{|} for
1837 OR.  @samp{&} binds more strongly than @samp{|}.  Parentheses are currently
1838 not implemented.  Each element in the search is either a tag, a regular
1839 expression matching tags, or an expression like @code{PROPERTY OPERATOR
1840 VALUE} with a comparison operator, accessing a property value.  Each element
1841 may be preceded by @samp{-}, to select against it, and @samp{+} is syntactic
1842 sugar for positive selection.  The AND operator @samp{&} is optional when
1843 @samp{+} or @samp{-} is present.  Here are some examples, using only tags.
1845 @table @samp
1846 @item +work-boss
1847 Select headlines tagged @samp{:work:}, but discard those also tagged
1848 @samp{:boss:}.
1849 @item work|laptop
1850 Selects lines tagged @samp{:work:} or @samp{:laptop:}.
1851 @item work|laptop+night
1852 Like before, but require the @samp{:laptop:} lines to be tagged also
1853 @samp{:night:}.
1854 @end table
1856 You may also test for properties at the same
1857 time as matching tags, see the manual for more information.
1859 @node Timeline, Search view, Matching tags and properties, Built-in agenda views
1860 @subsection Timeline for a single file
1862 The timeline summarizes all time-stamped items from a single Org mode
1863 file in a @emph{time-sorted view}.  The main purpose of this command is
1864 to give an overview over events in a project.
1866 @table @kbd
1867 @item C-c a L
1868 Show a time-sorted view of the Org file, with all time-stamped items.
1869 When called with a @kbd{C-u} prefix, all unfinished TODO entries
1870 (scheduled or not) are also listed under the current date.
1871 @end table
1873 @node Search view,  , Timeline, Built-in agenda views
1874 @subsection Search view
1876 This agenda view is a general text search facility for Org mode entries.
1877 It is particularly useful to find notes.
1879 @table @kbd
1880 @item C-c a s
1881 This is a special search that lets you select entries by matching a substring
1882 or specific words using a boolean logic.
1883 @end table
1884 For example, the search string @samp{computer equipment} will find entries
1885 that contain @samp{computer equipment} as a substring. 
1886 Search view can also search for specific keywords in the entry, using Boolean
1887 logic.  The search string @samp{+computer +wifi -ethernet -@{8\.11[bg]@}}
1888 will search for note entries that contain the keywords @code{computer}
1889 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
1890 not matched by the regular expression @code{8\.11[bg]}, meaning to
1891 exclude both 8.11b and 8.11g. 
1893 Note that in addition to the agenda files, this command will also search
1894 the files listed in @code{org-agenda-text-search-extra-files}.
1896 @node Agenda commands, Custom agenda views, Built-in agenda views, Agenda Views
1897 @section Commands in the agenda buffer
1899 Entries in the agenda buffer are linked back to the Org file or diary
1900 file where they originate.  Commands are provided to show and jump to the
1901 original entry location, and to edit the Org files ``remotely'' from
1902 the agenda buffer.  This is just a selection of the many commands, explore
1903 the @code{Agenda} menu and the manual for a complete list.
1905 @table @kbd
1906 @tsubheading{Motion}
1907 @item n
1908 Next line (same as @key{up} and @kbd{C-p}).
1909 @item p
1910 Previous line (same as @key{down} and @kbd{C-n}).
1911 @tsubheading{View/Go to Org file}
1912 @item mouse-3
1913 @itemx @key{SPC}
1914 Display the original location of the item in another window.
1915 With prefix arg, make sure that the entire entry is made visible in the
1916 outline, not only the heading.
1918 @itemx @key{TAB}
1919 Go to the original location of the item in another window.  Under Emacs
1920 22, @kbd{mouse-1} will also works for this.
1922 @itemx @key{RET}
1923 Go to the original location of the item and delete other windows.
1926 @tsubheading{Change display}
1927 @item o
1928 Delete other windows.
1930 @item d @r{/} w
1931 Switch to day/week view. 
1933 @item f @r{and} b
1934 Go forward/backward in time to display the following @code{org-agenda-ndays}
1935 days.  For example, if the display covers a week, switch to the
1936 following/previous week.
1938 @item .
1939 Go to today.
1941 @item j
1942 Prompt for a date and go there.
1944 @item v l @ @r{or short} @ l
1945 Toggle Logbook mode.  In Logbook mode, entries that were marked DONE while
1946 logging was on (variable @code{org-log-done}) are shown in the agenda, as are
1947 entries that have been clocked on that day.  When called with a @kbd{C-u}
1948 prefix, show all possible logbook entries, including state changes.
1950 @item r @r{or} g
1951 Recreate the agenda buffer, to reflect the changes.
1952 @item s
1953 Save all Org buffers in the current Emacs session, and also the locations of
1954 IDs.
1956 @tsubheading{Secondary filtering and query editing}
1958 @item /
1959 Filter the current agenda view with respect to a tag.  You are prompted for a
1960 letter to select a tag.  Press @samp{-} first to select against the tag.
1962 @item \
1963 Narrow the current agenda filter by an additional condition.
1965 @tsubheading{Remote editing (see the manual for many more commands)}
1967 @item 0-9
1968 Digit argument.
1970 @item t
1971 Change the TODO state of the item, in the agenda and in the
1972 org file.
1974 @item C-k
1975 Delete the current agenda item along with the entire subtree belonging
1976 to it in the original Org file.
1978 @item C-c C-w
1979 Refile the entry at point.
1981 @item C-c C-x C-a @ @r{or short} @ a
1982 Archive the subtree corresponding to the entry at point using the default
1983 archiving command set in @code{org-archive-default-command}.
1985 @item C-c C-x C-s @ @r{or short} @ $
1986 Archive the subtree corresponding to the current headline.
1988 @item C-c C-s
1989 Schedule this item, with prefix arg remove the scheduling timestamp
1991 @item C-c C-d
1992 Set a deadline for this item, with prefix arg remove the deadline.
1994 @item S-@key{right} @r{and} S-@key{left}
1995 Change the timestamp associated with the current line by one day.
1997 @item I
1998 Start the clock on the current item.
2000 @item O / X
2001 Stop/cancel the previously started clock.
2003 @item J
2004 Jump to the running clock in another window.
2005 @end table
2007 @node Custom agenda views,  , Agenda commands, Agenda Views
2008 @section Custom agenda views
2010 The main application of custom searches is the definition of keyboard
2011 shortcuts for frequently used searches, either creating an agenda
2012 buffer, or a sparse tree (the latter covering of course only the current
2013 buffer).
2014 Custom commands are configured in the variable
2015 @code{org-agenda-custom-commands}.  You can customize this variable, for
2016 example by pressing @kbd{C-c a C}.  You can also directly set it with
2017 Emacs Lisp in @file{.emacs}.  The following example contains all valid
2018 search types:
2020 @smalllisp
2021 @group
2022 (setq org-agenda-custom-commands
2023       '(("w" todo "WAITING")
2024         ("u" tags "+boss-urgent")
2025         ("v" tags-todo "+boss-urgent")))
2026 @end group
2027 @end smalllisp
2029 @noindent
2030 The initial string in each entry defines the keys you have to press after the
2031 dispatcher command @kbd{C-c a} in order to access the command.  Usually this
2032 will be just a single character.  The second parameter is the search type,
2033 followed by the string or regular expression to be used for the matching.
2034 The example above will therefore define:
2036 @table @kbd
2037 @item C-c a w
2038 as a global search for TODO entries with @samp{WAITING} as the TODO
2039 keyword
2040 @item C-c a u
2041 as a global tags search for headlines marked @samp{:boss:} but not
2042 @samp{:urgent:}
2043 @item C-c a v
2044 as the same search as @kbd{C-c a u}, but limiting the search to
2045 headlines that are also TODO items
2046 @end table
2048 @seealso{
2049 @uref{http://orgmode.org/manual/Agenda-Views.html#Agenda-Views, Chapter 10 of
2050 the manual}@*
2051 @uref{http://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.php,
2052 Mat Lundin's tutorial about custom agenda commands}@*
2053 @uref{http://www.newartisans.com/2007/08/using-org-mode-as-a-day-planner.html,
2054 John Wiegley's setup}}
2056 @node Markup, Exporting, Agenda Views, Top
2057 @chapter Markup for rich export
2059 When exporting Org-mode documents, the exporter tries to reflect the
2060 structure of the document as accurately as possible in the backend.  Since
2061 export targets like HTML, La@TeX{}, or DocBook allow much richer formatting,
2062 Org mode has rules on how to prepare text for rich export.  This section
2063 summarizes the markup rules used in an Org-mode buffer.
2065 @menu
2066 * Structural markup elements::  The basic structure as seen by the exporter
2067 * Images and tables::           Tables and Images will be included
2068 * Literal examples::            Source code examples with special formatting
2069 * Include files::               Include additional files into a document
2070 * Embedded LaTeX::              LaTeX can be freely used inside Org documents
2071 @end menu
2073 @node Structural markup elements, Images and tables, Markup, Markup
2074 @section Structural markup elements
2076 @menu
2077 * Document title::              Where the title is taken from
2078 * Headings and sections::       The document structure as seen by the exporter
2079 * Table of contents::           The if and where of the table of contents
2080 * Paragraphs::                  Paragraphs
2081 * Emphasis and monospace::      Bold, italic, etc.
2082 * Comment lines::               What will *not* be exported
2083 @end menu
2085 @node Document title, Headings and sections, Structural markup elements, Structural markup elements
2086 @subheading Document title
2088 @noindent
2089 The title of the exported document is taken from the special line
2091 @smallexample
2092 #+TITLE: This is the title of the document
2093 @end smallexample
2095 @node Headings and sections, Table of contents, Document title, Structural markup elements
2096 @subheading Headings and sections
2098 The outline structure of the document as described in @ref{Document
2099 Structure}, forms the basis for defining sections of the exported document.
2100 However, since the outline structure is also used for (for example) lists of
2101 tasks, only the first three outline levels will be used as headings.  Deeper
2102 levels will become itemized lists.  You can change the location of this
2103 switch globally by setting the variable @code{org-export-headline-levels}, or on a
2104 per-file basis with a line
2106 @smallexample
2107 #+OPTIONS: H:4
2108 @end smallexample
2110 @node Table of contents, Paragraphs, Headings and sections, Structural markup elements
2111 @subheading Table of contents
2113 The table of contents is normally inserted directly before the first headline
2114 of the file.
2116 @smallexample
2117 #+OPTIONS: toc:2          (only to two levels in TOC)
2118 #+OPTIONS: toc:nil        (no TOC at all)
2119 @end smallexample
2121 @node Paragraphs, Emphasis and monospace, Table of contents, Structural markup elements
2122 @subheading Paragraphs, line breaks, and quoting
2124 Paragraphs are separated by at least one empty line.  If you need to enforce
2125 a line break within a paragraph, use @samp{\\} at the end of a line.
2127 To keep the line breaks in a region, but otherwise use normal formatting, you
2128 can use this construct, which can also be used to format poetry.
2130 @smallexample
2131 #+BEGIN_VERSE
2132  Great clouds overhead
2133  Tiny black birds rise and fall
2134  Snow covers Emacs
2136      -- AlexSchroeder
2137 #+END_VERSE
2138 @end smallexample
2140 When quoting a passage from another document, it is customary to format this
2141 as a paragraph that is indented on both the left and the right margin.  You
2142 can include quotations in Org-mode documents like this:
2144 @smallexample
2145 #+BEGIN_QUOTE
2146 Everything should be made as simple as possible,
2147 but not any simpler -- Albert Einstein
2148 #+END_QUOTE
2149 @end smallexample
2151 If you would like to center some text, do it like this:
2152 @smallexample
2153 #+BEGIN_CENTER
2154 Everything should be made as simple as possible, \\
2155 but not any simpler
2156 #+END_CENTER
2157 @end smallexample
2159 @node Emphasis and monospace, Comment lines, Paragraphs, Structural markup elements
2160 @subheading Emphasis and monospace
2162 You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
2163 and @code{~verbatim~}, and, if you must, @samp{+strike-through+}.  Text
2164 in the code and verbatim string is not processed for Org-mode specific
2165 syntax, it is exported verbatim.  To insert a horizontal rules, use a line 
2166 consisting of only dashes, and at least 5 of them.
2168 @node Comment lines,  , Emphasis and monospace, Structural markup elements
2169 @subheading Comment lines
2171 Lines starting with @samp{#} in column zero are treated as comments and will
2172 never be exported. If you want an indented line to be treated as a comment,
2173 start it with @samp{#+ }.  Also entire subtrees starting with the word
2174 @samp{COMMENT} will never be exported.  Finally, regions surrounded by
2175 @samp{#+BEGIN_COMMENT} ... @samp{#+END_COMMENT} will not be exported.
2177 @table @kbd
2178 @item C-c ;
2179 Toggle the COMMENT keyword at the beginning of an entry.
2180 @end table
2182 @node Images and tables, Literal examples, Structural markup elements, Markup
2183 @section Images and Tables
2185 For Org mode tables, the lines before the first horizontal separator line
2186 will become table header lines.  You can use the following lines somewhere
2187 before the table to assign a caption and a label for cross references, and in
2188 the text you can refer to the object with @code{\ref@{tab:basic-data@}}:
2190 @smallexample
2191 #+CAPTION: This is the caption for the next table (or link)
2192 #+LABEL:   tbl:basic-data
2193    | ... | ...|
2194    |-----|----|
2195 @end smallexample
2197 Some backends (HTML, La@TeX{}, and DocBook) allow you to directly include
2198 images into the exported document.  Org does this, if a link to an image
2199 files does not have a description part, for example @code{[[./img/a.jpg]]}.
2200 If you wish to define a caption for the image and maybe a label for internal
2201 cross references, you sure that the link is on a line by itself precede it
2202 with:
2204 @smallexample
2205 #+CAPTION: This is the caption for the next figure link (or table)
2206 #+LABEL:   fig:SED-HR4049
2207 [[./img/a.jpg]]
2208 @end smallexample
2210 You may also define additional attributes for the figure.  As this is
2211 backend-specific, see the sections about the individual backends for more
2212 information.
2215 @node Literal examples, Include files, Images and tables, Markup
2216 @section Literal examples
2218 You can include literal examples that should not be subjected to
2219 markup.  Such examples will be typeset in monospace, so this is well suited
2220 for source code and similar examples.
2222 @smallexample
2223 #+BEGIN_EXAMPLE
2224 Some example from a text file.
2225 #+END_EXAMPLE
2226 @end smallexample
2228 For simplicity when using small examples, you can also start the example
2229 lines with a colon followed by a space.  There may also be additional
2230 whitespace before the colon:
2232 @smallexample
2233 Here is an example
2234    : Some example from a text file.
2235 @end smallexample
2237 For source code from a programming language, or any other text
2238 that can be marked up by font-lock in Emacs, you can ask for it to
2239 look like the fontified Emacs buffer
2241 @smallexample
2242 #+BEGIN_SRC emacs-lisp
2243 (defun org-xor (a b)
2244    "Exclusive or."
2245    (if a (not b) b))
2246 #+END_SRC
2247 @end smallexample
2249 To edit the example in a special buffer supporting this language, use
2250 @kbd{C-c '} to both enter and leave the editing buffer.
2252 @node Include files, Embedded LaTeX, Literal examples, Markup
2253 @section Include files
2255 During export, you can include the content of another file.  For example, to
2256 include your @file{.emacs} file, you could use:
2258 @smallexample
2259 #+INCLUDE: "~/.emacs" src emacs-lisp
2260 @end smallexample
2261 @noindent
2262 The optional second and third parameter are the markup (e.g. @samp{quote},
2263 @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
2264 language for formatting the contents.  The markup is optional, if it is not
2265 given, the text will be assumed to be in Org mode format and will be
2266 processed normally. @kbd{C-c '} will visit the included file.
2268 @node Embedded LaTeX,  , Include files, Markup
2269 @section Embedded La@TeX{}
2271 For scientific notes which need to be able to contain mathematical symbols
2272 and the occasional formula, Org-mode supports embedding La@TeX{} code into
2273 its files.  You can directly use TeX-like macros for special symbols, enter
2274 formulas and entire LaTeX environments.
2276 @smallexample
2277 Angles are written as Greek letters \alpha, \beta and \gamma.  The mass if
2278 the sun is M_sun = 1.989 x 10^30 kg.  The radius of the sun is R_@{sun@} =
2279 6.96 x 10^8 m.  If $a^2=b$ and $b=2$, then the solution must be either
2280 $a=+\sqrt@{2@}$ or $a=-\sqrt@{2@}$.
2282 \begin@{equation@}
2283 x=\sqrt@{b@}
2284 \end@{equation@}
2285 @end smallexample
2286 @noindent  With
2287 @uref{http://orgmode.org/manual/LaTeX-fragments.html#LaTeX-fragments,special
2288 setup}, LaTeX snippets will be included as images when exporting to HTML.
2290 @seealso{
2291 @uref{http://orgmode.org/manual/Markup.html#Markup, Chapter 11 of the manual}}
2293 @node Exporting, Publishing, Markup, Top
2294 @chapter Exporting
2296 Org-mode documents can be exported into a variety of other formats: ASCII
2297 export for inclusion into emails, HTML to publish on the web, La@TeX{}/PDF
2298 for beautiful printed documents and DocBook to enter the world of many other
2299 formats using DocBook tools.  There is also export to iCalendar format so
2300 that planning information can be incorporated into desktop calendars.
2302 @menu
2303 * Export options::              Per-file export settings
2304 * The export dispatcher::       How to access exporter commands
2305 * ASCII/Latin-1/UTF-8 export::  Exporting to flat files with encoding
2306 * HTML export::                 Exporting to HTML
2307 * LaTeX and PDF export::        Exporting to La@TeX{}, and processing to PDF
2308 * DocBook export::              Exporting to DocBook
2309 * iCalendar export::            
2310 @end menu
2312 @node Export options, The export dispatcher, Exporting, Exporting
2313 @section Export options
2315 The exporter recognizes special lines in the buffer which provide
2316 additional information.  These lines may be put anywhere in the file.
2317 The whole set of lines can be inserted into the buffer with @kbd{C-c
2318 C-e t}.
2320 @table @kbd
2321 @item C-c C-e t
2322 Insert template with export options, see example below.
2323 @end table
2325 @smallexample
2326 #+TITLE:       the title to be shown (default is the buffer name)
2327 #+AUTHOR:      the author (default taken from @code{user-full-name})
2328 #+DATE:        a date, fixed, of a format string for @code{format-time-string}
2329 #+EMAIL:       his/her email address (default from @code{user-mail-address})
2330 #+DESCRIPTION: the page description, e.g. for the XHTML meta tag
2331 #+KEYWORDS:    the page keywords, e.g. for the XHTML meta tag
2332 #+LANGUAGE:    language for HTML, e.g. @samp{en} (@code{org-export-default-language})
2333 #+TEXT:        Some descriptive text to be inserted at the beginning.
2334 #+TEXT:        Several lines may be given.
2335 #+OPTIONS:     H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
2336 #+LINK_UP:     the ``up'' link of an exported page
2337 #+LINK_HOME:   the ``home'' link of an exported page
2338 #+LATEX_HEADER: extra line(s) for the LaTeX header, like \usepackage@{xyz@}
2339 @end smallexample
2341 @node The export dispatcher, ASCII/Latin-1/UTF-8 export, Export options, Exporting
2342 @section The export dispatcher
2344 All export commands can be reached using the export dispatcher, which is a
2345 prefix key that prompts for an additional key specifying the command.
2346 Normally the entire file is exported, but if there is an active region that
2347 contains one outline tree, the first heading is used as document title and
2348 the subtrees are exported.
2350 @table @kbd
2351 @item C-c C-e
2352 Dispatcher for export and publishing commands.
2353 @end table
2355 @node ASCII/Latin-1/UTF-8 export, HTML export, The export dispatcher, Exporting
2356 @section ASCII/Latin-1/UTF-8 export
2358 ASCII export produces a simple and very readable version of an Org-mode
2359 file, containing only plain ASCII.  Latin-1 and UTF-8 export augment the file
2360 with special characters and symbols available in these encodings.
2362 @table @kbd
2363 @item C-c C-e a
2364 Export as ASCII file.
2365 @item C-c C-e n @ @ @r{and} @ @ C-c C-e N
2366 Like the above commands, but use Latin-1 encoding.
2367 @item C-c C-e u @ @ @r{and} @ @ C-c C-e U
2368 Like the above commands, but use UTF-8 encoding.
2369 @end table
2371 @node HTML export, LaTeX and PDF export, ASCII/Latin-1/UTF-8 export, Exporting
2372 @section HTML export
2374 @table @kbd
2375 @item C-c C-e h
2376 Export as HTML file @file{myfile.html}.
2377 @item C-c C-e b
2378 Export as HTML file and immediately open it with a browser.
2379 @end table
2381 To insert HTML that should be copied verbatim to
2382 the exported file use either
2384 @smallexample
2385 #+HTML: Literal HTML code for export
2386 @end smallexample
2387 @noindent or
2388 @smallexample
2389 #+BEGIN_HTML
2390 All lines between these markers are exported literally
2391 #+END_HTML
2392 @end smallexample
2394 @node LaTeX and PDF export, DocBook export, HTML export, Exporting
2395 @section La@TeX{} and PDF export
2397 @table @kbd
2398 @item C-c C-e l
2399 Export as La@TeX{} file @file{myfile.tex}.
2400 @item C-c C-e p
2401 Export as La@TeX{} and then process to PDF.
2402 @item C-c C-e d
2403 Export as La@TeX{} and then process to PDF, then open the resulting PDF file.
2404 @end table
2406 By default, the La@TeX{} output uses the class @code{article}.  You can
2407 change this by adding an option like @code{#+LaTeX_CLASS: myclass} in your
2408 file.  The class must be listed in @code{org-export-latex-classes}.
2410 Embedded La@TeX{} as described in @ref{Embedded LaTeX}, will be correctly
2411 inserted into the La@TeX{} file.  Similarly to the HTML exporter, you can use
2412 @code{#+LaTeX:} and @code{#+BEGIN_LaTeX ... #+END_LaTeX} construct to add
2413 verbatim LaTeX code.
2415 @node DocBook export, iCalendar export, LaTeX and PDF export, Exporting
2416 @section DocBook export
2418 @table @kbd
2419 @item C-c C-e D
2420 Export as DocBook file.
2421 @end table
2423 Similarly to the HTML exporter, you can use @code{#+DocBook:} and
2424 @code{#+BEGIN_DocBook ... #+END_DocBook} construct to add verbatim LaTeX
2425 code.
2427 @node iCalendar export,  , DocBook export, Exporting
2428 @section iCalendar export
2430 @table @kbd
2431 @item C-c C-e i
2432 Create iCalendar entries for the current file in a @file{.ics} file.
2433 @item C-c C-e c
2434 Create a single large iCalendar file from all files in
2435 @code{org-agenda-files} and write it to the file given by
2436 @code{org-combined-agenda-icalendar-file}.
2437 @end table
2439 @seealso{
2440 @uref{http://orgmode.org/manual/Exporting.html#Exporting, Chapter 12 of the manual}@*
2441 @uref{http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.php,
2442 Sebastian Rose's image handling tutorial}@*
2443 @uref{http://orgmode.org/worg/org-tutorials/org-latex-export.php, Thomas
2444 Dye's LaTeX export tutorial}
2445 @uref{http://orgmode.org/worg/org-tutorials/org-beamer/tutorial.php, Eric
2446 Fraga's BEAMER presentation tutorial}}
2448 @node Publishing, Working With Source Code, Exporting, Top
2449 @chapter Publishing
2451 Org includes a publishing management system that allows you to configure
2452 automatic HTML conversion of @emph{projects} composed of interlinked org
2453 files.  You can also configure Org to automatically upload your exported HTML
2454 pages and related attachments, such as images and source code files, to a web
2455 server.  For detailed instructions about setup, see the manual.
2457 Here is an example:
2459 @smalllisp
2460 (setq org-publish-project-alist
2461       '(("org"
2462          :base-directory "~/org/"
2463          :publishing-directory "~/public_html"
2464          :section-numbers nil
2465          :table-of-contents nil
2466          :style "<link rel=\"stylesheet\"
2467                 href=\"../other/mystyle.css\"
2468                 type=\"text/css\"/>")))
2469 @end smalllisp
2471 @table @kbd
2472 @item C-c C-e C
2473 Prompt for a specific project and publish all files that belong to it.
2474 @item C-c C-e P
2475 Publish the project containing the current file.
2476 @item C-c C-e F
2477 Publish only the current file.
2478 @item C-c C-e E
2479 Publish every project.
2480 @end table
2482 Org uses timestamps to track when a file has changed. The above functions
2483 normally only publish changed files. You can override this and force
2484 publishing of all files by giving a prefix argument to any of the commands
2485 above.
2487 @seealso{
2488 @uref{http://orgmode.org/manual/Publishing.html#Publishing, Chapter 13 of the
2489 manual}@*
2490 @uref{http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.php,
2491 Sebastian Rose's publishing tutorial}@*
2492 @uref{http://orgmode.org/worg/org-tutorials/org-jekyll.php, Ian Barton's
2493 Jekyll/blogging setup}}
2495 @node Working With Source Code, Miscellaneous, Publishing, Top
2496 @chapter Working with source code
2497 Org-mode provides a number of features for working with source code,
2498 including editing of code blocks in their native major-mode, evaluation of
2499 code blocks, tangling of code blocks, and exporting code blocks and their
2500 results in several formats.
2502 @subheading Structure of Code Blocks
2503 The structure of code blocks is as follows:
2505 @example
2506 #+srcname: <name>
2507 #+begin_src <language> <switches> <header arguments>
2508   <body>
2509 #+end_src
2510 @end example
2512 Where @code{<name>} is a string used to name the code block,
2513 @code{<language>} specifies the language of the code block
2514 (e.g. @code{emacs-lisp}, @code{shell}, @code{R}, @code{python}, etc...),
2515 @code{<switches>} can be used to control export of the code block,
2516 @code{<header arguments>} can be used to control many aspects of code block
2517 behavior as demonstrated below, and @code{<body>} contains the actual source
2518 code.
2520 @subheading Editing source code
2521 Use @kbd{C-c '} to edit the current code block. This brings up a language
2522 major-mode edit buffer containing the body of the code block. Saving this
2523 buffer will write the new contents back to the Org buffer. Use @kbd{C-c '}
2524 again to exit the edit buffer.
2526 @subheading Evaluating code blocks
2527 Use @kbd{C-c C-c} to evaluate the current code block and insert its results
2528 in the Org-mode buffer.  By default, evaluation is only turned on for
2529 @code{emacs-lisp} code blocks, however support exists for evaluating blocks
2530 in many languages.  For a complete list of supported languages see the
2531 manual.  The following shows a code block and its results.
2533 @example
2534 #+begin_src emacs-lisp
2535   (+ 1 2 3 4)
2536 #+end_src
2538 #+results:
2539 : 10
2540 @end example
2542 @subheading Extracting source code
2543 Use @kbd{C-c C-v t} to create pure source code files by extracting code from
2544 source blocks in the current buffer.  This is referred to as ``tangling''---a
2545 term adopted from the literate programming community.  During ``tangling'' of
2546 code blocks their bodies are expanded using @code{org-babel-expand-src-block}
2547 which can expand both variable and ``noweb'' style references.  In order to
2548 tangle a code block it must have a @code{:tangle} header argument, see the
2549 manual for details.
2551 @subheading Library of Babel
2552 Use @kbd{C-c C-v l} to load the code blocks from an Org-mode files into the
2553 ``Library of Babel'', these blocks can then be evaluated from any Org-mode
2554 buffer.  A collection of generally useful code blocks is distributed with
2555 Org-mode in @code{contrib/library-of-babel.org}.
2557 @subheading Header Arguments
2558 Many aspects of the evaluation and export of code blocks are controlled
2559 through header arguments.  These can be specified globally, at the file
2560 level, at the outline subtree level, and at the individual code block level.
2561 The following describes some of the header arguments.
2562 @table @code
2563 @item :var
2564 The @code{:var} header argument is used to pass arguments to code blocks.
2565 The values passed to arguments can be literal values, values from org-mode
2566 tables and literal example blocks, or the results of other named code blocks.
2567 @item :results
2568 The @code{:results} header argument controls the @emph{collection},
2569 @emph{type}, and @emph{handling} of code block results.  Values of
2570 @code{output} or @code{value} (the default) specify how results are collected
2571 from a code block's evaluation.  Values of @code{vector}, @code{scalar}
2572 @code{file} @code{raw} @code{html} @code{latex} and @code{code} specify the
2573 type of the results of the code block which dictates how they will be
2574 incorporated into the Org-mode buffer.  Values of @code{silent},
2575 @code{replace}, @code{prepend}, and @code{append} specify handling of code
2576 block results, specifically if and how the results should be inserted into
2577 the Org-mode buffer.
2578 @item :session
2579 A header argument of @code{:session} will cause the code block to be
2580 evaluated in a persistent interactive inferior process in Emacs.  This allows
2581 for persisting state between code block evaluations, and for manual
2582 inspection of the results of evaluation.
2583 @item :exports
2584 Any combination of the @emph{code} or the @emph{results} of a block can be
2585 retained on export, this is specified by setting the @code{:results} header
2586 argument to @code{code} @code{results} @code{none} or @code{both}.
2587 @item :tangle
2588 A header argument of @code{:tangle yes} will cause a code block's contents to
2589 be tangled to a file named after the filename of the Org-mode buffer.  An
2590 alternate file name can be specified with @code{:tangle filename}.
2591 @item :cache
2592 A header argument of @code{:cache yes} will cause associate a hash of the
2593 expanded code block with the results, ensuring that code blocks are only
2594 re-run when their inputs have changed.
2595 @item :noweb
2596 A header argument of @code{:noweb yes} will expand ``noweb'' style references
2597 on evaluation and tangling.
2598 @item :file
2599 Code blocks which output results to files (e.g. graphs, diagrams and figures)
2600 can accept a @code{:file filename} header argument in which case the results
2601 are saved to the named file, and a link to the file is inserted into the
2602 Org-mode buffer.
2603 @end table
2605 @seealso{
2606 @uref{http://orgmode.org/manual/Literal-examples.html#Literal-examples,
2607 Chapter 11.3 of the manual}@*
2608 @uref{http://orgmode.org/worg/org-contrib/babel/index.php,
2609 The Babel site on Worg}}
2611 @node Miscellaneous,  , Working With Source Code, Top
2612 @chapter Miscellaneous
2614 @menu
2615 * Completion::                  M-TAB knows what you need
2616 * Clean view::                  Getting rid of leading stars in the outline
2617 * MobileOrg::                   Org-mode on the iPhone
2618 @end menu
2620 @node Completion, Clean view, Miscellaneous, Miscellaneous
2621 @section Completion
2623 Org supports in-buffer completion with @kbd{M-@key{TAB}}.  This type of
2624 completion does not make use of the minibuffer.  You simply type a few
2625 letters into the buffer and use the key to complete text right there.  For
2626 example, this command will complete @TeX{} symbols after @samp{\}, TODO
2627 keywords at the beginning of a headline, and tags after @samp{:} in a
2628 headline.
2630 @node Clean view, MobileOrg, Completion, Miscellaneous
2631 @section A cleaner outline view
2633 Some people find it noisy and distracting that the Org headlines start with a
2634 potentially large number of stars, and that text below the headlines is not
2635 indented.  While this is no problem when writing a @emph{book-like} document
2636 where the outline headings are really section headings, in a more
2637 @emph{list-oriented} outline, indented structure is a lot cleaner:
2639 @smallexample
2640 @group
2641 * Top level headline             |    * Top level headline
2642 ** Second level                  |      * Second level
2643 *** 3rd level                    |        * 3rd level
2644 some text                        |          some text
2645 *** 3rd level                    |        * 3rd level
2646 more text                        |          more text
2647 * Another top level headline     |    * Another top level headline
2648 @end group
2649 @end smallexample
2651 @noindent
2652 If you are using at least Emacs 23.1.50.3 and version 6.29 of Org, this kind
2653 of view can be achieved dynamically at display time using
2654 @code{org-indent-mode}, which will prepend intangible space to each line.
2655 You can turn on @code{org-indent-mode} for all files by customizing the
2656 variable @code{org-startup-indented}, or you can turn it on for individual
2657 files using
2659 @smallexample
2660 #+STARTUP: indent
2661 @end smallexample
2663 If you want a similar effect in earlier version of Emacs and/or Org, or if
2664 you want the indentation to be hard space characters so that the plain text
2665 file looks as similar as possible to the Emacs display, Org supports you by
2666 helping to indent (with @key{TAB}) text below each headline, by hiding
2667 leading stars, and by only using levels 1, 3, etc to get two characters
2668 indentation for each level.  To get this support in a file, use
2670 @smallexample
2671 #+STARTUP: hidestars odd
2672 @end smallexample
2674 @node MobileOrg,  , Clean view, Miscellaneous
2675 @section MobileOrg
2677 @i{MobileOrg} is an application for the @i{iPhone/iPod Touch} series of
2678 devices, developed by Richard Moreland.  For details, see the Org-mode
2679 manual.
2681 @seealso{
2682 @uref{http://orgmode.org/manual/Miscellaneous.html#Miscellaneous, Chapter 15
2683 of the manual}@*
2684 @uref{http://orgmode.org/manual/MobileOrg.html#MobileOrg, Appendix B of the
2685 manual}@*
2686 @uref{http://orgmode.org/orgcard.pdf,Key reference card}}
2688 @bye
2690 @ignore
2691         arch-tag: 8f0a8557-0acc-4436-b2b2-0197699e1452
2692 @end ignore
2694 @c Local variables:
2695 @c fill-column: 77
2696 @c End:
2699 @c  LocalWords:  webdavhost pre