orgguide.texi 98 KB

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