orgguide.texi (93995B)
1 \input texinfo @c -*- texinfo -*- 2 @c %**start of header 3 @setfilename orgguide.info 4 @settitle Org Mode Compact Guide 5 @documentencoding UTF-8 6 @documentlanguage en 7 @set txicodequoteundirected 8 @set txicodequotebacktick 9 @set MAINTAINERSITE @uref{https://orgmode.org,maintainers webpage} 10 @set MAINTAINER Bastien Guerry 11 @set MAINTAINEREMAIL @email{bzg@gnu.org} 12 @set MAINTAINERCONTACT @uref{mailto:bzg@gnu.org,contact the maintainer} 13 @c %**end of header 14 15 @copying 16 Copyright @copyright{} 2004--2024 Free Software Foundation, Inc. 17 18 @quotation 19 Permission is granted to copy, distribute and/or modify this document 20 under the terms of the GNU Free Documentation License, Version 1.3 or 21 any later version published by the Free Software Foundation; with no 22 Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,'' 23 and with the Back-Cover Texts as in (a) below. A copy of the license 24 is included in the section entitled ``GNU Free Documentation License.'' 25 in the full Org manual, which is distributed together with this 26 compact guide. 27 28 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and 29 modify this GNU manual.'' 30 31 @end quotation 32 @end copying 33 34 @dircategory Emacs editing modes 35 @direntry 36 * Org Guide: (orgguide). Abbreviated Org mode manual. 37 @end direntry 38 39 @finalout 40 @titlepage 41 @title Org Mode Compact Guide 42 @subtitle Release 9.7 43 @author The Org Mode Developers 44 @page 45 @vskip 0pt plus 1filll 46 @insertcopying 47 @end titlepage 48 49 @contents 50 51 @ifnottex 52 @node Top 53 @top Org Mode Compact Guide 54 55 @insertcopying 56 57 @end ifnottex 58 59 @menu 60 * Introduction:: Welcome! 61 * Document Structure:: A tree works like your brain. 62 * Tables:: Pure magic for quick formatting. 63 * Hyperlinks:: Notes in context. 64 * TODO Items:: Every tree branch can be a TODO item. 65 * Tags:: Tagging headlines and matching sets of tags. 66 * Properties:: Storing information about an entry. 67 * Dates and Times:: Making items useful for planning. 68 * Capture, Refile, Archive: Capture Refile Archive. The ins and outs for projects. 69 * Agenda Views:: Collecting information into views. 70 * Markup:: Compose beautiful documents. 71 * Exporting:: Sharing and publishing notes. 72 * Publishing:: Create a web site of linked Org files. 73 * Working with Source Code:: Export, evaluate, and tangle code blocks. 74 * Miscellaneous:: All the rest which did not fit elsewhere. 75 76 @detailmenu 77 --- The Detailed Node Listing --- 78 79 Document Structure 80 81 * Headlines:: How to typeset Org tree nodes. 82 * Visibility Cycling:: Show and hide, much simplified. 83 * Motion:: Jumping to other headlines. 84 * Structure Editing:: Changing sequence and level of headlines. 85 * Sparse Trees:: Matches embedded in context. 86 * Plain Lists:: Additional structure within an entry. 87 88 TODO Items 89 90 * TODO Basics:: Marking and displaying TODO entries. 91 * Multi-state Workflow:: More than just on/off. 92 * Progress Logging:: Dates and notes for progress. 93 * Priorities:: Some things are more important than others. 94 * Breaking Down Tasks:: Splitting a task into manageable pieces. 95 * Checkboxes:: Tick-off lists. 96 97 Dates and Times 98 99 * Timestamps:: Assigning a time to a tree entry. 100 * Creating Timestamps:: Commands that insert timestamps. 101 * Deadlines and Scheduling:: Planning your work. 102 * Clocking Work Time:: Tracking how long you spent on a task. 103 104 Capture, Refile, Archive 105 106 * Capture:: Capturing new stuff. 107 * Refile and Copy:: Moving/copying a tree from one place to another. 108 * Archiving:: What to do with finished products. 109 110 Agenda Views 111 112 * Agenda Files:: Files being searched for agenda information. 113 * Agenda Dispatcher:: Keyboard access to agenda views. 114 * Built-in Agenda Views:: What is available out of the box? 115 * Global TODO List:: All unfinished action items. 116 * Matching Tags and Properties:: Structured information with fine-tuned search. 117 * Search View:: Find entries by searching for text. 118 * Agenda Commands:: Remote editing of Org trees. 119 * Custom Agenda Views:: Defining special searches and views. 120 121 Markup 122 123 * Paragraphs:: The basic unit of text. 124 * Emphasis and Monospace:: Bold, italic, etc. 125 * Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents. 126 * Literal examples:: Source code examples with special formatting. 127 * Images:: Display an image. 128 * Creating Footnotes:: Edit and read footnotes. 129 130 Exporting 131 132 * The Export Dispatcher:: The main interface. 133 * Export Settings:: Common export settings. 134 * Table of Contents:: The if and where of the table of contents. 135 * Include Files:: Include additional files into a document. 136 * Comment Lines:: What will not be exported. 137 * ASCII/UTF-8 Export:: Exporting to flat files with encoding. 138 * HTML Export:: Exporting to HTML. 139 * @LaTeX{} Export:: Exporting to @LaTeX{} and processing to PDF. 140 * iCalendar Export:: Exporting to iCalendar. 141 142 @end detailmenu 143 @end menu 144 145 @node Introduction 146 @chapter Introduction 147 148 Org is a mode for keeping notes, maintaining TODO lists, and doing 149 project planning with a fast and effective plain-text system. It is 150 also an authoring and publishing system, and it supports working with 151 source code for literal programming and reproducible research. 152 153 This document is a much compressed derivative of the @ref{Top,comprehensive Org 154 mode manual,,org,}. It contains all basic features and commands, along with 155 important hints for customization. It is intended for beginners who 156 would shy back from a 200 pages manual because of sheer size. 157 158 @anchor{Installation} 159 @heading Installation 160 161 @quotation Important 162 If you are using a version of Org that is part of the Emacs 163 distribution, please skip this section and go directly to @ref{Activation}. 164 165 @end quotation 166 167 If you have downloaded Org from the web, either as a distribution 168 @samp{.zip} or @samp{.tar} file, or as a Git archive, it is best to run it 169 directly from the distribution directory. You need to add the @samp{lisp/} 170 subdirectories to the Emacs load path. To do this, add the following 171 line to your Emacs init file: 172 173 @example 174 (add-to-list 'load-path "~/path/to/orgdir/lisp") 175 @end example 176 177 178 @noindent 179 If you have been using git or a tar ball to get Org, you need to run 180 the following command to generate autoload information. 181 182 @example 183 make autoloads 184 @end example 185 186 @anchor{Activation} 187 @heading Activation 188 189 Add the following lines to your Emacs init file to define @emph{global} 190 keys for three commands that are useful in any Emacs buffer, not just 191 Org buffers. Please choose suitable keys yourself. 192 193 @lisp 194 (global-set-key (kbd "C-c l") #'org-store-link) 195 (global-set-key (kbd "C-c a") #'org-agenda) 196 (global-set-key (kbd "C-c c") #'org-capture) 197 @end lisp 198 199 Files with extension @samp{.org} will be put into Org mode automatically. 200 201 @anchor{Feedback} 202 @heading Feedback 203 204 If you find problems with Org, or if you have questions, remarks, or 205 ideas about it, please mail to the Org mailing list 206 @email{mailto:emacs-orgmode@@gnu.org}. For information on how to submit bug 207 reports, see the @ref{Top,main manual,,org,}. 208 209 @node Document Structure 210 @chapter Document Structure 211 212 Org is an outliner. Outlines allow a document to be organized in 213 a hierarchical structure, which, least for me, is the best 214 representation of notes and thoughts. An overview of this structure 215 is achieved by folding, i.e., hiding large parts of the document to 216 show only the general document structure and the parts currently being 217 worked on. Org greatly simplifies the use of outlines by compressing 218 the entire show and hide functionalities into a single command, 219 @code{org-cycle}, which is bound to the @kbd{@key{TAB}} key. 220 221 @menu 222 * Headlines:: How to typeset Org tree nodes. 223 * Visibility Cycling:: Show and hide, much simplified. 224 * Motion:: Jumping to other headlines. 225 * Structure Editing:: Changing sequence and level of headlines. 226 * Sparse Trees:: Matches embedded in context. 227 * Plain Lists:: Additional structure within an entry. 228 @end menu 229 230 @node Headlines 231 @section Headlines 232 233 Headlines define the structure of an outline tree. The headlines in 234 Org start on the left margin@footnote{See the variable @code{org-special-ctrl-a/e} to configure special 235 behavior of @kbd{C-a} and @kbd{C-e} in headlines.} with one or more stars followed by 236 a space. For example: 237 238 @example 239 * Top level headline 240 ** Second level 241 *** Third level 242 some text 243 *** Third level 244 more text 245 * Another top level headline 246 @end example 247 248 Note that a headline named after @code{org-footnote-section}, which 249 defaults to @samp{Footnotes}, is considered as special. A subtree with 250 this headline will be silently ignored by exporting functions. 251 252 Some people find the many stars too noisy and would prefer an outline 253 that has whitespace followed by a single star as headline starters. 254 See @ref{Miscellaneous} for a setup to realize this. 255 256 @node Visibility Cycling 257 @section Visibility Cycling 258 259 Outlines make it possible to hide parts of the text in the buffer. 260 Org uses just two commands, bound to @kbd{@key{TAB}} and 261 @kbd{S-@key{TAB}} (@code{org-cycle} and @code{org-shifttab}) to change the 262 visibility in the buffer. 263 264 @table @asis 265 @item @kbd{@key{TAB}} (@code{org-cycle}) 266 @emph{Subtree cycling}: Rotate current subtree among the states 267 268 @example 269 ,-> FOLDED -> CHILDREN -> SUBTREE --. 270 '-----------------------------------' 271 @end example 272 273 274 When called with a prefix argument (@kbd{C-u @key{TAB}}), or with the 275 Shift key, global cycling is invoked. 276 277 @item @kbd{S-@key{TAB}} (@code{org-global-cycle}) 278 @itemx @kbd{C-u @key{TAB}} (@code{org-cycle}) 279 @emph{Global cycling}: Rotate the entire buffer among the states 280 281 @example 282 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --. 283 '--------------------------------------' 284 @end example 285 286 @item @kbd{C-u C-u C-u @key{TAB}} (@code{org-show-all}) 287 Show all, including drawers. 288 @end table 289 290 When Emacs first visits an Org file, the global state is set to 291 @code{showeverything}, i.e., all file content is visible. This can be 292 configured through the variable @code{org-startup-folded}, or on a per-file 293 basis by adding a @samp{STARTUP} keyword to @samp{overview}, @samp{content}, 294 @samp{showall}, @samp{showeverything} or @samp{show<n>levels} (n = 2..5) like this: 295 296 @example 297 #+STARTUP: content 298 @end example 299 300 @node Motion 301 @section Motion 302 303 The following commands jump to other headlines in the buffer. 304 305 @table @asis 306 @item @kbd{C-c C-n} (@code{org-next-visible-heading}) 307 Next heading. 308 @item @kbd{C-c C-p} (@code{org-previous-visible-heading}) 309 Previous 310 heading. 311 312 @item @kbd{C-c C-f} (@code{org-backward-heading-same-level}) 313 Next 314 heading same level. 315 316 @item @kbd{C-c C-b} (@code{outline-backward-same-level}) 317 Previous 318 heading same level. 319 320 @item @kbd{C-c C-u} (@code{outline-up-heading}) 321 Backward to higher 322 level heading. 323 @end table 324 325 @node Structure Editing 326 @section Structure Editing 327 328 @table @asis 329 @item @kbd{M-@key{RET}} (@code{org-meta-return}) 330 Insert new heading with same level as current. If point is in 331 a plain list item, a new item is created (see @ref{Plain Lists}). When 332 this command is used in the middle of a line, the line is split and 333 the rest of the line becomes the new headline@footnote{If you do not want the line to be split, customize the variable 334 @code{org-M-RET-may-split-line}.}. 335 336 @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading}) 337 Insert new TODO entry with same level as current heading. 338 339 @item @kbd{@key{TAB}} (@code{org-cycle}) in new 340 @itemx empty entry 341 In a new entry with no text yet, @kbd{@key{TAB}} cycles through 342 reasonable levels. 343 344 @item @kbd{M-@key{LEFT}} (@code{org-metaleft}) 345 @itemx @kbd{M-@key{RIGHT}} (@code{org-metaright}) 346 Promote or demote current heading by one level. 347 348 @item @kbd{M-@key{UP}} (@code{org-move-subtree-up}) 349 @itemx @kbd{M-@key{DOWN}} (@code{org-move-subtree-down}) 350 Move subtree up or down, i.e., swap with previous or next subtree of 351 same level. 352 353 @item @kbd{C-c C-w} (@code{org-refile}) 354 Refile entry or region to a different location. See @ref{Refile and Copy}. 355 356 @item @kbd{C-x n s} (@code{org-narrow-to-subtree}) 357 @itemx @kbd{C-x n w} (@code{widen}) 358 Narrow buffer to current subtree and widen it again. 359 @end table 360 361 When there is an active region (Transient Mark mode), promotion and 362 demotion work on all headlines in the region. 363 364 @node Sparse Trees 365 @section Sparse Trees 366 367 An important feature of Org mode is the ability to construct @emph{sparse 368 trees} for selected information in an outline tree, so that the entire 369 document is folded as much as possible, but the selected information 370 is made visible along with the headline structure above it@footnote{See also the variable @code{org-show-context-detail} to decide how 371 much context is shown around each match.}. 372 Just try it out and you will see immediately how it works. 373 374 Org mode contains several commands creating such trees, all these 375 commands can be accessed through a dispatcher: 376 377 @table @asis 378 @item @kbd{C-c /} (@code{org-sparse-tree}) 379 This prompts for an extra key to select a sparse-tree creating 380 command. 381 382 @item @kbd{C-c / r} (@code{org-occur}) 383 Occur. Prompts for a regexp and shows a sparse tree with all 384 matches. Each match is also highlighted; the highlights disappear 385 by pressing @kbd{C-c C-c}. 386 387 The other sparse tree commands select headings based on TODO 388 keywords, tags, or properties and will be discussed later in this 389 manual. 390 @end table 391 392 @node Plain Lists 393 @section Plain Lists 394 395 Within an entry of the outline tree, hand-formatted lists can provide 396 additional structure. They also provide a way to create lists of 397 checkboxes (see @ref{Checkboxes}). Org supports editing such lists, and 398 every exporter (see @ref{Exporting}) can parse and format them. 399 400 Org knows ordered lists, unordered lists, and description lists. 401 402 @itemize 403 @item 404 @emph{Unordered} list items start with @samp{-}, @samp{+}, or @samp{*} as bullets. 405 406 @item 407 @emph{Ordered} list items start with @samp{1.}, or @samp{1)}. 408 409 @item 410 @emph{Description} list use @samp{::} to separate the @emph{term} from the 411 description. 412 @end itemize 413 414 Items belonging to the same list must have the same indentation on the 415 first line. An item ends before the next line that is indented like 416 its bullet/number, or less. A list ends when all items are closed, or 417 before two blank lines. An example: 418 419 @example 420 * Lord of the Rings 421 My favorite scenes are (in this order) 422 1. The attack of the Rohirrim 423 2. Eowyn's fight with the witch king 424 + this was already my favorite scene in the book 425 + I really like Miranda Otto. 426 Important actors in this film are: 427 - Elijah Wood :: He plays Frodo 428 - Sean Astin :: He plays Sam, Frodo's friend. 429 @end example 430 431 The following commands act on items when point is in the first line of 432 an item (the line with the bullet or number). 433 434 @table @asis 435 @item @kbd{@key{TAB}} (@code{org-cycle}) 436 Items can be folded just like headline levels. 437 438 @item @kbd{M-@key{RET}} (@code{org-insert-heading}) 439 Insert new item at current level. With a prefix argument, force 440 a new heading (see @ref{Structure Editing}). 441 442 @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading}) 443 Insert a new item with a checkbox (see @ref{Checkboxes}). 444 445 @item @kbd{M-@key{UP}} (@code{org-move-item-up}) 446 @itemx @kbd{M-@key{DOWN}} (@code{org-move-item-down}) 447 Move the item including subitems up/down (swap with previous/next 448 item of same indentation). If the list is ordered, renumbering is 449 automatic. 450 451 @item @kbd{M-@key{LEFT}} (@code{org-do-promote}) 452 @itemx @kbd{M-@key{RIGHT}} (@code{org-do-demote}) 453 Decrease/increase the indentation of an item, leaving children 454 alone. 455 456 @item @kbd{M-S-@key{LEFT}} (@code{org-promote-subtree}) 457 @itemx @kbd{M-S-@key{RIGHT}} (@code{org-demote-subtree}) 458 Decrease/increase the indentation of the item, including subitems. 459 460 @item @kbd{C-c C-c} (@code{org-toggle-checkbox}) 461 If there is a checkbox (see @ref{Checkboxes}) in the item line, toggle 462 the state of the checkbox. Also verify bullets and indentation 463 consistency in the whole list. 464 465 @item @kbd{C-c -} (@code{org-cycle-list-bullet}) 466 Cycle the entire list level through the different itemize/enumerate 467 bullets (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}). 468 @end table 469 470 @node Tables 471 @chapter Tables 472 473 Org comes with a fast and intuitive table editor. Spreadsheet-like 474 calculations are supported in connection with the Emacs Calc package 475 (see @ref{Top,GNU Emacs Calculator Manual,,calc,}). 476 477 Org makes it easy to format tables in plain ASCII@. Any line with @samp{|} 478 as the first non-whitespace character is considered part of a table. 479 @samp{|} is also the column separator. A table might look like this: 480 481 @example 482 | Name | Phone | Age | 483 |-------+-------+-----| 484 | Peter | 1234 | 17 | 485 | Anna | 4321 | 25 | 486 @end example 487 488 A table is re-aligned automatically each time you press @kbd{@key{TAB}} 489 or @kbd{@key{RET}} or @kbd{C-c C-c} inside the table. 490 @kbd{@key{TAB}} also moves to the next field (@kbd{@key{RET}} to the 491 next row) and creates new table rows at the end of the table or before 492 horizontal lines. The indentation of the table is set by the first 493 line. Any line starting with @samp{|-} is considered as a horizontal 494 separator line and will be expanded on the next re-align to span the 495 whole table width. So, to create the above table, you would only type 496 497 @example 498 |Name|Phone|Age| 499 |- 500 @end example 501 502 503 @noindent 504 and then press @kbd{@key{TAB}} to align the table and start filling in 505 fields. Even faster would be to type @samp{|Name|Phone|Age} followed by 506 @kbd{C-c @key{RET}}. 507 508 When typing text into a field, Org treats @kbd{@key{DEL}}, 509 @kbd{Backspace}, and all character keys in a special way, so that 510 inserting and deleting avoids shifting other fields. Also, when 511 typing @emph{immediately after point was moved into a new field with 512 @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the field is 513 automatically made blank. 514 515 @anchor{Creation and conversion} 516 @heading Creation and conversion 517 518 @table @asis 519 @item @kbd{C-c |} (@code{org-table-create-or-convert-from-region}) 520 Convert the active region to table. If every line contains at least 521 one @kbd{@key{TAB}} character, the function assumes that the material 522 is tab separated. If every line contains a comma, comma-separated 523 values (CSV) are assumed. If not, lines are split at whitespace 524 into fields. 525 526 If there is no active region, this command creates an empty Org 527 table. But it is easier just to start typing, like @kbd{| N a m e | P h o n e | A g e @key{RET} | - @key{TAB}}. 528 @end table 529 530 @anchor{Re-aligning and field motion} 531 @heading Re-aligning and field motion 532 533 @table @asis 534 @item @kbd{C-c C-c} (@code{org-table-align}) 535 Re-align the table without moving point. 536 537 @item @kbd{@key{TAB}} (@code{org-table-next-field}) 538 Re-align the table, move to the next field. Creates a new row if 539 necessary. 540 541 @item @kbd{S-@key{TAB}} (@code{org-table-previous-field}) 542 Re-align, move to previous field. 543 544 @item @kbd{@key{RET}} (@code{org-table-next-row}) 545 Re-align the table and move down to next row. Creates a new row if 546 necessary. 547 548 @item @kbd{S-@key{UP}} (@code{org-table-move-cell-up}) 549 @itemx @kbd{S-@key{DOWN}} (@code{org-table-move-cell-down}) 550 @itemx @kbd{S-@key{LEFT}} (@code{org-table-move-cell-left}) 551 @itemx @kbd{S-@key{RIGHT}} (@code{org-table-move-cell-right}) 552 Move a cell up, down, left, and right by swapping with adjacent 553 cell. 554 @end table 555 556 @anchor{Column and row editing} 557 @heading Column and row editing 558 559 @table @asis 560 @item @kbd{M-@key{LEFT}} (@code{org-table-move-column-left}), @kbd{M-@key{RIGHT}} (@code{org-table-move-column-right}) 561 Move the current column left/right. 562 563 @item @kbd{M-S-@key{LEFT}} (@code{org-table-delete-column}) 564 Kill the current column. 565 566 @item @kbd{M-S-@key{RIGHT}} (@code{org-table-insert-column}) 567 Insert a new column to the left of point position. 568 569 @item @kbd{M-@key{UP}} (@code{org-table-move-row-up}), @kbd{M-@key{DOWN}} (@code{org-table-move-row-down}) 570 Move the current row up/down. 571 572 @item @kbd{M-S-@key{UP}} (@code{org-table-kill-row}) 573 Kill the current row or horizontal line. 574 575 @item @kbd{M-S-@key{DOWN}} (@code{org-table-insert-row}) 576 Insert a new row above the current row. With a prefix argument, the 577 line is created below the current one. 578 579 @item @kbd{C-c -} (@code{org-table-insert-hline}) 580 Insert a horizontal line below current row. With a prefix argument, 581 the line is created above the current line. 582 583 @item @kbd{C-c @key{RET}} (@code{org-table-hline-and-move}) 584 Insert a horizontal line below current row, and move the point into 585 the row below that line. 586 587 @item @kbd{C-c ^} (@code{org-table-sort-lines}) 588 Sort the table lines in the region. The position of point indicates 589 the column to be used for sorting, and the range of lines is the 590 range between the nearest horizontal separator lines, or the entire 591 table. 592 @end table 593 594 @node Hyperlinks 595 @chapter Hyperlinks 596 597 Like HTML, Org provides links inside a file, external links to other 598 files, Usenet articles, emails, and much more. 599 600 Org recognizes plain URIs, possibly wrapped within angle brackets, and 601 activate them as clickable links. The general link format, however, 602 looks like this: 603 604 @example 605 [[LINK][DESCRIPTION]] 606 @end example 607 608 609 @noindent 610 or alternatively 611 612 @example 613 [[LINK]] 614 @end example 615 616 617 Once a link in the buffer is complete, with all brackets present, Org 618 changes the display so that @samp{DESCRIPTION} is displayed instead of 619 @samp{[[LINK][DESCRIPTION]]} and @samp{LINK} is displayed instead of @samp{[[LINK]]}. 620 To edit the invisible @var{LINK} part, use @kbd{C-c C-l} 621 with the point on the link. 622 623 @anchor{Internal links} 624 @heading Internal links 625 626 If the link does not look like a URL, it is considered to be internal 627 in the current file. The most important case is a link like 628 @samp{[[#my-custom-id]]} which links to the entry with the @samp{CUSTOM_ID} property 629 @samp{my-custom-id}. 630 631 Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]} lead 632 to a text search in the current file for the corresponding target, 633 which looks like @samp{<<My Target>>}. 634 635 @anchor{External Links} 636 @heading External Links 637 638 Org supports links to files, websites, Usenet and email messages, BBDB 639 database entries and links to both IRC conversations and their logs. 640 External links are URL-like locators. They start with a short 641 identifying string followed by a colon. There can be no space after 642 the colon. Here are some examples: 643 644 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 645 @item @samp{http://www.astro.uva.nl/=dominik} 646 @tab on the web 647 @item @samp{file:/home/dominik/images/jupiter.jpg} 648 @tab file, absolute path 649 @item @samp{/home/dominik/images/jupiter.jpg} 650 @tab same as above 651 @item @samp{file:papers/last.pdf} 652 @tab file, relative path 653 @item @samp{./papers/last.pdf} 654 @tab same as above 655 @item @samp{file:projects.org} 656 @tab another Org file 657 @item @samp{docview:papers/last.pdf::NNN} 658 @tab open in DocView mode at page @var{NNN} 659 @item @samp{id:B7423F4D-2E8A-471B-8810-C40F074717E9} 660 @tab link to heading by ID 661 @item @samp{news:comp.emacs} 662 @tab Usenet link 663 @item @samp{mailto:adent@@galaxy.net} 664 @tab mail link 665 @item @samp{mhe:folder#id} 666 @tab MH-E message link 667 @item @samp{rmail:folder#id} 668 @tab Rmail message link 669 @item @samp{gnus:group#id} 670 @tab Gnus article link 671 @item @samp{bbdb:R.*Stallman} 672 @tab BBDB link (with regexp) 673 @item @samp{irc:/irc.com/#emacs/bob} 674 @tab IRC link 675 @item @samp{info:org#Hyperlinks} 676 @tab Info node link 677 @end multitable 678 679 File links can contain additional information to make Emacs jump to 680 a particular location in the file when following a link. This can be 681 a line number or a search option after a double colon. Here are a few 682 examples,, together with an explanation: 683 684 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaa} 685 @item @samp{file:~/code/main.c::255} 686 @tab Find line 255 687 @item @samp{file:~/xx.org::My Target} 688 @tab Find @samp{<<My Target>>} 689 @item @samp{[[file:~/xx.org::#my-custom-id]]} 690 @tab Find entry with a custom ID 691 @end multitable 692 693 @anchor{Handling Links} 694 @heading Handling Links 695 696 Org provides methods to create a link in the correct syntax, to insert 697 it into an Org file, and to follow the link. 698 699 The main function is @code{org-store-link}, called with @kbd{M-x org-store-link}. Because of its importance, we suggest to bind it 700 to a widely available key (see @ref{Activation}). It stores a link to the 701 current location. The link is stored for later insertion into an Org 702 buffer---see below. 703 704 From an Org buffer, the following commands create, navigate or, more 705 generally, act on links. 706 707 @table @asis 708 @item @kbd{C-c C-l} (@code{org-insert-link}) 709 Insert a link. This prompts for a link to be inserted into the 710 buffer. You can just type a link, or use history keys @kbd{@key{UP}} 711 and @kbd{@key{DOWN}} to access stored links. You will be prompted 712 for the description part of the link. 713 714 When called with a @kbd{C-u} prefix argument, file name 715 completion is used to link to a file. 716 717 @item @kbd{C-c C-l} (with point on existing link) (@code{org-insert-link}) 718 When point is on an existing link, @kbd{C-c C-l} allows you to 719 edit the link and description parts of the link. 720 721 @item @kbd{C-c C-o} (@code{open-link-at-point}) 722 Open link at point. 723 724 @item @kbd{C-c &} (@code{org-mark-ring-goto}) 725 Jump back to a recorded position. A position is recorded by the 726 commands following internal links, and by @kbd{C-c %}. Using 727 this command several times in direct succession moves through a ring 728 of previously recorded positions. 729 @end table 730 731 @node TODO Items 732 @chapter TODO Items 733 734 Org mode does not require TODO lists to live in separate documents. 735 Instead, TODO items are part of a notes file, because TODO items 736 usually come up while taking notes! With Org mode, simply mark any 737 entry in a tree as being a TODO item. In this way, information is not 738 duplicated, and TODO items remain in the context from which they 739 emerged. 740 741 Org mode provides methods to give you an overview of all the things 742 that you have to do, collected from many files. 743 744 @menu 745 * TODO Basics:: Marking and displaying TODO entries. 746 * Multi-state Workflow:: More than just on/off. 747 * Progress Logging:: Dates and notes for progress. 748 * Priorities:: Some things are more important than others. 749 * Breaking Down Tasks:: Splitting a task into manageable pieces. 750 * Checkboxes:: Tick-off lists. 751 @end menu 752 753 @node TODO Basics 754 @section Basic TODO Functionality 755 756 Any headline becomes a TODO item when it starts with the word @samp{TODO}, 757 for example: 758 759 @example 760 *** TODO Write letter to Sam Fortune 761 @end example 762 763 764 The most important commands to work with TODO entries are: 765 766 @table @asis 767 @item @kbd{C-c C-t} (@code{org-todo}) 768 Rotate the TODO state of the current item among 769 770 @example 771 ,-> (unmarked) -> TODO -> DONE --. 772 '--------------------------------' 773 @end example 774 775 776 The same rotation can also be done ``remotely'' from the agenda buffer 777 with the @kbd{t} command key (see @ref{Agenda Commands}). 778 779 @item @kbd{S-@key{RIGHT}} (@code{org-shiftright}) 780 @itemx @kbd{S-@key{LEFT}} (@code{org-shiftleft}) 781 Select the following/preceding TODO state, similar to cycling. 782 783 @item @kbd{C-c / t} (@code{org-show-todo-tree}) 784 View TODO items in a @emph{sparse tree} (see @ref{Sparse Trees}). Folds the 785 entire buffer, but shows all TODO items---with not-DONE state---and 786 the headings hierarchy above them. 787 788 @item @kbd{M-x org-agenda t} (@code{org-todo-list}) 789 Show the global TODO list. Collects the TODO items (with not-DONE 790 states) from all agenda files (see @ref{Agenda Views}) into a single 791 buffer. See @ref{Global TODO List}, for more information. 792 793 @item @kbd{S-M-@key{RET}} (@code{org-insert-todo-heading}) 794 Insert a new TODO entry below the current one. 795 @end table 796 797 Changing a TODO state can also trigger tag changes. See the docstring 798 of the option @code{org-todo-state-tags-triggers} for details. 799 800 @node Multi-state Workflow 801 @section Multi-state Workflow 802 803 You can use TODO keywords to indicate @emph{sequential} working progress 804 states: 805 806 @lisp 807 (setq org-todo-keywords 808 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED"))) 809 @end lisp 810 811 @noindent 812 The vertical bar separates the @samp{TODO} keywords (states that @emph{need 813 action}) from the @samp{DONE} states (which need @emph{no further action}). If 814 you do not provide the separator bar, the last state is used as the 815 @samp{DONE} state. With this setup, the command @kbd{C-c C-t} cycles 816 an entry from @samp{TODO} to @samp{FEEDBACK}, then to @samp{VERIFY}, and finally to 817 @samp{DONE} and @samp{DELEGATED}. 818 819 Sometimes you may want to use different sets of TODO keywords in 820 parallel. For example, you may want to have the basic @samp{TODO=/=DONE}, 821 but also a workflow for bug fixing. Your setup would then look like 822 this: 823 824 @lisp 825 (setq org-todo-keywords 826 '((sequence "TODO(t)" "|" "DONE(d)") 827 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)"))) 828 @end lisp 829 830 @noindent 831 The keywords should all be different, this helps Org mode to keep 832 track of which subsequence should be used for a given entry. The 833 example also shows how to define keys for fast access of a particular 834 state, by adding a letter in parenthesis after each keyword---you will 835 be prompted for the key after @kbd{C-c C-t}. 836 837 To define TODO keywords that are valid only in a single file, use the 838 following text anywhere in the file. 839 840 @example 841 #+TODO: TODO(t) | DONE(d) 842 #+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f) 843 #+TODO: | CANCELED(c) 844 @end example 845 846 After changing one of these lines, use @kbd{C-c C-c} with the 847 cursor still in the line to make the changes known to Org mode. 848 849 @node Progress Logging 850 @section Progress Logging 851 852 To record a timestamp and a note when changing a TODO state, call the 853 command @code{org-todo} with a prefix argument. 854 855 @table @asis 856 @item @kbd{C-u C-c C-t} (@code{org-todo}) 857 Prompt for a note and record a the time of the TODO state change. 858 @end table 859 860 Org mode can also automatically record a timestamp and optionally a 861 note when you mark a TODO item as DONE, or even each time you change 862 the state of a TODO item. This system is highly configurable, 863 settings can be on a per-keyword basis and can be localized to a file 864 or even a subtree. For information on how to clock working time for a 865 task, see @ref{Clocking Work Time}. 866 867 @anchor{Closing items} 868 @subheading Closing items 869 870 The most basic logging is to keep track of @emph{when} a certain TODO item 871 was marked as done. This can be achieved with@footnote{The corresponding in-buffer setting is @samp{#+STARTUP: logdone}.} 872 873 @lisp 874 (setq org-log-done 'time) 875 @end lisp 876 877 @noindent 878 Then each time you turn an entry from a TODO (not-done) state into any 879 of the DONE states, a line @samp{CLOSED: [timestamp]} is inserted just 880 after the headline. 881 882 If you want to record a note along with the timestamp, use@footnote{The corresponding in-buffer setting is @samp{#+STARTUP: 883 logenotedone}.} 884 885 @lisp 886 (setq org-log-done 'note) 887 @end lisp 888 889 @noindent 890 You are then be prompted for a note, and that note is stored below the 891 entry with a @samp{Closing Note} heading. 892 893 @anchor{Tracking TODO state changes} 894 @subheading Tracking TODO state changes 895 896 You might want to keep track of TODO state changes. You can either 897 record just a timestamp, or a time-stamped note for a change. These 898 records are inserted after the headline as an itemized list. When 899 taking a lot of notes, you might want to get the notes out of the way 900 into a drawer. Customize the variable @code{org-log-into-drawer} to get 901 this behavior. 902 903 For state logging, Org mode expects configuration on a per-keyword 904 basis. This is achieved by adding special markers @samp{!} (for 905 a timestamp) and @samp{@@} (for a note) in parentheses after each keyword. 906 For example: 907 908 @example 909 #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@) 910 @end example 911 912 913 @noindent 914 defines TODO keywords and fast access keys, and also request that 915 a time is recorded when the entry is set to @samp{DONE}, and that a note is 916 recorded when switching to @samp{WAIT} or @samp{CANCELED}. The same syntax 917 works also when setting @code{org-todo-keywords}. 918 919 @node Priorities 920 @section Priorities 921 922 If you use Org mode extensively, you may end up with enough TODO items 923 that it starts to make sense to prioritize them. Prioritizing can be 924 done by placing a @emph{priority cookie} into the headline of a TODO item, 925 like this 926 927 @example 928 *** TODO [#A] Write letter to Sam Fortune 929 @end example 930 931 932 Org mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}. @samp{A} is the 933 highest, @samp{B} the default if none is given. Priorities make 934 a difference only in the agenda. 935 936 @table @asis 937 @item @kbd{C-c ,} (@code{org-priority}) 938 Set the priority of the current headline. Press @kbd{A}, 939 @kbd{B} or @kbd{C} to select a priority, or @kbd{@key{SPC}} 940 to remove the cookie. 941 942 @item @kbd{S-@key{UP}} (@code{org-priority-up}) 943 @itemx @kbd{S-@key{DOWN}} (@code{org-priority-down}) 944 Increase/decrease the priority of the current headline. 945 @end table 946 947 @node Breaking Down Tasks 948 @section Breaking Tasks Down into Subtasks 949 950 It is often advisable to break down large tasks into smaller, 951 manageable subtasks. You can do this by creating an outline tree 952 below a TODO item, with detailed subtasks on the tree. To keep an 953 overview of the fraction of subtasks that have already been marked 954 as done, insert either @samp{[/]} or @samp{[%]} anywhere in the headline. These 955 cookies are updated each time the TODO status of a child changes, or 956 when pressing @kbd{C-c C-c} on the cookie. For example: 957 958 @example 959 * Organize Party [33%] 960 ** TODO Call people [1/2] 961 *** TODO Peter 962 *** DONE Sarah 963 ** TODO Buy food 964 ** DONE Talk to neighbor 965 @end example 966 967 @node Checkboxes 968 @section Checkboxes 969 970 Every item in a plain list (see @ref{Plain Lists}) can be made into 971 a checkbox by starting it with the string @samp{[ ]}. Checkboxes are not 972 included into the global TODO list, so they are often great to split 973 a task into a number of simple steps. 974 975 Here is an example of a checkbox list. 976 977 @example 978 * TODO Organize party [2/4] 979 - [-] call people [1/2] 980 - [ ] Peter 981 - [X] Sarah 982 - [X] order food 983 @end example 984 985 Checkboxes work hierarchically, so if a checkbox item has children 986 that are checkboxes, toggling one of the children checkboxes makes the 987 parent checkbox reflect if none, some, or all of the children are 988 checked. 989 990 The following commands work with checkboxes: 991 992 @table @asis 993 @item @kbd{C-c C-c}, @kbd{C-u C-c C-c} (@code{org-toggle-checkbox}) 994 Toggle checkbox status or---with prefix argument---checkbox presence 995 at point. 996 997 @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading}) 998 Insert a new item with a checkbox. This works only if point is 999 already in a plain list item (see @ref{Plain Lists}). 1000 @end table 1001 1002 @node Tags 1003 @chapter Tags 1004 1005 An excellent way to implement labels and contexts for 1006 cross-correlating information is to assign @emph{tags} to headlines. Org 1007 mode has extensive support for tags. 1008 1009 Every headline can contain a list of tags; they occur at the end of 1010 the headline. Tags are normal words containing letters, numbers, @samp{_}, 1011 and @samp{@@}. Tags must be preceded and followed by a single colon, e.g., 1012 @samp{:work:}. Several tags can be specified, as in @samp{:work:urgent:}. Tags 1013 by default are in bold face with the same color as the headline. 1014 1015 @anchor{Tag inheritance} 1016 @heading Tag inheritance 1017 1018 Tags make use of the hierarchical structure of outline trees. If 1019 a heading has a certain tag, all subheadings inherit the tag as well. 1020 For example, in the list 1021 1022 @example 1023 * Meeting with the French group :work: 1024 ** Summary by Frank :boss:notes: 1025 *** TODO Prepare slides for him :action: 1026 @end example 1027 1028 @noindent 1029 the final heading has the tags @samp{work}, @samp{boss}, @samp{notes}, and @samp{action} 1030 even though the final heading is not explicitly marked with those 1031 tags. 1032 1033 You can also set tags that all entries in a file should inherit just 1034 as if these tags were defined in a hypothetical level zero that 1035 surrounds the entire file. Use a line like this@footnote{As with all these in-buffer settings, pressing @kbd{C-c C-c} activates any changes in the line.}: 1036 1037 @example 1038 #+FILETAGS: :Peter:Boss:Secret: 1039 @end example 1040 1041 @anchor{Setting tags} 1042 @heading Setting tags 1043 1044 Tags can simply be typed into the buffer at the end of a headline. 1045 After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is 1046 also a special command for inserting tags: 1047 1048 @table @asis 1049 @item @kbd{C-c C-q} (@code{org-set-tags-command}) 1050 Enter new tags for the current headline. Org mode either offers 1051 completion or a special single-key interface for setting tags, see 1052 below. 1053 1054 @item @kbd{C-c C-c} (@code{org-set-tags-command}) 1055 When point is in a headline, this does the same as @kbd{C-c C-q}. 1056 @end table 1057 1058 Org supports tag insertion based on a @emph{list of tags}. By default this 1059 list is constructed dynamically, containing all tags currently used in 1060 the buffer. You may also globally specify a hard list of tags with 1061 the variable @code{org-tag-alist}. Finally you can set the default tags 1062 for a given file using the @samp{TAGS} keyword, like 1063 1064 @example 1065 #+TAGS: @@work @@home @@tennisclub 1066 #+TAGS: laptop car pc sailboat 1067 @end example 1068 1069 1070 By default Org mode uses the standard minibuffer completion facilities 1071 for entering tags. However, it also implements another, quicker, tag 1072 selection method called @emph{fast tag selection}. This allows you to 1073 select and deselect tags with just a single key press. For this to 1074 work well you should assign unique letters to most of your commonly 1075 used tags. You can do this globally by configuring the variable 1076 @code{org-tag-alist} in your Emacs init file. For example, you may find 1077 the need to tag many items in different files with @samp{@@home}. In this 1078 case you can set something like: 1079 1080 @lisp 1081 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l))) 1082 @end lisp 1083 1084 If the tag is only relevant to the file you are working on, then you 1085 can instead set the @samp{TAGS} keyword as: 1086 1087 @example 1088 #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p) 1089 @end example 1090 1091 @anchor{Tag groups} 1092 @heading Tag groups 1093 1094 A tag can be defined as a @emph{group tag} for a set of other tags. The 1095 group tag can be seen as the ``broader term'' for its set of tags. 1096 1097 You can set group tags by using brackets and inserting a colon between 1098 the group tag and its related tags: 1099 1100 @example 1101 #+TAGS: [ GTD : Control Persp ] 1102 @end example 1103 1104 1105 @noindent 1106 or, if tags in the group should be mutually exclusive: 1107 1108 @example 1109 #+TAGS: @{ Context : @@Home @@Work @} 1110 @end example 1111 1112 1113 When you search for a group tag, it return matches for all members in 1114 the group and its subgroups. In an agenda view, filtering by a group 1115 tag displays or hide headlines tagged with at least one of the members 1116 of the group or any of its subgroups. 1117 1118 If you want to ignore group tags temporarily, toggle group tags 1119 support with @code{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}. 1120 1121 @anchor{Tag searches} 1122 @heading Tag searches 1123 1124 @table @asis 1125 @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree}) 1126 Create a sparse tree with all headlines matching a tags search. 1127 With a @kbd{C-u} prefix argument, ignore headlines that are not 1128 a TODO line. 1129 1130 @item @kbd{M-x org-agenda m} (@code{org-tags-view}) 1131 Create a global list of tag matches from all agenda files. See 1132 @ref{Matching Tags and Properties}. 1133 1134 @item @kbd{M-x org-agenda M} (@code{org-tags-view}) 1135 Create a global list of tag matches from all agenda files, but check 1136 only TODO items. 1137 @end table 1138 1139 These commands all prompt for a match string which allows basic 1140 Boolean logic like @samp{+boss+urgent-project1}, to find entries with tags 1141 @samp{boss} and @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find 1142 entries which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of 1143 the search string is rich and allows also matching against TODO 1144 keywords, entry levels and properties. For a more detailed description 1145 with many examples, see @ref{Matching Tags and Properties}. 1146 1147 @node Properties 1148 @chapter Properties 1149 1150 Properties are key-value pairs associated with an entry. They live in 1151 a special drawer with the name @samp{PROPERTIES}. Each property is 1152 specified on a single line, with the key (surrounded by colons) first, 1153 and the value after it: 1154 1155 @example 1156 * CD collection 1157 ** Classic 1158 *** Goldberg Variations 1159 :PROPERTIES: 1160 :Title: Goldberg Variations 1161 :Composer: J.S. Bach 1162 :Publisher: Deutsche Grammophon 1163 :NDisks: 1 1164 :END: 1165 @end example 1166 1167 You may define the allowed values for a particular property @samp{Xyz} by 1168 setting a property @samp{Xyz_ALL}. This special property is @emph{inherited}, 1169 so if you set it in a level 1 entry, it applies to the entire tree. 1170 When allowed values are defined, setting the corresponding property 1171 becomes easier and is less prone to typing errors. For the example 1172 with the CD collection, we can pre-define publishers and the number of 1173 disks in a box like this: 1174 1175 @example 1176 * CD collection 1177 :PROPERTIES: 1178 :NDisks_ALL: 1 2 3 4 1179 :Publisher_ALL: "Deutsche Grammophon" Philips EMI 1180 :END: 1181 @end example 1182 1183 If you want to set properties that can be inherited by any entry in 1184 a file, use a line like: 1185 1186 @example 1187 #+PROPERTY: NDisks_ALL 1 2 3 4 1188 @end example 1189 1190 1191 The following commands help to work with properties: 1192 1193 @table @asis 1194 @item @kbd{C-c C-x p} (@code{org-set-property}) 1195 Set a property. This prompts for a property name and a value. 1196 1197 @item @kbd{C-c C-c d} (@code{org-delete-property}) 1198 Remove a property from the current entry. 1199 @end table 1200 1201 To create sparse trees and special lists with selection based on 1202 properties, the same commands are used as for tag searches (see 1203 @ref{Tags}). The syntax for the search string is described in @ref{Matching Tags and Properties}. 1204 1205 @node Dates and Times 1206 @chapter Dates and Times 1207 1208 To assist project planning, TODO items can be labeled with a date 1209 and/or a time. The specially formatted string carrying the date and 1210 time information is called a @emph{timestamp} in Org mode. This may be 1211 a little confusing because timestamp is often used as indicating when 1212 something was created or last changed. However, in Org mode this term 1213 is used in a much wider sense. 1214 1215 Timestamps can be used to plan appointments, schedule tasks, set 1216 deadlines, track time, and more. The following sections describe 1217 the timestamp format and tooling that Org mode provides for common 1218 use cases dealing with time and time intervals. 1219 1220 @menu 1221 * Timestamps:: Assigning a time to a tree entry. 1222 * Creating Timestamps:: Commands that insert timestamps. 1223 * Deadlines and Scheduling:: Planning your work. 1224 * Clocking Work Time:: Tracking how long you spent on a task. 1225 @end menu 1226 1227 @node Timestamps 1228 @section Timestamps 1229 1230 A timestamp is a specification of a date---possibly with a time or 1231 a range of times---in a special format, either @samp{<2003-09-16 Tue>} or 1232 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue 12:00-12:30>}. 1233 A timestamp can appear anywhere in the headline or body of an Org tree 1234 entry. Its presence causes entries to be shown on specific dates in 1235 the agenda (see @ref{Built-in Agenda Views}). We distinguish: 1236 1237 @table @asis 1238 @item Plain timestamp; Event; Appointment 1239 A simple timestamp just assigns a date/time to an item. This is 1240 just like writing down an appointment or event in a paper agenda. 1241 There can be multiple timestamps in an item. 1242 1243 @example 1244 * Meet Peter at the movies 1245 <2006-11-01 Wed 19:15> 1246 * Discussion on climate change 1247 <2006-11-02 Thu 20:00-22:00> 1248 * My days off 1249 <2006-11-03 Fri> 1250 <2006-11-06 Mon> 1251 @end example 1252 1253 @item Timestamp with repeater interval 1254 A timestamp may contain a @emph{repeater interval}, indicating that it 1255 applies not only on the given date, but again and again after 1256 a certain interval of N hours (h), days (d), weeks (w), months (m), 1257 or years (y). The following shows up in the agenda every Wednesday: 1258 1259 @example 1260 * Pick up Sam at school 1261 <2007-05-16 Wed 12:30 +1w> 1262 @end example 1263 1264 @item Diary-style expression entries 1265 For more complex date specifications, Org mode supports using the 1266 special expression diary entries implemented in the Emacs Calendar 1267 package. For example, with optional time: 1268 1269 @example 1270 * 22:00-23:00 The nerd meeting on every 2nd Thursday of the month 1271 <%%(diary-float t 4 2)> 1272 @end example 1273 1274 @item Time range 1275 Time range is a timestamp having two time units connected by @samp{-} 1276 1277 @example 1278 * Discussion on climate change 1279 <2006-11-02 Thu 10:00-12:00> 1280 @end example 1281 1282 @item Time/Date range 1283 Two timestamps connected by @samp{--} denote a range. In the agenda, the 1284 headline is shown on the first and last day of the range, and on any 1285 dates that are displayed and fall in the range. The first example 1286 specifies just the dates of the range while the second example 1287 specifies a time range for each date. 1288 1289 @example 1290 ** Meeting in Amsterdam 1291 <2004-08-23 Mon>--<2004-08-26 Thu> 1292 ** This weeks committee meetings 1293 <2004-08-23 Mon 10:00-11:00>--<2004-08-26 Thu 10:00-11:00> 1294 @end example 1295 1296 @item Inactive timestamp 1297 Just like a plain timestamp, but with square brackets instead of 1298 angular ones. These timestamps are inactive in the sense that they 1299 do @emph{not} trigger an entry to show up in the agenda. 1300 1301 @example 1302 * Gillian comes late for the fifth time 1303 [2006-11-01 Wed] 1304 @end example 1305 @end table 1306 1307 @node Creating Timestamps 1308 @section Creating Timestamps 1309 1310 For Org mode to recognize timestamps, they need to be in the specific 1311 format. All commands listed below produce timestamps in the correct 1312 format. 1313 1314 @table @asis 1315 @item @kbd{C-c .} (@code{org-timestamp}) 1316 Prompt for a date and insert a corresponding timestamp. When point 1317 is at an existing timestamp in the buffer, the command is used to 1318 modify this timestamp instead of inserting a new one. When this 1319 command is used twice in succession, a time range is inserted. With 1320 a prefix argument, it also adds the current time. 1321 1322 @item @kbd{C-c !} (@code{org-timestamp-inactive}) 1323 Like @kbd{C-c .}, but insert an inactive timestamp that does 1324 not cause an agenda entry. 1325 1326 @item @kbd{S-@key{LEFT}} (@code{org-timestamp-down-day}) 1327 @itemx @kbd{S-@key{RIGHT}} (@code{org-timestamp-up-day}) 1328 Change date at point by one day. 1329 1330 @item @kbd{S-@key{UP}} (@code{org-timestamp-up}) 1331 @itemx @kbd{S-@key{DOWN}} (@code{org-timestamp-down}) 1332 On the beginning or enclosing bracket of a timestamp, change its 1333 type. Within a timestamp, change the item under point. Point can 1334 be on a year, month, day, hour or minute. When the timestamp 1335 contains a time range like @samp{15:30-16:30}, modifying the first time 1336 also shifts the second, shifting the time block with constant 1337 length. To change the length, modify the second time. 1338 @end table 1339 1340 1341 When Org mode prompts for a date/time, it accepts any string 1342 containing some date and/or time information, and intelligently 1343 interprets the string, deriving defaults for unspecified information 1344 from the current date and time. You can also select a date in the 1345 pop-up calendar. See the @ref{Top,manual,,org,} for more information on how exactly 1346 the date/time prompt works. 1347 1348 @node Deadlines and Scheduling 1349 @section Deadlines and Scheduling 1350 1351 A timestamp may be preceded by special keywords to facilitate 1352 planning: 1353 1354 @table @asis 1355 @item @kbd{C-c C-d} (@code{org-deadline}) 1356 Insert @samp{DEADLINE} keyword along with a time stamp, in the line 1357 following the headline. 1358 1359 Meaning: the task---most likely a TODO item, though not 1360 necessarily---is supposed to be finished on that date. 1361 1362 On the deadline date, the task is listed in the agenda. In 1363 addition, the agenda for @emph{today} carries a warning about the 1364 approaching or missed deadline, starting @code{org-deadline-warning-days} 1365 before the due date, and continuing until the entry is marked as 1366 done. An example: 1367 1368 @example 1369 *** TODO write article about the Earth for the Guide 1370 DEADLINE: <2004-02-29 Sun> 1371 The editor in charge is [[bbdb:Ford Prefect]] 1372 @end example 1373 1374 @item @kbd{C-c C-s} (@code{org-schedule}) 1375 Insert @samp{SCHEDULED} keyword along with a stamp, in the line following 1376 the headline. 1377 1378 Meaning: you are planning to start working on that task on the given 1379 date@footnote{This is quite different from what is normally understood by 1380 @emph{scheduling a meeting}, which is done in Org by just inserting a time 1381 stamp without keyword.}. 1382 1383 The headline is listed under the given date@footnote{It will still be listed on that date after it has been marked 1384 as done. If you do not like this, set the variable 1385 @code{org-agenda-skip-scheduled-if-done}.}. In addition, 1386 a reminder that the scheduled date has passed is present in the 1387 compilation for @emph{today}, until the entry is marked as done, i.e., 1388 the task is automatically forwarded until completed. 1389 1390 @example 1391 *** TODO Call Trillian for a date on New Years Eve. 1392 SCHEDULED: <2004-12-25 Sat> 1393 @end example 1394 @end table 1395 1396 Some tasks need to be repeated again and again. Org mode helps to 1397 organize such tasks using a so-called repeater in a @samp{DEADLINE}, 1398 @samp{SCHEDULED}, or plain timestamps. In the following example: 1399 1400 @example 1401 ** TODO Pay the rent 1402 DEADLINE: <2005-10-01 Sat +1m> 1403 @end example 1404 1405 @noindent 1406 the @samp{+1m} is a repeater; the intended interpretation is that the task 1407 has a deadline on @samp{<2005-10-01>} and repeats itself every (one) month 1408 starting from that time. 1409 1410 @node Clocking Work Time 1411 @section Clocking Work Time 1412 1413 Org mode allows you to clock the time you spend on specific tasks in 1414 a project. 1415 1416 @table @asis 1417 @item @kbd{C-c C-x C-i} (@code{org-clock-in}) 1418 Start the clock on the current item (clock-in). This inserts the 1419 @samp{CLOCK} keyword together with a timestamp. When called with 1420 a @kbd{C-u} prefix argument, select the task from a list of 1421 recently clocked tasks. 1422 1423 @item @kbd{C-c C-x C-o} (@code{org-clock-out}) 1424 Stop the clock (clock-out). This inserts another timestamp at the 1425 same location where the clock was last started. It also directly 1426 computes the resulting time in inserts it after the time range as 1427 @samp{=>HH:MM}. 1428 1429 @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate}) 1430 Update the effort estimate for the current clock task. 1431 1432 @item @kbd{C-c C-x C-q} (@code{org-clock-cancel}) 1433 Cancel the current clock. This is useful if a clock was started by 1434 mistake, or if you ended up working on something else. 1435 1436 @item @kbd{C-c C-x C-j} (@code{org-clock-goto}) 1437 Jump to the headline of the currently clocked in task. With 1438 a @kbd{C-u} prefix argument, select the target task from a list 1439 of recently clocked tasks. 1440 @end table 1441 1442 The @kbd{l} key may be used in the agenda (see @ref{Built-in Agenda Views}) to show which tasks have been worked on or closed during 1443 a day. 1444 1445 @node Capture Refile Archive 1446 @chapter Capture, Refile, Archive 1447 1448 An important part of any organization system is the ability to quickly 1449 capture new ideas and tasks, and to associate reference material with 1450 them. Org does this using a process called @emph{capture}. It also can 1451 store files related to a task (@emph{attachments}) in a special directory. 1452 Once in the system, tasks and projects need to be moved around. 1453 Moving completed project trees to an archive file keeps the system 1454 compact and fast. 1455 1456 @menu 1457 * Capture:: Capturing new stuff. 1458 * Refile and Copy:: Moving/copying a tree from one place to another. 1459 * Archiving:: What to do with finished products. 1460 @end menu 1461 1462 @node Capture 1463 @section Capture 1464 1465 Capture lets you quickly store notes with little interruption of your 1466 work flow. You can define templates for new entries and associate 1467 them with different targets for storing notes. 1468 1469 @anchor{Setting up capture} 1470 @subheading Setting up capture 1471 1472 The following customization sets a default target@footnote{Using capture templates, you get finer control over capture 1473 locations. See @ref{Capture templates}.} file for notes. 1474 1475 @lisp 1476 (setq org-default-notes-file (concat org-directory "/notes.org")) 1477 @end lisp 1478 1479 You may also define a global key for capturing new material (see 1480 @ref{Activation}). 1481 1482 @anchor{Using capture} 1483 @subheading Using capture 1484 1485 @table @asis 1486 @item @kbd{M-x org-capture} (@code{org-capture}) 1487 Start a capture process, placing you into a narrowed indirect buffer 1488 to edit. 1489 1490 @item @kbd{C-c C-c} (@code{org-capture-finalize}) 1491 Once you have finished entering information into the capture buffer, 1492 @kbd{C-c C-c} returns you to the window configuration before 1493 the capture process, so that you can resume your work without 1494 further distraction. 1495 1496 @item @kbd{C-c C-w} (@code{org-capture-refile}) 1497 Finalize the capture process by refiling the note to a different 1498 place (see @ref{Refile and Copy}). 1499 1500 @item @kbd{C-c C-k} (@code{org-capture-kill}) 1501 Abort the capture process and return to the previous state. 1502 @end table 1503 1504 @anchor{Capture templates} 1505 @subheading Capture templates 1506 1507 You can use templates for different types of capture items, and for 1508 different target locations. Say you would like to use one template to 1509 create general TODO entries, and you want to put these entries under 1510 the heading @samp{Tasks} in your file @samp{~/org/gtd.org}. Also, a date tree 1511 in the file @samp{journal.org} should capture journal entries. A possible 1512 configuration would look like: 1513 1514 @lisp 1515 (setq org-capture-templates 1516 '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks") 1517 "* TODO %?\n %i\n %a") 1518 ("j" "Journal" entry (file+datetree "~/org/journal.org") 1519 "* %?\nEntered on %U\n %i\n %a"))) 1520 @end lisp 1521 1522 If you then press @kbd{t} from the capture menu, Org will prepare 1523 the template for you like this: 1524 1525 @example 1526 * TODO 1527 [[file:LINK TO WHERE YOU INITIATED CAPTURE]] 1528 @end example 1529 1530 1531 @noindent 1532 During expansion of the template, special %-escapes@footnote{If you need one of these sequences literally, escape the @samp{%} 1533 with a backslash.} allow 1534 dynamic insertion of content. Here is a small selection of the 1535 possibilities, consult the @ref{Top,manual,,org,} for more. 1536 1537 @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 1538 @item @samp{%a} 1539 @tab annotation, normally the link created with @code{org-store-link} 1540 @item @samp{%i} 1541 @tab initial content, the region when capture is called with @kbd{C-u} 1542 @item @samp{%t}, @samp{%T} 1543 @tab timestamp, date only, or date and time 1544 @item @samp{%u}, @samp{%U} 1545 @tab like above, but inactive timestamps 1546 @item @samp{%?} 1547 @tab after completing the template, position point here 1548 @end multitable 1549 1550 @node Refile and Copy 1551 @section Refile and Copy 1552 1553 When reviewing the captured data, you may want to refile or to copy 1554 some of the entries into a different list, for example into a project. 1555 Cutting, finding the right location, and then pasting the note is 1556 cumbersome. To simplify this process, you can use the following 1557 special command: 1558 1559 @table @asis 1560 @item @kbd{C-c C-w} (@code{org-agenda-refile}) 1561 Refile the entry or region at point. This command offers possible 1562 locations for refiling the entry and lets you select one with 1563 completion. The item (or all items in the region) is filed below 1564 the target heading as a subitem. 1565 1566 By default, all level 1 headlines in the current buffer are 1567 considered to be targets, but you can have more complex definitions 1568 across a number of files. See the variable @code{org-refile-targets} for 1569 details. 1570 1571 @item @kbd{C-u C-c C-w} (@code{org-agenda-refile}) 1572 Use the refile interface to jump to a heading. 1573 1574 @item @kbd{C-u C-u C-c C-w} (@code{org-refile-goto-last-stored}) 1575 Jump to the location where @code{org-refile} last moved a tree to. 1576 1577 @item @kbd{C-c M-w} (@code{org-refile-copy}) 1578 Copying works like refiling, except that the original note is not 1579 deleted. 1580 @end table 1581 1582 @node Archiving 1583 @section Archiving 1584 1585 When a project represented by a (sub)tree is finished, you may want to 1586 move the tree out of the way and to stop it from contributing to the 1587 agenda. Archiving is important to keep your working files compact and 1588 global searches like the construction of agenda views fast. 1589 1590 The most common archiving action is to move a project tree to another 1591 file, the archive file. 1592 1593 @table @asis 1594 @item @kbd{C-c C-x C-a} (@code{org-archive-subtree-default}) 1595 Archive the current entry using the command specified in the 1596 variable @code{org-archive-default-command}. 1597 1598 @item @kbd{C-c C-x C-s} or short @kbd{C-c $} (@code{org-archive-subtree}) 1599 Archive the subtree starting at point position to the location given 1600 by @code{org-archive-location}. 1601 @end table 1602 1603 The default archive location is a file in the same directory as the 1604 current file, with the name derived by appending @samp{_archive} to the 1605 current file name. You can also choose what heading to file archived 1606 items under, with the possibility to add them to a datetree in a file. 1607 For information and examples on how to specify the file and the 1608 heading, see the documentation string of the variable 1609 @code{org-archive-location}. 1610 1611 There is also an in-buffer option for setting this variable, for 1612 example: 1613 1614 @example 1615 #+ARCHIVE: %s_done:: 1616 @end example 1617 1618 @node Agenda Views 1619 @chapter Agenda Views 1620 1621 Due to the way Org works, TODO items, time-stamped items, and tagged 1622 headlines can be scattered throughout a file or even a number of 1623 files. To get an overview of open action items, or of events that are 1624 important for a particular date, this information must be collected, 1625 sorted and displayed in an organized way. 1626 1627 The extracted information is displayed in a special @emph{agenda buffer}. 1628 This buffer is read-only, but provides commands to visit the 1629 corresponding locations in the original Org files, and even to edit 1630 these files remotely. Remote editing from the agenda buffer means, 1631 for example, that you can change the dates of deadlines and 1632 appointments from the agenda buffer. For commands available in the 1633 Agenda buffer, see @ref{Agenda Commands}. 1634 1635 @menu 1636 * Agenda Files:: Files being searched for agenda information. 1637 * Agenda Dispatcher:: Keyboard access to agenda views. 1638 * Built-in Agenda Views:: What is available out of the box? 1639 * Global TODO List:: All unfinished action items. 1640 * Matching Tags and Properties:: Structured information with fine-tuned search. 1641 * Search View:: Find entries by searching for text. 1642 * Agenda Commands:: Remote editing of Org trees. 1643 * Custom Agenda Views:: Defining special searches and views. 1644 @end menu 1645 1646 @node Agenda Files 1647 @section Agenda Files 1648 1649 The information to be shown is normally collected from all @emph{agenda 1650 files}, the files listed in the variable @code{org-agenda-files}. 1651 1652 @table @asis 1653 @item @kbd{C-c [} (@code{org-agenda-file-to-front}) 1654 Add current file to the list of agenda files. The file is added to 1655 the front of the list. If it was already in the list, it is moved 1656 to the front. With a prefix argument, file is added/moved to the 1657 end. 1658 1659 @item @kbd{C-c ]} (@code{org-remove-file}) 1660 Remove current file from the list of agenda files. 1661 1662 @item @kbd{C-'} 1663 @itemx @kbd{C-,} (@code{org-cycle-agenda-files}) 1664 Cycle through agenda file list, visiting one file after the other. 1665 @end table 1666 1667 @node Agenda Dispatcher 1668 @section The Agenda Dispatcher 1669 1670 The views are created through a dispatcher, accessible with @kbd{M-x org-agenda}, or, better, bound to a global key (see @ref{Activation}). 1671 It displays a menu from which an additional letter is required to 1672 execute a command. The dispatcher offers the following default 1673 commands: 1674 1675 @table @asis 1676 @item @kbd{a} 1677 Create the calendar-like agenda (see @ref{Built-in Agenda Views}). 1678 1679 @item @kbd{t} 1680 @itemx @kbd{T} 1681 Create a list of all TODO items (see @ref{Global TODO List}). 1682 1683 @item @kbd{m} 1684 @itemx @kbd{M} 1685 Create a list of headlines matching a given expression (see 1686 @ref{Matching Tags and Properties}). 1687 1688 @item @kbd{s} 1689 @kindex s @r{(Agenda dispatcher)} 1690 Create a list of entries selected by a boolean expression of 1691 keywords and/or regular expressions that must or must not occur in 1692 the entry. 1693 @end table 1694 1695 @node Built-in Agenda Views 1696 @section The Weekly/Daily Agenda 1697 1698 The purpose of the weekly/daily @emph{agenda} is to act like a page of 1699 a paper agenda, showing all the tasks for the current week or day. 1700 1701 @table @asis 1702 @item @kbd{M-x org-agenda a} (@code{org-agenda-list}) 1703 Compile an agenda for the current week from a list of Org files. 1704 The agenda shows the entries for each day. 1705 @end table 1706 1707 Org mode understands the syntax of the diary and allows you to use 1708 diary expression entries directly in Org files: 1709 1710 @example 1711 * Holidays 1712 :PROPERTIES: 1713 :CATEGORY: Holiday 1714 :END: 1715 %%(org-calendar-holiday) ; special function for holiday names 1716 1717 * Birthdays 1718 :PROPERTIES: 1719 :CATEGORY: Ann 1720 :END: 1721 %%(org-anniversary 1956 5 14) Arthur Dent is %d years old 1722 %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old 1723 @end example 1724 1725 Org can interact with Emacs appointments notification facility. To 1726 add the appointments of your agenda files, use the command 1727 @code{org-agenda-to-appt}. 1728 1729 @node Global TODO List 1730 @section The Global TODO List 1731 1732 The global TODO list contains all unfinished TODO items formatted and 1733 collected into a single place. Remote editing of TODO items lets you 1734 can change the state of a TODO entry with a single key press. For 1735 commands available in the TODO list, see @ref{Agenda Commands}. 1736 1737 @table @asis 1738 @item @kbd{M-x org-agenda t} (@code{org-todo-list}) 1739 Show the global TODO list. This collects the TODO items from all 1740 agenda files (see @ref{Agenda Views}) into a single buffer. 1741 1742 @item @kbd{M-x org-agenda T} (@code{org-todo-list}) 1743 Like the above, but allows selection of a specific TODO keyword. 1744 @end table 1745 1746 @node Matching Tags and Properties 1747 @section Matching Tags and Properties 1748 1749 If headlines in the agenda files are marked with @emph{tags} (see @ref{Tags}), 1750 or have properties (see @ref{Properties}), you can select headlines based 1751 on this metadata and collect them into an agenda buffer. The match 1752 syntax described here also applies when creating sparse trees with 1753 @kbd{C-c / m}. 1754 1755 @table @asis 1756 @item @kbd{M-x org-agenda m} (@code{org-tags-view}) 1757 Produce a list of all headlines that match a given set of tags. The 1758 command prompts for a selection criterion, which is a boolean logic 1759 expression with tags, like @samp{+work+urgent-withboss} or @samp{work|home} 1760 (see @ref{Tags}). If you often need a specific search, define a custom 1761 command for it (see @ref{Agenda Dispatcher}). 1762 1763 @item @kbd{M-x org-agenda M} (@code{org-tags-view}) 1764 Like @kbd{m}, but only select headlines that are also TODO 1765 items. 1766 @end table 1767 1768 A search string can use Boolean operators @samp{&} for AND and @samp{|} for OR@. 1769 @samp{&} binds more strongly than @samp{|}. Parentheses are currently not 1770 implemented. Each element in the search is either a tag, a regular 1771 expression matching tags, or an expression like @samp{PROPERTY OPERATOR 1772 VALUE} with a comparison operator, accessing a property value. Each 1773 element may be preceded by @samp{-} to select against it, and @samp{+} is 1774 syntactic sugar for positive selection. The AND operator @samp{&} is 1775 optional when @samp{+} or @samp{-} is present. Here are some examples, using 1776 only tags. 1777 1778 @table @asis 1779 @item @samp{+work-boss} 1780 Select headlines tagged @samp{work}, but discard those also tagged 1781 @samp{boss}. 1782 1783 @item @samp{work|laptop} 1784 Selects lines tagged @samp{work} or @samp{laptop}. 1785 1786 @item @samp{work|laptop+night} 1787 Like before, but require the @samp{laptop} lines to be tagged also 1788 @samp{night}. 1789 @end table 1790 1791 You may also test for properties at the same time as matching tags, 1792 see the @ref{Top,manual,,org,} for more information. 1793 1794 @node Search View 1795 @section Search View 1796 1797 This agenda view is a general text search facility for Org mode 1798 entries. It is particularly useful to find notes. 1799 1800 @table @asis 1801 @item @kbd{M-x org-agenda s} (@code{org-search-view}) 1802 @kindex s @r{(Agenda dispatcher)} 1803 @findex org-search-view 1804 This is a special search that lets you select entries by matching 1805 a substring or specific words using a boolean logic. 1806 @end table 1807 1808 For example, the search string @samp{computer equipment} matches entries 1809 that contain @samp{computer equipment} as a substring. 1810 1811 Search view can also search for specific keywords in the entry, using 1812 Boolean logic. The search string @samp{+computer 1813 +wifi -ethernet -@{8\.11[bg]@}} matches note entries that contain the 1814 keywords @samp{computer} and @samp{wifi}, but not the keyword @samp{ethernet}, and 1815 which are also not matched by the regular expression @samp{8\.11[bg]}, 1816 meaning to exclude both @samp{8.11b} and @samp{8.11g}. 1817 1818 Note that in addition to the agenda files, this command also searches 1819 the files listed in @code{org-agenda-text-search-extra-files}. 1820 1821 @node Agenda Commands 1822 @section Commands in the Agenda Buffer 1823 1824 Entries in the agenda buffer are linked back to the Org file or diary 1825 file where they originate. You are not allowed to edit the agenda 1826 buffer itself, but commands are provided to show and jump to the 1827 original entry location, and to edit the Org files ``remotely'' from the 1828 agenda buffer. This is just a selection of the many commands, explore 1829 the agenda menu and the @ref{Top,manual,,org,} for a complete list. 1830 1831 @anchor{Motion (1)} 1832 @subheading Motion 1833 1834 @table @asis 1835 @item @kbd{n} (@code{org-agenda-next-line}) 1836 Next line (same as @kbd{@key{DOWN}} and @kbd{C-n}). 1837 1838 @item @kbd{p} (@code{org-agenda-previous-line}) 1839 Previous line (same as @kbd{@key{UP}} and @kbd{C-p}). 1840 @end table 1841 1842 @anchor{View/Go to Org file} 1843 @subheading View/Go to Org file 1844 1845 @table @asis 1846 @item @kbd{@key{SPC}} (@code{org-agenda-show-and-scroll-up}) 1847 Display the original location of the item in another window. 1848 With a prefix argument, make sure that drawers stay folded. 1849 1850 @item @kbd{@key{TAB}} (@code{org-agenda-goto}) 1851 Go to the original location of the item in another window. 1852 1853 @item @kbd{@key{RET}} (@code{org-agenda-switch-to}) 1854 Go to the original location of the item and delete other windows. 1855 @end table 1856 1857 @anchor{Change display} 1858 @subheading Change display 1859 1860 @table @asis 1861 @item @kbd{o} (@code{delete-other-windows}) 1862 Delete other windows. 1863 1864 @item @kbd{v d} or short @kbd{d} (@code{org-agenda-day-view}) 1865 Switch to day view. 1866 1867 @item @kbd{v w} or short @kbd{w} (@code{org-agenda-week-view}) 1868 Switch to week view. 1869 1870 @item @kbd{f} (@code{org-agenda-later}) 1871 Go forward in time to display the span following the current one. 1872 For example, if the display covers a week, switch to the following 1873 week. 1874 1875 @item @kbd{b} (@code{org-agenda-earlier}) 1876 Go backward in time to display earlier dates. 1877 1878 @item @kbd{.} (@code{org-agenda-goto-today}) 1879 Go to today. 1880 1881 @item @kbd{j} (@code{org-agenda-goto-date}) 1882 Prompt for a date and go there. 1883 1884 @item @kbd{v l} or @kbd{v L} or short @kbd{l} (@code{org-agenda-log-mode}) 1885 Toggle Logbook mode. In Logbook mode, entries that were marked as 1886 done while logging was on (see the variable @code{org-log-done}) are 1887 shown in the agenda, as are entries that have been clocked on that 1888 day. When called with a @kbd{C-u} prefix argument, show all 1889 possible logbook entries, including state changes. 1890 1891 @item @kbd{r} 1892 @itemx @kbd{g} (@code{org-agenda-redo}) 1893 Recreate the agenda buffer, for example to reflect the changes after 1894 modification of the timestamps of items. 1895 1896 @item @kbd{s} (@code{org-save-all-org-buffers}) 1897 @kindex C-x C-s 1898 @findex org-save-all-org-buffers 1899 @kindex s 1900 Save all Org buffers in the current Emacs session, and also the 1901 locations of IDs. 1902 @end table 1903 1904 @anchor{Remote editing} 1905 @subheading Remote editing 1906 1907 @table @asis 1908 @item @kbd{0--9} 1909 Digit argument. 1910 1911 @item @kbd{t} (@code{org-agenda-todo}) 1912 Change the TODO state of the item, both in the agenda and in the 1913 original Org file. 1914 1915 @item @kbd{C-k} (@code{org-agenda-kill}) 1916 Delete the current agenda item along with the entire subtree 1917 belonging to it in the original Org file. 1918 1919 @item @kbd{C-c C-w} (@code{org-agenda-refile}) 1920 Refile the entry at point. 1921 1922 @item @kbd{a} (@code{org-agenda-archive-default-with-confirmation}) 1923 Archive the subtree corresponding to the entry at point using the 1924 default archiving command set in @code{org-archive-default-command}. 1925 1926 @item @kbd{$} (@code{org-agenda-archive}) 1927 Archive the subtree corresponding to the current headline. 1928 1929 @item @kbd{C-c C-s} (@code{org-agenda-schedule}) 1930 Schedule this item. With a prefix argument, remove the 1931 scheduling timestamp 1932 1933 @item @kbd{C-c C-d} (@code{org-agenda-deadline}) 1934 Set a deadline for this item. With a prefix argument, remove the 1935 deadline. 1936 1937 @item @kbd{S-@key{RIGHT}} (@code{org-agenda-do-date-later}) 1938 Change the timestamp associated with the current line by one day 1939 into the future. 1940 1941 @item @kbd{S-@key{LEFT}} (@code{org-agenda-do-date-earlier}) 1942 Change the timestamp associated with the current line by one day 1943 into the past. 1944 1945 @item @kbd{I} (@code{org-agenda-clock-in}) 1946 Start the clock on the current item. 1947 1948 @item @kbd{O} (@code{org-agenda-clock-out}) 1949 Stop the previously started clock. 1950 1951 @item @kbd{X} (@code{org-agenda-clock-cancel}) 1952 Cancel the currently running clock. 1953 1954 @item @kbd{J} (@code{org-agenda-clock-goto}) 1955 Jump to the running clock in another window. 1956 @end table 1957 1958 @anchor{Quit and exit} 1959 @subheading Quit and exit 1960 1961 @table @asis 1962 @item @kbd{q} (@code{org-agenda-quit}) 1963 Quit agenda, remove the agenda buffer. 1964 1965 @item @kbd{x} (@code{org-agenda-exit}) 1966 Exit agenda, remove the agenda buffer and all buffers loaded by 1967 Emacs for the compilation of the agenda. 1968 @end table 1969 1970 @node Custom Agenda Views 1971 @section Custom Agenda Views 1972 1973 The first application of custom searches is the definition of keyboard 1974 shortcuts for frequently used searches, either creating an agenda 1975 buffer, or a sparse tree (the latter covering of course only the 1976 current buffer). 1977 1978 Custom commands are configured in the variable 1979 @code{org-agenda-custom-commands}. You can customize this variable, for 1980 example by pressing @kbd{C} from the agenda dispatcher (see @ref{Agenda Dispatcher}). You can also directly set it with Emacs Lisp in 1981 the Emacs init file. The following example contains all valid agenda 1982 views: 1983 1984 @lisp 1985 (setq org-agenda-custom-commands 1986 '(("w" todo "WAITING") 1987 ("u" tags "+boss-urgent") 1988 ("v" tags-todo "+boss-urgent"))) 1989 @end lisp 1990 1991 The initial string in each entry defines the keys you have to press 1992 after the dispatcher command in order to access the command. Usually 1993 this is just a single character. The second parameter is the search 1994 type, followed by the string or regular expression to be used for the 1995 matching. The example above will therefore define: 1996 1997 @table @asis 1998 @item @kbd{w} 1999 as a global search for TODO entries with @samp{WAITING} as the TODO 2000 keyword. 2001 2002 @item @kbd{u} 2003 as a global tags search for headlines tagged @samp{boss} but not 2004 @samp{urgent}. 2005 2006 @item @kbd{v} 2007 The same search, but limiting it to headlines that are also TODO 2008 items. 2009 @end table 2010 2011 @node Markup 2012 @chapter Markup for Rich Contents 2013 2014 Org is primarily about organizing and searching through your 2015 plain-text notes. However, it also provides a lightweight yet robust 2016 markup language for rich text formatting and more. Used in 2017 conjunction with the export framework (see @ref{Exporting}), you can author 2018 beautiful documents in Org. 2019 2020 @menu 2021 * Paragraphs:: The basic unit of text. 2022 * Emphasis and Monospace:: Bold, italic, etc. 2023 * Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents. 2024 * Literal examples:: Source code examples with special formatting. 2025 * Images:: Display an image. 2026 * Creating Footnotes:: Edit and read footnotes. 2027 @end menu 2028 2029 @node Paragraphs 2030 @section Paragraphs 2031 2032 Paragraphs are separated by at least one empty line. If you need to 2033 enforce a line break within a paragraph, use @samp{\\} at the end of 2034 a line. 2035 2036 To preserve the line breaks, indentation and blank lines in a region, 2037 but otherwise use normal formatting, you can use this construct, which 2038 can also be used to format poetry. 2039 2040 @example 2041 #+BEGIN_VERSE 2042 Great clouds overhead 2043 Tiny black birds rise and fall 2044 Snow covers Emacs 2045 2046 ---AlexSchroeder 2047 #+END_VERSE 2048 @end example 2049 2050 When quoting a passage from another document, it is customary to 2051 format this as a paragraph that is indented on both the left and the 2052 right margin. You can include quotations in Org documents like this: 2053 2054 @example 2055 #+BEGIN_QUOTE 2056 Everything should be made as simple as possible, 2057 but not any simpler ---Albert Einstein 2058 #+END_QUOTE 2059 @end example 2060 2061 If you would like to center some text, do it like this: 2062 2063 @example 2064 #+BEGIN_CENTER 2065 Everything should be made as simple as possible, \\ 2066 but not any simpler 2067 #+END_CENTER 2068 @end example 2069 2070 @node Emphasis and Monospace 2071 @section Emphasis and Monospace 2072 2073 You can make words @samp{*bold*}, @samp{/italic/}, @samp{_underlined_}, @samp{=verbatim=} 2074 and @samp{~code~}, and, if you must, @samp{+strike-through+}. Text in the code 2075 and verbatim string is not processed for Org specific syntax; it is 2076 exported verbatim. 2077 2078 @node Embedded @LaTeX{} 2079 @section Embedded @LaTeX{} 2080 2081 For scientific notes which need to be able to contain mathematical 2082 symbols and the occasional formula, Org mode supports embedding @LaTeX{} 2083 code into its files. You can directly use @TeX{}-like syntax for special 2084 symbols, enter formulas and entire @LaTeX{} environments. 2085 2086 @example 2087 The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand, 2088 the radius of Alpha Centauri is R_@{Alpha Centauri@} = 1.28 x R_@{sun@}. 2089 2090 \begin@{equation@} % arbitrary environments, 2091 x=\sqrt@{b@} % even tables, figures 2092 \end@{equation@} % etc 2093 2094 If $a^2=b$ and \( b=2 \), then the solution must be 2095 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \]. 2096 @end example 2097 2098 @node Literal examples 2099 @section Literal examples 2100 2101 You can include literal examples that should not be subjected to 2102 markup. Such examples are typeset in monospace, so this is well 2103 suited for source code and similar examples. 2104 2105 @example 2106 #+BEGIN_EXAMPLE 2107 Some example from a text file. 2108 #+END_EXAMPLE 2109 @end example 2110 2111 For simplicity when using small examples, you can also start the 2112 example lines with a colon followed by a space. There may also be 2113 additional whitespace before the colon: 2114 2115 @example 2116 Here is an example 2117 : Some example from a text file. 2118 @end example 2119 2120 If the example is source code from a programming language, or any 2121 other text that can be marked up by Font Lock in Emacs, you can ask 2122 for the example to look like the fontified Emacs buffer. 2123 2124 @example 2125 #+BEGIN_SRC emacs-lisp 2126 (defun org-xor (a b) 2127 "Exclusive or." 2128 (if a (not b) b)) 2129 #+END_SRC 2130 @end example 2131 2132 To edit the example in a special buffer supporting this language, use 2133 @kbd{C-c '} to both enter and leave the editing buffer. 2134 2135 @node Images 2136 @section Images 2137 2138 An image is a link to an image file that does not have a description 2139 part, for example 2140 2141 @example 2142 ./img/cat.jpg 2143 @end example 2144 2145 2146 If you wish to define a caption for the image and maybe a label for 2147 internal cross references (see @ref{Hyperlinks}), make sure that the 2148 link is on a line by itself and precede it with @samp{CAPTION} and @samp{NAME} 2149 keywords as follows: 2150 2151 @example 2152 #+CAPTION: This is the caption for the next figure link (or table) 2153 #+NAME: fig:SED-HR4049 2154 [[./img/a.jpg]] 2155 @end example 2156 2157 @node Creating Footnotes 2158 @section Creating Footnotes 2159 2160 A footnote is defined in a paragraph that is started by a footnote 2161 marker in square brackets in column 0, no indentation allowed. The 2162 footnote reference is simply the marker in square brackets, inside 2163 text. For example: 2164 2165 @example 2166 The Org website[fn:1] now looks a lot better than it used to. 2167 ... 2168 [fn:1] The link is: https://orgmode.org 2169 @end example 2170 2171 The following commands handle footnotes: 2172 2173 @table @asis 2174 @item @kbd{C-c C-x f} (@code{org-footnote-action}) 2175 The footnote action command. When point is on a footnote reference, 2176 jump to the definition. When it is at a definition, jump to the 2177 (first) reference. Otherwise, create a new footnote. When this 2178 command is called with a prefix argument, a menu of additional 2179 options including renumbering is offered. 2180 2181 @item @kbd{C-c C-c} (@code{org-ctrl-c-ctrl-c}) 2182 Jump between definition and reference. 2183 @end table 2184 2185 @node Exporting 2186 @chapter Exporting 2187 2188 Org can convert and export documents to a variety of other formats 2189 while retaining as much structure (see @ref{Document Structure}) and markup 2190 (see @ref{Markup}) as possible. 2191 2192 @menu 2193 * The Export Dispatcher:: The main interface. 2194 * Export Settings:: Common export settings. 2195 * Table of Contents:: The if and where of the table of contents. 2196 * Include Files:: Include additional files into a document. 2197 * Comment Lines:: What will not be exported. 2198 * ASCII/UTF-8 Export:: Exporting to flat files with encoding. 2199 * HTML Export:: Exporting to HTML. 2200 * @LaTeX{} Export:: Exporting to @LaTeX{} and processing to PDF. 2201 * iCalendar Export:: Exporting to iCalendar. 2202 @end menu 2203 2204 @node The Export Dispatcher 2205 @section The Export Dispatcher 2206 2207 The export dispatcher is the main interface for Org's exports. 2208 A hierarchical menu presents the currently configured export formats. 2209 Options are shown as easy toggle switches on the same screen. 2210 2211 @table @asis 2212 @item @kbd{C-c C-e} (@code{org-export-dispatch}) 2213 Invokes the export dispatcher interface. 2214 @end table 2215 2216 Org exports the entire buffer by default. If the Org buffer has an 2217 active region, then Org exports just that region. 2218 2219 @node Export Settings 2220 @section Export Settings 2221 2222 The exporter recognizes special lines in the buffer which provide 2223 additional information. These lines may be put anywhere in the file: 2224 2225 @example 2226 #+TITLE: I'm in the Mood for Org 2227 @end example 2228 2229 2230 Most proeminent export options include: 2231 2232 @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 2233 @item @samp{TITLE} 2234 @tab the title to be shown 2235 @item @samp{AUTHOR} 2236 @tab the author (default taken from @code{user-full-name}) 2237 @item @samp{DATE} 2238 @tab a date, fixed, or an Org timestamp 2239 @item @samp{EMAIL} 2240 @tab email address (default from @code{user-mail-address}) 2241 @item @samp{LANGUAGE} 2242 @tab language code, e.g., @samp{en} 2243 @end multitable 2244 2245 Option keyword sets can be inserted from the export dispatcher (see 2246 @ref{The Export Dispatcher}) using the @samp{Insert template} command by 2247 pressing @kbd{#}. 2248 2249 @node Table of Contents 2250 @section Table of Contents 2251 2252 The table of contents includes all headlines in the document. Its 2253 depth is therefore the same as the headline levels in the file. If 2254 you need to use a different depth, or turn it off entirely, set the 2255 @code{org-export-with-toc} variable accordingly. You can achieve the same 2256 on a per file basis, using the following @samp{toc} item in @samp{OPTIONS} 2257 keyword: 2258 2259 @example 2260 #+OPTIONS: toc:2 (only include two levels in TOC) 2261 #+OPTIONS: toc:nil (no default TOC at all) 2262 @end example 2263 2264 Org normally inserts the table of contents directly before the first 2265 headline of the file. 2266 2267 @node Include Files 2268 @section Include Files 2269 2270 During export, you can include the content of another file. For 2271 example, to include your @samp{.emacs} file, you could use: 2272 2273 @example 2274 #+INCLUDE: "~/.emacs" src emacs-lisp 2275 @end example 2276 2277 2278 @noindent 2279 The first parameter is the file name to include. The optional second 2280 parameter specifies the block type: @samp{example}, @samp{export} or @samp{src}. The 2281 optional third parameter specifies the source code language to use for 2282 formatting the contents. This is relevant to both @samp{export} and @samp{src} 2283 block types. 2284 2285 You can visit the included file with @kbd{C-c '}. 2286 2287 @node Comment Lines 2288 @section Comment Lines 2289 2290 Lines starting with zero or more whitespace characters followed by one 2291 @samp{#} and a whitespace are treated as comments and, as such, are not 2292 exported. 2293 2294 Likewise, regions surrounded by @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT} 2295 are not exported. 2296 2297 Finally, a @samp{COMMENT} keyword at the beginning of an entry, but after 2298 any other keyword or priority cookie, comments out the entire subtree. 2299 The command below helps changing the comment status of a headline. 2300 2301 @table @asis 2302 @item @kbd{C-c ;} (@code{org-toggle-comment}) 2303 Toggle the @samp{COMMENT} keyword at the beginning of an entry. 2304 @end table 2305 2306 @node ASCII/UTF-8 Export 2307 @section ASCII/UTF-8 Export 2308 2309 ASCII export produces an output file containing only plain ASCII 2310 characters. This is the simplest and most direct text output. It 2311 does not contain any Org markup. UTF-8 export uses additional 2312 characters and symbols available in this encoding standards. 2313 2314 @table @asis 2315 @item @kbd{C-c C-e t a} 2316 @itemx @kbd{C-c C-e t u} (@code{org-ascii-export-to-ascii}) 2317 Export as an ASCII file with a @samp{.txt} extension. For @samp{myfile.org}, 2318 Org exports to @samp{myfile.txt}, overwriting without warning. For 2319 @samp{myfile.txt}, Org exports to @samp{myfile.txt.txt} in order to prevent 2320 data loss. 2321 @end table 2322 2323 @node HTML Export 2324 @section HTML Export 2325 2326 Org mode contains an HTML exporter with extensive HTML formatting 2327 compatible with XHTML 1.0 strict standard. 2328 2329 @table @asis 2330 @item @kbd{C-c C-e h h} (@code{org-html-export-to-html}) 2331 Export as HTML file with a @samp{.html} extension. For @samp{myfile.org}, Org 2332 exports to @samp{myfile.html}, overwriting without warning. @kbd{C-c C-e h o} exports to HTML and opens it in a web browser. 2333 @end table 2334 2335 The HTML export backend transforms @samp{<} and @samp{>} to @samp{<} and @samp{>}. 2336 To include raw HTML code in the Org file so the HTML export backend 2337 can insert that HTML code in the output, use this inline syntax: 2338 @samp{@@@@html:...@@@@}. For example: 2339 2340 @example 2341 @@@@html:<b>@@@@bold text@@@@html:</b>@@@@ 2342 @end example 2343 2344 2345 For larger raw HTML code blocks, use these HTML export code blocks: 2346 2347 @example 2348 #+HTML: Literal HTML code for export 2349 2350 #+BEGIN_EXPORT html 2351 All lines between these markers are exported literally 2352 #+END_EXPORT 2353 @end example 2354 2355 @node @LaTeX{} Export 2356 @section @LaTeX{} Export 2357 2358 The @LaTeX{} export backend can handle complex documents, incorporate 2359 standard or custom @LaTeX{} document classes, generate documents using 2360 alternate @LaTeX{} engines, and produce fully linked PDF files with 2361 indexes, bibliographies, and tables of contents, destined for 2362 interactive online viewing or high-quality print publication. 2363 2364 By default, the @LaTeX{} output uses the @emph{article} class. You can change 2365 this by adding an option like @samp{#+LATEX_CLASS: myclass} in your file. 2366 The class must be listed in @code{org-latex-classes}. 2367 2368 @table @asis 2369 @item @kbd{C-c C-e l l} (@code{org-latex-export-to-latex}) 2370 Export to a @LaTeX{} file with a @samp{.tex} extension. For @samp{myfile.org}, 2371 Org exports to @samp{myfile.tex}, overwriting without warning. 2372 2373 @item @kbd{C-c C-e l p} (@code{org-latex-export-to-pdf}) 2374 Export as @LaTeX{} file and convert it to PDF file. 2375 2376 @item @kbd{C-c C-e l o} (@code{<no corresponding named command>}) 2377 Export as @LaTeX{} file and convert it to PDF, then open the PDF using 2378 the default viewer. 2379 @end table 2380 2381 The @LaTeX{} export backend can insert any arbitrary @LaTeX{} code, see 2382 @ref{Embedded @LaTeX{}}. There are three ways to embed such code in the Org 2383 file and they all use different quoting syntax. 2384 2385 Inserting in-line quoted with @@ symbols: 2386 2387 @example 2388 Code embedded in-line @@@@latex:any arbitrary LaTeX code@@@@ in a paragraph. 2389 @end example 2390 2391 2392 Inserting as one or more keyword lines in the Org file: 2393 2394 @example 2395 #+LATEX: any arbitrary LaTeX code 2396 @end example 2397 2398 2399 Inserting as an export block in the Org file, where the backend 2400 exports any code between begin and end markers: 2401 2402 @example 2403 #+BEGIN_EXPORT latex 2404 any arbitrary LaTeX code 2405 #+END_EXPORT 2406 @end example 2407 2408 @node iCalendar Export 2409 @section iCalendar Export 2410 2411 A large part of Org mode's interoperability success is its ability to 2412 easily export to or import from external applications. The iCalendar 2413 export backend takes calendar data from Org files and exports to the 2414 standard iCalendar format. 2415 2416 @table @asis 2417 @item @kbd{C-c C-e c f} (@code{org-icalendar-export-to-ics}) 2418 Create iCalendar entries from the current Org buffer and store them 2419 in the same directory, using a file extension @samp{.ics}. 2420 2421 @item @kbd{C-c C-e c c} (@code{org-icalendar-combine-agenda-files}) 2422 Create a combined iCalendar file from Org files in 2423 @code{org-agenda-files} and write it to 2424 @code{org-icalendar-combined-agenda-file} file name. 2425 @end table 2426 2427 @node Publishing 2428 @chapter Publishing 2429 2430 Org includes a publishing management system that allows you to 2431 configure automatic HTML conversion of @emph{projects} composed of 2432 interlinked Org files. You can also configure Org to automatically 2433 upload your exported HTML pages and related attachments, such as 2434 images and source code files, to a web server. 2435 2436 You can also use Org to convert files into PDF, or even combine HTML 2437 and PDF conversion so that files are available in both formats on the 2438 server. 2439 2440 For detailed instructions about setup, see the @ref{Top,manual,,org,}. Here is an 2441 example: 2442 2443 @lisp 2444 (setq org-publish-project-alist 2445 '(("org" 2446 :base-directory "~/org/" 2447 :publishing-function org-html-publish-to-html 2448 :publishing-directory "~/public_html" 2449 :section-numbers nil 2450 :with-toc nil 2451 :html-head "<link rel=\"stylesheet\" 2452 href=\"../other/mystyle.css\" 2453 type=\"text/css\"/>"))) 2454 @end lisp 2455 2456 @table @asis 2457 @item @kbd{C-c C-e P x} (@code{org-publish}) 2458 Prompt for a specific project and publish all files that belong to 2459 it. 2460 2461 @item @kbd{C-c C-e P p} (@code{org-publish-current-project}) 2462 Publish the project containing the current file. 2463 2464 @item @kbd{C-c C-e P f} (@code{org-publish-current-file}) 2465 Publish only the current file. 2466 2467 @item @kbd{C-c C-e P a} (@code{org-publish-all}) 2468 Publish every project. 2469 @end table 2470 2471 Org uses timestamps to track when a file has changed. The above 2472 functions normally only publish changed files. You can override this 2473 and force publishing of all files by giving a prefix argument to any 2474 of the commands above. 2475 2476 @node Working with Source Code 2477 @chapter Working with Source Code 2478 2479 Org mode provides a number of features for working with source code, 2480 including editing of code blocks in their native major mode, 2481 evaluation of code blocks, tangling of code blocks, and exporting code 2482 blocks and their results in several formats. 2483 2484 A source code block conforms to this structure: 2485 2486 @example 2487 #+NAME: <name> 2488 #+BEGIN_SRC <language> <switches> <header arguments> 2489 <body> 2490 #+END_SRC 2491 @end example 2492 2493 @noindent 2494 where: 2495 2496 @itemize 2497 @item 2498 @samp{<name>} is a string used to uniquely name the code block, 2499 2500 @item 2501 @samp{<language>} specifies the language of the code block, e.g., 2502 @samp{emacs-lisp}, @samp{shell}, @samp{R}, @samp{python}, etc., 2503 2504 @item 2505 @samp{<switches>} can be used to control export of the code block, 2506 2507 @item 2508 @samp{<header arguments>} can be used to control many aspects of code 2509 block behavior as demonstrated below, 2510 2511 @item 2512 @samp{<body>} contains the actual source code. 2513 @end itemize 2514 2515 Use @kbd{C-c '} to edit the current code block. It opens a new 2516 major mode edit buffer containing the body of the source code block, 2517 ready for any edits. Use @kbd{C-c '} again to close the buffer 2518 and return to the Org buffer. 2519 2520 @anchor{Using header arguments} 2521 @heading Using header arguments 2522 2523 A header argument is specified with an initial colon followed by the 2524 argument's name in lowercase. 2525 2526 Header arguments can be set in several ways; Org prioritizes them in 2527 case of overlaps or conflicts by giving local settings a higher 2528 priority. 2529 2530 @table @asis 2531 @item System-wide header arguments 2532 Those are specified by customizing @code{org-babel-default-header-args} 2533 variable, or, for a specific language @var{LANG} 2534 @code{org-babel-default-header-args:LANG}. 2535 2536 @item Header arguments in properties 2537 You can set them using @samp{header-args} property (see @ref{Properties})---or 2538 @samp{header-args:LANG} for language @var{LANG}. Header arguments 2539 set through properties drawers apply at the sub-tree level on down. 2540 2541 @item Header arguments in code blocks 2542 Header arguments are most commonly set at the source code block 2543 level, on the @samp{BEGIN_SRC} line: 2544 2545 @example 2546 #+NAME: factorial 2547 #+BEGIN_SRC haskell :results silent :exports code :var n=0 2548 fac 0 = 1 2549 fac n = n * fac (n-1) 2550 #+END_SRC 2551 @end example 2552 2553 Code block header arguments can span multiple lines using @samp{HEADER} 2554 keyword on each line. 2555 @end table 2556 2557 @anchor{Evaluating code blocks} 2558 @heading Evaluating code blocks 2559 2560 Use @kbd{C-c C-c} to evaluate the current code block and insert 2561 its results in the Org document. By default, evaluation is only 2562 turned on for @samp{emacs-lisp} code blocks, however support exists for 2563 evaluating blocks in many languages. For a complete list of supported 2564 languages see the @ref{Top,manual,,org,}. The following shows a code block and its 2565 results. 2566 2567 @example 2568 #+BEGIN_SRC emacs-lisp 2569 (+ 1 2 3 4) 2570 #+END_SRC 2571 2572 #+RESULTS: 2573 : 10 2574 @end example 2575 2576 The following syntax is used to pass arguments to code blocks using 2577 the @samp{var} header argument. 2578 2579 @example 2580 :var NAME=ASSIGN 2581 @end example 2582 2583 2584 @noindent 2585 @var{NAME} is the name of the variable bound in the code block 2586 body. @var{ASSIGN} is a literal value, such as a string, 2587 a number, a reference to a table, a list, a literal example, another 2588 code block---with or without arguments---or the results of evaluating 2589 a code block. 2590 2591 @anchor{Results of evaluation} 2592 @heading Results of evaluation 2593 2594 How Org handles results of a code block execution depends on many 2595 header arguments working together. The primary determinant, however, 2596 is the @samp{results} header argument. It controls the @emph{collection}, 2597 @emph{type}, @emph{format}, and @emph{handling} of code block results. 2598 2599 @table @asis 2600 @item Collection 2601 How the results should be collected from the code block. You may 2602 choose either @samp{output} or @samp{value} (the default). 2603 2604 @item Type 2605 What result types to expect from the execution of the code block. 2606 You may choose among @samp{table}, @samp{list}, @samp{scalar}, and @samp{file}. Org 2607 tries to guess it if you do not provide it. 2608 2609 @item Format 2610 How Org processes results. Some possible values are @samp{code}, 2611 @samp{drawer}, @samp{html}, @samp{latex}, @samp{link}, and @samp{raw}. 2612 2613 @item Handling 2614 How to insert the results once properly formatted. Allowed values 2615 are @samp{silent}, @samp{replace} (the default), @samp{append}, or @samp{prepend}. 2616 @end table 2617 2618 Code blocks which output results to files---e.g.: graphs, diagrams and 2619 figures---can accept a @samp{:file FILENAME} header argument, in which case 2620 the results are saved to the named file, and a link to the file is 2621 inserted into the buffer. 2622 2623 @anchor{Exporting code blocks} 2624 @heading Exporting code blocks 2625 2626 It is possible to export the @emph{code} of code blocks, the @emph{results} of 2627 code block evaluation, @emph{both} the code and the results of code block 2628 evaluation, or @emph{none}. Org defaults to exporting @emph{code} for most 2629 languages. 2630 2631 The @samp{exports} header argument is to specify if that part of the Org 2632 file is exported to, say, HTML or @LaTeX{} formats. It can be set to 2633 either @samp{code}, @samp{results}, @samp{both} or @samp{none}. 2634 2635 @anchor{Extracting source code} 2636 @heading Extracting source code 2637 2638 Use @kbd{C-c C-v t} to create pure source code files by 2639 extracting code from source blocks in the current buffer. This is 2640 referred to as ``tangling''---a term adopted from the literate 2641 programming community. During tangling of code blocks their bodies 2642 are expanded using @code{org-babel-expand-src-block}, which can expand both 2643 variable and ``Noweb'' style references. In order to tangle a code 2644 block it must have a @samp{tangle} header argument, see the @ref{Top,manual,,org,} for 2645 details. 2646 2647 @node Miscellaneous 2648 @chapter Miscellaneous 2649 2650 @anchor{Completion} 2651 @heading Completion 2652 2653 Org has in-buffer completions with @kbd{M-@key{TAB}}. No minibuffer is 2654 involved. Type one or more letters and invoke the hot key to complete 2655 the text in-place. 2656 2657 For example, this command will complete @TeX{} symbols after @samp{\}, TODO 2658 keywords at the beginning of a headline, and tags after @samp{:} in 2659 a headline. 2660 2661 @anchor{Structure Templates} 2662 @heading Structure Templates 2663 2664 To quickly insert empty structural blocks, such as @samp{#+BEGIN_SRC} 2665 @dots{} @samp{#+END_SRC}, or to wrap existing text in such a block, use 2666 2667 @table @asis 2668 @item @kbd{C-c C-,} (@code{org-insert-structure-template}) 2669 Prompt for a type of block structure, and insert the block at point. 2670 If the region is active, it is wrapped in the block. 2671 @end table 2672 2673 @anchor{Clean view} 2674 @heading Clean view 2675 2676 Org's default outline with stars and no indents can become too 2677 cluttered for short documents. For @emph{book-like} long documents, the 2678 effect is not as noticeable. Org provides an alternate stars and 2679 indentation scheme, as shown on the right in the following table. It 2680 uses only one star and indents text to line with the heading: 2681 2682 @example 2683 * Top level headline | * Top level headline 2684 ** Second level | * Second level 2685 *** Third level | * Third level 2686 some text | some text 2687 *** Third level | * Third level 2688 more text | more text 2689 * Another top level headline | * Another top level headline 2690 @end example 2691 2692 This kind of view can be achieved dynamically at display time using 2693 Org Indent mode (@kbd{M-x org-indent-mode @key{RET}}), which prepends 2694 intangible space to each line. You can turn on Org Indent mode for 2695 all files by customizing the variable @code{org-startup-indented}, or you 2696 can turn it on for individual files using 2697 2698 @example 2699 #+STARTUP: indent 2700 @end example 2701 2702 2703 If you want the indentation to be hard space characters so that the 2704 plain text file looks as similar as possible to the Emacs display, Org 2705 supports you by helping to indent (with @kbd{@key{TAB}}) text below 2706 each headline, by hiding leading stars, and by only using levels 1, 3, 2707 etc to get two characters indentation for each level. To get this 2708 support in a file, use 2709 2710 @example 2711 #+STARTUP: hidestars odd 2712 @end example 2713 2714 @bye