orgguide.texi 98 KB

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