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