orgguide.texi 97 KB

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