orgguide.texi 97 KB

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