orgguide.texi 99 KB

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