orgguide.texi 97 KB

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