Update Back-Cover Text as per maintain.info.
[bpt/emacs.git] / doc / misc / org.texi
CommitLineData
4009494e
GM
1\input texinfo
2@c %**start of header
db78a8cb 3@setfilename ../../info/org
a7808fba 4@settitle The Org Manual
4009494e 5
a7808fba
CD
6@set VERSION 6.02b
7@set DATE April 2008
4009494e
GM
8
9@dircategory Emacs
10@direntry
11* Org Mode: (org). Outline-based notes management and organizer
12@end direntry
13
14@c Version and Contact Info
dbc28aaa 15@set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
4009494e
GM
16@set AUTHOR Carsten Dominik
17@set MAINTAINER Carsten Dominik
dbc28aaa
CD
18@set MAINTAINEREMAIL @email{carsten at orgmode dot org}
19@set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
4009494e
GM
20@c %**end of header
21@finalout
22
23@c Macro definitions
24
25@c Subheadings inside a table.
26@macro tsubheading{text}
27@ifinfo
28@subsubheading \text\
29@end ifinfo
30@ifnotinfo
31@item @b{\text\}
32@end ifnotinfo
33@end macro
34
35@copying
a7808fba 36This manual is for Org (version @value{VERSION}).
4009494e 37
dbc28aaa 38Copyright @copyright{} 2004, 2005, 2006, 2007, 2008 Free Software Foundation
4009494e
GM
39
40@quotation
41Permission is granted to copy, distribute and/or modify this document
42under the terms of the GNU Free Documentation License, Version 1.1 or
43any later version published by the Free Software Foundation; with no
44Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
45and with the Back-Cover Texts as in (a) below. A copy of the
46license is included in the section entitled ``GNU Free Documentation
47License.''
48
6f093307
GM
49(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
50modify this GNU manual. Buying copies from the FSF supports it in
51developing GNU and promoting software freedom.''
4009494e
GM
52@end quotation
53@end copying
54
55@titlepage
a7808fba 56@title The Org Manual
4009494e
GM
57
58@subtitle Release @value{VERSION}
59@author by Carsten Dominik
60
61@c The following two commands start the copyright page.
62@page
63@vskip 0pt plus 1filll
64@insertcopying
65@end titlepage
66
67@c Output the table of contents at the beginning.
68@contents
69
70@ifnottex
71@node Top, Introduction, (dir), (dir)
72@top Org Mode Manual
73
74@insertcopying
75@end ifnottex
76
77@menu
78* Introduction:: Getting started
a7808fba 79* Document Structure:: A tree works like your brain
4009494e
GM
80* Tables:: Pure magic for quick formatting
81* Hyperlinks:: Notes in context
a7808fba 82* TODO Items:: Every tree branch can be a TODO item
4009494e 83* Tags:: Tagging headlines and matching sets of tags
a7808fba
CD
84* Properties and Columns:: Storing information about an entry
85* Dates and Times:: Making items useful for planning
dbc28aaa 86* Remember:: Quickly adding nodes to the outline tree
a7808fba 87* Agenda Views:: Collecting information into views
4009494e
GM
88* Embedded LaTeX:: LaTeX fragments and formulas
89* Exporting:: Sharing and publishing of notes
a7808fba 90* Publishing:: Create a web site of linked Org files
4009494e
GM
91* Miscellaneous:: All the rest which did not fit elsewhere
92* Extensions and Hacking:: It is possible to write add-on code
a7808fba
CD
93* History and Acknowledgments:: How Org came into being
94* Main Index:: An index of Org's concepts and features
4009494e
GM
95* Key Index:: Key bindings and where they are described
96
97@detailmenu
98 --- The Detailed Node Listing ---
99
100Introduction
101
a7808fba
CD
102* Summary:: Brief summary of what Org does
103* Installation:: How to install a downloaded version of Org
104* Activation:: How to activate Org for certain buffers
4009494e 105* Feedback:: Bug reports, ideas, patches etc.
dbc28aaa 106* Conventions:: Type-setting conventions in the manual
4009494e
GM
107
108Document Structure
109
a7808fba
CD
110* Outlines:: Org is based on Outline mode
111* Headlines:: How to typeset Org tree headlines
4009494e
GM
112* Visibility cycling:: Show and hide, much simplified
113* Motion:: Jumping to other headlines
114* Structure editing:: Changing sequence and level of headlines
115* Archiving:: Move done task trees to a different place
116* Sparse trees:: Matches embedded in context
117* Plain lists:: Additional structure within an entry
118* Drawers:: Tucking stuff away
a7808fba 119* Orgstruct mode:: Structure editing outside Org
4009494e
GM
120
121Archiving
122
123* ARCHIVE tag:: Marking a tree as inactive
124* Moving subtrees:: Moving a tree to an archive file
125
126Tables
127
128* Built-in table editor:: Simple tables
28a16a1b 129* Narrow columns:: Stop wasting space in tables
4009494e 130* Column groups:: Grouping to trigger vertical lines
a7808fba
CD
131* Orgtbl mode:: The table editor as minor mode
132* The spreadsheet:: The table editor has spreadsheet capabilities
4009494e
GM
133
134The spreadsheet
135
136* References:: How to refer to another field or range
137* Formula syntax for Calc:: Using Calc to compute stuff
138* Formula syntax for Lisp:: Writing formulas in Emacs Lisp
139* Field formulas:: Formulas valid for a single field
140* Column formulas:: Formulas valid for an entire column
141* Editing and debugging formulas:: Fixing formulas
142* Updating the table:: Recomputing all dependent fields
143* Advanced features:: Field names, parameters and automatic recalc
144
145Hyperlinks
146
a7808fba 147* Link format:: How links in Org are formatted
4009494e
GM
148* Internal links:: Links to other places in the current file
149* External links:: URL-like links to the world
150* Handling links:: Creating, inserting and following
a7808fba 151* Using links outside Org:: Linking from my C source code?
4009494e
GM
152* Link abbreviations:: Shortcuts for writing complex links
153* Search options:: Linking to a specific location
154* Custom searches:: When the default search is not enough
4009494e
GM
155
156Internal links
157
a7808fba 158* Radio targets:: Make targets trigger links in plain text
4009494e 159
a7808fba 160TODO Items
4009494e
GM
161
162* TODO basics:: Marking and displaying TODO entries
163* TODO extensions:: Workflow and assignments
dbc28aaa 164* Progress logging:: Dates and notes for progress
4009494e
GM
165* Priorities:: Some things are more important than others
166* Breaking down tasks:: Splitting a task into manageable pieces
167* Checkboxes:: Tick-off lists
168
169Extended use of TODO keywords
170
171* Workflow states:: From TODO to DONE in steps
dbc28aaa 172* TODO types:: I do this, Fred does the rest
4009494e 173* Multiple sets in one file:: Mixing it all, and still finding your way
dbc28aaa
CD
174* Fast access to TODO states:: Single letter selection of a state
175* Per-file keywords:: Different files, different requirements
176* Faces for TODO keywords:: Highlighting states
177
a7808fba 178Progress logging
dbc28aaa
CD
179
180* Closing items:: When was this entry marked DONE?
181* Tracking TODO state changes:: When did the status change?
4009494e
GM
182
183Tags
184
185* Tag inheritance:: Tags use the tree structure of the outline
186* Setting tags:: How to assign tags to a headline
187* Tag searches:: Searching for combinations of tags
188
189Properties and Columns
190
191* Property syntax:: How properties are spelled out
a7808fba 192* Special properties:: Access to other Org mode features
4009494e 193* Property searches:: Matching property values
dbc28aaa 194* Property inheritance:: Passing values down the tree
4009494e
GM
195* Column view:: Tabular viewing and editing
196* Property API:: Properties for Lisp programmers
197
a7808fba 198Column view
4009494e
GM
199
200* Defining columns:: The COLUMNS format property
201* Using column view:: How to create and use column view
a7808fba 202* Capturing column view:: A dynamic block for column view
4009494e 203
a7808fba 204Defining columns
4009494e
GM
205
206* Scope of column definitions:: Where defined, where valid?
207* Column attributes:: Appearance and content of a column
208
dbc28aaa 209Dates and Times
4009494e 210
a7808fba 211* Timestamps:: Assigning a time to a tree entry
4009494e
GM
212* Creating timestamps:: Commands which insert timestamps
213* Deadlines and scheduling:: Planning your work
a7808fba
CD
214* Clocking work time:: Tracking how long you spend on a task
215* Effort estimates:: Planning work effort in advance
4009494e
GM
216
217Creating timestamps
218
a7808fba
CD
219* The date/time prompt:: How Org mode helps you entering date and time
220* Custom time format:: Making dates look different
4009494e 221
a7808fba 222Deadlines and scheduling
4009494e
GM
223
224* Inserting deadline/schedule:: Planning items
225* Repeated tasks:: Items that show up again and again
226
dbc28aaa 227Remember
4009494e 228
a7808fba 229* Setting up Remember:: Some code for .emacs to get things going
dbc28aaa
CD
230* Remember templates:: Define the outline of different note types
231* Storing notes:: Directly get the note to where it belongs
232* Refiling notes:: Moving a note or task to a project
4009494e
GM
233
234Agenda Views
235
236* Agenda files:: Files being searched for agenda information
237* Agenda dispatcher:: Keyboard access to agenda views
238* Built-in agenda views:: What is available out of the box?
239* Presentation and sorting:: How agenda items are prepared for display
a7808fba 240* Agenda commands:: Remote editing of Org trees
4009494e 241* Custom agenda views:: Defining special searches and views
a7808fba 242* Agenda column view:: Using column view for collected entries
4009494e
GM
243
244The built-in agenda views
245
a7808fba 246* Weekly/daily agenda:: The calendar page with current tasks
4009494e
GM
247* Global TODO list:: All unfinished action items
248* Matching tags and properties:: Structured information with fine-tuned search
249* Timeline:: Time-sorted view for single file
28a16a1b 250* Keyword search:: Finding entries by keyword
4009494e
GM
251* Stuck projects:: Find projects you need to review
252
253Presentation and sorting
254
255* Categories:: Not all tasks are equal
256* Time-of-day specifications:: How the agenda knows the time
257* Sorting of agenda items:: The order of things
258
259Custom agenda views
260
261* Storing searches:: Type once, use often
262* Block agenda:: All the stuff you need in a single buffer
263* Setting Options:: Changing the rules
a7808fba
CD
264* Exporting Agenda Views:: Writing agendas to files
265* Using the agenda elsewhere:: Using agenda information in other programs
4009494e
GM
266
267Embedded LaTeX
268
269* Math symbols:: TeX macros for symbols and Greek letters
a7808fba 270* Subscripts and superscripts:: Simple syntax for raising/lowering text
4009494e
GM
271* LaTeX fragments:: Complex formulas made easy
272* Processing LaTeX fragments:: Previewing LaTeX processing
273* CDLaTeX mode:: Speed up entering of formulas
274
275Exporting
276
277* ASCII export:: Exporting to plain ASCII
278* HTML export:: Exporting to HTML
279* LaTeX export:: Exporting to LaTeX
280* XOXO export:: Exporting to XOXO
281* iCalendar export:: Exporting in iCalendar format
282* Text interpretation:: How the exporter looks at the file
283
284HTML export
285
286* HTML Export commands:: How to invoke LaTeX export
a7808fba 287* Quoting HTML tags:: Using direct HTML in Org mode
4009494e
GM
288* Links:: Transformation of links for HTML
289* Images:: How to include images
a7808fba
CD
290* CSS support:: Changing the appearance of the output
291* Javascript support:: Info and Folding in a web browser
4009494e
GM
292
293LaTeX export
294
295* LaTeX export commands:: How to invoke LaTeX export
296* Quoting LaTeX code:: Incorporating literal LaTeX code
a7808fba 297* Sectioning structure:: Changing sectioning in LaTeX output
4009494e
GM
298
299Text interpretation by the exporter
300
301* Comment lines:: Some lines will not be exported
302* Initial text:: Text before the first headline
303* Footnotes:: Numbers like [1]
a7808fba 304* Quoted examples:: Inserting quoted chunks of text
4009494e
GM
305* Enhancing text:: Subscripts, symbols and more
306* Export options:: How to influence the export settings
307
308Publishing
309
310* Configuration:: Defining projects
311* Sample configuration:: Example projects
312* Triggering publication:: Publication commands
313
314Configuration
315
316* Project alist:: The central configuration variable
317* Sources and destinations:: From here to there
318* Selecting files:: What files are part of the project?
319* Publishing action:: Setting the function doing the publishing
320* Publishing options:: Tweaking HTML export
321* Publishing links:: Which links keep working after publishing?
322* Project page index:: Publishing a list of project files
323
324Sample configuration
325
326* Simple example:: One-component publishing
327* Complex example:: A multi-component publishing example
328
329Miscellaneous
330
331* Completion:: M-TAB knows what you need
a7808fba 332* Customization:: Adapting Org to your taste
4009494e
GM
333* In-buffer settings:: Overview of the #+KEYWORDS
334* The very busy C-c C-c key:: When in doubt, press C-c C-c
335* Clean view:: Getting rid of leading stars in the outline
a7808fba 336* TTY keys:: Using Org on a tty
4009494e
GM
337* Interaction:: Other Emacs packages
338* Bugs:: Things which do not work perfectly
339
340Interaction with other packages
341
a7808fba 342* Cooperation:: Packages Org cooperates with
4009494e
GM
343* Conflicts:: Packages that lead to conflicts
344
345Extensions, Hooks and Hacking
346
a7808fba 347* Extensions:: Existing 3rd-party extensions
4009494e
GM
348* Adding hyperlink types:: New custom link types
349* Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
350* Dynamic blocks:: Automatically filled blocks
351* Special agenda views:: Customized views
352* Using the property API:: Writing programs that use entry properties
353
a7808fba 354Tables and lists in arbitrary syntax
4009494e
GM
355
356* Radio tables:: Sending and receiving
357* A LaTeX example:: Step by step, almost a tutorial
358* Translator functions:: Copy and modify
a7808fba 359* Radio lists:: Doing the same for lists
4009494e
GM
360
361@end detailmenu
362@end menu
363
a7808fba 364@node Introduction, Document Structure, Top, Top
4009494e
GM
365@chapter Introduction
366@cindex introduction
367
368@menu
a7808fba
CD
369* Summary:: Brief summary of what Org does
370* Installation:: How to install a downloaded version of Org
371* Activation:: How to activate Org for certain buffers
4009494e 372* Feedback:: Bug reports, ideas, patches etc.
dbc28aaa 373* Conventions:: Type-setting conventions in the manual
4009494e
GM
374@end menu
375
376@node Summary, Installation, Introduction, Introduction
377@section Summary
378@cindex summary
379
a7808fba 380Org is a mode for keeping notes, maintaining TODO lists, and doing
4009494e
GM
381project planning with a fast and effective plain-text system.
382
a7808fba
CD
383Org develops organizational tasks around NOTES files that contain
384lists or information about projects as plain text. Org is
385implemented on top of Outline mode, which makes it possible to keep the
4009494e
GM
386content of large files well structured. Visibility cycling and
387structure editing help to work with the tree. Tables are easily created
a7808fba 388with a built-in table editor. Org supports TODO items, deadlines,
4009494e
GM
389time stamps, and scheduling. It dynamically compiles entries into an
390agenda that utilizes and smoothly integrates much of the Emacs calendar
391and diary. Plain text URL-like links connect to websites, emails,
392Usenet messages, BBDB entries, and any files related to the projects.
a7808fba 393For printing and sharing of notes, an Org file can be exported as a
dbc28aaa 394structured ASCII file, as HTML, or (TODO and agenda items only) as an
4009494e 395iCalendar file. It can also serve as a publishing tool for a set of
a7808fba 396linked web pages.
4009494e 397
a7808fba 398An important design aspect that distinguishes Org from for example
4009494e
GM
399Planner/Muse is that it encourages to store every piece of information
400only once. In Planner, you have project pages, day pages and possibly
a7808fba 401other files, duplicating some information such as tasks. In Org,
4009494e
GM
402you only have notes files. In your notes you mark entries as tasks,
403label them with tags and timestamps. All necessary lists like a
404schedule for the day, the agenda for a meeting, tasks lists selected by
405tags etc are created dynamically when you need them.
406
a7808fba 407Org keeps simple things simple. When first fired up, it should
4009494e
GM
408feel like a straightforward, easy to use outliner. Complexity is not
409imposed, but a large amount of functionality is available when you need
a7808fba 410it. Org is a toolbox and can be used in different ways, for
4009494e
GM
411example as:
412
413@example
414@r{@bullet{} outline extension with visibility cycling and structure editing}
415@r{@bullet{} ASCII system and table editor for taking structured notes}
416@r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
417@r{@bullet{} TODO list editor}
418@r{@bullet{} full agenda and planner with deadlines and work scheduling}
419@r{@bullet{} environment to implement David Allen's GTD system}
420@r{@bullet{} a basic database application}
dbc28aaa 421@r{@bullet{} simple hypertext system, with HTML and LaTeX export}
4009494e
GM
422@r{@bullet{} publishing tool to create a set of interlinked webpages}
423@end example
424
a7808fba 425Org's automatic, context sensitive table editor with spreadsheet
4009494e 426capabilities can be integrated into any major mode by activating the
a7808fba 427minor Orgtbl mode. Using a translation step, it can be used to maintain
4009494e 428tables in arbitrary file types, for example in La@TeX{}. The structure
a7808fba
CD
429editing and list creation capabilities can be used outside Org with
430the minor Orgstruct mode.
4009494e
GM
431
432@cindex FAQ
a7808fba
CD
433There is a website for Org which provides links to the newest
434version of Org, as well as additional information, frequently asked
4009494e 435questions (FAQ), links to tutorials etc. This page is located at
dbc28aaa 436@uref{http://orgmode.org}.
4009494e
GM
437
438@page
439
440
441@node Installation, Activation, Summary, Introduction
442@section Installation
443@cindex installation
444@cindex XEmacs
445
a7808fba 446@b{Important:} @i{If Org is part of the Emacs distribution or an
4009494e
GM
447XEmacs package, please skip this section and go directly to
448@ref{Activation}.}
449
a7808fba
CD
450If you have downloaded Org from the Web, either as a distribution @file{.zip}
451or @file{.tar} file, or as a GIT archive, you must take the following steps
452to install it: Go into the unpacked Org distribution directory and edit the
453top section of the file @file{Makefile}. You must set the name of the Emacs
454binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
455directories where local Lisp and Info files are kept. If you don't have
456access to the system-wide directories, you can simply run Org directly from
457the distribution directory by adding the @file{lisp} subdirectory to the
458Emacs load path. To do this, add the following line to @file{.emacs}:
4009494e
GM
459
460@example
a7808fba
CD
461(setq load-path (cons "~/path/to/orgdir/lisp" load-path))
462@end example
463
464@noindent
465If you plan to use code from the @file{contrib} subdirectory, do a similar
466step for this directory:
467
468@example
469(setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
4009494e
GM
470@end example
471
472@b{XEmacs users now need to install the file @file{noutline.el} from
a7808fba 473the @file{xemacs} sub-directory of the Org distribution. Use the
4009494e
GM
474command:}
475
476@example
477@b{make install-noutline}
478@end example
479
a7808fba 480@noindent Now byte-compile the Lisp files with the shell command:
4009494e
GM
481
482@example
483make
4009494e
GM
484@end example
485
a7808fba
CD
486@noindent If you are running Org from the distribution directory, this is
487all. If you want to install into the system directories, use
4009494e
GM
488
489@example
a7808fba 490make install
4009494e
GM
491make install-info
492@end example
493
494@noindent Then add to @file{.emacs}:
495
496@lisp
a7808fba 497;; This line only if Org is not part of the X/Emacs distribution.
4009494e
GM
498(require 'org-install)
499@end lisp
500
a7808fba 501
4009494e
GM
502@node Activation, Feedback, Installation, Introduction
503@section Activation
504@cindex activation
505@cindex autoload
a7808fba
CD
506@cindex global key bindings
507@cindex key bindings, global
4009494e
GM
508
509@iftex
510@b{Important:} @i{If you use copy-and-paste to copy lisp code from the
511PDF documentation as viewed by Acrobat reader to your .emacs file, the
512single quote character comes out incorrectly and the code will not work.
513You need to fix the single quotes by hand, or copy from Info
514documentation.}
515@end iftex
516
517Add the following lines to your @file{.emacs} file. The last two lines
a7808fba
CD
518define @emph{global} keys for the commands @command{org-store-link},
519@command{org-agenda}, and @command{org-iswitchb} - please choose suitable
520keys yourself.
4009494e
GM
521
522@lisp
523;; The following lines are always needed. Choose your own keys.
524(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
525(global-set-key "\C-cl" 'org-store-link)
526(global-set-key "\C-ca" 'org-agenda)
a7808fba 527(global-set-key "\C-cb" 'org-iswitchb)
4009494e
GM
528@end lisp
529
a7808fba 530Furthermore, you must activate @code{font-lock-mode} in Org
4009494e
GM
531buffers, because significant functionality depends on font-locking being
532active. You can do this with either one of the following two lines
533(XEmacs user must use the second option):
534@lisp
535(global-font-lock-mode 1) ; for all buffers
a7808fba 536(add-hook 'org-mode-hook 'turn-on-font-lock) ; Org buffers only
4009494e
GM
537@end lisp
538
a7808fba 539@cindex Org mode, turning on
4009494e 540With this setup, all files with extension @samp{.org} will be put
a7808fba 541into Org mode. As an alternative, make the first line of a file look
4009494e
GM
542like this:
543
544@example
545MY PROJECTS -*- mode: org; -*-
546@end example
547
a7808fba 548@noindent which will select Org mode for this buffer no matter what
4009494e
GM
549the file's name is. See also the variable
550@code{org-insert-mode-line-in-empty-file}.
551
dbc28aaa 552@node Feedback, Conventions, Activation, Introduction
4009494e
GM
553@section Feedback
554@cindex feedback
555@cindex bug reports
556@cindex maintainer
557@cindex author
558
a7808fba 559If you find problems with Org, or if you have questions, remarks,
4009494e
GM
560or ideas about it, please contact the maintainer @value{MAINTAINER} at
561@value{MAINTAINEREMAIL}.
562
563For bug reports, please provide as much information as possible,
564including the version information of Emacs (@kbd{C-h v emacs-version
a7808fba
CD
565@key{RET}}) and Org (@kbd{C-h v org-version @key{RET}}), as well as
566the Org related setup in @file{.emacs}. If an error occurs, a
4009494e
GM
567backtrace can be very useful (see below on how to create one). Often a
568small example file helps, along with clear information about:
569
570@enumerate
571@item What exactly did you do?
572@item What did you expect to happen?
573@item What happened instead?
574@end enumerate
575@noindent Thank you for helping to improve this mode.
576
577@subsubheading How to create a useful backtrace
578
579@cindex backtrace of an error
a7808fba 580If working with Org produces an error with a message you don't
4009494e
GM
581understand, you may have hit a bug. The best way to report this is by
582providing, in addition to what was mentioned above, a @emph{Backtrace}.
583This is information from the built-in debugger about where and how the
584error occurred. Here is how to produce a useful backtrace:
585
586@enumerate
587@item
588Start a fresh Emacs or XEmacs, and make sure that it will load the
589original Lisp code in @file{org.el} instead of the compiled version in
590@file{org.elc}. The backtrace contains much more information if it is
591produced with uncompiled code. To do this, either rename @file{org.elc}
592to something else before starting Emacs, or ask Emacs explicitly to load
593@file{org.el} by using the command line
594@example
595emacs -l /path/to/org.el
596@end example
597@item
598Go to the @code{Options} menu and select @code{Enter Debugger on Error}
599(XEmacs has this option in the @code{Troubleshooting} sub-menu).
600@item
601Do whatever you have to do to hit the error. Don't forget to
602document the steps you take.
603@item
604When you hit the error, a @file{*Backtrace*} buffer will appear on the
605screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and
606attach it to your bug report.
607@end enumerate
608
dbc28aaa
CD
609@node Conventions, , Feedback, Introduction
610@section Typesetting conventions used in this manual
611
a7808fba 612Org uses three types of keywords: TODO keywords, tags, and property
dbc28aaa
CD
613names. In this manual we use the following conventions:
614
615@table @code
616@item TODO
617@itemx WAITING
618TODO keywords are written with all capitals, even if they are
619user-defined.
620@item boss
621@itemx ARCHIVE
622User-defined tags are written in lowercase; built-in tags with special
623meaning are written with all capitals.
624@item Release
625@itemx PRIORITY
626User-defined properties are capitalized; built-in properties with
627special meaning are written with all capitals.
628@end table
629
a7808fba 630@node Document Structure, Tables, Introduction, Top
4009494e
GM
631@chapter Document Structure
632@cindex document structure
633@cindex structure of document
634
a7808fba 635Org is based on outline mode and provides flexible commands to
4009494e
GM
636edit the structure of the document.
637
638@menu
a7808fba
CD
639* Outlines:: Org is based on Outline mode
640* Headlines:: How to typeset Org tree headlines
4009494e
GM
641* Visibility cycling:: Show and hide, much simplified
642* Motion:: Jumping to other headlines
643* Structure editing:: Changing sequence and level of headlines
644* Archiving:: Move done task trees to a different place
645* Sparse trees:: Matches embedded in context
646* Plain lists:: Additional structure within an entry
647* Drawers:: Tucking stuff away
a7808fba 648* Orgstruct mode:: Structure editing outside Org
4009494e
GM
649@end menu
650
a7808fba 651@node Outlines, Headlines, Document Structure, Document Structure
4009494e
GM
652@section Outlines
653@cindex outlines
a7808fba 654@cindex Outline mode
4009494e 655
a7808fba 656Org is implemented on top of Outline mode. Outlines allow a
4009494e
GM
657document to be organized in a hierarchical structure, which (at least
658for me) is the best representation of notes and thoughts. An overview
659of this structure is achieved by folding (hiding) large parts of the
660document to show only the general document structure and the parts
a7808fba 661currently being worked on. Org greatly simplifies the use of
4009494e
GM
662outlines by compressing the entire show/hide functionality into a single
663command @command{org-cycle}, which is bound to the @key{TAB} key.
664
a7808fba 665@node Headlines, Visibility cycling, Outlines, Document Structure
4009494e
GM
666@section Headlines
667@cindex headlines
668@cindex outline tree
669
670Headlines define the structure of an outline tree. The headlines in
a7808fba 671Org start with one or more stars, on the left margin@footnote{See
4009494e
GM
672the variable @code{org-special-ctrl-a/e} to configure special behavior
673of @kbd{C-a} and @kbd{C-e} in headlines.}. For example:
674
675@example
676* Top level headline
677** Second level
678*** 3rd level
679 some text
680*** 3rd level
681 more text
682
683* Another top level headline
684@end example
685
686@noindent Some people find the many stars too noisy and would prefer an
687outline that has whitespace followed by a single star as headline
688starters. @ref{Clean view} describes a setup to realize this.
689
690An empty line after the end of a subtree is considered part of it and
691will be hidden when the subtree is folded. However, if you leave at
692least two empty lines, one empty line will remain visible after folding
693the subtree, in order to structure the collapsed view. See the
694variable @code{org-cycle-separator-lines} to modify this behavior.
695
a7808fba 696@node Visibility cycling, Motion, Headlines, Document Structure
4009494e
GM
697@section Visibility cycling
698@cindex cycling, visibility
699@cindex visibility cycling
700@cindex trees, visibility
701@cindex show hidden text
702@cindex hide text
703
704Outlines make it possible to hide parts of the text in the buffer.
a7808fba 705Org uses just two commands, bound to @key{TAB} and
4009494e
GM
706@kbd{S-@key{TAB}} to change the visibility in the buffer.
707
708@cindex subtree visibility states
709@cindex subtree cycling
710@cindex folded, subtree visibility state
711@cindex children, subtree visibility state
712@cindex subtree, subtree visibility state
713@table @kbd
714@kindex @key{TAB}
715@item @key{TAB}
716@emph{Subtree cycling}: Rotate current subtree among the states
717
718@example
719,-> FOLDED -> CHILDREN -> SUBTREE --.
720'-----------------------------------'
721@end example
722
723The cursor must be on a headline for this to work@footnote{see, however,
724the option @code{org-cycle-emulate-tab}.}. When the cursor is at the
725beginning of the buffer and the first line is not a headline, then
726@key{TAB} actually runs global cycling (see below)@footnote{see the
727option @code{org-cycle-global-at-bob}.}. Also when called with a prefix
728argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
729
730@cindex global visibility states
731@cindex global cycling
732@cindex overview, global visibility state
733@cindex contents, global visibility state
734@cindex show all, global visibility state
735@kindex S-@key{TAB}
736@item S-@key{TAB}
737@itemx C-u @key{TAB}
738@emph{Global cycling}: Rotate the entire buffer among the states
739
740@example
741,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
742'--------------------------------------'
743@end example
744
a7808fba
CD
745When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
746CONTENTS view up to headlines of level N will be shown. Note that inside
747tables, @kbd{S-@key{TAB}} jumps to the previous field.
4009494e
GM
748
749@cindex show all, command
750@kindex C-c C-a
751@item C-c C-a
752Show all.
753@kindex C-c C-r
754@item C-c C-r
a7808fba
CD
755Reveal context around point, showing the current entry, the following heading
756and the hierarchy above. Useful for working near a location that has been
757exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
758(@pxref{Agenda commands}). With a prefix argument show, on each
4009494e
GM
759level, all sibling headings.
760@kindex C-c C-x b
761@item C-c C-x b
762Show the current subtree in an indirect buffer@footnote{The indirect
763buffer
764@ifinfo
765(@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
766@end ifinfo
767@ifnotinfo
768(see the Emacs manual for more information about indirect buffers)
769@end ifnotinfo
770will contain the entire buffer, but will be narrowed to the current
771tree. Editing the indirect buffer will also change the original buffer,
a7808fba
CD
772but without affecting visibility in that buffer.}. With a numeric
773prefix argument N, go up to level N and then take that tree. If N is
774negative then go up that many levels. With a @kbd{C-u} prefix, do not remove
4009494e
GM
775the previously used indirect buffer.
776@end table
777
a7808fba 778When Emacs first visits an Org file, the global state is set to
4009494e
GM
779OVERVIEW, i.e. only the top level headlines are visible. This can be
780configured through the variable @code{org-startup-folded}, or on a
781per-file basis by adding one of the following lines anywhere in the
782buffer:
783
784@example
785#+STARTUP: overview
786#+STARTUP: content
787#+STARTUP: showall
788@end example
789
a7808fba 790@node Motion, Structure editing, Visibility cycling, Document Structure
4009494e
GM
791@section Motion
792@cindex motion, between headlines
793@cindex jumping, to headlines
794@cindex headline navigation
795The following commands jump to other headlines in the buffer.
796
797@table @kbd
798@kindex C-c C-n
799@item C-c C-n
800Next heading.
801@kindex C-c C-p
802@item C-c C-p
803Previous heading.
804@kindex C-c C-f
805@item C-c C-f
806Next heading same level.
807@kindex C-c C-b
808@item C-c C-b
809Previous heading same level.
810@kindex C-c C-u
811@item C-c C-u
812Backward to higher level heading.
813@kindex C-c C-j
814@item C-c C-j
815Jump to a different place without changing the current outline
816visibility. Shows the document structure in a temporary buffer, where
817you can use the following keys to find your destination:
818@example
819@key{TAB} @r{Cycle visibility.}
820@key{down} / @key{up} @r{Next/previous visible headline.}
821n / p @r{Next/previous visible headline.}
822f / b @r{Next/previous headline same level.}
823u @r{One level up.}
8240-9 @r{Digit argument.}
825@key{RET} @r{Select this location.}
826@end example
827@end table
828
a7808fba 829@node Structure editing, Archiving, Motion, Document Structure
4009494e
GM
830@section Structure editing
831@cindex structure editing
832@cindex headline, promotion and demotion
833@cindex promotion, of subtrees
834@cindex demotion, of subtrees
835@cindex subtree, cut and paste
836@cindex pasting, of subtrees
837@cindex cutting, of subtrees
838@cindex copying, of subtrees
839@cindex subtrees, cut and paste
840
841@table @kbd
842@kindex M-@key{RET}
843@item M-@key{RET}
844Insert new heading with same level as current. If the cursor is in a
845plain list item, a new item is created (@pxref{Plain lists}). To force
a7808fba 846creation of a new headline, use a prefix argument, or first press @key{RET}
4009494e
GM
847to get to the beginning of the next line. When this command is used in
848the middle of a line, the line is split and the rest of the line becomes
28a16a1b
CD
849the new headline@footnote{If you do not want the line to be split,
850customize the variable @code{org-M-RET-may-split-line}.}. If the
851command is used at the beginning of a headline, the new headline is
852created before the current line. If at the beginning of any other line,
853the content of that line is made the new heading. If the command is
854used at the end of a folded subtree (i.e. behind the ellipses at the end
855of a headline), then a headline like the current one will be inserted
856after the end of the subtree.
dbc28aaa
CD
857@kindex C-@key{RET}
858@item C-@key{RET}
859Insert a new heading after the current subtree, same level as the
860current headline. This command works from anywhere in the entry.
4009494e
GM
861@kindex M-S-@key{RET}
862@item M-S-@key{RET}
863Insert new TODO entry with same level as current heading.
864@kindex M-@key{left}
865@item M-@key{left}
866Promote current heading by one level.
867@kindex M-@key{right}
868@item M-@key{right}
869Demote current heading by one level.
870@kindex M-S-@key{left}
871@item M-S-@key{left}
872Promote the current subtree by one level.
873@kindex M-S-@key{right}
874@item M-S-@key{right}
875Demote the current subtree by one level.
876@kindex M-S-@key{up}
877@item M-S-@key{up}
878Move subtree up (swap with previous subtree of same
879level).
880@kindex M-S-@key{down}
881@item M-S-@key{down}
882Move subtree down (swap with next subtree of same level).
883@kindex C-c C-x C-w
884@kindex C-c C-x C-k
885@item C-c C-x C-w
886@itemx C-c C-x C-k
887Kill subtree, i.e. remove it from buffer but save in kill ring.
a7808fba 888With a numeric prefix argument N, kill N sequential subtrees.
4009494e
GM
889@kindex C-c C-x M-w
890@item C-c C-x M-w
a7808fba
CD
891Copy subtree to kill ring. With a numeric prefix argument N, copy the N
892sequential subtrees.
4009494e
GM
893@kindex C-c C-x C-y
894@item C-c C-x C-y
895Yank subtree from kill ring. This does modify the level of the subtree to
a7808fba
CD
896make sure the tree fits in nicely at the yank position. The yank level can
897also be specified with a numeric prefix argument, or by yanking after a
4009494e 898headline marker like @samp{****}.
dbc28aaa
CD
899@kindex C-c C-w
900@item C-c C-w
901Refile entry to a different location. @xref{Refiling notes}.
4009494e
GM
902@kindex C-c ^
903@item C-c ^
a7808fba
CD
904Sort same-level entries. When there is an active region, all entries in the
905region will be sorted. Otherwise the children of the current headline are
906sorted. The command prompts for the sorting method, which can be
907alphabetically, numerically, by time (using the first time stamp in each
908entry), by priority, or by TODO keyword (in the sequence the keywords have
909been defined in the setup). Reverse sorting is possible as well. You can
910also supply your own function to extract the sorting key. With a @kbd{C-u}
911prefix, sorting will be case-sensitive. With two @kbd{C-u C-u} prefixes,
912duplicate entries will also be removed.
28a16a1b
CD
913@kindex C-c *
914@item C-c *
915Turn a normal line or plain list item into a headline (so that it
916becomes a subheading at its location). Also turn a headline into a
917normal line by removing the stars. If there is an active region, turn
918all lines in the region into headlines. Or, if the first line is a
919headline, remove the stars from all headlines in the region.
4009494e
GM
920@end table
921
922@cindex region, active
923@cindex active region
a7808fba
CD
924@cindex Transient mark mode
925When there is an active region (Transient mark mode), promotion and
4009494e
GM
926demotion work on all headlines in the region. To select a region of
927headlines, it is best to place both point and mark at the beginning of a
928line, mark at the beginning of the first headline, and point at the line
929just after the last headline to change. Note that when the cursor is
930inside a table (@pxref{Tables}), the Meta-Cursor keys have different
931functionality.
932
a7808fba 933@node Archiving, Sparse trees, Structure editing, Document Structure
4009494e
GM
934@section Archiving
935@cindex archiving
936
937When a project represented by a (sub)tree is finished, you may want
938to move the tree out of the way and to stop it from contributing to the
a7808fba 939agenda. Org mode knows two ways of archiving. You can mark a tree with
4009494e
GM
940the ARCHIVE tag, or you can move an entire (sub)tree to a different
941location.
942
943@menu
944* ARCHIVE tag:: Marking a tree as inactive
945* Moving subtrees:: Moving a tree to an archive file
946@end menu
947
948@node ARCHIVE tag, Moving subtrees, Archiving, Archiving
949@subsection The ARCHIVE tag
950@cindex internal archiving
951
952A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
953its location in the outline tree, but behaves in the following way:
954@itemize @minus
955@item
956It does not open when you attempt to do so with a visibility cycling
957command (@pxref{Visibility cycling}). You can force cycling archived
958subtrees with @kbd{C-@key{TAB}}, or by setting the option
959@code{org-cycle-open-archived-trees}. Also normal outline commands like
960@code{show-all} will open archived subtrees.
961@item
962During sparse tree construction (@pxref{Sparse trees}), matches in
963archived subtrees are not exposed, unless you configure the option
964@code{org-sparse-tree-open-archived-trees}.
965@item
a7808fba 966During agenda view construction (@pxref{Agenda Views}), the content of
4009494e
GM
967archived trees is ignored unless you configure the option
968@code{org-agenda-skip-archived-trees}.
969@item
970Archived trees are not exported (@pxref{Exporting}), only the headline
971is. Configure the details using the variable
972@code{org-export-with-archived-trees}.
973@end itemize
974
975The following commands help managing the ARCHIVE tag:
976
977@table @kbd
a7808fba
CD
978@kindex C-c C-x a
979@item C-c C-x a
4009494e 980Toggle the ARCHIVE tag for the current headline. When the tag is set,
a7808fba 981the headline changes to a shadowed face, and the subtree below it is
4009494e 982hidden.
a7808fba
CD
983@kindex C-u C-c C-x a
984@item C-u C-c C-x a
4009494e
GM
985Check if any direct children of the current headline should be archived.
986To do this, each subtree is checked for open TODO entries. If none are
987found, the command offers to set the ARCHIVE tag for the child. If the
988cursor is @emph{not} on a headline when this command is invoked, the
989level 1 trees will be checked.
990@kindex C-@kbd{TAB}
991@item C-@kbd{TAB}
992Cycle a tree even if it is tagged with ARCHIVE.
993@end table
994
995@node Moving subtrees, , ARCHIVE tag, Archiving
996@subsection Moving subtrees
997@cindex external archiving
998
a7808fba
CD
999Once an entire project is finished, you may want to move it to a different
1000location. Org can move it to an @emph{Attic Sibling} in the same tree, to a
1001different tree in the current file, or to a different file, the archive file.
4009494e
GM
1002
1003@table @kbd
a7808fba
CD
1004@kindex C-c C-x A
1005@item C-c C-x A
0a29fbf3 1006Move the current entry to the @emph{Attic Sibling}. This is a sibling of the
a7808fba
CD
1007entry with the heading @samp{Attic} and the tag @samp{ARCHIVE}
1008(@pxref{ARCHIVE tag}). The entry becomes a child of that sibling and in this
1009way retains a lot of its original context, including inherited tags and
1010approximate position in the outline.
4009494e
GM
1011@kindex C-c C-x C-s
1012@item C-c C-x C-s
1013Archive the subtree starting at the cursor position to the location
1014given by @code{org-archive-location}. Context information that could be
a7808fba 1015lost like the file name, the category, inherited tags, and the TODO
4009494e
GM
1016state will be store as properties in the entry.
1017@kindex C-u C-c C-x C-s
1018@item C-u C-c C-x C-s
1019Check if any direct children of the current headline could be moved to
1020the archive. To do this, each subtree is checked for open TODO entries.
1021If none are found, the command offers to move it to the archive
1022location. If the cursor is @emph{not} on a headline when this command
1023is invoked, the level 1 trees will be checked.
1024@end table
1025
1026@cindex archive locations
1027The default archive location is a file in the same directory as the
1028current file, with the name derived by appending @file{_archive} to the
1029current file name. For information and examples on how to change this,
1030see the documentation string of the variable
1031@code{org-archive-location}. There is also an in-buffer option for
dbc28aaa
CD
1032setting this variable, for example@footnote{For backward compatibility,
1033the following also works: If there are several such lines in a file,
1034each specifies the archive location for the text below it. The first
1035such line also applies to any text before its definition. However,
1036using this method is @emph{strongly} deprecated as it is incompatible
1037with the outline structure of the document. The correct method for
1038setting multiple archive locations in a buffer is using a property.}:
4009494e
GM
1039
1040@example
1041#+ARCHIVE: %s_done::
1042@end example
1043
1044@noindent
dbc28aaa
CD
1045If you would like to have a special ARCHIVE location for a single entry
1046or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
a7808fba 1047location as the value (@pxref{Properties and Columns}).
4009494e 1048
28a16a1b
CD
1049When a subtree is moved, it receives a number of special properties that
1050record context information like the file from where the entry came, it's
1051outline path the archiving time etc. Configure the variable
1052@code{org-archive-save-context-info} to adjust the amount of information
1053added.
1054
a7808fba 1055@node Sparse trees, Plain lists, Archiving, Document Structure
4009494e
GM
1056@section Sparse trees
1057@cindex sparse trees
1058@cindex trees, sparse
1059@cindex folding, sparse trees
1060@cindex occur, command
1061
a7808fba 1062An important feature of Org mode is the ability to construct
dbc28aaa
CD
1063@emph{sparse trees} for selected information in an outline tree, so that
1064the entire document is folded as much as possible, but the selected
1065information is made visible along with the headline structure above
1066it@footnote{See also the variables @code{org-show-hierarchy-above},
1067@code{org-show-following-heading}, and @code{org-show-siblings} for
1068detailed control on how much context is shown around each match.}. Just
1069try it out and you will see immediately how it works.
1070
a7808fba 1071Org mode contains several commands creating such trees, all these
dbc28aaa 1072commands can be accessed through a dispatcher:
4009494e
GM
1073
1074@table @kbd
1075@kindex C-c /
1076@item C-c /
dbc28aaa
CD
1077This prompts for an extra key to select a sparse-tree creating command.
1078@kindex C-c / r
1079@item C-c / r
4009494e
GM
1080Occur. Prompts for a regexp and shows a sparse tree with all matches.
1081If the match is in a headline, the headline is made visible. If the
1082match is in the body of an entry, headline and body are made visible.
1083In order to provide minimal context, also the full hierarchy of
1084headlines above the match is shown, as well as the headline following
1085the match. Each match is also highlighted; the highlights disappear
1086when the buffer is changed by an editing command, or by pressing
1087@kbd{C-c C-c}. When called with a @kbd{C-u} prefix argument, previous
1088highlights are kept, so several calls to this command can be stacked.
1089@end table
dbc28aaa 1090
4009494e
GM
1091@noindent
1092For frequently used sparse trees of specific search strings, you can
1093use the variable @code{org-agenda-custom-commands} to define fast
1094keyboard access to specific sparse trees. These commands will then be
1095accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
1096For example:
1097
1098@lisp
1099(setq org-agenda-custom-commands
1100 '(("f" occur-tree "FIXME")))
1101@end lisp
1102
1103@noindent will define the key @kbd{C-c a f} as a shortcut for creating
1104a sparse tree matching the string @samp{FIXME}.
1105
dbc28aaa
CD
1106The other sparse tree commands select headings based on TODO keywords,
1107tags, or properties and will be discussed later in this manual.
4009494e
GM
1108
1109@kindex C-c C-e v
1110@cindex printing sparse trees
1111@cindex visible text, printing
1112To print a sparse tree, you can use the Emacs command
1113@code{ps-print-buffer-with-faces} which does not print invisible parts
1114of the document @footnote{This does not work under XEmacs, because
1115XEmacs uses selective display for outlining, not text properties.}.
1116Or you can use the command @kbd{C-c C-e v} to export only the visible
1117part of the document and print the resulting file.
1118
a7808fba 1119@node Plain lists, Drawers, Sparse trees, Document Structure
4009494e
GM
1120@section Plain lists
1121@cindex plain lists
1122@cindex lists, plain
1123@cindex lists, ordered
1124@cindex ordered lists
1125
1126Within an entry of the outline tree, hand-formatted lists can provide
1127additional structure. They also provide a way to create lists of
a7808fba 1128checkboxes (@pxref{Checkboxes}). Org supports editing such lists,
dbc28aaa 1129and the HTML exporter (@pxref{Exporting}) parses and formats them.
4009494e 1130
a7808fba 1131Org knows ordered and unordered lists. Unordered list items start
4009494e
GM
1132with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
1133bullet, lines must be indented or they will be seen as top-level
1134headlines. Also, when you are hiding leading stars to get a clean
1135outline view, plain list items starting with a star are visually
1136indistinguishable from true headlines. In short: even though @samp{*}
dbc28aaa
CD
1137is supported, it may be better to not use it for plain list items.} as
1138bullets. Ordered list items start with a numeral followed by either a
1139period or a right parenthesis, such as @samp{1.} or @samp{1)}. Items
4009494e
GM
1140belonging to the same list must have the same indentation on the first
1141line. In particular, if an ordered list reaches number @samp{10.}, then
1142the 2--digit numbers must be written left-aligned with the other numbers
1143in the list. Indentation also determines the end of a list item. It
1144ends before the next line that is indented like the bullet/number, or
1145less. Empty lines are part of the previous item, so you can have
1146several paragraphs in one item. If you would like an empty line to
1147terminate all currently open plain lists, configure the variable
1148@code{org-empty-line-terminates-plain-lists}. Here is an example:
1149
1150@example
1151@group
1152** Lord of the Rings
1153 My favorite scenes are (in this order)
1154 1. The attack of the Rohirrim
1155 2. Eowyns fight with the witch king
1156 + this was already my favorite scene in the book
1157 + I really like Miranda Otto.
1158 3. Peter Jackson being shot by Legolas
1159 - on DVD only
1160 He makes a really funny face when it happens.
1161 But in the end, not individual scenes matter but the film as a whole.
1162@end group
1163@end example
1164
a7808fba
CD
1165Org supports these lists by tuning filling and wrapping commands to
1166deal with them correctly@footnote{Org only changes the filling
4009494e
GM
1167settings for Emacs. For XEmacs, you should use Kyle E. Jones'
1168@file{filladapt.el}. To turn this on, put into @file{.emacs}:
28a16a1b 1169@code{(require 'filladapt)}}.
4009494e
GM
1170
1171The following commands act on items when the cursor is in the first line
1172of an item (the line with the bullet or number).
1173
1174@table @kbd
1175@kindex @key{TAB}
1176@item @key{TAB}
1177Items can be folded just like headline levels if you set the variable
1178@code{org-cycle-include-plain-lists}. The level of an item is then
1179given by the indentation of the bullet/number. Items are always
1180subordinate to real headlines, however; the hierarchies remain
1181completely separated.
1182
1183If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
a7808fba 1184fixes the indentation of the current line in a heuristic way.
4009494e
GM
1185@kindex M-@key{RET}
1186@item M-@key{RET}
a7808fba
CD
1187Insert new item at current level. With a prefix argument, force a new
1188heading (@pxref{Structure editing}). If this command is used in the middle
1189of a line, the line is @emph{split} and the rest of the line becomes the new
1190item@footnote{If you do not want the line to be split, customize the variable
1191@code{org-M-RET-may-split-line}.}. If this command is executed in the
1192@emph{whitespace before a bullet or number}, the new item is created
1193@emph{before} the current item. If the command is executed in the white
1194space before the text that is part of an item but does not contain the
1195bullet, a bullet is added to the current line.
4009494e
GM
1196@kindex M-S-@key{RET}
1197@item M-S-@key{RET}
1198Insert a new item with a checkbox (@pxref{Checkboxes}).
1199@kindex S-@key{up}
1200@kindex S-@key{down}
1201@item S-@key{up}
1202@itemx S-@key{down}
1203Jump to the previous/next item in the current list.
1204@kindex M-S-@key{up}
1205@kindex M-S-@key{down}
1206@item M-S-@key{up}
1207@itemx M-S-@key{down}
1208Move the item including subitems up/down (swap with previous/next item
1209of same indentation). If the list is ordered, renumbering is
1210automatic.
1211@kindex M-S-@key{left}
1212@kindex M-S-@key{right}
1213@item M-S-@key{left}
1214@itemx M-S-@key{right}
1215Decrease/increase the indentation of the item, including subitems.
1216Initially, the item tree is selected based on current indentation.
1217When these commands are executed several times in direct succession,
1218the initially selected region is used, even if the new indentation
1219would imply a different hierarchy. To use the new hierarchy, break
1220the command chain with a cursor motion or so.
1221@kindex C-c C-c
1222@item C-c C-c
1223If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
dbc28aaa
CD
1224state of the checkbox. If not, this command makes sure that all the
1225items on this list level use the same bullet. Furthermore, if this is
a7808fba 1226an ordered list, make sure the numbering is OK.
4009494e
GM
1227@kindex C-c -
1228@item C-c -
a7808fba
CD
1229Cycle the entire list level through the different itemize/enumerate bullets
1230(@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}). With a numeric prefix
1231argument N, select the Nth bullet from this list. If there is an active
1232region when calling this, all lines will be converted to list items. If the
1233first line already was a list item, any item markers will be removed from the
1234list. Finally, even without an active region, a normal line will be
1235converted into a list item.
4009494e
GM
1236@end table
1237
a7808fba 1238@node Drawers, Orgstruct mode, Plain lists, Document Structure
4009494e
GM
1239@section Drawers
1240@cindex drawers
1241@cindex visibility cycling, drawers
1242
1243Sometimes you want to keep information associated with an entry, but you
a7808fba 1244normally don't want to see it. For this, Org mode has @emph{drawers}.
dbc28aaa
CD
1245Drawers need to be configured with the variable
1246@code{org-drawers}@footnote{You can define drawers on a per-file basis
1247with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}. Drawers
4009494e
GM
1248look like this:
1249
1250@example
1251** This is a headline
1252 Still outside the drawer
1253 :DRAWERNAME:
1254 This is inside the drawer.
1255 :END:
1256 After the drawer.
1257@end example
1258
1259Visibility cycling (@pxref{Visibility cycling}) on the headline will
1260hide and show the entry, but keep the drawer collapsed to a single line.
1261In order to look inside the drawer, you need to move the cursor to the
a7808fba
CD
1262drawer line and press @key{TAB} there. Org mode uses a drawer for
1263storing properties (@pxref{Properties and Columns}).
4009494e 1264
a7808fba 1265@node Orgstruct mode, , Drawers, Document Structure
4009494e 1266@section The Orgstruct minor mode
a7808fba 1267@cindex Orgstruct mode
4009494e
GM
1268@cindex minor mode for structure editing
1269
a7808fba 1270If you like the intuitive way the Org mode structure editing and list
4009494e 1271formatting works, you might want to use these commands in other modes
a7808fba 1272like Text mode or Mail mode as well. The minor mode Orgstruct mode
4009494e 1273makes this possible. You can always toggle the mode with @kbd{M-x
a7808fba 1274orgstruct-mode}. To turn it on by default, for example in Mail mode,
4009494e
GM
1275use
1276
1277@lisp
1278(add-hook 'mail-mode-hook 'turn-on-orgstruct)
1279@end lisp
1280
1281When this mode is active and the cursor is on a line that looks to
a7808fba 1282Org like a headline of the first line of a list item, most
4009494e
GM
1283structure editing commands will work, even if the same keys normally
1284have different functionality in the major mode you are using. If the
a7808fba 1285cursor is not in one of those special lines, Orgstruct mode lurks
4009494e
GM
1286silently in the shadow.
1287
a7808fba 1288@node Tables, Hyperlinks, Document Structure, Top
4009494e
GM
1289@chapter Tables
1290@cindex tables
1291@cindex editing tables
1292
a7808fba 1293Org comes with a fast and intuitive table editor. Spreadsheet-like
dbc28aaa 1294calculations are supported in connection with the Emacs @file{calc}
28a16a1b 1295package
dbc28aaa 1296@ifinfo
a7808fba 1297(@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
dbc28aaa
CD
1298@end ifinfo
1299@ifnotinfo
1300(see the Emacs Calculator manual for more information about the Emacs
1301calculator).
1302@end ifnotinfo
4009494e
GM
1303
1304@menu
1305* Built-in table editor:: Simple tables
28a16a1b 1306* Narrow columns:: Stop wasting space in tables
4009494e 1307* Column groups:: Grouping to trigger vertical lines
a7808fba
CD
1308* Orgtbl mode:: The table editor as minor mode
1309* The spreadsheet:: The table editor has spreadsheet capabilities
4009494e
GM
1310@end menu
1311
1312@node Built-in table editor, Narrow columns, Tables, Tables
1313@section The built-in table editor
1314@cindex table editor, built-in
1315
a7808fba 1316Org makes it easy to format tables in plain ASCII. Any line with
4009494e
GM
1317@samp{|} as the first non-whitespace character is considered part of a
1318table. @samp{|} is also the column separator. A table might look like
1319this:
1320
1321@example
1322| Name | Phone | Age |
1323|-------+-------+-----|
1324| Peter | 1234 | 17 |
1325| Anna | 4321 | 25 |
1326@end example
1327
1328A table is re-aligned automatically each time you press @key{TAB} or
1329@key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
1330the next field (@key{RET} to the next row) and creates new table rows
1331at the end of the table or before horizontal lines. The indentation
1332of the table is set by the first line. Any line starting with
1333@samp{|-} is considered as a horizontal separator line and will be
1334expanded on the next re-align to span the whole table width. So, to
1335create the above table, you would only type
1336
1337@example
1338|Name|Phone|Age|
1339|-
1340@end example
1341
1342@noindent and then press @key{TAB} to align the table and start filling in
1343fields.
1344
a7808fba 1345When typing text into a field, Org treats @key{DEL},
4009494e
GM
1346@key{Backspace}, and all character keys in a special way, so that
1347inserting and deleting avoids shifting other fields. Also, when
1348typing @emph{immediately after the cursor was moved into a new field
1349with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
1350field is automatically made blank. If this behavior is too
1351unpredictable for you, configure the variables
1352@code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
1353
1354@table @kbd
1355@tsubheading{Creation and conversion}
1356@kindex C-c |
1357@item C-c |
1358Convert the active region to table. If every line contains at least one
1359TAB character, the function assumes that the material is tab separated.
dbc28aaa 1360If every line contains a comma, comma-separated values (CSV) are assumed.
4009494e 1361If not, lines are split at whitespace into fields. You can use a prefix
dbc28aaa
CD
1362argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
1363C-u} forces TAB, and a numeric argument N indicates that at least N
a7808fba 1364consecutive spaces, or alternatively a TAB will be the separator.
28a16a1b 1365@*
a7808fba 1366If there is no active region, this command creates an empty Org
4009494e
GM
1367table. But it's easier just to start typing, like
1368@kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
1369
1370@tsubheading{Re-aligning and field motion}
1371@kindex C-c C-c
1372@item C-c C-c
1373Re-align the table without moving the cursor.
1374@c
1375@kindex @key{TAB}
1376@item @key{TAB}
1377Re-align the table, move to the next field. Creates a new row if
1378necessary.
1379@c
1380@kindex S-@key{TAB}
1381@item S-@key{TAB}
1382Re-align, move to previous field.
1383@c
1384@kindex @key{RET}
1385@item @key{RET}
1386Re-align the table and move down to next row. Creates a new row if
1387necessary. At the beginning or end of a line, @key{RET} still does
1388NEWLINE, so it can be used to split a table.
1389
1390@tsubheading{Column and row editing}
1391@kindex M-@key{left}
1392@kindex M-@key{right}
1393@item M-@key{left}
1394@itemx M-@key{right}
1395Move the current column left/right.
1396@c
1397@kindex M-S-@key{left}
1398@item M-S-@key{left}
1399Kill the current column.
1400@c
1401@kindex M-S-@key{right}
1402@item M-S-@key{right}
1403Insert a new column to the left of the cursor position.
1404@c
1405@kindex M-@key{up}
1406@kindex M-@key{down}
1407@item M-@key{up}
1408@itemx M-@key{down}
1409Move the current row up/down.
1410@c
1411@kindex M-S-@key{up}
1412@item M-S-@key{up}
1413Kill the current row or horizontal line.
1414@c
1415@kindex M-S-@key{down}
1416@item M-S-@key{down}
a7808fba
CD
1417Insert a new row above the current row. With a prefix argument, the line is
1418created below the current one.
4009494e
GM
1419@c
1420@kindex C-c -
1421@item C-c -
a7808fba 1422Insert a horizontal line below current row. With a prefix argument, the line
4009494e
GM
1423is created above the current line.
1424@c
1425@kindex C-c ^
1426@item C-c ^
1427Sort the table lines in the region. The position of point indicates the
1428column to be used for sorting, and the range of lines is the range
1429between the nearest horizontal separator lines, or the entire table. If
1430point is before the first column, you will be prompted for the sorting
1431column. If there is an active region, the mark specifies the first line
1432and the sorting column, while point should be in the last line to be
1433included into the sorting. The command prompts for the sorting type
1434(alphabetically, numerically, or by time). When called with a prefix
1435argument, alphabetic sorting will be case-sensitive.
1436
1437@tsubheading{Regions}
1438@kindex C-c C-x M-w
1439@item C-c C-x M-w
1440Copy a rectangular region from a table to a special clipboard. Point
1441and mark determine edge fields of the rectangle. The process ignores
1442horizontal separator lines.
1443@c
1444@kindex C-c C-x C-w
1445@item C-c C-x C-w
1446Copy a rectangular region from a table to a special clipboard, and
1447blank all fields in the rectangle. So this is the ``cut'' operation.
1448@c
1449@kindex C-c C-x C-y
1450@item C-c C-x C-y
1451Paste a rectangular region into a table.
1452The upper right corner ends up in the current field. All involved fields
1453will be overwritten. If the rectangle does not fit into the present table,
1454the table is enlarged as needed. The process ignores horizontal separator
1455lines.
1456@c
1457@kindex C-c C-q
28a16a1b 1458@kindex M-@key{RET}
4009494e 1459@item C-c C-q
28a16a1b 1460@itemx M-@kbd{RET}
4009494e
GM
1461Wrap several fields in a column like a paragraph. If there is an active
1462region, and both point and mark are in the same column, the text in the
a7808fba
CD
1463column is wrapped to minimum width for the given number of lines. A numeric
1464prefix argument may be used to change the number of desired lines. If there
1465is no region, the current field is split at the cursor position and the text
1466fragment to the right of the cursor is prepended to the field one line
1467down. If there is no region, but you specify a prefix argument, the current
1468field is made blank, and the content is appended to the field above.
4009494e
GM
1469
1470@tsubheading{Calculations}
1471@cindex formula, in tables
1472@cindex calculations, in tables
1473@cindex region, active
1474@cindex active region
a7808fba 1475@cindex Transient mark mode
4009494e
GM
1476@kindex C-c +
1477@item C-c +
1478Sum the numbers in the current column, or in the rectangle defined by
1479the active region. The result is shown in the echo area and can
1480be inserted with @kbd{C-y}.
1481@c
1482@kindex S-@key{RET}
1483@item S-@key{RET}
1484When current field is empty, copy from first non-empty field above.
1485When not empty, copy current field down to next row and move cursor
1486along with it. Depending on the variable
1487@code{org-table-copy-increment}, integer field values will be
a7808fba 1488incremented during copy. This key is also used by CUA mode
4009494e
GM
1489(@pxref{Cooperation}).
1490
1491@tsubheading{Miscellaneous}
1492@kindex C-c `
1493@item C-c `
1494Edit the current field in a separate window. This is useful for fields
1495that are not fully visible (@pxref{Narrow columns}). When called with a
1496@kbd{C-u} prefix, just make the full field visible, so that it can be
1497edited in place.
1498@c
4009494e
GM
1499@item M-x org-table-import
1500Import a file as a table. The table should be TAB- or whitespace
dbc28aaa
CD
1501separated. Useful, for example, to import a spreadsheet table or data
1502from a database, because these programs generally can write
1503TAB-separated text files. This command works by inserting the file into
1504the buffer and then converting the region to a table. Any prefix
1505argument is passed on to the converter, which uses it to determine the
1506separator.
4009494e 1507@item C-c |
a7808fba 1508Tables can also be imported by pasting tabular text into the Org
4009494e
GM
1509buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
1510@kbd{C-c |} command (see above under @i{Creation and conversion}.
1511@c
1512@item M-x org-table-export
a7808fba
CD
1513Export the table, by default as a TAB-separated file. Useful for data
1514exchange with, for example, spreadsheet or database programs. The format
1515used to export the file can be configured in the variable
1516@code{org-table-export-default-format}. You may also use properties
1517@code{TABLE_EXPORT_FILE} and @code{TABLE_EXPORT_FORMAT} to specify the file
1518name and the format for table export in a subtree.
4009494e
GM
1519@end table
1520
1521If you don't like the automatic table editor because it gets in your
1522way on lines which you would like to start with @samp{|}, you can turn
1523it off with
1524
1525@lisp
1526(setq org-enable-table-editor nil)
1527@end lisp
1528
1529@noindent Then the only table command that still works is
1530@kbd{C-c C-c} to do a manual re-align.
1531
1532@node Narrow columns, Column groups, Built-in table editor, Tables
1533@section Narrow columns
1534@cindex narrow columns in tables
1535
1536The width of columns is automatically determined by the table editor.
1537Sometimes a single field or a few fields need to carry more text,
1538leading to inconveniently wide columns. To limit@footnote{This feature
1539does not work on XEmacs.} the width of a column, one field anywhere in
1540the column may contain just the string @samp{<N>} where @samp{N} is an
1541integer specifying the width of the column in characters. The next
1542re-align will then set the width of this column to no more than this
1543value.
1544
1545@example
1546@group
1547|---+------------------------------| |---+--------|
1548| | | | | <6> |
1549| 1 | one | | 1 | one |
1550| 2 | two | ----\ | 2 | two |
1551| 3 | This is a long chunk of text | ----/ | 3 | This=> |
1552| 4 | four | | 4 | four |
1553|---+------------------------------| |---+--------|
1554@end group
1555@end example
1556
1557@noindent
1558Fields that are wider become clipped and end in the string @samp{=>}.
1559Note that the full text is still in the buffer, it is only invisible.
1560To see the full text, hold the mouse over the field - a tool-tip window
1561will show the full content. To edit such a field, use the command
1562@kbd{C-c `} (that is @kbd{C-c} followed by the backquote). This will
1563open a new window with the full field. Edit it and finish with @kbd{C-c
1564C-c}.
1565
1566When visiting a file containing a table with narrowed columns, the
1567necessary character hiding has not yet happened, and the table needs to
1568be aligned before it looks nice. Setting the option
1569@code{org-startup-align-all-tables} will realign all tables in a file
1570upon visiting, but also slow down startup. You can also set this option
1571on a per-file basis with:
1572
1573@example
1574#+STARTUP: align
1575#+STARTUP: noalign
1576@end example
1577
a7808fba 1578@node Column groups, Orgtbl mode, Narrow columns, Tables
4009494e
GM
1579@section Column groups
1580@cindex grouping columns in tables
1581
a7808fba 1582When Org exports tables, it does so by default without vertical
4009494e
GM
1583lines because that is visually more satisfying in general. Occasionally
1584however, vertical lines can be useful to structure a table into groups
1585of columns, much like horizontal lines can do for groups of rows. In
1586order to specify column groups, you can use a special row where the
1587first field contains only @samp{/}. The further fields can either
1588contain @samp{<} to indicate that this column should start a group,
1589@samp{>} to indicate the end of a column, or @samp{<>} to make a column
a7808fba 1590a group of its own. Boundaries between column groups will upon export be
4009494e
GM
1591marked with vertical lines. Here is an example:
1592
1593@example
1594| | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1595|---+----+-----+-----+-----+---------+------------|
1596| / | <> | < | | > | < | > |
1597| # | 1 | 1 | 1 | 1 | 1 | 1 |
1598| # | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
1599| # | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
1600|---+----+-----+-----+-----+---------+------------|
1601#+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
1602@end example
1603
a7808fba 1604It is also sufficient to just insert the column group starters after
4009494e
GM
1605every vertical line you'd like to have:
1606
1607@example
1608| N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1609|----+-----+-----+-----+---------+------------|
1610| / | < | | | < | |
1611@end example
1612
a7808fba 1613@node Orgtbl mode, The spreadsheet, Column groups, Tables
4009494e 1614@section The Orgtbl minor mode
a7808fba 1615@cindex Orgtbl mode
4009494e
GM
1616@cindex minor mode for tables
1617
a7808fba
CD
1618If you like the intuitive way the Org table editor works, you
1619might also want to use it in other modes like Text mode or Mail mode.
1620The minor mode Orgtbl mode makes this possible. You can always toggle
4009494e
GM
1621the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
1622example in mail mode, use
1623
1624@lisp
1625(add-hook 'mail-mode-hook 'turn-on-orgtbl)
1626@end lisp
1627
1628Furthermore, with some special setup, it is possible to maintain tables
a7808fba 1629in arbitrary syntax with Orgtbl mode. For example, it is possible to
4009494e 1630construct La@TeX{} tables with the underlying ease and power of
a7808fba 1631Orgtbl mode, including spreadsheet capabilities. For details, see
4009494e
GM
1632@ref{Tables in arbitrary syntax}.
1633
a7808fba 1634@node The spreadsheet, , Orgtbl mode, Tables
4009494e
GM
1635@section The spreadsheet
1636@cindex calculations, in tables
1637@cindex spreadsheet capabilities
1638@cindex @file{calc} package
1639
1640The table editor makes use of the Emacs @file{calc} package to implement
1641spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to
a7808fba 1642derive fields from other fields. While fully featured, Org's
4009494e 1643implementation is not identical to other spreadsheets. For example,
a7808fba 1644Org knows the concept of a @emph{column formula} that will be
4009494e
GM
1645applied to all non-header fields in a column without having to copy the
1646formula to each relevant field.
1647
1648@menu
1649* References:: How to refer to another field or range
1650* Formula syntax for Calc:: Using Calc to compute stuff
1651* Formula syntax for Lisp:: Writing formulas in Emacs Lisp
1652* Field formulas:: Formulas valid for a single field
1653* Column formulas:: Formulas valid for an entire column
1654* Editing and debugging formulas:: Fixing formulas
1655* Updating the table:: Recomputing all dependent fields
1656* Advanced features:: Field names, parameters and automatic recalc
1657@end menu
1658
1659@node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
1660@subsection References
1661@cindex references
1662
1663To compute fields in the table from other fields, formulas must
a7808fba 1664reference other fields or ranges. In Org, fields can be referenced
4009494e
GM
1665by name, by absolute coordinates, and by relative coordinates. To find
1666out what the coordinates of a field are, press @kbd{C-c ?} in that
1667field, or press @kbd{C-c @}} to toggle the display of a grid.
1668
1669@subsubheading Field references
1670@cindex field references
1671@cindex references, to fields
1672
1673Formulas can reference the value of another field in two ways. Like in
1674any other spreadsheet, you may reference fields with a letter/number
1675combination like @code{B3}, meaning the 2nd field in the 3rd row.
1676@c Such references are always fixed to that field, they don't change
1677@c when you copy and paste a formula to a different field. So
a7808fba 1678@c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
4009494e
GM
1679
1680@noindent
a7808fba 1681Org also uses another, more general operator that looks like this:
4009494e
GM
1682@example
1683@@row$column
1684@end example
1685
1686@noindent
1687Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
1688or relative to the current column like @samp{+1} or @samp{-2}.
1689
1690The row specification only counts data lines and ignores horizontal
1691separator lines (hlines). You can use absolute row numbers
1692@samp{1}...@samp{N}, and row numbers relative to the current row like
1693@samp{+3} or @samp{-1}. Or specify the row relative to one of the
dbc28aaa
CD
1694hlines: @samp{I} refers to the first hline@footnote{Note that only
1695hlines are counted that @emph{separate} table lines. If the table
1696starts with a hline above the header, it does not count.}, @samp{II} to
1697the second etc. @samp{-I} refers to the first such line above the
1698current line, @samp{+I} to the first such line below the current line.
1699You can also write @samp{III+2} which is the second data line after the
1700third hline in the table. Relative row numbers like @samp{-3} will not
1701cross hlines if the current line is too close to the hline. Instead,
1702the value directly at the hline is used.
4009494e
GM
1703
1704@samp{0} refers to the current row and column. Also, if you omit
1705either the column or the row part of the reference, the current
28a16a1b 1706row/column is implied.
4009494e 1707
a7808fba 1708Org's references with @emph{unsigned} numbers are fixed references
4009494e
GM
1709in the sense that if you use the same reference in the formula for two
1710different fields, the same field will be referenced each time.
a7808fba 1711Org's references with @emph{signed} numbers are floating
4009494e
GM
1712references because the same reference operator can reference different
1713fields depending on the field being calculated by the formula.
1714
1715Here are a few examples:
1716
1717@example
1718@@2$3 @r{2nd row, 3rd column}
1719C2 @r{same as previous}
1720$5 @r{column 5 in the current row}
1721E& @r{same as previous}
1722@@2 @r{current column, row 2}
1723@@-1$-3 @r{the field one row up, three columns to the left}
1724@@-I$2 @r{field just under hline above current row, column 2}
1725@end example
1726
1727@subsubheading Range references
1728@cindex range references
1729@cindex references, to ranges
1730
1731You may reference a rectangular range of fields by specifying two field
1732references connected by two dots @samp{..}. If both fields are in the
1733current row, you may simply use @samp{$2..$7}, but if at least one field
1734is in a different row, you need to use the general @code{@@row$column}
1735format at least for the first field (i.e the reference must start with
1736@samp{@@} in order to be interpreted correctly). Examples:
1737
1738@example
1739$1..$3 @r{First three fields in the current row.}
1740$P..$Q @r{Range, using column names (see under Advanced)}
1741@@2$1..@@4$3 @r{6 fields between these two fields.}
1742A2..C4 @r{Same as above.}
1743@@-1$-2..@@-1 @r{3 numbers from the column to the left, 2 up to current row}
1744@end example
1745
1746@noindent Range references return a vector of values that can be fed
1747into Calc vector functions. Empty fields in ranges are normally
1748suppressed, so that the vector contains only the non-empty fields (but
1749see the @samp{E} mode switch below). If there are no non-empty fields,
1750@samp{[0]} is returned to avoid syntax errors in formulas.
1751
1752@subsubheading Named references
1753@cindex named references
1754@cindex references, named
1755@cindex name, of column or field
1756@cindex constants, in calculations
1757
1758@samp{$name} is interpreted as the name of a column, parameter or
1759constant. Constants are defined globally through the variable
1760@code{org-table-formula-constants}, and locally (for the file) through a
1761line like
1762
1763@example
1764#+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
1765@end example
1766
1767@noindent
a7808fba 1768Also properties (@pxref{Properties and Columns}) can be used as
dbc28aaa
CD
1769constants in table formulas: For a property @samp{:Xyz:} use the name
1770@samp{$PROP_Xyz}, and the property will be searched in the current
4009494e
GM
1771outline entry and in the hierarchy above it. If you have the
1772@file{constants.el} package, it will also be used to resolve constants,
1773including natural constants like @samp{$h} for Planck's constant, and
1774units like @samp{$km} for kilometers@footnote{@file{Constant.el} can
1775supply the values of constants in two different unit systems, @code{SI}
1776and @code{cgs}. Which one is used depends on the value of the variable
1777@code{constants-unit-system}. You can use the @code{#+STARTUP} options
1778@code{constSI} and @code{constcgs} to set this value for the current
1779buffer.}. Column names and parameters can be specified in special table
1780lines. These are described below, see @ref{Advanced features}. All
1781names must start with a letter, and further consist of letters and
1782numbers.
1783
1784@node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
1785@subsection Formula syntax for Calc
1786@cindex formula syntax, Calc
1787@cindex syntax, of formulas
1788
1789A formula can be any algebraic expression understood by the Emacs
1790@file{Calc} package. @b{Note that @file{calc} has the
1791non-standard convention that @samp{/} has lower precedence than
1792@samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before
1793evaluation by @code{calc-eval} (@pxref{Calling Calc from
a7808fba 1794Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
4009494e 1795Emacs Calc Manual}),
a7808fba 1796@c FIXME: The link to the Calc manual in HTML does not work.
4009494e
GM
1797variable substitution takes place according to the rules described above.
1798@cindex vectors, in table calculations
a7808fba 1799The range vectors can be directly fed into the Calc vector functions
4009494e
GM
1800like @samp{vmean} and @samp{vsum}.
1801
1802@cindex format specifier
1803@cindex mode, for @file{calc}
1804A formula can contain an optional mode string after a semicolon. This
1805string consists of flags to influence Calc and other modes during
a7808fba 1806execution. By default, Org uses the standard Calc modes (precision
4009494e
GM
180712, angular units degrees, fraction and symbolic modes off. The display
1808format, however, has been changed to @code{(float 5)} to keep tables
1809compact. The default settings can be configured using the variable
1810@code{org-calc-default-modes}.
1811
1812@example
1813p20 @r{switch the internal precision to 20 digits}
1814n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format}
1815D R @r{angle modes: degrees, radians}
1816F S @r{fraction and symbolic modes}
1817N @r{interpret all fields as numbers, use 0 for non-numbers}
1818T @r{force text interpretation}
1819E @r{keep empty fields in ranges}
1820@end example
1821
1822@noindent
1823In addition, you may provide a @code{printf} format specifier to
1824reformat the final result. A few examples:
1825
1826@example
1827$1+$2 @r{Sum of first and second field}
1828$1+$2;%.2f @r{Same, format result to two decimals}
1829exp($2)+exp($1) @r{Math functions can be used}
1830$0;%.1f @r{Reformat current cell to 1 decimal}
1831($3-32)*5/9 @r{Degrees F -> C conversion}
1832$c/$1/$cm @r{Hz -> cm conversion, using @file{constants.el}}
1833tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
1834sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
1835vmean($2..$7) @r{Compute column range mean, using vector function}
1836vmean($2..$7);EN @r{Same, but treat empty fields as 0}
1837taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
1838@end example
1839
1840Calc also contains a complete set of logical operations. For example
1841
1842@example
1843if($1<20,teen,string("")) @r{``teen'' if age $1 less than 20, else empty}
1844@end example
1845
1846@node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
1847@subsection Emacs Lisp forms as formulas
1848@cindex Lisp forms, as table formulas
1849
1850It is also possible to write a formula in Emacs Lisp; this can be useful
1851for string manipulation and control structures, if the Calc's
1852functionality is not enough. If a formula starts with a single quote
1853followed by an opening parenthesis, then it is evaluated as a lisp form.
1854The evaluation should return either a string or a number. Just as with
1855@file{calc} formulas, you can specify modes and a printf format after a
a7808fba 1856semicolon. With Emacs Lisp forms, you need to be conscious about the way
4009494e
GM
1857field references are interpolated into the form. By default, a
1858reference will be interpolated as a Lisp string (in double quotes)
1859containing the field. If you provide the @samp{N} mode switch, all
1860referenced elements will be numbers (non-number fields will be zero) and
1861interpolated as Lisp numbers, without quotes. If you provide the
1862@samp{L} flag, all fields will be interpolated literally, without quotes.
1863I.e., if you want a reference to be interpreted as a string by the Lisp
a7808fba 1864form, enclose the reference operator itself in double quotes, like
4009494e
GM
1865@code{"$3"}. Ranges are inserted as space-separated fields, so you can
1866embed them in list or vector syntax. A few examples, note how the
1867@samp{N} mode is used when we do computations in lisp.
1868
1869@example
1870@r{Swap the first two characters of the content of column 1}
1871 '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
1872@r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
1873 '(+ $1 $2);N
1874@r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
1875 '(apply '+ '($1..$4));N
1876@end example
1877
1878@node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
1879@subsection Field formulas
1880@cindex field formula
1881@cindex formula, for individual table field
1882
1883To assign a formula to a particular field, type it directly into the
1884field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you
1885press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
1886the field, the formula will be stored as the formula for this field,
1887evaluated, and the current field replaced with the result.
1888
1889Formulas are stored in a special line starting with @samp{#+TBLFM:}
1890directly below the table. If you typed the equation in the 4th field of
1891the 3rd data line in the table, the formula will look like
1892@samp{@@3$4=$1+$2}. When inserting/deleting/swapping column and rows
1893with the appropriate commands, @i{absolute references} (but not relative
1894ones) in stored formulas are modified in order to still reference the
1895same field. Of cause this is not true if you edit the table structure
1896with normal editing commands - then you must fix the equations yourself.
1897
1898Instead of typing an equation into the field, you may also use the
1899following command
1900
1901@table @kbd
1902@kindex C-u C-c =
1903@item C-u C-c =
1904Install a new formula for the current field. The command prompts for a
1905formula, with default taken from the @samp{#+TBLFM:} line, applies
1906it to the current field and stores it.
1907@end table
1908
1909@node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
1910@subsection Column formulas
1911@cindex column formula
1912@cindex formula, for table column
1913
1914Often in a table, the same formula should be used for all fields in a
1915particular column. Instead of having to copy the formula to all fields
a7808fba 1916in that column, Org allows to assign a single formula to an entire
4009494e
GM
1917column. If the table contains horizontal separator hlines, everything
1918before the first such line is considered part of the table @emph{header}
1919and will not be modified by column formulas.
1920
1921To assign a formula to a column, type it directly into any field in the
1922column, preceded by an equal sign, like @samp{=$1+$2}. When you press
1923@key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
1924field, the formula will be stored as the formula for the current column,
1925evaluated and the current field replaced with the result. If the field
1926contains only @samp{=}, the previously stored formula for this column is
a7808fba 1927used. For each column, Org will only remember the most recently
4009494e
GM
1928used formula. In the @samp{TBLFM:} line, column formulas will look like
1929@samp{$4=$1+$2}.
1930
1931Instead of typing an equation into the field, you may also use the
1932following command:
1933
1934@table @kbd
1935@kindex C-c =
1936@item C-c =
a7808fba
CD
1937Install a new formula for the current column and replace current field with
1938the result of the formula. The command prompts for a formula, with default
1939taken from the @samp{#+TBLFM} line, applies it to the current field and
1940stores it. With a numeric prefix argument(e.g. @kbd{C-5 C-c =}) the command
4009494e
GM
1941will apply it to that many consecutive fields in the current column.
1942@end table
1943
4009494e 1944@node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
a7808fba 1945@subsection Editing and debugging formulas
4009494e
GM
1946@cindex formula editing
1947@cindex editing, of table formulas
1948
1949You can edit individual formulas in the minibuffer or directly in the
a7808fba
CD
1950field. Org can also prepare a special buffer with all active
1951formulas of a table. When offering a formula for editing, Org
4009494e
GM
1952converts references to the standard format (like @code{B3} or @code{D&})
1953if possible. If you prefer to only work with the internal format (like
1954@code{@@3$2} or @code{$4}), configure the variable
1955@code{org-table-use-standard-references}.
1956
1957@table @kbd
1958@kindex C-c =
1959@kindex C-u C-c =
1960@item C-c =
1961@itemx C-u C-c =
1962Edit the formula associated with the current column/field in the
1963minibuffer. See @ref{Column formulas} and @ref{Field formulas}.
1964@kindex C-u C-u C-c =
1965@item C-u C-u C-c =
1966Re-insert the active formula (either a
1967field formula, or a column formula) into the current field, so that you
1968can edit it directly in the field. The advantage over editing in the
1969minibuffer is that you can use the command @kbd{C-c ?}.
1970@kindex C-c ?
1971@item C-c ?
1972While editing a formula in a table field, highlight the field(s)
1973referenced by the reference at the cursor position in the formula.
1974@kindex C-c @}
1975@item C-c @}
1976Toggle the display of row and column numbers for a table, using
1977overlays. These are updated each time the table is aligned, you can
1978force it with @kbd{C-c C-c}.
1979@kindex C-c @{
1980@item C-c @{
1981Toggle the formula debugger on and off. See below.
1982@kindex C-c '
1983@item C-c '
1984Edit all formulas for the current table in a special buffer, where the
1985formulas will be displayed one per line. If the current field has an
1986active formula, the cursor in the formula editor will mark it.
a7808fba 1987While inside the special buffer, Org will automatically highlight
4009494e
GM
1988any field or range reference at the cursor position. You may edit,
1989remove and add formulas, and use the following commands:
1990@table @kbd
1991@kindex C-c C-c
1992@kindex C-x C-s
1993@item C-c C-c
1994@itemx C-x C-s
1995Exit the formula editor and store the modified formulas. With @kbd{C-u}
1996prefix, also apply the new formulas to the entire table.
1997@kindex C-c C-q
1998@item C-c C-q
1999Exit the formula editor without installing changes.
2000@kindex C-c C-r
2001@item C-c C-r
2002Toggle all references in the formula editor between standard (like
2003@code{B3}) and internal (like @code{@@3$2}).
2004@kindex @key{TAB}
2005@item @key{TAB}
2006Pretty-print or indent lisp formula at point. When in a line containing
2007a lisp formula, format the formula according to Emacs Lisp rules.
2008Another @key{TAB} collapses the formula back again. In the open
a7808fba 2009formula, @key{TAB} re-indents just like in Emacs lisp mode.
4009494e
GM
2010@kindex M-@key{TAB}
2011@item M-@key{TAB}
a7808fba 2012Complete Lisp symbols, just like in Emacs lisp mode.
4009494e
GM
2013@kindex S-@key{up}
2014@kindex S-@key{down}
2015@kindex S-@key{left}
2016@kindex S-@key{right}
2017@item S-@key{up}/@key{down}/@key{left}/@key{right}
2018Shift the reference at point. For example, if the reference is
2019@code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
2020This also works for relative references, and for hline references.
2021@kindex M-S-@key{up}
2022@kindex M-S-@key{down}
2023@item M-S-@key{up}/@key{down}
a7808fba 2024Move the test line for column formulas in the Org buffer up and
4009494e
GM
2025down.
2026@kindex M-@key{up}
2027@kindex M-@key{down}
2028@item M-@key{up}/@key{down}
2029Scroll the window displaying the table.
2030@kindex C-c @}
2031@item C-c @}
2032Turn the coordinate grid in the table on and off.
2033@end table
2034@end table
2035
2036Making a table field blank does not remove the formula associated with
2037the field, because that is stored in a different line (the @samp{TBLFM}
2038line) - during the next recalculation the field will be filled again.
2039To remove a formula from a field, you have to give an empty reply when
2040prompted for the formula, or to edit the @samp{#+TBLFM} line.
2041
2042@kindex C-c C-c
2043You may edit the @samp{#+TBLFM} directly and re-apply the changed
2044equations with @kbd{C-c C-c} in that line, or with the normal
2045recalculation commands in the table.
2046
2047@subsubheading Debugging formulas
2048@cindex formula debugging
2049@cindex debugging, of table formulas
2050When the evaluation of a formula leads to an error, the field content
2051becomes the string @samp{#ERROR}. If you would like see what is going
2052on during variable substitution and calculation in order to find a bug,
2053turn on formula debugging in the @code{Tbl} menu and repeat the
2054calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
2055field. Detailed information will be displayed.
2056
2057@node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
a7808fba 2058@subsection Updating the table
4009494e
GM
2059@cindex recomputing table fields
2060@cindex updating, table
2061
2062Recalculation of a table is normally not automatic, but needs to be
2063triggered by a command. See @ref{Advanced features} for a way to make
2064recalculation at least semi-automatically.
2065
2066In order to recalculate a line of a table or the entire table, use the
2067following commands:
2068
2069@table @kbd
2070@kindex C-c *
2071@item C-c *
2072Recalculate the current row by first applying the stored column formulas
2073from left to right, and all field formulas in the current row.
2074@c
2075@kindex C-u C-c *
2076@item C-u C-c *
2077@kindex C-u C-c C-c
2078@itemx C-u C-c C-c
2079Recompute the entire table, line by line. Any lines before the first
2080hline are left alone, assuming that these are part of the table header.
2081@c
2082@kindex C-u C-u C-c *
2083@kindex C-u C-u C-c C-c
2084@item C-u C-u C-c *
2085@itemx C-u C-u C-c C-c
2086Iterate the table by recomputing it until no further changes occur.
2087This may be necessary if some computed fields use the value of other
2088fields that are computed @i{later} in the calculation sequence.
2089@end table
2090
2091@node Advanced features, , Updating the table, The spreadsheet
2092@subsection Advanced features
2093
2094If you want the recalculation of fields to happen automatically, or if
2095you want to be able to assign @i{names} to fields and columns, you need
2096to reserve the first column of the table for special marking characters.
2097@table @kbd
2098@kindex C-#
2099@item C-#
2100Rotate the calculation mark in first column through the states @samp{},
2101@samp{#}, @samp{*}, @samp{!}, @samp{$}. The meaning of these characters
2102is discussed below. When there is an active region, change all marks in
2103the region.
2104@end table
2105
2106Here is an example of a table that collects exam results of students and
2107makes use of these features:
2108
2109@example
2110@group
2111|---+---------+--------+--------+--------+-------+------|
2112| | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2113|---+---------+--------+--------+--------+-------+------|
2114| ! | | P1 | P2 | P3 | Tot | |
2115| # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
2116| ^ | | m1 | m2 | m3 | mt | |
2117|---+---------+--------+--------+--------+-------+------|
2118| # | Peter | 10 | 8 | 23 | 41 | 8.2 |
2119| # | Sara | 6 | 14 | 19 | 39 | 7.8 |
2120| # | Sam | 2 | 4 | 3 | 9 | 1.8 |
2121|---+---------+--------+--------+--------+-------+------|
2122| | Average | | | | 29.7 | |
2123| ^ | | | | | at | |
2124| $ | max=50 | | | | | |
2125|---+---------+--------+--------+--------+-------+------|
2126#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
2127@end group
2128@end example
2129
2130@noindent @b{Important}: Please note that for these special tables,
2131recalculating the table with @kbd{C-u C-c *} will only affect rows that
2132are marked @samp{#} or @samp{*}, and fields that have a formula assigned
2133to the field itself. The column formulas are not applied in rows with
2134empty first field.
2135
2136@cindex marking characters, tables
2137The marking characters have the following meaning:
2138@table @samp
2139@item !
2140The fields in this line define names for the columns, so that you may
2141refer to a column as @samp{$Tot} instead of @samp{$6}.
2142@item ^
2143This row defines names for the fields @emph{above} the row. With such
2144a definition, any formula in the table may use @samp{$m1} to refer to
2145the value @samp{10}. Also, if you assign a formula to a names field, it
2146will be stored as @samp{$name=...}.
2147@item _
2148Similar to @samp{^}, but defines names for the fields in the row
2149@emph{below}.
2150@item $
2151Fields in this row can define @emph{parameters} for formulas. For
2152example, if a field in a @samp{$} row contains @samp{max=50}, then
2153formulas in this table can refer to the value 50 using @samp{$max}.
2154Parameters work exactly like constants, only that they can be defined on
2155a per-table basis.
2156@item #
2157Fields in this row are automatically recalculated when pressing
2158@key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
2159is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
2160lines will be left alone by this command.
2161@item *
2162Selects this line for global recalculation with @kbd{C-u C-c *}, but
2163not for automatic recalculation. Use this when automatic
2164recalculation slows down editing too much.
2165@item
2166Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
2167All lines that should be recalculated should be marked with @samp{#}
2168or @samp{*}.
2169@item /
2170Do not export this line. Useful for lines that contain the narrowing
2171@samp{<N>} markers.
2172@end table
2173
2174Finally, just to whet your appetite on what can be done with the
2175fantastic @file{calc} package, here is a table that computes the Taylor
28a16a1b
CD
2176series of degree @code{n} at location @code{x} for a couple of
2177functions.
4009494e
GM
2178
2179@example
2180@group
2181|---+-------------+---+-----+--------------------------------------|
2182| | Func | n | x | Result |
2183|---+-------------+---+-----+--------------------------------------|
2184| # | exp(x) | 1 | x | 1 + x |
2185| # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
2186| # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
2187| # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2188| # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
2189| * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
2190|---+-------------+---+-----+--------------------------------------|
2191#+TBLFM: $5=taylor($2,$4,$3);n3
2192@end group
2193@end example
2194
a7808fba 2195@node Hyperlinks, TODO Items, Tables, Top
4009494e
GM
2196@chapter Hyperlinks
2197@cindex hyperlinks
2198
a7808fba 2199Like HTML, Org provides links inside a file, external links to
dbc28aaa 2200other files, Usenet articles, emails, and much more.
4009494e
GM
2201
2202@menu
a7808fba 2203* Link format:: How links in Org are formatted
4009494e
GM
2204* Internal links:: Links to other places in the current file
2205* External links:: URL-like links to the world
2206* Handling links:: Creating, inserting and following
a7808fba 2207* Using links outside Org:: Linking from my C source code?
4009494e
GM
2208* Link abbreviations:: Shortcuts for writing complex links
2209* Search options:: Linking to a specific location
2210* Custom searches:: When the default search is not enough
4009494e
GM
2211@end menu
2212
2213@node Link format, Internal links, Hyperlinks, Hyperlinks
2214@section Link format
2215@cindex link format
2216@cindex format, of links
2217
a7808fba 2218Org will recognize plain URL-like links and activate them as
4009494e
GM
2219clickable links. The general link format, however, looks like this:
2220
2221@example
28a16a1b 2222[[link][description]] @r{or alternatively} [[link]]
4009494e
GM
2223@end example
2224
a7808fba 2225Once a link in the buffer is complete (all brackets present), Org
4009494e
GM
2226will change the display so that @samp{description} is displayed instead
2227of @samp{[[link][description]]} and @samp{link} is displayed instead of
2228@samp{[[link]]}. Links will be highlighted in the face @code{org-link},
2229which by default is an underlined face. You can directly edit the
2230visible part of a link. Note that this can be either the @samp{link}
2231part (if there is no description) or the @samp{description} part. To
2232edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
2233cursor on the link.
2234
2235If you place the cursor at the beginning or just behind the end of the
2236displayed text and press @key{BACKSPACE}, you will remove the
2237(invisible) bracket at that location. This makes the link incomplete
2238and the internals are again displayed as plain text. Inserting the
2239missing bracket hides the link internals again. To show the
2240internal structure of all links, use the menu entry
2241@code{Org->Hyperlinks->Literal links}.
2242
2243@node Internal links, External links, Link format, Hyperlinks
2244@section Internal links
2245@cindex internal links
2246@cindex links, internal
2247@cindex targets, for links
2248
2249If the link does not look like a URL, it is considered to be internal in
2250the current file. Links such as @samp{[[My Target]]} or @samp{[[My
2251Target][Find my target]]} lead to a text search in the current file.
2252The link can be followed with @kbd{C-c C-o} when the cursor is on the
2253link, or with a mouse click (@pxref{Handling links}). The preferred
2254match for such a link is a dedicated target: the same string in double
2255angular brackets. Targets may be located anywhere; sometimes it is
2256convenient to put them into a comment line. For example
2257
2258@example
2259# <<My Target>>
2260@end example
2261
2262@noindent In HTML export (@pxref{HTML export}), such targets will become
2263named anchors for direct access through @samp{http} links@footnote{Note
2264that text before the first headline is usually not exported, so the
2265first such target should be after the first headline.}.
2266
a7808fba 2267If no dedicated target exists, Org will search for the words in the
4009494e
GM
2268link. In the above example the search would be for @samp{my target}.
2269Links starting with a star like @samp{*My Target} restrict the search to
a7808fba 2270headlines. When searching, Org mode will first try an exact match, but
4009494e
GM
2271then move on to more and more lenient searches. For example, the link
2272@samp{[[*My Targets]]} will find any of the following:
2273
2274@example
2275** My targets
2276** TODO my targets are bright
2277** my 20 targets are
2278@end example
2279
2280To insert a link targeting a headline, in-buffer completion can be used.
2281Just type a star followed by a few optional letters into the buffer and
2282press @kbd{M-@key{TAB}}. All headlines in the current buffer will be
2283offered as completions. @xref{Handling links}, for more commands
2284creating links.
2285
a7808fba 2286Following a link pushes a mark onto Org's own mark ring. You can
4009494e
GM
2287return to the previous position with @kbd{C-c &}. Using this command
2288several times in direct succession goes back to positions recorded
2289earlier.
2290
2291@menu
a7808fba 2292* Radio targets:: Make targets trigger links in plain text
4009494e
GM
2293@end menu
2294
2295@node Radio targets, , Internal links, Internal links
2296@subsection Radio targets
2297@cindex radio targets
2298@cindex targets, radio
2299@cindex links, radio targets
2300
a7808fba 2301Org can automatically turn any occurrences of certain target names
4009494e
GM
2302in normal text into a link. So without explicitly creating a link, the
2303text connects to the target radioing its position. Radio targets are
2304enclosed by triple angular brackets. For example, a target @samp{<<<My
2305Target>>>} causes each occurrence of @samp{my target} in normal text to
a7808fba 2306become activated as a link. The Org file is scanned automatically
4009494e
GM
2307for radio targets only when the file is first loaded into Emacs. To
2308update the target list during editing, press @kbd{C-c C-c} with the
2309cursor on or at a target.
2310
2311@node External links, Handling links, Internal links, Hyperlinks
2312@section External links
2313@cindex links, external
2314@cindex external links
2315@cindex links, external
a7808fba 2316@cindex Gnus links
4009494e 2317@cindex BBDB links
28a16a1b 2318@cindex IRC links
4009494e
GM
2319@cindex URL links
2320@cindex file links
2321@cindex VM links
2322@cindex RMAIL links
2323@cindex WANDERLUST links
2324@cindex MH-E links
2325@cindex USENET links
2326@cindex SHELL links
2327@cindex Info links
2328@cindex elisp links
2329
a7808fba 2330Org supports links to files, websites, Usenet and email messages,
28a16a1b
CD
2331BBDB database entries and links to both IRC conversations and their
2332logs. External links are URL-like locators. They start with a short
2333identifying string followed by a colon. There can be no space after
2334the colon. The following list shows examples for each link type.
4009494e
GM
2335
2336@example
a7808fba 2337http://www.astro.uva.nl/~dominik @r{on the web}
4009494e
GM
2338file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
2339file:papers/last.pdf @r{file, relative path}
2340news:comp.emacs @r{Usenet link}
28a16a1b 2341mailto:adent@@galaxy.net @r{Mail link}
4009494e
GM
2342vm:folder @r{VM folder link}
2343vm:folder#id @r{VM message link}
28a16a1b 2344vm://myself@@some.where.org/folder#id @r{VM on remote machine}
4009494e
GM
2345wl:folder @r{WANDERLUST folder link}
2346wl:folder#id @r{WANDERLUST message link}
2347mhe:folder @r{MH-E folder link}
2348mhe:folder#id @r{MH-E message link}
2349rmail:folder @r{RMAIL folder link}
2350rmail:folder#id @r{RMAIL message link}
a7808fba
CD
2351gnus:group @r{Gnus group link}
2352gnus:group#id @r{Gnus article link}
4009494e 2353bbdb:Richard Stallman @r{BBDB link}
28a16a1b 2354irc:/irc.com/#emacs/bob @r{IRC link}
4009494e
GM
2355shell:ls *.org @r{A shell command}
2356elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
2357@end example
2358
2359A link should be enclosed in double brackets and may contain a
a7808fba 2360descriptive text to be displayed instead of the URL (@pxref{Link
4009494e
GM
2361format}), for example:
2362
2363@example
2364[[http://www.gnu.org/software/emacs/][GNU Emacs]]
2365@end example
2366
2367@noindent
2368If the description is a file name or URL that points to an image, HTML
2369export (@pxref{HTML export}) will inline the image as a clickable
2370button. If there is no description at all and the link points to an
2371image,
2372that image will be inlined into the exported HTML file.
2373
2374@cindex angular brackets, around links
2375@cindex plain text external links
a7808fba 2376Org also finds external links in the normal text and activates them
4009494e
GM
2377as links. If spaces must be part of the link (for example in
2378@samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
2379about the end of the link, enclose them in angular brackets.
2380
a7808fba 2381@node Handling links, Using links outside Org, External links, Hyperlinks
4009494e
GM
2382@section Handling links
2383@cindex links, handling
2384
a7808fba
CD
2385Org provides methods to create a link in the correct syntax, to
2386insert it into an Org file, and to follow the link.
4009494e
GM
2387
2388@table @kbd
2389@kindex C-c l
2390@cindex storing links
2391@item C-c l
2392Store a link to the current location. This is a @emph{global} command
2393which can be used in any buffer to create a link. The link will be
a7808fba
CD
2394stored for later insertion into an Org buffer (see below). For
2395Org files, if there is a @samp{<<target>>} at the cursor, the
28a16a1b 2396link points to the target. Otherwise it points to the current
a7808fba 2397headline. For VM, Rmail, Wanderlust, MH-E, Gnus and BBDB buffers, the
28a16a1b
CD
2398link will indicate the current article/entry. For W3 and W3M buffers,
2399the link goes to the current URL. For IRC links, if you set the
2400variable @code{org-irc-link-to-logs} to non-nil then @kbd{C-c l} will
2401store a @samp{file:/} style link to the relevant point in the logs for
2402the current conversation. Otherwise an @samp{irc:/} style link to the
2403user/channel/server under the point will be stored. For any other
2404files, the link will point to the file, with a search string
2405(@pxref{Search options}) pointing to the contents of the current line.
2406If there is an active region, the selected words will form the basis
2407of the search string. If the automatically created link is not
2408working correctly or accurately enough, you can write custom functions
2409to select the search string and to do the search for particular file
2410types - see @ref{Custom searches}. The key binding @kbd{C-c l} is
2411only a suggestion - see @ref{Installation}.
4009494e
GM
2412@c
2413@kindex C-c C-l
2414@cindex link completion
2415@cindex completion, of links
2416@cindex inserting links
2417@item C-c C-l
a7808fba
CD
2418Insert a link. This prompts for a link to be inserted into the buffer. You
2419can just type a link, using text for an internal link, or one of the link
2420type prefixes mentioned in the examples above. All links stored during the
2421current session are part of the history for this prompt, so you can access
2422them with @key{up} and @key{down} (or @kbd{M-p/n}). Completion, on the other
2423hand, will help you to insert valid link prefixes like @samp{http:} or
2424@samp{ftp:}, including the prefixes defined through link abbreviations
2425(@pxref{Link abbreviations}). The link will be inserted into the
2426buffer@footnote{After insertion of a stored link, the link will be removed
2427from the list of stored links. To keep it in the list later use, use a
2428triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
2429@code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
2430If some text was selected when this command is called, the selected text
2431becomes the default description.@* Note that you don't have to use this
2432command to insert a link. Links in Org are plain text, and you can type
2433or paste them straight into the buffer. By using this command, the links are
2434automatically enclosed in double brackets, and you will be asked for the
2435optional descriptive text.
4009494e
GM
2436@c
2437@c If the link is a @samp{file:} link and
2438@c the linked file is located in the same directory as the current file or
2439@c a subdirectory of it, the path of the file will be inserted relative to
2440@c the current directory.
2441@c
2442@kindex C-u C-c C-l
2443@cindex file name completion
2444@cindex completion, of file names
2445@item C-u C-c C-l
2446When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
2447a file will be inserted and you may use file name completion to select
2448the name of the file. The path to the file is inserted relative to the
2449directory of the current org file, if the linked file is in the current
a7808fba 2450directory or in a sub-directory of it, or if the path is written relative
4009494e
GM
2451to the current directory using @samp{../}. Otherwise an absolute path
2452is used, if possible with @samp{~/} for your home directory. You can
2453force an absolute path with two @kbd{C-u} prefixes.
2454@c
2455@item C-c C-l @r{(with cursor on existing link)}
2456When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
2457link and description parts of the link.
2458@c
2459@cindex following links
2460@kindex C-c C-o
2461@item C-c C-o
2462Open link at point. This will launch a web browser for URLs (using
a7808fba 2463@command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
4009494e
GM
2464for the corresponding links, and execute the command in a shell link.
2465When the cursor is on an internal link, this commands runs the
2466corresponding search. When the cursor is on a TAG list in a headline,
2467it creates the corresponding TAGS view. If the cursor is on a time
2468stamp, it compiles the agenda for that date. Furthermore, it will visit
2469text and remote files in @samp{file:} links with Emacs and select a
2470suitable application for local non-text files. Classification of files
2471is based on file extension only. See option @code{org-file-apps}. If
2472you want to override the default application and visit the file with
2473Emacs, use a @kbd{C-u} prefix.
2474@c
2475@kindex mouse-2
2476@kindex mouse-1
2477@item mouse-2
2478@itemx mouse-1
2479On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
2480would. Under Emacs 22, also @kbd{mouse-1} will follow a link.
2481@c
2482@kindex mouse-3
2483@item mouse-3
2484Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
2485internal links to be displayed in another window@footnote{See the
2486variable @code{org-display-internal-link-with-indirect-buffer}}.
2487@c
2488@cindex mark ring
2489@kindex C-c %
2490@item C-c %
2491Push the current position onto the mark ring, to be able to return
2492easily. Commands following an internal link do this automatically.
2493@c
2494@cindex links, returning to
2495@kindex C-c &
2496@item C-c &
2497Jump back to a recorded position. A position is recorded by the
2498commands following internal links, and by @kbd{C-c %}. Using this
2499command several times in direct succession moves through a ring of
2500previously recorded positions.
2501@c
2502@kindex C-c C-x C-n
2503@kindex C-c C-x C-p
2504@cindex links, finding next/previous
2505@item C-c C-x C-n
2506@itemx C-c C-x C-p
2507Move forward/backward to the next link in the buffer. At the limit of
2508the buffer, the search fails once, and then wraps around. The key
2509bindings for this are really too long, you might want to bind this also
2510to @kbd{C-n} and @kbd{C-p}
2511@lisp
2512(add-hook 'org-load-hook
2513 (lambda ()
2514 (define-key 'org-mode-map "\C-n" 'org-next-link)
2515 (define-key 'org-mode-map "\C-p" 'org-previous-link)))
2516@end lisp
2517@end table
2518
a7808fba
CD
2519@node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
2520@section Using links outside Org
4009494e 2521
a7808fba
CD
2522You can insert and follow links that have Org syntax not only in
2523Org, but in any Emacs buffer. For this, you should create two
4009494e
GM
2524global commands, like this (please select suitable global keys
2525yourself):
2526
2527@lisp
2528(global-set-key "\C-c L" 'org-insert-link-global)
2529(global-set-key "\C-c o" 'org-open-at-point-global)
2530@end lisp
2531
a7808fba 2532@node Link abbreviations, Search options, Using links outside Org, Hyperlinks
4009494e
GM
2533@section Link abbreviations
2534@cindex link abbreviations
2535@cindex abbreviation, links
2536
2537Long URLs can be cumbersome to type, and often many similar links are
2538needed in a document. For this you can use link abbreviations. An
2539abbreviated link looks like this
2540
2541@example
2542[[linkword:tag][description]]
2543@end example
2544
2545@noindent
2546where the tag is optional. Such abbreviations are resolved according to
2547the information in the variable @code{org-link-abbrev-alist} that
2548relates the linkwords to replacement text. Here is an example:
2549
2550@lisp
2551@group
2552(setq org-link-abbrev-alist
2553 '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
2554 ("google" . "http://www.google.com/search?q=")
2555 ("ads" . "http://adsabs.harvard.edu/cgi-bin/
2556 nph-abs_connect?author=%s&db_key=AST")))
2557@end group
2558@end lisp
2559
2560If the replacement text contains the string @samp{%s}, it will be
2561replaced with the tag. Otherwise the tag will be appended to the string
2562in order to create the link. You may also specify a function that will
2563be called with the tag as the only argument to create the link.
2564
2565With the above setting, you could link to a specific bug with
2566@code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
a7808fba 2567@code{[[google:OrgMode]]} and find out what the Org author is
4009494e
GM
2568doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
2569
a7808fba 2570If you need special abbreviations just for a single Org buffer, you
4009494e
GM
2571can define them in the file with
2572
2573@example
2574#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
2575#+LINK: google http://www.google.com/search?q=%s
2576@end example
2577
2578@noindent
2579In-buffer completion @pxref{Completion} can be used after @samp{[} to
2580complete link abbreviations.
2581
2582@node Search options, Custom searches, Link abbreviations, Hyperlinks
2583@section Search options in file links
2584@cindex search option in file links
2585@cindex file links, searching
2586
2587File links can contain additional information to make Emacs jump to a
2588particular location in the file when following a link. This can be a
2589line number or a search option after a double@footnote{For backward
2590compatibility, line numbers can also follow a single colon.} colon. For
2591example, when the command @kbd{C-c l} creates a link (@pxref{Handling
2592links}) to a file, it encodes the words in the current line as a search
2593string that can be used to find this line back later when following the
28a16a1b 2594link with @kbd{C-c C-o}.
4009494e
GM
2595
2596Here is the syntax of the different ways to attach a search to a file
2597link, together with an explanation:
2598
2599@example
2600[[file:~/code/main.c::255]]
2601[[file:~/xx.org::My Target]]
2602[[file:~/xx.org::*My Target]]
2603[[file:~/xx.org::/regexp/]]
2604@end example
2605
2606@table @code
2607@item 255
2608Jump to line 255.
2609@item My Target
2610Search for a link target @samp{<<My Target>>}, or do a text search for
2611@samp{my target}, similar to the search in internal links, see
2612@ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
2613link will become an HTML reference to the corresponding named anchor in
2614the linked file.
2615@item *My Target
a7808fba 2616In an Org file, restrict search to headlines.
4009494e
GM
2617@item /regexp/
2618Do a regular expression search for @code{regexp}. This uses the Emacs
2619command @code{occur} to list all matches in a separate window. If the
a7808fba 2620target file is in Org mode, @code{org-occur} is used to create a
4009494e
GM
2621sparse tree with the matches.
2622@c If the target file is a directory,
2623@c @code{grep} will be used to search all files in the directory.
2624@end table
2625
2626As a degenerate case, a file link with an empty file name can be used
2627to search the current file. For example, @code{[[file:::find me]]} does
2628a search for @samp{find me} in the current file, just as
2629@samp{[[find me]]} would.
2630
dbc28aaa 2631@node Custom searches, , Search options, Hyperlinks
4009494e
GM
2632@section Custom Searches
2633@cindex custom search strings
2634@cindex search strings, custom
2635
2636The default mechanism for creating search strings and for doing the
2637actual search related to a file link may not work correctly in all
2638cases. For example, BibTeX database files have many entries like
2639@samp{year="1993"} which would not result in good search strings,
2640because the only unique identification for a BibTeX entry is the
2641citation key.
2642
2643If you come across such a problem, you can write custom functions to set
2644the right search string for a particular file type, and to do the search
2645for the string in the file. Using @code{add-hook}, these functions need
2646to be added to the hook variables
2647@code{org-create-file-search-functions} and
2648@code{org-execute-file-search-functions}. See the docstring for these
a7808fba 2649variables for more information. Org actually uses this mechanism
4009494e
GM
2650for Bib@TeX{} database files, and you can use the corresponding code as
2651an implementation example. Search for @samp{BibTeX links} in the source
2652file.
2653
2654
4009494e 2655
a7808fba
CD
2656@node TODO Items, Tags, Hyperlinks, Top
2657@chapter TODO Items
4009494e
GM
2658@cindex TODO items
2659
a7808fba 2660Org mode does not maintain TODO lists as separate documents. Instead,
dbc28aaa 2661TODO items are an integral part of the notes file, because TODO items
a7808fba 2662usually come up while taking notes! With Org mode, simply mark any
dbc28aaa
CD
2663entry in a tree as being a TODO item. In this way, information is not
2664duplicated, and the entire context from which the TODO item emerged is
2665always present.
4009494e 2666
dbc28aaa 2667Of course, this technique for managing TODO items scatters them
a7808fba 2668throughout your notes file. Org mode compensates for this by providing
dbc28aaa 2669methods to give you an overview of all the things that you have to do.
4009494e
GM
2670
2671@menu
2672* TODO basics:: Marking and displaying TODO entries
2673* TODO extensions:: Workflow and assignments
dbc28aaa 2674* Progress logging:: Dates and notes for progress
4009494e
GM
2675* Priorities:: Some things are more important than others
2676* Breaking down tasks:: Splitting a task into manageable pieces
2677* Checkboxes:: Tick-off lists
2678@end menu
2679
a7808fba 2680@node TODO basics, TODO extensions, TODO Items, TODO Items
4009494e
GM
2681@section Basic TODO functionality
2682
dbc28aaa
CD
2683Any headline becomes a TODO item when it starts with the word
2684@samp{TODO}, for example:
4009494e
GM
2685
2686@example
2687*** TODO Write letter to Sam Fortune
2688@end example
2689
2690@noindent
2691The most important commands to work with TODO entries are:
2692
2693@table @kbd
2694@kindex C-c C-t
2695@cindex cycling, of TODO states
2696@item C-c C-t
2697Rotate the TODO state of the current item among
2698
2699@example
2700,-> (unmarked) -> TODO -> DONE --.
2701'--------------------------------'
2702@end example
2703
2704The same rotation can also be done ``remotely'' from the timeline and
2705agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
dbc28aaa
CD
2706
2707@kindex C-u C-c C-t
2708@item C-u C-c C-t
2709Select a specific keyword using completion or (if it has been set up)
28a16a1b
CD
2710the fast selection interface. For the latter, you need to assign keys
2711to TODO states, see @ref{Per-file keywords} and @ref{Setting tags} for
2712more information.
dbc28aaa 2713
4009494e
GM
2714@kindex S-@key{right}
2715@kindex S-@key{left}
2716@item S-@key{right}
2717@itemx S-@key{left}
dbc28aaa
CD
2718Select the following/preceding TODO state, similar to cycling. Useful
2719mostly if more than two TODO states are possible (@pxref{TODO
4009494e 2720extensions}).
4009494e 2721@kindex C-c C-v
dbc28aaa 2722@kindex C-c / t
4009494e
GM
2723@cindex sparse tree, for TODO
2724@item C-c C-v
dbc28aaa 2725@itemx C-c / t
4009494e
GM
2726View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds
2727the entire buffer, but shows all TODO items and the headings hierarchy
a7808fba 2728above them. With a prefix argument, search for a specific TODO. You will be
4009494e 2729prompted for the keyword, and you can also give a list of keywords like
a7808fba 2730@code{KWD1|KWD2|...}. With numeric prefix argument N, show the tree for the
4009494e 2731Nth keyword in the variable @code{org-todo-keywords}. With two prefix
a7808fba 2732arguments, find all TODO and DONE entries.
4009494e
GM
2733@kindex C-c a t
2734@item C-c a t
dbc28aaa 2735Show the global TODO list. Collects the TODO items from all agenda
a7808fba 2736files (@pxref{Agenda Views}) into a single buffer. The new buffer will
dbc28aaa
CD
2737be in @code{agenda-mode}, which provides commands to examine and
2738manipulate the TODO entries from the new buffer (@pxref{Agenda
2739commands}). @xref{Global TODO list}, for more information.
4009494e
GM
2740@kindex S-M-@key{RET}
2741@item S-M-@key{RET}
2742Insert a new TODO entry below the current one.
2743@end table
2744
a7808fba 2745@node TODO extensions, Progress logging, TODO basics, TODO Items
4009494e
GM
2746@section Extended use of TODO keywords
2747@cindex extended TODO keywords
2748
dbc28aaa 2749By default, marked TODO entries have one of only two states: TODO and
a7808fba 2750DONE. Org mode allows you to classify TODO items in more complex ways
dbc28aaa
CD
2751with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With
2752special setup, the TODO keyword system can work differently in different
2753files.
4009494e
GM
2754
2755Note that @i{tags} are another way to classify headlines in general and
2756TODO items in particular (@pxref{Tags}).
2757
2758@menu
2759* Workflow states:: From TODO to DONE in steps
dbc28aaa 2760* TODO types:: I do this, Fred does the rest
4009494e 2761* Multiple sets in one file:: Mixing it all, and still finding your way
dbc28aaa
CD
2762* Fast access to TODO states:: Single letter selection of a state
2763* Per-file keywords:: Different files, different requirements
2764* Faces for TODO keywords:: Highlighting states
4009494e
GM
2765@end menu
2766
2767@node Workflow states, TODO types, TODO extensions, TODO extensions
2768@subsection TODO keywords as workflow states
2769@cindex TODO workflow
2770@cindex workflow states as TODO keywords
2771
2772You can use TODO keywords to indicate different @emph{sequential} states
2773in the process of working on an item, for example@footnote{Changing
a7808fba 2774this variable only becomes effective after restarting Org mode in a
4009494e
GM
2775buffer.}:
2776
2777@lisp
2778(setq org-todo-keywords
2779 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
2780@end lisp
2781
2782The vertical bar separates the TODO keywords (states that @emph{need
2783action}) from the DONE states (which need @emph{no further action}. If
2784you don't provide the separator bar, the last state is used as the DONE
2785state.
2786@cindex completion, of TODO keywords
2787With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
2788to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. You may
a7808fba 2789also use a numeric prefix argument to quickly select a specific state. For
4009494e 2790example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
28a16a1b
CD
2791Or you can use @kbd{S-left} to go backward through the sequence. If you
2792define many keywords, you can use in-buffer completion
2793(@pxref{Completion}) or even a special one-key selection scheme
2794(@pxref{Fast access to TODO states}) to insert these words into the
a7808fba 2795buffer. Changing a TODO state can be logged with a timestamp, see
28a16a1b 2796@ref{Tracking TODO state changes} for more information.
4009494e
GM
2797
2798@node TODO types, Multiple sets in one file, Workflow states, TODO extensions
2799@subsection TODO keywords as types
2800@cindex TODO types
2801@cindex names as TODO keywords
2802@cindex types as TODO keywords
2803
2804The second possibility is to use TODO keywords to indicate different
2805@emph{types} of action items. For example, you might want to indicate
2806that items are for ``work'' or ``home''. Or, when you work with several
2807people on a single project, you might want to assign action items
2808directly to persons, by using their names as TODO keywords. This would
2809be set up like this:
2810
2811@lisp
2812(setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
2813@end lisp
2814
2815In this case, different keywords do not indicate a sequence, but rather
2816different types. So the normal work flow would be to assign a task to a
a7808fba
CD
2817person, and later to mark it DONE. Org mode supports this style by adapting
2818the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
2819@kbd{t} command in the timeline and agenda buffers.}. When used several
2820times in succession, it will still cycle through all names, in order to first
2821select the right type for a task. But when you return to the item after some
2822time and execute @kbd{C-c C-t} again, it will switch from any name directly
2823to DONE. Use prefix arguments or completion to quickly select a specific
2824name. You can also review the items of a specific TODO type in a sparse tree
2825by using a numeric prefix to @kbd{C-c C-v}. For example, to see all things
2826Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect Lucy's items
2827from all agenda files into a single buffer, you would use the numeric prefix
2828argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
4009494e 2829
dbc28aaa 2830@node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
4009494e 2831@subsection Multiple keyword sets in one file
a7808fba 2832@cindex TODO keyword sets
4009494e
GM
2833
2834Sometimes you may want to use different sets of TODO keywords in
2835parallel. For example, you may want to have the basic
2836@code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
2837separate state indicating that an item has been canceled (so it is not
2838DONE, but also does not require action). Your setup would then look
2839like this:
2840
2841@lisp
2842(setq org-todo-keywords
2843 '((sequence "TODO" "|" "DONE")
2844 (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
2845 (sequence "|" "CANCELED")))
2846@end lisp
2847
a7808fba 2848The keywords should all be different, this helps Org mode to keep track
4009494e
GM
2849of which subsequence should be used for a given entry. In this setup,
2850@kbd{C-c C-t} only operates within a subsequence, so it switches from
2851@code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
2852(nothing) to @code{REPORT}. Therefore you need a mechanism to initially
2853select the correct sequence. Besides the obvious ways like typing a
2854keyword or using completion, you may also apply the following commands:
2855
2856@table @kbd
2857@kindex C-S-@key{right}
2858@kindex C-S-@key{left}
2859@item C-S-@key{right}
2860@itemx C-S-@key{left}
2861These keys jump from one TODO subset to the next. In the above example,
2862@kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
2863@code{REPORT}, and any of the words in the second row to @code{CANCELED}.
2864@kindex S-@key{right}
2865@kindex S-@key{left}
2866@item S-@key{right}
2867@itemx S-@key{left}
2868@kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
2869@emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
2870would switch from @code{DONE} to @code{REPORT} in the example above.
2871@end table
2872
dbc28aaa
CD
2873@node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
2874@subsection Fast access to TODO states
2875
2876If you would like to quickly change an entry to an arbitrary TODO state
2877instead of cycling through the states, you can set up keys for
2878single-letter access to the states. This is done by adding the section
2879key after each keyword, in parenthesis. For example:
2880
2881@lisp
2882(setq org-todo-keywords
2883 '((sequence "TODO(t)" "|" "DONE(d)")
2884 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
2885 (sequence "|" "CANCELED(c)")))
2886@end lisp
2887
2888If you then press @code{C-u C-c C-t} followed by the selection key, the
2889entry will be switched to this state. @key{SPC} can be used to remove
2890any TODO keyword from an entry. Should you like this way of selecting
2891TODO states a lot, you might want to set the variable
2892@code{org-use-fast-todo-selection} to @code{t} and make this behavior
2893the default. Check also the variable
2894@code{org-fast-tag-selection-include-todo}, it allows to change the TODO
28a16a1b
CD
2895state through the tags interface (@pxref{Setting tags}), in case you
2896like to mingle the two concepts.
dbc28aaa
CD
2897
2898@node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
4009494e
GM
2899@subsection Setting up keywords for individual files
2900@cindex keyword options
dbc28aaa 2901@cindex per-file keywords
4009494e
GM
2902
2903It can be very useful to use different aspects of the TODO mechanism in
2904different files. For file-local settings, you need to add special lines
2905to the file which set the keywords and interpretation for that file
2906only. For example, to set one of the two examples discussed above, you
2907need one of the following lines, starting in column zero anywhere in the
2908file:
2909
2910@example
2911#+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
2912@end example
2913or
2914@example
2915#+TYP_TODO: Fred Sara Lucy Mike | DONE
2916@end example
2917
2918A setup for using several sets in parallel would be:
2919
2920@example
2921#+SEQ_TODO: TODO | DONE
2922#+SEQ_TODO: REPORT BUG KNOWNCAUSE | FIXED
2923#+SEQ_TODO: | CANCELED
2924@end example
2925
2926@cindex completion, of option keywords
2927@kindex M-@key{TAB}
2928@noindent To make sure you are using the correct keyword, type
2929@samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
2930
2931@cindex DONE, final TODO keyword
2932Remember that the keywords after the vertical bar (or the last keyword
2933if no bar is there) must always mean that the item is DONE (although you
2934may use a different word). After changing one of these lines, use
2935@kbd{C-c C-c} with the cursor still in the line to make the changes
a7808fba
CD
2936known to Org mode@footnote{Org mode parses these lines only when
2937Org mode is activated after visiting a file. @kbd{C-c C-c} with the
2938cursor in a line starting with @samp{#+} is simply restarting Org mode
4009494e
GM
2939for the current buffer.}.
2940
dbc28aaa
CD
2941@node Faces for TODO keywords, , Per-file keywords, TODO extensions
2942@subsection Faces for TODO keywords
2943@cindex faces, for TODO keywords
2944
a7808fba 2945Org mode highlights TODO keywords with special faces: @code{org-todo}
dbc28aaa
CD
2946for keywords indicating that an item still has to be acted upon, and
2947@code{org-done} for keywords indicating that an item is finished. If
2948you are using more than 2 different states, you might want to use
2949special faces for some of them. This can be done using the variable
2950@code{org-todo-keyword-faces}. For example:
2951
2952@lisp
2953(setq org-todo-keyword-faces
2954 '(("TODO" . org-warning)
2955 ("DEFERRED" . shadow)
2956 ("CANCELED" . (:foreground "blue" :weight bold))))
2957@end lisp
2958
28a16a1b
CD
2959While using a list with face properties as shown for CANCELED
2960@emph{should} work, this does not aways seem to be the case. If
2961necessary, define a special face and use that.
2962
dbc28aaa 2963@page
a7808fba
CD
2964@node Progress logging, Priorities, TODO extensions, TODO Items
2965@section Progress logging
dbc28aaa
CD
2966@cindex progress logging
2967@cindex logging, of progress
2968
a7808fba 2969Org mode can automatically record a time stamp and possibly a note when
28a16a1b
CD
2970you mark a TODO item as DONE, or even each time you change the state of
2971a TODO item. This system is highly configurable, settings can be on a
2972per-keyword basis and can be localized to a file or even a subtree. For
2973information on how to clock working time for a task, see @ref{Clocking
2974work time}.
dbc28aaa
CD
2975
2976@menu
2977* Closing items:: When was this entry marked DONE?
2978* Tracking TODO state changes:: When did the status change?
2979@end menu
2980
2981@node Closing items, Tracking TODO state changes, Progress logging, Progress logging
2982@subsection Closing items
2983
28a16a1b
CD
2984The most basic logging is to keep track of @emph{when} a certain TODO
2985item was finished. This is achieved with@footnote{The corresponding
2986in-buffer setting is: @code{#+STARTUP: logdone}}.
dbc28aaa
CD
2987
2988@lisp
28a16a1b 2989(setq org-log-done 'time)
dbc28aaa
CD
2990@end lisp
2991
2992@noindent
28a16a1b
CD
2993Then each time you turn an entry from a TODO (not-done) state into any
2994of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
2995just after the headline. If you turn the entry back into a TODO item
2996through further state cycling, that line will be removed again. If you
2997want to record a note along with the timestamp, use@footnote{The
2998corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
dbc28aaa
CD
2999
3000@lisp
28a16a1b 3001(setq org-log-done 'note)
dbc28aaa
CD
3002@end lisp
3003
28a16a1b
CD
3004@noindent
3005You will then be prompted for a note, and that note will be stored below
3006the entry with a @samp{Closing Note} heading.
3007
3008In the timeline (@pxref{Timeline}) and in the agenda
a7808fba 3009(@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
28a16a1b
CD
3010display the TODO items with a @samp{CLOSED} timestamp on each day,
3011giving you an overview of what has been done.
3012
dbc28aaa
CD
3013@node Tracking TODO state changes, , Closing items, Progress logging
3014@subsection Tracking TODO state changes
3015
3016When TODO keywords are used as workflow states (@pxref{Workflow
3017states}), you might want to keep track of when a state change occurred
28a16a1b 3018and maybe take a note about this change. Since it is normally too much
a7808fba 3019to record a note for every state, Org mode expects configuration on a
28a16a1b
CD
3020per-keyword basis for this. This is achieved by adding special markers
3021@samp{!} (for a time stamp) and @samp{@@} (for a note) in parenthesis
3022after each keyword. For example, with the setting
dbc28aaa
CD
3023
3024@lisp
28a16a1b
CD
3025(setq org-todo-keywords
3026 '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
dbc28aaa
CD
3027@end lisp
3028
3029@noindent
28a16a1b
CD
3030you not only define global TODO keywords and fast access keys, but also
3031request that a time is recorded when the entry is turned into
a7808fba 3032DONE@footnote{It is possible that Org mode will record two time stamps
28a16a1b
CD
3033when you are using both @code{org-log-done} and state change logging.
3034However, it will never prompt for two notes - if you have configured
3035both, the state change recording note will take precedence and cancel
3036the @samp{Closing Note}.}, and that a note is recorded when switching to
3037WAIT or CANCELED. The setting for WAIT is even more special: The
3038@samp{!} after the slash means that in addition to the note taken when
3039entering the state, a time stamp should be recorded when @i{leaving} the
3040WAIT state, if and only if the @i{target} state does not configure
3041logging for entering it. So it has no effect when switching from WAIT
3042to DONE, because DONE is configured to record a timestamp only. But
3043when switching from WAIT back to TODO, the @samp{/!} in the WAIT
3044setting now triggers a timestamp even though TODO has no logging
3045configured.
3046
3047You can use the exact same syntax for setting logging preferences local
3048to a buffer:
3049@example
3050#+SEQ_TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
3051@end example
3052
3053In order to define logging settings that are local to a subtree or a
3054single item, define a LOGGING property in this entry. Any non-empty
3055LOGGING property resets all logging settings to nil. You may then turn
3056on logging for this specific tree using STARTUP keywords like
3057@code{lognotedone} or @code{logrepeat}, as well as adding state specific
3058settings like @code{TODO(!)}. For example
3059
3060@example
3061* TODO Log each state with only a time
3062 :PROPERTIES:
3063 :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
3064 :END:
3065* TODO Only log when switching to WAIT, and when repeating
3066 :PROPERTIES:
3067 :LOGGING: WAIT(@@) logrepeat
3068 :END:
3069* TODO No logging at all
3070 :PROPERTIES:
3071 :LOGGING: nil
3072 :END:
dbc28aaa
CD
3073@end example
3074
dbc28aaa 3075
a7808fba 3076@node Priorities, Breaking down tasks, Progress logging, TODO Items
4009494e
GM
3077@section Priorities
3078@cindex priorities
3079
a7808fba 3080If you use Org mode extensively, you may end up enough TODO items that
dbc28aaa
CD
3081it starts to make sense to prioritize them. Prioritizing can be done by
3082placing a @emph{priority cookie} into the headline of a TODO item, like
3083this
4009494e
GM
3084
3085@example
3086*** TODO [#A] Write letter to Sam Fortune
3087@end example
3088
3089@noindent
a7808fba 3090By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
dbc28aaa
CD
3091@samp{C}. @samp{A} is the highest priority. An entry without a cookie
3092is treated as priority @samp{B}. Priorities make a difference only in
a7808fba
CD
3093the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
3094no inherent meaning to Org mode.
dbc28aaa
CD
3095
3096Priorities can be attached to any outline tree entries; they do not need
3097to be TODO items.
4009494e
GM
3098
3099@table @kbd
3100@kindex @kbd{C-c ,}
3101@item @kbd{C-c ,}
3102Set the priority of the current headline. The command prompts for a
3103priority character @samp{A}, @samp{B} or @samp{C}. When you press
3104@key{SPC} instead, the priority cookie is removed from the headline.
3105The priorities can also be changed ``remotely'' from the timeline and
3106agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
3107@c
3108@kindex S-@key{up}
3109@kindex S-@key{down}
3110@item S-@key{up}
3111@itemx S-@key{down}
dbc28aaa
CD
3112Increase/decrease priority of current headline@footnote{See also the
3113option @code{org-priority-start-cycle-with-default'}.}. Note that these
3114keys are also used to modify time stamps (@pxref{Creating timestamps}).
a7808fba 3115Furthermore, these keys are also used by CUA mode (@pxref{Conflicts}).
4009494e
GM
3116@end table
3117
3118You can change the range of allowed priorities by setting the variables
3119@code{org-highest-priority}, @code{org-lowest-priority}, and
3120@code{org-default-priority}. For an individual buffer, you may set
3121these values (highest, lowest, default) like this (please make sure that
3122the highest priority is earlier in the alphabet than the lowest
3123priority):
3124
3125@example
3126#+PRIORITIES: A C B
3127@end example
3128
a7808fba 3129@node Breaking down tasks, Checkboxes, Priorities, TODO Items
4009494e
GM
3130@section Breaking tasks down into subtasks
3131@cindex tasks, breaking down
3132
3133It is often advisable to break down large tasks into smaller, manageable
3134subtasks. You can do this by creating an outline tree below a TODO
3135item, with detailed subtasks on the tree@footnote{To keep subtasks out
3136of the global TODO list, see the
3137@code{org-agenda-todo-list-sublevels}.}. Another possibility is the use
3138of checkboxes to identify (a hierarchy of) a large number of subtasks
3139(@pxref{Checkboxes}).
3140
3141
a7808fba 3142@node Checkboxes, , Breaking down tasks, TODO Items
4009494e
GM
3143@section Checkboxes
3144@cindex checkboxes
3145
dbc28aaa
CD
3146Every item in a plain list (@pxref{Plain lists}) can be made into a
3147checkbox by starting it with the string @samp{[ ]}. This feature is
a7808fba 3148similar to TODO items (@pxref{TODO Items}), but is more lightweight.
dbc28aaa
CD
3149Checkboxes are not included into the global TODO list, so they are often
3150great to split a task into a number of simple steps. Or you can use
3151them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or
3152use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
3153
3154Here is an example of a checkbox list.
4009494e
GM
3155
3156@example
28a16a1b
CD
3157* TODO Organize party [2/4]
3158 - [-] call people [1/3]
4009494e
GM
3159 - [ ] Peter
3160 - [X] Sarah
3161 - [ ] Sam
3162 - [X] order food
3163 - [ ] think about what music to play
3164 - [X] talk to the neighbors
3165@end example
3166
28a16a1b
CD
3167Checkboxes work hierarchically, so if a checkbox item has children that
3168are checkboxes, toggling one of the children checkboxes will make the
3169parent checkbox reflect if none, some, or all of the children are
3170checked.
3171
4009494e
GM
3172@cindex statistics, for checkboxes
3173@cindex checkbox statistics
28a16a1b 3174The @samp{[2/4]} and @samp{[1/3]} in the first and second line are
dbc28aaa
CD
3175cookies indicating how many checkboxes present in this entry have been
3176checked off, and the total number of checkboxes are present. This can
3177give you an idea on how many checkboxes remain, even without opening a
3178folded entry. The cookies can be placed into a headline or into (the
3179first line of) a plain list item. Each cookie covers all checkboxes
3180structurally below the headline/item on which the cookie appear. You
3181have to insert the cookie yourself by typing either @samp{[/]} or
3182@samp{[%]}. With @samp{[/]} you get an @samp{n out of m} result, as in
3183the examples above. With @samp{[%]} you get information about the
4009494e 3184percentage of checkboxes checked (in the above example, this would be
dbc28aaa 3185@samp{[50%]} and @samp{[33%]}, respectively).
4009494e
GM
3186
3187@noindent The following commands work with checkboxes:
3188
3189@table @kbd
3190@kindex C-c C-c
3191@item C-c C-c
a7808fba 3192Toggle checkbox at point. With a prefix argument, set it to @samp{[-]},
4009494e
GM
3193which is considered to be an intermediate state.
3194@kindex C-c C-x C-b
3195@item C-c C-x C-b
3196Toggle checkbox at point.
3197@itemize @minus
3198@item
3199If there is an active region, toggle the first checkbox in the region
3200and set all remaining boxes to the same status as the first. If you
3201want to toggle all boxes in the region independently, use a prefix
3202argument.
3203@item
3204If the cursor is in a headline, toggle checkboxes in the region between
3205this headline and the next (so @emph{not} the entire subtree).
3206@item
3207If there is no active region, just toggle the checkbox at point.
3208@end itemize
3209@kindex M-S-@key{RET}
3210@item M-S-@key{RET}
3211Insert a new item with a checkbox.
3212This works only if the cursor is already in a plain list item
3213(@pxref{Plain lists}).
3214@kindex C-c #
3215@item C-c #
3216Update the checkbox statistics in the current outline entry. When
3217called with a @kbd{C-u} prefix, update the entire file. Checkbox
3218statistic cookies are updated automatically if you toggle checkboxes
3219with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}. If you
3220delete boxes or add/change them by hand, use this command to get things
3221back into synch. Or simply toggle any checkbox twice with @kbd{C-c C-c}.
3222@end table
3223
a7808fba 3224@node Tags, Properties and Columns, TODO Items, Top
4009494e
GM
3225@chapter Tags
3226@cindex tags
3227@cindex headline tagging
3228@cindex matching, tags
3229@cindex sparse tree, tag based
3230
dbc28aaa 3231An excellent way to implement labels and contexts for cross-correlating
a7808fba 3232information is to assign @i{tags} to headlines. Org mode has extensive
dbc28aaa 3233support for tags.
4009494e 3234
dbc28aaa
CD
3235Every headline can contain a list of tags; they occur at the end of the
3236headline. Tags are normal words containing letters, numbers, @samp{_},
3237and @samp{@@}. Tags must be preceded and followed by a single colon,
3238e.g., @samp{:WORK:}. Several tags can be specified, as in
3239@samp{:work:URGENT:}.
4009494e
GM
3240
3241@menu
3242* Tag inheritance:: Tags use the tree structure of the outline
3243* Setting tags:: How to assign tags to a headline
3244* Tag searches:: Searching for combinations of tags
3245@end menu
3246
3247@node Tag inheritance, Setting tags, Tags, Tags
3248@section Tag inheritance
dbc28aaa 3249@cindex tag inheritance
4009494e
GM
3250@cindex inheritance, of tags
3251@cindex sublevels, inclusion into tags match
3252
3253@i{Tags} make use of the hierarchical structure of outline trees. If a
3254heading has a certain tag, all subheadings will inherit the tag as
3255well. For example, in the list
3256
3257@example
dbc28aaa
CD
3258* Meeting with the French group :work:
3259** Summary by Frank :boss:notes:
3260*** TODO Prepare slides for him :action:
4009494e
GM
3261@end example
3262
3263@noindent
dbc28aaa
CD
3264the final heading will have the tags @samp{:work:}, @samp{:boss:},
3265@samp{:notes:}, and @samp{:action:} even though the final heading is not
3266explicitly marked with those tags. When executing tag searches and
a7808fba 3267Org mode finds that a certain headline matches the search criterion, it
dbc28aaa
CD
3268will not check any sublevel headline, assuming that these also match and
3269that the list of matches could become very long because of that. If you
a7808fba
CD
3270do want the sublevels be tested and listed as well, you may set the
3271variable @code{org-tags-match-list-sublevels}. To limit tag inheritance
3272to specific tags, or to turn it off entirely, use the variable
3273@code{org-use-tag-inheritance}.
4009494e
GM
3274
3275@node Setting tags, Tag searches, Tag inheritance, Tags
3276@section Setting tags
3277@cindex setting tags
3278@cindex tags, setting
3279
3280@kindex M-@key{TAB}
3281Tags can simply be typed into the buffer at the end of a headline.
3282After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
3283also a special command for inserting tags:
3284
3285@table @kbd
3286@kindex C-c C-c
3287@item C-c C-c
3288@cindex completion, of tags
a7808fba 3289Enter new tags for the current headline. Org mode will either offer
4009494e
GM
3290completion or a special single-key interface for setting tags, see
3291below. After pressing @key{RET}, the tags will be inserted and aligned
3292to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all
3293tags in the current buffer will be aligned to that column, just to make
3294things look nice. TAGS are automatically realigned after promotion,
3295demotion, and TODO state changes (@pxref{TODO basics}).
3296@end table
3297
3298Org will support tag insertion based on a @emph{list of tags}. By
3299default this list is constructed dynamically, containing all tags
3300currently used in the buffer. You may also globally specify a hard list
3301of tags with the variable @code{org-tag-alist}. Finally you can set
3302the default tags for a given file with lines like
3303
3304@example
dbc28aaa
CD
3305#+TAGS: @@work @@home @@tennisclub
3306#+TAGS: laptop car pc sailboat
4009494e
GM
3307@end example
3308
3309If you have globally defined your preferred set of tags using the
3310variable @code{org-tag-alist}, but would like to use a dynamic tag list
dbc28aaa 3311in a specific file, add an empty TAGS option line to that file:
4009494e
GM
3312
3313@example
3314#+TAGS:
3315@end example
3316
a7808fba
CD
3317By default Org mode uses the standard minibuffer completion facilities for
3318entering tags. However, it also implements another, quicker, tag selection
3319method called @emph{fast tag selection}. This allows you to select and
3320deselect tags with just a single key press. For this to work well you should
3321assign unique letters to most of your commonly used tags. You can do this
3322globally by configuring the variable @code{org-tag-alist} in your
3323@file{.emacs} file. For example, you may find the need to tag many items in
3324different files with @samp{:@@home:}. In this case you can set something
3325like:
4009494e
GM
3326
3327@lisp
dbc28aaa 3328(setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
4009494e
GM
3329@end lisp
3330
a7808fba
CD
3331@noindent If the tag is only relevant to the file you are working on then you
3332can, instead, set the TAGS option line as:
4009494e
GM
3333
3334@example
dbc28aaa 3335#+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
4009494e
GM
3336@end example
3337
3338@noindent
a7808fba
CD
3339You can also group together tags that are mutually exclusive. By using
3340braces, as in:
4009494e
GM
3341
3342@example
dbc28aaa 3343#+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
4009494e
GM
3344@end example
3345
dbc28aaa 3346@noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
a7808fba 3347and @samp{@@tennisclub} should be selected. Multiple such groups are allowed.
4009494e
GM
3348
3349@noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
3350these lines to activate any changes.
3351
a7808fba
CD
3352@noindent
3353To set these mutually exclusive groups in the variable @code{org-mode-alist}
3354you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
3355of the braces. The previous example would be set globally by the following
3356configuration:
3357
3358@lisp
3359(setq org-tag-alist '((:startgroup . nil)
3360 ("@@work" . ?w) ("@@home" . ?h)
3361 ("@@tennisclub" . ?t)
3362 (:endgroup . nil)
3363 ("laptop" . ?l) ("pc" . ?p)))
3364@end lisp
3365
3366If at least one tag has a selection key then pressing @kbd{C-c C-c} will
3367automatically present you with a special interface, listing inherited tags,
3368the tags of the current headline, and a list of all valid tags with
3369corresponding keys@footnote{Keys will automatically be assigned to tags which
3370have no configured keys.}. In this interface, you can use the following
3371keys:
4009494e
GM
3372
3373@table @kbd
3374@item a-z...
3375Pressing keys assigned to tags will add or remove them from the list of
3376tags in the current line. Selecting a tag in a group of mutually
3377exclusive tags will turn off any other tags from that group.
3378@kindex @key{TAB}
3379@item @key{TAB}
3380Enter a tag in the minibuffer, even if the tag is not in the predefined
3381list. You will be able to complete on all tags present in the buffer.
3382@kindex @key{SPC}
3383@item @key{SPC}
3384Clear all tags for this line.
3385@kindex @key{RET}
3386@item @key{RET}
3387Accept the modified set.
3388@item C-g
3389Abort without installing changes.
3390@item q
3391If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
3392@item !
3393Turn off groups of mutually exclusive tags. Use this to (as an
3394exception) assign several tags from such a group.
3395@item C-c
3396Toggle auto-exit after the next change (see below).
3397If you are using expert mode, the first @kbd{C-c} will display the
3398selection window.
3399@end table
3400
3401@noindent
3402This method lets you assign tags to a headline with very few keys. With
dbc28aaa
CD
3403the above setup, you could clear the current tags and set @samp{@@home},
3404@samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
3405C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to
3406@samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
4009494e
GM
3407alternatively with @kbd{C-c C-c C-c w}. Adding the non-predefined tag
3408@samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
3409@key{RET} @key{RET}}.
3410
a7808fba 3411If you find that most of the time, you need only a single key press to
4009494e
GM
3412modify your list of tags, set the variable
3413@code{org-fast-tag-selection-single-key}. Then you no longer have to
3414press @key{RET} to exit fast tag selection - it will immediately exit
3415after the first change. If you then occasionally need more keys, press
3416@kbd{C-c} to turn off auto-exit for the current tag selection process
3417(in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
3418C-c}). If you set the variable to the value @code{expert}, the special
3419window is not even shown for single-key tag selection, it comes up only
3420when you press an extra @kbd{C-c}.
3421
3422@node Tag searches, , Setting tags, Tags
3423@section Tag searches
3424@cindex tag searches
3425@cindex searching for tags
3426
dbc28aaa 3427Once a system of tags has been set up, it can be used to collect related
4009494e
GM
3428information into special lists.
3429
3430@table @kbd
3431@kindex C-c \
dbc28aaa 3432@kindex C-c / T
4009494e 3433@item C-c \
dbc28aaa 3434@itemx C-c / T
4009494e
GM
3435Create a sparse tree with all headlines matching a tags search. With a
3436@kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
3437@kindex C-c a m
3438@item C-c a m
3439Create a global list of tag matches from all agenda files.
3440@xref{Matching tags and properties}.
3441@kindex C-c a M
3442@item C-c a M
3443Create a global list of tag matches from all agenda files, but check
3444only TODO items and force checking subitems (see variable
3445@code{org-tags-match-list-sublevels}).
3446@end table
3447
3448@cindex Boolean logic, for tag searches
3449A @i{tags} search string can use Boolean operators @samp{&} for AND and
3450@samp{|} for OR. @samp{&} binds more strongly than @samp{|}.
3451Parenthesis are currently not implemented. A tag may also be preceded
3452by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
3453positive selection. The AND operator @samp{&} is optional when @samp{+}
3454or @samp{-} is present. Examples:
3455
3456@table @samp
dbc28aaa
CD
3457@item +work-boss
3458Select headlines tagged @samp{:work:}, but discard those also tagged
3459@samp{:boss:}.
3460@item work|laptop
3461Selects lines tagged @samp{:work:} or @samp{:laptop:}.
3462@item work|laptop&night
3463Like before, but require the @samp{:laptop:} lines to be tagged also
3464@samp{:night:}.
4009494e
GM
3465@end table
3466
3467@cindex TODO keyword matching, with tags search
3468If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
3469can be useful to also match on the TODO keyword. This can be done by
3470adding a condition after a slash to a tags match. The syntax is similar
3471to the tag matches, but should be applied with consideration: For
3472example, a positive selection on several TODO keywords can not
3473meaningfully be combined with boolean AND. However, @emph{negative
3474selection} combined with AND can be meaningful. To make sure that only
3475lines are checked that actually have any TODO keyword, use @kbd{C-c a
a7808fba 3476M}, or equivalently start the TODO part after the slash with @samp{!}.
4009494e
GM
3477Examples:
3478
3479@table @samp
dbc28aaa
CD
3480@item work/WAITING
3481Select @samp{:work:}-tagged TODO lines with the specific TODO
4009494e 3482keyword @samp{WAITING}.
dbc28aaa
CD
3483@item work/!-WAITING-NEXT
3484Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
4009494e 3485nor @samp{NEXT}
dbc28aaa
CD
3486@item work/+WAITING|+NEXT
3487Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
4009494e
GM
3488@samp{NEXT}.
3489@end table
3490
3491@cindex regular expressions, with tags search
3492Any element of the tag/todo match can be a regular expression - in this
3493case it must be enclosed in curly braces. For example,
dbc28aaa
CD
3494@samp{work+@{^boss.*@}} matches headlines that contain the tag
3495@samp{:work:} and any tag @i{starting} with @samp{boss}.
3496
3497@cindex level, require for tags/property match
3498@cindex category, require for tags/property match
3499You can also require a headline to be of a certain level or category, by
3500writing instead of any TAG an expression like @samp{LEVEL=3} or
3501@samp{CATEGORY="work"}, respectively. For example, a search
3502@samp{+LEVEL=3+boss/-DONE} lists all level three headlines that have the
a7808fba 3503tag @samp{boss} and are @emph{not} marked with the TODO keyword DONE.
dbc28aaa 3504
a7808fba 3505@node Properties and Columns, Dates and Times, Tags, Top
4009494e
GM
3506@chapter Properties and Columns
3507@cindex properties
3508
3509Properties are a set of key-value pairs associated with an entry. There
a7808fba 3510are two main applications for properties in Org mode. First, properties
dbc28aaa 3511are like tags, but with a value. Second, you can use properties to
a7808fba 3512implement (very basic) database capabilities in an Org buffer. For
dbc28aaa
CD
3513an example of the first application, imagine maintaining a file where
3514you document bugs and plan releases of a piece of software. Instead of
3515using tags like @code{:release_1:}, @code{:release_2:}, one can use a
3516property, say @code{:Release:}, that in different subtrees has different
3517values, such as @code{1.0} or @code{2.0}. For an example of the second
a7808fba 3518application of properties, imagine keeping track of your music CD's,
dbc28aaa
CD
3519where properties could be things such as the album artist, date of
3520release, number of tracks, and so on.
3521
28a16a1b 3522Properties can be conveniently edited and viewed in column view
dbc28aaa
CD
3523(@pxref{Column view}).
3524
3525Properties are like tags, but with a value. For example, in a file
3526where you document bugs and plan releases of a piece of software,
3527instead of using tags like @code{:release_1:}, @code{:release_2:}, it
3528can be more efficient to use a property @code{:Release:} with a value
3529@code{1.0} or @code{2.0}. Second, you can use properties to implement
a7808fba 3530(very basic) database capabilities in an Org buffer, for example to
dbc28aaa 3531create a list of Music CD's you own. You can edit and view properties
4009494e
GM
3532conveniently in column view (@pxref{Column view}).
3533
3534@menu
3535* Property syntax:: How properties are spelled out
a7808fba 3536* Special properties:: Access to other Org mode features
4009494e 3537* Property searches:: Matching property values
dbc28aaa 3538* Property inheritance:: Passing values down the tree
4009494e
GM
3539* Column view:: Tabular viewing and editing
3540* Property API:: Properties for Lisp programmers
3541@end menu
3542
a7808fba
CD
3543@node Property syntax, Special properties, Properties and Columns, Properties and Columns
3544@section Property syntax
4009494e
GM
3545@cindex property syntax
3546@cindex drawer, for properties
3547
3548Properties are key-value pairs. They need to be inserted into a special
3549drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property
3550is specified on a single line, with the key (surrounded by colons)
3551first, and the value after it. Here is an example:
3552
3553@example
3554* CD collection
3555** Classic
3556*** Goldberg Variations
3557 :PROPERTIES:
3558 :Title: Goldberg Variations
3559 :Composer: J.S. Bach
28a16a1b 3560 :Artist: Glen Gould
4009494e
GM
3561 :Publisher: Deutsche Grammphon
3562 :NDisks: 1
28a16a1b 3563 :END:
4009494e
GM
3564@end example
3565
dbc28aaa
CD
3566You may define the allowed values for a particular property @samp{:Xyz:}
3567by setting a property @samp{:Xyz_ALL:}. This special property is
4009494e
GM
3568@emph{inherited}, so if you set it in a level 1 entry, it will apply to
3569the entire tree. When allowed values are defined, setting the
3570corresponding property becomes easier and is less prone to typing
3571errors. For the example with the CD collection, we can predefine
3572publishers and the number of disks in a box like this:
3573
3574@example
3575* CD collection
3576 :PROPERTIES:
3577 :NDisks_ALL: 1 2 3 4
3578 :Publisher_ALL: "Deutsche Grammophon" Phillips EMI
3579 :END:
3580@end example
3581
3582If you want to set properties that can be inherited by any entry in a
3583file, use a line like
3584
3585@example
3586#+PROPERTY: NDisks_ALL 1 2 3 4
3587@end example
3588
3589Property values set with the global variable
3590@code{org-global-properties} can be inherited by all entries in all
a7808fba 3591Org files.
4009494e
GM
3592
3593@noindent
3594The following commands help to work with properties:
3595
3596@table @kbd
3597@kindex M-@key{TAB}
3598@item M-@key{TAB}
3599After an initial colon in a line, complete property keys. All keys used
3600in the current file will be offered as possible completions.
dbc28aaa
CD
3601@kindex C-c C-x p
3602@item C-c C-x p
3603Set a property. This prompts for a property name and a value. If
3604necessary, the property drawer is created as well.
4009494e
GM
3605@item M-x org-insert-property-drawer
3606Insert a property drawer into the current entry. The drawer will be
3607inserted early in the entry, but after the lines with planning
3608information like deadlines.
3609@kindex C-c C-c
3610@item C-c C-c
3611With the cursor in a property drawer, this executes property commands.
3612@item C-c C-c s
3613Set a property in the current entry. Both the property and the value
3614can be inserted using completion.
3615@kindex S-@key{right}
3616@kindex S-@key{left}
3617@item S-@key{left}/@key{right}
3618Switch property at point to the next/previous allowed value.
3619@item C-c C-c d
3620Remove a property from the current entry.
3621@item C-c C-c D
3622Globally remove a property, from all entries in the current file.
dbc28aaa
CD
3623@item C-c C-c c
3624Compute the property at point, using the operator and scope from the
3625nearest column format definition.
4009494e
GM
3626@end table
3627
a7808fba
CD
3628@node Special properties, Property searches, Property syntax, Properties and Columns
3629@section Special properties
4009494e
GM
3630@cindex properties, special
3631
a7808fba 3632Special properties provide alternative access method to Org mode
4009494e
GM
3633features discussed in the previous chapters, like the TODO state or the
3634priority of an entry. This interface exists so that you can include
dbc28aaa
CD
3635these states into columns view (@pxref{Column view}), or to use them in
3636queries. The following property names are special and should not be
3637used as keys in the properties drawer:
4009494e
GM
3638
3639@example
3640TODO @r{The TODO keyword of the entry.}
3641TAGS @r{The tags defined directly in the headline.}
3642ALLTAGS @r{All tags, including inherited ones.}
3643PRIORITY @r{The priority of the entry, a string with a single letter.}
3644DEADLINE @r{The deadline time string, without the angular brackets.}
3645SCHEDULED @r{The scheduling time stamp, without the angular brackets.}
dbc28aaa
CD
3646TIMESTAMP @r{The first keyword-less time stamp in the entry.}
3647TIMESTAMP_IA @r{The first inactive time stamp in the entry.}
3648CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}}
3649 @r{must be run first to compute the values.}
4009494e
GM
3650@end example
3651
a7808fba 3652@node Property searches, Property inheritance, Special properties, Properties and Columns
4009494e
GM
3653@section Property searches
3654@cindex properties, searching
dbc28aaa 3655@cindex searching, of properties
4009494e 3656
a7808fba
CD
3657To create sparse trees and special lists with selection based on properties,
3658the same commands are used as for tag searches (@pxref{Tag searches}), and
3659the same logic applies. For example, here is a search string:
4009494e
GM
3660
3661@example
a7808fba 3662+work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2+With=@{Sarah\|Denny@}
4009494e
GM
3663@end example
3664
3665@noindent
a7808fba
CD
3666If the comparison value is a plain number, a numerical comparison is done,
3667and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=},
3668@samp{>=}, and @samp{<>}. If the comparison value is enclosed in double
3669quotes, a string comparison is done, and the same operators are allowed. If
3670the comparison value is enclosed in curly braces, a regexp match is
3671performed, with @samp{=} meaning that the regexp matches the property value,
3672and @samp{<>} meaning that it does not match. So the search string in the
3673example finds entries tagged @samp{:work:} but not @samp{:boss:}, which also
3674have a priority value @samp{A}, a @samp{:Coffee:} property with the value
3675@samp{unlimited}, an @samp{Effort} property that is numerically smaller than
36762, and a @samp{:With:} property that is matched by the regular expression
3677@samp{Sarah\|Denny}.
3678
3679You can configure Org mode to use property inheritance during a search, but
3680beware that this can slow down searches considerably. See @ref{Property
3681inheritance} for details.
dbc28aaa
CD
3682
3683There is also a special command for creating sparse trees based on a
3684single property:
3685
3686@table @kbd
3687@kindex C-c / p
3688@item C-c / p
3689Create a sparse tree based on the value of a property. This first
3690prompts for the name of a property, and then for a value. A sparse tree
3691is created with all entries that define this property with the given
3692value. If you enclose the value into curly braces, it is interpreted as
3693a regular expression and matched against the property values.
3694@end table
3695
a7808fba 3696@node Property inheritance, Column view, Property searches, Properties and Columns
dbc28aaa 3697@section Property Inheritance
a7808fba
CD
3698@cindex properties, inheritance
3699@cindex inheritance, of properties
dbc28aaa 3700
a7808fba 3701The outline structure of Org mode documents lends itself for an
dbc28aaa 3702inheritance model of properties: If the parent in a tree has a certain
a7808fba 3703property, the children can inherit this property. Org mode does not
dbc28aaa
CD
3704turn this on by default, because it can slow down property searches
3705significantly and is often not needed. However, if you find inheritance
3706useful, you can turn it on by setting the variable
3707@code{org-use-property-inheritance}. It may be set to @code{t}, to make
a7808fba
CD
3708all properties inherited from the parent, to a list of properties
3709that should be inherited, or to a regular expression that matches
3710inherited properties.
dbc28aaa 3711
a7808fba 3712Org mode has a few properties for which inheritance is hard-coded, at
dbc28aaa
CD
3713least for the special applications for which they are used:
3714
3715@table @code
3716@item COLUMNS
3717The @code{:COLUMNS:} property defines the format of column view
3718(@pxref{Column view}). It is inherited in the sense that the level
3719where a @code{:COLUMNS:} property is defined is used as the starting
3720point for a column view table, independently of the location in the
3721subtree from where columns view is turned on.
3722@item CATEGORY
3723For agenda view, a category set through a @code{:CATEGORY:} property
3724applies to the entire subtree.
3725@item ARCHIVE
3726For archiving, the @code{:ARCHIVE:} property may define the archive
3727location for the entire subtree (@pxref{Moving subtrees}).
28a16a1b
CD
3728@item LOGGING
3729The LOGGING property may define logging settings for an entry or a
3730subtree (@pxref{Tracking TODO state changes}).
dbc28aaa
CD
3731@end table
3732
a7808fba
CD
3733@node Column view, Property API, Property inheritance, Properties and Columns
3734@section Column view
4009494e
GM
3735
3736A great way to view and edit properties in an outline tree is
3737@emph{column view}. In column view, each outline item is turned into a
3738table row. Columns in this table provide access to properties of the
a7808fba 3739entries. Org mode implements columns by overlaying a tabular structure
4009494e
GM
3740over the headline of each item. While the headlines have been turned
3741into a table row, you can still change the visibility of the outline
3742tree. For example, you get a compact table by switching to CONTENTS
3743view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
3744is active), but you can still open, read, and edit the entry below each
3745headline. Or, you can switch to column view after executing a sparse
3746tree command and in this way get a table only for the selected items.
a7808fba 3747Column view also works in agenda buffers (@pxref{Agenda Views}) where
4009494e
GM
3748queries have collected selected items, possibly from a number of files.
3749
3750@menu
3751* Defining columns:: The COLUMNS format property
3752* Using column view:: How to create and use column view
a7808fba 3753* Capturing column view:: A dynamic block for column view
4009494e
GM
3754@end menu
3755
3756@node Defining columns, Using column view, Column view, Column view
a7808fba 3757@subsection Defining columns
4009494e
GM
3758@cindex column view, for properties
3759@cindex properties, column view
3760
3761Setting up a column view first requires defining the columns. This is
3762done by defining a column format line.
3763
3764@menu
3765* Scope of column definitions:: Where defined, where valid?
3766* Column attributes:: Appearance and content of a column
3767@end menu
3768
3769@node Scope of column definitions, Column attributes, Defining columns, Defining columns
3770@subsubsection Scope of column definitions
3771
3772To define a column format for an entire file, use a line like
3773
3774@example
3775#+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3776@end example
3777
dbc28aaa
CD
3778To specify a format that only applies to a specific tree, add a
3779@code{:COLUMNS:} property to the top node of that tree, for example:
3780
4009494e
GM
3781@example
3782** Top node for columns view
3783 :PROPERTIES:
3784 :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3785 :END:
3786@end example
3787
dbc28aaa 3788If a @code{:COLUMNS:} property is present in an entry, it defines columns
4009494e
GM
3789for the entry itself, and for the entire subtree below it. Since the
3790column definition is part of the hierarchical structure of the document,
3791you can define columns on level 1 that are general enough for all
3792sublevels, and more specific columns further down, when you edit a
3793deeper part of the tree.
3794
3795@node Column attributes, , Scope of column definitions, Defining columns
3796@subsubsection Column attributes
3797A column definition sets the attributes of a column. The general
3798definition looks like this:
3799
3800@example
3801 %[width]property[(title)][@{summary-type@}]
3802@end example
3803
3804@noindent
3805Except for the percent sign and the property name, all items are
3806optional. The individual parts have the following meaning:
3807
3808@example
3809width @r{An integer specifying the width of the column in characters.}
3810 @r{If omitted, the width will be determined automatically.}
3811property @r{The property that should be edited in this column.}
3812(title) @r{The header text for the column. If omitted, the}
3813 @r{property name is used.}
3814@{summary-type@} @r{The summary type. If specified, the column values for}
3815 @r{parent nodes are computed from the children.}
3816 @r{Supported summary types are:}
dbc28aaa
CD
3817 @{+@} @r{Sum numbers in this column.}
3818 @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.}
3819 @{$@} @r{Currency, short for @samp{+;%.2f}.}
3820 @{:@} @r{Sum times, HH:MM:SS, plain numbers are hours.}
3821 @{X@} @r{Checkbox status, [X] if all children are [X].}
28a16a1b
CD
3822 @{X/@} @r{Checkbox status, [n/m].}
3823 @{X%@} @r{Checkbox status, [n%].}
4009494e
GM
3824@end example
3825
3826@noindent
3827Here is an example for a complete columns definition, along with allowed
3828values.
3829
3830@example
dbc28aaa
CD
3831:COLUMNS: %20ITEM %9Approved(Approved?)@{X@} %Owner %11Status \@footnote{Please note that the COLUMNS definition must be on a single line - it is wrapped here only because of formatting constraints.}
3832 %10Time_Estimate@{:@} %CLOCKSUM
4009494e
GM
3833:Owner_ALL: Tammy Mark Karl Lisa Don
3834:Status_ALL: "In progress" "Not started yet" "Finished" ""
3835:Approved_ALL: "[ ]" "[X]"
3836@end example
3837
3838The first column, @samp{%25ITEM}, means the first 25 characters of the
3839item itself, i.e. of the headline. You probably always should start the
28a16a1b
CD
3840column definition with the @samp{ITEM} specifier. The other specifiers
3841create columns @samp{Owner} with a list of names as allowed values, for
4009494e
GM
3842@samp{Status} with four different possible values, and for a checkbox
3843field @samp{Approved}. When no width is given after the @samp{%}
3844character, the column will be exactly as wide as it needs to be in order
3845to fully display all values. The @samp{Approved} column does have a
3846modified title (@samp{Approved?}, with a question mark). Summaries will
dbc28aaa 3847be created for the @samp{Time_Estimate} column by adding time duration
4009494e 3848expressions like HH:MM, and for the @samp{Approved} column, by providing
dbc28aaa
CD
3849an @samp{[X]} status if all children have been checked. The
3850@samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
3851in the subtree.
4009494e 3852
a7808fba
CD
3853@node Using column view, Capturing column view, Defining columns, Column view
3854@subsection Using column view
4009494e
GM
3855
3856@table @kbd
3857@tsubheading{Turning column view on and off}
3858@kindex C-c C-x C-c
3859@item C-c C-x C-c
3860Create the column view for the local environment. This command searches
dbc28aaa 3861the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
4009494e 3862a format. When one is found, the column view table is established for
dbc28aaa 3863the entire tree, starting from the entry that contains the @code{:COLUMNS:}
4009494e
GM
3864property. If none is found, the format is taken from the @code{#+COLUMNS}
3865line or from the variable @code{org-columns-default-format}, and column
3866view is established for the current entry and its subtree.
28a16a1b
CD
3867@kindex r
3868@item r
a7808fba 3869Recreate the column view, to include recent changes made in the buffer.
28a16a1b
CD
3870@kindex g
3871@item g
3872Same as @kbd{r}.
4009494e
GM
3873@kindex q
3874@item q
3875Exit column view.
3876@tsubheading{Editing values}
3877@item @key{left} @key{right} @key{up} @key{down}
3878Move through the column view from field to field.
3879@kindex S-@key{left}
3880@kindex S-@key{right}
3881@item S-@key{left}/@key{right}
3882Switch to the next/previous allowed value of the field. For this, you
3883have to have specified allowed values for a property.
3884@kindex n
3885@kindex p
3886@itemx n / p
3887Same as @kbd{S-@key{left}/@key{right}}
3888@kindex e
3889@item e
3890Edit the property at point. For the special properties, this will
3891invoke the same interface that you normally use to change that
3892property. For example, when editing a TAGS property, the tag completion
3893or fast selection interface will pop up.
dbc28aaa
CD
3894@kindex C-c C-c
3895@item C-c C-c
3896When there is a checkbox at point, toggle it.
4009494e
GM
3897@kindex v
3898@item v
3899View the full value of this property. This is useful if the width of
3900the column is smaller than that of the value.
3901@kindex a
3902@item a
3903Edit the list of allowed values for this property. If the list is found
3904in the hierarchy, the modified values is stored there. If no list is
3905found, the new value is stored in the first entry that is part of the
3906current column view.
3907@tsubheading{Modifying the table structure}
3908@kindex <
3909@kindex >
3910@item < / >
3911Make the column narrower/wider by one character.
3912@kindex S-M-@key{right}
3913@item S-M-@key{right}
3914Insert a new column, to the right of the current column.
3915@kindex S-M-@key{left}
3916@item S-M-@key{left}
3917Delete the current column.
3918@end table
3919
a7808fba
CD
3920@node Capturing column view, , Using column view, Column view
3921@subsection Capturing column view
dbc28aaa
CD
3922
3923Since column view is just an overlay over a buffer, it cannot be
3924exported or printed directly. If you want to capture a column view, use
a7808fba 3925this @code{columnview} dynamic block (@pxref{Dynamic blocks}). The frame
28a16a1b 3926of this block looks like this:
dbc28aaa
CD
3927
3928@example
3929* The column view
3930#+BEGIN: columnview :hlines 1 :id "label"
3931
3932#+END:
3933@end example
3934
3935@noindent This dynamic block has the following parameters:
3936
3937@table @code
3938@item :id
3939This is most important parameter. Column view is a feature that is
3940often localized to a certain (sub)tree, and the capture block might be
3941in a different location in the file. To identify the tree whose view to
3942capture, you can use 3 values:
3943@example
3944local @r{use the tree in which the capture block is located}
3945global @r{make a global view, including all headings in the file}
3946"label" @r{call column view in the tree that has and @code{:ID:}}
3947 @r{property with the value @i{label}}
3948@end example
3949@item :hlines
3950When @code{t}, insert a hline after every line. When a number N, insert
3951a hline before each headline with level @code{<= N}.
3952@item :vlines
3953When set to @code{t}, enforce column groups to get vertical lines.
28a16a1b
CD
3954@item :maxlevel
3955When set to a number, don't capture entries below this level.
3956@item :skip-empty-rows
3957When set to @code{t}, skip row where the only non-empty specifier of the
3958column view is @code{ITEM}.
3959
dbc28aaa
CD
3960@end table
3961
3962@noindent
3963The following commands insert or update the dynamic block:
3964
3965@table @kbd
3966@kindex C-c C-x r
3967@item C-c C-x r
3968Insert a dynamic block capturing a column view. You will be prompted
3969for the scope or id of the view.
3970@kindex C-c C-c
3971@item C-c C-c
3972@kindex C-c C-x C-u
3973@itemx C-c C-x C-u
3974Update dynamical block at point. The cursor needs to be in the
3975@code{#+BEGIN} line of the dynamic block.
3976@kindex C-u C-c C-x C-u
3977@item C-u C-c C-x C-u
3978Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
a7808fba 3979you have several clock table blocks in a buffer.
dbc28aaa
CD
3980@end table
3981
a7808fba 3982@node Property API, , Column view, Properties and Columns
4009494e
GM
3983@section The Property API
3984@cindex properties, API
3985@cindex API, for properties
3986
3987There is a full API for accessing and changing properties. This API can
3988be used by Emacs Lisp programs to work with properties and to implement
3989features based on them. For more information see @ref{Using the
3990property API}.
3991
a7808fba 3992@node Dates and Times, Remember, Properties and Columns, Top
dbc28aaa
CD
3993@chapter Dates and Times
3994@cindex dates
3995@cindex times
4009494e
GM
3996@cindex time stamps
3997@cindex date stamps
3998
dbc28aaa
CD
3999To assist project planning, TODO items can be labeled with a date and/or
4000a time. The specially formatted string carrying the date and time
a7808fba 4001information is called a @emph{timestamp} in Org mode. This may be a
dbc28aaa 4002little confusing because timestamp is often used as indicating when
a7808fba 4003something was created or last changed. However, in Org mode this term
dbc28aaa 4004is used in a much wider sense.
4009494e
GM
4005
4006@menu
a7808fba 4007* Timestamps:: Assigning a time to a tree entry
4009494e
GM
4008* Creating timestamps:: Commands which insert timestamps
4009* Deadlines and scheduling:: Planning your work
a7808fba
CD
4010* Clocking work time:: Tracking how long you spend on a task
4011* Effort estimates:: Planning work effort in advance
4009494e
GM
4012@end menu
4013
4014
a7808fba
CD
4015@node Timestamps, Creating timestamps, Dates and Times, Dates and Times
4016@section Timestamps, deadlines and scheduling
4009494e
GM
4017@cindex time stamps
4018@cindex ranges, time
4019@cindex date stamps
4020@cindex deadlines
4021@cindex scheduling
4022
4023A time stamp is a specification of a date (possibly with time or a range
4024of times) in a special format, either @samp{<2003-09-16 Tue>} or
4025@samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
dbc28aaa
CD
402612:00-12:30>}@footnote{This is the standard ISO date/time format. To
4027use an alternative format, see @ref{Custom time format}.}. A time stamp
a7808fba 4028can appear anywhere in the headline or body of an Org tree entry. Its
dbc28aaa 4029presence causes entries to be shown on specific dates in the agenda
a7808fba 4030(@pxref{Weekly/daily agenda}). We distinguish:
4009494e
GM
4031
4032@table @var
dbc28aaa 4033@item Plain time stamp; Event; Appointment
4009494e
GM
4034@cindex timestamp
4035A simple time stamp just assigns a date/time to an item. This is just
dbc28aaa
CD
4036like writing down an appointment or event in a paper agenda. In the
4037timeline and agenda displays, the headline of an entry associated with a
4038plain time stamp will be shown exactly on that date.
4009494e
GM
4039
4040@example
4041* Meet Peter at the movies <2006-11-01 Wed 19:15>
4042* Discussion on climate change <2006-11-02 Thu 20:00-22:00>
4043@end example
4044
4045@item Time stamp with repeater interval
4046@cindex timestamp, with repeater interval
4047A time stamp may contain a @emph{repeater interval}, indicating that it
4048applies not only on the given date, but again and again after a certain
4049interval of N days (d), weeks (w), months(m), or years(y). The
4050following will show up in the agenda every Wednesday:
4051
4052@example
4053* Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
4054@end example
4055
4056@item Diary-style sexp entries
a7808fba 4057For more complex date specifications, Org mode supports using the
4009494e
GM
4058special sexp diary entries implemented in the Emacs calendar/diary
4059package. For example
4060
4061@example
4062* The nerd meeting on every 2nd Thursday of the month
4063 <%%(diary-float t 4 2)>
4064@end example
4065
4066@item Time/Date range
4067@cindex timerange
4068@cindex date range
4069Two time stamps connected by @samp{--} denote a range. The headline
4070will be shown on the first and last day of the range, and on any dates
4071that are displayed and fall in the range. Here is an example:
4072
4073@example
4074** Meeting in Amsterdam
4075 <2004-08-23 Mon>--<2004-08-26 Thu>
4076@end example
4077
4078@item Inactive time stamp
4079@cindex timestamp, inactive
4080@cindex inactive timestamp
4081Just like a plain time stamp, but with square brackets instead of
4082angular ones. These time stamps are inactive in the sense that they do
4083@emph{not} trigger an entry to show up in the agenda.
4084
4085@example
4086* Gillian comes late for the fifth time [2006-11-01 Wed]
4087@end example
4088
4089@end table
4090
a7808fba 4091@node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
4009494e
GM
4092@section Creating timestamps
4093@cindex creating timestamps
4094@cindex timestamps, creating
4095
a7808fba 4096For Org mode to recognize time stamps, they need to be in the specific
4009494e
GM
4097format. All commands listed below produce time stamps in the correct
4098format.
4099
4100@table @kbd
4101@kindex C-c .
4102@item C-c .
4103Prompt for a date and insert a corresponding time stamp. When the
4104cursor is at a previously used time stamp, it is updated to NOW. When
4105this command is used twice in succession, a time range is inserted.
4106@c
4107@kindex C-u C-c .
4108@item C-u C-c .
4109Like @kbd{C-c .}, but use the alternative format which contains date
4110and time. The default time can be rounded to multiples of 5 minutes,
4111see the option @code{org-time-stamp-rounding-minutes}.
4112@c
4113@kindex C-c !
4114@item C-c !
4115Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
4116an agenda entry.
4117@c
4118@kindex C-c <
4119@item C-c <
4120Insert a time stamp corresponding to the cursor date in the Calendar.
4121@c
4122@kindex C-c >
4123@item C-c >
4124Access the Emacs calendar for the current date. If there is a
a7808fba 4125timestamp in the current line, go to the corresponding date
4009494e
GM
4126instead.
4127@c
4128@kindex C-c C-o
4129@item C-c C-o
4130Access the agenda for the date given by the time stamp or -range at
a7808fba 4131point (@pxref{Weekly/daily agenda}).
4009494e
GM
4132@c
4133@kindex S-@key{left}
4134@kindex S-@key{right}
4135@item S-@key{left}
4136@itemx S-@key{right}
4137Change date at cursor by one day. These key bindings conflict with
a7808fba 4138CUA mode (@pxref{Conflicts}).
4009494e
GM
4139@c
4140@kindex S-@key{up}
4141@kindex S-@key{down}
4142@item S-@key{up}
4143@itemx S-@key{down}
4144Change the item under the cursor in a timestamp. The cursor can be on a
4145year, month, day, hour or minute. Note that if the cursor is in a
4146headline and not at a time stamp, these same keys modify the priority of
4147an item. (@pxref{Priorities}). The key bindings also conflict with
a7808fba 4148CUA mode (@pxref{Conflicts}).
4009494e
GM
4149@c
4150@kindex C-c C-y
4151@cindex evaluate time range
4152@item C-c C-y
a7808fba
CD
4153Evaluate a time range by computing the difference between start and end.
4154With a prefix argument, insert result after the time range (in a table: into
4155the following column).
4009494e
GM
4156@end table
4157
4158
4159@menu
a7808fba
CD
4160* The date/time prompt:: How Org mode helps you entering date and time
4161* Custom time format:: Making dates look different
4009494e
GM
4162@end menu
4163
4164@node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
4165@subsection The date/time prompt
4166@cindex date, reading in minibuffer
4167@cindex time, reading in minibuffer
4168
a7808fba 4169When Org mode prompts for a date/time, the default is shown as an ISO
dbc28aaa
CD
4170date, and the prompt therefore seems to ask for an ISO date. But it
4171will in fact accept any string containing some date and/or time
4172information, and it is really smart about interpreting your input. You
4173can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
a7808fba 4174copied from an email message. Org mode will find whatever information
dbc28aaa
CD
4175is in there and derive anything you have not specified from the
4176@emph{default date and time}. The default is usually the current date
4177and time, but when modifying an existing time stamp, or when entering
4178the second stamp of a range, it is taken from the stamp in the buffer.
a7808fba 4179When filling in information, Org mode assumes that most of the time you
dbc28aaa
CD
4180will want to enter a date in the future: If you omit the month/year and
4181the given day/month is @i{before} today, it will assume that you mean a
4182future date@footnote{See the variable
4183@code{org-read-date-prefer-future}.}.
4184
4185For example, lets assume that today is @b{June 13, 2006}. Here is how
a7808fba 4186various inputs will be interpreted, the items filled in by Org mode are
dbc28aaa
CD
4187in @b{bold}.
4188
4189@example
41903-2-5 --> 2003-02-05
419114 --> @b{2006}-@b{06}-14
419212 --> @b{2006}-@b{07}-12
4193Fri --> nearest Friday (defaultdate or later)
4194sep 15 --> @b{2006}-11-15
4195feb 15 --> @b{2007}-02-15
4196sep 12 9 --> 2009-09-12
419712:45 --> @b{2006}-@b{06}-@b{13} 12:45
419822 sept 0:34 --> @b{2006}-09-22 0:34
a7808fba
CD
4199w4 --> ISO week for of the current year @b{2006}
42002012 w4 fri --> Friday of ISO week 4 in 2012
42012012-w04-5 --> Same as above
dbc28aaa
CD
4202@end example
4203
4204Furthermore you can specify a relative date by giving, as the
4205@emph{first} thing in the input: a plus/minus sign, a number and a
4206letter [dwmy] to indicate change in days weeks, months, years. With a
4207single plus or minus, the date is always relative to today. With a
4208double plus or minus, it is relative to the default date. If instead of
4209a single letter, you use the abbreviation of day name, the date will be
4210the nth such day. E.g.
4211
4212@example
4213+4d --> four days from today
4214+4 --> same as above
4215+2w --> two weeks from today
4216++5 --> five days from default date
4217+2tue --> second tuesday from now.
4009494e
GM
4218@end example
4219
4220The function understands English month and weekday abbreviations. If
4221you want to use unabbreviated names and/or other languages, configure
4222the variables @code{parse-time-months} and @code{parse-time-weekdays}.
4223
4224@cindex calendar, for selecting date
4225Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
4226you don't need/want the calendar, configure the variable
4227@code{org-popup-calendar-for-date-prompt}.}. When you exit the date
4228prompt, either by clicking on a date in the calendar, or by pressing
4229@key{RET}, the date selected in the calendar will be combined with the
4230information entered at the prompt. You can control the calendar fully
4231from the minibuffer:
4232
4009494e 4233@kindex <
4009494e 4234@kindex >
4009494e 4235@kindex mouse-1
4009494e 4236@kindex S-@key{right}
4009494e 4237@kindex S-@key{left}
4009494e 4238@kindex S-@key{down}
4009494e 4239@kindex S-@key{up}
4009494e 4240@kindex M-S-@key{right}
4009494e 4241@kindex M-S-@key{left}
4009494e 4242@kindex @key{RET}
dbc28aaa
CD
4243@example
4244> / < @r{Scroll calendar forward/backward by one month.}
4245mouse-1 @r{Select date by clicking on it.}
4246S-@key{right}/@key{left} @r{One day forward/backward.}
4247S-@key{down}/@key{up} @r{One week forward/backward.}
4248M-S-@key{right}/@key{left} @r{One month forward/backward.}
4249@key{RET} @r{Choose date in calendar.}
4250@end example
4251
a7808fba
CD
4252The actions of the date/time prompt may seem complex, but I assure you they
4253will grow on you, and you will start getting annoyed by pretty much any other
4254way of entering a date/time out there. To help you understand what is going
4255on, the current interpretation of your input will be displayed live in the
4256minibuffer@footnote{If you find this distracting, turn the display of with
4257@code{org-read-date-display-live}.}.
4009494e
GM
4258
4259@node Custom time format, , The date/time prompt, Creating timestamps
4260@subsection Custom time format
4261@cindex custom date/time format
4262@cindex time format, custom
4263@cindex date format, custom
4264
a7808fba 4265Org mode uses the standard ISO notation for dates and times as it is
4009494e
GM
4266defined in ISO 8601. If you cannot get used to this and require another
4267representation of date and time to keep you happy, you can get it by
4268customizing the variables @code{org-display-custom-times} and
4269@code{org-time-stamp-custom-formats}.
4270
4271@table @kbd
4272@kindex C-c C-x C-t
4273@item C-c C-x C-t
4274Toggle the display of custom formats for dates and times.
4275@end table
4276
4277@noindent
a7808fba 4278Org mode needs the default format for scanning, so the custom date/time
4009494e
GM
4279format does not @emph{replace} the default format - instead it is put
4280@emph{over} the default format using text properties. This has the
4281following consequences:
4282@itemize @bullet
28a16a1b 4283@item
4009494e
GM
4284You cannot place the cursor onto a time stamp anymore, only before or
4285after.
4286@item
4287The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
4288each component of a time stamp. If the cursor is at the beginning of
4289the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
4290just like @kbd{S-@key{left}/@key{right}}. At the end of the stamp, the
4291time will be changed by one minute.
4292@item
4293If the time stamp contains a range of clock times or a repeater, these
4294will not be overlayed, but remain in the buffer as they were.
4295@item
4296When you delete a time stamp character-by-character, it will only
4297disappear from the buffer after @emph{all} (invisible) characters
4298belonging to the ISO timestamp have been removed.
4299@item
4300If the custom time stamp format is longer than the default and you are
4301using dates in tables, table alignment will be messed up. If the custom
4302format is shorter, things do work as expected.
4303@end itemize
4304
4305
a7808fba
CD
4306@node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
4307@section Deadlines and scheduling
4009494e 4308
dbc28aaa 4309A time stamp may be preceded by special keywords to facilitate planning:
4009494e
GM
4310
4311@table @var
4312@item DEADLINE
4313@cindex DEADLINE keyword
dbc28aaa
CD
4314
4315Meaning: the task (most likely a TODO item, though not necessarily) is supposed
4316to be finished on that date.
4317
4318On the deadline date, the task will be listed in the agenda. In
4319addition, the agenda for @emph{today} will carry a warning about the
4320approaching or missed deadline, starting
4321@code{org-deadline-warning-days} before the due date, and continuing
4322until the entry is marked DONE. An example:
4009494e
GM
4323
4324@example
4325*** TODO write article about the Earth for the Guide
4326 The editor in charge is [[bbdb:Ford Prefect]]
4327 DEADLINE: <2004-02-29 Sun>
4328@end example
4329
4330You can specify a different lead time for warnings for a specific
4331deadlines using the following syntax. Here is an example with a warning
4332period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
4333
4334@item SCHEDULED
4335@cindex SCHEDULED keyword
dbc28aaa
CD
4336
4337Meaning: you are planning to start working on that task on the given
4338date.
4339
4340The headline will be listed under the given date@footnote{It will still
4341be listed on that date after it has been marked DONE. If you don't like
4009494e
GM
4342this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In
4343addition, a reminder that the scheduled date has passed will be present
4344in the compilation for @emph{today}, until the entry is marked DONE.
4345I.e., the task will automatically be forwarded until completed.
4346
4347@example
4348*** TODO Call Trillian for a date on New Years Eve.
4349 SCHEDULED: <2004-12-25 Sat>
4350@end example
dbc28aaa
CD
4351
4352@noindent
a7808fba 4353@b{Important:} Scheduling an item in Org mode should @i{not} be
dbc28aaa
CD
4354understood in the same way that we understand @i{scheduling a meeting}.
4355Setting a date for a meeting is just a simple appointment, you should
4356mark this entry with a simple plain time stamp, to get this item shown
4357on the date where it applies. This is a frequent mis-understanding from
a7808fba 4358Org-users. In Org mode, @i{scheduling} means setting a date when you
dbc28aaa 4359want to start working on an action item.
4009494e
GM
4360@end table
4361
dbc28aaa 4362You may use time stamps with repeaters in scheduling and deadline
a7808fba 4363entries. Org mode will issue early and late warnings based on the
dbc28aaa
CD
4364assumption that the time stamp represents the @i{nearest instance} of
4365the repeater. However, the use of diary sexp entries like
4366@c
4367@code{<%%(diary-float t 42)>}
4368@c
a7808fba 4369in scheduling and deadline timestamps is limited. Org mode does not
dbc28aaa
CD
4370know enough about the internals of each sexp function to issue early and
4371late warnings. However, it will show the item on each day where the
4372sexp entry matches.
4373
4009494e
GM
4374@menu
4375* Inserting deadline/schedule:: Planning items
4376* Repeated tasks:: Items that show up again and again
4377@end menu
4378
4379@node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
a7808fba 4380@subsection Inserting deadlines or schedules
4009494e
GM
4381
4382The following commands allow to quickly insert a deadline or to schedule
4383an item:
4384
4385@table @kbd
4386@c
4387@kindex C-c C-d
4388@item C-c C-d
4389Insert @samp{DEADLINE} keyword along with a stamp. The insertion will
dbc28aaa
CD
4390happen in the line directly following the headline. When called with a
4391prefix arg, an existing deadline will be removed from the entry.
4009494e
GM
4392@c FIXME Any CLOSED timestamp will be removed.????????
4393@c
dbc28aaa 4394@kindex C-c / d
4009494e 4395@cindex sparse tree, for deadlines
dbc28aaa 4396@item C-c / d
4009494e
GM
4397Create a sparse tree with all deadlines that are either past-due, or
4398which will become due within @code{org-deadline-warning-days}.
4399With @kbd{C-u} prefix, show all deadlines in the file. With a numeric
dbc28aaa 4400prefix, check that many days. For example, @kbd{C-1 C-c / d} shows
4009494e
GM
4401all deadlines due tomorrow.
4402@c
4403@kindex C-c C-s
4404@item C-c C-s
4405Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will
4406happen in the line directly following the headline. Any CLOSED
dbc28aaa
CD
4407timestamp will be removed. When called with a prefix argument, remove
4408the scheduling date from the entry.
4009494e
GM
4409@end table
4410
4411@node Repeated tasks, , Inserting deadline/schedule, Deadlines and scheduling
a7808fba 4412@subsection Repeated tasks
4009494e 4413
a7808fba 4414Some tasks need to be repeated again and again. Org mode helps to
28a16a1b
CD
4415organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
4416or plain time stamp. In the following example
4009494e
GM
4417@example
4418** TODO Pay the rent
4419 DEADLINE: <2005-10-01 Sat +1m>
4420@end example
dbc28aaa
CD
4421the @code{+1m} is a repeater; the intended interpretation is that the
4422task has a deadline on <2005-10-01> and repeats itself every (one) month
28a16a1b
CD
4423starting from that time. If you need both a repeater and a special
4424warning period in a deadline entry, the repeater comes first and the
4425warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
4009494e
GM
4426
4427Deadlines and scheduled items produce entries in the agenda when they
4428are over-due, so it is important to be able to mark such an entry as
4429completed once you have done so. When you mark a DEADLINE or a SCHEDULE
a7808fba 4430with the TODO keyword DONE, it will no longer produce entries in the
28a16a1b 4431agenda. The problem with this is, however, that then also the
a7808fba 4432@emph{next} instance of the repeated entry will not be active. Org mode
4009494e
GM
4433deals with this in the following way: When you try to mark such an entry
4434DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
4435time stamp by the repeater interval, and immediately set the entry state
4436back to TODO. In the example above, setting the state to DONE would
4437actually switch the date like this:
4438
4439@example
4440** TODO Pay the rent
4441 DEADLINE: <2005-11-01 Tue +1m>
4442@end example
4443
a7808fba
CD
4444A timestamp@footnote{You can change this using the option
4445@code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
4446@code{lognoterepeat}, and @code{nologrepeat}. With @code{lognoterepeat}, you
4447will aslo be prompted for a note.} will be added under the deadline, to keep
4448a record that you actually acted on the previous instance of this deadline.
4009494e
GM
4449
4450As a consequence of shifting the base date, this entry will no longer be
4451visible in the agenda when checking past dates, but all future instances
4452will be visible.
4453
28a16a1b
CD
4454With the @samp{+1m} cookie, the date shift will always be exactly one
4455month. So if you have not payed the rent for three months, marking this
4456entry DONE will still keep it as an overdue deadline. Depending on the
4457task, this may not be the best way to handle it. For example, if you
4458forgot to call you father for 3 weeks, it does not make sense to call
a7808fba 4459him 3 times in a single day to make up for it. Finally, there are tasks
28a16a1b 4460like changing batteries which should always repeat a certain time
a7808fba
CD
4461@i{after} the last time you did it. For these tasks, Org mode has
4462special repeaters markers with @samp{++} and @samp{.+}. For example:
28a16a1b
CD
4463
4464@example
4465** TODO Call Father
4466 DEADLINE: <2008-02-10 Sun ++1w>
4467 Marking this DONE will shift the date by at least one week,
4468 but also by as many weeks as it takes to get this date into
4469 the future. However, it stays on a Sunday, even if you called
4470 and marked it done on Saturday.
4471** TODO Check the batteries in the smoke detectors
4472 DEADLINE: <2005-11-01 Tue .+1m>
4473 Marking this DONE will shift the date to one month after
4474 today.
4475@end example
4476
4009494e
GM
4477You may have both scheduling and deadline information for a specific
4478task - just make sure that the repeater intervals on both are the same.
4479
a7808fba 4480@node Clocking work time, Effort estimates, Deadlines and scheduling, Dates and Times
dbc28aaa 4481@section Clocking work time
4009494e 4482
a7808fba 4483Org mode allows you to clock the time you spent on specific tasks in a
4009494e
GM
4484project. When you start working on an item, you can start the clock.
4485When you stop working on that task, or when you mark the task done, the
4486clock is stopped and the corresponding time interval is recorded. It
4487also computes the total time spent on each subtree of a project.
4488
4489@table @kbd
4490@kindex C-c C-x C-i
4491@item C-c C-x C-i
4492Start the clock on the current item (clock-in). This inserts the CLOCK
dbc28aaa
CD
4493keyword together with a timestamp. If this is not the first clocking of
4494this item, the multiple CLOCK lines will be wrapped into a
4495@code{:CLOCK:} drawer (see also the variable
a7808fba
CD
4496@code{org-clock-into-drawer}). When called with a @kbd{C-u} prefix argument,
4497select the task from a list of recently clocked tasks. With two @kbd{C-u
4498C-u} prefixes, clock into the task at point and mark it as the default task.
4499The default task will always be available when selecting a clocking task,
4500with letter @kbd{d}.
4009494e
GM
4501@kindex C-c C-x C-o
4502@item C-c C-x C-o
4503Stop the clock (clock-out). The inserts another timestamp at the same
4504location where the clock was last started. It also directly computes
4505the resulting time in inserts it after the time range as @samp{=>
28a16a1b
CD
4506HH:MM}. See the variable @code{org-log-note-clock-out} for the
4507possibility to record an additional note together with the clock-out
4508time stamp@footnote{The corresponding in-buffer setting is:
4509@code{#+STARTUP: lognoteclock-out}}.
4009494e
GM
4510@kindex C-c C-y
4511@item C-c C-y
4512Recompute the time interval after changing one of the time stamps. This
4513is only necessary if you edit the time stamps directly. If you change
4514them with @kbd{S-@key{cursor}} keys, the update is automatic.
4515@kindex C-c C-t
4516@item C-c C-t
4517Changing the TODO state of an item to DONE automatically stops the clock
4518if it is running in this same item.
4519@kindex C-c C-x C-x
4520@item C-c C-x C-x
4521Cancel the current clock. This is useful if a clock was started by
4522mistake, or if you ended up working on something else.
dbc28aaa
CD
4523@kindex C-c C-x C-j
4524@item C-c C-x C-j
a7808fba
CD
4525Jump to the entry that contains the currently running clock. With a
4526@kbd{C-u} prefix arg, select the target task from a list of recently clocked
4527tasks.
4009494e
GM
4528@kindex C-c C-x C-d
4529@item C-c C-x C-d
4530Display time summaries for each subtree in the current buffer. This
4531puts overlays at the end of each headline, showing the total time
4532recorded under that heading, including the time of any subheadings. You
4533can use visibility cycling to study the tree, but the overlays disappear
4534when you change the buffer (see variable
4535@code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
4536@kindex C-c C-x C-r
4537@item C-c C-x C-r
4538Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
a7808fba 4539report as an Org mode table into the current file. When the cursor is
dbc28aaa
CD
4540at an existing clock table, just update it. When called with a prefix
4541argument, jump to the first clock report in the current document and
4542update it.
4009494e 4543@example
dbc28aaa 4544#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
4009494e
GM
4545#+END: clocktable
4546@end example
4547@noindent
dbc28aaa
CD
4548If such a block already exists at point, its content is replaced by the
4549new table. The @samp{BEGIN} line can specify options:
4009494e 4550@example
dbc28aaa 4551:maxlevel @r{Maximum level depth to which times are listed in the table.}
4009494e 4552:emphasize @r{When @code{t}, emphasize level one and level two items}
dbc28aaa
CD
4553:scope @r{The scope to consider. This can be any of the following:}
4554 nil @r{the current buffer or narrowed region}
4555 file @r{the full current buffer}
4556 subtree @r{the subtree where the clocktable is located}
4557 treeN @r{the surrounding level N tree, for example @code{tree3}}
4558 tree @r{the surrounding level 1 tree}
4559 agenda @r{all agenda files}
4560 ("file"..) @r{scan these files}
a7808fba
CD
4561 file-with-archives @r{current file and its archives}
4562 agenda-with-archives @r{all agenda files, including archives}
4563:block @r{The time block to consider. This block is specified either}
4564 @r{absolute, or relative to the current time and may be any of}
4565 @r{these formats:}
4566 2007-12-31 @r{New year eve 2007}
4567 2007-12 @r{December 2007}
4568 2007-W50 @r{ISO-week 50 in 2007}
4569 2007 @r{the year 2007}
4570 today, yesterday, today-N @r{a relative day}
4571 thisweek, lastweek, thisweek-N @r{a relative week}
4572 thismonth, lastmonth, thismonth-N @r{a relative month}
4573 thisyear, lastyear, thisyear-N @r{a relative year}
4574 @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
4009494e
GM
4575:tstart @r{A time string specifying when to start considering times}
4576:tend @r{A time string specifying when to stop considering times}
a7808fba
CD
4577:step @r{@code{week} or @code{day}, to split the table into chunks.}
4578 @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
28a16a1b 4579:link @r{Link the item headlines in the table to their origins}
4009494e 4580@end example
dbc28aaa
CD
4581So to get a clock summary of the current level 1 tree, for the current
4582day, you could write
4009494e 4583@example
a7808fba 4584#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
4009494e
GM
4585#+END: clocktable
4586@end example
4587and to use a specific time range you could write@footnote{Note that all
4588parameters must be specified in a single line - the line is broken here
4589only to fit it onto the manual.}
4590@example
28a16a1b 4591#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
4009494e 4592 :tend "<2006-08-10 Thu 12:00>"
4009494e
GM
4593#+END: clocktable
4594@end example
dbc28aaa
CD
4595@kindex C-c C-c
4596@item C-c C-c
4597@kindex C-c C-x C-u
4598@itemx C-c C-x C-u
4599Update dynamical block at point. The cursor needs to be in the
4600@code{#+BEGIN} line of the dynamic block.
4009494e
GM
4601@kindex C-u C-c C-x C-u
4602@item C-u C-c C-x C-u
4603Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
a7808fba
CD
4604you have several clock table blocks in a buffer.
4605@kindex S-@key{left}
4606@kindex S-@key{right}
4607@item S-@key{left}
4608@itemx S-@key{right}
4609Shift the current @code{:block} interval and update the table. The cursor
4610needs to be in the @code{#+BEGIN: clocktable} line for this command. If
4611@code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
4009494e
GM
4612@end table
4613
4614The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
a7808fba 4615the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
4009494e
GM
4616worked on or closed during a day.
4617
a7808fba
CD
4618@node Effort estimates
4619@section Effort estimates
4620@cindex Effort estimates
4621
4622If you want to plan your work in a very detailed way, or if you need to
4623produce offers with quotations of the estimated work effort, you may want to
4624assign effort estimates to entries. If you are also clocking your work, you
4625may later want to compare the planned effort with the actual working time, a
4626great way to improve planning estimates. Effort estimates are stored in a
4627special property @samp{Effort}@footnote{You may change the property being
4628used with the variable @code{org-effort-property}.}. Clearly the best way to
4629work with effort estimates is through column view (@pxref{Column view}). You
4630should start by setting up discrete values for effort estimates, and a
4631@code{COLUMNS} format that displays these values together with clock sums (if
4632you want to clock your time). For a specific buffer you can use
4633
4634@example
4635#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00
4636#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
4637@end example
4638
4639@noindent
4640or you can set up these values globally by customizing the variables
4641@code{org-global-properties} and @code{org-columns-default-format}. In
4642particular if you want to use this setup also in the agenda, a global setup
4643may be advised.
4644
4645The way to assign estimates to individual items is then to switch to column
4646mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the
4647value. The values you enter will immediately be summed up in the hierarchy.
4648In the column next to it, any clocked time will be displayed.
4649
4650If you switch to column view in the daily/weekly agenda, the effort column
4651will summarize the estimated work effort for each day@footnote{Please note
4652the pitfalls of summing hierarchical data in a flat list (@pxref{Agenda
4653column view}.}, and you can use this to find space in your schedule. To get
4654an overview of the entire part of the day that is committed, you can set the
4655option @code{org-agenda-columns-add-appointments-to-effort-sum}. The
4656appointments on a day that take place over a specified time interval will
4657then also be added to the load estimate of the day.
4658
4659@node Remember, Agenda Views, Dates and Times, Top
dbc28aaa
CD
4660@chapter Remember
4661@cindex @file{remember.el}
4662
4663The @i{Remember} package by John Wiegley lets you store quick notes with
4664little interruption of your work flow. See
4665@uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
4666information. It is an excellent way to add new notes and tasks to
a7808fba 4667Org files. Org significantly expands the possibilities of
dbc28aaa
CD
4668@i{remember}: You may define templates for different note types, and
4669associate target files and headlines with specific templates. It also
4670allows you to select the location where a note should be stored
4671interactively, on the fly.
4672
4673@menu
a7808fba 4674* Setting up Remember:: Some code for .emacs to get things going
dbc28aaa
CD
4675* Remember templates:: Define the outline of different note types
4676* Storing notes:: Directly get the note to where it belongs
4677* Refiling notes:: Moving a note or task to a project
4678@end menu
4679
a7808fba
CD
4680@node Setting up Remember, Remember templates, Remember, Remember
4681@section Setting up Remember
dbc28aaa
CD
4682
4683The following customization will tell @i{remember} to use org files as
a7808fba 4684target, and to create annotations compatible with Org links.
dbc28aaa
CD
4685
4686@example
4687(org-remember-insinuate)
4688(setq org-directory "~/path/to/my/orgfiles/")
4689(setq org-default-notes-file (concat org-directory "/notes.org"))
4690(define-key global-map "\C-cr" 'org-remember)
4691@end example
4692
4693The last line binds the command @code{org-remember} to a global
4694key@footnote{Please select your own key, @kbd{C-c r} is only a
4695suggestion.}. @code{org-remember} basically just calls @code{remember},
4696but it makes a few things easier: If there is an active region, it will
4697automatically copy the region into the remember buffer. It also allows
4698to jump to the buffer and location where remember notes are being
28a16a1b 4699stored: Just call @code{org-remember} with a prefix argument. If you
a7808fba 4700use two prefix arguments, Org jumps to the location where the last
28a16a1b 4701remember note was stored.
dbc28aaa 4702
a7808fba 4703@node Remember templates, Storing notes, Setting up Remember, Remember
dbc28aaa
CD
4704@section Remember templates
4705@cindex templates, for remember
4706
a7808fba 4707In combination with Org, you can use templates to generate
dbc28aaa
CD
4708different types of @i{remember} notes. For example, if you would like
4709to use one template to create general TODO entries, another one for
4710journal entries, and a third one for collecting random ideas, you could
4711use:
4712
4713@example
4714(setq org-remember-templates
4715 '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks")
4716 ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
4717 ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
4718@end example
4719
4720@noindent In these entries, the first string is just a name, and the
4721character specifies how to select the template. It is useful if the
4722character is also the first letter of the name. The next string
4723specifies the template. Two more (optional) strings give the file in
4724which, and the headline under which the new note should be stored. The
4725file (if not present or @code{nil}) defaults to
4726@code{org-default-notes-file}, the heading to
a7808fba
CD
4727@code{org-remember-default-headline}. If the file name is not an
4728absolute path, it will be interpreted relative to @code{org-directory}.
dbc28aaa 4729
28a16a1b
CD
4730An optional sixth element specifies the contexts in which the user can
4731select the template. This element can be either a list of major modes
4732or a function. @code{org-remember} will first check whether the function
a7808fba 4733returns @code{t} or if we are in any of the listed major mode, and select
28a16a1b
CD
4734the template accordingly.
4735
4736So for example:
4737
4738@example
4739(setq org-remember-templates
4740 '(("Bug" ?b "* BUG %?\n %i\n %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
4741 ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" my-check)
4742 ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
4743@end example
4744
4745The first template will only be available when invoking @code{org-remember}
4746from an buffer in @code{emacs-lisp-mode}. The second template will only be
4747available when the function @code{my-check} returns @code{t}. The third
4748template will be proposed in any context.
4749
dbc28aaa
CD
4750When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember
4751something, org will prompt for a key to select the template (if you have
4752more than one template) and then prepare the buffer like
4753@example
4754* TODO
4755 [[file:link to where you called remember]]
4756@end example
4757
4758@noindent
4759During expansion of the template, special @kbd{%}-escapes allow dynamic
4760insertion of content:
4761@example
4762%^@{prompt@} @r{prompt the user for a string and replace this sequence with it.}
4763 @r{You may specify a default value and a completion table with}
4764 @r{%^@{prompt|default|completion2|completion3...@}}
4765 @r{The arrow keys access a prompt-specific history.}
4766%t @r{time stamp, date only}
4767%T @r{time stamp with date and time}
4768%u, %U @r{like the above, but inactive time stamps}
4769%^t @r{like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}}
4770 @r{You may define a prompt like @code{%^@{Birthday@}t}}
4771%n @r{user name (taken from @code{user-full-name})}
4772%a @r{annotation, normally the link created with @code{org-store-link}}
4773%A @r{like @code{%a}, but prompt for the description part}
4774%i @r{initial content, the region when remember is called with C-u.}
4775 @r{The entire text will be indented like @code{%i} itself.}
a7808fba
CD
4776%c @r{Current kill ring head.}
4777%x @r{Content of the X clipboard.}
4778%^C @r{Interactive selection of which kill or clip to use.}
4779%^L @r{Like @code{%^C}, but insert as link.}
dbc28aaa
CD
4780%^g @r{prompt for tags, with completion on tags in target file.}
4781%^G @r{prompt for tags, with completion all tags in all agenda files.}
4782%:keyword @r{specific information for certain link types, see below}
4783%[pathname] @r{insert the contents of the file given by @code{pathname}}
4784%(sexp) @r{evaluate elisp @code{(sexp)} and replace with the result}
4785%! @r{immediately store note after completing the template}
4786 @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
4787@end example
4788
4789@noindent
4790For specific link types, the following keywords will be
4791defined@footnote{If you define your own link types (@pxref{Adding
4792hyperlink types}), any property you store with
4793@code{org-store-link-props} can be accessed in remember templates in a
4794similar way.}:
4795
4796@example
4797Link type | Available keywords
4798-------------------+----------------------------------------------
4799bbdb | %:name %:company
28a16a1b 4800bbdb | %::server %:port %:nick
dbc28aaa
CD
4801vm, wl, mh, rmail | %:type %:subject %:message-id
4802 | %:from %:fromname %:fromaddress
4803 | %:to %:toname %:toaddress
28a16a1b 4804 | %:fromto @r{(either "to NAME" or "from NAME")@footnote{This will always be the other, not the user. See the variable @code{org-from-is-user-regexp}.}}
dbc28aaa
CD
4805gnus | %:group, @r{for messages also all email fields}
4806w3, w3m | %:url
4807info | %:file %:node
4808calendar | %:date"
4809@end example
4810
4811@noindent
4812To place the cursor after template expansion use:
4813
4814@example
4815%? @r{After completing the template, position cursor here.}
4816@end example
4817
4818@noindent
28a16a1b 4819If you change your mind about which template to use, call
dbc28aaa
CD
4820@code{org-remember} in the remember buffer. You may then select a new
4821template that will be filled with the previous context information.
4822
4823@node Storing notes, Refiling notes, Remember templates, Remember
4824@section Storing notes
4825
4826When you are finished preparing a note with @i{remember}, you have to
4827press @kbd{C-c C-c} to file the note away. The handler will store the
4828note in the file and under the headline specified in the template, or it
4829will use the default file and headlines. The window configuration will
4830be restored, sending you back to the working context before the call to
4831@code{remember}. To re-use the location found during the last call to
4832@code{remember}, exit the remember buffer with @kbd{C-u C-u C-c C-c},
4833i.e. specify a double prefix argument to @kbd{C-c C-c}.
4834
4835If you want to store the note directly to a different place, use
4836@kbd{C-u C-c C-c} instead to exit remember@footnote{Configure the
4837variable @code{org-remember-store-without-prompt} to make this behavior
4838the default.}. The handler will then first prompt for a target file -
4839if you press @key{RET}, the value specified for the template is used.
4840Then the command offers the headings tree of the selected file, with the
4841cursor position at the default headline (if you had specified one in the
4842template). You can either immediately press @key{RET} to get the note
4843placed there. Or you can use the following keys to find a different
4844location:
4845@example
4846@key{TAB} @r{Cycle visibility.}
4847@key{down} / @key{up} @r{Next/previous visible headline.}
4848n / p @r{Next/previous visible headline.}
4849f / b @r{Next/previous headline same level.}
4850u @r{One level up.}
4851@c 0-9 @r{Digit argument.}
4852@end example
4853@noindent
4854Pressing @key{RET} or @key{left} or @key{right}
4855then leads to the following result.
4856
4857@multitable @columnfractions 0.2 0.15 0.65
4858@item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
4859@item on headline @tab @key{RET} @tab as sublevel of the heading at cursor, first or last
4860@item @tab @tab depending on @code{org-reverse-note-order}.
4861@item @tab @key{left}/@key{right} @tab as same level, before/after current heading
4862@item buffer-start @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
4863@item @tab @tab depending on @code{org-reverse-note-order}.
4864@item not on headline @tab @key{RET}
4865 @tab at cursor position, level taken from context.
4866@end multitable
4867
4868Before inserting the text into a tree, the function ensures that the
4869text has a headline, i.e. a first line that starts with a @samp{*}. If
4870not, a headline is constructed from the current date and some additional
4871data. If you have indented the text of the note below the headline, the
4872indentation will be adapted if inserting the note into the tree requires
4873demotion from level 1.
4874
4875@node Refiling notes, , Storing notes, Remember
4876@section Refiling notes
4877@cindex refiling notes
4878
4879Remember is usually used to quickly capture notes and tasks into one or
4880a few capture lists. When reviewing the captured data, you may want to
4881refile some of the entries into a different list, for example into a
4882project. Cutting, finding the right location and then pasting the note
4883is cumbersome. To simplify this process, you can use the following
4884special command:
4885
4886@table @kbd
4887@kindex C-c C-w
4888@item C-c C-w
4889Refile the entry at point. This command offers possible locations for
4890refiling the entry and lets you select one with completion. The item is
4891filed below the target heading as a subitem. Depending on
4892@code{org-reverse-note-order}, it will be either the first of last
28a16a1b
CD
4893subitem.@* By default, all level 1 headlines in the current buffer are
4894considered to be targets, but you can have more complex definitions
4895across a number of files. See the variable @code{org-refile-targets}
4896for details.
4897@kindex C-u C-c C-w
4898@item C-u C-c C-w
4899Use the refile interface to jump to a heading.
4900@kindex C-u C-u C-c C-w
a7808fba 4901@item C-u C-u C-c C-w
28a16a1b 4902Jump to the location where @code{org-refile} last moved a tree to.
dbc28aaa
CD
4903@end table
4904
a7808fba 4905@node Agenda Views, Embedded LaTeX, Remember, Top
4009494e
GM
4906@chapter Agenda Views
4907@cindex agenda views
4908
a7808fba 4909Due to the way Org works, TODO items, time-stamped items, and
4009494e 4910tagged headlines can be scattered throughout a file or even a number of
dbc28aaa
CD
4911files. To get an overview of open action items, or of events that are
4912important for a particular date, this information must be collected,
4009494e
GM
4913sorted and displayed in an organized way.
4914
a7808fba 4915Org can select items based on various criteria, and display them
28a16a1b 4916in a separate buffer. Seven different view types are provided:
4009494e
GM
4917
4918@itemize @bullet
4919@item
4920an @emph{agenda} that is like a calendar and shows information
4921for specific dates,
4922@item
4923a @emph{TODO list} that covers all unfinished
4924action items,
4925@item
4926a @emph{tags view}, showings headlines based on
4927the tags associated with them,
4928@item
a7808fba 4929a @emph{timeline view} that shows all events in a single Org file,
4009494e
GM
4930in time-sorted view,
4931@item
28a16a1b
CD
4932a @emph{keyword search view} that shows all entries from multiple files
4933that contain specified keywords.
4934@item
4009494e
GM
4935a @emph{stuck projects view} showing projects that currently don't move
4936along, and
4937@item
4938@emph{custom views} that are special tag/keyword searches and
4939combinations of different views.
4940@end itemize
4941
4942@noindent
4943The extracted information is displayed in a special @emph{agenda
4944buffer}. This buffer is read-only, but provides commands to visit the
a7808fba 4945corresponding locations in the original Org files, and even to
28a16a1b 4946edit these files remotely.
4009494e
GM
4947
4948Two variables control how the agenda buffer is displayed and whether the
4949window configuration is restored when the agenda exits:
4950@code{org-agenda-window-setup} and
4951@code{org-agenda-restore-windows-after-quit}.
4952
4953@menu
4954* Agenda files:: Files being searched for agenda information
4955* Agenda dispatcher:: Keyboard access to agenda views
4956* Built-in agenda views:: What is available out of the box?
4957* Presentation and sorting:: How agenda items are prepared for display
a7808fba 4958* Agenda commands:: Remote editing of Org trees
4009494e 4959* Custom agenda views:: Defining special searches and views
a7808fba 4960* Agenda column view:: Using column view for collected entries
4009494e
GM
4961@end menu
4962
a7808fba 4963@node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
4009494e
GM
4964@section Agenda files
4965@cindex agenda files
4966@cindex files for agenda
4967
dbc28aaa
CD
4968The information to be shown is normally collected from all @emph{agenda
4969files}, the files listed in the variable
4970@code{org-agenda-files}@footnote{If the value of that variable is not a
4971list, but a single file name, then the list of agenda files will be
4972maintained in that external file.}. If a directory is part of this list,
4973all files with the extension @file{.org} in this directory will be part
4974of the list.
4975
a7808fba 4976Thus even if you only work with a single Org file, this file should
dbc28aaa
CD
4977be put into that list@footnote{When using the dispatcher, pressing
4978@kbd{<} before selecting a command will actually limit the command to
4979the current file, and ignore @code{org-agenda-files} until the next
4009494e
GM
4980dispatcher command.}. You can customize @code{org-agenda-files}, but
4981the easiest way to maintain it is through the following commands
4982
4983@cindex files, adding to agenda list
4984@table @kbd
4985@kindex C-c [
4986@item C-c [
4987Add current file to the list of agenda files. The file is added to
4988the front of the list. If it was already in the list, it is moved to
a7808fba 4989the front. With a prefix argument, file is added/moved to the end.
4009494e
GM
4990@kindex C-c ]
4991@item C-c ]
4992Remove current file from the list of agenda files.
4993@kindex C-,
4994@kindex C-'
4995@item C-,
4996@itemx C-'
4997Cycle through agenda file list, visiting one file after the other.
a7808fba
CD
4998@kindex M-x org-iswitchb
4999@item M-x org-iswitchb
5000Command to use an @code{iswitchb}-like interface to switch to and between Org
5001buffers.
4009494e
GM
5002@end table
5003
5004@noindent
5005The Org menu contains the current list of files and can be used
5006to visit any of them.
5007
dbc28aaa
CD
5008If you would like to focus the agenda temporarily onto a file not in
5009this list, or onto just one file in the list or even only a subtree in a
5010file, this can be done in different ways. For a single agenda command,
5011you may press @kbd{<} once or several times in the dispatcher
5012(@pxref{Agenda dispatcher}). To restrict the agenda scope for an
5013extended period, use the following commands:
5014
5015@table @kbd
5016@kindex C-c C-x <
5017@item C-c C-x <
5018Permanently restrict the agenda to the current subtree. When with a
5019prefix argument, or with the cursor before the first headline in a file,
5020the agenda scope is set to the entire file. This restriction remains in
5021effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
5022or @kbd{>} in the agenda dispatcher. If there is a window displaying an
5023agenda view, the new restriction takes effect immediately.
5024@kindex C-c C-x <
5025@item C-c C-x <
5026Remove the permanent restriction created by @kbd{C-c C-x <}.
5027@end table
5028
5029@noindent
5030When working with @file{Speedbar}, you can use the following commands in
a7808fba 5031the Speedbar frame:
dbc28aaa
CD
5032@table @kbd
5033@kindex <
5034@item < @r{in the speedbar frame}
5035Permanently restrict the agenda to the item at the cursor in the
a7808fba 5036Speedbar frame, either an Org file or a subtree in such a file.
dbc28aaa
CD
5037If there is a window displaying an agenda view, the new restriction takes
5038effect immediately.
5039@kindex <
5040@item > @r{in the speedbar frame}
5041Lift the restriction again.
5042@end table
5043
a7808fba 5044@node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
4009494e
GM
5045@section The agenda dispatcher
5046@cindex agenda dispatcher
5047@cindex dispatching agenda commands
5048The views are created through a dispatcher that should be bound to a
5049global key, for example @kbd{C-c a} (@pxref{Installation}). In the
5050following we will assume that @kbd{C-c a} is indeed how the dispatcher
5051is accessed and list keyboard access to commands accordingly. After
5052pressing @kbd{C-c a}, an additional letter is required to execute a
5053command. The dispatcher offers the following default commands:
5054@table @kbd
5055@item a
a7808fba 5056Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
4009494e
GM
5057@item t @r{/} T
5058Create a list of all TODO items (@pxref{Global TODO list}).
5059@item m @r{/} M
5060Create a list of headlines matching a TAGS expression (@pxref{Matching
5061tags and properties}).
5062@item L
5063Create the timeline view for the current buffer (@pxref{Timeline}).
28a16a1b
CD
5064@item s
5065Create a list of entries selected by a boolean expression of keywords
5066and/or regular expressions that must or must not occur in the entry.
dbc28aaa
CD
5067@item /
5068Search for a regular expression in all agenda files and additionally in
5069the files listed in @code{org-agenda-multi-occur-extra-files}. This
5070uses the Emacs command @code{multi-occur}. A prefix argument can be
5071used to specify the number of context lines for each match, default is
50721.
28a16a1b
CD
5073@item # @r{/} !
5074Create a list of stuck projects (@pxref{Stuck projects}).
dbc28aaa
CD
5075@item <
5076Restrict an agenda command to the current buffer@footnote{For backward
5077compatibility, you can also press @kbd{1} to restrict to the current
5078buffer.}. After pressing @kbd{<}, you still need to press the character
5079selecting the command.
5080@item < <
4009494e 5081If there is an active region, restrict the following agenda command to
dbc28aaa
CD
5082the region. Otherwise, restrict it to the current subtree@footnote{For
5083backward compatibility, you can also press @kbd{0} to restrict to the
5084current buffer.}. After pressing @kbd{< <}, you still need to press the
5085character selecting the command.
4009494e
GM
5086@end table
5087
5088You can also define custom commands that will be accessible through the
5089dispatcher, just like the default commands. This includes the
5090possibility to create extended agenda buffers that contain several
5091blocks together, for example the weekly agenda, the global TODO list and
5092a number of special tags matches. @xref{Custom agenda views}.
5093
a7808fba 5094@node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
4009494e
GM
5095@section The built-in agenda views
5096
5097In this section we describe the built-in views.
5098
5099@menu
a7808fba 5100* Weekly/daily agenda:: The calendar page with current tasks
4009494e
GM
5101* Global TODO list:: All unfinished action items
5102* Matching tags and properties:: Structured information with fine-tuned search
5103* Timeline:: Time-sorted view for single file
28a16a1b 5104* Keyword search:: Finding entries by keyword
4009494e
GM
5105* Stuck projects:: Find projects you need to review
5106@end menu
5107
a7808fba 5108@node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
4009494e
GM
5109@subsection The weekly/daily agenda
5110@cindex agenda
5111@cindex weekly agenda
5112@cindex daily agenda
5113
5114The purpose of the weekly/daily @emph{agenda} is to act like a page of a
5115paper agenda, showing all the tasks for the current week or day.
5116
5117@table @kbd
5118@cindex org-agenda, command
5119@kindex C-c a a
5120@item C-c a a
5121Compile an agenda for the current week from a list of org files. The
dbc28aaa
CD
5122agenda shows the entries for each day. With a numeric
5123prefix@footnote{For backward compatibility, the universal prefix
5124@kbd{C-u} causes all TODO entries to be listed before the agenda. This
5125feature is deprecated, use the dedicated TODO list, or a block agenda
5126instead.} (like @kbd{C-u 2 1 C-c a a}) you may set the number of days
5127to be displayed (see also the variable @code{org-agenda-ndays})
4009494e
GM
5128@end table
5129
5130Remote editing from the agenda buffer means, for example, that you can
5131change the dates of deadlines and appointments from the agenda buffer.
5132The commands available in the Agenda buffer are listed in @ref{Agenda
5133commands}.
5134
5135@subsubheading Calendar/Diary integration
5136@cindex calendar integration
5137@cindex diary integration
5138
5139Emacs contains the calendar and diary by Edward M. Reingold. The
5140calendar displays a three-month calendar with holidays from different
5141countries and cultures. The diary allows you to keep track of
5142anniversaries, lunar phases, sunrise/set, recurrent appointments
5143(weekly, monthly) and more. In this way, it is quite complementary to
a7808fba 5144Org. It can be very useful to combine output from Org with
4009494e
GM
5145the diary.
5146
a7808fba 5147In order to include entries from the Emacs diary into Org mode's
4009494e
GM
5148agenda, you only need to customize the variable
5149
5150@lisp
5151(setq org-agenda-include-diary t)
5152@end lisp
5153
5154@noindent After that, everything will happen automatically. All diary
5155entries including holidays, anniversaries etc will be included in the
a7808fba 5156agenda buffer created by Org mode. @key{SPC}, @key{TAB}, and
4009494e
GM
5157@key{RET} can be used from the agenda buffer to jump to the diary
5158file in order to edit existing diary entries. The @kbd{i} command to
5159insert new entries for the current date works in the agenda buffer, as
5160well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
5161Sunrise/Sunset times, show lunar phases and to convert to other
5162calendars, respectively. @kbd{c} can be used to switch back and forth
5163between calendar and agenda.
5164
5165If you are using the diary only for sexp entries and holidays, it is
5166faster to not use the above setting, but instead to copy or even move
a7808fba 5167the entries into an Org file. Org mode evaluates diary-style sexp
4009494e
GM
5168entries, and does it faster because there is no overhead for first
5169creating the diary display. Note that the sexp entries must start at
5170the left margin, no white space is allowed before them. For example,
a7808fba 5171the following segment of an Org file will be processed and entries
4009494e
GM
5172will be made in the agenda:
5173
5174@example
5175* Birthdays and similar stuff
5176#+CATEGORY: Holiday
5177%%(org-calendar-holiday) ; special function for holiday names
5178#+CATEGORY: Ann
5179%%(diary-anniversary 14 5 1956) Arthur Dent is %d years old
5180%%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old
5181@end example
5182
dbc28aaa
CD
5183@subsubheading Appointment reminders
5184@cindex @file{appt.el}
5185@cindex appointment reminders
5186
5187Org can interact with Emacs appointments notification facility.
5188
5189To add all the appointments of your agenda files, use the command
5190@code{org-agenda-to-appt}. This commands also lets you filter through
5191the list of your appointments and add only those belonging to a specific
5192category or matching a regular expression. See the docstring for
5193details.
5194
a7808fba 5195@node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
4009494e
GM
5196@subsection The global TODO list
5197@cindex global TODO list
5198@cindex TODO list, global
5199
5200The global TODO list contains all unfinished TODO items, formatted and
5201collected into a single place.
5202
5203@table @kbd
5204@kindex C-c a t
5205@item C-c a t
5206Show the global TODO list. This collects the TODO items from all
a7808fba 5207agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in
4009494e
GM
5208@code{agenda-mode}, so there are commands to examine and manipulate
5209the TODO entries directly from that buffer (@pxref{Agenda commands}).
5210@kindex C-c a T
5211@item C-c a T
5212@cindex TODO keyword matching
5213Like the above, but allows selection of a specific TODO keyword. You
5214can also do this by specifying a prefix argument to @kbd{C-c a t}. With
5215a @kbd{C-u} prefix you are prompted for a keyword, and you may also
5216specify several keywords by separating them with @samp{|} as boolean OR
5217operator. With a numeric prefix, the Nth keyword in
5218@code{org-todo-keywords} is selected.
5219@kindex r
5220The @kbd{r} key in the agenda buffer regenerates it, and you can give
5221a prefix argument to this command to change the selected TODO keyword,
5222for example @kbd{3 r}. If you often need a search for a specific
5223keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
5224Matching specific TODO keywords can also be done as part of a tags
5225search (@pxref{Tag searches}).
5226@end table
5227
5228Remote editing of TODO items means that you can change the state of a
5229TODO entry with a single key press. The commands available in the
5230TODO list are described in @ref{Agenda commands}.
5231
a7808fba
CD
5232@cindex sublevels, inclusion into TODO list
5233Normally the global TODO list simply shows all headlines with TODO
4009494e
GM
5234keywords. This list can become very long. There are two ways to keep
5235it more compact:
5236@itemize @minus
5237@item
5238Some people view a TODO item that has been @emph{scheduled} for
a7808fba 5239execution (@pxref{Timestamps}) as no longer @emph{open}. Configure the
4009494e
GM
5240variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
5241items from the global TODO list.
5242@item
5243TODO items may have sublevels to break up the task into subtasks. In
5244such cases it may be enough to list only the highest level TODO headline
5245and omit the sublevels from the global list. Configure the variable
5246@code{org-agenda-todo-list-sublevels} to get this behavior.
5247@end itemize
5248
5249@node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
a7808fba 5250@subsection Matching tags and properties
4009494e
GM
5251@cindex matching, of tags
5252@cindex matching, of properties
5253@cindex tags view
5254
5255If headlines in the agenda files are marked with @emph{tags}
5256(@pxref{Tags}), you can select headlines based on the tags that apply
5257to them and collect them into an agenda buffer.
5258
5259@table @kbd
5260@kindex C-c a m
5261@item C-c a m
5262Produce a list of all headlines that match a given set of tags. The
5263command prompts for a selection criterion, which is a boolean logic
dbc28aaa
CD
5264expression with tags, like @samp{+work+urgent-withboss} or
5265@samp{work|home} (@pxref{Tags}). If you often need a specific search,
4009494e
GM
5266define a custom command for it (@pxref{Agenda dispatcher}).
5267@kindex C-c a M
5268@item C-c a M
5269Like @kbd{C-c a m}, but only select headlines that are also TODO items
5270and force checking subitems (see variable
a7808fba 5271@code{org-tags-match-list-sublevels}). Matching specific TODO keywords
4009494e
GM
5272together with a tags match is also possible, see @ref{Tag searches}.
5273@end table
5274
5275The commands available in the tags list are described in @ref{Agenda
5276commands}.
5277
28a16a1b 5278@node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
4009494e
GM
5279@subsection Timeline for a single file
5280@cindex timeline, single file
5281@cindex time-sorted view
5282
a7808fba 5283The timeline summarizes all time-stamped items from a single Org mode
4009494e
GM
5284file in a @emph{time-sorted view}. The main purpose of this command is
5285to give an overview over events in a project.
5286
5287@table @kbd
5288@kindex C-c a L
5289@item C-c a L
5290Show a time-sorted view of the org file, with all time-stamped items.
5291When called with a @kbd{C-u} prefix, all unfinished TODO entries
5292(scheduled or not) are also listed under the current date.
5293@end table
5294
5295@noindent
5296The commands available in the timeline buffer are listed in
5297@ref{Agenda commands}.
5298
28a16a1b
CD
5299@node Keyword search, Stuck projects, Timeline, Built-in agenda views
5300@subsection Keyword search
5301@cindex keyword search
5302@cindex searching, for keywords
5303
a7808fba 5304This agenda view is a general text search facility for Org mode entries.
28a16a1b
CD
5305It is particularly useful to find notes.
5306
5307@table @kbd
5308@kindex C-c a s
5309@item C-c a s
5310This is a special search that lets you select entries by keywords or
5311regular expression, using a boolean logic. For example, the search
5312string
5313
5314@example
5315+computer +wifi -ethernet -@{8\.11[bg]@}
5316@end example
4009494e 5317
28a16a1b
CD
5318@noindent
5319will search for note entries that contain the keywords @code{computer}
5320and @code{wifi}, but not the keyword @code{ethernet}, and which are also
5321not matched by the regular expression @code{8\.11[bg]}, meaning to
5322exclude both 8.11b and 8.11g.
5323
5324Note that in addition to the agenda files, this command will also search
5325the files listed in @code{org-agenda-text-search-extra-files}.
5326@end table
5327
5328@node Stuck projects, , Keyword search, Built-in agenda views
4009494e
GM
5329@subsection Stuck projects
5330
5331If you are following a system like David Allen's GTD to organize your
5332work, one of the ``duties'' you have is a regular review to make sure
5333that all projects move along. A @emph{stuck} project is a project that
5334has no defined next actions, so it will never show up in the TODO lists
a7808fba 5335Org mode produces. During the review, you need to identify such
4009494e
GM
5336projects and define next actions for them.
5337
5338@table @kbd
5339@kindex C-c a #
5340@item C-c a #
5341List projects that are stuck.
5342@kindex C-c a !
5343@item C-c a !
5344Customize the variable @code{org-stuck-projects} to define what a stuck
5345project is and how to find it.
5346@end table
5347
5348You almost certainly will have to configure this view before it will
5349work for you. The built-in default assumes that all your projects are
5350level-2 headlines, and that a project is not stuck if it has at least
a7808fba 5351one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
4009494e 5352
a7808fba
CD
5353Lets assume that you, in your own way of using Org mode, identify
5354projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
4009494e 5355indicate a project that should not be considered yet. Lets further
a7808fba 5356assume that the TODO keyword DONE marks finished projects, and that NEXT
4009494e
GM
5357and TODO indicate next actions. The tag @@SHOP indicates shopping and
5358is a next action even without the NEXT tag. Finally, if the project
5359contains the special word IGNORE anywhere, it should not be listed
5360either. In this case you would start by identifying eligible projects
5361with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
5362TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
5363are not stuck. The correct customization for this is
5364
5365@lisp
5366(setq org-stuck-projects
5367 '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
5368 "\\<IGNORE\\>"))
5369@end lisp
5370
5371
a7808fba 5372@node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
4009494e
GM
5373@section Presentation and sorting
5374@cindex presentation, of agenda items
5375
a7808fba 5376Before displaying items in an agenda view, Org mode visually prepares
4009494e
GM
5377the items and sorts them. Each item occupies a single line. The line
5378starts with a @emph{prefix} that contains the @emph{category}
5379(@pxref{Categories}) of the item and other important information. You can
5380customize the prefix using the option @code{org-agenda-prefix-format}.
5381The prefix is followed by a cleaned-up version of the outline headline
5382associated with the item.
5383
5384@menu
5385* Categories:: Not all tasks are equal
5386* Time-of-day specifications:: How the agenda knows the time
5387* Sorting of agenda items:: The order of things
5388@end menu
5389
5390@node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
5391@subsection Categories
5392
5393@cindex category
5394The category is a broad label assigned to each agenda item. By default,
5395the category is simply derived from the file name, but you can also
dbc28aaa
CD
5396specify it with a special line in the buffer, like this@footnote{For
5397backward compatibility, the following also works: If there are several
5398such lines in a file, each specifies the category for the text below it.
5399The first category also applies to any text before the first CATEGORY
5400line. However, using this method is @emph{strongly} deprecated as it is
5401incompatible with the outline structure of the document. The correct
5402method for setting multiple categories in a buffer is using a
5403property.}:
4009494e
GM
5404
5405@example
5406#+CATEGORY: Thesis
5407@end example
5408
dbc28aaa
CD
5409@noindent
5410If you would like to have a special CATEGORY for a single entry or a
5411(sub)tree, give the entry a @code{:CATEGORY:} property with the location
a7808fba 5412as the value (@pxref{Properties and Columns}).
dbc28aaa
CD
5413
5414@noindent
5415The display in the agenda buffer looks best if the category is not
5416longer than 10 characters.
4009494e
GM
5417
5418@node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
a7808fba 5419@subsection Time-of-day specifications
4009494e
GM
5420@cindex time-of-day specification
5421
a7808fba 5422Org mode checks each agenda item for a time-of-day specification. The
4009494e
GM
5423time can be part of the time stamp that triggered inclusion into the
5424agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time
5425ranges can be specified with two time stamps, like
5426@c
5427@w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
5428
5429In the headline of the entry itself, a time(range) may also appear as
5430plain text (like @samp{12:45} or a @samp{8:30-1pm}. If the agenda
a7808fba 5431integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
4009494e
GM
5432specifications in diary entries are recognized as well.
5433
a7808fba 5434For agenda display, Org mode extracts the time and displays it in a
4009494e
GM
5435standard 24 hour format as part of the prefix. The example times in
5436the previous paragraphs would end up in the agenda like this:
5437
5438@example
5439 8:30-13:00 Arthur Dent lies in front of the bulldozer
5440 12:45...... Ford Prefect arrives and takes Arthur to the pub
5441 19:00...... The Vogon reads his poem
5442 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5443@end example
5444
5445@cindex time grid
5446If the agenda is in single-day mode, or for the display of today, the
5447timed entries are embedded in a time grid, like
5448
5449@example
5450 8:00...... ------------------
5451 8:30-13:00 Arthur Dent lies in front of the bulldozer
5452 10:00...... ------------------
5453 12:00...... ------------------
5454 12:45...... Ford Prefect arrives and takes Arthur to the pub
5455 14:00...... ------------------
5456 16:00...... ------------------
5457 18:00...... ------------------
5458 19:00...... The Vogon reads his poem
5459 20:00...... ------------------
5460 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5461@end example
5462
5463The time grid can be turned on and off with the variable
5464@code{org-agenda-use-time-grid}, and can be configured with
5465@code{org-agenda-time-grid}.
5466
5467@node Sorting of agenda items, , Time-of-day specifications, Presentation and sorting
5468@subsection Sorting of agenda items
5469@cindex sorting, of agenda items
5470@cindex priorities, of agenda items
5471Before being inserted into a view, the items are sorted. How this is
5472done depends on the type of view.
5473@itemize @bullet
5474@item
5475For the daily/weekly agenda, the items for each day are sorted. The
5476default order is to first collect all items containing an explicit
5477time-of-day specification. These entries will be shown at the beginning
5478of the list, as a @emph{schedule} for the day. After that, items remain
5479grouped in categories, in the sequence given by @code{org-agenda-files}.
5480Within each category, items are sorted by priority (@pxref{Priorities}),
5481which is composed of the base priority (2000 for priority @samp{A}, 1000
5482for @samp{B}, and 0 for @samp{C}), plus additional increments for
5483overdue scheduled or deadline items.
28a16a1b 5484@item
4009494e
GM
5485For the TODO list, items remain in the order of categories, but within
5486each category, sorting takes place according to priority
5487(@pxref{Priorities}).
5488@item
5489For tags matches, items are not sorted at all, but just appear in the
5490sequence in which they are found in the agenda files.
5491@end itemize
5492
5493Sorting can be customized using the variable
a7808fba
CD
5494@code{org-agenda-sorting-strategy}, and may also include criteria based on
5495the estimated effort of an entry.
5496@c FIXME: link!!!!!!!!
4009494e
GM
5497
5498
a7808fba 5499@node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
4009494e
GM
5500@section Commands in the agenda buffer
5501@cindex commands, in agenda buffer
5502
5503Entries in the agenda buffer are linked back to the org file or diary
5504file where they originate. You are not allowed to edit the agenda
5505buffer itself, but commands are provided to show and jump to the
5506original entry location, and to edit the org-files ``remotely'' from
5507the agenda buffer. In this way, all information is stored only once,
5508removing the risk that your agenda and note files may diverge.
5509
5510Some commands can be executed with mouse clicks on agenda lines. For
5511the other commands, the cursor needs to be in the desired line.
5512
5513@table @kbd
5514@tsubheading{Motion}
5515@cindex motion commands in agenda
5516@kindex n
5517@item n
dbc28aaa 5518Next line (same as @key{up} and @kbd{C-p}).
4009494e
GM
5519@kindex p
5520@item p
dbc28aaa 5521Previous line (same as @key{down} and @kbd{C-n}).
a7808fba 5522@tsubheading{View/Go to org file}
4009494e
GM
5523@kindex mouse-3
5524@kindex @key{SPC}
5525@item mouse-3
5526@itemx @key{SPC}
5527Display the original location of the item in another window.
5528@c
5529@kindex L
5530@item L
5531Display original location and recenter that window.
5532@c
5533@kindex mouse-2
5534@kindex mouse-1
5535@kindex @key{TAB}
5536@item mouse-2
5537@itemx mouse-1
5538@itemx @key{TAB}
5539Go to the original location of the item in another window. Under Emacs
554022, @kbd{mouse-1} will also works for this.
5541@c
5542@kindex @key{RET}
5543@itemx @key{RET}
5544Go to the original location of the item and delete other windows.
5545@c
5546@kindex f
5547@item f
5548Toggle Follow mode. In Follow mode, as you move the cursor through
5549the agenda buffer, the other window always shows the corresponding
5550location in the org file. The initial setting for this mode in new
5551agenda buffers can be set with the variable
5552@code{org-agenda-start-with-follow-mode}.
5553@c
5554@kindex b
5555@item b
a7808fba
CD
5556Display the entire subtree of the current item in an indirect buffer. With a
5557numeric prefix argument N, go up to level N and then take that tree. If N is
5558negative, go up that many levels. With a @kbd{C-u} prefix, do not remove the
5559previously used indirect buffer.
4009494e
GM
5560@c
5561@kindex l
5562@item l
5563Toggle Logbook mode. In Logbook mode, entries that where marked DONE while
5564logging was on (variable @code{org-log-done}) are shown in the agenda,
5565as are entries that have been clocked on that day.
a7808fba
CD
5566@c
5567@kindex R
5568@item R
5569Toggle Clockreport mode. In clockreport mode, the daily/weekly agenda will
5570always show a table with the clocked times for the timespan and file scope
5571covered by the current agenda view. The initial setting for this mode in new
5572agenda buffers can be set with the variable
5573@code{org-agenda-start-with-clockreport-mode}.
4009494e
GM
5574
5575@tsubheading{Change display}
5576@cindex display changing, in agenda
5577@kindex o
5578@item o
5579Delete other windows.
5580@c
5581@kindex d
5582@kindex w
5583@kindex m
5584@kindex y
5585@item d w m y
5586Switch to day/week/month/year view. When switching to day or week view,
a7808fba
CD
5587this setting becomes the default for subsequent agenda commands. Since
5588month and year views are slow to create, they do not become the default.
5589A numeric prefix argument may be used to jump directly to a specific day
5590of the year, ISO week, month, or year, respectively. For example,
5591@kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9. When
5592setting day, week, or month view, a year may be encoded in the prefix
5593argument as well. For example, @kbd{200712 w} will jump to week 12 in
55942007. If such a year specification has only one or two digits, it will
5595be mapped to the interval 1938-2037.
4009494e
GM
5596@c
5597@kindex D
5598@item D
a7808fba 5599Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
4009494e 5600@c
28a16a1b
CD
5601@kindex G
5602@item G
4009494e
GM
5603Toggle the time grid on and off. See also the variables
5604@code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
5605@c
5606@kindex r
5607@item r
5608Recreate the agenda buffer, for example to reflect the changes
5609after modification of the time stamps of items with S-@key{left} and
a7808fba 5610S-@key{right}. When the buffer is the global TODO list, a prefix
4009494e
GM
5611argument is interpreted to create a selective list for a specific TODO
5612keyword.
28a16a1b
CD
5613@kindex g
5614@item g
5615Same as @kbd{r}.
4009494e
GM
5616@c
5617@kindex s
dbc28aaa 5618@kindex C-x C-s
4009494e 5619@item s
dbc28aaa 5620@itemx C-x C-s
a7808fba 5621Save all Org buffers in the current Emacs session.
4009494e
GM
5622@c
5623@kindex @key{right}
5624@item @key{right}
5625Display the following @code{org-agenda-ndays} days. For example, if
5626the display covers a week, switch to the following week. With prefix
5627arg, go forward that many times @code{org-agenda-ndays} days.
5628@c
5629@kindex @key{left}
5630@item @key{left}
5631Display the previous dates.
5632@c
5633@kindex .
5634@item .
a7808fba
CD
5635Go to today.
5636@c
5637@kindex C-c C-x C-c
5638@item C-c C-x C-c
5639Invoke column view (@pxref{Column view}) in the agenda buffer. The column
5640view format is taken from the entry at point, or (if there is no entry at
5641point), from the first entry in the agenda view. So whatever the format for
5642that entry would be in the original buffer (taken from a property, from a
5643@code{#+COLUMNS} line, or from the default variable
5644@code{org-columns-default-format}), will be used in the agenda.
4009494e 5645
28a16a1b
CD
5646@tsubheading{Query editing}
5647@cindex query editing, in agenda
5648
5649@kindex [
5650@kindex ]
5651@kindex @{
5652@kindex @}
5653@item [ ] @{ @}
5654In the @i{search view} (@pxref{Keyword search}), these keys add new
5655search words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{}
5656and @kbd{@}}) to the query string. The opening bracket/brace will add a
5657positive search term prefixed by @samp{+}, indicating that this search
5658term @i{must} occur/match in the entry. Closing bracket/brace add a
5659negative search term which @i{must not} occur/match in the entry for it
5660to be selected.
5661
5662
4009494e
GM
5663@tsubheading{Remote editing}
5664@cindex remote editing, from agenda
5665
5666@item 0-9
5667Digit argument.
5668@c
5669@cindex undoing remote-editing events
5670@cindex remote editing, undo
5671@kindex C-_
5672@item C-_
5673Undo a change due to a remote editing command. The change is undone
5674both in the agenda buffer and in the remote buffer.
5675@c
5676@kindex t
5677@item t
5678Change the TODO state of the item, both in the agenda and in the
5679original org file.
5680@c
5681@kindex C-k
5682@item C-k
5683Delete the current agenda item along with the entire subtree belonging
a7808fba 5684to it in the original Org file. If the text to be deleted remotely
4009494e
GM
5685is longer than one line, the kill needs to be confirmed by the user. See
5686variable @code{org-agenda-confirm-kill}.
5687@c
a7808fba
CD
5688@kindex a
5689@item a
5690Toggle the ARCHIVE tag for the current headline.
5691@c
5692@kindex A
5693@item A
5694Move the subtree correspoding to the current entry to its @emph{Archive
5695Sibling}.
5696@c
4009494e
GM
5697@kindex $
5698@item $
a7808fba
CD
5699Archive the subtree corresponding to the current headline. This means the
5700entry will be moved to the configured archive locatin, most likely a
5701different file.
4009494e
GM
5702@c
5703@kindex T
5704@item T
5705Show all tags associated with the current item. Because of
5706inheritance, this may be more than the tags listed in the line itself.
5707@c
5708@kindex :
5709@item :
dbc28aaa
CD
5710Set tags for the current headline. If there is an active region in the
5711agenda, change a tag for all headings in the region.
4009494e 5712@c
4009494e
GM
5713@kindex ,
5714@item ,
a7808fba 5715Set the priority for the current item. Org mode prompts for the
4009494e
GM
5716priority character. If you reply with @key{SPC}, the priority cookie
5717is removed from the entry.
5718@c
5719@kindex P
5720@item P
5721Display weighted priority of current item.
5722@c
5723@kindex +
5724@kindex S-@key{up}
5725@item +
5726@itemx S-@key{up}
5727Increase the priority of the current item. The priority is changed in
5728the original buffer, but the agenda is not resorted. Use the @kbd{r}
5729key for this.
5730@c
5731@kindex -
5732@kindex S-@key{down}
5733@item -
5734@itemx S-@key{down}
5735Decrease the priority of the current item.
5736@c
5737@kindex C-c C-s
5738@item C-c C-s
5739Schedule this item
5740@c
5741@kindex C-c C-d
5742@item C-c C-d
5743Set a deadline for this item.
5744@c
5745@kindex S-@key{right}
5746@item S-@key{right}
a7808fba
CD
5747Change the time stamp associated with the current line by one day into the
5748future. With a numeric prefix argument, change it by that many days. For
5749example, @kbd{3 6 5 S-@key{right}} will change it by a year. The stamp is
5750changed in the original org file, but the change is not directly reflected in
5751the agenda buffer. Use the @kbd{r} key to update the buffer.
4009494e
GM
5752@c
5753@kindex S-@key{left}
5754@item S-@key{left}
5755Change the time stamp associated with the current line by one day
5756into the past.
5757@c
5758@kindex >
5759@item >
5760Change the time stamp associated with the current line to today.
5761The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
5762on my keyboard.
5763@c
5764@kindex I
5765@item I
5766Start the clock on the current item. If a clock is running already, it
5767is stopped first.
5768@c
5769@kindex O
5770@item O
5771Stop the previously started clock.
5772@c
5773@kindex X
5774@item X
5775Cancel the currently running clock.
5776
dbc28aaa
CD
5777@kindex J
5778@item J
5779Jump to the running clock in another window.
5780
4009494e
GM
5781@tsubheading{Calendar commands}
5782@cindex calendar commands, from agenda
5783@kindex c
5784@item c
5785Open the Emacs calendar and move to the date at the agenda cursor.
5786@c
5787@item c
a7808fba 5788When in the calendar, compute and show the Org mode agenda for the
4009494e
GM
5789date at the cursor.
5790@c
5791@cindex diary entries, creating from agenda
5792@kindex i
5793@item i
5794Insert a new entry into the diary. Prompts for the type of entry
5795(day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
5796entry in the diary, just as @kbd{i d} etc. would do in the calendar.
5797The date is taken from the cursor position.
5798@c
5799@kindex M
5800@item M
5801Show the phases of the moon for the three months around current date.
5802@c
5803@kindex S
5804@item S
5805Show sunrise and sunset times. The geographical location must be set
5806with calendar variables, see documentation of the Emacs calendar.
5807@c
5808@kindex C
5809@item C
5810Convert the date at cursor into many other cultural and historic
5811calendars.
5812@c
5813@kindex H
5814@item H
5815Show holidays for three month around the cursor date.
a7808fba
CD
5816
5817@item M-x org-export-icalendar-combine-agenda-files
4009494e 5818Export a single iCalendar file containing entries from all agenda files.
a7808fba 5819This is a globally available command, and also available in the agenda menu.
4009494e
GM
5820
5821@tsubheading{Exporting to a file}
5822@kindex C-x C-w
5823@item C-x C-w
5824@cindex exporting agenda views
5825@cindex agenda views, exporting
5826Write the agenda view to a file. Depending on the extension of the
5827selected file name, the view will be exported as HTML (extension
5828@file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
5829plain text (any other extension). Use the variable
5830@code{org-agenda-exporter-settings} to set options for @file{ps-print}
5831and for @file{htmlize} to be used during export.
5832
5833@tsubheading{Quit and Exit}
5834@kindex q
5835@item q
5836Quit agenda, remove the agenda buffer.
5837@c
5838@kindex x
5839@cindex agenda files, removing buffers
5840@item x
5841Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
5842for the compilation of the agenda. Buffers created by the user to
5843visit org files will not be removed.
5844@end table
5845
5846
a7808fba 5847@node Custom agenda views, Agenda column view, Agenda commands, Agenda Views
4009494e
GM
5848@section Custom agenda views
5849@cindex custom agenda views
5850@cindex agenda views, custom
5851
5852Custom agenda commands serve two purposes: to store and quickly access
5853frequently used TODO and tags searches, and to create special composite
5854agenda buffers. Custom agenda commands will be accessible through the
5855dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
5856
5857@menu
5858* Storing searches:: Type once, use often
5859* Block agenda:: All the stuff you need in a single buffer
5860* Setting Options:: Changing the rules
a7808fba
CD
5861* Exporting Agenda Views:: Writing agendas to files
5862* Using the agenda elsewhere:: Using agenda information in other programs
4009494e
GM
5863@end menu
5864
5865@node Storing searches, Block agenda, Custom agenda views, Custom agenda views
5866@subsection Storing searches
5867
5868The first application of custom searches is the definition of keyboard
5869shortcuts for frequently used searches, either creating an agenda
5870buffer, or a sparse tree (the latter covering of course only the current
5871buffer).
5872@kindex C-c a C
5873Custom commands are configured in the variable
5874@code{org-agenda-custom-commands}. You can customize this variable, for
5875example by pressing @kbd{C-c a C}. You can also directly set it with
5876Emacs Lisp in @file{.emacs}. The following example contains all valid
5877search types:
5878
5879@lisp
5880@group
5881(setq org-agenda-custom-commands
5882 '(("w" todo "WAITING")
5883 ("W" todo-tree "WAITING")
dbc28aaa
CD
5884 ("u" tags "+boss-urgent")
5885 ("v" tags-todo "+boss-urgent")
5886 ("U" tags-tree "+boss-urgent")
5887 ("f" occur-tree "\\<FIXME\\>")
5888 ("h" . "HOME+Name tags searches") ; description for "h" prefix
5889 ("hl" tags "+home+Lisa")
5890 ("hp" tags "+home+Peter")
5891 ("hk" tags "+home+Kim")))
4009494e
GM
5892@end group
5893@end lisp
5894
5895@noindent
dbc28aaa
CD
5896The initial string in each entry defines the keys you have to press
5897after the dispatcher command @kbd{C-c a} in order to access the command.
5898Usually this will be just a single character, but if you have many
5899similar commands, you can also define two-letter combinations where the
5900first character is the same in several combinations and serves as a
5901prefix key@footnote{You can provide a description for a prefix key by
5902inserting a cons cell with the prefix and the description.}. The second
5903parameter is the search type, followed by the string or regular
5904expression to be used for the matching. The example above will
5905therefore define:
4009494e
GM
5906
5907@table @kbd
5908@item C-c a w
5909as a global search for TODO entries with @samp{WAITING} as the TODO
5910keyword
5911@item C-c a W
5912as the same search, but only in the current buffer and displaying the
5913results as a sparse tree
5914@item C-c a u
dbc28aaa
CD
5915as a global tags search for headlines marked @samp{:boss:} but not
5916@samp{:urgent:}
4009494e
GM
5917@item C-c a v
5918as the same search as @kbd{C-c a u}, but limiting the search to
5919headlines that are also TODO items
5920@item C-c a U
5921as the same search as @kbd{C-c a u}, but only in the current buffer and
5922displaying the result as a sparse tree
5923@item C-c a f
5924to create a sparse tree (again: current buffer only) with all entries
dbc28aaa
CD
5925containing the word @samp{FIXME}
5926@item C-c a h
5927as a prefix command for a HOME tags search where you have to press an
5928additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
5929Peter, or Kim) as additional tag to match.
4009494e
GM
5930@end table
5931
5932@node Block agenda, Setting Options, Storing searches, Custom agenda views
5933@subsection Block agenda
5934@cindex block agenda
5935@cindex agenda, with block views
5936
5937Another possibility is the construction of agenda views that comprise
5938the results of @emph{several} commands, each of which creates a block in
5939the agenda buffer. The available commands include @code{agenda} for the
5940daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
a7808fba 5941for the global TODO list (as constructed with @kbd{C-c a t}), and the
4009494e
GM
5942matching commands discussed above: @code{todo}, @code{tags}, and
5943@code{tags-todo}. Here are two examples:
5944
5945@lisp
5946@group
5947(setq org-agenda-custom-commands
5948 '(("h" "Agenda and Home-related tasks"
28a16a1b 5949 ((agenda "")
dbc28aaa
CD
5950 (tags-todo "home")
5951 (tags "garden")))
4009494e 5952 ("o" "Agenda and Office-related tasks"
28a16a1b 5953 ((agenda "")
dbc28aaa
CD
5954 (tags-todo "work")
5955 (tags "office")))))
4009494e
GM
5956@end group
5957@end lisp
5958
5959@noindent
5960This will define @kbd{C-c a h} to create a multi-block view for stuff
5961you need to attend to at home. The resulting agenda buffer will contain
5962your agenda for the current week, all TODO items that carry the tag
dbc28aaa 5963@samp{home}, and also all lines tagged with @samp{garden}. Finally the
4009494e
GM
5964command @kbd{C-c a o} provides a similar view for office tasks.
5965
4009494e 5966@node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
a7808fba 5967@subsection Setting options for custom commands
4009494e
GM
5968@cindex options, for custom agenda views
5969
a7808fba 5970Org mode contains a number of variables regulating agenda construction
4009494e
GM
5971and display. The global variables define the behavior for all agenda
5972commands, including the custom commands. However, if you want to change
5973some settings just for a single custom view, you can do so. Setting
5974options requires inserting a list of variable names and values at the
5975right spot in @code{org-agenda-custom-commands}. For example:
5976
5977@lisp
5978@group
5979(setq org-agenda-custom-commands
5980 '(("w" todo "WAITING"
5981 ((org-agenda-sorting-strategy '(priority-down))
5982 (org-agenda-prefix-format " Mixed: ")))
dbc28aaa 5983 ("U" tags-tree "+boss-urgent"
4009494e 5984 ((org-show-following-heading nil)
28a16a1b
CD
5985 (org-show-hierarchy-above nil)))
5986 ("N" search ""
5987 ((org-agenda-files '("~org/notes.org"))
5988 (org-agenda-text-search-extra-files nil)))))
4009494e
GM
5989@end group
5990@end lisp
5991
5992@noindent
5993Now the @kbd{C-c a w} command will sort the collected entries only by
dbc28aaa 5994priority, and the prefix format is modified to just say @samp{ Mixed: }
4009494e
GM
5995instead of giving the category of the entry. The sparse tags tree of
5996@kbd{C-c a U} will now turn out ultra-compact, because neither the
5997headline hierarchy above the match, nor the headline following the match
28a16a1b
CD
5998will be shown. The command @kbd{C-c a N} will do a text search limited
5999to only a single file.
4009494e
GM
6000
6001For command sets creating a block agenda,
6002@code{org-agenda-custom-commands} has two separate spots for setting
6003options. You can add options that should be valid for just a single
6004command in the set, and options that should be valid for all commands in
6005the set. The former are just added to the command entry, the latter
6006must come after the list of command entries. Going back to the block
6007agenda example (@pxref{Block agenda}), let's change the sorting strategy
6008for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
6009the results for GARDEN tags query in the opposite order,
6010@code{priority-up}. This would look like this:
6011
6012@lisp
6013@group
6014(setq org-agenda-custom-commands
6015 '(("h" "Agenda and Home-related tasks"
6016 ((agenda)
dbc28aaa
CD
6017 (tags-todo "home")
6018 (tags "garden"
4009494e
GM
6019 ((org-agenda-sorting-strategy '(priority-up)))))
6020 ((org-agenda-sorting-strategy '(priority-down))))
6021 ("o" "Agenda and Office-related tasks"
6022 ((agenda)
dbc28aaa
CD
6023 (tags-todo "work")
6024 (tags "office")))))
4009494e
GM
6025@end group
6026@end lisp
6027
6028As you see, the values and parenthesis setting is a little complex.
6029When in doubt, use the customize interface to set this variable - it
6030fully supports its structure. Just one caveat: When setting options in
6031this interface, the @emph{values} are just lisp expressions. So if the
6032value is a string, you need to add the double quotes around the value
6033yourself.
6034
6035
a7808fba 6036@node Exporting Agenda Views, Using the agenda elsewhere, Setting Options, Custom agenda views
4009494e
GM
6037@subsection Exporting Agenda Views
6038@cindex agenda views, exporting
6039
6040If you are away from your computer, it can be very useful to have a
a7808fba 6041printed version of some agenda views to carry around. Org mode can
4009494e 6042export custom agenda views as plain text, HTML@footnote{You need to
28a16a1b
CD
6043install Hrvoje Niksic' @file{htmlize.el}.} postscript, and iCalendar
6044files. If you want to do this only occasionally, use the command
4009494e
GM
6045
6046@table @kbd
6047@kindex C-x C-w
6048@item C-x C-w
6049@cindex exporting agenda views
6050@cindex agenda views, exporting
6051Write the agenda view to a file. Depending on the extension of the
6052selected file name, the view will be exported as HTML (extension
28a16a1b
CD
6053@file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
6054iCalendar (extension @file{.ics}), or plain text (any other extension).
6055Use the variable @code{org-agenda-exporter-settings} to
6056set options for @file{ps-print} and for @file{htmlize} to be used during
6057export, for example
6058
4009494e
GM
6059@lisp
6060(setq org-agenda-exporter-settings
6061 '((ps-number-of-columns 2)
6062 (ps-landscape-mode t)
6063 (htmlize-output-type 'css)))
6064@end lisp
6065@end table
6066
6067If you need to export certain agenda views frequently, you can associate
6068any custom agenda command with a list of output file names
6069@footnote{If you want to store standard views like the weekly agenda
6070or the global TODO list as well, you need to define custom commands for
28a16a1b 6071them in order to be able to specify file names.}. Here is an example
4009494e
GM
6072that first does define custom commands for the agenda and the global
6073todo list, together with a number of files to which to export them.
28a16a1b 6074Then we define two block agenda commands and specify file names for them
4009494e
GM
6075as well. File names can be relative to the current working directory,
6076or absolute.
6077
6078@lisp
6079@group
6080(setq org-agenda-custom-commands
6081 '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
6082 ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
6083 ("h" "Agenda and Home-related tasks"
28a16a1b 6084 ((agenda "")
dbc28aaa
CD
6085 (tags-todo "home")
6086 (tags "garden"))
4009494e
GM
6087 nil
6088 ("~/views/home.html"))
6089 ("o" "Agenda and Office-related tasks"
6090 ((agenda)
dbc28aaa
CD
6091 (tags-todo "work")
6092 (tags "office"))
4009494e 6093 nil
28a16a1b 6094 ("~/views/office.ps" "~/calendars/office.ics"))))
4009494e
GM
6095@end group
6096@end lisp
6097
6098The extension of the file name determines the type of export. If it is
a7808fba 6099@file{.html}, Org mode will use the @file{htmlize.el} package to convert
4009494e
GM
6100the buffer to HTML and save it to this file name. If the extension is
6101@file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
28a16a1b
CD
6102postscript output. If the extension is @file{.ics}, iCalendar export is
6103run export over all files that were used to construct the agenda, and
6104limit the export to entries listed in the agenda now. Any other
6105extension produces a plain ASCII file.
4009494e
GM
6106
6107The export files are @emph{not} created when you use one of those
28a16a1b
CD
6108commands interactively because this might use too much overhead.
6109Instead, there is a special command to produce @emph{all} specified
6110files in one step:
4009494e
GM
6111
6112@table @kbd
6113@kindex C-c a e
6114@item C-c a e
28a16a1b 6115Export all agenda views that have export file names associated with
4009494e
GM
6116them.
6117@end table
6118
6119You can use the options section of the custom agenda commands to also
6120set options for the export commands. For example:
6121
6122@lisp
6123(setq org-agenda-custom-commands
6124 '(("X" agenda ""
6125 ((ps-number-of-columns 2)
6126 (ps-landscape-mode t)
6127 (org-agenda-prefix-format " [ ] ")
6128 (org-agenda-with-colors nil)
6129 (org-agenda-remove-tags t))
6130 ("theagenda.ps"))))
6131@end lisp
6132
6133@noindent
6134This command sets two options for the postscript exporter, to make it
6135print in two columns in landscape format - the resulting page can be cut
6136in two and then used in a paper agenda. The remaining settings modify
6137the agenda prefix to omit category and scheduling information, and
6138instead include a checkbox to check off items. We also remove the tags
6139to make the lines compact, and we don't want to use colors for the
6140black-and-white printer. Settings specified in
6141@code{org-agenda-exporter-settings} will also apply, but the settings
6142in @code{org-agenda-custom-commands} take precedence.
6143
6144@noindent
6145From the command line you may also use
6146@example
6147emacs -f org-batch-store-agenda-views -kill
6148@end example
6149@noindent
6150or, if you need to modify some parameters
6151@example
6152emacs -eval '(org-batch-store-agenda-views \
6153 org-agenda-ndays 30 \
dbc28aaa 6154 org-agenda-start-day "2007-11-01" \
4009494e
GM
6155 org-agenda-include-diary nil \
6156 org-agenda-files (quote ("~/org/project.org")))' \
6157 -kill
6158@end example
6159@noindent
6160which will create the agenda views restricted to the file
6161@file{~/org/project.org}, without diary entries and with 30 days
28a16a1b 6162extent.
4009494e 6163
a7808fba
CD
6164@node Using the agenda elsewhere, , Exporting Agenda Views, Custom agenda views
6165@subsection Using agenda information outside of Org
4009494e
GM
6166@cindex agenda, pipe
6167@cindex Scripts, for agenda processing
6168
a7808fba 6169Org provides commands to access agenda information for the command
4009494e
GM
6170line in emacs batch mode. This extracted information can be sent
6171directly to a printer, or it can be read by a program that does further
6172processing of the data. The first of these commands is the function
6173@code{org-batch-agenda}, that produces an agenda view and sends it as
6174ASCII text to STDOUT. The command takes a single string as parameter.
6175If the string has length 1, it is used as a key to one of the commands
6176you have configured in @code{org-agenda-custom-commands}, basically any
6177key you can use after @kbd{C-c a}. For example, to directly print the
6178current TODO list, you could use
6179
6180@example
6181emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
6182@end example
6183
6184If the parameter is a string with 2 or more characters, it is used as a
6185tags/todo match string. For example, to print your local shopping list
6186(all items with the tag @samp{shop}, but excluding the tag
6187@samp{NewYork}), you could use
6188
6189@example
28a16a1b 6190emacs -batch -l ~/.emacs \
4009494e
GM
6191 -eval '(org-batch-agenda "+shop-NewYork")' | lpr
6192@end example
6193
6194@noindent
6195You may also modify parameters on the fly like this:
6196
6197@example
6198emacs -batch -l ~/.emacs \
6199 -eval '(org-batch-agenda "a" \
6200 org-agenda-ndays 30 \
6201 org-agenda-include-diary nil \
6202 org-agenda-files (quote ("~/org/project.org")))' \
6203 | lpr
6204@end example
6205
6206@noindent
6207which will produce a 30 day agenda, fully restricted to the Org file
6208@file{~/org/projects.org}, not even including the diary.
6209
6210If you want to process the agenda data in more sophisticated ways, you
6211can use the command @code{org-batch-agenda-csv} to get a comma-separated
6212list of values for each agenda item. Each line in the output will
6213contain a number of fields separated by commas. The fields in a line
6214are:
6215
6216@example
6217category @r{The category of the item}
6218head @r{The headline, without TODO kwd, TAGS and PRIORITY}
6219type @r{The type of the agenda entry, can be}
6220 todo @r{selected in TODO match}
6221 tagsmatch @r{selected in tags match}
6222 diary @r{imported from diary}
6223 deadline @r{a deadline}
6224 scheduled @r{scheduled}
6225 timestamp @r{appointment, selected by timestamp}
6226 closed @r{entry was closed on date}
6227 upcoming-deadline @r{warning about nearing deadline}
6228 past-scheduled @r{forwarded scheduled item}
6229 block @r{entry has date block including date}
a7808fba 6230todo @r{The TODO keyword, if any}
4009494e
GM
6231tags @r{All tags including inherited ones, separated by colons}
6232date @r{The relevant date, like 2007-2-14}
6233time @r{The time, like 15:00-16:50}
6234extra @r{String with extra planning info}
6235priority-l @r{The priority letter if any was given}
6236priority-n @r{The computed numerical priority}
6237@end example
6238
6239@noindent
6240Time and date will only be given if a timestamp (or deadline/scheduled)
6241lead to the selection of the item.
6242
6243A CSV list like this is very easy to use in a post processing script.
6244For example, here is a Perl program that gets the TODO list from
a7808fba 6245Emacs/Org and prints all the items, preceded by a checkbox:
4009494e
GM
6246
6247@example
6248@group
6249#!/usr/bin/perl
6250
6251# define the Emacs command to run
6252$cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
6253
6254# run it and capture the output
6255$agenda = qx@{$cmd 2>/dev/null@};
6256
6257# loop over all lines
6258foreach $line (split(/\n/,$agenda)) @{
6259
6260 # get the individual values
6261 ($category,$head,$type,$todo,$tags,$date,$time,$extra,
6262 $priority_l,$priority_n) = split(/,/,$line);
6263
6264 # proccess and print
6265 print "[ ] $head\n";
6266@}
6267@end group
6268@end example
6269
a7808fba
CD
6270@node Agenda column view, , Custom agenda views, Agenda Views
6271@section Using column view in the agenda
6272@cindex column view, in agenda
6273@cindex agenda, column view
6274
6275Column view (@pxref{Column view}) is normally used to view and edit
6276properties embedded in the hierarchical structure of an Org file. It can be
6277quite useful to use column view also from the agenda, where entries are
6278collected by certain criteria.
6279
6280@table @kbd
6281@kindex C-c C-x C-c
6282@item C-c C-x C-c
6283Turn on column view in the agenda.
6284@end table
6285
6286To understand how to use this properly, it is important to realize that the
6287entries in the agenda are no longer in their proper outline environment.
6288This causes the following issues:
6289
6290@enumerate
6291@item
6292Org needs to make a decision which @code{COLUMNS} format to use. Since the
6293entries in the agenda are collected from different files, and different files
6294may have different @code{COLUMNS} formats, this is a non-trivial problem.
6295Org first checks if the variable @code{org-overriding-columns-format} is
6296currently set, and if yes takes the format from there. Otherwise it takes
6297the format associated with the first item in the agenda, or, if that item
6298does not have a specific format (defined in a property, or in it's file), it
6299uses @code{org-columns-default-format}.
6300@item
6301If any of the columns has a summary type defined (@pxref{Column attributes}),
6302turning on column view in the agenda will visit all relevant agenda files and
6303make sure that the computations of this property are up to date. This is
6304also true for the special @code{CLOCKSUM} property. Org will then sum the
6305values displayed in the agenda. In the daily/weekly agenda, the sums will
6306cover a single day, in all other views they cover the entire block. It is
6307vital to realize that the agenda may show the same entry @emph{twice} (for
6308example as scheduled and as a deadline), and it may show two entries from the
6309same hierarchy (for example a @emph{parent} and it's @emph{child}). In these
6310cases, the summation in the agenda will lead to incorrect results because
6311some values will count double.
6312@item
6313When the column view in the agenda shows the @code{CLOCKSUM}, that is always
6314the entire clocked time for this item. So even in the daily/weekly agenda,
6315the clocksum listed in column view may originate from times outside the
6316current view. This has the advantage that you can compare these values with
6317a column listing the planned total effort for a task - one of the major
6318applications for column view in the agenda. If you want information about
6319clocked time in the displayed period use clock table mode (press @kbd{R} in
6320the agenda).
6321@end enumerate
6322
6323
6324@node Embedded LaTeX, Exporting, Agenda Views, Top
4009494e
GM
6325@chapter Embedded LaTeX
6326@cindex @TeX{} interpretation
6327@cindex La@TeX{} interpretation
6328
6329Plain ASCII is normally sufficient for almost all note taking. One
a7808fba
CD
6330exception, however, are scientific notes which need to be able to contain
6331mathematical symbols and the occasional formula. La@TeX{}@footnote{La@TeX{}
6332is a macro system based on Donald E. Knuth's @TeX{} system. Many of the
6333features described here as ``La@TeX{}'' are really from @TeX{}, but for
6334simplicity I am blurring this distinction.} is widely used to typeset
6335scientific documents. Org mode supports embedding La@TeX{} code into its
6336files, because many academics are used to reading La@TeX{} source code, and
6337because it can be readily processed into images for HTML production.
4009494e
GM
6338
6339It is not necessary to mark La@TeX{} macros and code in any special way.
a7808fba 6340If you observe a few conventions, Org mode knows how to find it and what
4009494e
GM
6341to do with it.
6342
6343@menu
6344* Math symbols:: TeX macros for symbols and Greek letters
a7808fba 6345* Subscripts and superscripts:: Simple syntax for raising/lowering text
4009494e
GM
6346* LaTeX fragments:: Complex formulas made easy
6347* Processing LaTeX fragments:: Previewing LaTeX processing
6348* CDLaTeX mode:: Speed up entering of formulas
6349@end menu
6350
a7808fba 6351@node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
4009494e
GM
6352@section Math symbols
6353@cindex math symbols
6354@cindex TeX macros
6355
6356You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
6357to indicate the Greek letter, or @samp{\to} to indicate an arrow.
6358Completion for these macros is available, just type @samp{\} and maybe a
6359few letters, and press @kbd{M-@key{TAB}} to see possible completions.
a7808fba 6360Unlike La@TeX{} code, Org mode allows these macros to be present
4009494e
GM
6361without surrounding math delimiters, for example:
6362
6363@example
6364Angles are written as Greek letters \alpha, \beta and \gamma.
6365@end example
6366
6367During HTML export (@pxref{HTML export}), these symbols are translated
6368into the proper syntax for HTML, for the above examples this is
6369@samp{&alpha;} and @samp{&rarr;}, respectively.
6370
a7808fba
CD
6371@node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
6372@section Subscripts and superscripts
4009494e
GM
6373@cindex subscript
6374@cindex superscript
6375
6376Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
6377and subscripts. Again, these can be used without embedding them in
6378math-mode delimiters. To increase the readability of ASCII text, it is
6379not necessary (but OK) to surround multi-character sub- and superscripts
6380with curly braces. For example
6381
6382@example
6383The mass if the sun is M_sun = 1.989 x 10^30 kg. The radius of
6384the sun is R_@{sun@} = 6.96 x 10^8 m.
6385@end example
6386
6387To avoid interpretation as raised or lowered text, you can quote
6388@samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
6389
6390During HTML export (@pxref{HTML export}), subscript and superscripts
6391are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
6392
a7808fba 6393@node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
4009494e
GM
6394@section LaTeX fragments
6395@cindex LaTeX fragments
6396
6397With symbols, sub- and superscripts, HTML is pretty much at its end when
6398it comes to representing mathematical formulas@footnote{Yes, there is
6399MathML, but that is not yet fully supported by many browsers, and there
6400is no decent converter for turning La@TeX{} or ASCII representations of
6401formulas into MathML. So for the time being, converting formulas into
6402images seems the way to go.}. More complex expressions need a dedicated
a7808fba 6403formula processor. To this end, Org mode can contain arbitrary La@TeX{}
4009494e
GM
6404fragments. It provides commands to preview the typeset result of these
6405fragments, and upon export to HTML, all fragments will be converted to
6406images and inlined into the HTML document@footnote{The La@TeX{} export
6407will not use images for displaying La@TeX{} fragments but include these
6408fragments directly into the La@TeX{} code.}. For this to work you
6409need to be on a system with a working La@TeX{} installation. You also
6410need the @file{dvipng} program, available at
6411@url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
6412will be used when processing a fragment can be configured with the
6413variable @code{org-format-latex-header}.
6414
6415La@TeX{} fragments don't need any special marking at all. The following
6416snippets will be identified as La@TeX{} source code:
6417@itemize @bullet
6418@item
6419Environments of any kind. The only requirement is that the
6420@code{\begin} statement appears on a new line, preceded by only
6421whitespace.
6422@item
6423Text within the usual La@TeX{} math delimiters. To avoid conflicts with
6424currency specifications, single @samp{$} characters are only recognized
6425as math delimiters if the enclosed text contains at most two line breaks,
6426is directly attached to the @samp{$} characters with no whitespace in
6427between, and if the closing @samp{$} is followed by whitespace or
6428punctuation. For the other delimiters, there is no such restriction, so
6429when in doubt, use @samp{\(...\)} as inline math delimiters.
6430@end itemize
6431
6432@noindent For example:
6433
6434@example
6435\begin@{equation@} % arbitrary environments,
6436x=\sqrt@{b@} % even tables, figures
6437\end@{equation@} % etc
6438
6439If $a^2=b$ and \( b=2 \), then the solution must be
6440either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
6441@end example
6442
6443@noindent
6444If you need any of the delimiter ASCII sequences for other purposes, you
6445can configure the option @code{org-format-latex-options} to deselect the
6446ones you do not wish to have interpreted by the La@TeX{} converter.
6447
6448@node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
6449@section Processing LaTeX fragments
6450@cindex LaTeX fragments, preview
6451
6452La@TeX{} fragments can be processed to produce a preview images of the
6453typeset expressions:
6454
6455@table @kbd
6456@kindex C-c C-x C-l
6457@item C-c C-x C-l
6458Produce a preview image of the La@TeX{} fragment at point and overlay it
6459over the source code. If there is no fragment at point, process all
6460fragments in the current entry (between two headlines). When called
6461with a prefix argument, process the entire subtree. When called with
6462two prefix arguments, or when the cursor is before the first headline,
6463process the entire buffer.
6464@kindex C-c C-c
6465@item C-c C-c
6466Remove the overlay preview images.
6467@end table
6468
6469During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
6470converted into images and inlined into the document if the following
6471setting is active:
6472
6473@lisp
6474(setq org-export-with-LaTeX-fragments t)
6475@end lisp
6476
6477@node CDLaTeX mode, , Processing LaTeX fragments, Embedded LaTeX
6478@section Using CDLaTeX to enter math
6479@cindex CDLaTeX
6480
a7808fba 6481CDLaTeX mode is a minor mode that is normally used in combination with a
4009494e 6482major La@TeX{} mode like AUCTeX in order to speed-up insertion of
a7808fba
CD
6483environments and math templates. Inside Org mode, you can make use of
6484some of the features of CDLaTeX mode. You need to install
4009494e
GM
6485@file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
6486AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
a7808fba
CD
6487Don't use CDLaTeX mode itself under Org mode, but use the light
6488version @code{org-cdlatex-mode} that comes as part of Org mode. Turn it
4009494e 6489on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
a7808fba 6490Org files with
4009494e
GM
6491
6492@lisp
6493(add-hook 'org-mode-hook 'turn-on-org-cdlatex)
6494@end lisp
6495
6496When this mode is enabled, the following features are present (for more
a7808fba 6497details see the documentation of CDLaTeX mode):
4009494e
GM
6498@itemize @bullet
6499@kindex C-c @{
6500@item
6501Environment templates can be inserted with @kbd{C-c @{}.
6502@item
6503@kindex @key{TAB}
6504The @key{TAB} key will do template expansion if the cursor is inside a
a7808fba 6505La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
4009494e
GM
6506inside such a fragment, see the documentation of the function
6507@code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will
6508expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
6509correctly inside the first brace. Another @key{TAB} will get you into
6510the second brace. Even outside fragments, @key{TAB} will expand
6511environment abbreviations at the beginning of a line. For example, if
6512you write @samp{equ} at the beginning of a line and press @key{TAB},
6513this abbreviation will be expanded to an @code{equation} environment.
6514To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
6515@item
6516@kindex _
6517@kindex ^
6518Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
6519characters together with a pair of braces. If you use @key{TAB} to move
6520out of the braces, and if the braces surround only a single character or
6521macro, they are removed again (depending on the variable
6522@code{cdlatex-simplify-sub-super-scripts}).
6523@item
6524@kindex `
6525Pressing the backquote @kbd{`} followed by a character inserts math
6526macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds
6527after the backquote, a help window will pop up.
6528@item
6529@kindex '
6530Pressing the normal quote @kbd{'} followed by another character modifies
6531the symbol before point with an accent or a font. If you wait more than
65321.5 seconds after the backquote, a help window will pop up. Character
6533modification will work only inside La@TeX{} fragments, outside the quote
6534is normal.
6535@end itemize
6536
6537@node Exporting, Publishing, Embedded LaTeX, Top
6538@chapter Exporting
6539@cindex exporting
6540
a7808fba 6541Org mode documents can be exported into a variety of other formats. For
4009494e 6542printing and sharing of notes, ASCII export produces a readable and
a7808fba 6543simple version of an Org file. HTML export allows you to publish a
4009494e
GM
6544notes file on the web, while the XOXO format provides a solid base for
6545exchange with a broad range of other applications. La@TeX{} export lets
a7808fba 6546you use Org mode and its structured editing functions to easily create
4009494e
GM
6547La@TeX{} files. To incorporate entries with associated times like
6548deadlines or appointments into a desktop calendar program like iCal,
a7808fba
CD
6549Org mode can also produce extracts in the iCalendar format. Currently
6550Org mode only supports export, not import of these different formats.
4009494e 6551
a7808fba 6552When exporting, Org mode uses special conventions to enrich the output
4009494e
GM
6553produced. @xref{Text interpretation}, for more details.
6554
6555@table @kbd
6556@kindex C-c C-e
6557@item C-c C-e
6558Dispatcher for export and publishing commands. Displays a help-window
6559listing the additional key(s) needed to launch an export or publishing
a7808fba
CD
6560command. The prefix arg is passed through to the exporter. If the option
6561@code{org-export-run-in-background} is set, Org will run the command in the
6562background if that seems useful for the specific command (i.e. commands that
6563write to a file).
6564@kindex C-u C-u C-c C-e
6565@item C-u C-u C-c C-e
6566Call an the exporter, but reverse the setting of
6567@code{org-export-run-in-background}, i.e. request background processing if
6568not set, or force processing in the current Emacs process if st.
4009494e
GM
6569@end table
6570
6571@menu
6572* ASCII export:: Exporting to plain ASCII
6573* HTML export:: Exporting to HTML
6574* LaTeX export:: Exporting to LaTeX
6575* XOXO export:: Exporting to XOXO
6576* iCalendar export:: Exporting in iCalendar format
6577* Text interpretation:: How the exporter looks at the file
6578@end menu
6579
6580@node ASCII export, HTML export, Exporting, Exporting
6581@section ASCII export
6582@cindex ASCII export
6583
a7808fba 6584ASCII export produces a simple and very readable version of an Org mode
4009494e
GM
6585file.
6586
6587@cindex region, active
6588@cindex active region
a7808fba 6589@cindex Transient mark mode
4009494e
GM
6590@table @kbd
6591@kindex C-c C-e a
6592@item C-c C-e a
6593Export as ASCII file. For an org file @file{myfile.org}, the ASCII file
6594will be @file{myfile.txt}. The file will be overwritten without
6595warning. If there is an active region, only the region will be
6596exported. If the selected region is a single tree, the tree head will
6597become the document title. If the tree head entry has or inherits an
dbc28aaa 6598@code{:EXPORT_FILE_NAME:} property, that name will be used for the
28a16a1b 6599export.
4009494e
GM
6600@kindex C-c C-e v a
6601@item C-c C-e v a
6602Export only the visible part of the document.
6603@end table
6604
6605@cindex headline levels, for exporting
6606In the exported version, the first 3 outline levels will become
6607headlines, defining a general document structure. Additional levels
6608will be exported as itemized lists. If you want that transition to occur
6609at a different level, specify it with a prefix argument. For example,
6610
6611@example
6612@kbd{C-1 C-c C-e a}
6613@end example
6614
6615@noindent
6616creates only top level headlines and does the rest as items. When
6617headlines are converted to items, the indentation of the text following
6618the headline is changed to fit nicely under the item. This is done with
a7808fba 6619the assumption that the first body line indicates the base indentation of
4009494e
GM
6620the body text. Any indentation larger than this is adjusted to preserve
6621the layout relative to the first line. Should there be lines with less
6622indentation than the first, these are left alone.
6623
6624@node HTML export, LaTeX export, ASCII export, Exporting
6625@section HTML export
6626@cindex HTML export
6627
a7808fba 6628Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
4009494e
GM
6629HTML formatting, in ways similar to John Grubers @emph{markdown}
6630language, but with additional support for tables.
6631
6632@menu
6633* HTML Export commands:: How to invoke LaTeX export
a7808fba 6634* Quoting HTML tags:: Using direct HTML in Org mode
4009494e
GM
6635* Links:: Transformation of links for HTML
6636* Images:: How to include images
a7808fba
CD
6637* CSS support:: Changing the appearance of the output
6638* Javascript support:: Info and Folding in a web browser
4009494e
GM
6639@end menu
6640
6641@node HTML Export commands, Quoting HTML tags, HTML export, HTML export
6642@subsection HTML export commands
6643
6644@cindex region, active
6645@cindex active region
a7808fba 6646@cindex Transient mark mode
4009494e
GM
6647@table @kbd
6648@kindex C-c C-e h
6649@item C-c C-e h
6650Export as HTML file @file{myfile.html}. For an org file
6651@file{myfile.org}, the ASCII file will be @file{myfile.html}. The file
6652will be overwritten without warning. If there is an active region, only
6653the region will be exported. If the selected region is a single tree,
6654the tree head will become the document title. If the tree head entry
dbc28aaa
CD
6655has or inherits an @code{:EXPORT_FILE_NAME:} property, that name will be
6656used for the export.
4009494e
GM
6657@kindex C-c C-e b
6658@item C-c C-e b
6659Export as HTML file and immediately open it with a browser.
6660@kindex C-c C-e H
6661@item C-c C-e H
6662Export to a temporary buffer, do not create a file.
6663@kindex C-c C-e R
dbc28aaa 6664@item C-c C-e R
a7808fba
CD
6665Export the active region to a temporary buffer. With a prefix argument, do
6666not produce the file header and footer, but just the plain HTML section for
6667the region. This is good for cut-and-paste operations.
4009494e
GM
6668@kindex C-c C-e v h
6669@kindex C-c C-e v b
6670@kindex C-c C-e v H
6671@kindex C-c C-e v R
6672@item C-c C-e v h
6673@item C-c C-e v b
6674@item C-c C-e v H
6675@item C-c C-e v R
6676Export only the visible part of the document.
6677@item M-x org-export-region-as-html
a7808fba 6678Convert the region to HTML under the assumption that it was Org mode
4009494e
GM
6679syntax before. This is a global command that can be invoked in any
6680buffer.
6681@item M-x org-replace-region-by-HTML
a7808fba 6682Replace the active region (assumed to be in Org mode syntax) by HTML
4009494e
GM
6683code.
6684@end table
6685
6686@cindex headline levels, for exporting
a7808fba
CD
6687In the exported version, the first 3 outline levels will become headlines,
6688defining a general document structure. Additional levels will be exported as
6689itemized lists. If you want that transition to occur at a different level,
6690specify it with a numeric prefix argument. For example,
4009494e
GM
6691
6692@example
6693@kbd{C-2 C-c C-e b}
6694@end example
6695
6696@noindent
6697creates two levels of headings and does the rest as items.
6698
6699@node Quoting HTML tags, Links, HTML Export commands, HTML export
6700@subsection Quoting HTML tags
6701
6702Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
6703@samp{&gt;} in HTML export. If you want to include simple HTML tags
6704which should be interpreted as such, mark them with @samp{@@} as in
6705@samp{@@<b>bold text@@</b>}. Note that this really works only for
6706simple tags. For more extensive HTML that should be copied verbatim to
6707the exported file use either
6708
6709@example
6710#+HTML: Literal HTML code for export
6711@end example
6712
6713@noindent or
6714
6715@example
6716#+BEGIN_HTML
6717All lines between these markers are exported literally
6718#+END_HTML
6719@end example
6720
6721
6722@node Links, Images, Quoting HTML tags, HTML export
6723@subsection Links
6724
6725@cindex links, in HTML export
6726@cindex internal links, in HTML export
6727@cindex external links, in HTML export
6728Internal links (@pxref{Internal links}) will continue to work in HTML
6729files only if they match a dedicated @samp{<<target>>}. Automatic links
6730created by radio targets (@pxref{Radio targets}) will also work in the
6731HTML file. Links to external files will still work if the HTML file is
a7808fba 6732in the same directory as the Org file. Links to other @file{.org}
4009494e
GM
6733files will be translated into HTML links under the assumption that an
6734HTML version also exists of the linked file. For information related to
6735linking files while publishing them to a publishing directory see
6736@ref{Publishing links}.
6737
6738@node Images, CSS support, Links, HTML export
6739@subsection Images
6740
6741@cindex images, inline in HTML
6742@cindex inlining images in HTML
a7808fba 6743HTML export can inline images given as links in the Org file, and
4009494e
GM
6744it can make an image the clickable part of a link. By
6745default@footnote{but see the variable
6746@code{org-export-html-inline-images}}, images are inlined if a link does
6747not have a description. So @samp{[[file:myimg.jpg]]} will be inlined,
6748while @samp{[[file:myimg.jpg][the image]]} will just produce a link
6749@samp{the image} that points to the image. If the description part
6750itself is a @code{file:} link or a @code{http:} URL pointing to an
6751image, this image will be inlined and activated so that clicking on the
6752image will activate the link. For example, to include a thumbnail that
6753will link to a high resolution version of the image, you could use:
6754
6755@example
6756[[file:highres.jpg][file:thumb.jpg]]
6757@end example
6758
6759@noindent
6760and you could use @code{http} addresses just as well.
6761
a7808fba 6762@node CSS support, Javascript support, Images, HTML export
4009494e 6763@subsection CSS support
a7808fba
CD
6764@cindex CSS, for HTML export
6765@cindex HTML export, CSS
4009494e
GM
6766
6767You can also give style information for the exported file. The HTML
6768exporter assigns the following CSS classes to appropriate parts of the
6769document - your style specifications may change these:
6770@example
6771.todo @r{TODO keywords}
6772.done @r{the DONE keyword}
6773.timestamp @r{time stamp}
6774.timestamp-kwd @r{keyword associated with a time stamp, like SCHEDULED}
6775.tag @r{tag in a headline}
6776.target @r{target for links}
6777@end example
6778
6779The default style specification can be configured through the option
6780@code{org-export-html-style}. If you want to use a file-local style,
6781you may use file variables, best wrapped into a COMMENT section at the
6782end of the outline tree. For example@footnote{Under Emacs 21, the
6783continuation lines for a variable value should have no @samp{#} at the
6784start of the line.}:
6785
6786@example
6787* COMMENT html style specifications
6788
6789# Local Variables:
6790# org-export-html-style: " <style type=\"text/css\">
6791# p @{font-weight: normal; color: gray; @}
6792# h1 @{color: black; @}
6793# </style>"
6794# End:
6795@end example
6796
6797Remember to execute @kbd{M-x normal-mode} after changing this to make
a7808fba 6798the new style visible to Emacs. This command restarts Org mode for the
4009494e
GM
6799current buffer and forces Emacs to re-evaluate the local variables
6800section in the buffer.
6801
6802@c FIXME: More about header and footer styles
6803@c FIXME: Talk about links and targets.
6804
a7808fba
CD
6805@node Javascript support, , CSS support, HTML export
6806@subsection Javascript supported display of web pages
6807
6808@emph{Sebastian Rose} has written a JavaScript program especially designed to
6809enhance the web viewing experience of HTML files created with Org. This
6810program allows to view large files in two different ways. The first one is
6811an @emph{Info}-like mode where each section is displayed separately and
6812navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
6813as well, press @kbd{?} for an overview of the available keys). The second
6814view type is a @emph{folding} view much like Org provides it inside Emacs.
6815The script is available at @url{http://orgmode.org/org-info.js} and you can
6816find the documentation for it at @url{http://orgmode.org/org-infojs.html}.
6817We are serving the script from our site, but if you use it a lot, you might
6818not want to be dependent on @url{orgmode.org} and prefer to install a local
6819copy on your own web server.
6820
6821To use the script, you need to make sure that the @file{org-infojs.el} module
6822gets loaded. It should be loaded by default, try @kbd{M-x customize-variable
6823@key{RET} org-modules @key{RET}} to convince yourself that this is indeed the
6824case. All it then takes to make use of the program is adding a single line
6825to the Org file:
6826
6827@example
6828#+INFOSJ_OPT: view:info toc:nil
6829@end example
6830
6831@noindent
6832If this line is found, the HTML header will automatically contain the code
6833needed to invoke the script. Using the line above, you can set the following
6834viewing options:
6835
6836@example
6837path: @r{The path to the script. The default is to grab the script from}
6838 @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
6839 @r{a local copy and use a path like @samp{../scripts/org-info.js}.}
6840view: @r{Initial view when website is first shown. Possible values are}
6841 info @r{Info-like interface with one section per page.}
6842 overview @r{Folding interface, initially showing only top-level.}
6843 content @r{Folding interface, starting with all headlines visible.}
6844 showall @r{Folding interface, all headlines and text visible.}
6845sdepth: @r{Maximum headline level that will still become an independent}
6846 @r{section for info and folding modes. The default is taken from}
6847 @r{@code{org-headline-levels} (= the @code{H} switch in @code{#+OPTIONS}).}
6848 @r{If this is smaller than in @code{org-headline-levels}, each}
6849 @r{info/folding section can still contain children headlines.}
6850toc: @r{Should the table of content @emph{initially} be visible?}
6851 @r{Even when @code{nil}, you can always get to the toc with @kbd{i}.}
6852tdepth: @r{The depth of the table of contents. The defaults are taken from}
6853 @r{the variables @code{org-headline-levels} and @code{org-export-with-toc}.}
6854ltoc: @r{Should there be short contents (children) in each section?}
6855mouse: @r{Headings are highlighted when the mouse is over them. Should be}
6856 @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
6857buttons: @r{Should view-toggle buttons be everywhere? When @code{nil} (the}
6858 @r{default), only one such button will be present.}
6859@end example
6860
6861You can choose default values for these options by customizing the variable
6862@code{org-infojs-options}. If you always want to apply the script to your
6863pages, configure the variable @code{org-export-html-use-infojs}.
6864
4009494e
GM
6865@node LaTeX export, XOXO export, HTML export, Exporting
6866@section LaTeX export
6867@cindex LaTeX export
6868
a7808fba 6869Org mode contains a La@TeX{} exporter written by Bastien Guerry.
4009494e
GM
6870
6871@menu
6872* LaTeX export commands:: How to invoke LaTeX export
6873* Quoting LaTeX code:: Incorporating literal LaTeX code
a7808fba 6874* Sectioning structure:: Changing sectioning in LaTeX output
4009494e
GM
6875@end menu
6876
6877@node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
6878@subsection LaTeX export commands
6879
6880@table @kbd
6881@kindex C-c C-e l
6882@item C-c C-e l
6883Export as La@TeX{} file @file{myfile.tex}.
6884@kindex C-c C-e L
6885@item C-c C-e L
6886Export to a temporary buffer, do not create a file.
6887@kindex C-c C-e v l
6888@kindex C-c C-e v L
6889@item C-c C-e v l
6890@item C-c C-e v L
6891Export only the visible part of the document.
6892@item M-x org-export-region-as-latex
a7808fba 6893Convert the region to La@TeX{} under the assumption that it was Org mode
4009494e
GM
6894syntax before. This is a global command that can be invoked in any
6895buffer.
6896@item M-x org-replace-region-by-latex
a7808fba 6897Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
4009494e
GM
6898code.
6899@end table
6900
6901@cindex headline levels, for exporting
6902In the exported version, the first 3 outline levels will become
6903headlines, defining a general document structure. Additional levels
6904will be exported as description lists. The exporter can ignore them or
6905convert them to a custom string depending on
6906@code{org-latex-low-levels}.
6907
6908If you want that transition to occur at a different level, specify it
a7808fba 6909with a numeric prefix argument. For example,
4009494e
GM
6910
6911@example
6912@kbd{C-2 C-c C-e l}
6913@end example
6914
6915@noindent
6916creates two levels of headings and does the rest as items.
6917
dbc28aaa 6918@node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export
4009494e
GM
6919@subsection Quoting LaTeX code
6920
6921Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
a7808fba 6922inserted into the La@TeX{} file. Furthermore, you can add special code
4009494e
GM
6923that should only be present in La@TeX{} export with the following
6924constructs:
6925
6926@example
6927#+LaTeX: Literal LaTeX code for export
6928@end example
6929
6930@noindent or
6931
6932@example
6933#+BEGIN_LaTeX
6934All lines between these markers are exported literally
6935#+END_LaTeX
6936@end example
dbc28aaa
CD
6937
6938
6939
6940@node Sectioning structure, , Quoting LaTeX code, LaTeX export
6941@subsection Sectioning structure
6942@cindex LaTeX class
6943@cindex LaTeX sectioning structure
6944
6945By default, the La@TeX{} output uses the class @code{article}.
6946
6947You can change this globally by setting a different value for
6948@code{org-export-latex-default-class} or locally by adding an option
6949like @code{#+LaTeX_CLASS: myclass} in your file. The class should be
6950listed in @code{org-export-latex-classes}, where you can also define the
6951sectioning structure for each class.
6952
6953
4009494e
GM
6954@node XOXO export, iCalendar export, LaTeX export, Exporting
6955@section XOXO export
6956@cindex XOXO export
6957
a7808fba 6958Org mode contains an exporter that produces XOXO-style output.
4009494e 6959Currently, this exporter only handles the general outline structure and
a7808fba 6960does not interpret any additional Org mode features.
4009494e
GM
6961
6962@table @kbd
6963@kindex C-c C-e x
6964@item C-c C-e x
6965Export as XOXO file @file{myfile.html}.
6966@kindex C-c C-e v
6967@item C-c C-e v x
6968Export only the visible part of the document.
6969@end table
6970
6971@node iCalendar export, Text interpretation, XOXO export, Exporting
6972@section iCalendar export
6973@cindex iCalendar export
6974
a7808fba 6975Some people like to use Org mode for keeping track of projects, but
4009494e
GM
6976still prefer a standard calendar application for anniversaries and
6977appointments. In this case it can be useful to have deadlines and
a7808fba
CD
6978other time-stamped items in Org files show up in the calendar
6979application. Org mode can export calendar information in the standard
4009494e
GM
6980iCalendar format. If you also want to have TODO entries included in the
6981export, configure the variable @code{org-icalendar-include-todo}.
6982
6983@table @kbd
6984@kindex C-c C-e i
6985@item C-c C-e i
6986Create iCalendar entries for the current file and store them in the same
6987directory, using a file extension @file{.ics}.
6988@kindex C-c C-e I
6989@item C-c C-e I
6990Like @kbd{C-c C-e i}, but do this for all files in
6991@code{org-agenda-files}. For each of these files, a separate iCalendar
6992file will be written.
6993@kindex C-c C-e c
6994@item C-c C-e c
6995Create a single large iCalendar file from all files in
6996@code{org-agenda-files} and write it to the file given by
6997@code{org-combined-agenda-icalendar-file}.
6998@end table
6999
dbc28aaa
CD
7000The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
7001the selected entries have them. If not, the summary will be derived
7002from the headline, and the description from the body (limited to
28a16a1b 7003@code{org-icalendar-include-body} characters).
dbc28aaa 7004
4009494e
GM
7005How this calendar is best read and updated, depends on the application
7006you are using. The FAQ covers this issue.
7007
7008
7009@node Text interpretation, , iCalendar export, Exporting
7010@section Text interpretation by the exporter
7011
a7808fba 7012The exporter backends interpret additional structure in the Org file
4009494e
GM
7013in order to produce better output.
7014
7015@menu
7016* Comment lines:: Some lines will not be exported
7017* Initial text:: Text before the first headline
7018* Footnotes:: Numbers like [1]
a7808fba 7019* Quoted examples:: Inserting quoted chunks of text
4009494e
GM
7020* Enhancing text:: Subscripts, symbols and more
7021* Export options:: How to influence the export settings
7022@end menu
7023
7024@node Comment lines, Initial text, Text interpretation, Text interpretation
7025@subsection Comment lines
7026@cindex comment lines
7027@cindex exporting, not
7028
7029Lines starting with @samp{#} in column zero are treated as comments
7030and will never be exported. Also entire subtrees starting with the
7031word @samp{COMMENT} will never be exported.
7032
7033@table @kbd
7034@kindex C-c ;
7035@item C-c ;
7036Toggle the COMMENT keyword at the beginning of an entry.
7037@end table
7038
7039@node Initial text, Footnotes, Comment lines, Text interpretation
7040@subsection Text before the first headline
7041
a7808fba 7042Org mode normally ignores any text before the first headline when
4009494e
GM
7043exporting, leaving this region for internal links to speed up navigation
7044etc. However, in publishing-oriented files, you might want to have some
7045text before the first headline, like a small introduction, special HTML
7046code with a navigation bar, etc. You can ask to have this part of the
7047file exported as well by setting the variable
7048@code{org-export-skip-text-before-1st-heading} to @code{nil}. On a
7049per-file basis, you can get the same effect with
7050
7051@example
7052#+OPTIONS: skip:nil
7053@end example
7054
7055The text before the first headline will be fully processed
7056(@pxref{Enhancing text}), and the first non-comment line becomes the
7057title of the exported document. If you need to include literal HTML,
7058use the special constructs described in @ref{Quoting HTML tags}. The
7059table of contents is normally inserted directly before the first
7060headline of the file. If you would like to get it to a different
7061location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by
7062itself at the desired location.
7063
7064Finally, if you want to use the space before the first headline for
7065internal purposes, but @emph{still} want to place something before the
7066first headline when exporting the file, you can use the @code{#+TEXT}
7067construct:
7068
7069@example
7070#+OPTIONS: skip:t
7071#+TEXT: This text will go before the *first* headline.
7072#+TEXT: We place the table of contents here:
7073#+TEXT: [TABLE-OF-CONTENTS]
7074#+TEXT: This goes between the table of contents and the first headline
7075@end example
7076
dbc28aaa 7077@node Footnotes, Quoted examples, Initial text, Text interpretation
4009494e
GM
7078@subsection Footnotes
7079@cindex footnotes
7080@cindex @file{footnote.el}
7081
7082Numbers in square brackets are treated as footnotes, so that you can use
7083the Emacs package @file{footnote.el} to create footnotes. For example:
7084
7085@example
a7808fba 7086The Org homepage[1] clearly needs help from
4009494e
GM
7087a good web designer.
7088
dbc28aaa 7089[1] The link is: http://orgmode.org
4009494e
GM
7090@end example
7091
7092@noindent
7093@kindex C-c !
7094Note that the @file{footnote} package uses @kbd{C-c !} to invoke its
a7808fba 7095commands. This binding conflicts with the Org mode command for
4009494e
GM
7096inserting inactive time stamps. You could use the variable
7097@code{footnote-prefix} to switch footnotes commands to another key. Or,
7098if you are too used to this binding, you could use
7099@code{org-replace-disputed-keys} and @code{org-disputed-keys} to change
a7808fba 7100the settings in Org.
4009494e 7101
dbc28aaa
CD
7102@node Quoted examples, Enhancing text, Footnotes, Text interpretation
7103@subsection Quoted examples
7104@cindex quoted examples
7105@cindex examples, quoted
7106@cindex text, fixed width
7107@cindex fixed width text
7108
7109When writing technical documents, you often need to insert examples that
a7808fba 7110are not further interpreted by Org mode. For historical reasons, there
dbc28aaa
CD
7111are several ways to do this:
7112
7113@itemize @bullet
7114@item
7115If a headline starts with the word @samp{QUOTE}, the text below the
7116headline will be typeset as fixed-width, to allow quoting of computer
7117codes etc.
7118@item
28a16a1b 7119Lines starting with @samp{:} are also typeset in fixed-width font.
dbc28aaa
CD
7120@table @kbd
7121@kindex C-c :
7122@item C-c :
7123Toggle fixed-width for entry (QUOTE) or region, see below.
7124@end table
7125@item
7126Finally, text between
7127@example
7128#+BEGIN_EXAMPLE
7129quoted text
7130#+END_EXAMPLE
7131@end example
7132will also be exported in this way.
7133@end itemize
7134
7135
7136@node Enhancing text, Export options, Quoted examples, Text interpretation
4009494e
GM
7137@subsection Enhancing text for export
7138@cindex enhancing text
7139@cindex richer text
7140
a7808fba 7141Some of the export backends of Org mode allow for sophisticated text
4009494e 7142formatting, this is true in particular for the HTML and La@TeX{}
a7808fba 7143backends. Org mode has a number of typing conventions that allow to
4009494e
GM
7144produce a richly formatted output.
7145
7146@itemize @bullet
7147
7148@cindex hand-formatted lists
7149@cindex lists, hand-formatted
7150@item
7151Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
7152or @samp{2)} as enumerator will be recognized and transformed if the
7153backend supports lists. See @xref{Plain lists}.
7154
7155@cindex underlined text
7156@cindex bold text
7157@cindex italic text
dbc28aaa 7158@cindex verbatim text
4009494e 7159@item
dbc28aaa
CD
7160You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
7161and @code{~verbatim~}, and, if you must, @samp{+strikethrough+}. Text
a7808fba 7162in the code and verbatim string is not processed for Org mode specific
dbc28aaa 7163syntax, it is exported verbatim.
4009494e
GM
7164
7165@cindex horizontal rules, in exported files
7166@item
7167A line consisting of only dashes, and at least 5 of them, will be
7168exported as a horizontal line (@samp{<hr/>} in HTML).
7169
7170@cindex LaTeX fragments, export
7171@cindex TeX macros, export
7172@item
7173Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML
7174entities or images (@pxref{Embedded LaTeX}).
7175
7176@cindex tables, export
7177@item
7178Tables are transformed into native tables under the exporter, if the
7179export backend supports this. Data fields before the first horizontal
7180separator line will be formatted as table header fields.
7181
7182@cindex fixed width
7183@item
7184If a headline starts with the word @samp{QUOTE}, the text below the
7185headline will be typeset as fixed-width, to allow quoting of computer
7186codes etc. Lines starting with @samp{:} are also typeset in fixed-width
28a16a1b 7187font.
4009494e
GM
7188@table @kbd
7189@kindex C-c :
7190@item C-c :
7191Toggle fixed-width for entry (QUOTE) or region, see below.
7192@end table
dbc28aaa
CD
7193Finally, text between
7194@example
7195#+BEGIN_EXAMPLE
7196quoted text
7197#+END_EXAMPLE
7198@end example
7199will also be exported in this way.
4009494e
GM
7200
7201@cindex linebreak, forced
28a16a1b 7202@item
4009494e
GM
7203A double backslash @emph{at the end of a line} enforces a line break at
7204this position.
dbc28aaa
CD
7205
7206@cindex HTML entities, LaTeX entities
7207@item
7208Strings like @code{\alpha} will be exported as @code{&alpha;}, in the
7209HTML output. These strings are exported as @code{$\alpha$} in the
7210La@TeX{} output. Similarly, @code{\nbsp} will become @code{&nbsp;} in
7211HTML and in La@TeX{}. This applies for a long list of entities, see
7212the variable @code{org-html-entities} for the complete list.
7213@c FIXME
4009494e
GM
7214@end itemize
7215
7216If these conversions conflict with your habits of typing ASCII text,
7217they can all be turned off with corresponding variables. See the
7218customization group @code{org-export-general}, and the following section
7219which explains how to set export options with special lines in a
7220buffer.
7221
7222
7223@node Export options, , Enhancing text, Text interpretation
7224@subsection Export options
7225@cindex options, for export
7226
7227@cindex completion, of option keywords
7228The exporter recognizes special lines in the buffer which provide
7229additional information. These lines may be put anywhere in the file.
7230The whole set of lines can be inserted into the buffer with @kbd{C-c
7231C-e t}. For individual lines, a good way to make sure the keyword is
7232correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
7233(@pxref{Completion}).
7234
7235@table @kbd
7236@kindex C-c C-e t
7237@item C-c C-e t
7238Insert template with export options, see example below.
7239@end table
7240
7241@example
7242#+TITLE: the title to be shown (default is the buffer name)
7243#+AUTHOR: the author (default taken from @code{user-full-name})
dbc28aaa 7244#+DATE: A date, fixed, of a format string for @code{format-time-string}
4009494e
GM
7245#+EMAIL: his/her email address (default from @code{user-mail-address})
7246#+LANGUAGE: language for HTML, e.g. @samp{en} (@code{org-export-default-language})
7247#+TEXT: Some descriptive text to be inserted at the beginning.
7248#+TEXT: Several lines may be given.
7249#+OPTIONS: H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
7250@end example
7251
7252@noindent
7253The OPTIONS line is a compact form to specify export settings. Here
7254you can:
7255@cindex headline levels
7256@cindex section-numbers
7257@cindex table of contents
7258@cindex linebreak preservation
7259@cindex quoted HTML tags
7260@cindex fixed-width sections
7261@cindex tables
7262@cindex @TeX{}-like syntax for sub- and superscripts
7263@cindex footnotes
dbc28aaa 7264@cindex special strings
4009494e
GM
7265@cindex emphasized text
7266@cindex @TeX{} macros
7267@cindex La@TeX{} fragments
7268@cindex author info, in export
7269@cindex time info, in export
7270@example
7271H: @r{set the number of headline levels for export}
7272num: @r{turn on/off section-numbers}
7273toc: @r{turn on/off table of contents, or set level limit (integer)}
7274\n: @r{turn on/off linebreak-preservation}
7275@@: @r{turn on/off quoted HTML tags}
7276:: @r{turn on/off fixed-width sections}
7277|: @r{turn on/off tables}
7278^: @r{turn on/off @TeX{}-like syntax for sub- and superscripts. If}
7279 @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
7280 @r{the simple @code{a_b} will be left as it is.}
dbc28aaa 7281-: @r{turn on/off conversion of special strings.}
4009494e
GM
7282f: @r{turn on/off foototes like this[1].}
7283*: @r{turn on/off emphasized text (bold, italic, underlined)}
7284TeX: @r{turn on/off simple @TeX{} macros in plain text}
7285LaTeX: @r{turn on/off La@TeX{} fragments}
7286skip: @r{turn on/off skipping the text before the first heading}
7287author: @r{turn on/off inclusion of author name/email into exported file}
7288timestamp: @r{turn on/off inclusion creation time into exported file}
dbc28aaa 7289d: @r{turn on/off inclusion of drawers}
4009494e
GM
7290@end example
7291
7292These options take effect in both the HTML and La@TeX{} export, except
7293for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
7294@code{nil} for the La@TeX{} export.
7295
7296@node Publishing, Miscellaneous, Exporting, Top
7297@chapter Publishing
7298@cindex publishing
7299
a7808fba 7300Org includes@footnote{@file{org-publish.el} is not distributed with
4009494e
GM
7301Emacs 21, if you are still using Emacs 21, you need you need to download
7302this file separately.} a publishing management system that allows you to
7303configure automatic HTML conversion of @emph{projects} composed of
7304interlinked org files. This system is called @emph{org-publish}. You can
7305also configure org-publish to automatically upload your exported HTML
7306pages and related attachments, such as images and source code files, to
a7808fba 7307a web server. Org-publish turns Org into a web-site authoring tool.
4009494e
GM
7308
7309You can also use Org-publish to convert files into La@TeX{}, or even
7310combine HTML and La@TeX{} conversion so that files are available in both
7311formats on the server@footnote{Since La@TeX{} files on a server are not
7312that helpful, you surely want to perform further conversion on them --
7313e.g. convert them to @code{PDF} format.}.
7314
a7808fba 7315Org-publish has been contributed to Org by David O'Toole.
4009494e
GM
7316
7317@menu
7318* Configuration:: Defining projects
7319* Sample configuration:: Example projects
7320* Triggering publication:: Publication commands
7321@end menu
7322
7323@node Configuration, Sample configuration, Publishing, Publishing
7324@section Configuration
7325
7326Publishing needs significant configuration to specify files, destination
7327and many other properties of a project.
7328
7329@menu
7330* Project alist:: The central configuration variable
7331* Sources and destinations:: From here to there
7332* Selecting files:: What files are part of the project?
7333* Publishing action:: Setting the function doing the publishing
7334* Publishing options:: Tweaking HTML export
7335* Publishing links:: Which links keep working after publishing?
7336* Project page index:: Publishing a list of project files
7337@end menu
7338
7339@node Project alist, Sources and destinations, Configuration, Configuration
7340@subsection The variable @code{org-publish-project-alist}
7341@cindex org-publish-project-alist
7342@cindex projects, for publishing
7343
7344Org-publish is configured almost entirely through setting the value of
7345one variable, called @code{org-publish-project-alist}.
7346Each element of the list configures one project, and may be in one of
7347the two following forms:
7348
7349@lisp
dbc28aaa 7350("project-name" :property value :property value ...)
4009494e 7351
28a16a1b
CD
7352@r{or}
7353
dbc28aaa 7354("project-name" :components ("project-name" "project-name" ...))
4009494e
GM
7355
7356@end lisp
7357
7358In both cases, projects are configured by specifying property values.
7359A project defines the set of files that will be published, as well as
7360the publishing configuration to use when publishing those files. When
7361a project takes the second form listed above, the individual members
7362of the ``components'' property are taken to be components of the
7363project, which group together files requiring different publishing
7364options. When you publish such a ``meta-project'' all the components
7365will also publish.
7366
7367@node Sources and destinations, Selecting files, Project alist, Configuration
7368@subsection Sources and destinations for files
7369@cindex directories, for publishing
7370
7371Most properties are optional, but some should always be set. In
7372particular, org-publish needs to know where to look for source files,
7373and where to put published files.
7374
7375@multitable @columnfractions 0.3 0.7
7376@item @code{:base-directory}
7377@tab Directory containing publishing source files
7378@item @code{:publishing-directory}
7379@tab Directory (possibly remote) where output files will be published.
7380@item @code{:preparation-function}
7381@tab Function called before starting publishing process, for example to
7382run @code{make} for updating files to be published.
7383@end multitable
7384@noindent
7385
7386@node Selecting files, Publishing action, Sources and destinations, Configuration
7387@subsection Selecting files
7388@cindex files, selecting for publishing
7389
7390By default, all files with extension @file{.org} in the base directory
7391are considered part of the project. This can be modified by setting the
28a16a1b 7392properties
4009494e
GM
7393@multitable @columnfractions 0.25 0.75
7394@item @code{:base-extension}
7395@tab Extension (without the dot!) of source files. This actually is a
7396regular expression.
7397
28a16a1b 7398@item @code{:exclude}
4009494e
GM
7399@tab Regular expression to match file names that should not be
7400published, even though they have been selected on the basis of their
7401extension.
7402
7403@item @code{:include}
7404@tab List of files to be included regardless of @code{:base-extension}
7405and @code{:exclude}.
7406@end multitable
7407
7408@node Publishing action, Publishing options, Selecting files, Configuration
a7808fba 7409@subsection Publishing action
4009494e
GM
7410@cindex action, for publishing
7411
7412Publishing means that a file is copied to the destination directory and
7413possibly transformed in the process. The default transformation is to
a7808fba 7414export Org files as HTML files, and this is done by the function
4009494e
GM
7415@code{org-publish-org-to-html} which calls the HTML exporter
7416(@pxref{HTML export}). But you also can publish your files in La@TeX{} by
7417using the function @code{org-publish-org-to-latex} instead. Other files
7418like images only need to be copied to the publishing destination. For
a7808fba 7419non-Org files, you need to specify the publishing function.
4009494e
GM
7420
7421
7422@multitable @columnfractions 0.3 0.7
7423@item @code{:publishing-function}
7424@tab Function executing the publication of a file. This may also be a
7425list of functions, which will all be called in turn.
7426@end multitable
7427
7428The function must accept two arguments: a property list containing at
7429least a @code{:publishing-directory} property, and the name of the file
7430to be published. It should take the specified file, make the necessary
7431transformation (if any) and place the result into the destination folder.
7432You can write your own publishing function, but @code{org-publish}
7433provides one for attachments (files that only need to be copied):
7434@code{org-publish-attachment}.
7435
7436@node Publishing options, Publishing links, Publishing action, Configuration
7437@subsection Options for the HTML/LaTeX exporters
7438@cindex options, for publishing
7439
7440The property list can be used to set many export options for the HTML
7441and La@TeX{} exporters. In most cases, these properties correspond to user
a7808fba 7442variables in Org. The table below lists these properties along
4009494e
GM
7443with the variable they belong to. See the documentation string for the
7444respective variable for details.
7445
7446@multitable @columnfractions 0.3 0.7
7447@item @code{:language} @tab @code{org-export-default-language}
7448@item @code{:headline-levels} @tab @code{org-export-headline-levels}
7449@item @code{:section-numbers} @tab @code{org-export-with-section-numbers}
7450@item @code{:table-of-contents} @tab @code{org-export-with-toc}
7451@item @code{:archived-trees} @tab @code{org-export-with-archived-trees}
7452@item @code{:emphasize} @tab @code{org-export-with-emphasize}
7453@item @code{:sub-superscript} @tab @code{org-export-with-sub-superscripts}
dbc28aaa 7454@item @code{:special-strings} @tab @code{org-export-with-special-strings}
4009494e
GM
7455@item @code{:TeX-macros} @tab @code{org-export-with-TeX-macros}
7456@item @code{:LaTeX-fragments} @tab @code{org-export-with-LaTeX-fragments}
7457@item @code{:fixed-width} @tab @code{org-export-with-fixed-width}
7458@item @code{:timestamps} .@tab @code{org-export-with-timestamps}
7459@item @code{:tags} .@tab @code{org-export-with-tags}
7460@item @code{:tables} @tab @code{org-export-with-tables}
7461@item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line}
7462@item @code{:style} @tab @code{org-export-html-style}
7463@item @code{:convert-org-links} @tab @code{org-export-html-link-org-files-as-html}
7464@item @code{:inline-images} @tab @code{org-export-html-inline-images}
7465@item @code{:expand-quoted-html} @tab @code{org-export-html-expand}
7466@item @code{:timestamp} @tab @code{org-export-html-with-timestamp}
7467@item @code{:publishing-directory} @tab @code{org-export-publishing-directory}
7468@item @code{:preamble} @tab @code{org-export-html-preamble}
7469@item @code{:postamble} @tab @code{org-export-html-postamble}
7470@item @code{:auto-preamble} @tab @code{org-export-html-auto-preamble}
7471@item @code{:auto-postamble} @tab @code{org-export-html-auto-postamble}
7472@item @code{:author} @tab @code{user-full-name}
7473@item @code{:email} @tab @code{user-mail-address}
7474@end multitable
7475
dbc28aaa
CD
7476If you use several email addresses, separate them by a semi-column.
7477
4009494e
GM
7478Most of the @code{org-export-with-*} variables have the same effect in
7479both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
7480@code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
7481La@TeX{} export.
7482
dbc28aaa
CD
7483When a property is given a value in @code{org-publish-project-alist},
7484its setting overrides the value of the corresponding user variable (if
7485any) during publishing. Options set within a file (@pxref{Export
4009494e
GM
7486options}), however, override everything.
7487
7488@node Publishing links, Project page index, Publishing options, Configuration
7489@subsection Links between published files
7490@cindex links, publishing
7491
a7808fba 7492To create a link from one Org file to another, you would use
4009494e
GM
7493something like @samp{[[file:foo.org][The foo]]} or simply
7494@samp{file:foo.org.} (@pxref{Hyperlinks}). Upon publishing this link
7495becomes a link to @file{foo.html}. In this way, you can interlink the
7496pages of your "org web" project and the links will work as expected when
7497you publish them to HTML.
7498
7499You may also link to related files, such as images. Provided you are
7500careful with relative pathnames, and provided you have also configured
dbc28aaa 7501@code{org-publish} to upload the related files, these links will work
4009494e
GM
7502too. @ref{Complex example} for an example of this usage.
7503
a7808fba 7504Sometime an Org file to be published may contain links that are
4009494e 7505only valid in your production environment, but not in the publishing
28a16a1b 7506location. In this case, use the property
4009494e
GM
7507
7508@multitable @columnfractions 0.4 0.6
7509@item @code{:link-validation-function}
7510@tab Function to validate links
7511@end multitable
7512
7513@noindent
7514to define a function for checking link validity. This function must
7515accept two arguments, the file name and a directory relative to which
7516the file name is interpreted in the production environment. If this
7517function returns @code{nil}, then the HTML generator will only insert a
7518description into the HTML file, but no link. One option for this
7519function is @code{org-publish-validate-link} which checks if the given
7520file is part of any project in @code{org-publish-project-alist}.
7521
7522@node Project page index, , Publishing links, Configuration
7523@subsection Project page index
7524@cindex index, of published pages
7525
7526The following properties may be used to control publishing of an
7527index of files or summary page for a given project.
7528
7529@multitable @columnfractions 0.25 0.75
7530@item @code{:auto-index}
7531@tab When non-nil, publish an index during org-publish-current-project or
7532org-publish-all.
7533
7534@item @code{:index-filename}
7535@tab Filename for output of index. Defaults to @file{index.org} (which
7536becomes @file{index.html}).
7537
7538@item @code{:index-title}
7539@tab Title of index page. Defaults to name of file.
7540
7541@item @code{:index-function}
a7808fba 7542@tab Plug-in function to use for generation of index.
4009494e
GM
7543Defaults to @code{org-publish-org-index}, which generates a plain list
7544of links to all files in the project.
7545@end multitable
7546
7547@node Sample configuration, Triggering publication, Configuration, Publishing
7548@section Sample configuration
7549
7550Below we provide two example configurations. The first one is a simple
a7808fba 7551project publishing only a set of Org files. The second example is
4009494e
GM
7552more complex, with a multi-component project.
7553
7554@menu
7555* Simple example:: One-component publishing
7556* Complex example:: A multi-component publishing example
7557@end menu
7558
7559@node Simple example, Complex example, Sample configuration, Sample configuration
7560@subsection Example: simple publishing configuration
7561
a7808fba 7562This example publishes a set of Org files to the @file{public_html}
4009494e
GM
7563directory on the local machine.
7564
7565@lisp
7566(setq org-publish-project-alist
28a16a1b 7567 '(("org"
4009494e
GM
7568 :base-directory "~/org/"
7569 :publishing-directory "~/public_html"
7570 :section-numbers nil
7571 :table-of-contents nil
28a16a1b 7572 :style "<link rel=stylesheet
4009494e
GM
7573 href=\"../other/mystyle.css\"
7574 type=\"text/css\">")))
7575@end lisp
7576
7577@node Complex example, , Simple example, Sample configuration
7578@subsection Example: complex publishing configuration
7579
7580This more complicated example publishes an entire website, including
7581org files converted to HTML, image files, emacs lisp source code, and
a7808fba 7582style sheets. The publishing-directory is remote and private files are
4009494e
GM
7583excluded.
7584
7585To ensure that links are preserved, care should be taken to replicate
7586your directory structure on the web server, and to use relative file
7587paths. For example, if your org files are kept in @file{~/org} and your
7588publishable images in @file{~/images}, you'd link to an image with
7589@c
7590@example
7591file:../images/myimage.png
7592@end example
7593@c
7594On the web server, the relative path to the image should be the
7595same. You can accomplish this by setting up an "images" folder in the
a7808fba 7596right place on the web server, and publishing images to it.
4009494e
GM
7597
7598@lisp
7599(setq org-publish-project-alist
7600 '(("orgfiles"
7601 :base-directory "~/org/"
7602 :base-extension "org"
7603 :publishing-directory "/ssh:user@@host:~/html/notebook/"
7604 :publishing-function org-publish-org-to-html
7605 :exclude "PrivatePage.org" ;; regexp
7606 :headline-levels 3
7607 :section-numbers nil
7608 :table-of-contents nil
28a16a1b 7609 :style "<link rel=stylesheet
4009494e
GM
7610 href=\"../other/mystyle.css\" type=\"text/css\">"
7611 :auto-preamble t
7612 :auto-postamble nil)
28a16a1b 7613
4009494e
GM
7614 ("images"
7615 :base-directory "~/images/"
7616 :base-extension "jpg\\|gif\\|png"
7617 :publishing-directory "/ssh:user@@host:~/html/images/"
7618 :publishing-function org-publish-attachment)
28a16a1b 7619
4009494e
GM
7620 ("other"
7621 :base-directory "~/other/"
7622 :base-extension "css\\|el"
7623 :publishing-directory "/ssh:user@@host:~/html/other/"
7624 :publishing-function org-publish-attachment)
7625 ("website" :components ("orgfiles" "images" "other"))))
7626@end lisp
7627
7628@node Triggering publication, , Sample configuration, Publishing
7629@section Triggering publication
7630
7631Once org-publish is properly configured, you can publish with the
28a16a1b 7632following functions:
4009494e
GM
7633
7634@table @kbd
7635@item C-c C-e C
7636Prompt for a specific project and publish all files that belong to it.
7637@item C-c C-e P
7638Publish the project containing the current file.
7639@item C-c C-e F
7640Publish only the current file.
7641@item C-c C-e A
7642Publish all projects.
7643@end table
7644
7645Org uses timestamps to track when a file has changed. The above
7646functions normally only publish changed files. You can override this and
7647force publishing of all files by giving a prefix argument.
7648
7649@node Miscellaneous, Extensions and Hacking, Publishing, Top
7650@chapter Miscellaneous
7651
7652@menu
7653* Completion:: M-TAB knows what you need
a7808fba 7654* Customization:: Adapting Org to your taste
4009494e
GM
7655* In-buffer settings:: Overview of the #+KEYWORDS
7656* The very busy C-c C-c key:: When in doubt, press C-c C-c
7657* Clean view:: Getting rid of leading stars in the outline
a7808fba 7658* TTY keys:: Using Org on a tty
4009494e
GM
7659* Interaction:: Other Emacs packages
7660* Bugs:: Things which do not work perfectly
7661@end menu
7662
7663@node Completion, Customization, Miscellaneous, Miscellaneous
7664@section Completion
7665@cindex completion, of @TeX{} symbols
7666@cindex completion, of TODO keywords
7667@cindex completion, of dictionary words
7668@cindex completion, of option keywords
7669@cindex completion, of tags
7670@cindex completion, of property keys
7671@cindex completion, of link abbreviations
7672@cindex @TeX{} symbol completion
7673@cindex TODO keywords completion
7674@cindex dictionary word completion
7675@cindex option keyword completion
7676@cindex tag completion
7677@cindex link abbreviations, completion of
7678
a7808fba 7679Org supports in-buffer completion. This type of completion does
4009494e
GM
7680not make use of the minibuffer. You simply type a few letters into
7681the buffer and use the key to complete text right there.
7682
7683@table @kbd
7684@kindex M-@key{TAB}
7685@item M-@key{TAB}
7686Complete word at point
7687@itemize @bullet
7688@item
7689At the beginning of a headline, complete TODO keywords.
7690@item
7691After @samp{\}, complete @TeX{} symbols supported by the exporter.
7692@item
7693After @samp{*}, complete headlines in the current buffer so that they
7694can be used in search links like @samp{[[*find this headline]]}.
7695@item
7696After @samp{:} in a headline, complete tags. The list of tags is taken
7697from the variable @code{org-tag-alist} (possibly set through the
7698@samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
7699dynamically from all tags used in the current buffer.
7700@item
7701After @samp{:} and not in a headline, complete property keys. The list
7702of keys is constructed dynamically from all keys used in the current
7703buffer.
7704@item
7705After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
7706@item
7707After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
a7808fba 7708@samp{OPTIONS} which set file-specific options for Org mode. When the
4009494e
GM
7709option keyword is already complete, pressing @kbd{M-@key{TAB}} again
7710will insert example settings for this keyword.
7711@item
7712In the line after @samp{#+STARTUP: }, complete startup keywords,
7713i.e. valid keys for this line.
7714@item
a7808fba 7715Elsewhere, complete dictionary words using Ispell.
4009494e
GM
7716@end itemize
7717@end table
7718
7719@node Customization, In-buffer settings, Completion, Miscellaneous
7720@section Customization
7721@cindex customization
7722@cindex options, for customization
7723@cindex variables, for customization
7724
7725There are more than 180 variables that can be used to customize
a7808fba 7726Org. For the sake of compactness of the manual, I am not
4009494e
GM
7727describing the variables here. A structured overview of customization
7728variables is available with @kbd{M-x org-customize}. Or select
7729@code{Browse Org Group} from the @code{Org->Customization} menu. Many
7730settings can also be activated on a per-file basis, by putting special
7731lines into the buffer (@pxref{In-buffer settings}).
7732
7733@node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
7734@section Summary of in-buffer settings
7735@cindex in-buffer settings
7736@cindex special keywords
7737
a7808fba 7738Org mode uses special lines in the buffer to define settings on a
4009494e
GM
7739per-file basis. These lines start with a @samp{#+} followed by a
7740keyword, a colon, and then individual words defining a setting. Several
7741setting words can be in the same line, but you can also have multiple
7742lines for the keyword. While these settings are described throughout
7743the manual, here is a summary. After changing any of those lines in the
7744buffer, press @kbd{C-c C-c} with the cursor still in the line to
7745activate the changes immediately. Otherwise they become effective only
7746when the file is visited again in a new Emacs session.
7747
7748@table @kbd
7749@item #+ARCHIVE: %s_done::
7750This line sets the archive location for the agenda file. It applies for
7751all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
7752of the file. The first such line also applies to any entries before it.
7753The corresponding variable is @code{org-archive-location}.
7754@item #+CATEGORY:
7755This line sets the category for the agenda file. The category applies
7756for all subsequent lines until the next @samp{#+CATEGORY} line, or the
7757end of the file. The first such line also applies to any entries before it.
7758@item #+COLUMNS: %25ITEM .....
7759Set the default format for columns view. This format applies when
dbc28aaa
CD
7760columns view is invoked in location where no @code{COLUMNS} property
7761applies.
4009494e
GM
7762@item #+CONSTANTS: name1=value1 ...
7763Set file-local values for constants to be used in table formulas. This
7764line set the local variable @code{org-table-formula-constants-local}.
dbc28aaa 7765The global version of this variable is
4009494e 7766@code{org-table-formula-constants}.
dbc28aaa
CD
7767@item #+DRAWERS: NAME1 .....
7768Set the file-local set of drawers. The corresponding global variable is
7769@code{org-drawers}.
4009494e
GM
7770@item #+LINK: linkword replace
7771These lines (several are allowed) specify link abbreviations.
7772@xref{Link abbreviations}. The corresponding variable is
7773@code{org-link-abbrev-alist}.
7774@item #+PRIORITIES: highest lowest default
7775This line sets the limits and the default for the priorities. All three
7776must be either letters A-Z or numbers 0-9. The highest priority must
7777have a lower ASCII number that the lowest priority.
7778@item #+PROPERTY: Property_Name Value
7779This line sets a default inheritance value for entries in the current
7780buffer, most useful for specifying the allowed values of a property.
7781@item #+STARTUP:
a7808fba
CD
7782This line sets options to be used at startup of Org mode, when an
7783Org file is being visited. The first set of options deals with the
4009494e
GM
7784initial visibility of the outline tree. The corresponding variable for
7785global default settings is @code{org-startup-folded}, with a default
7786value @code{t}, which means @code{overview}.
7787@cindex @code{overview}, STARTUP keyword
7788@cindex @code{content}, STARTUP keyword
7789@cindex @code{showall}, STARTUP keyword
7790@example
7791overview @r{top-level headlines only}
7792content @r{all headlines}
7793showall @r{no folding at all, show everything}
7794@end example
7795Then there are options for aligning tables upon visiting a file. This
7796is useful in files containing narrowed table columns. The corresponding
7797variable is @code{org-startup-align-all-tables}, with a default value
28a16a1b 7798@code{nil}.
4009494e
GM
7799@cindex @code{align}, STARTUP keyword
7800@cindex @code{noalign}, STARTUP keyword
7801@example
7802align @r{align all tables}
7803noalign @r{don't align tables on startup}
7804@end example
28a16a1b
CD
7805Logging closing and reinstating TODO items, and clock intervals
7806(variables @code{org-log-done}, @code{org-log-note-clock-out}, and
7807@code{org-log-repeat}) can be configured using these options.
4009494e 7808@cindex @code{logdone}, STARTUP keyword
4009494e 7809@cindex @code{lognotedone}, STARTUP keyword
28a16a1b 7810@cindex @code{nologdone}, STARTUP keyword
4009494e 7811@cindex @code{lognoteclock-out}, STARTUP keyword
28a16a1b 7812@cindex @code{nolognoteclock-out}, STARTUP keyword
4009494e 7813@cindex @code{logrepeat}, STARTUP keyword
28a16a1b 7814@cindex @code{lognoterepeat}, STARTUP keyword
4009494e
GM
7815@cindex @code{nologrepeat}, STARTUP keyword
7816@example
28a16a1b
CD
7817logdone @r{record a timestamp when an item is marked DONE}
7818lognotedone @r{record timestamp and a note when DONE}
7819nologdone @r{don't record when items are marked DONE}
7820logrepeat @r{record a time when reinstating a repeating item}
7821lognoterepeat @r{record a note when reinstating a repeating item}
7822nologrepeat @r{do not record when reinstating repeating item}
7823lognoteclock-out @r{record a note when clocking out}
7824nolognoteclock-out @r{don't record a note when clocking out}
4009494e
GM
7825@end example
7826Here are the options for hiding leading stars in outline headings. The
7827corresponding variables are @code{org-hide-leading-stars} and
7828@code{org-odd-levels-only}, both with a default setting @code{nil}
7829(meaning @code{showstars} and @code{oddeven}).
7830@cindex @code{hidestars}, STARTUP keyword
7831@cindex @code{showstars}, STARTUP keyword
7832@cindex @code{odd}, STARTUP keyword
7833@cindex @code{even}, STARTUP keyword
7834@example
7835hidestars @r{make all but one of the stars starting a headline invisible.}
7836showstars @r{show all stars starting a headline}
7837odd @r{allow only odd outline levels (1,3,...)}
7838oddeven @r{allow all outline levels}
7839@end example
7840To turn on custom format overlays over time stamps (variables
7841@code{org-put-time-stamp-overlays} and
7842@code{org-time-stamp-overlay-formats}), use
7843@cindex @code{customtime}, STARTUP keyword
7844@example
7845customtime @r{overlay custom time format}
7846@end example
7847The following options influence the table spreadsheet (variable
7848@code{constants-unit-system}).
7849@cindex @code{constcgs}, STARTUP keyword
7850@cindex @code{constSI}, STARTUP keyword
7851@example
7852constcgs @r{@file{constants.el} should use the c-g-s unit system}
7853constSI @r{@file{constants.el} should use the SI unit system}
7854@end example
7855@item #+TAGS: TAG1(c1) TAG2(c2)
cad1d376 7856These lines (several such lines are allowed) specify the valid tags in
4009494e
GM
7857this file, and (potentially) the corresponding @emph{fast tag selection}
7858keys. The corresponding variable is @code{org-tag-alist}.
7859@item #+TBLFM:
7860This line contains the formulas for the table directly above the line.
dbc28aaa 7861@item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:
4009494e
GM
7862These lines provide settings for exporting files. For more details see
7863@ref{Export options}.
7864@item #+SEQ_TODO: #+TYP_TODO:
7865These lines set the TODO keywords and their interpretation in the
7866current file. The corresponding variables are @code{org-todo-keywords}
7867and @code{org-todo-interpretation}.
7868@end table
7869
7870@node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
7871@section The very busy C-c C-c key
7872@kindex C-c C-c
7873@cindex C-c C-c, overview
7874
a7808fba 7875The key @kbd{C-c C-c} has many purposes in Org, which are all
4009494e
GM
7876mentioned scattered throughout this manual. One specific function of
7877this key is to add @emph{tags} to a headline (@pxref{Tags}). In many
a7808fba 7878other circumstances it means something like @emph{Hey Org, look
4009494e
GM
7879here and update according to what you see here}. Here is a summary of
7880what this means in different contexts.
7881
7882@itemize @minus
7883@item
7884If there are highlights in the buffer from the creation of a sparse
7885tree, or from clock display, remove these highlights.
7886@item
7887If the cursor is in one of the special @code{#+KEYWORD} lines, this
7888triggers scanning the buffer for these lines and updating the
28a16a1b 7889information.
4009494e
GM
7890@item
7891If the cursor is inside a table, realign the table. This command
7892works even if the automatic table editor has been turned off.
7893@item
7894If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
7895the entire table.
7896@item
7897If the cursor is inside a table created by the @file{table.el} package,
7898activate that table.
7899@item
7900If the current buffer is a remember buffer, close the note and file it.
7901With a prefix argument, file it, without further interaction, to the
7902default location.
7903@item
7904If the cursor is on a @code{<<<target>>>}, update radio targets and
7905corresponding links in this buffer.
7906@item
7907If the cursor is in a property line or at the start or end of a property
7908drawer, offer property commands.
7909@item
7910If the cursor is in a plain list item with a checkbox, toggle the status
7911of the checkbox.
7912@item
7913If the cursor is on a numbered item in a plain list, renumber the
7914ordered list.
dbc28aaa
CD
7915@item
7916If the cursor is on the @code{#+BEGIN} line of a dynamical block, the
7917block is updated.
4009494e
GM
7918@end itemize
7919
7920@node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
7921@section A cleaner outline view
7922@cindex hiding leading stars
7923@cindex clean outline view
7924
a7808fba 7925Some people find it noisy and distracting that the Org headlines
4009494e
GM
7926are starting with a potentially large number of stars. For example
7927the tree from @ref{Headlines}:
7928
7929@example
7930* Top level headline
7931** Second level
7932*** 3rd level
7933 some text
7934*** 3rd level
7935 more text
7936* Another top level headline
7937@end example
7938
7939@noindent
a7808fba 7940Unfortunately this is deeply ingrained into the code of Org and
4009494e
GM
7941cannot be easily changed. You can, however, modify the display in such
7942a way that all leading stars become invisible and the outline more easy
7943to read. To do this, customize the variable
7944@code{org-hide-leading-stars} like this:
7945
7946@lisp
7947(setq org-hide-leading-stars t)
7948@end lisp
7949
7950@noindent
7951or change this on a per-file basis with one of the lines (anywhere in
7952the buffer)
7953
7954@example
7955#+STARTUP: showstars
7956#+STARTUP: hidestars
7957@end example
7958
7959@noindent
7960Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
7961the modifications.
7962
7963With stars hidden, the tree becomes:
7964
7965@example
7966* Top level headline
7967 * Second level
7968 * 3rd level
7969 some text
7970 * 3rd level
7971 more text
7972* Another top level headline
7973@end example
7974
7975@noindent
7976Note that the leading stars are not truly replaced by whitespace, they
7977are only fontified with the face @code{org-hide} that uses the
7978background color as font color. If you are not using either white or
7979black background, you may have to customize this face to get the wanted
7980effect. Another possibility is to set this font such that the extra
7981stars are @i{almost} invisible, for example using the color
7982@code{grey90} on a white background.
7983
7984Things become cleaner still if you skip all the even levels and use only
7985odd levels 1, 3, 5..., effectively adding two stars to go from one
7986outline level to the next:
7987
7988@example
7989* Top level headline
7990 * Second level
7991 * 3rd level
7992 some text
7993 * 3rd level
7994 more text
7995* Another top level headline
7996@end example
7997
7998@noindent
7999In order to make the structure editing and export commands handle this
8000convention correctly, use
8001
8002@lisp
8003(setq org-odd-levels-only t)
8004@end lisp
8005
8006@noindent
8007or set this on a per-file basis with one of the following lines (don't
8008forget to press @kbd{C-c C-c} with the cursor in the startup line to
8009activate changes immediately).
8010
8011@example
8012#+STARTUP: odd
8013#+STARTUP: oddeven
8014@end example
8015
a7808fba 8016You can convert an Org file from single-star-per-level to the
4009494e
GM
8017double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
8018RET} in that file. The reverse operation is @kbd{M-x
8019org-convert-to-oddeven-levels}.
8020
8021@node TTY keys, Interaction, Clean view, Miscellaneous
a7808fba
CD
8022@section Using Org on a tty
8023@cindex tty key bindings
4009494e 8024
a7808fba
CD
8025Because Org contains a large number of commands, by default much of
8026Org's core commands are bound to keys that are generally not
dbc28aaa
CD
8027accessible on a tty, such as the cursor keys (@key{left}, @key{right},
8028@key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
8029together with modifiers like @key{Meta} and/or @key{Shift}. To access
8030these commands on a tty when special keys are unavailable, the following
8031alternative bindings can be used. The tty bindings below will likely be
8032more cumbersome; you may find for some of the bindings below that a
8033customized work-around suits you better. For example, changing a time
8034stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
8035tty you would rather use @kbd{C-c .} to re-insert the timestamp.
4009494e
GM
8036
8037@multitable @columnfractions 0.15 0.2 0.2
8038@item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
8039@item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab
8040@item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{@key{Esc} @key{left}}
8041@item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab
8042@item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{@key{Esc} @key{right}}
8043@item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab
8044@item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{@key{Esc} @key{up}}
8045@item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab
8046@item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{@key{Esc} @key{down}}
8047@item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab
8048@item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab
8049@item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{@key{Esc} @key{RET}}
8050@item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab
8051@item @kbd{S-@key{left}} @tab @kbd{C-c @key{left}} @tab
8052@item @kbd{S-@key{right}} @tab @kbd{C-c @key{right}} @tab
8053@item @kbd{S-@key{up}} @tab @kbd{C-c @key{up}} @tab
8054@item @kbd{S-@key{down}} @tab @kbd{C-c @key{down}} @tab
8055@item @kbd{C-S-@key{left}} @tab @kbd{C-c C-x @key{left}} @tab
8056@item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
8057@end multitable
8058
8059@node Interaction, Bugs, TTY keys, Miscellaneous
8060@section Interaction with other packages
8061@cindex packages, interaction with other
a7808fba 8062Org lives in the world of GNU Emacs and interacts in various ways
4009494e
GM
8063with other code out there.
8064
8065@menu
a7808fba 8066* Cooperation:: Packages Org cooperates with
4009494e
GM
8067* Conflicts:: Packages that lead to conflicts
8068@end menu
8069
8070@node Cooperation, Conflicts, Interaction, Interaction
a7808fba 8071@subsection Packages that Org cooperates with
4009494e
GM
8072
8073@table @asis
8074@cindex @file{calc.el}
8075@item @file{calc.el} by Dave Gillespie
a7808fba
CD
8076Org uses the Calc package for implementing spreadsheet
8077functionality in its tables (@pxref{The spreadsheet}). Org
8078checks for the availability of Calc by looking for the function
8079@code{calc-eval} which should be autoloaded in your setup if Calc has
8080been installed properly. As of Emacs 22, Calc is part of the Emacs
4009494e 8081distribution. Another possibility for interaction between the two
a7808fba
CD
8082packages is using Calc for embedded calculations. @xref{Embedded Mode,
8083, Embedded Mode, Calc, GNU Emacs Calc Manual}.
4009494e
GM
8084@cindex @file{constants.el}
8085@item @file{constants.el} by Carsten Dominik
8086In a table formula (@pxref{The spreadsheet}), it is possible to use
8087names for natural constants or units. Instead of defining your own
8088constants in the variable @code{org-table-formula-constants}, install
8089the @file{constants} package which defines a large number of constants
8090and units, and lets you use unit prefixes like @samp{M} for
8091@samp{Mega} etc. You will need version 2.0 of this package, available
a7808fba 8092at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
4009494e
GM
8093the function @code{constants-get}, which has to be autoloaded in your
8094setup. See the installation instructions in the file
8095@file{constants.el}.
8096@item @file{cdlatex.el} by Carsten Dominik
8097@cindex @file{cdlatex.el}
a7808fba
CD
8098Org mode can make use of the CDLaTeX package to efficiently enter
8099La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
dbc28aaa
CD
8100@item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
8101@cindex @file{imenu.el}
a7808fba
CD
8102Imenu allows menu access to an index of items in a file. Org mode
8103supports Imenu - all you need to do to get the index is the following:
dbc28aaa 8104@lisp
28a16a1b 8105(add-hook 'org-mode-hook
a7808fba 8106 (lambda () (imenu-add-to-menubar "Imenu")))
dbc28aaa
CD
8107@end lisp
8108By default the index is two levels deep - you can modify the depth using
8109the option @code{org-imenu-depth}.
4009494e
GM
8110@item @file{remember.el} by John Wiegley
8111@cindex @file{remember.el}
a7808fba 8112Org cooperates with remember, see @ref{Remember}.
4009494e 8113@file{Remember.el} is not part of Emacs, find it on the web.
dbc28aaa
CD
8114@item @file{speedbar.el} by Eric M. Ludlam
8115@cindex @file{speedbar.el}
8116Speedbar is a package that creates a special frame displaying files and
a7808fba
CD
8117index items in files. Org mode supports Speedbar and allows you to
8118drill into Org files directly from the Speedbar. It also allows to
dbc28aaa 8119restrict the scope of agenda commands to a file or a subtree by using
a7808fba 8120the command @kbd{<} in the Speedbar frame.
4009494e
GM
8121@cindex @file{table.el}
8122@item @file{table.el} by Takaaki Ota
8123@kindex C-c C-c
8124@cindex table editor, @file{table.el}
8125@cindex @file{table.el}
8126
8127Complex ASCII tables with automatic line wrapping, column- and
8128row-spanning, and alignment can be created using the Emacs table
8129package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
8130and also part of Emacs 22).
a7808fba 8131When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
4009494e 8132will call @command{table-recognize-table} and move the cursor into the
a7808fba
CD
8133table. Inside a table, the keymap of Org mode is inactive. In order
8134to execute Org mode-related commands, leave the table.
4009494e
GM
8135
8136@table @kbd
8137@kindex C-c C-c
8138@item C-c C-c
8139Recognize @file{table.el} table. Works when the cursor is in a
8140table.el table.
8141@c
8142@kindex C-c ~
8143@item C-c ~
8144Insert a table.el table. If there is already a table at point, this
a7808fba 8145command converts it between the table.el format and the Org mode
4009494e
GM
8146format. See the documentation string of the command
8147@code{org-convert-table} for the restrictions under which this is
8148possible.
8149@end table
8150@file{table.el} is part of Emacs 22.
8151@cindex @file{footnote.el}
8152@item @file{footnote.el} by Steven L. Baur
a7808fba 8153Org mode recognizes numerical footnotes as provided by this package
4009494e
GM
8154(@pxref{Footnotes}).
8155@end table
8156
8157@node Conflicts, , Cooperation, Interaction
a7808fba 8158@subsection Packages that lead to conflicts with Org mode
4009494e
GM
8159
8160@table @asis
8161
8162@cindex @file{allout.el}
8163@item @file{allout.el} by Ken Manheimer
a7808fba 8164Startup of Org may fail with the error message
4009494e
GM
8165@code{(wrong-type-argument keymapp nil)} when there is an outdated
8166version @file{allout.el} on the load path, for example the version
8167distributed with Emacs 21.x. Upgrade to Emacs 22 and this problem will
8168disappear. If for some reason you cannot do this, make sure that org.el
8169is loaded @emph{before} @file{allout.el}, for example by putting
8170@code{(require 'org)} early enough into your @file{.emacs} file.
8171
8172@cindex @file{CUA.el}
8173@item @file{CUA.el} by Kim. F. Storm
a7808fba
CD
8174Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by
8175CUA mode (as well as pc-select-mode and s-region-mode) to select and
dbc28aaa 8176extend the region. If you want to use one of these packages along with
a7808fba
CD
8177Org, configure the variable @code{org-replace-disputed-keys}. When
8178set, Org will move the following key bindings in Org files, and
dbc28aaa 8179in the agenda buffer (but not during date selection).
4009494e
GM
8180
8181@example
8182S-UP -> M-p S-DOWN -> M-n
8183S-LEFT -> M-- S-RIGHT -> M-+
8184@end example
8185
8186Yes, these are unfortunately more difficult to remember. If you want
8187to have other replacement keys, look at the variable
8188@code{org-disputed-keys}.
8189@item @file{windmove.el} by Hovav Shacham
8190@cindex @file{windmove.el}
8191Also this package uses the @kbd{S-<cursor>} keys, so everything written
8192in the paragraph above about CUA mode also applies here.
8193
8194@cindex @file{footnote.el}
8195@item @file{footnote.el} by Steven L. Baur
a7808fba 8196Org supports the syntax of the footnote package, but only the
4009494e 8197numerical footnote markers. Also, the default key for footnote
a7808fba 8198commands, @kbd{C-c !} is already used by Org. You could use the
4009494e
GM
8199variable @code{footnote-prefix} to switch footnotes commands to another
8200key. Or, you could use @code{org-replace-disputed-keys} and
a7808fba 8201@code{org-disputed-keys} to change the settings in Org.
4009494e
GM
8202
8203@end table
8204
8205
8206@node Bugs, , Interaction, Miscellaneous
8207@section Bugs
8208@cindex bugs
8209
8210Here is a list of things that should work differently, but which I
8211have found too hard to fix.
8212
8213@itemize @bullet
8214@item
8215If a table field starts with a link, and if the corresponding table
8216column is narrowed (@pxref{Narrow columns}) to a width too small to
8217display the link, the field would look entirely empty even though it is
a7808fba 8218not. To prevent this, Org throws an error. The work-around is to
4009494e
GM
8219make the column wide enough to fit the link, or to add some text (at
8220least 2 characters) before the link in the same field.
8221@item
8222Narrowing table columns does not work on XEmacs, because the
8223@code{format} function does not transport text properties.
8224@item
8225Text in an entry protected with the @samp{QUOTE} keyword should not
8226autowrap.
8227@item
8228When the application called by @kbd{C-c C-o} to open a file link fails
8229(for example because the application does not exist or refuses to open
8230the file), it does so silently. No error message is displayed.
8231@item
8232Recalculating a table line applies the formulas from left to right.
8233If a formula uses @emph{calculated} fields further down the row,
8234multiple recalculation may be needed to get all fields consistent. You
8235may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
8236recalculate until convergence.
8237@item
8238A single letter cannot be made bold, for example @samp{*a*}.
8239@item
8240The exporters work well, but could be made more efficient.
8241@end itemize
8242
8243
8244@node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
8245@appendix Extensions, Hooks and Hacking
8246
a7808fba 8247This appendix lists extensions for Org written by other authors.
4009494e 8248It also covers some aspects where users can extend the functionality of
a7808fba 8249Org.
4009494e
GM
8250
8251@menu
a7808fba 8252* Extensions:: Existing 3rd-party extensions
4009494e
GM
8253* Adding hyperlink types:: New custom link types
8254* Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
8255* Dynamic blocks:: Automatically filled blocks
8256* Special agenda views:: Customized views
8257* Using the property API:: Writing programs that use entry properties
8258@end menu
8259
8260@node Extensions, Adding hyperlink types, Extensions and Hacking, Extensions and Hacking
a7808fba 8261@section Third-party extensions for Org
4009494e
GM
8262@cindex extension, third-party
8263
a7808fba
CD
8264There are lots of extensions that have been written by other people. Most of
8265them have either been integrated into Org by now, or they can be found in the
8266Org distribution, in the @file{contrib} directory. The list has gotten too
8267long to cover in any detail here, but there is a seaparate manual for these
8268extensions.
4009494e
GM
8269
8270@node Adding hyperlink types, Tables in arbitrary syntax, Extensions, Extensions and Hacking
8271@section Adding hyperlink types
8272@cindex hyperlinks, adding new types
8273
a7808fba 8274Org has a large number of hyperlink types built-in
4009494e
GM
8275(@pxref{Hyperlinks}). If you would like to add new link types, it
8276provides an interface for doing so. Lets look at an example file
8277@file{org-man.el} that will add support for creating links like
a7808fba 8278@samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
4009494e
GM
8279emacs:
8280
8281@lisp
a7808fba 8282;;; org-man.el - Support for links to manpages in Org
4009494e
GM
8283
8284(require 'org)
8285
8286(org-add-link-type "man" 'org-man-open)
8287(add-hook 'org-store-link-functions 'org-man-store-link)
8288
8289(defcustom org-man-command 'man
8290 "The Emacs command to be used to display a man page."
8291 :group 'org-link
8292 :type '(choice (const man) (const woman)))
8293
8294(defun org-man-open (path)
8295 "Visit the manpage on PATH.
8296PATH should be a topic that can be thrown at the man command."
8297 (funcall org-man-command path))
8298
8299(defun org-man-store-link ()
8300 "Store a link to a manpage."
8301 (when (memq major-mode '(Man-mode woman-mode))
8302 ;; This is a man page, we do make this link
8303 (let* ((page (org-man-get-page-name))
8304 (link (concat "man:" page))
8305 (description (format "Manpage for %s" page)))
8306 (org-store-link-props
8307 :type "man"
8308 :link link
8309 :description description))))
8310
8311(defun org-man-get-page-name ()
8312 "Extract the page name from the buffer name."
8313 ;; This works for both `Man-mode' and `woman-mode'.
8314 (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
8315 (match-string 1 (buffer-name))
8316 (error "Cannot create link to this man page")))
8317
8318(provide 'org-man)
8319
8320;;; org-man.el ends here
8321@end lisp
8322
8323@noindent
8324You would activate this new link type in @file{.emacs} with
8325
8326@lisp
8327(require 'org-man)
8328@end lisp
8329
8330@noindent
8331Lets go through the file and see what it does.
8332@enumerate
28a16a1b 8333@item
4009494e
GM
8334It does @code{(require 'org)} to make sure that @file{org.el} has been
8335loaded.
8336@item
8337The next line calls @code{org-add-link-type} to define a new link type
8338with prefix @samp{man}. The call also contains the name of a function
8339that will be called to follow such a link.
8340@item
8341The next line adds a function to @code{org-store-link-functions}, in
8342order to allow the command @kbd{C-c l} to record a useful link in a
8343buffer displaying a man page.
8344@end enumerate
8345
8346The rest of the file defines the necessary variables and functions.
8347First there is a customization variable that determines which emacs
a7808fba 8348command should be used to display man pages. There are two options,
4009494e
GM
8349@code{man} and @code{woman}. Then the function to follow a link is
8350defined. It gets the link path as an argument - in this case the link
8351path is just a topic for the manual command. The function calls the
8352value of @code{org-man-command} to display the man page.
8353
8354Finally the function @code{org-man-store-link} is defined. When you try
8355to store a link with @kbd{C-c l}, also this function will be called to
8356try to make a link. The function must first decide if it is supposed to
8357create the link for this buffer type, we do this by checking the value
8358of the variable @code{major-mode}. If not, the function must exit and
a7808fba
CD
8359return the value @code{nil}. If yes, the link is created by getting the
8360manual topic from the buffer name and prefixing it with the string
4009494e
GM
8361@samp{man:}. Then it must call the command @code{org-store-link-props}
8362and set the @code{:type} and @code{:link} properties. Optionally you
8363can also set the @code{:description} property to provide a default for
a7808fba 8364the link description when the link is later inserted into an Org
4009494e
GM
8365buffer with @kbd{C-c C-l}.
8366
8367@node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Extensions and Hacking
a7808fba 8368@section Tables and lists in arbitrary syntax
4009494e 8369@cindex tables, in other modes
dbc28aaa 8370@cindex lists, in other modes
a7808fba 8371@cindex Orgtbl mode
4009494e 8372
a7808fba 8373Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
4009494e 8374frequent feature request has been to make it work with native tables in
dbc28aaa
CD
8375specific languages, for example La@TeX{}. However, this is extremely
8376hard to do in a general way, would lead to a customization nightmare,
a7808fba 8377and would take away much of the simplicity of the Orgtbl mode table
dbc28aaa
CD
8378editor.
8379
4009494e 8380
a7808fba 8381This appendix describes a different approach. We keep the Orgtbl mode
4009494e
GM
8382table in its native format (the @i{source table}), and use a custom
8383function to @i{translate} the table to the correct syntax, and to
8384@i{install} it in the right location (the @i{target table}). This puts
8385the burden of writing conversion functions on the user, but it allows
8386for a very flexible system.
8387
dbc28aaa
CD
8388Bastien added the ability to do the same with lists. You can use Org's
8389facilities to edit and structure lists by turning @code{orgstruct-mode}
8390on, then locally exporting such lists in another format (HTML, La@TeX{}
a7808fba 8391or Texinfo.)
dbc28aaa
CD
8392
8393
4009494e
GM
8394@menu
8395* Radio tables:: Sending and receiving
8396* A LaTeX example:: Step by step, almost a tutorial
8397* Translator functions:: Copy and modify
a7808fba 8398* Radio lists:: Doing the same for lists
4009494e
GM
8399@end menu
8400
8401@node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
8402@subsection Radio tables
8403@cindex radio tables
8404
8405To define the location of the target table, you first need to create two
8406lines that are comments in the current mode, but contain magic words for
a7808fba 8407Orgtbl mode to find. Orgtbl mode will insert the translated table
4009494e
GM
8408between these lines, replacing whatever was there before. For example:
8409
8410@example
8411/* BEGIN RECEIVE ORGTBL table_name */
8412/* END RECEIVE ORGTBL table_name */
8413@end example
8414
8415@noindent
8416Just above the source table, we put a special line that tells
a7808fba 8417Orgtbl mode how to translate this table and where to install it. For
4009494e
GM
8418example:
8419@example
8420#+ORGTBL: SEND table_name translation_function arguments....
8421@end example
8422
8423@noindent
8424@code{table_name} is the reference name for the table that is also used
8425in the receiver lines. @code{translation_function} is the Lisp function
8426that does the translation. Furthermore, the line can contain a list of
8427arguments (alternating key and value) at the end. The arguments will be
8428passed as a property list to the translation function for
8429interpretation. A few standard parameters are already recognized and
8430acted upon before the translation function is called:
8431
8432@table @code
8433@item :skip N
8434Skip the first N lines of the table. Hlines do count!
8435@item :skipcols (n1 n2 ...)
8436List of columns that should be skipped. If the table has a column with
8437calculation marks, that column is automatically discarded as well.
8438Please note that the translator function sees the table @emph{after} the
8439removal of these columns, the function never knows that there have been
8440additional columns.
8441@end table
8442
8443@noindent
8444The one problem remaining is how to keep the source table in the buffer
8445without disturbing the normal workings of the file, for example during
8446compilation of a C file or processing of a La@TeX{} file. There are a
8447number of different solutions:
8448
8449@itemize @bullet
8450@item
8451The table could be placed in a block comment if that is supported by the
a7808fba 8452language. For example, in C mode you could wrap the table between
4009494e 8453@samp{/*} and @samp{*/} lines.
28a16a1b 8454@item
4009494e
GM
8455Sometimes it is possible to put the table after some kind of @i{END}
8456statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
8457in La@TeX{}.
8458@item
8459You can just comment the table line by line whenever you want to process
8460the file, and uncomment it whenever you need to edit the table. This
8461only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
8462make this comment-toggling very easy, in particular if you bind it to a
8463key.
8464@end itemize
8465
8466@node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
dbc28aaa 8467@subsection A LaTeX example of radio tables
a7808fba 8468@cindex LaTeX, and Orgtbl mode
4009494e
GM
8469
8470The best way to wrap the source table in La@TeX{} is to use the
8471@code{comment} environment provided by @file{comment.sty}. It has to be
8472activated by placing @code{\usepackage@{comment@}} into the document
a7808fba
CD
8473header. Orgtbl mode can insert a radio table skeleton@footnote{By
8474default this works only for La@TeX{}, HTML, and Texinfo. Configure the
4009494e
GM
8475variable @code{orgtbl-radio-tables} to install templates for other
8476modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will
8477be prompted for a table name, lets say we use @samp{salesfigures}. You
8478will then get the following template:
8479
8480@example
8481% BEGIN RECEIVE ORGTBL salesfigures
8482% END RECEIVE ORGTBL salesfigures
8483\begin@{comment@}
8484#+ORGTBL: SEND salesfigures orgtbl-to-latex
8485| | |
8486\end@{comment@}
8487@end example
8488
8489@noindent
a7808fba 8490The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
4009494e
GM
8491@code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
8492into the receiver location with name @code{salesfigures}. You may now
8493fill in the table, feel free to use the spreadsheet features@footnote{If
8494the @samp{#+TBLFM} line contains an odd number of dollar characters,
a7808fba 8495this may cause problems with font-lock in LaTeX mode. As shown in the
4009494e
GM
8496example you can fix this by adding an extra line inside the
8497@code{comment} environment that is used to balance the dollar
8498expressions. If you are using AUCTeX with the font-latex library, a
8499much better solution is to add the @code{comment} environment to the
8500variable @code{LaTeX-verbatim-environments}.}:
8501
8502@example
8503% BEGIN RECEIVE ORGTBL salesfigures
8504% END RECEIVE ORGTBL salesfigures
8505\begin@{comment@}
8506#+ORGTBL: SEND salesfigures orgtbl-to-latex
8507| Month | Days | Nr sold | per day |
8508|-------+------+---------+---------|
8509| Jan | 23 | 55 | 2.4 |
8510| Feb | 21 | 16 | 0.8 |
8511| March | 22 | 278 | 12.6 |
8512#+TBLFM: $4=$3/$2;%.1f
8513% $ (optional extra dollar to keep font-lock happy, see footnote)
8514\end@{comment@}
8515@end example
8516
8517@noindent
8518When you are done, press @kbd{C-c C-c} in the table to get the converted
8519table inserted between the two marker lines.
8520
8521Now lets assume you want to make the table header by hand, because you
8522want to control how columns are aligned etc. In this case we make sure
8523that the table translator does skip the first 2 lines of the source
8524table, and tell the command to work as a @i{splice}, i.e. to not produce
8525header and footer commands of the target table:
8526
8527@example
8528\begin@{tabular@}@{lrrr@}
8529Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
8530% BEGIN RECEIVE ORGTBL salesfigures
8531% END RECEIVE ORGTBL salesfigures
8532\end@{tabular@}
8533%
8534\begin@{comment@}
8535#+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
8536| Month | Days | Nr sold | per day |
8537|-------+------+---------+---------|
8538| Jan | 23 | 55 | 2.4 |
8539| Feb | 21 | 16 | 0.8 |
8540| March | 22 | 278 | 12.6 |
8541#+TBLFM: $4=$3/$2;%.1f
8542\end@{comment@}
8543@end example
8544
8545The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
a7808fba 8546Orgtbl mode. It uses a @code{tabular} environment to typeset the table
4009494e
GM
8547and marks horizontal lines with @code{\hline}. Furthermore, it
8548interprets the following parameters:
8549
8550@table @code
8551@item :splice nil/t
8552When set to t, return only table body lines, don't wrap them into a
8553tabular environment. Default is nil.
8554
8555@item :fmt fmt
8556A format to be used to wrap each field, should contain @code{%s} for the
8557original field value. For example, to wrap each field value in dollars,
8558you could use @code{:fmt "$%s$"}. This may also be a property list with
8559column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
a7808fba
CD
8560A function of one argument can be used in place of the strings; the
8561function must return a formatted string.
4009494e
GM
8562
8563@item :efmt efmt
8564Use this format to print numbers with exponentials. The format should
8565have @code{%s} twice for inserting mantissa and exponent, for example
8566@code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This
8567may also be a property list with column numbers and formats, for example
8568@code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
8569@code{efmt} has been applied to a value, @code{fmt} will also be
a7808fba
CD
8570applied. Similar to @code{fmt}, functions of two arguments can be
8571supplied instead of strings.
4009494e
GM
8572@end table
8573
dbc28aaa 8574@node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
4009494e 8575@subsection Translator functions
a7808fba 8576@cindex HTML, and Orgtbl mode
4009494e
GM
8577@cindex translator function
8578
a7808fba 8579Orgtbl mode has several translator functions built-in:
4009494e
GM
8580@code{orgtbl-to-latex}, @code{orgtbl-to-html}, and
8581@code{orgtbl-to-texinfo}. Except for @code{orgtbl-to-html}@footnote{The
8582HTML translator uses the same code that produces tables during HTML
8583export.}, these all use a generic translator, @code{orgtbl-to-generic}.
8584For example, @code{orgtbl-to-latex} itself is a very short function that
8585computes the column definitions for the @code{tabular} environment,
8586defines a few field and line separators and then hands over to the
8587generic translator. Here is the entire code:
8588
8589@lisp
8590@group
8591(defun orgtbl-to-latex (table params)
a7808fba 8592 "Convert the Orgtbl mode TABLE to LaTeX."
4009494e
GM
8593 (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
8594 org-table-last-alignment ""))
8595 (params2
8596 (list
8597 :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
8598 :tend "\\end@{tabular@}"
8599 :lstart "" :lend " \\\\" :sep " & "
8600 :efmt "%s\\,(%s)" :hline "\\hline")))
8601 (orgtbl-to-generic table (org-combine-plists params2 params))))
8602@end group
8603@end lisp
8604
8605As you can see, the properties passed into the function (variable
8606@var{PARAMS}) are combined with the ones newly defined in the function
8607(variable @var{PARAMS2}). The ones passed into the function (i.e. the
8608ones set by the @samp{ORGTBL SEND} line) take precedence. So if you
8609would like to use the La@TeX{} translator, but wanted the line endings to
8610be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
8611overrule the default with
8612
8613@example
8614#+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
8615@end example
8616
8617For a new language, you can either write your own converter function in
8618analogy with the La@TeX{} translator, or you can use the generic function
8619directly. For example, if you have a language where a table is started
8620with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
8621started with @samp{!BL!}, ended with @samp{!EL!} and where the field
8622separator is a TAB, you could call the generic translator like this (on
8623a single line!):
8624
8625@example
8626#+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
8627 :lstart "!BL! " :lend " !EL!" :sep "\t"
8628@end example
8629
8630@noindent
8631Please check the documentation string of the function
8632@code{orgtbl-to-generic} for a full list of parameters understood by
8633that function and remember that you can pass each of them into
8634@code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
8635using the generic function.
8636
8637Of course you can also write a completely new function doing complicated
8638things the generic translator cannot do. A translator function takes
8639two arguments. The first argument is the table, a list of lines, each
8640line either the symbol @code{hline} or a list of fields. The second
8641argument is the property list containing all parameters specified in the
8642@samp{#+ORGTBL: SEND} line. The function must return a single string
8643containing the formatted table. If you write a generally useful
8644translator, please post it on @code{emacs-orgmode@@gnu.org} so that
8645others can benefit from your work.
8646
dbc28aaa
CD
8647@node Radio lists, , Translator functions, Tables in arbitrary syntax
8648@subsection Radio lists
8649@cindex radio lists
8650@cindex org-list-insert-radio-list
8651
8652Sending and receiving radio lists works exactly the same way than
8653sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
8654need to load the @code{org-export-latex.el} package to use radio lists
8655since the relevant code is there for now.}. As for radio tables, you
a7808fba 8656can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
dbc28aaa
CD
8657calling @code{org-list-insert-radio-list}.
8658
8659Here are the differences with radio tables:
8660
8661@itemize @minus
8662@item
8663Use @code{ORGLST} instead of @code{ORGTBL}.
8664@item
8665The available translation functions for radio lists don't take
8666parameters.
28a16a1b 8667@item
dbc28aaa
CD
8668`C-c C-c' will work when pressed on the first item of the list.
8669@end itemize
8670
8671Here is a La@TeX{} example. Let's say that you have this in your
8672La@TeX{} file:
8673
8674@example
8675% BEGIN RECEIVE ORGLST to-buy
8676% END RECEIVE ORGLST to-buy
8677\begin@{comment@}
8678#+ORGLIST: SEND to-buy orgtbl-to-latex
8679- a new house
8680- a new computer
8681 + a new keyboard
8682 + a new mouse
8683- a new life
8684\end@{comment@}
8685@end example
8686
8687Pressing `C-c C-c' on @code{a new house} and will insert the converted
8688La@TeX{} list between the two marker lines.
8689
4009494e
GM
8690@node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Extensions and Hacking
8691@section Dynamic blocks
8692@cindex dynamic blocks
8693
a7808fba 8694Org documents can contain @emph{dynamic blocks}. These are
4009494e
GM
8695specially marked regions that are updated by some user-written function.
8696A good example for such a block is the clock table inserted by the
8697command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
8698
8699Dynamic block are enclosed by a BEGIN-END structure that assigns a name
8700to the block and can also specify parameters for the function producing
8701the content of the block.
8702
8703@example
8704#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
8705
8706#+END:
8707@end example
8708
8709Dynamic blocks are updated with the following commands
8710
8711@table @kbd
8712@kindex C-c C-x C-u
8713@item C-c C-x C-u
8714Update dynamic block at point.
8715@kindex C-u C-c C-x C-u
8716@item C-u C-c C-x C-u
8717Update all dynamic blocks in the current file.
8718@end table
8719
8720Updating a dynamic block means to remove all the text between BEGIN and
8721END, parse the BEGIN line for parameters and then call the specific
28a16a1b
CD
8722writer function for this block to insert the new content. If you want
8723to use the original content in the writer function, you can use the
8724extra parameter @code{:content}.
8725
8726For a block with name @code{myblock}, the writer function is
4009494e
GM
8727@code{org-dblock-write:myblock} with as only parameter a property list
8728with the parameters given in the begin line. Here is a trivial example
8729of a block that keeps track of when the block update function was last
8730run:
8731
8732@example
8733#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
8734
8735#+END:
8736@end example
8737
8738@noindent
8739The corresponding block writer function could look like this:
8740
8741@lisp
8742(defun org-dblock-write:block-update-time (params)
8743 (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
8744 (insert "Last block update at: "
8745 (format-time-string fmt (current-time)))))
8746@end lisp
8747
8748If you want to make sure that all dynamic blocks are always up-to-date,
8749you could add the function @code{org-update-all-dblocks} to a hook, for
8750example @code{before-save-hook}. @code{org-update-all-dblocks} is
a7808fba
CD
8751written in a way that is does nothing in buffers that are not in
8752@code{org-mode}.
4009494e
GM
8753
8754@node Special agenda views, Using the property API, Dynamic blocks, Extensions and Hacking
a7808fba 8755@section Special agenda views
4009494e
GM
8756@cindex agenda views, user-defined
8757
a7808fba 8758Org provides a special hook that can be used to narrow down the
4009494e
GM
8759selection made by any of the agenda views. You may specify a function
8760that is used at each match to verify if the match should indeed be part
8761of the agenda view, and if not, how much should be skipped.
8762
8763Let's say you want to produce a list of projects that contain a WAITING
8764tag anywhere in the project tree. Let's further assume that you have
a7808fba
CD
8765marked all tree headings that define a project with the TODO keyword
8766PROJECT. In this case you would run a TODO search for the keyword
4009494e
GM
8767PROJECT, but skip the match unless there is a WAITING tag anywhere in
8768the subtree belonging to the project line.
8769
8770To achieve this, you must write a function that searches the subtree for
8771the tag. If the tag is found, the function must return @code{nil} to
8772indicate that this match should not be skipped. If there is no such
8773tag, return the location of the end of the subtree, to indicate that
8774search should continue from there.
8775
8776@lisp
8777(defun my-skip-unless-waiting ()
8778 "Skip trees that are not waiting"
8779 (let ((subtree-end (save-excursion (org-end-of-subtree t))))
dbc28aaa 8780 (if (re-search-forward ":waiting:" subtree-end t)
4009494e
GM
8781 nil ; tag found, do not skip
8782 subtree-end))) ; tag not found, continue after end of subtree
8783@end lisp
8784
8785Now you may use this function in an agenda custom command, for example
8786like this:
8787
8788@lisp
8789(org-add-agenda-custom-command
8790 '("b" todo "PROJECT"
8791 ((org-agenda-skip-function 'my-org-waiting-projects)
8792 (org-agenda-overriding-header "Projects waiting for something: "))))
8793@end lisp
8794
8795Note that this also binds @code{org-agenda-overriding-header} to get a
8796meaningful header in the agenda view.
8797
a7808fba
CD
8798A general way to create custom searches is to base them on a search for
8799entries with a certain level limit. If you want to study all entries with
8800your custom search function, simply do a search for @samp{LEVEL>0}, and then
8801use @code{org-agenda-skip-function} to select the entries you really want to
8802have.
8803
4009494e
GM
8804You may also put a Lisp form into @code{org-agenda-skip-function}. In
8805particular, you may use the functions @code{org-agenda-skip-entry-if}
8806and @code{org-agenda-skip-subtree-if} in this form, for example:
8807
8808@table @code
8809@item '(org-agenda-skip-entry-if 'scheduled)
8810Skip current entry if it has been scheduled.
8811@item '(org-agenda-skip-entry-if 'notscheduled)
8812Skip current entry if it has not been scheduled.
8813@item '(org-agenda-skip-entry-if 'deadline)
8814Skip current entry if it has a deadline.
8815@item '(org-agenda-skip-entry-if 'scheduled 'deadline)
8816Skip current entry if it has a deadline, or if it is scheduled.
8817@item '(org-agenda-skip-entry 'regexp "regular expression")
dbc28aaa
CD
8818Skip current entry if the regular expression matches in the entry.
8819@item '(org-agenda-skip-entry 'notregexp "regular expression")
8820Skip current entry unless the regular expression matches.
4009494e
GM
8821@item '(org-agenda-skip-subtree-if 'regexp "regular expression")
8822Same as above, but check and skip the entire subtree.
8823@end table
8824
8825Therefore we could also have written the search for WAITING projects
8826like this, even without defining a special function:
8827
8828@lisp
8829(org-add-agenda-custom-command
8830 '("b" todo "PROJECT"
8831 ((org-agenda-skip-function '(org-agenda-skip-subtree-if
dbc28aaa 8832 'regexp ":waiting:"))
4009494e
GM
8833 (org-agenda-overriding-header "Projects waiting for something: "))))
8834@end lisp
8835
4009494e
GM
8836@node Using the property API, , Special agenda views, Extensions and Hacking
8837@section Using the property API
8838@cindex API, for properties
8839@cindex properties, API
8840
8841Here is a description of the functions that can be used to work with
8842properties.
8843
8844@defun org-entry-properties &optional pom which
8845Get all properties of the entry at point-or-marker POM.
8846This includes the TODO keyword, the tags, time strings for deadline,
8847scheduled, and clocking, and any additional properties defined in the
8848entry. The return value is an alist, keys may occur multiple times
8849if the property key was used several times.
8850POM may also be nil, in which case the current entry is used.
8851If WHICH is nil or `all', get all properties. If WHICH is
8852`special' or `standard', only get that subclass.
8853@end defun
8854@defun org-entry-get pom property &optional inherit
a7808fba
CD
8855Get value of PROPERTY for entry at point-or-marker POM. By default,
8856this only looks at properties defined locally in the entry. If INHERIT
8857is non-nil and the entry does not have the property, then also check
8858higher levels of the hierarchy. If INHERIT is the symbol
8859@code{selective}, use inheritance if and only if the setting of
8860@code{org-use-property-inheritance} selects PROPERTY for inheritance.
4009494e
GM
8861@end defun
8862
8863@defun org-entry-delete pom property
8864Delete the property PROPERTY from entry at point-or-marker POM.
8865@end defun
8866
8867@defun org-entry-put pom property value
8868Set PROPERTY to VALUE for entry at point-or-marker POM.
8869@end defun
8870
8871@defun org-buffer-property-keys &optional include-specials
8872Get all property keys in the current buffer.
8873@end defun
8874
8875@defun org-insert-property-drawer
8876Insert a property drawer at point.
8877@end defun
8878
a7808fba
CD
8879@defun org-entry-add-to-multivalued-property pom property value
8880Treat the value of the property PROPERTY as a whitespace-separated list of
8881values and make sure that VALUE is in this list.
8882@end defun
8883
8884@defun org-entry-remove-from-multivalued-property pom property value
8885Treat the value of the property PROPERTY as a whitespace-separated list of
8886values and make sure that VALUE is @emph{not} in this list.
8887@end defun
8888
8889@defun org-entry-member-in-multivalued-property pom property value
8890Treat the value of the property PROPERTY as a whitespace-separated list of
8891values and check if VALUE is in this list.
8892@end defun
8893
dbc28aaa 8894@node History and Acknowledgments, Main Index, Extensions and Hacking, Top
4009494e
GM
8895@appendix History and Acknowledgments
8896@cindex acknowledgments
8897@cindex history
8898@cindex thanks
8899
a7808fba
CD
8900Org was borne in 2003, out of frustration over the user interface
8901of the Emacs Outline mode. I was trying to organize my notes and
4009494e
GM
8902projects, and using Emacs seemed to be the natural way to go. However,
8903having to remember eleven different commands with two or three keys per
a7808fba 8904command, only to hide and show parts of the outline tree, that seemed
4009494e
GM
8905entirely unacceptable to me. Also, when using outlines to take notes, I
8906constantly want to restructure the tree, organizing it parallel to my
8907thoughts and plans. @emph{Visibility cycling} and @emph{structure
8908editing} were originally implemented in the package
8909@file{outline-magic.el}, but quickly moved to the more general
8910@file{org.el}. As this environment became comfortable for project
8911planning, the next step was adding @emph{TODO entries}, basic @emph{time
8912stamps}, and @emph{table support}. These areas highlight the two main
a7808fba 8913goals that Org still has today: To create a new, outline-based,
4009494e
GM
8914plain text mode with innovative and intuitive editing features, and to
8915incorporate project planning functionality directly into a notes file.
8916
a7808fba
CD
8917A special thanks goes to @i{Bastien Guerry} who has not only writen a large
8918number of extensions to Org (most of them integrated into the core by now),
8919but has also helped the development and maintenance of Org so much that he
8920should be considered co-author of this package.
8921
4009494e
GM
8922Since the first release, literally thousands of emails to me or on
8923@code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
8924reports, feedback, new ideas, and sometimes patches and add-on code.
8925Many thanks to everyone who has helped to improve this package. I am
8926trying to keep here a list of the people who had significant influence
a7808fba 8927in shaping one or more aspects of Org. The list may not be
4009494e
GM
8928complete, if I have forgotten someone, please accept my apologies and
8929let me know.
8930
8931@itemize @bullet
8932
8933@item
8934@i{Russel Adams} came up with the idea for drawers.
8935@item
a7808fba 8936@i{Thomas Baumann} wrote @file{org-bbdb.el} and @file{org-mhe.el}.
4009494e
GM
8937@item
8938@i{Alex Bochannek} provided a patch for rounding time stamps.
8939@item
8940@i{Charles Cave}'s suggestion sparked the implementation of templates
8941for Remember.
8942@item
8943@i{Pavel Chalmoviansky} influenced the agenda treatment of items with
8944specified time.
8945@item
8946@i{Gregory Chernov} patched support for lisp forms into table
8947calculations and improved XEmacs compatibility, in particular by porting
8948@file{nouline.el} to XEmacs.
8949@item
8950@i{Sacha Chua} suggested to copy some linking code from Planner.
8951@item
8952@i{Eddward DeVilla} proposed and tested checkbox statistics. He also
8953came up with the idea of properties, and that there should be an API for
8954them.
8955@item
8956@i{Kees Dullemond} used to edit projects lists directly in HTML and so
8957inspired some of the early development, including HTML export. He also
8958asked for a way to narrow wide table columns.
8959@item
a7808fba 8960@i{Christian Egli} converted the documentation into Texinfo format,
4009494e
GM
8961patched CSS formatting into the HTML exporter, and inspired the agenda.
8962@item
8963@i{David Emery} provided a patch for custom CSS support in exported
8964HTML agendas.
8965@item
8966@i{Nic Ferrier} contributed mailcap and XOXO support.
8967@item
28a16a1b
CD
8968@i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
8969@item
4009494e
GM
8970@i{John Foerch} figured out how to make incremental search show context
8971around a match in a hidden outline tree.
8972@item
dbc28aaa 8973@i{Niels Giesen} had the idea to automatically archive DONE trees.
4009494e 8974@item
a7808fba
CD
8975@i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and
8976has been prolific with patches, ideas, and bug reports.
4009494e
GM
8977@item
8978@i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
8979@item
a7808fba
CD
8980@i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
8981task state change logging, and the clocktable. His clear explanations have
8982been critical when we started to adopt the GIT version control system.
8983@item
8984@i{Phil Jackson} wrote @file{org-irc.el}.
8985@item
4009494e
GM
8986@i{Scott Jaderholm} proposed footnotes, control over whitespace between
8987folded entries, and column view for properties.
8988@item
a7808fba
CD
8989@i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}.
8990@item
4009494e
GM
8991@i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also
8992provided frequent feedback and some patches.
8993@item
8994@i{Jason F. McBrayer} suggested agenda export to CSV format.
8995@item
dbc28aaa
CD
8996@i{Max Mikhanosha} came up with the idea of refiling.
8997@item
4009494e
GM
8998@i{Dmitri Minaev} sent a patch to set priority limits on a per-file
8999basis.
9000@item
9001@i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
9002happy.
9003@item
dbc28aaa
CD
9004@i{Rick Moynihan} proposed to allow multiple TODO sequences in a file
9005and to be able to quickly restrict the agenda to a subtree.
4009494e
GM
9006@item
9007@i{Todd Neal} provided patches for links to Info files and elisp forms.
9008@item
9009@i{Tim O'Callaghan} suggested in-file links, search options for general
9010file links, and TAGS.
9011@item
9012@i{Takeshi Okano} translated the manual and David O'Toole's tutorial
9013into Japanese.
9014@item
9015@i{Oliver Oppitz} suggested multi-state TODO items.
9016@item
9017@i{Scott Otterson} sparked the introduction of descriptive text for
9018links, among other things.
9019@item
9020@i{Pete Phillips} helped during the development of the TAGS feature, and
9021provided frequent feedback.
9022@item
9023@i{T.V. Raman} reported bugs and suggested improvements.
9024@item
9025@i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
9026control.
9027@item
9028@i{Kevin Rogers} contributed code to access VM files on remote hosts.
9029@item
a7808fba
CD
9030@i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
9031webpages derived from Org using an Info-like, or a folding interface with
9032single key navigation.
9033@item
4009494e
GM
9034@i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
9035conflict with @file{allout.el}.
9036@item
9037@i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords.
9038@item
a7808fba 9039@i{Philip Rooke} created the Org reference card and provided lots
4009494e
GM
9040of feedback.
9041@item
9042@i{Christian Schlauer} proposed angular brackets around links, among
9043other things.
9044@item
a7808fba 9045Linking to VM/BBDB/Gnus was inspired by @i{Tom Shannon}'s
4009494e
GM
9046@file{organizer-mode.el}.
9047@item
a7808fba
CD
9048@i{Ilya Shlyakhter} proposed the Archive Sibling.
9049@item
4009494e
GM
9050@i{Daniel Sinder} came up with the idea of internal archiving by locking
9051subtrees.
9052@item
9053@i{Dale Smith} proposed link abbreviations.
9054@item
9055@i{Adam Spiers} asked for global linking commands and inspired the link
9056extension system. support mairix.
9057@item
9058@i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
9059chapter about publishing.
9060@item
9061@i{J@"urgen Vollmer} contributed code generating the table of contents
9062in HTML output.
9063@item
9064@i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
9065keyword.
9066@item
9067@i{David Wainberg} suggested archiving, and improvements to the linking
9068system.
9069@item
9070@i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}. The
a7808fba
CD
9071development of Org was fully independent, and both systems are really
9072different beasts in their basic ideas and implementation details. I later
9073looked at John's code, however, and learned from his implementation of (i)
9074links where the link itself is hidden and only a description is shown, and
9075(ii) popping up a calendar to select a date. John has also contributed a
9076number of great ideas and patches directly to Org, including the file
9077@code{org-mac-message.el}'
4009494e
GM
9078@item
9079@i{Carsten Wimmer} suggested some changes and helped fix a bug in
a7808fba 9080linking to Gnus.
4009494e 9081@item
a7808fba 9082@i{Roland Winkler} requested additional key bindings to make Org
4009494e
GM
9083work on a tty.
9084@item
9085@i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
9086and contributed various ideas and code snippets.
9087@end itemize
9088
9089
dbc28aaa
CD
9090@node Main Index, Key Index, History and Acknowledgments, Top
9091@unnumbered The Main Index
4009494e
GM
9092
9093@printindex cp
9094
dbc28aaa 9095@node Key Index, , Main Index, Top
4009494e
GM
9096@unnumbered Key Index
9097
9098@printindex ky
9099
9100@bye
9101
9102@ignore
a7808fba 9103 arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
4009494e 9104@end ignore
a7808fba
CD
9105
9106@c Local variables:
9107@c ispell-local-dictionary: "en_US-w_accents"
9108@c ispell-local-pdict: "./.aspell.org.pws"
9109@c fill-column: 77
9110@c End: