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