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