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