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