orgguide.texi 97 KB

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