org.texi: Update internal links documentation
[org-mode.git] / doc / orgguide.texi
blobab96641804dc06adbd1a2860c8bb6f4e9a173d2d
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 Bastien Guerry
17 @set MAINTAINEREMAIL @email{bzg at gnu dot org}
18 @set MAINTAINERCONTACT @uref{mailto:bzg at gnu 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 searches::                Searching for combinations of 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::           Tables and Images will be included
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 * DocBook export::              Exporting to DocBook
213 * iCalendar export::
215 Miscellaneous
217 * Completion::                  M-TAB knows what you need
218 * Clean view::                  Getting rid of leading stars in the outline
219 * MobileOrg::                   Org-mode on the iPhone
221 @end detailmenu
222 @end menu
224 @node Introduction, Document Structure, Top, Top
225 @chapter Introduction
227 @menu
228 * Preface::                     Welcome
229 * Installation::                How to install a downloaded version of Org
230 * Activation::                  How to activate Org for certain buffers
231 * Feedback::                    Bug reports, ideas, patches etc.
232 @end menu
234 @node Preface, Installation, Introduction, Introduction
235 @section Preface
237 Org is a mode for keeping notes, maintaining TODO lists, and doing project
238 planning with a fast and effective plain-text system.  It is also an
239 authoring and publishing system.
241 @i{This document is a much compressed derivative of the
242 @uref{http://orgmode.org/index.html#sec-4_1, comprehensive Org-mode manual}.
243 It contains all basic features and commands, along with important hints for
244 customization.  It is intended for beginners who would shy back from a 200
245 page manual because of sheer size.}
247 @node Installation, Activation, Preface, Introduction
248 @section Installation
250 @b{Important:} @i{If you are using a version of Org that is part of the Emacs
251 distribution or an XEmacs package, please skip this section and go directly
252 to @ref{Activation}.}
254 If you have downloaded Org from the Web, either as a distribution @file{.zip}
255 or @file{.tar} file, or as a Git archive, it is best to run it directly from
256 the distribution directory.  You need to add the @file{lisp} subdirectories
257 to the Emacs load path.  To do this, add the following line to @file{.emacs}:
259 @smallexample
260 (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
261 (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
262 @end smallexample
264 @noindent For speed you should byte-compile the Lisp files with the shell
265 command:
267 @smallexample
268 make
269 @end smallexample
271 @node Activation, Feedback, Installation, Introduction
272 @section Activation
274 Add the following lines to your @file{.emacs} file.  The last three lines
275 define @emph{global} keys for some commands --- please choose suitable keys
276 yourself.
278 @smalllisp
279 ;; The following lines are always needed.  Choose your own keys.
280 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) ; not needed since Emacs 22.2
281 (add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on
282 (global-set-key "\C-cl" 'org-store-link)
283 (global-set-key "\C-ca" 'org-agenda)
284 (global-set-key "\C-cb" 'org-iswitchb)
285 @end smalllisp
287 With this setup, all files with extension @samp{.org} will be put
288 into Org mode. 
290 @node Feedback,  , Activation, Introduction
291 @section Feedback
293 If you find problems with Org, or if you have questions, remarks, or ideas
294 about it, please mail to the Org mailing list @email{emacs-orgmode@@gnu.org}.
295 For information on how to submit bug reports, see the main manual.
297 @node Document Structure, Tables, Introduction, Top
298 @chapter Document Structure
300 Org is based on Outline mode and provides flexible commands to
301 edit the structure of the document.
303 @menu
304 * Outlines::                    Org is based on Outline mode
305 * Headlines::                   How to typeset Org tree headlines
306 * Visibility cycling::          Show and hide, much simplified
307 * Motion::                      Jumping to other headlines
308 * Structure editing::           Changing sequence and level of headlines
309 * Sparse trees::                Matches embedded in context
310 * Plain lists::                 Additional structure within an entry
311 * Footnotes::                   How footnotes are defined in Org's syntax
312 @end menu
314 @node Outlines, Headlines, Document Structure, Document Structure
315 @section Outlines
317 Org is implemented on top of Outline mode.  Outlines allow a
318 document to be organized in a hierarchical structure, which (at least
319 for me) is the best representation of notes and thoughts.  An overview
320 of this structure is achieved by folding (hiding) large parts of the
321 document to show only the general document structure and the parts
322 currently being worked on.  Org greatly simplifies the use of
323 outlines by compressing the entire show/hide functionality into a single
324 command, @command{org-cycle}, which is bound to the @key{TAB} key.
326 @node Headlines, Visibility cycling, Outlines, Document Structure
327 @section Headlines
329 Headlines define the structure of an outline tree.  The headlines in
330 Org start with one or more stars, on the left margin@footnote{See
331 the variable @code{org-special-ctrl-a/e} to configure special behavior
332 of @kbd{C-a} and @kbd{C-e} in headlines.}.  For example:
334 @smallexample
335 * Top level headline
336 ** Second level
337 *** 3rd level
338     some text
339 *** 3rd level
340     more text
342 * Another top level headline
343 @end smallexample
345 @noindent Some people find the many stars too noisy and would prefer an
346 outline that has whitespace followed by a single star as headline
347 starters.  @ref{Clean view}, describes a setup to realize this.
349 @node Visibility cycling, Motion, Headlines, Document Structure
350 @section Visibility cycling
352 Outlines make it possible to hide parts of the text in the buffer.
353 Org uses just two commands, bound to @key{TAB} and
354 @kbd{S-@key{TAB}} to change the visibility in the buffer.
356 @table @kbd
357 @item @key{TAB}
358 @emph{Subtree cycling}: Rotate current subtree among the states
360 @smallexample
361 ,-> FOLDED -> CHILDREN -> SUBTREE --.
362 '-----------------------------------'
363 @end smallexample
365 When called with a prefix argument (@kbd{C-u @key{TAB}}) or with the shift
366 key, global cycling is invoked.
368 @item S-@key{TAB} @r{and} C-u @key{TAB}
369 @emph{Global cycling}: Rotate the entire buffer among the states
371 @smallexample
372 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
373 '--------------------------------------'
374 @end smallexample
376 @item C-u C-u C-u @key{TAB}
377 Show all, including drawers.
378 @end table
380 When Emacs first visits an Org file, the global state is set to
381 OVERVIEW, i.e.@: only the top level headlines are visible.  This can be
382 configured through the variable @code{org-startup-folded}, or on a
383 per-file basis by adding a startup keyword @code{overview}, @code{content},
384 @code{showall}, like this:
386 @smallexample
387 #+STARTUP: content
388 @end smallexample
391 @node Motion, Structure editing, Visibility cycling, Document Structure
392 @section Motion
393 The following commands jump to other headlines in the buffer.
395 @table @kbd
396 @item C-c C-n
397 Next heading.
398 @item C-c C-p
399 Previous heading.
400 @item C-c C-f
401 Next heading same level.
402 @item C-c C-b
403 Previous heading same level.
404 @item C-c C-u
405 Backward to higher level heading.
406 @end table
408 @node Structure editing, Sparse trees, Motion, Document Structure
409 @section Structure editing
411 @table @kbd
412 @item M-@key{RET}
413 Insert new heading with same level as current.  If the cursor is in a plain
414 list item, a new item is created (@pxref{Plain lists}).  When this command is
415 used in the middle of a line, the line is split and the rest of the line
416 becomes the new headline@footnote{If you do not want the line to be split,
417 customize the variable @code{org-M-RET-may-split-line}.}.
418 @item M-S-@key{RET}
419 Insert new TODO entry with same level as current heading.
420 @item @key{TAB} @r{in new, empty entry}
421 In a new entry with no text yet, @key{TAB} will cycle through reasonable
422 levels.
423 @item M-@key{left}@r{/}@key{right}
424 Promote/demote current heading by one level.
425 @item M-S-@key{left}@r{/}@key{right}
426 Promote/demote the current subtree by one level.
427 @item M-S-@key{up}@r{/}@key{down}
428 Move subtree up/down (swap with previous/next subtree of same
429 level).
430 @item C-c C-w
431 Refile entry or region to a different location.  @xref{Refile and copy}.
432 @item C-x n s/w
433 Narrow buffer to current subtree / widen it again
434 @end table
436 When there is an active region (Transient Mark mode), promotion and
437 demotion work on all headlines in the region.
439 @node Sparse trees, Plain lists, Structure editing, Document Structure
440 @section Sparse trees
442 An important feature of Org mode is the ability to construct @emph{sparse
443 trees} for selected information in an outline tree, so that the entire
444 document is folded as much as possible, but the selected information is made
445 visible along with the headline structure above it@footnote{See also the
446 variables @code{org-show-hierarchy-above}, @code{org-show-following-heading},
447 @code{org-show-siblings}, and @code{org-show-entry-below} for detailed
448 control on how much context is shown around each match.}.  Just try it out
449 and you will see immediately how it works.
451 Org mode contains several commands creating such trees, all these
452 commands can be accessed through a dispatcher:
454 @table @kbd
455 @item C-c /
456 This prompts for an extra key to select a sparse-tree creating command.
457 @item C-c / r
458 Occur.  Prompts for a regexp and shows a sparse tree with all matches.  Each
459 match is also highlighted; the highlights disappear by pressing @kbd{C-c C-c}.
460 @end table
462 The other sparse tree commands select headings based on TODO keywords,
463 tags, or properties and will be discussed later in this manual.
465 @node Plain lists, Footnotes, Sparse trees, Document Structure
466 @section Plain lists
468 Within an entry of the outline tree, hand-formatted lists can provide
469 additional structure.  They also provide a way to create lists of
470 checkboxes (@pxref{Checkboxes}).  Org supports editing such lists,
471 and the HTML exporter (@pxref{Exporting}) parses and formats them.
473 Org knows ordered lists, unordered lists, and description lists.
474 @itemize @bullet
475 @item
476 @emph{Unordered} list items start with @samp{-}, @samp{+}, or
477 @samp{*} as bullets.
478 @item
479 @emph{Ordered} list items start with @samp{1.} or @samp{1)}.
480 @item
481 @emph{Description} list use @samp{ :: } to separate the @emph{term} from the
482 description.
483 @end itemize
485 Items belonging to the same list must have the same indentation on the first
486 line.  An item ends before the next line that is indented like its
487 bullet/number, or less.  A list ends when all items are closed, or before two
488 blank lines.  An example:
490 @smallexample
491 @group
492 ** Lord of the Rings
493    My favorite scenes are (in this order)
494    1. The attack of the Rohirrim
495    2. Eowyn's fight with the witch king
496       + this was already my favorite scene in the book
497       + I really like Miranda Otto.
498    Important actors in this film are:
499    - @b{Elijah Wood} :: He plays Frodo
500    - @b{Sean Austin} :: He plays Sam, Frodo's friend.
501 @end group
502 @end smallexample
504 The following commands act on items when the cursor is in the first line of
505 an item (the line with the bullet or number).
507 @table @kbd
508 @item @key{TAB}
509 Items can be folded just like headline levels.
510 @item M-@key{RET}
511 Insert new item at current level.  With a prefix argument, force a new
512 heading (@pxref{Structure editing}).
513 @item M-S-@key{RET}
514 Insert a new item with a checkbox (@pxref{Checkboxes}).
515 @item M-S-@key{up}@r{/}@key{down}
516 Move the item including subitems up/down (swap with previous/next item
517 of same indentation).  If the list is ordered, renumbering is
518 automatic.
519 @item M-@key{left}@r{/}M-@key{right}
520 Decrease/increase the indentation of an item, leaving children alone.
521 @item M-S-@key{left}@r{/}@key{right}
522 Decrease/increase the indentation of the item, including subitems.
523 @item C-c C-c
524 If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
525 state of the checkbox.  Also verify bullets and indentation consistency in
526 the whole list.
527 @item C-c -
528 Cycle the entire list level through the different itemize/enumerate bullets
529 (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}).
530 @end table
532 @node Footnotes,  , Plain lists, Document Structure
533 @section Footnotes
535 A footnote is defined in a paragraph that is started by a footnote marker in
536 square brackets in column 0, no indentation allowed.  The footnote reference
537 is simply the marker in square brackets, inside text.  For example:
539 @smallexample
540 The Org homepage[fn:1] now looks a lot better than it used to.
542 [fn:1] The link is: http://orgmode.org
543 @end smallexample
545 @noindent The following commands handle footnotes:
547 @table @kbd
548 @item C-c C-x f
549 The footnote action command.  When the cursor is on a footnote reference,
550 jump to the definition.  When it is at a definition, jump to the (first)
551 reference.  Otherwise, create a new footnote.  When this command is called
552 with a prefix argument, a menu of additional options including renumbering is
553 offered.
555 @item C-c C-c
556 Jump between definition and reference.
557 @end table
559 @seealso{
560 @uref{http://orgmode.org/manual/Document-Structure.html#Document-Structure,
561 Chapter 2 of the manual}@*
562 @uref{http://sachachua.com/wp/2008/01/outlining-your-notes-with-org/,
563 Sacha Chua's tutorial}}
566 @node Tables, Hyperlinks, Document Structure, Top
567 @chapter Tables
569 Org comes with a fast and intuitive table editor.  Spreadsheet-like
570 calculations are supported in connection with the Emacs @file{calc}
571 package
572 @ifinfo
573 (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
574 @end ifinfo
575 @ifnotinfo
576 (see the Emacs Calculator manual for more information about the Emacs
577 calculator).
578 @end ifnotinfo
580 Org makes it easy to format tables in plain ASCII.  Any line with
581 @samp{|} as the first non-whitespace character is considered part of a
582 table.  @samp{|} is also the column separator.  A table might look like
583 this:
585 @smallexample
586 | Name  | Phone | Age |
587 |-------+-------+-----|
588 | Peter |  1234 |  17 |
589 | Anna  |  4321 |  25 |
590 @end smallexample
592 A table is re-aligned automatically each time you press @key{TAB} or
593 @key{RET} or @kbd{C-c C-c} inside the table.  @key{TAB} also moves to
594 the next field (@key{RET} to the next row) and creates new table rows
595 at the end of the table or before horizontal lines.  The indentation
596 of the table is set by the first line.  Any line starting with
597 @samp{|-} is considered as a horizontal separator line and will be
598 expanded on the next re-align to span the whole table width.  So, to
599 create the above table, you would only type
601 @smallexample
602 |Name|Phone|Age|
604 @end smallexample
606 @noindent and then press @key{TAB} to align the table and start filling in
607 fields.  Even faster would be to type @code{|Name|Phone|Age} followed by
608 @kbd{C-c @key{RET}}.
610 When typing text into a field, Org treats @key{DEL},
611 @key{Backspace}, and all character keys in a special way, so that
612 inserting and deleting avoids shifting other fields.  Also, when
613 typing @emph{immediately after the cursor was moved into a new field
614 with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
615 field is automatically made blank.
617 @table @kbd
618 @tsubheading{Creation and conversion}
619 @item C-c |
620 Convert the active region to table.  If every line contains at least one TAB
621 character, the function assumes that the material is tab separated.  If every
622 line contains a comma, comma-separated values (CSV) are assumed.  If not,
623 lines are split at whitespace into fields.
625 If there is no active region, this command creates an empty Org
626 table.  But it's easier just to start typing, like
627 @kbd{|Name|Phone|Age C-c @key{RET}}.
629 @tsubheading{Re-aligning and field motion}
630 @item C-c C-c
631 Re-align the table without moving the cursor.
633 @item @key{TAB}
634 Re-align the table, move to the next field.  Creates a new row if
635 necessary.
637 @item S-@key{TAB}
638 Re-align, move to previous field.
640 @item @key{RET}
641 Re-align the table and move down to next row.  Creates a new row if
642 necessary.
644 @tsubheading{Column and row editing}
645 @item M-@key{left}
646 @itemx M-@key{right}
647 Move the current column left/right.
649 @item M-S-@key{left}
650 Kill the current column.
652 @item M-S-@key{right}
653 Insert a new column to the left of the cursor position.
655 @item M-@key{up}
656 @itemx M-@key{down}
657 Move the current row up/down.
659 @item M-S-@key{up}
660 Kill the current row or horizontal line.
662 @item M-S-@key{down}
663 Insert a new row above the current row.  With a prefix argument, the line is
664 created below the current one.
666 @item C-c -
667 Insert a horizontal line below current row.  With a prefix argument, the line
668 is created above the current line.
670 @item C-c @key{RET}
671 Insert a horizontal line below current row, and move the cursor into the row
672 below that line.
674 @item C-c ^
675 Sort the table lines in the region.  The position of point indicates the
676 column to be used for sorting, and the range of lines is the range
677 between the nearest horizontal separator lines, or the entire table.
679 @end table
681 @seealso{
682 @uref{http://orgmode.org/manual/Tables.html#Tables, Chapter 3 of the
683 manual}@*
684 @uref{http://orgmode.org/worg/org-tutorials/tables.php, Bastien's
685 table tutorial}@*
686 @uref{http://orgmode.org/worg/org-tutorials/org-spreadsheet-intro.php,
687 Bastien's spreadsheet tutorial}@*
688 @uref{http://orgmode.org/worg/org-tutorials/org-plot.php, Eric's plotting tutorial}}
690 @node Hyperlinks, TODO Items, Tables, Top
691 @chapter Hyperlinks
693 Like HTML, Org provides links inside a file, external links to
694 other files, Usenet articles, emails, and much more.
696 @menu
697 * Link format::                 How links in Org are formatted
698 * Internal links::              Links to other places in the current file
699 * External links::              URL-like links to the world
700 * Handling links::              Creating, inserting and following
701 * Targeted links::              Point at a location in a file
702 @end menu
704 @node Link format, Internal links, Hyperlinks, Hyperlinks
705 @section Link format
707 Org will recognize plain URL-like links and activate them as
708 clickable links.  The general link format, however, looks like this:
710 @smallexample
711 [[link][description]]       @r{or alternatively}           [[link]]
712 @end smallexample
714 @noindent
715 Once a link in the buffer is complete (all brackets present), Org will change
716 the display so that @samp{description} is displayed instead of
717 @samp{[[link][description]]} and @samp{link} is displayed instead of
718 @samp{[[link]]}.  To edit the invisible @samp{link} part, use @kbd{C-c
719 C-l} with the cursor on the link.
721 @node Internal links, External links, Link format, Hyperlinks
722 @section Internal links
724 If the link does not look like a URL, it is considered to be internal in the
725 current file.  The most important case is a link like
726 @samp{[[#my-custom-id]]} which will link to the entry with the
727 @code{CUSTOM_ID} property @samp{my-custom-id}.
729 Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]}
730 lead to a text search in the current file for the corresponding target which
731 looks like @samp{<<My Target>>}.
733 Internal links will be used to reference their destination, through links or
734 numbers, when possible.
736 @node External links, Handling links, Internal links, Hyperlinks
737 @section External links
739 Org supports links to files, websites, Usenet and email messages,
740 BBDB database entries and links to both IRC conversations and their
741 logs.  External links are URL-like locators.  They start with a short
742 identifying string followed by a colon.  There can be no space after
743 the colon.  Here are some examples:
745 @smallexample
746 http://www.astro.uva.nl/~dominik          @r{on the web}
747 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
748 /home/dominik/images/jupiter.jpg          @r{same as above}
749 file:papers/last.pdf                      @r{file, relative path}
750 file:projects.org                         @r{another Org file}
751 docview:papers/last.pdf::NNN              @r{open file in doc-view mode at page NNN}
752 id:B7423F4D-2E8A-471B-8810-C40F074717E9   @r{Link to heading by ID}
753 news:comp.emacs                           @r{Usenet link}
754 mailto:adent@@galaxy.net                   @r{Mail link}
755 vm:folder                                 @r{VM folder link}
756 vm:folder#id                              @r{VM message link}
757 wl:folder#id                              @r{WANDERLUST message link}
758 mhe:folder#id                             @r{MH-E message link}
759 rmail:folder#id                           @r{RMAIL message link}
760 gnus:group#id                             @r{Gnus article link}
761 bbdb:R.*Stallman                          @r{BBDB link (with regexp)}
762 irc:/irc.com/#emacs/bob                   @r{IRC link}
763 info:org:External%20links                 @r{Info node link (with encoded space)}
764 @end smallexample
766 A link should be enclosed in double brackets and may contain a
767 descriptive text to be displayed instead of the URL (@pxref{Link
768 format}), for example:
770 @smallexample
771 [[http://www.gnu.org/software/emacs/][GNU Emacs]]
772 @end smallexample
774 @noindent
775 If the description is a file name or URL that points to an image, HTML export
776 (@pxref{HTML export}) will inline the image as a clickable button.  If there
777 is no description at all and the link points to an image, that image will be
778 inlined into the exported HTML file.
780 @node Handling links, Targeted links, External links, Hyperlinks
781 @section Handling links
783 Org provides methods to create a link in the correct syntax, to
784 insert it into an Org file, and to follow the link.
786 @table @kbd
787 @item C-c l
788 Store a link to the current location.  This is a @emph{global} command (you
789 must create the key binding yourself) which can be used in any buffer to
790 create a link.  The link will be stored for later insertion into an Org
791 buffer (see below).
793 @item C-c C-l
794 Insert a link.  This prompts for a link to be inserted into the buffer.  You
795 can just type a link, or use history keys @key{up} and @key{down} to access
796 stored links.  You will be prompted for the description part of the link.
797 When called with a @kbd{C-u} prefix argument, file name completion is used to
798 link to a file.
800 @item C-c C-l @r{(with cursor on existing link)}
801 When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
802 link and description parts of the link.
804 @item C-c C-o @r{or} mouse-1 @r{or} mouse-2
805 Open link at point.
806 @item C-c &
807 Jump back to a recorded position.  A position is recorded by the
808 commands following internal links, and by @kbd{C-c %}.  Using this
809 command several times in direct succession moves through a ring of
810 previously recorded positions.
812 @end table
814 @node Targeted links,  , Handling links, Hyperlinks
815 @section Targeted links
817 File links can contain additional information to make Emacs jump to a
818 particular location in the file when following a link.  This can be a
819 line number or a search option after a double colon.
821 Here is the syntax of the different ways to attach a search to a file
822 link, together with an explanation:
824 @smallexample
825 [[file:~/code/main.c::255]]                 @r{Find line 255}
826 [[file:~/xx.org::My Target]]                @r{Find @samp{<<My Target>>}}
827 [[file:~/xx.org::#my-custom-id]]            @r{Find entry with custom id}
828 @end smallexample
830 @seealso{
831 @uref{http://orgmode.org/manual/Hyperlinks.html#Hyperlinks, Chapter 4 of the
832 manual}}
834 @node TODO Items, Tags, Hyperlinks, Top
835 @chapter TODO Items
837 Org mode does not maintain TODO lists as separate documents@footnote{Of
838 course, you can make a document that contains only long lists of TODO items,
839 but this is not required.}.  Instead, TODO items are an integral part of the
840 notes file, because TODO items usually come up while taking notes!  With Org
841 mode, simply mark any entry in a tree as being a TODO item.  In this way,
842 information is not duplicated, and the entire context from which the TODO
843 item emerged is always present.
845 Of course, this technique for managing TODO items scatters them
846 throughout your notes file.  Org mode compensates for this by providing
847 methods to give you an overview of all the things that you have to do.
849 @menu
850 * Using TODO states::           Setting and switching states
851 * Multi-state workflows::       More than just on/off
852 * Progress logging::            Dates and notes for progress
853 * Priorities::                  Some things are more important than others
854 * Breaking down tasks::         Splitting a task into manageable pieces
855 * Checkboxes::                  Tick-off lists
856 @end menu
858 @node Using TODO states, Multi-state workflows, TODO Items, TODO Items
859 @section Using TODO states
861 Any headline becomes a TODO item when it starts with the word
862 @samp{TODO}, for example:
864 @smallexample
865 *** TODO Write letter to Sam Fortune
866 @end smallexample
868 @noindent
869 The most important commands to work with TODO entries are:
871 @table @kbd
872 @item C-c C-t
873 Rotate the TODO state of the current item among
875 @smallexample
876 ,-> (unmarked) -> TODO -> DONE --.
877 '--------------------------------'
878 @end smallexample
880 The same rotation can also be done ``remotely'' from the timeline and
881 agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
883 @item S-@key{right}@r{/}@key{left}
884 Select the following/preceding TODO state, similar to cycling.
885 @item C-c / t
886 View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds the
887 buffer, but shows all TODO items and the headings hierarchy above
888 them.
889 @item C-c a t
890 Show the global TODO list.  Collects the TODO items from all agenda files
891 (@pxref{Agenda Views}) into a single buffer.  @xref{Global TODO list}, for
892 more information.
893 @item S-M-@key{RET}
894 Insert a new TODO entry below the current one.
895 @end table
897 @noindent
898 Changing a TODO state can also trigger tag changes.  See the docstring of the
899 option @code{org-todo-state-tags-triggers} for details.
901 @node Multi-state workflows, Progress logging, Using TODO states, TODO Items
902 @section Multi-state workflows
904 You can use TODO keywords to indicate different @emph{sequential} states
905 in the process of working on an item, for example:
907 @smalllisp
908 (setq org-todo-keywords
909   '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
910 @end smalllisp
912 The vertical bar separates the TODO keywords (states that @emph{need
913 action}) from the DONE states (which need @emph{no further action}).  If
914 you don't provide the separator bar, the last state is used as the DONE
915 state.
916 With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
917 to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED.  
919 Sometimes you may want to use different sets of TODO keywords in
920 parallel.  For example, you may want to have the basic
921 @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
922 separate state indicating that an item has been canceled (so it is not
923 DONE, but also does not require action).  Your setup would then look
924 like this:
926 @smalllisp
927 (setq org-todo-keywords
928       '((sequence "TODO(t)" "|" "DONE(d)")
929         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
930         (sequence "|" "CANCELED(c)")))
931 @end smalllisp
933 The keywords should all be different, this helps Org mode to keep track of
934 which subsequence should be used for a given entry.  The example also shows
935 how to define keys for fast access of a particular state, by adding a letter
936 in parenthesis after each keyword---you will be prompted for the key after
937 @kbd{C-c C-t}.
939 To define TODO keywords that are valid only in a single file, use the
940 following text anywhere in the file.
942 @smallexample
943 #+TODO: TODO(t) | DONE(d)
944 #+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f)
945 #+TODO: | CANCELED(c)
946 @end smallexample
948 After changing one of these lines, use @kbd{C-c C-c} with the cursor still in
949 the line to make the changes known to Org mode.
951 @node Progress logging, Priorities, Multi-state workflows, TODO Items
952 @section Progress logging
954 Org mode can automatically record a timestamp and possibly a note when
955 you mark a TODO item as DONE, or even each time you change the state of
956 a TODO item.  This system is highly configurable; settings can be on a
957 per-keyword basis and can be localized to a file or even a subtree.  For
958 information on how to clock working time for a task, see @ref{Clocking
959 work time}.
961 @menu
962 * Closing items::               When was this entry marked DONE?
963 * Tracking TODO state changes::  When did the status change?
964 @end menu
966 @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
967 @unnumberedsubsec Closing items
969 The most basic logging is to keep track of @emph{when} a certain TODO
970 item was finished.  This is achieved with@footnote{The corresponding
971 in-buffer setting is: @code{#+STARTUP: logdone}}.
973 @smalllisp
974 (setq org-log-done 'time)
975 @end smalllisp
977 @noindent
978 Then each time you turn an entry from a TODO (not-done) state into any of the
979 DONE states, a line @samp{CLOSED: [timestamp]} will be inserted just after
980 the headline.  If you want to record a note along with the timestamp,
981 use@footnote{The corresponding in-buffer setting is: @code{#+STARTUP:
982 lognotedone}}
984 @smalllisp
985 (setq org-log-done 'note)
986 @end smalllisp
988 @noindent
989 You will then be prompted for a note, and that note will be stored below
990 the entry with a @samp{Closing Note} heading.
992 @node Tracking TODO state changes,  , Closing items, Progress logging
993 @unnumberedsubsec Tracking TODO state changes
995 You might want to keep track of TODO state changes.  You can either record
996 just a timestamp, or a time-stamped note for a change.  These records will be
997 inserted after the headline as an itemized list.  When taking a lot of notes,
998 you might want to get the notes out of the way into a drawer.  Customize the
999 variable @code{org-log-into-drawer} to get this behavior.
1001 For state logging, Org mode expects configuration on a per-keyword basis.
1002 This is achieved by adding special markers @samp{!} (for a timestamp) and
1003 @samp{@@} (for a note) in parentheses after each keyword.  For example:
1004 @smallexample
1005 #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
1006 @end smallexample
1007 @noindent
1008 will define TODO keywords and fast access keys, and also request that a time
1009 is recorded when the entry is set to DONE, and that a note is recorded when
1010 switching to WAIT or CANCELED.  The same syntax works also when setting
1011 @code{org-todo-keywords}.
1013 @node Priorities, Breaking down tasks, Progress logging, TODO Items
1014 @section Priorities
1016 If you use Org mode extensively, you may end up with enough TODO items that
1017 it starts to make sense to prioritize them.  Prioritizing can be done by
1018 placing a @emph{priority cookie} into the headline of a TODO item, like this
1020 @smallexample
1021 *** TODO [#A] Write letter to Sam Fortune
1022 @end smallexample
1024 @noindent
1025 Org mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}.
1026 @samp{A} is the highest, @samp{B} the default if none is given.  Priorities
1027 make a difference only in the agenda.
1029 @table @kbd
1030 @item @kbd{C-c ,}
1031 Set the priority of the current headline.  Press @samp{A}, @samp{B} or
1032 @samp{C} to select a priority, or @key{SPC} to remove the cookie.
1034 @item S-@key{up}
1035 @itemx S-@key{down}
1036 Increase/decrease priority of current headline
1037 @end table
1039 @node Breaking down tasks, Checkboxes, Priorities, TODO Items
1040 @section Breaking tasks down into subtasks
1042 It is often advisable to break down large tasks into smaller, manageable
1043 subtasks.  You can do this by creating an outline tree below a TODO item,
1044 with detailed subtasks on the tree.  To keep the overview over the fraction
1045 of subtasks that are already completed, insert either @samp{[/]} or
1046 @samp{[%]} anywhere in the headline.  These cookies will be updated each time
1047 the TODO status of a child changes, or when pressing @kbd{C-c C-c} on the
1048 cookie.  For example:
1050 @smallexample
1051 * Organize Party [33%]
1052 ** TODO Call people [1/2]
1053 *** TODO Peter
1054 *** DONE Sarah
1055 ** TODO Buy food
1056 ** DONE Talk to neighbor
1057 @end smallexample
1059 @node Checkboxes,  , Breaking down tasks, TODO Items
1060 @section Checkboxes
1062 Every item in a plain list (@pxref{Plain lists}) can be made into a checkbox
1063 by starting it with the string @samp{[ ]}.  Checkboxes are not included in
1064 the global TODO list, so they are often great to split a task into a number
1065 of simple steps.
1066 Here is an example of a checkbox list.
1068 @smallexample
1069 * TODO Organize party [1/3]
1070   - [-] call people [1/2]
1071     - [ ] Peter
1072     - [X] Sarah
1073   - [X] order food
1074   - [ ] think about what music to play
1075 @end smallexample
1077 Checkboxes work hierarchically, so if a checkbox item has children that
1078 are checkboxes, toggling one of the children checkboxes will make the
1079 parent checkbox reflect if none, some, or all of the children are
1080 checked.
1082 @noindent The following commands work with checkboxes:
1084 @table @kbd
1085 @item C-c C-c
1086 Toggle checkbox status or (with prefix arg) checkbox presence at point.
1087 @item M-S-@key{RET}
1088 Insert a new item with a checkbox.
1089 This works only if the cursor is already in a plain list item
1090 (@pxref{Plain lists}).
1091 @end table
1093 @seealso{
1094 @uref{http://orgmode.org/manual/TODO-Items.html#TODO-Items, Chapter 5 of the manual}@*
1095 @uref{http://orgmode.org/worg/org-tutorials/orgtutorial_dto.php, David
1096 O'Toole's introductory tutorial}@*
1097 @uref{http://members.optusnet.com.au/~charles57/GTD/gtd_workflow.html,
1098 Charles Cave's GTD setup}}
1100 @node Tags, Properties, TODO Items, Top
1101 @chapter Tags
1103 An excellent way to implement labels and contexts for cross-correlating
1104 information is to assign @i{tags} to headlines.  Org mode has extensive
1105 support for tags.
1107 Every headline can contain a list of tags; they occur at the end of the
1108 headline.  Tags are normal words containing letters, numbers, @samp{_}, and
1109 @samp{@@}.  Tags must be preceded and followed by a single colon, e.g.,
1110 @samp{:work:}.  Several tags can be specified, as in @samp{:work:urgent:}.
1111 Tags will by default be in bold face with the same color as the headline.
1113 @menu
1114 * Tag inheritance::             Tags use the tree structure of the outline
1115 * Setting tags::                How to assign tags to a headline
1116 * Tag searches::                Searching for combinations of tags
1117 * Tag searches::                Searching for combinations of tags
1118 @end menu
1120 @node Tag inheritance, Setting tags, Tags, Tags
1121 @section Tag inheritance
1123 @i{Tags} make use of the hierarchical structure of outline trees.  If a
1124 heading has a certain tag, all subheadings will inherit the tag as
1125 well.  For example, in the list
1127 @smallexample
1128 * Meeting with the French group      :work:
1129 ** Summary by Frank                  :boss:notes:
1130 *** TODO Prepare slides for him      :action:
1131 @end smallexample
1133 @noindent
1134 the final heading will have the tags @samp{:work:}, @samp{:boss:},
1135 @samp{:notes:}, and @samp{:action:} even though the final heading is not
1136 explicitly marked with those tags.  You can also set tags that all entries in
1137 a file should inherit just as if these tags were defined in a hypothetical
1138 level zero that surrounds the entire file.  Use a line like this@footnote{As
1139 with all these in-buffer settings, pressing @kbd{C-c C-c} activates any
1140 changes in the line.}:
1142 @smallexample
1143 #+FILETAGS: :Peter:Boss:Secret:
1144 @end smallexample
1146 @node Setting tags, Tag searches, Tag inheritance, Tags
1147 @section Setting tags
1149 Tags can simply be typed into the buffer at the end of a headline.
1150 After a colon, @kbd{M-@key{TAB}} offers completion on tags.  There is
1151 also a special command for inserting tags:
1153 @table @kbd
1154 @item C-c C-q
1155 Enter new tags for the current headline.  Org mode will either offer
1156 completion or a special single-key interface for setting tags, see
1157 below.  After pressing @key{RET}, the tags will be inserted and aligned
1158 to @code{org-tags-column}.  When called with a @kbd{C-u} prefix, all
1159 tags in the current buffer will be aligned to that column, just to make
1160 things look nice.
1161 @item C-c C-c
1162 When the cursor is in a headline, this does the same as @kbd{C-c C-q}.
1163 @end table
1165 Org will support tag insertion based on a @emph{list of tags}.  By
1166 default this list is constructed dynamically, containing all tags
1167 currently used in the buffer.  You may also globally specify a hard list
1168 of tags with the variable @code{org-tag-alist}.  Finally you can set
1169 the default tags for a given file with lines like
1171 @smallexample
1172 #+TAGS: @@work @@home @@tennisclub
1173 #+TAGS: laptop car pc sailboat
1174 @end smallexample
1176 By default Org mode uses the standard minibuffer completion facilities for
1177 entering tags.  However, it also implements another, quicker, tag selection
1178 method called @emph{fast tag selection}.  This allows you to select and
1179 deselect tags with just a single key press.  For this to work well you should
1180 assign unique letters to most of your commonly used tags.  You can do this
1181 globally by configuring the variable @code{org-tag-alist} in your
1182 @file{.emacs} file.  For example, you may find the need to tag many items in
1183 different files with @samp{:@@home:}.  In this case you can set something
1184 like:
1186 @smalllisp
1187 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
1188 @end smalllisp
1190 @noindent If the tag is only relevant to the file you are working on, then you
1191 can instead set the TAGS option line as:
1193 @smallexample
1194 #+TAGS: @@work(w)  @@home(h)  @@tennisclub(t)  laptop(l)  pc(p)
1195 @end smallexample
1197 @node Tag searches, Tag searches, Setting tags, Tags
1198 @section Tag groups
1200 @cindex group tags
1201 @cindex tags, groups
1202 In a set of mutually exclusive tags, the first tag can be defined as a
1203 @emph{group tag}.  When you search for a group tag, it will return matches
1204 for all members in the group.  In an agenda view, filtering by a group tag
1205 will display headlines tagged with at least one of the members of the
1206 group.  This makes tag searches and filters even more flexible.
1208 You can set group tags by inserting a colon between the group tag and other
1209 tags, like this:
1211 @example
1212 #+TAGS: @{ @@read : @@read_book  @@read_ebook @}
1213 @end example
1215 In this example, @samp{@@read} is a @emph{group tag} for a set of three
1216 tags: @samp{@@read}, @samp{@@read_book} and @samp{@@read_ebook}.
1218 You can also use the @code{:grouptags} keyword directly when setting
1219 @var{org-tag-alist}:
1221 @lisp
1222 (setq org-tag-alist '((:startgroup . nil) 
1223                       ("@@read" . nil)
1224                       (:grouptags . nil)
1225                       ("@@read_book" . nil)
1226                       ("@@read_ebook" . nil)
1227                       (:endgroup . nil)))
1228 @end lisp
1230 @kindex C-c C-x q
1231 @vindex org-group-tags
1232 If you want to ignore group tags temporarily, toggle group tags support
1233 with @command{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}.  If you
1234 want to disable tag groups completely, set @var{org-group-tags} to nil.
1236 @node Tag searches,  , Tag searches, Tags
1237 @section Tag searches
1239 Once a system of tags has been set up, it can be used to collect related
1240 information into special lists.
1242 @table @kbd
1243 @item C-c \
1244 @itemx C-c / m
1245 Create a sparse tree with all headlines matching a tags search.  With a
1246 @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
1247 @item C-c a m
1248 Create a global list of tag matches from all agenda files.
1249 @xref{Matching tags and properties}.
1250 @item C-c a M
1251 Create a global list of tag matches from all agenda files, but check
1252 only TODO items and force checking subitems (see variable
1253 @code{org-tags-match-list-sublevels}).
1254 @end table
1256 These commands all prompt for a match string which allows basic Boolean logic
1257 like @samp{+boss+urgent-project1}, to find entries with tags @samp{boss} and
1258 @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find entries
1259 which are tagged, like @samp{Kathy} or @samp{Sally}.  The full syntax of the
1260 search string is rich and allows also matching against TODO keywords, entry
1261 levels and properties.  For a complete description with many examples, see
1262 @ref{Matching tags and properties}.
1264 @seealso{
1265 @uref{http://orgmode.org/manual/Tags.html#Tags, Chapter 6 of the manual}@*
1266 @uref{http://sachachua.com/wp/2008/01/tagging-in-org-plus-bonus-code-for-timeclocks-and-tags/,
1267 Sacha Chua's article about tagging in Org-mode}}
1269 @node Properties, Dates and Times, Tags, Top
1270 @chapter Properties
1272 Properties are key-value pairs associated with an entry.  They live in a
1273 special drawer with the name @code{PROPERTIES}.  Each
1274 property is specified on a single line, with the key (surrounded by colons)
1275 first, and the value after it:
1277 @smallexample
1278 * CD collection
1279 ** Classic
1280 *** Goldberg Variations
1281     :PROPERTIES:
1282     :Title:     Goldberg Variations
1283     :Composer:  J.S. Bach
1284     :Publisher: Deutsche Grammophon
1285     :NDisks:    1
1286     :END:
1287 @end smallexample
1289 You may define the allowed values for a particular property @samp{:Xyz:}
1290 by setting a property @samp{:Xyz_ALL:}.  This special property is
1291 @emph{inherited}, so if you set it in a level 1 entry, it will apply to
1292 the entire tree.  When allowed values are defined, setting the
1293 corresponding property becomes easier and is less prone to typing
1294 errors.  For the example with the CD collection, we can predefine
1295 publishers and the number of disks in a box like this:
1297 @smallexample
1298 * CD collection
1299   :PROPERTIES:
1300   :NDisks_ALL:  1 2 3 4
1301   :Publisher_ALL: "Deutsche Grammophon" Philips EMI
1302   :END:
1303 @end smallexample
1304 or globally using @code{org-global-properties}, or file-wide like this:
1305 @smallexample
1306 #+PROPERTY: NDisks_ALL 1 2 3 4
1307 @end smallexample
1309 @table @kbd
1310 @item C-c C-x p
1311 Set a property.  This prompts for a property name and a value.
1312 @item C-c C-c d
1313 Remove a property from the current entry.
1314 @end table
1316 To create sparse trees and special lists with selection based on properties,
1317 the same commands are used as for tag searches (@pxref{Tag searches}).  The
1318 syntax for the search string is described in @ref{Matching tags and
1319 properties}.
1321 @table @kbd
1322 @end table
1324 @seealso{
1325 @uref{http://orgmode.org/manual/Properties-and-Columns.html#Properties-and-Columns,
1326 Chapter 7 of the manual}@*
1327 @uref{http://orgmode.org/worg/org-tutorials/org-column-view-tutorial.php,Bastien
1328 Guerry's column view tutorial}}
1330 @node Dates and Times, Capture - Refile - Archive, Properties, Top
1331 @chapter Dates and Times
1333 To assist project planning, TODO items can be labeled with a date and/or
1334 a time.  The specially formatted string carrying the date and time
1335 information is called a @emph{timestamp} in Org mode.
1337 @menu
1338 * Timestamps::                  Assigning a time to a tree entry
1339 * Creating timestamps::         Commands which insert timestamps
1340 * Deadlines and scheduling::    Planning your work
1341 * Clocking work time::          Tracking how long you spend on a task
1342 @end menu
1345 @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
1346 @section Timestamps
1348 A timestamp is a specification of a date (possibly with a time or a range of
1349 times) in a special format, either @samp{<2003-09-16 Tue>} or
1350 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue 12:00-12:30>}.  A
1351 timestamp can appear anywhere in the headline or body of an Org tree entry.
1352 Its presence causes entries to be shown on specific dates in the agenda
1353 (@pxref{Weekly/daily agenda}).  We distinguish:
1355 @noindent @b{Plain timestamp; Event; Appointment}@*
1356 A simple timestamp just assigns a date/time to an item.  This is just
1357 like writing down an appointment or event in a paper agenda.
1359 @smallexample
1360 * Meet Peter at the movies
1361   <2006-11-01 Wed 19:15>
1362 * Discussion on climate change
1363   <2006-11-02 Thu 20:00-22:00>
1364 @end smallexample
1366 @noindent @b{Timestamp with repeater interval}@*
1367 A timestamp may contain a @emph{repeater interval}, indicating that it
1368 applies not only on the given date, but again and again after a certain
1369 interval of N days (d), weeks (w), months (m), or years (y).  The
1370 following will show up in the agenda every Wednesday:
1371 @smallexample
1372 * Pick up Sam at school
1373   <2007-05-16 Wed 12:30 +1w>
1374 @end smallexample
1376 @noindent @b{Diary-style sexp entries}@*
1377 For more complex date specifications, Org mode supports using the
1378 special sexp diary entries implemented in the Emacs calendar/diary
1379 package.  For example
1380 @smallexample
1381 * The nerd meeting on every 2nd Thursday of the month
1382   <%%(diary-float t 4 2)>
1383 @end smallexample
1385 @noindent @b{Time/Date range}@*
1386 Two timestamps connected by @samp{--} denote a range.
1387 @smallexample
1388 ** Meeting in Amsterdam
1389    <2004-08-23 Mon>--<2004-08-26 Thu>
1390 @end smallexample
1392 @noindent @b{Inactive timestamp}@*
1393 Just like a plain timestamp, but with square brackets instead of
1394 angular ones.  These timestamps are inactive in the sense that they do
1395 @emph{not} trigger an entry to show up in the agenda.
1397 @smallexample
1398 * Gillian comes late for the fifth time
1399   [2006-11-01 Wed]
1400 @end smallexample
1403 @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
1404 @section Creating timestamps
1406 For Org mode to recognize timestamps, they need to be in the specific
1407 format.  All commands listed below produce timestamps in the correct
1408 format.
1410 @table @kbd
1411 @item C-c .
1412 Prompt for a date and insert a corresponding timestamp.  When the cursor is
1413 at an existing timestamp in the buffer, the command is used to modify this
1414 timestamp instead of inserting a new one.  When this command is used twice in
1415 succession, a time range is inserted.  With a prefix, also add the current
1416 time. 
1418 @item C-c !
1419 Like @kbd{C-c .}, but insert an inactive timestamp that will not cause
1420 an agenda entry.
1422 @item S-@key{left}@r{/}@key{right}
1423 Change date at cursor by one day.
1425 @item S-@key{up}@r{/}@key{down}
1426 Change the item under the cursor in a timestamp.  The cursor can be on a
1427 year, month, day, hour or minute.  When the timestamp contains a time range
1428 like @samp{15:30-16:30}, modifying the first time will also shift the second,
1429 shifting the time block with constant length.  To change the length, modify
1430 the second time.
1431 @end table
1433 When Org mode prompts for a date/time, it will accept any string containing
1434 some date and/or time information, and intelligently interpret the string,
1435 deriving defaults for unspecified information from the current date and time.
1436 You can also select a date in the pop-up calendar.  See the manual for more
1437 information on how exactly the date/time prompt works.
1439 @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
1440 @section Deadlines and scheduling
1442 A timestamp may be preceded by special keywords to facilitate planning:
1444 @noindent @b{DEADLINE}@*
1445 Meaning: the task (most likely a TODO item, though not necessarily) is supposed
1446 to be finished on that date.
1447 @table @kbd
1448 @item C-c C-d
1449 Insert @samp{DEADLINE} keyword along with a stamp, in the line following the
1450 headline.
1451 @end table
1453 On the deadline date, the task will be listed in the agenda.  In
1454 addition, the agenda for @emph{today} will carry a warning about the
1455 approaching or missed deadline, starting
1456 @code{org-deadline-warning-days} before the due date, and continuing
1457 until the entry is marked DONE.  An example:
1459 @smallexample
1460 *** TODO write article about the Earth for the Guide
1461     The editor in charge is [[bbdb:Ford Prefect]]
1462     DEADLINE: <2004-02-29 Sun>
1463 @end smallexample
1466 @noindent @b{SCHEDULED}@*
1467 Meaning: you are @i{planning to start working} on that task on the given
1468 date@footnote{This is quite different from what is normally understood by
1469 @i{scheduling a meeting}, which is done in Org-mode by just inserting a time
1470 stamp without keyword.}.
1472 @table @kbd
1473 @item C-c C-s
1474 Insert @samp{SCHEDULED} keyword along with a stamp, in the line following the
1475 headline.
1476 @end table
1478 The headline will be listed under the given date@footnote{It will still
1479 be listed on that date after it has been marked DONE.  If you don't like
1480 this, set the variable @code{org-agenda-skip-scheduled-if-done}.}.  In
1481 addition, a reminder that the scheduled date has passed will be present
1482 in the compilation for @emph{today}, until the entry is marked DONE.
1483 I.e.@: the task will automatically be forwarded until completed.
1485 @smallexample
1486 *** TODO Call Trillian for a date on New Years Eve.
1487     SCHEDULED: <2004-12-25 Sat>
1488 @end smallexample
1490 Some tasks need to be repeated again and again.  Org mode helps to
1491 organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
1492 or plain timestamp.  In the following example
1493 @smallexample
1494 ** TODO Pay the rent
1495    DEADLINE: <2005-10-01 Sat +1m>
1496 @end smallexample
1497 @noindent
1498 the @code{+1m} is a repeater; the intended interpretation is that the task
1499 has a deadline on <2005-10-01> and repeats itself every (one) month starting
1500 from that time.
1502 @node Clocking work time,  , Deadlines and scheduling, Dates and Times
1503 @section Clocking work time
1505 Org mode allows you to clock the time you spend on specific tasks in a
1506 project.
1508 @table @kbd
1509 @item C-c C-x C-i
1510 Start the clock on the current item (clock-in).  This inserts the CLOCK
1511 keyword together with a timestamp.  When called with a @kbd{C-u} prefix
1512 argument, select the task from a list of recently clocked tasks.
1514 @item C-c C-x C-o
1515 Stop the clock (clock-out).  This inserts another timestamp at the same
1516 location where the clock was last started.  It also directly computes
1517 the resulting time in inserts it after the time range as @samp{=>
1518 HH:MM}.
1519 @item C-c C-x C-e
1520 Update the effort estimate for the current clock task.
1521 @item C-c C-x C-x
1522 Cancel the current clock.  This is useful if a clock was started by
1523 mistake, or if you ended up working on something else.
1524 @item C-c C-x C-j
1525 Jump to the entry that contains the currently running clock.  With a
1526 @kbd{C-u} prefix arg, select the target task from a list of recently clocked
1527 tasks.
1528 @item C-c C-x C-r
1529 Insert a dynamic block containing a clock
1530 report as an Org-mode table into the current file.  When the cursor is
1531 at an existing clock table, just update it.
1532 @smallexample
1533 #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
1534 #+END: clocktable
1535 @end smallexample
1536 @noindent
1537 For details about how to customize this view, see @uref{http://orgmode.org/manual/Clocking-work-time.html#Clocking-work-time,the manual}.
1538 @item C-c C-c
1539 Update dynamic block at point.  The cursor needs to be in the
1540 @code{#+BEGIN} line of the dynamic block.
1541 @end table
1543 The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
1544 the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
1545 worked on or closed during a day.
1547 @seealso{
1548 @uref{http://orgmode.org/manual/Dates-and-Times.html#Dates-and-Times,
1549 Chapter 8 of the manual}@*
1550 @uref{http://members.optusnet.com.au/~charles57/GTD/org_dates/, Charles
1551 Cave's Date and Time tutorial}@*
1552 @uref{http://doc.norang.ca/org-mode.html#Clocking, Bernt Hansen's clocking workflow}}
1554 @node Capture - Refile - Archive, Agenda Views, Dates and Times, Top
1555 @chapter Capture - Refile - Archive
1557 An important part of any organization system is the ability to quickly
1558 capture new ideas and tasks, and to associate reference material with them.
1559 Org defines a capture process to create tasks.  It stores files related to a
1560 task (@i{attachments}) in a special directory.  Once in the system, tasks and
1561 projects need to be moved around.  Moving completed project trees to an
1562 archive file keeps the system compact and fast.
1564 @menu
1565 * Capture::                     Capturing new stuff
1566 * Refile and copy::             Moving a tree from one place to another
1567 * Archiving::                   What to do with finished projects
1568 @end menu
1570 @node Capture, Refile and copy, Capture - Refile - Archive, Capture - Refile - Archive
1571 @section Capture
1573 Org's method for capturing new items is heavily inspired by John Wiegley
1574 excellent @file{remember.el} package.  It lets you store quick notes with
1575 little interruption of your work flow.  Org lets you define templates for new
1576 entries and associate them with different targets for storing notes.
1578 @menu
1579 * Setting up a capture location::  Where notes will be stored
1580 * Using capture::               Commands to invoke and terminate capture
1581 * Capture templates::           Define the outline of different note types
1582 @end menu
1584 @node Setting up a capture location, Using capture, Capture, Capture
1585 @unnumberedsubsec Setting up a capture location
1587 The following customization sets a default target@footnote{Using capture
1588 templates, you can define more fine-grained capture locations, see
1589 @ref{Capture templates}.} file for notes, and defines a global
1590 key@footnote{Please select your own key, @kbd{C-c c} is only a suggestion.}
1591 for capturing new stuff.
1593 @example
1594 (setq org-default-notes-file (concat org-directory "/notes.org"))
1595 (define-key global-map "\C-cc" 'org-capture)
1596 @end example
1598 @node Using capture, Capture templates, Setting up a capture location, Capture
1599 @unnumberedsubsec Using capture
1601 @table @kbd
1602 @item C-c c
1603 Start a capture process.  You will be placed into a narrowed indirect buffer
1604 to edit the item.
1605 @item C-c C-c
1606 Once you are done entering information into the capture buffer, 
1607 @kbd{C-c C-c} will return you to the window configuration before the capture
1608 process, so that you can resume your work without further distraction.
1609 @item C-c C-w
1610 Finalize by moving the entry to a refile location (@pxref{Refile and copy}).
1611 @item C-c C-k
1612 Abort the capture process and return to the previous state.
1613 @end table
1615 @node Capture templates,  , Using capture, Capture
1616 @unnumberedsubsec Capture templates
1618 You can use templates to generate different types of capture notes, and to
1619 store them in different places.  For example, if you would like
1620 to store new tasks under a heading @samp{Tasks} in file @file{TODO.org}, and
1621 journal entries in a date tree in @file{journal.org} you could
1622 use:
1624 @smallexample
1625 (setq org-capture-templates
1626  '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
1627         "* TODO %?\n  %i\n  %a")
1628    ("j" "Journal" entry (file+datetree "~/org/journal.org")
1629         "* %?\nEntered on %U\n  %i\n  %a")))
1630 @end smallexample
1632 @noindent In these entries, the first string is the key to reach the
1633 template, the second is a short description.  Then follows the type of the
1634 entry and a definition of the target location for storing the note.  Finally,
1635 the template itself, a string with %-escapes to fill in information based on
1636 time and context.
1638 When you call @kbd{M-x org-capture}, Org will prompt for a key to select the
1639 template (if you have more than one template) and then prepare the buffer like
1640 @smallexample
1641 * TODO
1642   [[file:@var{link to where you were when initiating capture}]]
1643 @end smallexample
1645 @noindent
1646 During expansion of the template, special @kbd{%}-escapes@footnote{If you
1647 need one of these sequences literally, escape the @kbd{%} with a backslash.}
1648 allow dynamic insertion of content.  Here is a small selection of the
1649 possibilities, consult the manual for more.
1650 @smallexample
1651 %a          @r{annotation, normally the link created with @code{org-store-link}}
1652 %i          @r{initial content, the region when capture is called with C-u.}
1653 %t          @r{timestamp, date only}
1654 %T          @r{timestamp with date and time}
1655 %u, %U      @r{like the above, but inactive timestamps}
1656 @end smallexample
1658 @node Refile and copy, Archiving, Capture, Capture - Refile - Archive
1659 @section Refile and copy
1661 When reviewing the captured data, you may want to refile or copy some of the
1662 entries into a different list, for example into a project.  Cutting, finding
1663 the right location, and then pasting the note is cumbersome.  To simplify
1664 this process, you can use the following special command:
1666 @table @kbd
1667 @item C-c M-x
1668 Copy the entry or region at point.  This command behaves like
1669 @code{org-refile}, except that the original note will not be deleted.
1670 @item C-c C-w
1671 Refile the entry or region at point.  This command offers possible locations
1672 for refiling the entry and lets you select one with completion.  The item (or
1673 all items in the region) is filed below the target heading as a subitem.@*
1674 By default, all level 1 headlines in the current buffer are considered to be
1675 targets, but you can have more complex definitions across a number of files.
1676 See the variable @code{org-refile-targets} for details.
1677 @item C-u C-c C-w
1678 Use the refile interface to jump to a heading.
1679 @item C-u C-u C-c C-w
1680 Jump to the location where @code{org-refile} last moved a tree to.
1681 @end table
1683 @node Archiving,  , Refile and copy, Capture - Refile - Archive
1684 @section Archiving
1686 When a project represented by a (sub)tree is finished, you may want
1687 to move the tree out of the way and to stop it from contributing to the
1688 agenda.  Archiving is important to keep your working files compact and global
1689 searches like the construction of agenda views fast.
1690 The most common archiving action is to move a project tree to another file,
1691 the archive file.
1693 @table @kbd
1694 @item C-c C-x C-a
1695 Archive the current entry using the command specified in the variable
1696 @code{org-archive-default-command}.
1697 @item C-c C-x C-s@ @r{or short} @ C-c $
1698 Archive the subtree starting at the cursor position to the location
1699 given by @code{org-archive-location}.
1700 @end table
1702 The default archive location is a file in the same directory as the
1703 current file, with the name derived by appending @file{_archive} to the
1704 current file name.  For information and examples on how to change this,
1705 see the documentation string of the variable
1706 @code{org-archive-location}.  There is also an in-buffer option for
1707 setting this variable, for example
1709 @smallexample
1710 #+ARCHIVE: %s_done::
1711 @end smallexample
1713 @seealso{
1714 @uref{http://orgmode.org/manual/Capture-_002d-Refile-_002d-Archive.html#Capture-_002d-Refile-_002d-Archive,
1715 Chapter 9 of the manual}@*
1716 @uref{http://orgmode.org/worg/org-tutorials/org-protocol-custom-handler.php,
1717 Sebastian Rose's tutorial for capturing from a web browser}}@uref{}@*
1719 @node Agenda Views, Markup, Capture - Refile - Archive, Top
1720 @chapter Agenda Views
1722 Due to the way Org works, TODO items, time-stamped items, and tagged
1723 headlines can be scattered throughout a file or even a number of files.  To
1724 get an overview of open action items, or of events that are important for a
1725 particular date, this information must be collected, sorted and displayed in
1726 an organized way.  There are several different views, see below.
1728 The extracted information is displayed in a special @emph{agenda buffer}.
1729 This buffer is read-only, but provides commands to visit the corresponding
1730 locations in the original Org files, and even to edit these files remotely.
1731 Remote editing from the agenda buffer means, for example, that you can
1732 change the dates of deadlines and appointments from the agenda buffer.
1733 The commands available in the Agenda buffer are listed in @ref{Agenda
1734 commands}.
1736 @menu
1737 * Agenda files::                Files being searched for agenda information
1738 * Agenda dispatcher::           Keyboard access to agenda views
1739 * Built-in agenda views::       What is available out of the box?
1740 * Agenda commands::             Remote editing of Org trees
1741 * Custom agenda views::         Defining special searches and views
1742 @end menu
1744 @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
1745 @section Agenda files
1747 The information to be shown is normally collected from all @emph{agenda
1748 files}, the files listed in the variable
1749 @code{org-agenda-files}.
1751 @table @kbd
1752 @item C-c [
1753 Add current file to the list of agenda files.  The file is added to
1754 the front of the list.  If it was already in the list, it is moved to
1755 the front.  With a prefix argument, file is added/moved to the end.
1756 @item C-c ]
1757 Remove current file from the list of agenda files.
1758 @item C-,
1759 Cycle through agenda file list, visiting one file after the other.
1760 @end table
1762 @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
1763 @section The agenda dispatcher
1764 The views are created through a dispatcher, which should be bound to a
1765 global key---for example @kbd{C-c a} (@pxref{Installation}).  After
1766 pressing @kbd{C-c a}, an additional letter is required to execute a
1767 command:
1768 @table @kbd
1769 @item a
1770 The calendar-like agenda (@pxref{Weekly/daily agenda}).
1771 @item t @r{/} T
1772 A list of all TODO items (@pxref{Global TODO list}).
1773 @item m @r{/} M
1774 A list of headlines matching a TAGS expression (@pxref{Matching
1775 tags and properties}).
1776 @item L
1777 The timeline view for the current buffer (@pxref{Timeline}).
1778 @item s
1779 A list of entries selected by a boolean expression of keywords
1780 and/or regular expressions that must or must not occur in the entry.
1781 @end table
1783 @node Built-in agenda views, Agenda commands, Agenda dispatcher, Agenda Views
1784 @section The built-in agenda views
1786 @menu
1787 * Weekly/daily agenda::         The calendar page with current tasks
1788 * Global TODO list::            All unfinished action items
1789 * Matching tags and properties::  Structured information with fine-tuned search
1790 * Timeline::                    Time-sorted view for single file
1791 * Search view::                 Find entries by searching for text
1792 @end menu
1794 @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
1795 @subsection The weekly/daily agenda
1797 The purpose of the weekly/daily @emph{agenda} is to act like a page of a
1798 paper agenda, showing all the tasks for the current week or day.
1800 @table @kbd
1801 @item C-c a a
1802 Compile an agenda for the current week from a list of Org files.  The agenda
1803 shows the entries for each day.
1804 @end table
1806 Emacs contains the calendar and diary by Edward M. Reingold.  Org-mode
1807 understands the syntax of the diary and allows you to use diary sexp entries
1808 directly in Org files:
1810 @smallexample
1811 * Birthdays and similar stuff
1812 #+CATEGORY: Holiday
1813 %%(org-calendar-holiday)   ; special function for holiday names
1814 #+CATEGORY: Ann
1815 %%(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
1816 %%(diary-anniversary 10  2 1869) Mahatma Gandhi would be %d years old
1817 @end smallexample
1819 Org can interact with Emacs appointments notification facility.  To add all
1820 the appointments of your agenda files, use the command
1821 @code{org-agenda-to-appt}.  See the docstring for details.
1823 @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
1824 @subsection The global TODO list
1826 The global TODO list contains all unfinished TODO items formatted and
1827 collected into a single place.  Remote editing of TODO items lets you
1828 can change the state of a TODO entry with a single key press.  The commands
1829 available in the TODO list are described in @ref{Agenda commands}.
1831 @table @kbd
1832 @item C-c a t
1833 Show the global TODO list.  This collects the TODO items from all
1834 agenda files (@pxref{Agenda Views}) into a single buffer.
1835 @item C-c a T
1836 Like the above, but allows selection of a specific TODO keyword. 
1837 @end table
1839 @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
1840 @subsection Matching tags and properties
1842 If headlines in the agenda files are marked with @emph{tags} (@pxref{Tags}),
1843 or have properties (@pxref{Properties}), you can select headlines
1844 based on this metadata and collect them into an agenda buffer.  The match
1845 syntax described here also applies when creating sparse trees with @kbd{C-c /
1846 m}.  The commands available in the tags list are described in @ref{Agenda
1847 commands}.
1849 @table @kbd
1850 @item C-c a m
1851 Produce a list of all headlines that match a given set of tags.  The
1852 command prompts for a selection criterion, which is a boolean logic
1853 expression with tags, like @samp{+work+urgent-withboss} or
1854 @samp{work|home} (@pxref{Tags}).  If you often need a specific search,
1855 define a custom command for it (@pxref{Agenda dispatcher}).
1856 @item C-c a M
1857 Like @kbd{C-c a m}, but only select headlines that are also TODO items.
1858 @end table
1860 @subsubheading Match syntax
1862 A search string can use Boolean operators @samp{&} for AND and @samp{|} for
1863 OR.  @samp{&} binds more strongly than @samp{|}.  Parentheses are currently
1864 not implemented.  Each element in the search is either a tag, a regular
1865 expression matching tags, or an expression like @code{PROPERTY OPERATOR
1866 VALUE} with a comparison operator, accessing a property value.  Each element
1867 may be preceded by @samp{-}, to select against it, and @samp{+} is syntactic
1868 sugar for positive selection.  The AND operator @samp{&} is optional when
1869 @samp{+} or @samp{-} is present.  Here are some examples, using only tags.
1871 @table @samp
1872 @item +work-boss
1873 Select headlines tagged @samp{:work:}, but discard those also tagged
1874 @samp{:boss:}.
1875 @item work|laptop
1876 Selects lines tagged @samp{:work:} or @samp{:laptop:}.
1877 @item work|laptop+night
1878 Like before, but require the @samp{:laptop:} lines to be tagged also
1879 @samp{:night:}.
1880 @end table
1882 You may also test for properties at the same
1883 time as matching tags, see the manual for more information.
1885 @node Timeline, Search view, Matching tags and properties, Built-in agenda views
1886 @subsection Timeline for a single file
1888 The timeline summarizes all time-stamped items from a single Org mode
1889 file in a @emph{time-sorted view}.  The main purpose of this command is
1890 to give an overview over events in a project.
1892 @table @kbd
1893 @item C-c a L
1894 Show a time-sorted view of the Org file, with all time-stamped items.
1895 When called with a @kbd{C-u} prefix, all unfinished TODO entries
1896 (scheduled or not) are also listed under the current date.
1897 @end table
1899 @node Search view,  , Timeline, Built-in agenda views
1900 @subsection Search view
1902 This agenda view is a general text search facility for Org mode entries.
1903 It is particularly useful to find notes.
1905 @table @kbd
1906 @item C-c a s
1907 This is a special search that lets you select entries by matching a substring
1908 or specific words using a boolean logic.
1909 @end table
1910 For example, the search string @samp{computer equipment} will find entries
1911 that contain @samp{computer equipment} as a substring. 
1912 Search view can also search for specific keywords in the entry, using Boolean
1913 logic.  The search string @samp{+computer +wifi -ethernet -@{8\.11[bg]@}}
1914 will search for note entries that contain the keywords @code{computer}
1915 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
1916 not matched by the regular expression @code{8\.11[bg]}, meaning to
1917 exclude both 8.11b and 8.11g. 
1919 Note that in addition to the agenda files, this command will also search
1920 the files listed in @code{org-agenda-text-search-extra-files}.
1922 @node Agenda commands, Custom agenda views, Built-in agenda views, Agenda Views
1923 @section Commands in the agenda buffer
1925 Entries in the agenda buffer are linked back to the Org file or diary
1926 file where they originate.  Commands are provided to show and jump to the
1927 original entry location, and to edit the Org files ``remotely'' from
1928 the agenda buffer.  This is just a selection of the many commands, explore
1929 the @code{Agenda} menu and the manual for a complete list.
1931 @table @kbd
1932 @tsubheading{Motion}
1933 @item n
1934 Next line (same as @key{up} and @kbd{C-p}).
1935 @item p
1936 Previous line (same as @key{down} and @kbd{C-n}).
1937 @tsubheading{View/Go to Org file}
1938 @item mouse-3
1939 @itemx @key{SPC}
1940 Display the original location of the item in another window.
1941 With prefix arg, make sure that the entire entry is made visible in the
1942 outline, not only the heading.
1944 @itemx @key{TAB}
1945 Go to the original location of the item in another window.  Under Emacs
1946 22, @kbd{mouse-1} will also work for this.
1948 @itemx @key{RET}
1949 Go to the original location of the item and delete other windows.
1952 @tsubheading{Change display}
1953 @item o
1954 Delete other windows.
1956 @item d @r{/} w
1957 Switch to day/week view. 
1959 @item f @r{and} b
1960 Go forward/backward in time to display the following
1961 @code{org-agenda-current-span} days.  For example, if the display covers a
1962 week, switch to the following/previous week.
1964 @item .
1965 Go to today.
1967 @item j
1968 Prompt for a date and go there.
1970 @item v l @ @r{or short} @ l
1971 Toggle Logbook mode.  In Logbook mode, entries that were marked DONE while
1972 logging was on (variable @code{org-log-done}) are shown in the agenda, as are
1973 entries that have been clocked on that day.  When called with a @kbd{C-u}
1974 prefix, show all possible logbook entries, including state changes.
1976 @item r @r{or} g
1977 Recreate the agenda buffer, to reflect the changes.
1978 @item s
1979 Save all Org buffers in the current Emacs session, and also the locations of
1980 IDs.
1982 @tsubheading{Secondary filtering and query editing}
1984 @item /
1985 Filter the current agenda view with respect to a tag.  You are prompted for a
1986 letter to select a tag.  Press @samp{-} first to select against the tag.
1988 @item \
1989 Narrow the current agenda filter by an additional condition.
1991 @tsubheading{Remote editing (see the manual for many more commands)}
1993 @item 0--9
1994 Digit argument.
1996 @item t
1997 Change the TODO state of the item, in the agenda and in the
1998 org file.
2000 @item C-k
2001 Delete the current agenda item along with the entire subtree belonging
2002 to it in the original Org file.
2004 @item C-c C-w
2005 Refile the entry at point.
2007 @item C-c C-x C-a @ @r{or short} @ a
2008 Archive the subtree corresponding to the entry at point using the default
2009 archiving command set in @code{org-archive-default-command}.
2011 @item C-c C-x C-s @ @r{or short} @ $
2012 Archive the subtree corresponding to the current headline.
2014 @item C-c C-s
2015 Schedule this item, with prefix arg remove the scheduling timestamp
2017 @item C-c C-d
2018 Set a deadline for this item, with prefix arg remove the deadline.
2020 @item S-@key{right} @r{and} S-@key{left}
2021 Change the timestamp associated with the current line by one day.
2023 @item I
2024 Start the clock on the current item.
2026 @item O / X
2027 Stop/cancel the previously started clock.
2029 @item J
2030 Jump to the running clock in another window.
2031 @end table
2033 @node Custom agenda views,  , Agenda commands, Agenda Views
2034 @section Custom agenda views
2036 The main application of custom searches is the definition of keyboard
2037 shortcuts for frequently used searches, either creating an agenda
2038 buffer, or a sparse tree (the latter covering of course only the current
2039 buffer).
2040 Custom commands are configured in the variable
2041 @code{org-agenda-custom-commands}.  You can customize this variable, for
2042 example by pressing @kbd{C-c a C}.  You can also directly set it with
2043 Emacs Lisp in @file{.emacs}.  The following example contains all valid
2044 search types:
2046 @smalllisp
2047 @group
2048 (setq org-agenda-custom-commands
2049       '(("w" todo "WAITING")
2050         ("u" tags "+boss-urgent")
2051         ("v" tags-todo "+boss-urgent")))
2052 @end group
2053 @end smalllisp
2055 @noindent
2056 The initial string in each entry defines the keys you have to press after the
2057 dispatcher command @kbd{C-c a} in order to access the command.  Usually this
2058 will be just a single character.  The second parameter is the search type,
2059 followed by the string or regular expression to be used for the matching.
2060 The example above will therefore define:
2062 @table @kbd
2063 @item C-c a w
2064 as a global search for TODO entries with @samp{WAITING} as the TODO
2065 keyword
2066 @item C-c a u
2067 as a global tags search for headlines marked @samp{:boss:} but not
2068 @samp{:urgent:}
2069 @item C-c a v
2070 as the same search as @kbd{C-c a u}, but limiting the search to
2071 headlines that are also TODO items
2072 @end table
2074 @seealso{
2075 @uref{http://orgmode.org/manual/Agenda-Views.html#Agenda-Views, Chapter 10 of
2076 the manual}@*
2077 @uref{http://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.php,
2078 Mat Lundin's tutorial about custom agenda commands}@*
2079 @uref{http://www.newartisans.com/2007/08/using-org-mode-as-a-day-planner.html,
2080 John Wiegley's setup}}
2082 @node Markup, Exporting, Agenda Views, Top
2083 @chapter Markup for rich export
2085 When exporting Org-mode documents, the exporter tries to reflect the
2086 structure of the document as accurately as possible in the backend.  Since
2087 export targets like HTML, @LaTeX{}, or DocBook allow much richer formatting,
2088 Org mode has rules on how to prepare text for rich export.  This section
2089 summarizes the markup rules used in an Org-mode buffer.
2091 @menu
2092 * Structural markup elements::  The basic structure as seen by the exporter
2093 * Images and tables::           Tables and Images will be included
2094 * Literal examples::            Source code examples with special formatting
2095 * Include files::               Include additional files into a document
2096 * Embedded @LaTeX{}::           @LaTeX{} can be freely used inside Org documents
2097 @end menu
2099 @node Structural markup elements, Images and tables, Markup, Markup
2100 @section Structural markup elements
2102 @menu
2103 * Document title::              Where the title is taken from
2104 * Headings and sections::       The document structure as seen by the exporter
2105 * Table of contents::           The if and where of the table of contents
2106 * Paragraphs::                  Paragraphs
2107 * Emphasis and monospace::      Bold, italic, etc.
2108 * Comment lines::               What will *not* be exported
2109 @end menu
2111 @node Document title, Headings and sections, Structural markup elements, Structural markup elements
2112 @subheading Document title
2114 @noindent
2115 The title of the exported document is taken from the special line
2117 @smallexample
2118 #+TITLE: This is the title of the document
2119 @end smallexample
2121 @node Headings and sections, Table of contents, Document title, Structural markup elements
2122 @subheading Headings and sections
2124 The outline structure of the document as described in @ref{Document
2125 Structure}, forms the basis for defining sections of the exported document.
2126 However, since the outline structure is also used for (for example) lists of
2127 tasks, only the first three outline levels will be used as headings.  Deeper
2128 levels will become itemized lists.  You can change the location of this
2129 switch globally by setting the variable @code{org-export-headline-levels}, or on a
2130 per-file basis with a line
2132 @smallexample
2133 #+OPTIONS: H:4
2134 @end smallexample
2136 @node Table of contents, Paragraphs, Headings and sections, Structural markup elements
2137 @subheading Table of contents
2139 The table of contents is normally inserted directly before the first headline
2140 of the file.
2142 @smallexample
2143 #+OPTIONS: toc:2          (only to two levels in TOC)
2144 #+OPTIONS: toc:nil        (no TOC at all)
2145 @end smallexample
2147 @node Paragraphs, Emphasis and monospace, Table of contents, Structural markup elements
2148 @subheading Paragraphs, line breaks, and quoting
2150 Paragraphs are separated by at least one empty line.  If you need to enforce
2151 a line break within a paragraph, use @samp{\\} at the end of a line.
2153 To keep the line breaks in a region, but otherwise use normal formatting, you
2154 can use this construct, which can also be used to format poetry.
2156 @smallexample
2157 #+BEGIN_VERSE
2158  Great clouds overhead
2159  Tiny black birds rise and fall
2160  Snow covers Emacs
2162      -- AlexSchroeder
2163 #+END_VERSE
2164 @end smallexample
2166 When quoting a passage from another document, it is customary to format this
2167 as a paragraph that is indented on both the left and the right margin.  You
2168 can include quotations in Org-mode documents like this:
2170 @smallexample
2171 #+BEGIN_QUOTE
2172 Everything should be made as simple as possible,
2173 but not any simpler -- Albert Einstein
2174 #+END_QUOTE
2175 @end smallexample
2177 If you would like to center some text, do it like this:
2178 @smallexample
2179 #+BEGIN_CENTER
2180 Everything should be made as simple as possible, \\
2181 but not any simpler
2182 #+END_CENTER
2183 @end smallexample
2185 @node Emphasis and monospace, Comment lines, Paragraphs, Structural markup elements
2186 @subheading Emphasis and monospace
2188 You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
2189 and @code{~verbatim~}, and, if you must, @samp{+strike-through+}.  Text
2190 in the code and verbatim string is not processed for Org-mode specific
2191 syntax, it is exported verbatim.  To insert a horizontal rules, use a line 
2192 consisting of only dashes, and at least 5 of them.
2194 @node Comment lines,  , Emphasis and monospace, Structural markup elements
2195 @subheading Comment lines
2197 Lines starting with zero or more whitespace characters followed by @samp{#}
2198 are treated as comments and will never be exported.  Also entire subtrees
2199 starting with the word @samp{COMMENT} will never be exported.  Finally,
2200 regions surrounded by @samp{#+BEGIN_COMMENT} ... @samp{#+END_COMMENT} will
2201 not be exported.
2203 @table @kbd
2204 @item C-c ;
2205 Toggle the COMMENT keyword at the beginning of an entry.
2206 @end table
2208 @node Images and tables, Literal examples, Structural markup elements, Markup
2209 @section Images and Tables
2211 For Org mode tables, the lines before the first horizontal separator line
2212 will become table header lines.  You can use the following lines somewhere
2213 before the table to assign a caption and a label for cross references, and in
2214 the text you can refer to the object with @code{\ref@{tab:basic-data@}}:
2216 @smallexample
2217 #+CAPTION: This is the caption for the next table (or link)
2218 #+LABEL:   tbl:basic-data
2219    | ... | ...|
2220    |-----|----|
2221 @end smallexample
2223 Some backends (HTML, @LaTeX{}, and DocBook) allow you to directly include
2224 images into the exported document.  Org does this, if a link to an image
2225 files does not have a description part, for example @code{[[./img/a.jpg]]}.
2226 If you wish to define a caption for the image and maybe a label for internal
2227 cross references, you sure that the link is on a line by itself precede it
2228 with:
2230 @smallexample
2231 #+CAPTION: This is the caption for the next figure link (or table)
2232 #+LABEL:   fig:SED-HR4049
2233 [[./img/a.jpg]]
2234 @end smallexample
2236 You may also define additional attributes for the figure.  As this is
2237 backend-specific, see the sections about the individual backends for more
2238 information.
2241 @node Literal examples, Include files, Images and tables, Markup
2242 @section Literal examples
2244 You can include literal examples that should not be subjected to
2245 markup.  Such examples will be typeset in monospace, so this is well suited
2246 for source code and similar examples.
2248 @smallexample
2249 #+BEGIN_EXAMPLE
2250 Some example from a text file.
2251 #+END_EXAMPLE
2252 @end smallexample
2254 For simplicity when using small examples, you can also start the example
2255 lines with a colon followed by a space.  There may also be additional
2256 whitespace before the colon:
2258 @smallexample
2259 Here is an example
2260    : Some example from a text file.
2261 @end smallexample
2263 For source code from a programming language, or any other text
2264 that can be marked up by font-lock in Emacs, you can ask for it to
2265 look like the fontified Emacs buffer
2267 @smallexample
2268 #+BEGIN_SRC emacs-lisp
2269 (defun org-xor (a b)
2270    "Exclusive or."
2271    (if a (not b) b))
2272 #+END_SRC
2273 @end smallexample
2275 To edit the example in a special buffer supporting this language, use
2276 @kbd{C-c '} to both enter and leave the editing buffer.
2278 @node Include files, Embedded @LaTeX{}, Literal examples, Markup
2279 @section Include files
2281 During export, you can include the content of another file.  For example, to
2282 include your @file{.emacs} file, you could use:
2284 @smallexample
2285 #+INCLUDE: "~/.emacs" src emacs-lisp
2286 @end smallexample
2287 @noindent
2288 The optional second and third parameter are the markup (e.g.@: @samp{quote},
2289 @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
2290 language for formatting the contents.  The markup is optional, if it is not
2291 given, the text will be assumed to be in Org mode format and will be
2292 processed normally. @kbd{C-c '} will visit the included file.
2294 @node Embedded @LaTeX{},  , Include files, Markup
2295 @section Embedded @LaTeX{}
2297 For scientific notes which need to be able to contain mathematical symbols
2298 and the occasional formula, Org-mode supports embedding @LaTeX{} code into
2299 its files.  You can directly use TeX-like macros for special symbols, enter
2300 formulas and entire @LaTeX{} environments.
2302 @smallexample
2303 Angles are written as Greek letters \alpha, \beta and \gamma.  The mass if
2304 the sun is M_sun = 1.989 x 10^30 kg.  The radius of the sun is R_@{sun@} =
2305 6.96 x 10^8 m.  If $a^2=b$ and $b=2$, then the solution must be either
2306 $a=+\sqrt@{2@}$ or $a=-\sqrt@{2@}$.
2308 \begin@{equation@}
2309 x=\sqrt@{b@}
2310 \end@{equation@}
2311 @end smallexample
2312 @noindent  With
2313 @uref{http://orgmode.org/manual/LaTeX-fragments.html#LaTeX-fragments,special
2314 setup}, @LaTeX{} snippets will be included as images when exporting to HTML.
2316 @seealso{
2317 @uref{http://orgmode.org/manual/Markup.html#Markup, Chapter 11 of the manual}}
2319 @node Exporting, Publishing, Markup, Top
2320 @chapter Exporting
2322 Org-mode documents can be exported into a variety of other formats: ASCII
2323 export for inclusion into emails, HTML to publish on the web, @LaTeX{}/PDF
2324 for beautiful printed documents and DocBook to enter the world of many other
2325 formats using DocBook tools.  There is also export to iCalendar format so
2326 that planning information can be incorporated into desktop calendars.
2328 @menu
2329 * Export options::              Per-file export settings
2330 * The export dispatcher::       How to access exporter commands
2331 * ASCII/Latin-1/UTF-8 export::  Exporting to flat files with encoding
2332 * HTML export::                 Exporting to HTML
2333 * @LaTeX{} and PDF export::     Exporting to @LaTeX{}, and processing to PDF
2334 * DocBook export::              Exporting to DocBook
2335 * iCalendar export::
2336 @end menu
2338 @node Export options, The export dispatcher, Exporting, Exporting
2339 @section Export options
2341 The exporter recognizes special lines in the buffer which provide
2342 additional information.  These lines may be put anywhere in the file.
2343 The whole set of lines can be inserted into the buffer with @kbd{C-c
2344 C-e t}.
2346 @table @kbd
2347 @item C-c C-e t
2348 Insert template with export options, see example below.
2349 @end table
2351 @smallexample
2352 #+TITLE:       the title to be shown (default is the buffer name)
2353 #+AUTHOR:      the author (default taken from @code{user-full-name})
2354 #+DATE:        a date, fixed, of a format string for @code{format-time-string}
2355 #+EMAIL:       his/her email address (default from @code{user-mail-address})
2356 #+DESCRIPTION: the page description, e.g.@: for the XHTML meta tag
2357 #+KEYWORDS:    the page keywords, e.g.@: for the XHTML meta tag
2358 #+LANGUAGE:    language for HTML, e.g.@: @samp{en} (@code{org-export-default-language})
2359 #+OPTIONS:     H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
2360 #+LINK_UP:     the ``up'' link of an exported page
2361 #+LINK_HOME:   the ``home'' link of an exported page
2362 #+LATEX_HEADER: extra line(s) for the @LaTeX{} header, like \usepackage@{xyz@}
2363 @end smallexample
2365 @node The export dispatcher, ASCII/Latin-1/UTF-8 export, Export options, Exporting
2366 @section The export dispatcher
2368 All export commands can be reached using the export dispatcher, which is a
2369 prefix key that prompts for an additional key specifying the command.
2370 Normally the entire file is exported, but if there is an active region that
2371 contains one outline tree, the first heading is used as document title and
2372 the subtrees are exported.
2374 @table @kbd
2375 @item C-c C-e
2376 Dispatcher for export and publishing commands.
2377 @end table
2379 @node ASCII/Latin-1/UTF-8 export, HTML export, The export dispatcher, Exporting
2380 @section ASCII/Latin-1/UTF-8 export
2382 ASCII export produces a simple and very readable version of an Org-mode
2383 file, containing only plain ASCII.  Latin-1 and UTF-8 export augment the file
2384 with special characters and symbols available in these encodings.
2386 @table @kbd
2387 @item C-c C-e a
2388 Export as ASCII file.
2389 @item C-c C-e n @ @ @r{and} @ @ C-c C-e N
2390 Like the above commands, but use Latin-1 encoding.
2391 @item C-c C-e u @ @ @r{and} @ @ C-c C-e U
2392 Like the above commands, but use UTF-8 encoding.
2393 @end table
2395 @node HTML export, @LaTeX{} and PDF export, ASCII/Latin-1/UTF-8 export, Exporting
2396 @section HTML export
2398 @table @kbd
2399 @item C-c C-e h
2400 Export as HTML file @file{myfile.html}.
2401 @item C-c C-e b
2402 Export as HTML file and immediately open it with a browser.
2403 @end table
2405 To insert HTML that should be copied verbatim to
2406 the exported file use either
2408 @smallexample
2409 #+HTML: Literal HTML code for export
2410 @end smallexample
2411 @noindent or
2412 @smallexample
2413 #+BEGIN_HTML
2414 All lines between these markers are exported literally
2415 #+END_HTML
2416 @end smallexample
2418 @node @LaTeX{} and PDF export, DocBook export, HTML export, Exporting
2419 @section @LaTeX{} and PDF export
2421 @table @kbd
2422 @item C-c C-e l
2423 Export as @LaTeX{} file @file{myfile.tex}.
2424 @item C-c C-e p
2425 Export as @LaTeX{} and then process to PDF.
2426 @item C-c C-e d
2427 Export as @LaTeX{} and then process to PDF, then open the resulting PDF file.
2428 @end table
2430 By default, the @LaTeX{} output uses the class @code{article}.  You can
2431 change this by adding an option like @code{#+LaTeX_CLASS: myclass} in your
2432 file.  The class must be listed in @code{org-latex-classes}.
2434 Embedded @LaTeX{} as described in @ref{Embedded @LaTeX{}}, will be correctly
2435 inserted into the @LaTeX{} file.  Similarly to the HTML exporter, you can use
2436 @code{#+LaTeX:} and @code{#+BEGIN_LaTeX ... #+END_LaTeX} construct to add
2437 verbatim @LaTeX{} code.
2439 @node DocBook export, iCalendar export, @LaTeX{} and PDF export, Exporting
2440 @section DocBook export
2442 @table @kbd
2443 @item C-c C-e D
2444 Export as DocBook file.
2445 @end table
2447 Similarly to the HTML exporter, you can use @code{#+DOCBOOK:} and
2448 @code{#+BEGIN_DOCBOOK ... #+END_DOCBOOK} construct to add verbatim @LaTeX{}
2449 code.
2451 @node iCalendar export,  , DocBook export, Exporting
2452 @section iCalendar export
2454 @table @kbd
2455 @item C-c C-e i
2456 Create iCalendar entries for the current file in a @file{.ics} file.
2457 @item C-c C-e c
2458 Create a single large iCalendar file from all files in
2459 @code{org-agenda-files} and write it to the file given by
2460 @code{org-combined-agenda-icalendar-file}.
2461 @end table
2463 @seealso{
2464 @uref{http://orgmode.org/manual/Exporting.html#Exporting, Chapter 12 of the manual}@*
2465 @uref{http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.php,
2466 Sebastian Rose's image handling tutorial}@*
2467 @uref{http://orgmode.org/worg/org-tutorials/org-latex-export.php, Thomas
2468 Dye's LaTeX export tutorial}
2469 @uref{http://orgmode.org/worg/org-tutorials/org-beamer/tutorial.php, Eric
2470 Fraga's BEAMER presentation tutorial}}
2472 @node Publishing, Working With Source Code, Exporting, Top
2473 @chapter Publishing
2475 Org includes a publishing management system that allows you to configure
2476 automatic HTML conversion of @emph{projects} composed of interlinked org
2477 files.  You can also configure Org to automatically upload your exported HTML
2478 pages and related attachments, such as images and source code files, to a web
2479 server.  For detailed instructions about setup, see the manual.
2481 Here is an example:
2483 @smalllisp
2484 (setq org-publish-project-alist
2485       '(("org"
2486          :base-directory "~/org/"
2487          :publishing-directory "~/public_html"
2488          :section-numbers nil
2489          :table-of-contents nil
2490          :style "<link rel=\"stylesheet\"
2491                 href=\"../other/mystyle.css\"
2492                 type=\"text/css\"/>")))
2493 @end smalllisp
2495 @table @kbd
2496 @item C-c C-e C
2497 Prompt for a specific project and publish all files that belong to it.
2498 @item C-c C-e P
2499 Publish the project containing the current file.
2500 @item C-c C-e F
2501 Publish only the current file.
2502 @item C-c C-e E
2503 Publish every project.
2504 @end table
2506 Org uses timestamps to track when a file has changed.  The above functions
2507 normally only publish changed files.  You can override this and force
2508 publishing of all files by giving a prefix argument to any of the commands
2509 above.
2511 @seealso{
2512 @uref{http://orgmode.org/manual/Publishing.html#Publishing, Chapter 13 of the
2513 manual}@*
2514 @uref{http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.php,
2515 Sebastian Rose's publishing tutorial}@*
2516 @uref{http://orgmode.org/worg/org-tutorials/org-jekyll.php, Ian Barton's
2517 Jekyll/blogging setup}}
2519 @node Working With Source Code, Miscellaneous, Publishing, Top
2520 @chapter Working with source code
2521 Org-mode provides a number of features for working with source code,
2522 including editing of code blocks in their native major-mode, evaluation of
2523 code blocks, tangling of code blocks, and exporting code blocks and their
2524 results in several formats.
2526 @subheading Structure of Code Blocks
2527 The structure of code blocks is as follows:
2529 @example
2530 #+NAME: <name>
2531 #+BEGIN_SRC <language> <switches> <header arguments>
2532   <body>
2533 #+END_SRC
2534 @end example
2536 Where @code{<name>} is a string used to name the code block,
2537 @code{<language>} specifies the language of the code block
2538 (e.g.@: @code{emacs-lisp}, @code{shell}, @code{R}, @code{python}, etc...),
2539 @code{<switches>} can be used to control export of the code block,
2540 @code{<header arguments>} can be used to control many aspects of code block
2541 behavior as demonstrated below, and @code{<body>} contains the actual source
2542 code.
2544 @subheading Editing source code
2545 Use @kbd{C-c '} to edit the current code block.  This brings up a language
2546 major-mode edit buffer containing the body of the code block.  Saving this
2547 buffer will write the new contents back to the Org buffer.  Use @kbd{C-c '}
2548 again to exit the edit buffer.
2550 @subheading Evaluating code blocks
2551 Use @kbd{C-c C-c} to evaluate the current code block and insert its results
2552 in the Org-mode buffer.  By default, evaluation is only turned on for
2553 @code{emacs-lisp} code blocks, however support exists for evaluating blocks
2554 in many languages.  For a complete list of supported languages see the
2555 manual.  The following shows a code block and its results.
2557 @example
2558 #+BEGIN_SRC emacs-lisp
2559   (+ 1 2 3 4)
2560 #+END_SRC
2562 #+RESULTS:
2563 : 10
2564 @end example
2566 @subheading Extracting source code
2567 Use @kbd{C-c C-v t} to create pure source code files by extracting code from
2568 source blocks in the current buffer.  This is referred to as ``tangling''---a
2569 term adopted from the literate programming community.  During ``tangling'' of
2570 code blocks their bodies are expanded using @code{org-babel-expand-src-block}
2571 which can expand both variable and ``noweb'' style references.  In order to
2572 tangle a code block it must have a @code{:tangle} header argument, see the
2573 manual for details.
2575 @subheading Library of Babel
2576 Use @kbd{C-c C-v l} to load the code blocks from an Org-mode files into the
2577 ``Library of Babel'', these blocks can then be evaluated from any Org-mode
2578 buffer.  A collection of generally useful code blocks is distributed with
2579 Org-mode in @code{contrib/library-of-babel.org}.
2581 @subheading Header Arguments
2582 Many aspects of the evaluation and export of code blocks are controlled
2583 through header arguments.  These can be specified globally, at the file
2584 level, at the outline subtree level, and at the individual code block level.
2585 The following describes some of the header arguments.
2586 @table @code
2587 @item :var
2588 The @code{:var} header argument is used to pass arguments to code blocks.
2589 The values passed to arguments can be literal values, values from org-mode
2590 tables and literal example blocks, or the results of other named code blocks.
2591 @item :results
2592 The @code{:results} header argument controls the @emph{collection},
2593 @emph{type}, and @emph{handling} of code block results.  Values of
2594 @code{output} or @code{value} (the default) specify how results are collected
2595 from a code block's evaluation.  Values of @code{vector}, @code{scalar}
2596 @code{file} @code{raw} @code{html} @code{latex} and @code{code} specify the
2597 type of the results of the code block which dictates how they will be
2598 incorporated into the Org-mode buffer.  Values of @code{silent},
2599 @code{replace}, @code{prepend}, and @code{append} specify handling of code
2600 block results, specifically if and how the results should be inserted into
2601 the Org-mode buffer.
2602 @item :session
2603 A header argument of @code{:session} will cause the code block to be
2604 evaluated in a persistent interactive inferior process in Emacs.  This allows
2605 for persisting state between code block evaluations, and for manual
2606 inspection of the results of evaluation.
2607 @item :exports
2608 Any combination of the @emph{code} or the @emph{results} of a block can be
2609 retained on export, this is specified by setting the @code{:results} header
2610 argument to @code{code} @code{results} @code{none} or @code{both}.
2611 @item :tangle
2612 A header argument of @code{:tangle yes} will cause a code block's contents to
2613 be tangled to a file named after the filename of the Org-mode buffer.  An
2614 alternate file name can be specified with @code{:tangle filename}.
2615 @item :cache
2616 A header argument of @code{:cache yes} will cause associate a hash of the
2617 expanded code block with the results, ensuring that code blocks are only
2618 re-run when their inputs have changed.
2619 @item :noweb
2620 A header argument of @code{:noweb yes} will expand ``noweb'' style references
2621 on evaluation and tangling.
2622 @item :file
2623 Code blocks which output results to files (e.g.@: graphs, diagrams and figures)
2624 can accept a @code{:file filename} header argument in which case the results
2625 are saved to the named file, and a link to the file is inserted into the
2626 Org-mode buffer.
2627 @end table
2629 @seealso{
2630 @uref{http://orgmode.org/manual/Literal-examples.html#Literal-examples,
2631 Chapter 11.3 of the manual}@*
2632 @uref{http://orgmode.org/worg/org-contrib/babel/index.php,
2633 The Babel site on Worg}}
2635 @node Miscellaneous, GNU Free Documentation License, Working With Source Code, Top
2636 @chapter Miscellaneous
2638 @menu
2639 * Completion::                  M-TAB knows what you need
2640 * Clean view::                  Getting rid of leading stars in the outline
2641 * MobileOrg::                   Org-mode on the iPhone
2642 @end menu
2644 @node Completion, Clean view, Miscellaneous, Miscellaneous
2645 @section Completion
2647 Org supports in-buffer completion with @kbd{M-@key{TAB}}.  This type of
2648 completion does not make use of the minibuffer.  You simply type a few
2649 letters into the buffer and use the key to complete text right there.  For
2650 example, this command will complete @TeX{} symbols after @samp{\}, TODO
2651 keywords at the beginning of a headline, and tags after @samp{:} in a
2652 headline.
2654 @node Clean view, MobileOrg, Completion, Miscellaneous
2655 @section A cleaner outline view
2657 Some people find it noisy and distracting that the Org headlines start with a
2658 potentially large number of stars, and that text below the headlines is not
2659 indented.  While this is no problem when writing a @emph{book-like} document
2660 where the outline headings are really section headings, in a more
2661 @emph{list-oriented} outline, indented structure is a lot cleaner:
2663 @smallexample
2664 @group
2665 * Top level headline             |    * Top level headline
2666 ** Second level                  |      * Second level
2667 *** 3rd level                    |        * 3rd level
2668 some text                        |          some text
2669 *** 3rd level                    |        * 3rd level
2670 more text                        |          more text
2671 * Another top level headline     |    * Another top level headline
2672 @end group
2673 @end smallexample
2675 @noindent
2676 If you are using at least Emacs 23.1.50.3 and version 6.29 of Org, this kind
2677 of view can be achieved dynamically at display time using
2678 @code{org-indent-mode}, which will prepend intangible space to each line.
2679 You can turn on @code{org-indent-mode} for all files by customizing the
2680 variable @code{org-startup-indented}, or you can turn it on for individual
2681 files using
2683 @smallexample
2684 #+STARTUP: indent
2685 @end smallexample
2687 If you want a similar effect in earlier version of Emacs and/or Org, or if
2688 you want the indentation to be hard space characters so that the plain text
2689 file looks as similar as possible to the Emacs display, Org supports you by
2690 helping to indent (with @key{TAB}) text below each headline, by hiding
2691 leading stars, and by only using levels 1, 3, etc to get two characters
2692 indentation for each level.  To get this support in a file, use
2694 @smallexample
2695 #+STARTUP: hidestars odd
2696 @end smallexample
2698 @node MobileOrg,  , Clean view, Miscellaneous
2699 @section MobileOrg
2701 @i{MobileOrg} is the name of the mobile companion app for Org mode, currently
2702 available for iOS and for Android.  @i{MobileOrg} offers offline viewing and
2703 capture support for an Org mode system rooted on a ``real'' computer.  It
2704 does also allow you to record changes to existing entries.
2706 The @uref{http://mobileorg.ncogni.to/, iOS implementation} for the
2707 @i{iPhone/iPod Touch/iPad} series of devices, was developed by Richard
2708 Moreland. Android users should check out
2709 @uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg Android}
2710 by Matt Jones.  The two implementations are not identical but offer similar
2711 features.
2713 @seealso{
2714 @uref{http://orgmode.org/manual/Miscellaneous.html#Miscellaneous, Chapter 15
2715 of the manual}@*
2716 @uref{http://orgmode.org/manual/MobileOrg.html#MobileOrg, Appendix B of the
2717 manual}@*
2718 @uref{http://orgmode.org/orgcard.pdf,Key reference card}}
2721 @node GNU Free Documentation License,  , Miscellaneous, Top
2722 @appendix GNU Free Documentation License
2723 @include doclicense.texi
2726 @bye
2728 @c Local variables:
2729 @c fill-column: 77
2730 @c End:
2733 @c  LocalWords:  webdavhost pre