Change to GFDL 1.2. Refer to license in Emacs manual.
[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
5b14aca9 42under the terms of the GNU Free Documentation License, Version 1.2 or
4009494e
GM
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
5b14aca9 47License'' in the Emacs manual.
4009494e 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.''
5b14aca9
GM
52
53This document is part of a collection distributed under the GNU Free
54Documentation License. If you want to distribute this document
55separately from the collection, you can do so by adding a copy of the
56license to the document, as described in section 6 of the license.
4009494e
GM
57@end quotation
58@end copying
59
60@titlepage
a7808fba 61@title The Org Manual
4009494e
GM
62
63@subtitle Release @value{VERSION}
64@author by Carsten Dominik
65
66@c The following two commands start the copyright page.
67@page
68@vskip 0pt plus 1filll
69@insertcopying
70@end titlepage
71
72@c Output the table of contents at the beginning.
73@contents
74
75@ifnottex
76@node Top, Introduction, (dir), (dir)
77@top Org Mode Manual
78
79@insertcopying
80@end ifnottex
81
82@menu
83* Introduction:: Getting started
a7808fba 84* Document Structure:: A tree works like your brain
4009494e
GM
85* Tables:: Pure magic for quick formatting
86* Hyperlinks:: Notes in context
a7808fba 87* TODO Items:: Every tree branch can be a TODO item
4009494e 88* Tags:: Tagging headlines and matching sets of tags
a7808fba
CD
89* Properties and Columns:: Storing information about an entry
90* Dates and Times:: Making items useful for planning
dbc28aaa 91* Remember:: Quickly adding nodes to the outline tree
a7808fba 92* Agenda Views:: Collecting information into views
4009494e
GM
93* Embedded LaTeX:: LaTeX fragments and formulas
94* Exporting:: Sharing and publishing of notes
a7808fba 95* Publishing:: Create a web site of linked Org files
4009494e
GM
96* Miscellaneous:: All the rest which did not fit elsewhere
97* Extensions and Hacking:: It is possible to write add-on code
a7808fba
CD
98* History and Acknowledgments:: How Org came into being
99* Main Index:: An index of Org's concepts and features
4009494e
GM
100* Key Index:: Key bindings and where they are described
101
102@detailmenu
103 --- The Detailed Node Listing ---
104
105Introduction
106
a7808fba
CD
107* Summary:: Brief summary of what Org does
108* Installation:: How to install a downloaded version of Org
109* Activation:: How to activate Org for certain buffers
4009494e 110* Feedback:: Bug reports, ideas, patches etc.
dbc28aaa 111* Conventions:: Type-setting conventions in the manual
4009494e
GM
112
113Document Structure
114
a7808fba
CD
115* Outlines:: Org is based on Outline mode
116* Headlines:: How to typeset Org tree headlines
4009494e
GM
117* Visibility cycling:: Show and hide, much simplified
118* Motion:: Jumping to other headlines
119* Structure editing:: Changing sequence and level of headlines
120* Archiving:: Move done task trees to a different place
121* Sparse trees:: Matches embedded in context
122* Plain lists:: Additional structure within an entry
123* Drawers:: Tucking stuff away
a7808fba 124* Orgstruct mode:: Structure editing outside Org
4009494e
GM
125
126Archiving
127
128* ARCHIVE tag:: Marking a tree as inactive
129* Moving subtrees:: Moving a tree to an archive file
130
131Tables
132
133* Built-in table editor:: Simple tables
28a16a1b 134* Narrow columns:: Stop wasting space in tables
4009494e 135* Column groups:: Grouping to trigger vertical lines
a7808fba
CD
136* Orgtbl mode:: The table editor as minor mode
137* The spreadsheet:: The table editor has spreadsheet capabilities
4009494e
GM
138
139The spreadsheet
140
141* References:: How to refer to another field or range
142* Formula syntax for Calc:: Using Calc to compute stuff
143* Formula syntax for Lisp:: Writing formulas in Emacs Lisp
144* Field formulas:: Formulas valid for a single field
145* Column formulas:: Formulas valid for an entire column
146* Editing and debugging formulas:: Fixing formulas
147* Updating the table:: Recomputing all dependent fields
148* Advanced features:: Field names, parameters and automatic recalc
149
150Hyperlinks
151
a7808fba 152* Link format:: How links in Org are formatted
4009494e
GM
153* Internal links:: Links to other places in the current file
154* External links:: URL-like links to the world
155* Handling links:: Creating, inserting and following
a7808fba 156* Using links outside Org:: Linking from my C source code?
4009494e
GM
157* Link abbreviations:: Shortcuts for writing complex links
158* Search options:: Linking to a specific location
159* Custom searches:: When the default search is not enough
4009494e
GM
160
161Internal links
162
a7808fba 163* Radio targets:: Make targets trigger links in plain text
4009494e 164
a7808fba 165TODO Items
4009494e
GM
166
167* TODO basics:: Marking and displaying TODO entries
168* TODO extensions:: Workflow and assignments
dbc28aaa 169* Progress logging:: Dates and notes for progress
4009494e
GM
170* Priorities:: Some things are more important than others
171* Breaking down tasks:: Splitting a task into manageable pieces
172* Checkboxes:: Tick-off lists
173
174Extended use of TODO keywords
175
176* Workflow states:: From TODO to DONE in steps
dbc28aaa 177* TODO types:: I do this, Fred does the rest
4009494e 178* Multiple sets in one file:: Mixing it all, and still finding your way
dbc28aaa
CD
179* Fast access to TODO states:: Single letter selection of a state
180* Per-file keywords:: Different files, different requirements
181* Faces for TODO keywords:: Highlighting states
182
a7808fba 183Progress logging
dbc28aaa
CD
184
185* Closing items:: When was this entry marked DONE?
186* Tracking TODO state changes:: When did the status change?
4009494e
GM
187
188Tags
189
190* Tag inheritance:: Tags use the tree structure of the outline
191* Setting tags:: How to assign tags to a headline
192* Tag searches:: Searching for combinations of tags
193
194Properties and Columns
195
196* Property syntax:: How properties are spelled out
a7808fba 197* Special properties:: Access to other Org mode features
4009494e 198* Property searches:: Matching property values
dbc28aaa 199* Property inheritance:: Passing values down the tree
4009494e
GM
200* Column view:: Tabular viewing and editing
201* Property API:: Properties for Lisp programmers
202
a7808fba 203Column view
4009494e
GM
204
205* Defining columns:: The COLUMNS format property
206* Using column view:: How to create and use column view
a7808fba 207* Capturing column view:: A dynamic block for column view
4009494e 208
a7808fba 209Defining columns
4009494e
GM
210
211* Scope of column definitions:: Where defined, where valid?
212* Column attributes:: Appearance and content of a column
213
dbc28aaa 214Dates and Times
4009494e 215
a7808fba 216* Timestamps:: Assigning a time to a tree entry
4009494e
GM
217* Creating timestamps:: Commands which insert timestamps
218* Deadlines and scheduling:: Planning your work
a7808fba
CD
219* Clocking work time:: Tracking how long you spend on a task
220* Effort estimates:: Planning work effort in advance
4009494e
GM
221
222Creating timestamps
223
a7808fba
CD
224* The date/time prompt:: How Org mode helps you entering date and time
225* Custom time format:: Making dates look different
4009494e 226
a7808fba 227Deadlines and scheduling
4009494e
GM
228
229* Inserting deadline/schedule:: Planning items
230* Repeated tasks:: Items that show up again and again
231
dbc28aaa 232Remember
4009494e 233
a7808fba 234* Setting up Remember:: Some code for .emacs to get things going
dbc28aaa
CD
235* Remember templates:: Define the outline of different note types
236* Storing notes:: Directly get the note to where it belongs
237* Refiling notes:: Moving a note or task to a project
4009494e
GM
238
239Agenda Views
240
241* Agenda files:: Files being searched for agenda information
242* Agenda dispatcher:: Keyboard access to agenda views
243* Built-in agenda views:: What is available out of the box?
244* Presentation and sorting:: How agenda items are prepared for display
a7808fba 245* Agenda commands:: Remote editing of Org trees
4009494e 246* Custom agenda views:: Defining special searches and views
a7808fba 247* Agenda column view:: Using column view for collected entries
4009494e
GM
248
249The built-in agenda views
250
a7808fba 251* Weekly/daily agenda:: The calendar page with current tasks
4009494e
GM
252* Global TODO list:: All unfinished action items
253* Matching tags and properties:: Structured information with fine-tuned search
254* Timeline:: Time-sorted view for single file
28a16a1b 255* Keyword search:: Finding entries by keyword
4009494e
GM
256* Stuck projects:: Find projects you need to review
257
258Presentation and sorting
259
260* Categories:: Not all tasks are equal
261* Time-of-day specifications:: How the agenda knows the time
262* Sorting of agenda items:: The order of things
263
264Custom agenda views
265
266* Storing searches:: Type once, use often
267* Block agenda:: All the stuff you need in a single buffer
268* Setting Options:: Changing the rules
a7808fba
CD
269* Exporting Agenda Views:: Writing agendas to files
270* Using the agenda elsewhere:: Using agenda information in other programs
4009494e
GM
271
272Embedded LaTeX
273
274* Math symbols:: TeX macros for symbols and Greek letters
a7808fba 275* Subscripts and superscripts:: Simple syntax for raising/lowering text
4009494e
GM
276* LaTeX fragments:: Complex formulas made easy
277* Processing LaTeX fragments:: Previewing LaTeX processing
278* CDLaTeX mode:: Speed up entering of formulas
279
280Exporting
281
282* ASCII export:: Exporting to plain ASCII
283* HTML export:: Exporting to HTML
284* LaTeX export:: Exporting to LaTeX
285* XOXO export:: Exporting to XOXO
286* iCalendar export:: Exporting in iCalendar format
287* Text interpretation:: How the exporter looks at the file
288
289HTML export
290
291* HTML Export commands:: How to invoke LaTeX export
a7808fba 292* Quoting HTML tags:: Using direct HTML in Org mode
4009494e
GM
293* Links:: Transformation of links for HTML
294* Images:: How to include images
a7808fba
CD
295* CSS support:: Changing the appearance of the output
296* Javascript support:: Info and Folding in a web browser
4009494e
GM
297
298LaTeX export
299
300* LaTeX export commands:: How to invoke LaTeX export
301* Quoting LaTeX code:: Incorporating literal LaTeX code
a7808fba 302* Sectioning structure:: Changing sectioning in LaTeX output
4009494e
GM
303
304Text interpretation by the exporter
305
306* Comment lines:: Some lines will not be exported
307* Initial text:: Text before the first headline
308* Footnotes:: Numbers like [1]
a7808fba 309* Quoted examples:: Inserting quoted chunks of text
4009494e
GM
310* Enhancing text:: Subscripts, symbols and more
311* Export options:: How to influence the export settings
312
313Publishing
314
315* Configuration:: Defining projects
316* Sample configuration:: Example projects
317* Triggering publication:: Publication commands
318
319Configuration
320
321* Project alist:: The central configuration variable
322* Sources and destinations:: From here to there
323* Selecting files:: What files are part of the project?
324* Publishing action:: Setting the function doing the publishing
325* Publishing options:: Tweaking HTML export
326* Publishing links:: Which links keep working after publishing?
327* Project page index:: Publishing a list of project files
328
329Sample configuration
330
331* Simple example:: One-component publishing
332* Complex example:: A multi-component publishing example
333
334Miscellaneous
335
336* Completion:: M-TAB knows what you need
a7808fba 337* Customization:: Adapting Org to your taste
4009494e
GM
338* In-buffer settings:: Overview of the #+KEYWORDS
339* The very busy C-c C-c key:: When in doubt, press C-c C-c
340* Clean view:: Getting rid of leading stars in the outline
a7808fba 341* TTY keys:: Using Org on a tty
4009494e
GM
342* Interaction:: Other Emacs packages
343* Bugs:: Things which do not work perfectly
344
345Interaction with other packages
346
a7808fba 347* Cooperation:: Packages Org cooperates with
4009494e
GM
348* Conflicts:: Packages that lead to conflicts
349
350Extensions, Hooks and Hacking
351
a7808fba 352* Extensions:: Existing 3rd-party extensions
4009494e
GM
353* Adding hyperlink types:: New custom link types
354* Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
355* Dynamic blocks:: Automatically filled blocks
356* Special agenda views:: Customized views
357* Using the property API:: Writing programs that use entry properties
358
a7808fba 359Tables and lists in arbitrary syntax
4009494e
GM
360
361* Radio tables:: Sending and receiving
362* A LaTeX example:: Step by step, almost a tutorial
363* Translator functions:: Copy and modify
a7808fba 364* Radio lists:: Doing the same for lists
4009494e
GM
365
366@end detailmenu
367@end menu
368
a7808fba 369@node Introduction, Document Structure, Top, Top
4009494e
GM
370@chapter Introduction
371@cindex introduction
372
373@menu
a7808fba
CD
374* Summary:: Brief summary of what Org does
375* Installation:: How to install a downloaded version of Org
376* Activation:: How to activate Org for certain buffers
4009494e 377* Feedback:: Bug reports, ideas, patches etc.
dbc28aaa 378* Conventions:: Type-setting conventions in the manual
4009494e
GM
379@end menu
380
381@node Summary, Installation, Introduction, Introduction
382@section Summary
383@cindex summary
384
a7808fba 385Org is a mode for keeping notes, maintaining TODO lists, and doing
4009494e
GM
386project planning with a fast and effective plain-text system.
387
a7808fba
CD
388Org develops organizational tasks around NOTES files that contain
389lists or information about projects as plain text. Org is
390implemented on top of Outline mode, which makes it possible to keep the
4009494e
GM
391content of large files well structured. Visibility cycling and
392structure editing help to work with the tree. Tables are easily created
a7808fba 393with a built-in table editor. Org supports TODO items, deadlines,
4009494e
GM
394time stamps, and scheduling. It dynamically compiles entries into an
395agenda that utilizes and smoothly integrates much of the Emacs calendar
396and diary. Plain text URL-like links connect to websites, emails,
397Usenet messages, BBDB entries, and any files related to the projects.
a7808fba 398For printing and sharing of notes, an Org file can be exported as a
dbc28aaa 399structured ASCII file, as HTML, or (TODO and agenda items only) as an
4009494e 400iCalendar file. It can also serve as a publishing tool for a set of
a7808fba 401linked web pages.
4009494e 402
a7808fba 403An important design aspect that distinguishes Org from for example
4009494e
GM
404Planner/Muse is that it encourages to store every piece of information
405only once. In Planner, you have project pages, day pages and possibly
a7808fba 406other files, duplicating some information such as tasks. In Org,
4009494e
GM
407you only have notes files. In your notes you mark entries as tasks,
408label them with tags and timestamps. All necessary lists like a
409schedule for the day, the agenda for a meeting, tasks lists selected by
410tags etc are created dynamically when you need them.
411
a7808fba 412Org keeps simple things simple. When first fired up, it should
4009494e
GM
413feel like a straightforward, easy to use outliner. Complexity is not
414imposed, but a large amount of functionality is available when you need
a7808fba 415it. Org is a toolbox and can be used in different ways, for
4009494e
GM
416example as:
417
418@example
419@r{@bullet{} outline extension with visibility cycling and structure editing}
420@r{@bullet{} ASCII system and table editor for taking structured notes}
421@r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
422@r{@bullet{} TODO list editor}
423@r{@bullet{} full agenda and planner with deadlines and work scheduling}
424@r{@bullet{} environment to implement David Allen's GTD system}
425@r{@bullet{} a basic database application}
dbc28aaa 426@r{@bullet{} simple hypertext system, with HTML and LaTeX export}
4009494e
GM
427@r{@bullet{} publishing tool to create a set of interlinked webpages}
428@end example
429
a7808fba 430Org's automatic, context sensitive table editor with spreadsheet
4009494e 431capabilities can be integrated into any major mode by activating the
a7808fba 432minor Orgtbl mode. Using a translation step, it can be used to maintain
4009494e 433tables in arbitrary file types, for example in La@TeX{}. The structure
a7808fba
CD
434editing and list creation capabilities can be used outside Org with
435the minor Orgstruct mode.
4009494e
GM
436
437@cindex FAQ
a7808fba
CD
438There is a website for Org which provides links to the newest
439version of Org, as well as additional information, frequently asked
4009494e 440questions (FAQ), links to tutorials etc. This page is located at
dbc28aaa 441@uref{http://orgmode.org}.
4009494e
GM
442
443@page
444
445
446@node Installation, Activation, Summary, Introduction
447@section Installation
448@cindex installation
449@cindex XEmacs
450
a7808fba 451@b{Important:} @i{If Org is part of the Emacs distribution or an
4009494e
GM
452XEmacs package, please skip this section and go directly to
453@ref{Activation}.}
454
a7808fba
CD
455If you have downloaded Org from the Web, either as a distribution @file{.zip}
456or @file{.tar} file, or as a GIT archive, you must take the following steps
457to install it: Go into the unpacked Org distribution directory and edit the
458top section of the file @file{Makefile}. You must set the name of the Emacs
459binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
460directories where local Lisp and Info files are kept. If you don't have
461access to the system-wide directories, you can simply run Org directly from
462the distribution directory by adding the @file{lisp} subdirectory to the
463Emacs load path. To do this, add the following line to @file{.emacs}:
4009494e
GM
464
465@example
a7808fba
CD
466(setq load-path (cons "~/path/to/orgdir/lisp" load-path))
467@end example
468
469@noindent
470If you plan to use code from the @file{contrib} subdirectory, do a similar
471step for this directory:
472
473@example
474(setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
4009494e
GM
475@end example
476
477@b{XEmacs users now need to install the file @file{noutline.el} from
a7808fba 478the @file{xemacs} sub-directory of the Org distribution. Use the
4009494e
GM
479command:}
480
481@example
482@b{make install-noutline}
483@end example
484
a7808fba 485@noindent Now byte-compile the Lisp files with the shell command:
4009494e
GM
486
487@example
488make
4009494e
GM
489@end example
490
a7808fba
CD
491@noindent If you are running Org from the distribution directory, this is
492all. If you want to install into the system directories, use
4009494e
GM
493
494@example
a7808fba 495make install
4009494e
GM
496make install-info
497@end example
498
499@noindent Then add to @file{.emacs}:
500
501@lisp
a7808fba 502;; This line only if Org is not part of the X/Emacs distribution.
4009494e
GM
503(require 'org-install)
504@end lisp
505
a7808fba 506
4009494e
GM
507@node Activation, Feedback, Installation, Introduction
508@section Activation
509@cindex activation
510@cindex autoload
a7808fba
CD
511@cindex global key bindings
512@cindex key bindings, global
4009494e
GM
513
514@iftex
515@b{Important:} @i{If you use copy-and-paste to copy lisp code from the
516PDF documentation as viewed by Acrobat reader to your .emacs file, the
517single quote character comes out incorrectly and the code will not work.
518You need to fix the single quotes by hand, or copy from Info
519documentation.}
520@end iftex
521
522Add the following lines to your @file{.emacs} file. The last two lines
a7808fba
CD
523define @emph{global} keys for the commands @command{org-store-link},
524@command{org-agenda}, and @command{org-iswitchb} - please choose suitable
525keys yourself.
4009494e
GM
526
527@lisp
528;; The following lines are always needed. Choose your own keys.
529(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
530(global-set-key "\C-cl" 'org-store-link)
531(global-set-key "\C-ca" 'org-agenda)
a7808fba 532(global-set-key "\C-cb" 'org-iswitchb)
4009494e
GM
533@end lisp
534
a7808fba 535Furthermore, you must activate @code{font-lock-mode} in Org
4009494e
GM
536buffers, because significant functionality depends on font-locking being
537active. You can do this with either one of the following two lines
538(XEmacs user must use the second option):
539@lisp
540(global-font-lock-mode 1) ; for all buffers
a7808fba 541(add-hook 'org-mode-hook 'turn-on-font-lock) ; Org buffers only
4009494e
GM
542@end lisp
543
a7808fba 544@cindex Org mode, turning on
4009494e 545With this setup, all files with extension @samp{.org} will be put
a7808fba 546into Org mode. As an alternative, make the first line of a file look
4009494e
GM
547like this:
548
549@example
550MY PROJECTS -*- mode: org; -*-
551@end example
552
a7808fba 553@noindent which will select Org mode for this buffer no matter what
4009494e
GM
554the file's name is. See also the variable
555@code{org-insert-mode-line-in-empty-file}.
556
dbc28aaa 557@node Feedback, Conventions, Activation, Introduction
4009494e
GM
558@section Feedback
559@cindex feedback
560@cindex bug reports
561@cindex maintainer
562@cindex author
563
a7808fba 564If you find problems with Org, or if you have questions, remarks,
4009494e
GM
565or ideas about it, please contact the maintainer @value{MAINTAINER} at
566@value{MAINTAINEREMAIL}.
567
568For bug reports, please provide as much information as possible,
569including the version information of Emacs (@kbd{C-h v emacs-version
a7808fba
CD
570@key{RET}}) and Org (@kbd{C-h v org-version @key{RET}}), as well as
571the Org related setup in @file{.emacs}. If an error occurs, a
4009494e
GM
572backtrace can be very useful (see below on how to create one). Often a
573small example file helps, along with clear information about:
574
575@enumerate
576@item What exactly did you do?
577@item What did you expect to happen?
578@item What happened instead?
579@end enumerate
580@noindent Thank you for helping to improve this mode.
581
582@subsubheading How to create a useful backtrace
583
584@cindex backtrace of an error
a7808fba 585If working with Org produces an error with a message you don't
4009494e
GM
586understand, you may have hit a bug. The best way to report this is by
587providing, in addition to what was mentioned above, a @emph{Backtrace}.
588This is information from the built-in debugger about where and how the
589error occurred. Here is how to produce a useful backtrace:
590
591@enumerate
592@item
593Start a fresh Emacs or XEmacs, and make sure that it will load the
594original Lisp code in @file{org.el} instead of the compiled version in
595@file{org.elc}. The backtrace contains much more information if it is
596produced with uncompiled code. To do this, either rename @file{org.elc}
597to something else before starting Emacs, or ask Emacs explicitly to load
598@file{org.el} by using the command line
599@example
600emacs -l /path/to/org.el
601@end example
602@item
603Go to the @code{Options} menu and select @code{Enter Debugger on Error}
604(XEmacs has this option in the @code{Troubleshooting} sub-menu).
605@item
606Do whatever you have to do to hit the error. Don't forget to
607document the steps you take.
608@item
609When you hit the error, a @file{*Backtrace*} buffer will appear on the
610screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and
611attach it to your bug report.
612@end enumerate
613
dbc28aaa
CD
614@node Conventions, , Feedback, Introduction
615@section Typesetting conventions used in this manual
616
a7808fba 617Org uses three types of keywords: TODO keywords, tags, and property
dbc28aaa
CD
618names. In this manual we use the following conventions:
619
620@table @code
621@item TODO
622@itemx WAITING
623TODO keywords are written with all capitals, even if they are
624user-defined.
625@item boss
626@itemx ARCHIVE
627User-defined tags are written in lowercase; built-in tags with special
628meaning are written with all capitals.
629@item Release
630@itemx PRIORITY
631User-defined properties are capitalized; built-in properties with
632special meaning are written with all capitals.
633@end table
634
a7808fba 635@node Document Structure, Tables, Introduction, Top
4009494e
GM
636@chapter Document Structure
637@cindex document structure
638@cindex structure of document
639
a7808fba 640Org is based on outline mode and provides flexible commands to
4009494e
GM
641edit the structure of the document.
642
643@menu
a7808fba
CD
644* Outlines:: Org is based on Outline mode
645* Headlines:: How to typeset Org tree headlines
4009494e
GM
646* Visibility cycling:: Show and hide, much simplified
647* Motion:: Jumping to other headlines
648* Structure editing:: Changing sequence and level of headlines
649* Archiving:: Move done task trees to a different place
650* Sparse trees:: Matches embedded in context
651* Plain lists:: Additional structure within an entry
652* Drawers:: Tucking stuff away
a7808fba 653* Orgstruct mode:: Structure editing outside Org
4009494e
GM
654@end menu
655
a7808fba 656@node Outlines, Headlines, Document Structure, Document Structure
4009494e
GM
657@section Outlines
658@cindex outlines
a7808fba 659@cindex Outline mode
4009494e 660
a7808fba 661Org is implemented on top of Outline mode. Outlines allow a
4009494e
GM
662document to be organized in a hierarchical structure, which (at least
663for me) is the best representation of notes and thoughts. An overview
664of this structure is achieved by folding (hiding) large parts of the
665document to show only the general document structure and the parts
a7808fba 666currently being worked on. Org greatly simplifies the use of
4009494e
GM
667outlines by compressing the entire show/hide functionality into a single
668command @command{org-cycle}, which is bound to the @key{TAB} key.
669
a7808fba 670@node Headlines, Visibility cycling, Outlines, Document Structure
4009494e
GM
671@section Headlines
672@cindex headlines
673@cindex outline tree
674
675Headlines define the structure of an outline tree. The headlines in
a7808fba 676Org start with one or more stars, on the left margin@footnote{See
4009494e
GM
677the variable @code{org-special-ctrl-a/e} to configure special behavior
678of @kbd{C-a} and @kbd{C-e} in headlines.}. For example:
679
680@example
681* Top level headline
682** Second level
683*** 3rd level
684 some text
685*** 3rd level
686 more text
687
688* Another top level headline
689@end example
690
691@noindent Some people find the many stars too noisy and would prefer an
692outline that has whitespace followed by a single star as headline
693starters. @ref{Clean view} describes a setup to realize this.
694
695An empty line after the end of a subtree is considered part of it and
696will be hidden when the subtree is folded. However, if you leave at
697least two empty lines, one empty line will remain visible after folding
698the subtree, in order to structure the collapsed view. See the
699variable @code{org-cycle-separator-lines} to modify this behavior.
700
a7808fba 701@node Visibility cycling, Motion, Headlines, Document Structure
4009494e
GM
702@section Visibility cycling
703@cindex cycling, visibility
704@cindex visibility cycling
705@cindex trees, visibility
706@cindex show hidden text
707@cindex hide text
708
709Outlines make it possible to hide parts of the text in the buffer.
a7808fba 710Org uses just two commands, bound to @key{TAB} and
4009494e
GM
711@kbd{S-@key{TAB}} to change the visibility in the buffer.
712
713@cindex subtree visibility states
714@cindex subtree cycling
715@cindex folded, subtree visibility state
716@cindex children, subtree visibility state
717@cindex subtree, subtree visibility state
718@table @kbd
719@kindex @key{TAB}
720@item @key{TAB}
721@emph{Subtree cycling}: Rotate current subtree among the states
722
723@example
724,-> FOLDED -> CHILDREN -> SUBTREE --.
725'-----------------------------------'
726@end example
727
728The cursor must be on a headline for this to work@footnote{see, however,
729the option @code{org-cycle-emulate-tab}.}. When the cursor is at the
730beginning of the buffer and the first line is not a headline, then
731@key{TAB} actually runs global cycling (see below)@footnote{see the
732option @code{org-cycle-global-at-bob}.}. Also when called with a prefix
733argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
734
735@cindex global visibility states
736@cindex global cycling
737@cindex overview, global visibility state
738@cindex contents, global visibility state
739@cindex show all, global visibility state
740@kindex S-@key{TAB}
741@item S-@key{TAB}
742@itemx C-u @key{TAB}
743@emph{Global cycling}: Rotate the entire buffer among the states
744
745@example
746,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
747'--------------------------------------'
748@end example
749
a7808fba
CD
750When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
751CONTENTS view up to headlines of level N will be shown. Note that inside
752tables, @kbd{S-@key{TAB}} jumps to the previous field.
4009494e
GM
753
754@cindex show all, command
755@kindex C-c C-a
756@item C-c C-a
757Show all.
758@kindex C-c C-r
759@item C-c C-r
a7808fba
CD
760Reveal context around point, showing the current entry, the following heading
761and the hierarchy above. Useful for working near a location that has been
762exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
763(@pxref{Agenda commands}). With a prefix argument show, on each
4009494e
GM
764level, all sibling headings.
765@kindex C-c C-x b
766@item C-c C-x b
767Show the current subtree in an indirect buffer@footnote{The indirect
768buffer
769@ifinfo
770(@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
771@end ifinfo
772@ifnotinfo
773(see the Emacs manual for more information about indirect buffers)
774@end ifnotinfo
775will contain the entire buffer, but will be narrowed to the current
776tree. Editing the indirect buffer will also change the original buffer,
a7808fba
CD
777but without affecting visibility in that buffer.}. With a numeric
778prefix argument N, go up to level N and then take that tree. If N is
779negative then go up that many levels. With a @kbd{C-u} prefix, do not remove
4009494e
GM
780the previously used indirect buffer.
781@end table
782
a7808fba 783When Emacs first visits an Org file, the global state is set to
4009494e
GM
784OVERVIEW, i.e. only the top level headlines are visible. This can be
785configured through the variable @code{org-startup-folded}, or on a
786per-file basis by adding one of the following lines anywhere in the
787buffer:
788
789@example
790#+STARTUP: overview
791#+STARTUP: content
792#+STARTUP: showall
793@end example
794
a7808fba 795@node Motion, Structure editing, Visibility cycling, Document Structure
4009494e
GM
796@section Motion
797@cindex motion, between headlines
798@cindex jumping, to headlines
799@cindex headline navigation
800The following commands jump to other headlines in the buffer.
801
802@table @kbd
803@kindex C-c C-n
804@item C-c C-n
805Next heading.
806@kindex C-c C-p
807@item C-c C-p
808Previous heading.
809@kindex C-c C-f
810@item C-c C-f
811Next heading same level.
812@kindex C-c C-b
813@item C-c C-b
814Previous heading same level.
815@kindex C-c C-u
816@item C-c C-u
817Backward to higher level heading.
818@kindex C-c C-j
819@item C-c C-j
820Jump to a different place without changing the current outline
821visibility. Shows the document structure in a temporary buffer, where
822you can use the following keys to find your destination:
823@example
824@key{TAB} @r{Cycle visibility.}
825@key{down} / @key{up} @r{Next/previous visible headline.}
826n / p @r{Next/previous visible headline.}
827f / b @r{Next/previous headline same level.}
828u @r{One level up.}
8290-9 @r{Digit argument.}
830@key{RET} @r{Select this location.}
831@end example
832@end table
833
a7808fba 834@node Structure editing, Archiving, Motion, Document Structure
4009494e
GM
835@section Structure editing
836@cindex structure editing
837@cindex headline, promotion and demotion
838@cindex promotion, of subtrees
839@cindex demotion, of subtrees
840@cindex subtree, cut and paste
841@cindex pasting, of subtrees
842@cindex cutting, of subtrees
843@cindex copying, of subtrees
844@cindex subtrees, cut and paste
845
846@table @kbd
847@kindex M-@key{RET}
848@item M-@key{RET}
849Insert new heading with same level as current. If the cursor is in a
850plain list item, a new item is created (@pxref{Plain lists}). To force
a7808fba 851creation of a new headline, use a prefix argument, or first press @key{RET}
4009494e
GM
852to get to the beginning of the next line. When this command is used in
853the middle of a line, the line is split and the rest of the line becomes
28a16a1b
CD
854the new headline@footnote{If you do not want the line to be split,
855customize the variable @code{org-M-RET-may-split-line}.}. If the
856command is used at the beginning of a headline, the new headline is
857created before the current line. If at the beginning of any other line,
858the content of that line is made the new heading. If the command is
859used at the end of a folded subtree (i.e. behind the ellipses at the end
860of a headline), then a headline like the current one will be inserted
861after the end of the subtree.
dbc28aaa
CD
862@kindex C-@key{RET}
863@item C-@key{RET}
864Insert a new heading after the current subtree, same level as the
865current headline. This command works from anywhere in the entry.
4009494e
GM
866@kindex M-S-@key{RET}
867@item M-S-@key{RET}
868Insert new TODO entry with same level as current heading.
869@kindex M-@key{left}
870@item M-@key{left}
871Promote current heading by one level.
872@kindex M-@key{right}
873@item M-@key{right}
874Demote current heading by one level.
875@kindex M-S-@key{left}
876@item M-S-@key{left}
877Promote the current subtree by one level.
878@kindex M-S-@key{right}
879@item M-S-@key{right}
880Demote the current subtree by one level.
881@kindex M-S-@key{up}
882@item M-S-@key{up}
883Move subtree up (swap with previous subtree of same
884level).
885@kindex M-S-@key{down}
886@item M-S-@key{down}
887Move subtree down (swap with next subtree of same level).
888@kindex C-c C-x C-w
889@kindex C-c C-x C-k
890@item C-c C-x C-w
891@itemx C-c C-x C-k
892Kill subtree, i.e. remove it from buffer but save in kill ring.
a7808fba 893With a numeric prefix argument N, kill N sequential subtrees.
4009494e
GM
894@kindex C-c C-x M-w
895@item C-c C-x M-w
a7808fba
CD
896Copy subtree to kill ring. With a numeric prefix argument N, copy the N
897sequential subtrees.
4009494e
GM
898@kindex C-c C-x C-y
899@item C-c C-x C-y
900Yank subtree from kill ring. This does modify the level of the subtree to
a7808fba
CD
901make sure the tree fits in nicely at the yank position. The yank level can
902also be specified with a numeric prefix argument, or by yanking after a
4009494e 903headline marker like @samp{****}.
dbc28aaa
CD
904@kindex C-c C-w
905@item C-c C-w
906Refile entry to a different location. @xref{Refiling notes}.
4009494e
GM
907@kindex C-c ^
908@item C-c ^
a7808fba
CD
909Sort same-level entries. When there is an active region, all entries in the
910region will be sorted. Otherwise the children of the current headline are
911sorted. The command prompts for the sorting method, which can be
912alphabetically, numerically, by time (using the first time stamp in each
913entry), by priority, or by TODO keyword (in the sequence the keywords have
914been defined in the setup). Reverse sorting is possible as well. You can
915also supply your own function to extract the sorting key. With a @kbd{C-u}
916prefix, sorting will be case-sensitive. With two @kbd{C-u C-u} prefixes,
917duplicate entries will also be removed.
28a16a1b
CD
918@kindex C-c *
919@item C-c *
920Turn a normal line or plain list item into a headline (so that it
921becomes a subheading at its location). Also turn a headline into a
922normal line by removing the stars. If there is an active region, turn
923all lines in the region into headlines. Or, if the first line is a
924headline, remove the stars from all headlines in the region.
4009494e
GM
925@end table
926
927@cindex region, active
928@cindex active region
a7808fba
CD
929@cindex Transient mark mode
930When there is an active region (Transient mark mode), promotion and
4009494e
GM
931demotion work on all headlines in the region. To select a region of
932headlines, it is best to place both point and mark at the beginning of a
933line, mark at the beginning of the first headline, and point at the line
934just after the last headline to change. Note that when the cursor is
935inside a table (@pxref{Tables}), the Meta-Cursor keys have different
936functionality.
937
a7808fba 938@node Archiving, Sparse trees, Structure editing, Document Structure
4009494e
GM
939@section Archiving
940@cindex archiving
941
942When a project represented by a (sub)tree is finished, you may want
943to move the tree out of the way and to stop it from contributing to the
a7808fba 944agenda. Org mode knows two ways of archiving. You can mark a tree with
4009494e
GM
945the ARCHIVE tag, or you can move an entire (sub)tree to a different
946location.
947
948@menu
949* ARCHIVE tag:: Marking a tree as inactive
950* Moving subtrees:: Moving a tree to an archive file
951@end menu
952
953@node ARCHIVE tag, Moving subtrees, Archiving, Archiving
954@subsection The ARCHIVE tag
955@cindex internal archiving
956
957A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
958its location in the outline tree, but behaves in the following way:
959@itemize @minus
960@item
961It does not open when you attempt to do so with a visibility cycling
962command (@pxref{Visibility cycling}). You can force cycling archived
963subtrees with @kbd{C-@key{TAB}}, or by setting the option
964@code{org-cycle-open-archived-trees}. Also normal outline commands like
965@code{show-all} will open archived subtrees.
966@item
967During sparse tree construction (@pxref{Sparse trees}), matches in
968archived subtrees are not exposed, unless you configure the option
969@code{org-sparse-tree-open-archived-trees}.
970@item
a7808fba 971During agenda view construction (@pxref{Agenda Views}), the content of
4009494e
GM
972archived trees is ignored unless you configure the option
973@code{org-agenda-skip-archived-trees}.
974@item
975Archived trees are not exported (@pxref{Exporting}), only the headline
976is. Configure the details using the variable
977@code{org-export-with-archived-trees}.
978@end itemize
979
980The following commands help managing the ARCHIVE tag:
981
982@table @kbd
a7808fba
CD
983@kindex C-c C-x a
984@item C-c C-x a
4009494e 985Toggle the ARCHIVE tag for the current headline. When the tag is set,
a7808fba 986the headline changes to a shadowed face, and the subtree below it is
4009494e 987hidden.
a7808fba
CD
988@kindex C-u C-c C-x a
989@item C-u C-c C-x a
4009494e
GM
990Check if any direct children of the current headline should be archived.
991To do this, each subtree is checked for open TODO entries. If none are
992found, the command offers to set the ARCHIVE tag for the child. If the
993cursor is @emph{not} on a headline when this command is invoked, the
994level 1 trees will be checked.
995@kindex C-@kbd{TAB}
996@item C-@kbd{TAB}
997Cycle a tree even if it is tagged with ARCHIVE.
998@end table
999
1000@node Moving subtrees, , ARCHIVE tag, Archiving
1001@subsection Moving subtrees
1002@cindex external archiving
1003
a7808fba
CD
1004Once an entire project is finished, you may want to move it to a different
1005location. Org can move it to an @emph{Attic Sibling} in the same tree, to a
1006different tree in the current file, or to a different file, the archive file.
4009494e
GM
1007
1008@table @kbd
a7808fba
CD
1009@kindex C-c C-x A
1010@item C-c C-x A
0a29fbf3 1011Move the current entry to the @emph{Attic Sibling}. This is a sibling of the
a7808fba
CD
1012entry with the heading @samp{Attic} and the tag @samp{ARCHIVE}
1013(@pxref{ARCHIVE tag}). The entry becomes a child of that sibling and in this
1014way retains a lot of its original context, including inherited tags and
1015approximate position in the outline.
4009494e
GM
1016@kindex C-c C-x C-s
1017@item C-c C-x C-s
1018Archive the subtree starting at the cursor position to the location
1019given by @code{org-archive-location}. Context information that could be
a7808fba 1020lost like the file name, the category, inherited tags, and the TODO
4009494e
GM
1021state will be store as properties in the entry.
1022@kindex C-u C-c C-x C-s
1023@item C-u C-c C-x C-s
1024Check if any direct children of the current headline could be moved to
1025the archive. To do this, each subtree is checked for open TODO entries.
1026If none are found, the command offers to move it to the archive
1027location. If the cursor is @emph{not} on a headline when this command
1028is invoked, the level 1 trees will be checked.
1029@end table
1030
1031@cindex archive locations
1032The default archive location is a file in the same directory as the
1033current file, with the name derived by appending @file{_archive} to the
1034current file name. For information and examples on how to change this,
1035see the documentation string of the variable
1036@code{org-archive-location}. There is also an in-buffer option for
dbc28aaa
CD
1037setting this variable, for example@footnote{For backward compatibility,
1038the following also works: If there are several such lines in a file,
1039each specifies the archive location for the text below it. The first
1040such line also applies to any text before its definition. However,
1041using this method is @emph{strongly} deprecated as it is incompatible
1042with the outline structure of the document. The correct method for
1043setting multiple archive locations in a buffer is using a property.}:
4009494e
GM
1044
1045@example
1046#+ARCHIVE: %s_done::
1047@end example
1048
1049@noindent
dbc28aaa
CD
1050If you would like to have a special ARCHIVE location for a single entry
1051or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
a7808fba 1052location as the value (@pxref{Properties and Columns}).
4009494e 1053
28a16a1b
CD
1054When a subtree is moved, it receives a number of special properties that
1055record context information like the file from where the entry came, it's
1056outline path the archiving time etc. Configure the variable
1057@code{org-archive-save-context-info} to adjust the amount of information
1058added.
1059
a7808fba 1060@node Sparse trees, Plain lists, Archiving, Document Structure
4009494e
GM
1061@section Sparse trees
1062@cindex sparse trees
1063@cindex trees, sparse
1064@cindex folding, sparse trees
1065@cindex occur, command
1066
a7808fba 1067An important feature of Org mode is the ability to construct
dbc28aaa
CD
1068@emph{sparse trees} for selected information in an outline tree, so that
1069the entire document is folded as much as possible, but the selected
1070information is made visible along with the headline structure above
1071it@footnote{See also the variables @code{org-show-hierarchy-above},
1072@code{org-show-following-heading}, and @code{org-show-siblings} for
1073detailed control on how much context is shown around each match.}. Just
1074try it out and you will see immediately how it works.
1075
a7808fba 1076Org mode contains several commands creating such trees, all these
dbc28aaa 1077commands can be accessed through a dispatcher:
4009494e
GM
1078
1079@table @kbd
1080@kindex C-c /
1081@item C-c /
dbc28aaa
CD
1082This prompts for an extra key to select a sparse-tree creating command.
1083@kindex C-c / r
1084@item C-c / r
4009494e
GM
1085Occur. Prompts for a regexp and shows a sparse tree with all matches.
1086If the match is in a headline, the headline is made visible. If the
1087match is in the body of an entry, headline and body are made visible.
1088In order to provide minimal context, also the full hierarchy of
1089headlines above the match is shown, as well as the headline following
1090the match. Each match is also highlighted; the highlights disappear
1091when the buffer is changed by an editing command, or by pressing
1092@kbd{C-c C-c}. When called with a @kbd{C-u} prefix argument, previous
1093highlights are kept, so several calls to this command can be stacked.
1094@end table
dbc28aaa 1095
4009494e
GM
1096@noindent
1097For frequently used sparse trees of specific search strings, you can
1098use the variable @code{org-agenda-custom-commands} to define fast
1099keyboard access to specific sparse trees. These commands will then be
1100accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
1101For example:
1102
1103@lisp
1104(setq org-agenda-custom-commands
1105 '(("f" occur-tree "FIXME")))
1106@end lisp
1107
1108@noindent will define the key @kbd{C-c a f} as a shortcut for creating
1109a sparse tree matching the string @samp{FIXME}.
1110
dbc28aaa
CD
1111The other sparse tree commands select headings based on TODO keywords,
1112tags, or properties and will be discussed later in this manual.
4009494e
GM
1113
1114@kindex C-c C-e v
1115@cindex printing sparse trees
1116@cindex visible text, printing
1117To print a sparse tree, you can use the Emacs command
1118@code{ps-print-buffer-with-faces} which does not print invisible parts
1119of the document @footnote{This does not work under XEmacs, because
1120XEmacs uses selective display for outlining, not text properties.}.
1121Or you can use the command @kbd{C-c C-e v} to export only the visible
1122part of the document and print the resulting file.
1123
a7808fba 1124@node Plain lists, Drawers, Sparse trees, Document Structure
4009494e
GM
1125@section Plain lists
1126@cindex plain lists
1127@cindex lists, plain
1128@cindex lists, ordered
1129@cindex ordered lists
1130
1131Within an entry of the outline tree, hand-formatted lists can provide
1132additional structure. They also provide a way to create lists of
a7808fba 1133checkboxes (@pxref{Checkboxes}). Org supports editing such lists,
dbc28aaa 1134and the HTML exporter (@pxref{Exporting}) parses and formats them.
4009494e 1135
a7808fba 1136Org knows ordered and unordered lists. Unordered list items start
4009494e
GM
1137with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
1138bullet, lines must be indented or they will be seen as top-level
1139headlines. Also, when you are hiding leading stars to get a clean
1140outline view, plain list items starting with a star are visually
1141indistinguishable from true headlines. In short: even though @samp{*}
dbc28aaa
CD
1142is supported, it may be better to not use it for plain list items.} as
1143bullets. Ordered list items start with a numeral followed by either a
1144period or a right parenthesis, such as @samp{1.} or @samp{1)}. Items
4009494e
GM
1145belonging to the same list must have the same indentation on the first
1146line. In particular, if an ordered list reaches number @samp{10.}, then
1147the 2--digit numbers must be written left-aligned with the other numbers
1148in the list. Indentation also determines the end of a list item. It
1149ends before the next line that is indented like the bullet/number, or
1150less. Empty lines are part of the previous item, so you can have
1151several paragraphs in one item. If you would like an empty line to
1152terminate all currently open plain lists, configure the variable
1153@code{org-empty-line-terminates-plain-lists}. Here is an example:
1154
1155@example
1156@group
1157** Lord of the Rings
1158 My favorite scenes are (in this order)
1159 1. The attack of the Rohirrim
1160 2. Eowyns fight with the witch king
1161 + this was already my favorite scene in the book
1162 + I really like Miranda Otto.
1163 3. Peter Jackson being shot by Legolas
1164 - on DVD only
1165 He makes a really funny face when it happens.
1166 But in the end, not individual scenes matter but the film as a whole.
1167@end group
1168@end example
1169
a7808fba
CD
1170Org supports these lists by tuning filling and wrapping commands to
1171deal with them correctly@footnote{Org only changes the filling
4009494e
GM
1172settings for Emacs. For XEmacs, you should use Kyle E. Jones'
1173@file{filladapt.el}. To turn this on, put into @file{.emacs}:
28a16a1b 1174@code{(require 'filladapt)}}.
4009494e
GM
1175
1176The following commands act on items when the cursor is in the first line
1177of an item (the line with the bullet or number).
1178
1179@table @kbd
1180@kindex @key{TAB}
1181@item @key{TAB}
1182Items can be folded just like headline levels if you set the variable
1183@code{org-cycle-include-plain-lists}. The level of an item is then
1184given by the indentation of the bullet/number. Items are always
1185subordinate to real headlines, however; the hierarchies remain
1186completely separated.
1187
1188If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
a7808fba 1189fixes the indentation of the current line in a heuristic way.
4009494e
GM
1190@kindex M-@key{RET}
1191@item M-@key{RET}
a7808fba
CD
1192Insert new item at current level. With a prefix argument, force a new
1193heading (@pxref{Structure editing}). If this command is used in the middle
1194of a line, the line is @emph{split} and the rest of the line becomes the new
1195item@footnote{If you do not want the line to be split, customize the variable
1196@code{org-M-RET-may-split-line}.}. If this command is executed in the
1197@emph{whitespace before a bullet or number}, the new item is created
1198@emph{before} the current item. If the command is executed in the white
1199space before the text that is part of an item but does not contain the
1200bullet, a bullet is added to the current line.
4009494e
GM
1201@kindex M-S-@key{RET}
1202@item M-S-@key{RET}
1203Insert a new item with a checkbox (@pxref{Checkboxes}).
1204@kindex S-@key{up}
1205@kindex S-@key{down}
1206@item S-@key{up}
1207@itemx S-@key{down}
1208Jump to the previous/next item in the current list.
1209@kindex M-S-@key{up}
1210@kindex M-S-@key{down}
1211@item M-S-@key{up}
1212@itemx M-S-@key{down}
1213Move the item including subitems up/down (swap with previous/next item
1214of same indentation). If the list is ordered, renumbering is
1215automatic.
1216@kindex M-S-@key{left}
1217@kindex M-S-@key{right}
1218@item M-S-@key{left}
1219@itemx M-S-@key{right}
1220Decrease/increase the indentation of the item, including subitems.
1221Initially, the item tree is selected based on current indentation.
1222When these commands are executed several times in direct succession,
1223the initially selected region is used, even if the new indentation
1224would imply a different hierarchy. To use the new hierarchy, break
1225the command chain with a cursor motion or so.
1226@kindex C-c C-c
1227@item C-c C-c
1228If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
dbc28aaa
CD
1229state of the checkbox. If not, this command makes sure that all the
1230items on this list level use the same bullet. Furthermore, if this is
a7808fba 1231an ordered list, make sure the numbering is OK.
4009494e
GM
1232@kindex C-c -
1233@item C-c -
a7808fba
CD
1234Cycle the entire list level through the different itemize/enumerate bullets
1235(@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}). With a numeric prefix
1236argument N, select the Nth bullet from this list. If there is an active
1237region when calling this, all lines will be converted to list items. If the
1238first line already was a list item, any item markers will be removed from the
1239list. Finally, even without an active region, a normal line will be
1240converted into a list item.
4009494e
GM
1241@end table
1242
a7808fba 1243@node Drawers, Orgstruct mode, Plain lists, Document Structure
4009494e
GM
1244@section Drawers
1245@cindex drawers
1246@cindex visibility cycling, drawers
1247
1248Sometimes you want to keep information associated with an entry, but you
a7808fba 1249normally don't want to see it. For this, Org mode has @emph{drawers}.
dbc28aaa
CD
1250Drawers need to be configured with the variable
1251@code{org-drawers}@footnote{You can define drawers on a per-file basis
1252with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}. Drawers
4009494e
GM
1253look like this:
1254
1255@example
1256** This is a headline
1257 Still outside the drawer
1258 :DRAWERNAME:
1259 This is inside the drawer.
1260 :END:
1261 After the drawer.
1262@end example
1263
1264Visibility cycling (@pxref{Visibility cycling}) on the headline will
1265hide and show the entry, but keep the drawer collapsed to a single line.
1266In order to look inside the drawer, you need to move the cursor to the
a7808fba
CD
1267drawer line and press @key{TAB} there. Org mode uses a drawer for
1268storing properties (@pxref{Properties and Columns}).
4009494e 1269
a7808fba 1270@node Orgstruct mode, , Drawers, Document Structure
4009494e 1271@section The Orgstruct minor mode
a7808fba 1272@cindex Orgstruct mode
4009494e
GM
1273@cindex minor mode for structure editing
1274
a7808fba 1275If you like the intuitive way the Org mode structure editing and list
4009494e 1276formatting works, you might want to use these commands in other modes
a7808fba 1277like Text mode or Mail mode as well. The minor mode Orgstruct mode
4009494e 1278makes this possible. You can always toggle the mode with @kbd{M-x
a7808fba 1279orgstruct-mode}. To turn it on by default, for example in Mail mode,
4009494e
GM
1280use
1281
1282@lisp
1283(add-hook 'mail-mode-hook 'turn-on-orgstruct)
1284@end lisp
1285
1286When this mode is active and the cursor is on a line that looks to
a7808fba 1287Org like a headline of the first line of a list item, most
4009494e
GM
1288structure editing commands will work, even if the same keys normally
1289have different functionality in the major mode you are using. If the
a7808fba 1290cursor is not in one of those special lines, Orgstruct mode lurks
4009494e
GM
1291silently in the shadow.
1292
a7808fba 1293@node Tables, Hyperlinks, Document Structure, Top
4009494e
GM
1294@chapter Tables
1295@cindex tables
1296@cindex editing tables
1297
a7808fba 1298Org comes with a fast and intuitive table editor. Spreadsheet-like
dbc28aaa 1299calculations are supported in connection with the Emacs @file{calc}
28a16a1b 1300package
dbc28aaa 1301@ifinfo
a7808fba 1302(@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
dbc28aaa
CD
1303@end ifinfo
1304@ifnotinfo
1305(see the Emacs Calculator manual for more information about the Emacs
1306calculator).
1307@end ifnotinfo
4009494e
GM
1308
1309@menu
1310* Built-in table editor:: Simple tables
28a16a1b 1311* Narrow columns:: Stop wasting space in tables
4009494e 1312* Column groups:: Grouping to trigger vertical lines
a7808fba
CD
1313* Orgtbl mode:: The table editor as minor mode
1314* The spreadsheet:: The table editor has spreadsheet capabilities
4009494e
GM
1315@end menu
1316
1317@node Built-in table editor, Narrow columns, Tables, Tables
1318@section The built-in table editor
1319@cindex table editor, built-in
1320
a7808fba 1321Org makes it easy to format tables in plain ASCII. Any line with
4009494e
GM
1322@samp{|} as the first non-whitespace character is considered part of a
1323table. @samp{|} is also the column separator. A table might look like
1324this:
1325
1326@example
1327| Name | Phone | Age |
1328|-------+-------+-----|
1329| Peter | 1234 | 17 |
1330| Anna | 4321 | 25 |
1331@end example
1332
1333A table is re-aligned automatically each time you press @key{TAB} or
1334@key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
1335the next field (@key{RET} to the next row) and creates new table rows
1336at the end of the table or before horizontal lines. The indentation
1337of the table is set by the first line. Any line starting with
1338@samp{|-} is considered as a horizontal separator line and will be
1339expanded on the next re-align to span the whole table width. So, to
1340create the above table, you would only type
1341
1342@example
1343|Name|Phone|Age|
1344|-
1345@end example
1346
1347@noindent and then press @key{TAB} to align the table and start filling in
1348fields.
1349
a7808fba 1350When typing text into a field, Org treats @key{DEL},
4009494e
GM
1351@key{Backspace}, and all character keys in a special way, so that
1352inserting and deleting avoids shifting other fields. Also, when
1353typing @emph{immediately after the cursor was moved into a new field
1354with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
1355field is automatically made blank. If this behavior is too
1356unpredictable for you, configure the variables
1357@code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
1358
1359@table @kbd
1360@tsubheading{Creation and conversion}
1361@kindex C-c |
1362@item C-c |
1363Convert the active region to table. If every line contains at least one
1364TAB character, the function assumes that the material is tab separated.
dbc28aaa 1365If every line contains a comma, comma-separated values (CSV) are assumed.
4009494e 1366If not, lines are split at whitespace into fields. You can use a prefix
dbc28aaa
CD
1367argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
1368C-u} forces TAB, and a numeric argument N indicates that at least N
a7808fba 1369consecutive spaces, or alternatively a TAB will be the separator.
28a16a1b 1370@*
a7808fba 1371If there is no active region, this command creates an empty Org
4009494e
GM
1372table. But it's easier just to start typing, like
1373@kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
1374
1375@tsubheading{Re-aligning and field motion}
1376@kindex C-c C-c
1377@item C-c C-c
1378Re-align the table without moving the cursor.
1379@c
1380@kindex @key{TAB}
1381@item @key{TAB}
1382Re-align the table, move to the next field. Creates a new row if
1383necessary.
1384@c
1385@kindex S-@key{TAB}
1386@item S-@key{TAB}
1387Re-align, move to previous field.
1388@c
1389@kindex @key{RET}
1390@item @key{RET}
1391Re-align the table and move down to next row. Creates a new row if
1392necessary. At the beginning or end of a line, @key{RET} still does
1393NEWLINE, so it can be used to split a table.
1394
1395@tsubheading{Column and row editing}
1396@kindex M-@key{left}
1397@kindex M-@key{right}
1398@item M-@key{left}
1399@itemx M-@key{right}
1400Move the current column left/right.
1401@c
1402@kindex M-S-@key{left}
1403@item M-S-@key{left}
1404Kill the current column.
1405@c
1406@kindex M-S-@key{right}
1407@item M-S-@key{right}
1408Insert a new column to the left of the cursor position.
1409@c
1410@kindex M-@key{up}
1411@kindex M-@key{down}
1412@item M-@key{up}
1413@itemx M-@key{down}
1414Move the current row up/down.
1415@c
1416@kindex M-S-@key{up}
1417@item M-S-@key{up}
1418Kill the current row or horizontal line.
1419@c
1420@kindex M-S-@key{down}
1421@item M-S-@key{down}
a7808fba
CD
1422Insert a new row above the current row. With a prefix argument, the line is
1423created below the current one.
4009494e
GM
1424@c
1425@kindex C-c -
1426@item C-c -
a7808fba 1427Insert a horizontal line below current row. With a prefix argument, the line
4009494e
GM
1428is created above the current line.
1429@c
1430@kindex C-c ^
1431@item C-c ^
1432Sort the table lines in the region. The position of point indicates the
1433column to be used for sorting, and the range of lines is the range
1434between the nearest horizontal separator lines, or the entire table. If
1435point is before the first column, you will be prompted for the sorting
1436column. If there is an active region, the mark specifies the first line
1437and the sorting column, while point should be in the last line to be
1438included into the sorting. The command prompts for the sorting type
1439(alphabetically, numerically, or by time). When called with a prefix
1440argument, alphabetic sorting will be case-sensitive.
1441
1442@tsubheading{Regions}
1443@kindex C-c C-x M-w
1444@item C-c C-x M-w
1445Copy a rectangular region from a table to a special clipboard. Point
1446and mark determine edge fields of the rectangle. The process ignores
1447horizontal separator lines.
1448@c
1449@kindex C-c C-x C-w
1450@item C-c C-x C-w
1451Copy a rectangular region from a table to a special clipboard, and
1452blank all fields in the rectangle. So this is the ``cut'' operation.
1453@c
1454@kindex C-c C-x C-y
1455@item C-c C-x C-y
1456Paste a rectangular region into a table.
1457The upper right corner ends up in the current field. All involved fields
1458will be overwritten. If the rectangle does not fit into the present table,
1459the table is enlarged as needed. The process ignores horizontal separator
1460lines.
1461@c
1462@kindex C-c C-q
28a16a1b 1463@kindex M-@key{RET}
4009494e 1464@item C-c C-q
28a16a1b 1465@itemx M-@kbd{RET}
4009494e
GM
1466Wrap several fields in a column like a paragraph. If there is an active
1467region, and both point and mark are in the same column, the text in the
a7808fba
CD
1468column is wrapped to minimum width for the given number of lines. A numeric
1469prefix argument may be used to change the number of desired lines. If there
1470is no region, the current field is split at the cursor position and the text
1471fragment to the right of the cursor is prepended to the field one line
1472down. If there is no region, but you specify a prefix argument, the current
1473field is made blank, and the content is appended to the field above.
4009494e
GM
1474
1475@tsubheading{Calculations}
1476@cindex formula, in tables
1477@cindex calculations, in tables
1478@cindex region, active
1479@cindex active region
a7808fba 1480@cindex Transient mark mode
4009494e
GM
1481@kindex C-c +
1482@item C-c +
1483Sum the numbers in the current column, or in the rectangle defined by
1484the active region. The result is shown in the echo area and can
1485be inserted with @kbd{C-y}.
1486@c
1487@kindex S-@key{RET}
1488@item S-@key{RET}
1489When current field is empty, copy from first non-empty field above.
1490When not empty, copy current field down to next row and move cursor
1491along with it. Depending on the variable
1492@code{org-table-copy-increment}, integer field values will be
a7808fba 1493incremented during copy. This key is also used by CUA mode
4009494e
GM
1494(@pxref{Cooperation}).
1495
1496@tsubheading{Miscellaneous}
1497@kindex C-c `
1498@item C-c `
1499Edit the current field in a separate window. This is useful for fields
1500that are not fully visible (@pxref{Narrow columns}). When called with a
1501@kbd{C-u} prefix, just make the full field visible, so that it can be
1502edited in place.
1503@c
4009494e
GM
1504@item M-x org-table-import
1505Import a file as a table. The table should be TAB- or whitespace
dbc28aaa
CD
1506separated. Useful, for example, to import a spreadsheet table or data
1507from a database, because these programs generally can write
1508TAB-separated text files. This command works by inserting the file into
1509the buffer and then converting the region to a table. Any prefix
1510argument is passed on to the converter, which uses it to determine the
1511separator.
4009494e 1512@item C-c |
a7808fba 1513Tables can also be imported by pasting tabular text into the Org
4009494e
GM
1514buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
1515@kbd{C-c |} command (see above under @i{Creation and conversion}.
1516@c
1517@item M-x org-table-export
a7808fba
CD
1518Export the table, by default as a TAB-separated file. Useful for data
1519exchange with, for example, spreadsheet or database programs. The format
1520used to export the file can be configured in the variable
1521@code{org-table-export-default-format}. You may also use properties
1522@code{TABLE_EXPORT_FILE} and @code{TABLE_EXPORT_FORMAT} to specify the file
1523name and the format for table export in a subtree.
4009494e
GM
1524@end table
1525
1526If you don't like the automatic table editor because it gets in your
1527way on lines which you would like to start with @samp{|}, you can turn
1528it off with
1529
1530@lisp
1531(setq org-enable-table-editor nil)
1532@end lisp
1533
1534@noindent Then the only table command that still works is
1535@kbd{C-c C-c} to do a manual re-align.
1536
1537@node Narrow columns, Column groups, Built-in table editor, Tables
1538@section Narrow columns
1539@cindex narrow columns in tables
1540
1541The width of columns is automatically determined by the table editor.
1542Sometimes a single field or a few fields need to carry more text,
1543leading to inconveniently wide columns. To limit@footnote{This feature
1544does not work on XEmacs.} the width of a column, one field anywhere in
1545the column may contain just the string @samp{<N>} where @samp{N} is an
1546integer specifying the width of the column in characters. The next
1547re-align will then set the width of this column to no more than this
1548value.
1549
1550@example
1551@group
1552|---+------------------------------| |---+--------|
1553| | | | | <6> |
1554| 1 | one | | 1 | one |
1555| 2 | two | ----\ | 2 | two |
1556| 3 | This is a long chunk of text | ----/ | 3 | This=> |
1557| 4 | four | | 4 | four |
1558|---+------------------------------| |---+--------|
1559@end group
1560@end example
1561
1562@noindent
1563Fields that are wider become clipped and end in the string @samp{=>}.
1564Note that the full text is still in the buffer, it is only invisible.
1565To see the full text, hold the mouse over the field - a tool-tip window
1566will show the full content. To edit such a field, use the command
1567@kbd{C-c `} (that is @kbd{C-c} followed by the backquote). This will
1568open a new window with the full field. Edit it and finish with @kbd{C-c
1569C-c}.
1570
1571When visiting a file containing a table with narrowed columns, the
1572necessary character hiding has not yet happened, and the table needs to
1573be aligned before it looks nice. Setting the option
1574@code{org-startup-align-all-tables} will realign all tables in a file
1575upon visiting, but also slow down startup. You can also set this option
1576on a per-file basis with:
1577
1578@example
1579#+STARTUP: align
1580#+STARTUP: noalign
1581@end example
1582
a7808fba 1583@node Column groups, Orgtbl mode, Narrow columns, Tables
4009494e
GM
1584@section Column groups
1585@cindex grouping columns in tables
1586
a7808fba 1587When Org exports tables, it does so by default without vertical
4009494e
GM
1588lines because that is visually more satisfying in general. Occasionally
1589however, vertical lines can be useful to structure a table into groups
1590of columns, much like horizontal lines can do for groups of rows. In
1591order to specify column groups, you can use a special row where the
1592first field contains only @samp{/}. The further fields can either
1593contain @samp{<} to indicate that this column should start a group,
1594@samp{>} to indicate the end of a column, or @samp{<>} to make a column
a7808fba 1595a group of its own. Boundaries between column groups will upon export be
4009494e
GM
1596marked with vertical lines. Here is an example:
1597
1598@example
1599| | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1600|---+----+-----+-----+-----+---------+------------|
1601| / | <> | < | | > | < | > |
1602| # | 1 | 1 | 1 | 1 | 1 | 1 |
1603| # | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
1604| # | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
1605|---+----+-----+-----+-----+---------+------------|
1606#+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
1607@end example
1608
a7808fba 1609It is also sufficient to just insert the column group starters after
4009494e
GM
1610every vertical line you'd like to have:
1611
1612@example
1613| N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
1614|----+-----+-----+-----+---------+------------|
1615| / | < | | | < | |
1616@end example
1617
a7808fba 1618@node Orgtbl mode, The spreadsheet, Column groups, Tables
4009494e 1619@section The Orgtbl minor mode
a7808fba 1620@cindex Orgtbl mode
4009494e
GM
1621@cindex minor mode for tables
1622
a7808fba
CD
1623If you like the intuitive way the Org table editor works, you
1624might also want to use it in other modes like Text mode or Mail mode.
1625The minor mode Orgtbl mode makes this possible. You can always toggle
4009494e
GM
1626the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
1627example in mail mode, use
1628
1629@lisp
1630(add-hook 'mail-mode-hook 'turn-on-orgtbl)
1631@end lisp
1632
1633Furthermore, with some special setup, it is possible to maintain tables
a7808fba 1634in arbitrary syntax with Orgtbl mode. For example, it is possible to
4009494e 1635construct La@TeX{} tables with the underlying ease and power of
a7808fba 1636Orgtbl mode, including spreadsheet capabilities. For details, see
4009494e
GM
1637@ref{Tables in arbitrary syntax}.
1638
a7808fba 1639@node The spreadsheet, , Orgtbl mode, Tables
4009494e
GM
1640@section The spreadsheet
1641@cindex calculations, in tables
1642@cindex spreadsheet capabilities
1643@cindex @file{calc} package
1644
1645The table editor makes use of the Emacs @file{calc} package to implement
1646spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to
a7808fba 1647derive fields from other fields. While fully featured, Org's
4009494e 1648implementation is not identical to other spreadsheets. For example,
a7808fba 1649Org knows the concept of a @emph{column formula} that will be
4009494e
GM
1650applied to all non-header fields in a column without having to copy the
1651formula to each relevant field.
1652
1653@menu
1654* References:: How to refer to another field or range
1655* Formula syntax for Calc:: Using Calc to compute stuff
1656* Formula syntax for Lisp:: Writing formulas in Emacs Lisp
1657* Field formulas:: Formulas valid for a single field
1658* Column formulas:: Formulas valid for an entire column
1659* Editing and debugging formulas:: Fixing formulas
1660* Updating the table:: Recomputing all dependent fields
1661* Advanced features:: Field names, parameters and automatic recalc
1662@end menu
1663
1664@node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
1665@subsection References
1666@cindex references
1667
1668To compute fields in the table from other fields, formulas must
a7808fba 1669reference other fields or ranges. In Org, fields can be referenced
4009494e
GM
1670by name, by absolute coordinates, and by relative coordinates. To find
1671out what the coordinates of a field are, press @kbd{C-c ?} in that
1672field, or press @kbd{C-c @}} to toggle the display of a grid.
1673
1674@subsubheading Field references
1675@cindex field references
1676@cindex references, to fields
1677
1678Formulas can reference the value of another field in two ways. Like in
1679any other spreadsheet, you may reference fields with a letter/number
1680combination like @code{B3}, meaning the 2nd field in the 3rd row.
1681@c Such references are always fixed to that field, they don't change
1682@c when you copy and paste a formula to a different field. So
a7808fba 1683@c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
4009494e
GM
1684
1685@noindent
a7808fba 1686Org also uses another, more general operator that looks like this:
4009494e
GM
1687@example
1688@@row$column
1689@end example
1690
1691@noindent
1692Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
1693or relative to the current column like @samp{+1} or @samp{-2}.
1694
1695The row specification only counts data lines and ignores horizontal
1696separator lines (hlines). You can use absolute row numbers
1697@samp{1}...@samp{N}, and row numbers relative to the current row like
1698@samp{+3} or @samp{-1}. Or specify the row relative to one of the
dbc28aaa
CD
1699hlines: @samp{I} refers to the first hline@footnote{Note that only
1700hlines are counted that @emph{separate} table lines. If the table
1701starts with a hline above the header, it does not count.}, @samp{II} to
1702the second etc. @samp{-I} refers to the first such line above the
1703current line, @samp{+I} to the first such line below the current line.
1704You can also write @samp{III+2} which is the second data line after the
1705third hline in the table. Relative row numbers like @samp{-3} will not
1706cross hlines if the current line is too close to the hline. Instead,
1707the value directly at the hline is used.
4009494e
GM
1708
1709@samp{0} refers to the current row and column. Also, if you omit
1710either the column or the row part of the reference, the current
28a16a1b 1711row/column is implied.
4009494e 1712
a7808fba 1713Org's references with @emph{unsigned} numbers are fixed references
4009494e
GM
1714in the sense that if you use the same reference in the formula for two
1715different fields, the same field will be referenced each time.
a7808fba 1716Org's references with @emph{signed} numbers are floating
4009494e
GM
1717references because the same reference operator can reference different
1718fields depending on the field being calculated by the formula.
1719
1720Here are a few examples:
1721
1722@example
1723@@2$3 @r{2nd row, 3rd column}
1724C2 @r{same as previous}
1725$5 @r{column 5 in the current row}
1726E& @r{same as previous}
1727@@2 @r{current column, row 2}
1728@@-1$-3 @r{the field one row up, three columns to the left}
1729@@-I$2 @r{field just under hline above current row, column 2}
1730@end example
1731
1732@subsubheading Range references
1733@cindex range references
1734@cindex references, to ranges
1735
1736You may reference a rectangular range of fields by specifying two field
1737references connected by two dots @samp{..}. If both fields are in the
1738current row, you may simply use @samp{$2..$7}, but if at least one field
1739is in a different row, you need to use the general @code{@@row$column}
1740format at least for the first field (i.e the reference must start with
1741@samp{@@} in order to be interpreted correctly). Examples:
1742
1743@example
1744$1..$3 @r{First three fields in the current row.}
1745$P..$Q @r{Range, using column names (see under Advanced)}
1746@@2$1..@@4$3 @r{6 fields between these two fields.}
1747A2..C4 @r{Same as above.}
1748@@-1$-2..@@-1 @r{3 numbers from the column to the left, 2 up to current row}
1749@end example
1750
1751@noindent Range references return a vector of values that can be fed
1752into Calc vector functions. Empty fields in ranges are normally
1753suppressed, so that the vector contains only the non-empty fields (but
1754see the @samp{E} mode switch below). If there are no non-empty fields,
1755@samp{[0]} is returned to avoid syntax errors in formulas.
1756
1757@subsubheading Named references
1758@cindex named references
1759@cindex references, named
1760@cindex name, of column or field
1761@cindex constants, in calculations
1762
1763@samp{$name} is interpreted as the name of a column, parameter or
1764constant. Constants are defined globally through the variable
1765@code{org-table-formula-constants}, and locally (for the file) through a
1766line like
1767
1768@example
1769#+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
1770@end example
1771
1772@noindent
a7808fba 1773Also properties (@pxref{Properties and Columns}) can be used as
dbc28aaa
CD
1774constants in table formulas: For a property @samp{:Xyz:} use the name
1775@samp{$PROP_Xyz}, and the property will be searched in the current
4009494e
GM
1776outline entry and in the hierarchy above it. If you have the
1777@file{constants.el} package, it will also be used to resolve constants,
1778including natural constants like @samp{$h} for Planck's constant, and
1779units like @samp{$km} for kilometers@footnote{@file{Constant.el} can
1780supply the values of constants in two different unit systems, @code{SI}
1781and @code{cgs}. Which one is used depends on the value of the variable
1782@code{constants-unit-system}. You can use the @code{#+STARTUP} options
1783@code{constSI} and @code{constcgs} to set this value for the current
1784buffer.}. Column names and parameters can be specified in special table
1785lines. These are described below, see @ref{Advanced features}. All
1786names must start with a letter, and further consist of letters and
1787numbers.
1788
1789@node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
1790@subsection Formula syntax for Calc
1791@cindex formula syntax, Calc
1792@cindex syntax, of formulas
1793
1794A formula can be any algebraic expression understood by the Emacs
1795@file{Calc} package. @b{Note that @file{calc} has the
1796non-standard convention that @samp{/} has lower precedence than
1797@samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before
1798evaluation by @code{calc-eval} (@pxref{Calling Calc from
a7808fba 1799Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
4009494e 1800Emacs Calc Manual}),
a7808fba 1801@c FIXME: The link to the Calc manual in HTML does not work.
4009494e
GM
1802variable substitution takes place according to the rules described above.
1803@cindex vectors, in table calculations
a7808fba 1804The range vectors can be directly fed into the Calc vector functions
4009494e
GM
1805like @samp{vmean} and @samp{vsum}.
1806
1807@cindex format specifier
1808@cindex mode, for @file{calc}
1809A formula can contain an optional mode string after a semicolon. This
1810string consists of flags to influence Calc and other modes during
a7808fba 1811execution. By default, Org uses the standard Calc modes (precision
4009494e
GM
181212, angular units degrees, fraction and symbolic modes off. The display
1813format, however, has been changed to @code{(float 5)} to keep tables
1814compact. The default settings can be configured using the variable
1815@code{org-calc-default-modes}.
1816
1817@example
1818p20 @r{switch the internal precision to 20 digits}
1819n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format}
1820D R @r{angle modes: degrees, radians}
1821F S @r{fraction and symbolic modes}
1822N @r{interpret all fields as numbers, use 0 for non-numbers}
1823T @r{force text interpretation}
1824E @r{keep empty fields in ranges}
1825@end example
1826
1827@noindent
1828In addition, you may provide a @code{printf} format specifier to
1829reformat the final result. A few examples:
1830
1831@example
1832$1+$2 @r{Sum of first and second field}
1833$1+$2;%.2f @r{Same, format result to two decimals}
1834exp($2)+exp($1) @r{Math functions can be used}
1835$0;%.1f @r{Reformat current cell to 1 decimal}
1836($3-32)*5/9 @r{Degrees F -> C conversion}
1837$c/$1/$cm @r{Hz -> cm conversion, using @file{constants.el}}
1838tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
1839sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
1840vmean($2..$7) @r{Compute column range mean, using vector function}
1841vmean($2..$7);EN @r{Same, but treat empty fields as 0}
1842taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
1843@end example
1844
1845Calc also contains a complete set of logical operations. For example
1846
1847@example
1848if($1<20,teen,string("")) @r{``teen'' if age $1 less than 20, else empty}
1849@end example
1850
1851@node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
1852@subsection Emacs Lisp forms as formulas
1853@cindex Lisp forms, as table formulas
1854
1855It is also possible to write a formula in Emacs Lisp; this can be useful
1856for string manipulation and control structures, if the Calc's
1857functionality is not enough. If a formula starts with a single quote
1858followed by an opening parenthesis, then it is evaluated as a lisp form.
1859The evaluation should return either a string or a number. Just as with
1860@file{calc} formulas, you can specify modes and a printf format after a
a7808fba 1861semicolon. With Emacs Lisp forms, you need to be conscious about the way
4009494e
GM
1862field references are interpolated into the form. By default, a
1863reference will be interpolated as a Lisp string (in double quotes)
1864containing the field. If you provide the @samp{N} mode switch, all
1865referenced elements will be numbers (non-number fields will be zero) and
1866interpolated as Lisp numbers, without quotes. If you provide the
1867@samp{L} flag, all fields will be interpolated literally, without quotes.
1868I.e., if you want a reference to be interpreted as a string by the Lisp
a7808fba 1869form, enclose the reference operator itself in double quotes, like
4009494e
GM
1870@code{"$3"}. Ranges are inserted as space-separated fields, so you can
1871embed them in list or vector syntax. A few examples, note how the
1872@samp{N} mode is used when we do computations in lisp.
1873
1874@example
1875@r{Swap the first two characters of the content of column 1}
1876 '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
1877@r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
1878 '(+ $1 $2);N
1879@r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
1880 '(apply '+ '($1..$4));N
1881@end example
1882
1883@node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
1884@subsection Field formulas
1885@cindex field formula
1886@cindex formula, for individual table field
1887
1888To assign a formula to a particular field, type it directly into the
1889field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you
1890press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
1891the field, the formula will be stored as the formula for this field,
1892evaluated, and the current field replaced with the result.
1893
1894Formulas are stored in a special line starting with @samp{#+TBLFM:}
1895directly below the table. If you typed the equation in the 4th field of
1896the 3rd data line in the table, the formula will look like
1897@samp{@@3$4=$1+$2}. When inserting/deleting/swapping column and rows
1898with the appropriate commands, @i{absolute references} (but not relative
1899ones) in stored formulas are modified in order to still reference the
1900same field. Of cause this is not true if you edit the table structure
1901with normal editing commands - then you must fix the equations yourself.
1902
1903Instead of typing an equation into the field, you may also use the
1904following command
1905
1906@table @kbd
1907@kindex C-u C-c =
1908@item C-u C-c =
1909Install a new formula for the current field. The command prompts for a
1910formula, with default taken from the @samp{#+TBLFM:} line, applies
1911it to the current field and stores it.
1912@end table
1913
1914@node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
1915@subsection Column formulas
1916@cindex column formula
1917@cindex formula, for table column
1918
1919Often in a table, the same formula should be used for all fields in a
1920particular column. Instead of having to copy the formula to all fields
a7808fba 1921in that column, Org allows to assign a single formula to an entire
4009494e
GM
1922column. If the table contains horizontal separator hlines, everything
1923before the first such line is considered part of the table @emph{header}
1924and will not be modified by column formulas.
1925
1926To assign a formula to a column, type it directly into any field in the
1927column, preceded by an equal sign, like @samp{=$1+$2}. When you press
1928@key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
1929field, the formula will be stored as the formula for the current column,
1930evaluated and the current field replaced with the result. If the field
1931contains only @samp{=}, the previously stored formula for this column is
a7808fba 1932used. For each column, Org will only remember the most recently
4009494e
GM
1933used formula. In the @samp{TBLFM:} line, column formulas will look like
1934@samp{$4=$1+$2}.
1935
1936Instead of typing an equation into the field, you may also use the
1937following command:
1938
1939@table @kbd
1940@kindex C-c =
1941@item C-c =
a7808fba
CD
1942Install a new formula for the current column and replace current field with
1943the result of the formula. The command prompts for a formula, with default
1944taken from the @samp{#+TBLFM} line, applies it to the current field and
1945stores it. With a numeric prefix argument(e.g. @kbd{C-5 C-c =}) the command
4009494e
GM
1946will apply it to that many consecutive fields in the current column.
1947@end table
1948
4009494e 1949@node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
a7808fba 1950@subsection Editing and debugging formulas
4009494e
GM
1951@cindex formula editing
1952@cindex editing, of table formulas
1953
1954You can edit individual formulas in the minibuffer or directly in the
a7808fba
CD
1955field. Org can also prepare a special buffer with all active
1956formulas of a table. When offering a formula for editing, Org
4009494e
GM
1957converts references to the standard format (like @code{B3} or @code{D&})
1958if possible. If you prefer to only work with the internal format (like
1959@code{@@3$2} or @code{$4}), configure the variable
1960@code{org-table-use-standard-references}.
1961
1962@table @kbd
1963@kindex C-c =
1964@kindex C-u C-c =
1965@item C-c =
1966@itemx C-u C-c =
1967Edit the formula associated with the current column/field in the
1968minibuffer. See @ref{Column formulas} and @ref{Field formulas}.
1969@kindex C-u C-u C-c =
1970@item C-u C-u C-c =
1971Re-insert the active formula (either a
1972field formula, or a column formula) into the current field, so that you
1973can edit it directly in the field. The advantage over editing in the
1974minibuffer is that you can use the command @kbd{C-c ?}.
1975@kindex C-c ?
1976@item C-c ?
1977While editing a formula in a table field, highlight the field(s)
1978referenced by the reference at the cursor position in the formula.
1979@kindex C-c @}
1980@item C-c @}
1981Toggle the display of row and column numbers for a table, using
1982overlays. These are updated each time the table is aligned, you can
1983force it with @kbd{C-c C-c}.
1984@kindex C-c @{
1985@item C-c @{
1986Toggle the formula debugger on and off. See below.
1987@kindex C-c '
1988@item C-c '
1989Edit all formulas for the current table in a special buffer, where the
1990formulas will be displayed one per line. If the current field has an
1991active formula, the cursor in the formula editor will mark it.
a7808fba 1992While inside the special buffer, Org will automatically highlight
4009494e
GM
1993any field or range reference at the cursor position. You may edit,
1994remove and add formulas, and use the following commands:
1995@table @kbd
1996@kindex C-c C-c
1997@kindex C-x C-s
1998@item C-c C-c
1999@itemx C-x C-s
2000Exit the formula editor and store the modified formulas. With @kbd{C-u}
2001prefix, also apply the new formulas to the entire table.
2002@kindex C-c C-q
2003@item C-c C-q
2004Exit the formula editor without installing changes.
2005@kindex C-c C-r
2006@item C-c C-r
2007Toggle all references in the formula editor between standard (like
2008@code{B3}) and internal (like @code{@@3$2}).
2009@kindex @key{TAB}
2010@item @key{TAB}
2011Pretty-print or indent lisp formula at point. When in a line containing
2012a lisp formula, format the formula according to Emacs Lisp rules.
2013Another @key{TAB} collapses the formula back again. In the open
a7808fba 2014formula, @key{TAB} re-indents just like in Emacs lisp mode.
4009494e
GM
2015@kindex M-@key{TAB}
2016@item M-@key{TAB}
a7808fba 2017Complete Lisp symbols, just like in Emacs lisp mode.
4009494e
GM
2018@kindex S-@key{up}
2019@kindex S-@key{down}
2020@kindex S-@key{left}
2021@kindex S-@key{right}
2022@item S-@key{up}/@key{down}/@key{left}/@key{right}
2023Shift the reference at point. For example, if the reference is
2024@code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
2025This also works for relative references, and for hline references.
2026@kindex M-S-@key{up}
2027@kindex M-S-@key{down}
2028@item M-S-@key{up}/@key{down}
a7808fba 2029Move the test line for column formulas in the Org buffer up and
4009494e
GM
2030down.
2031@kindex M-@key{up}
2032@kindex M-@key{down}
2033@item M-@key{up}/@key{down}
2034Scroll the window displaying the table.
2035@kindex C-c @}
2036@item C-c @}
2037Turn the coordinate grid in the table on and off.
2038@end table
2039@end table
2040
2041Making a table field blank does not remove the formula associated with
2042the field, because that is stored in a different line (the @samp{TBLFM}
2043line) - during the next recalculation the field will be filled again.
2044To remove a formula from a field, you have to give an empty reply when
2045prompted for the formula, or to edit the @samp{#+TBLFM} line.
2046
2047@kindex C-c C-c
2048You may edit the @samp{#+TBLFM} directly and re-apply the changed
2049equations with @kbd{C-c C-c} in that line, or with the normal
2050recalculation commands in the table.
2051
2052@subsubheading Debugging formulas
2053@cindex formula debugging
2054@cindex debugging, of table formulas
2055When the evaluation of a formula leads to an error, the field content
2056becomes the string @samp{#ERROR}. If you would like see what is going
2057on during variable substitution and calculation in order to find a bug,
2058turn on formula debugging in the @code{Tbl} menu and repeat the
2059calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
2060field. Detailed information will be displayed.
2061
2062@node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
a7808fba 2063@subsection Updating the table
4009494e
GM
2064@cindex recomputing table fields
2065@cindex updating, table
2066
2067Recalculation of a table is normally not automatic, but needs to be
2068triggered by a command. See @ref{Advanced features} for a way to make
2069recalculation at least semi-automatically.
2070
2071In order to recalculate a line of a table or the entire table, use the
2072following commands:
2073
2074@table @kbd
2075@kindex C-c *
2076@item C-c *
2077Recalculate the current row by first applying the stored column formulas
2078from left to right, and all field formulas in the current row.
2079@c
2080@kindex C-u C-c *
2081@item C-u C-c *
2082@kindex C-u C-c C-c
2083@itemx C-u C-c C-c
2084Recompute the entire table, line by line. Any lines before the first
2085hline are left alone, assuming that these are part of the table header.
2086@c
2087@kindex C-u C-u C-c *
2088@kindex C-u C-u C-c C-c
2089@item C-u C-u C-c *
2090@itemx C-u C-u C-c C-c
2091Iterate the table by recomputing it until no further changes occur.
2092This may be necessary if some computed fields use the value of other
2093fields that are computed @i{later} in the calculation sequence.
2094@end table
2095
2096@node Advanced features, , Updating the table, The spreadsheet
2097@subsection Advanced features
2098
2099If you want the recalculation of fields to happen automatically, or if
2100you want to be able to assign @i{names} to fields and columns, you need
2101to reserve the first column of the table for special marking characters.
2102@table @kbd
2103@kindex C-#
2104@item C-#
2105Rotate the calculation mark in first column through the states @samp{},
2106@samp{#}, @samp{*}, @samp{!}, @samp{$}. The meaning of these characters
2107is discussed below. When there is an active region, change all marks in
2108the region.
2109@end table
2110
2111Here is an example of a table that collects exam results of students and
2112makes use of these features:
2113
2114@example
2115@group
2116|---+---------+--------+--------+--------+-------+------|
2117| | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
2118|---+---------+--------+--------+--------+-------+------|
2119| ! | | P1 | P2 | P3 | Tot | |
2120| # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
2121| ^ | | m1 | m2 | m3 | mt | |
2122|---+---------+--------+--------+--------+-------+------|
2123| # | Peter | 10 | 8 | 23 | 41 | 8.2 |
2124| # | Sara | 6 | 14 | 19 | 39 | 7.8 |
2125| # | Sam | 2 | 4 | 3 | 9 | 1.8 |
2126|---+---------+--------+--------+--------+-------+------|
2127| | Average | | | | 29.7 | |
2128| ^ | | | | | at | |
2129| $ | max=50 | | | | | |
2130|---+---------+--------+--------+--------+-------+------|
2131#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
2132@end group
2133@end example
2134
2135@noindent @b{Important}: Please note that for these special tables,
2136recalculating the table with @kbd{C-u C-c *} will only affect rows that
2137are marked @samp{#} or @samp{*}, and fields that have a formula assigned
2138to the field itself. The column formulas are not applied in rows with
2139empty first field.
2140
2141@cindex marking characters, tables
2142The marking characters have the following meaning:
2143@table @samp
2144@item !
2145The fields in this line define names for the columns, so that you may
2146refer to a column as @samp{$Tot} instead of @samp{$6}.
2147@item ^
2148This row defines names for the fields @emph{above} the row. With such
2149a definition, any formula in the table may use @samp{$m1} to refer to
2150the value @samp{10}. Also, if you assign a formula to a names field, it
2151will be stored as @samp{$name=...}.
2152@item _
2153Similar to @samp{^}, but defines names for the fields in the row
2154@emph{below}.
2155@item $
2156Fields in this row can define @emph{parameters} for formulas. For
2157example, if a field in a @samp{$} row contains @samp{max=50}, then
2158formulas in this table can refer to the value 50 using @samp{$max}.
2159Parameters work exactly like constants, only that they can be defined on
2160a per-table basis.
2161@item #
2162Fields in this row are automatically recalculated when pressing
2163@key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
2164is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
2165lines will be left alone by this command.
2166@item *
2167Selects this line for global recalculation with @kbd{C-u C-c *}, but
2168not for automatic recalculation. Use this when automatic
2169recalculation slows down editing too much.
2170@item
2171Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
2172All lines that should be recalculated should be marked with @samp{#}
2173or @samp{*}.
2174@item /
2175Do not export this line. Useful for lines that contain the narrowing
2176@samp{<N>} markers.
2177@end table
2178
2179Finally, just to whet your appetite on what can be done with the
2180fantastic @file{calc} package, here is a table that computes the Taylor
28a16a1b
CD
2181series of degree @code{n} at location @code{x} for a couple of
2182functions.
4009494e
GM
2183
2184@example
2185@group
2186|---+-------------+---+-----+--------------------------------------|
2187| | Func | n | x | Result |
2188|---+-------------+---+-----+--------------------------------------|
2189| # | exp(x) | 1 | x | 1 + x |
2190| # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
2191| # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
2192| # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
2193| # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
2194| * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
2195|---+-------------+---+-----+--------------------------------------|
2196#+TBLFM: $5=taylor($2,$4,$3);n3
2197@end group
2198@end example
2199
a7808fba 2200@node Hyperlinks, TODO Items, Tables, Top
4009494e
GM
2201@chapter Hyperlinks
2202@cindex hyperlinks
2203
a7808fba 2204Like HTML, Org provides links inside a file, external links to
dbc28aaa 2205other files, Usenet articles, emails, and much more.
4009494e
GM
2206
2207@menu
a7808fba 2208* Link format:: How links in Org are formatted
4009494e
GM
2209* Internal links:: Links to other places in the current file
2210* External links:: URL-like links to the world
2211* Handling links:: Creating, inserting and following
a7808fba 2212* Using links outside Org:: Linking from my C source code?
4009494e
GM
2213* Link abbreviations:: Shortcuts for writing complex links
2214* Search options:: Linking to a specific location
2215* Custom searches:: When the default search is not enough
4009494e
GM
2216@end menu
2217
2218@node Link format, Internal links, Hyperlinks, Hyperlinks
2219@section Link format
2220@cindex link format
2221@cindex format, of links
2222
a7808fba 2223Org will recognize plain URL-like links and activate them as
4009494e
GM
2224clickable links. The general link format, however, looks like this:
2225
2226@example
28a16a1b 2227[[link][description]] @r{or alternatively} [[link]]
4009494e
GM
2228@end example
2229
a7808fba 2230Once a link in the buffer is complete (all brackets present), Org
4009494e
GM
2231will change the display so that @samp{description} is displayed instead
2232of @samp{[[link][description]]} and @samp{link} is displayed instead of
2233@samp{[[link]]}. Links will be highlighted in the face @code{org-link},
2234which by default is an underlined face. You can directly edit the
2235visible part of a link. Note that this can be either the @samp{link}
2236part (if there is no description) or the @samp{description} part. To
2237edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
2238cursor on the link.
2239
2240If you place the cursor at the beginning or just behind the end of the
2241displayed text and press @key{BACKSPACE}, you will remove the
2242(invisible) bracket at that location. This makes the link incomplete
2243and the internals are again displayed as plain text. Inserting the
2244missing bracket hides the link internals again. To show the
2245internal structure of all links, use the menu entry
2246@code{Org->Hyperlinks->Literal links}.
2247
2248@node Internal links, External links, Link format, Hyperlinks
2249@section Internal links
2250@cindex internal links
2251@cindex links, internal
2252@cindex targets, for links
2253
2254If the link does not look like a URL, it is considered to be internal in
2255the current file. Links such as @samp{[[My Target]]} or @samp{[[My
2256Target][Find my target]]} lead to a text search in the current file.
2257The link can be followed with @kbd{C-c C-o} when the cursor is on the
2258link, or with a mouse click (@pxref{Handling links}). The preferred
2259match for such a link is a dedicated target: the same string in double
2260angular brackets. Targets may be located anywhere; sometimes it is
2261convenient to put them into a comment line. For example
2262
2263@example
2264# <<My Target>>
2265@end example
2266
2267@noindent In HTML export (@pxref{HTML export}), such targets will become
2268named anchors for direct access through @samp{http} links@footnote{Note
2269that text before the first headline is usually not exported, so the
2270first such target should be after the first headline.}.
2271
a7808fba 2272If no dedicated target exists, Org will search for the words in the
4009494e
GM
2273link. In the above example the search would be for @samp{my target}.
2274Links starting with a star like @samp{*My Target} restrict the search to
a7808fba 2275headlines. When searching, Org mode will first try an exact match, but
4009494e
GM
2276then move on to more and more lenient searches. For example, the link
2277@samp{[[*My Targets]]} will find any of the following:
2278
2279@example
2280** My targets
2281** TODO my targets are bright
2282** my 20 targets are
2283@end example
2284
2285To insert a link targeting a headline, in-buffer completion can be used.
2286Just type a star followed by a few optional letters into the buffer and
2287press @kbd{M-@key{TAB}}. All headlines in the current buffer will be
2288offered as completions. @xref{Handling links}, for more commands
2289creating links.
2290
a7808fba 2291Following a link pushes a mark onto Org's own mark ring. You can
4009494e
GM
2292return to the previous position with @kbd{C-c &}. Using this command
2293several times in direct succession goes back to positions recorded
2294earlier.
2295
2296@menu
a7808fba 2297* Radio targets:: Make targets trigger links in plain text
4009494e
GM
2298@end menu
2299
2300@node Radio targets, , Internal links, Internal links
2301@subsection Radio targets
2302@cindex radio targets
2303@cindex targets, radio
2304@cindex links, radio targets
2305
a7808fba 2306Org can automatically turn any occurrences of certain target names
4009494e
GM
2307in normal text into a link. So without explicitly creating a link, the
2308text connects to the target radioing its position. Radio targets are
2309enclosed by triple angular brackets. For example, a target @samp{<<<My
2310Target>>>} causes each occurrence of @samp{my target} in normal text to
a7808fba 2311become activated as a link. The Org file is scanned automatically
4009494e
GM
2312for radio targets only when the file is first loaded into Emacs. To
2313update the target list during editing, press @kbd{C-c C-c} with the
2314cursor on or at a target.
2315
2316@node External links, Handling links, Internal links, Hyperlinks
2317@section External links
2318@cindex links, external
2319@cindex external links
2320@cindex links, external
a7808fba 2321@cindex Gnus links
4009494e 2322@cindex BBDB links
28a16a1b 2323@cindex IRC links
4009494e
GM
2324@cindex URL links
2325@cindex file links
2326@cindex VM links
2327@cindex RMAIL links
2328@cindex WANDERLUST links
2329@cindex MH-E links
2330@cindex USENET links
2331@cindex SHELL links
2332@cindex Info links
2333@cindex elisp links
2334
a7808fba 2335Org supports links to files, websites, Usenet and email messages,
28a16a1b
CD
2336BBDB database entries and links to both IRC conversations and their
2337logs. External links are URL-like locators. They start with a short
2338identifying string followed by a colon. There can be no space after
2339the colon. The following list shows examples for each link type.
4009494e
GM
2340
2341@example
a7808fba 2342http://www.astro.uva.nl/~dominik @r{on the web}
4009494e
GM
2343file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
2344file:papers/last.pdf @r{file, relative path}
2345news:comp.emacs @r{Usenet link}
28a16a1b 2346mailto:adent@@galaxy.net @r{Mail link}
4009494e
GM
2347vm:folder @r{VM folder link}
2348vm:folder#id @r{VM message link}
28a16a1b 2349vm://myself@@some.where.org/folder#id @r{VM on remote machine}
4009494e
GM
2350wl:folder @r{WANDERLUST folder link}
2351wl:folder#id @r{WANDERLUST message link}
2352mhe:folder @r{MH-E folder link}
2353mhe:folder#id @r{MH-E message link}
2354rmail:folder @r{RMAIL folder link}
2355rmail:folder#id @r{RMAIL message link}
a7808fba
CD
2356gnus:group @r{Gnus group link}
2357gnus:group#id @r{Gnus article link}
4009494e 2358bbdb:Richard Stallman @r{BBDB link}
28a16a1b 2359irc:/irc.com/#emacs/bob @r{IRC link}
4009494e
GM
2360shell:ls *.org @r{A shell command}
2361elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
2362@end example
2363
2364A link should be enclosed in double brackets and may contain a
a7808fba 2365descriptive text to be displayed instead of the URL (@pxref{Link
4009494e
GM
2366format}), for example:
2367
2368@example
2369[[http://www.gnu.org/software/emacs/][GNU Emacs]]
2370@end example
2371
2372@noindent
2373If the description is a file name or URL that points to an image, HTML
2374export (@pxref{HTML export}) will inline the image as a clickable
2375button. If there is no description at all and the link points to an
2376image,
2377that image will be inlined into the exported HTML file.
2378
2379@cindex angular brackets, around links
2380@cindex plain text external links
a7808fba 2381Org also finds external links in the normal text and activates them
4009494e
GM
2382as links. If spaces must be part of the link (for example in
2383@samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
2384about the end of the link, enclose them in angular brackets.
2385
a7808fba 2386@node Handling links, Using links outside Org, External links, Hyperlinks
4009494e
GM
2387@section Handling links
2388@cindex links, handling
2389
a7808fba
CD
2390Org provides methods to create a link in the correct syntax, to
2391insert it into an Org file, and to follow the link.
4009494e
GM
2392
2393@table @kbd
2394@kindex C-c l
2395@cindex storing links
2396@item C-c l
2397Store a link to the current location. This is a @emph{global} command
2398which can be used in any buffer to create a link. The link will be
a7808fba
CD
2399stored for later insertion into an Org buffer (see below). For
2400Org files, if there is a @samp{<<target>>} at the cursor, the
28a16a1b 2401link points to the target. Otherwise it points to the current
a7808fba 2402headline. For VM, Rmail, Wanderlust, MH-E, Gnus and BBDB buffers, the
28a16a1b
CD
2403link will indicate the current article/entry. For W3 and W3M buffers,
2404the link goes to the current URL. For IRC links, if you set the
2405variable @code{org-irc-link-to-logs} to non-nil then @kbd{C-c l} will
2406store a @samp{file:/} style link to the relevant point in the logs for
2407the current conversation. Otherwise an @samp{irc:/} style link to the
2408user/channel/server under the point will be stored. For any other
2409files, the link will point to the file, with a search string
2410(@pxref{Search options}) pointing to the contents of the current line.
2411If there is an active region, the selected words will form the basis
2412of the search string. If the automatically created link is not
2413working correctly or accurately enough, you can write custom functions
2414to select the search string and to do the search for particular file
2415types - see @ref{Custom searches}. The key binding @kbd{C-c l} is
2416only a suggestion - see @ref{Installation}.
4009494e
GM
2417@c
2418@kindex C-c C-l
2419@cindex link completion
2420@cindex completion, of links
2421@cindex inserting links
2422@item C-c C-l
a7808fba
CD
2423Insert a link. This prompts for a link to be inserted into the buffer. You
2424can just type a link, using text for an internal link, or one of the link
2425type prefixes mentioned in the examples above. All links stored during the
2426current session are part of the history for this prompt, so you can access
2427them with @key{up} and @key{down} (or @kbd{M-p/n}). Completion, on the other
2428hand, will help you to insert valid link prefixes like @samp{http:} or
2429@samp{ftp:}, including the prefixes defined through link abbreviations
2430(@pxref{Link abbreviations}). The link will be inserted into the
2431buffer@footnote{After insertion of a stored link, the link will be removed
2432from the list of stored links. To keep it in the list later use, use a
2433triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
2434@code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
2435If some text was selected when this command is called, the selected text
2436becomes the default description.@* Note that you don't have to use this
2437command to insert a link. Links in Org are plain text, and you can type
2438or paste them straight into the buffer. By using this command, the links are
2439automatically enclosed in double brackets, and you will be asked for the
2440optional descriptive text.
4009494e
GM
2441@c
2442@c If the link is a @samp{file:} link and
2443@c the linked file is located in the same directory as the current file or
2444@c a subdirectory of it, the path of the file will be inserted relative to
2445@c the current directory.
2446@c
2447@kindex C-u C-c C-l
2448@cindex file name completion
2449@cindex completion, of file names
2450@item C-u C-c C-l
2451When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
2452a file will be inserted and you may use file name completion to select
2453the name of the file. The path to the file is inserted relative to the
2454directory of the current org file, if the linked file is in the current
a7808fba 2455directory or in a sub-directory of it, or if the path is written relative
4009494e
GM
2456to the current directory using @samp{../}. Otherwise an absolute path
2457is used, if possible with @samp{~/} for your home directory. You can
2458force an absolute path with two @kbd{C-u} prefixes.
2459@c
2460@item C-c C-l @r{(with cursor on existing link)}
2461When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
2462link and description parts of the link.
2463@c
2464@cindex following links
2465@kindex C-c C-o
2466@item C-c C-o
2467Open link at point. This will launch a web browser for URLs (using
a7808fba 2468@command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
4009494e
GM
2469for the corresponding links, and execute the command in a shell link.
2470When the cursor is on an internal link, this commands runs the
2471corresponding search. When the cursor is on a TAG list in a headline,
2472it creates the corresponding TAGS view. If the cursor is on a time
2473stamp, it compiles the agenda for that date. Furthermore, it will visit
2474text and remote files in @samp{file:} links with Emacs and select a
2475suitable application for local non-text files. Classification of files
2476is based on file extension only. See option @code{org-file-apps}. If
2477you want to override the default application and visit the file with
2478Emacs, use a @kbd{C-u} prefix.
2479@c
2480@kindex mouse-2
2481@kindex mouse-1
2482@item mouse-2
2483@itemx mouse-1
2484On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
2485would. Under Emacs 22, also @kbd{mouse-1} will follow a link.
2486@c
2487@kindex mouse-3
2488@item mouse-3
2489Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
2490internal links to be displayed in another window@footnote{See the
2491variable @code{org-display-internal-link-with-indirect-buffer}}.
2492@c
2493@cindex mark ring
2494@kindex C-c %
2495@item C-c %
2496Push the current position onto the mark ring, to be able to return
2497easily. Commands following an internal link do this automatically.
2498@c
2499@cindex links, returning to
2500@kindex C-c &
2501@item C-c &
2502Jump back to a recorded position. A position is recorded by the
2503commands following internal links, and by @kbd{C-c %}. Using this
2504command several times in direct succession moves through a ring of
2505previously recorded positions.
2506@c
2507@kindex C-c C-x C-n
2508@kindex C-c C-x C-p
2509@cindex links, finding next/previous
2510@item C-c C-x C-n
2511@itemx C-c C-x C-p
2512Move forward/backward to the next link in the buffer. At the limit of
2513the buffer, the search fails once, and then wraps around. The key
2514bindings for this are really too long, you might want to bind this also
2515to @kbd{C-n} and @kbd{C-p}
2516@lisp
2517(add-hook 'org-load-hook
2518 (lambda ()
2519 (define-key 'org-mode-map "\C-n" 'org-next-link)
2520 (define-key 'org-mode-map "\C-p" 'org-previous-link)))
2521@end lisp
2522@end table
2523
a7808fba
CD
2524@node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
2525@section Using links outside Org
4009494e 2526
a7808fba
CD
2527You can insert and follow links that have Org syntax not only in
2528Org, but in any Emacs buffer. For this, you should create two
4009494e
GM
2529global commands, like this (please select suitable global keys
2530yourself):
2531
2532@lisp
2533(global-set-key "\C-c L" 'org-insert-link-global)
2534(global-set-key "\C-c o" 'org-open-at-point-global)
2535@end lisp
2536
a7808fba 2537@node Link abbreviations, Search options, Using links outside Org, Hyperlinks
4009494e
GM
2538@section Link abbreviations
2539@cindex link abbreviations
2540@cindex abbreviation, links
2541
2542Long URLs can be cumbersome to type, and often many similar links are
2543needed in a document. For this you can use link abbreviations. An
2544abbreviated link looks like this
2545
2546@example
2547[[linkword:tag][description]]
2548@end example
2549
2550@noindent
2551where the tag is optional. Such abbreviations are resolved according to
2552the information in the variable @code{org-link-abbrev-alist} that
2553relates the linkwords to replacement text. Here is an example:
2554
2555@lisp
2556@group
2557(setq org-link-abbrev-alist
2558 '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
2559 ("google" . "http://www.google.com/search?q=")
2560 ("ads" . "http://adsabs.harvard.edu/cgi-bin/
2561 nph-abs_connect?author=%s&db_key=AST")))
2562@end group
2563@end lisp
2564
2565If the replacement text contains the string @samp{%s}, it will be
2566replaced with the tag. Otherwise the tag will be appended to the string
2567in order to create the link. You may also specify a function that will
2568be called with the tag as the only argument to create the link.
2569
2570With the above setting, you could link to a specific bug with
2571@code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
a7808fba 2572@code{[[google:OrgMode]]} and find out what the Org author is
4009494e
GM
2573doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
2574
a7808fba 2575If you need special abbreviations just for a single Org buffer, you
4009494e
GM
2576can define them in the file with
2577
2578@example
2579#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
2580#+LINK: google http://www.google.com/search?q=%s
2581@end example
2582
2583@noindent
2584In-buffer completion @pxref{Completion} can be used after @samp{[} to
2585complete link abbreviations.
2586
2587@node Search options, Custom searches, Link abbreviations, Hyperlinks
2588@section Search options in file links
2589@cindex search option in file links
2590@cindex file links, searching
2591
2592File links can contain additional information to make Emacs jump to a
2593particular location in the file when following a link. This can be a
2594line number or a search option after a double@footnote{For backward
2595compatibility, line numbers can also follow a single colon.} colon. For
2596example, when the command @kbd{C-c l} creates a link (@pxref{Handling
2597links}) to a file, it encodes the words in the current line as a search
2598string that can be used to find this line back later when following the
28a16a1b 2599link with @kbd{C-c C-o}.
4009494e
GM
2600
2601Here is the syntax of the different ways to attach a search to a file
2602link, together with an explanation:
2603
2604@example
2605[[file:~/code/main.c::255]]
2606[[file:~/xx.org::My Target]]
2607[[file:~/xx.org::*My Target]]
2608[[file:~/xx.org::/regexp/]]
2609@end example
2610
2611@table @code
2612@item 255
2613Jump to line 255.
2614@item My Target
2615Search for a link target @samp{<<My Target>>}, or do a text search for
2616@samp{my target}, similar to the search in internal links, see
2617@ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
2618link will become an HTML reference to the corresponding named anchor in
2619the linked file.
2620@item *My Target
a7808fba 2621In an Org file, restrict search to headlines.
4009494e
GM
2622@item /regexp/
2623Do a regular expression search for @code{regexp}. This uses the Emacs
2624command @code{occur} to list all matches in a separate window. If the
a7808fba 2625target file is in Org mode, @code{org-occur} is used to create a
4009494e
GM
2626sparse tree with the matches.
2627@c If the target file is a directory,
2628@c @code{grep} will be used to search all files in the directory.
2629@end table
2630
2631As a degenerate case, a file link with an empty file name can be used
2632to search the current file. For example, @code{[[file:::find me]]} does
2633a search for @samp{find me} in the current file, just as
2634@samp{[[find me]]} would.
2635
dbc28aaa 2636@node Custom searches, , Search options, Hyperlinks
4009494e
GM
2637@section Custom Searches
2638@cindex custom search strings
2639@cindex search strings, custom
2640
2641The default mechanism for creating search strings and for doing the
2642actual search related to a file link may not work correctly in all
2643cases. For example, BibTeX database files have many entries like
2644@samp{year="1993"} which would not result in good search strings,
2645because the only unique identification for a BibTeX entry is the
2646citation key.
2647
2648If you come across such a problem, you can write custom functions to set
2649the right search string for a particular file type, and to do the search
2650for the string in the file. Using @code{add-hook}, these functions need
2651to be added to the hook variables
2652@code{org-create-file-search-functions} and
2653@code{org-execute-file-search-functions}. See the docstring for these
a7808fba 2654variables for more information. Org actually uses this mechanism
4009494e
GM
2655for Bib@TeX{} database files, and you can use the corresponding code as
2656an implementation example. Search for @samp{BibTeX links} in the source
2657file.
2658
2659
4009494e 2660
a7808fba
CD
2661@node TODO Items, Tags, Hyperlinks, Top
2662@chapter TODO Items
4009494e
GM
2663@cindex TODO items
2664
a7808fba 2665Org mode does not maintain TODO lists as separate documents. Instead,
dbc28aaa 2666TODO items are an integral part of the notes file, because TODO items
a7808fba 2667usually come up while taking notes! With Org mode, simply mark any
dbc28aaa
CD
2668entry in a tree as being a TODO item. In this way, information is not
2669duplicated, and the entire context from which the TODO item emerged is
2670always present.
4009494e 2671
dbc28aaa 2672Of course, this technique for managing TODO items scatters them
a7808fba 2673throughout your notes file. Org mode compensates for this by providing
dbc28aaa 2674methods to give you an overview of all the things that you have to do.
4009494e
GM
2675
2676@menu
2677* TODO basics:: Marking and displaying TODO entries
2678* TODO extensions:: Workflow and assignments
dbc28aaa 2679* Progress logging:: Dates and notes for progress
4009494e
GM
2680* Priorities:: Some things are more important than others
2681* Breaking down tasks:: Splitting a task into manageable pieces
2682* Checkboxes:: Tick-off lists
2683@end menu
2684
a7808fba 2685@node TODO basics, TODO extensions, TODO Items, TODO Items
4009494e
GM
2686@section Basic TODO functionality
2687
dbc28aaa
CD
2688Any headline becomes a TODO item when it starts with the word
2689@samp{TODO}, for example:
4009494e
GM
2690
2691@example
2692*** TODO Write letter to Sam Fortune
2693@end example
2694
2695@noindent
2696The most important commands to work with TODO entries are:
2697
2698@table @kbd
2699@kindex C-c C-t
2700@cindex cycling, of TODO states
2701@item C-c C-t
2702Rotate the TODO state of the current item among
2703
2704@example
2705,-> (unmarked) -> TODO -> DONE --.
2706'--------------------------------'
2707@end example
2708
2709The same rotation can also be done ``remotely'' from the timeline and
2710agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
dbc28aaa
CD
2711
2712@kindex C-u C-c C-t
2713@item C-u C-c C-t
2714Select a specific keyword using completion or (if it has been set up)
28a16a1b
CD
2715the fast selection interface. For the latter, you need to assign keys
2716to TODO states, see @ref{Per-file keywords} and @ref{Setting tags} for
2717more information.
dbc28aaa 2718
4009494e
GM
2719@kindex S-@key{right}
2720@kindex S-@key{left}
2721@item S-@key{right}
2722@itemx S-@key{left}
dbc28aaa
CD
2723Select the following/preceding TODO state, similar to cycling. Useful
2724mostly if more than two TODO states are possible (@pxref{TODO
4009494e 2725extensions}).
4009494e 2726@kindex C-c C-v
dbc28aaa 2727@kindex C-c / t
4009494e
GM
2728@cindex sparse tree, for TODO
2729@item C-c C-v
dbc28aaa 2730@itemx C-c / t
4009494e
GM
2731View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds
2732the entire buffer, but shows all TODO items and the headings hierarchy
a7808fba 2733above them. With a prefix argument, search for a specific TODO. You will be
4009494e 2734prompted for the keyword, and you can also give a list of keywords like
a7808fba 2735@code{KWD1|KWD2|...}. With numeric prefix argument N, show the tree for the
4009494e 2736Nth keyword in the variable @code{org-todo-keywords}. With two prefix
a7808fba 2737arguments, find all TODO and DONE entries.
4009494e
GM
2738@kindex C-c a t
2739@item C-c a t
dbc28aaa 2740Show the global TODO list. Collects the TODO items from all agenda
a7808fba 2741files (@pxref{Agenda Views}) into a single buffer. The new buffer will
dbc28aaa
CD
2742be in @code{agenda-mode}, which provides commands to examine and
2743manipulate the TODO entries from the new buffer (@pxref{Agenda
2744commands}). @xref{Global TODO list}, for more information.
4009494e
GM
2745@kindex S-M-@key{RET}
2746@item S-M-@key{RET}
2747Insert a new TODO entry below the current one.
2748@end table
2749
a7808fba 2750@node TODO extensions, Progress logging, TODO basics, TODO Items
4009494e
GM
2751@section Extended use of TODO keywords
2752@cindex extended TODO keywords
2753
dbc28aaa 2754By default, marked TODO entries have one of only two states: TODO and
a7808fba 2755DONE. Org mode allows you to classify TODO items in more complex ways
dbc28aaa
CD
2756with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With
2757special setup, the TODO keyword system can work differently in different
2758files.
4009494e
GM
2759
2760Note that @i{tags} are another way to classify headlines in general and
2761TODO items in particular (@pxref{Tags}).
2762
2763@menu
2764* Workflow states:: From TODO to DONE in steps
dbc28aaa 2765* TODO types:: I do this, Fred does the rest
4009494e 2766* Multiple sets in one file:: Mixing it all, and still finding your way
dbc28aaa
CD
2767* Fast access to TODO states:: Single letter selection of a state
2768* Per-file keywords:: Different files, different requirements
2769* Faces for TODO keywords:: Highlighting states
4009494e
GM
2770@end menu
2771
2772@node Workflow states, TODO types, TODO extensions, TODO extensions
2773@subsection TODO keywords as workflow states
2774@cindex TODO workflow
2775@cindex workflow states as TODO keywords
2776
2777You can use TODO keywords to indicate different @emph{sequential} states
2778in the process of working on an item, for example@footnote{Changing
a7808fba 2779this variable only becomes effective after restarting Org mode in a
4009494e
GM
2780buffer.}:
2781
2782@lisp
2783(setq org-todo-keywords
2784 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
2785@end lisp
2786
2787The vertical bar separates the TODO keywords (states that @emph{need
2788action}) from the DONE states (which need @emph{no further action}. If
2789you don't provide the separator bar, the last state is used as the DONE
2790state.
2791@cindex completion, of TODO keywords
2792With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
2793to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. You may
a7808fba 2794also use a numeric prefix argument to quickly select a specific state. For
4009494e 2795example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
28a16a1b
CD
2796Or you can use @kbd{S-left} to go backward through the sequence. If you
2797define many keywords, you can use in-buffer completion
2798(@pxref{Completion}) or even a special one-key selection scheme
2799(@pxref{Fast access to TODO states}) to insert these words into the
a7808fba 2800buffer. Changing a TODO state can be logged with a timestamp, see
28a16a1b 2801@ref{Tracking TODO state changes} for more information.
4009494e
GM
2802
2803@node TODO types, Multiple sets in one file, Workflow states, TODO extensions
2804@subsection TODO keywords as types
2805@cindex TODO types
2806@cindex names as TODO keywords
2807@cindex types as TODO keywords
2808
2809The second possibility is to use TODO keywords to indicate different
2810@emph{types} of action items. For example, you might want to indicate
2811that items are for ``work'' or ``home''. Or, when you work with several
2812people on a single project, you might want to assign action items
2813directly to persons, by using their names as TODO keywords. This would
2814be set up like this:
2815
2816@lisp
2817(setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
2818@end lisp
2819
2820In this case, different keywords do not indicate a sequence, but rather
2821different types. So the normal work flow would be to assign a task to a
a7808fba
CD
2822person, and later to mark it DONE. Org mode supports this style by adapting
2823the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
2824@kbd{t} command in the timeline and agenda buffers.}. When used several
2825times in succession, it will still cycle through all names, in order to first
2826select the right type for a task. But when you return to the item after some
2827time and execute @kbd{C-c C-t} again, it will switch from any name directly
2828to DONE. Use prefix arguments or completion to quickly select a specific
2829name. You can also review the items of a specific TODO type in a sparse tree
2830by using a numeric prefix to @kbd{C-c C-v}. For example, to see all things
2831Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect Lucy's items
2832from all agenda files into a single buffer, you would use the numeric prefix
2833argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
4009494e 2834
dbc28aaa 2835@node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
4009494e 2836@subsection Multiple keyword sets in one file
a7808fba 2837@cindex TODO keyword sets
4009494e
GM
2838
2839Sometimes you may want to use different sets of TODO keywords in
2840parallel. For example, you may want to have the basic
2841@code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
2842separate state indicating that an item has been canceled (so it is not
2843DONE, but also does not require action). Your setup would then look
2844like this:
2845
2846@lisp
2847(setq org-todo-keywords
2848 '((sequence "TODO" "|" "DONE")
2849 (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
2850 (sequence "|" "CANCELED")))
2851@end lisp
2852
a7808fba 2853The keywords should all be different, this helps Org mode to keep track
4009494e
GM
2854of which subsequence should be used for a given entry. In this setup,
2855@kbd{C-c C-t} only operates within a subsequence, so it switches from
2856@code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
2857(nothing) to @code{REPORT}. Therefore you need a mechanism to initially
2858select the correct sequence. Besides the obvious ways like typing a
2859keyword or using completion, you may also apply the following commands:
2860
2861@table @kbd
2862@kindex C-S-@key{right}
2863@kindex C-S-@key{left}
2864@item C-S-@key{right}
2865@itemx C-S-@key{left}
2866These keys jump from one TODO subset to the next. In the above example,
2867@kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
2868@code{REPORT}, and any of the words in the second row to @code{CANCELED}.
2869@kindex S-@key{right}
2870@kindex S-@key{left}
2871@item S-@key{right}
2872@itemx S-@key{left}
2873@kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
2874@emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
2875would switch from @code{DONE} to @code{REPORT} in the example above.
2876@end table
2877
dbc28aaa
CD
2878@node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
2879@subsection Fast access to TODO states
2880
2881If you would like to quickly change an entry to an arbitrary TODO state
2882instead of cycling through the states, you can set up keys for
2883single-letter access to the states. This is done by adding the section
2884key after each keyword, in parenthesis. For example:
2885
2886@lisp
2887(setq org-todo-keywords
2888 '((sequence "TODO(t)" "|" "DONE(d)")
2889 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
2890 (sequence "|" "CANCELED(c)")))
2891@end lisp
2892
2893If you then press @code{C-u C-c C-t} followed by the selection key, the
2894entry will be switched to this state. @key{SPC} can be used to remove
2895any TODO keyword from an entry. Should you like this way of selecting
2896TODO states a lot, you might want to set the variable
2897@code{org-use-fast-todo-selection} to @code{t} and make this behavior
2898the default. Check also the variable
2899@code{org-fast-tag-selection-include-todo}, it allows to change the TODO
28a16a1b
CD
2900state through the tags interface (@pxref{Setting tags}), in case you
2901like to mingle the two concepts.
dbc28aaa
CD
2902
2903@node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
4009494e
GM
2904@subsection Setting up keywords for individual files
2905@cindex keyword options
dbc28aaa 2906@cindex per-file keywords
4009494e
GM
2907
2908It can be very useful to use different aspects of the TODO mechanism in
2909different files. For file-local settings, you need to add special lines
2910to the file which set the keywords and interpretation for that file
2911only. For example, to set one of the two examples discussed above, you
2912need one of the following lines, starting in column zero anywhere in the
2913file:
2914
2915@example
2916#+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
2917@end example
2918or
2919@example
2920#+TYP_TODO: Fred Sara Lucy Mike | DONE
2921@end example
2922
2923A setup for using several sets in parallel would be:
2924
2925@example
2926#+SEQ_TODO: TODO | DONE
2927#+SEQ_TODO: REPORT BUG KNOWNCAUSE | FIXED
2928#+SEQ_TODO: | CANCELED
2929@end example
2930
2931@cindex completion, of option keywords
2932@kindex M-@key{TAB}
2933@noindent To make sure you are using the correct keyword, type
2934@samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
2935
2936@cindex DONE, final TODO keyword
2937Remember that the keywords after the vertical bar (or the last keyword
2938if no bar is there) must always mean that the item is DONE (although you
2939may use a different word). After changing one of these lines, use
2940@kbd{C-c C-c} with the cursor still in the line to make the changes
a7808fba
CD
2941known to Org mode@footnote{Org mode parses these lines only when
2942Org mode is activated after visiting a file. @kbd{C-c C-c} with the
2943cursor in a line starting with @samp{#+} is simply restarting Org mode
4009494e
GM
2944for the current buffer.}.
2945
dbc28aaa
CD
2946@node Faces for TODO keywords, , Per-file keywords, TODO extensions
2947@subsection Faces for TODO keywords
2948@cindex faces, for TODO keywords
2949
a7808fba 2950Org mode highlights TODO keywords with special faces: @code{org-todo}
dbc28aaa
CD
2951for keywords indicating that an item still has to be acted upon, and
2952@code{org-done} for keywords indicating that an item is finished. If
2953you are using more than 2 different states, you might want to use
2954special faces for some of them. This can be done using the variable
2955@code{org-todo-keyword-faces}. For example:
2956
2957@lisp
2958(setq org-todo-keyword-faces
2959 '(("TODO" . org-warning)
2960 ("DEFERRED" . shadow)
2961 ("CANCELED" . (:foreground "blue" :weight bold))))
2962@end lisp
2963
28a16a1b
CD
2964While using a list with face properties as shown for CANCELED
2965@emph{should} work, this does not aways seem to be the case. If
2966necessary, define a special face and use that.
2967
dbc28aaa 2968@page
a7808fba
CD
2969@node Progress logging, Priorities, TODO extensions, TODO Items
2970@section Progress logging
dbc28aaa
CD
2971@cindex progress logging
2972@cindex logging, of progress
2973
a7808fba 2974Org mode can automatically record a time stamp and possibly a note when
28a16a1b
CD
2975you mark a TODO item as DONE, or even each time you change the state of
2976a TODO item. This system is highly configurable, settings can be on a
2977per-keyword basis and can be localized to a file or even a subtree. For
2978information on how to clock working time for a task, see @ref{Clocking
2979work time}.
dbc28aaa
CD
2980
2981@menu
2982* Closing items:: When was this entry marked DONE?
2983* Tracking TODO state changes:: When did the status change?
2984@end menu
2985
2986@node Closing items, Tracking TODO state changes, Progress logging, Progress logging
2987@subsection Closing items
2988
28a16a1b
CD
2989The most basic logging is to keep track of @emph{when} a certain TODO
2990item was finished. This is achieved with@footnote{The corresponding
2991in-buffer setting is: @code{#+STARTUP: logdone}}.
dbc28aaa
CD
2992
2993@lisp
28a16a1b 2994(setq org-log-done 'time)
dbc28aaa
CD
2995@end lisp
2996
2997@noindent
28a16a1b
CD
2998Then each time you turn an entry from a TODO (not-done) state into any
2999of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
3000just after the headline. If you turn the entry back into a TODO item
3001through further state cycling, that line will be removed again. If you
3002want to record a note along with the timestamp, use@footnote{The
3003corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
dbc28aaa
CD
3004
3005@lisp
28a16a1b 3006(setq org-log-done 'note)
dbc28aaa
CD
3007@end lisp
3008
28a16a1b
CD
3009@noindent
3010You will then be prompted for a note, and that note will be stored below
3011the entry with a @samp{Closing Note} heading.
3012
3013In the timeline (@pxref{Timeline}) and in the agenda
a7808fba 3014(@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
28a16a1b
CD
3015display the TODO items with a @samp{CLOSED} timestamp on each day,
3016giving you an overview of what has been done.
3017
dbc28aaa
CD
3018@node Tracking TODO state changes, , Closing items, Progress logging
3019@subsection Tracking TODO state changes
3020
3021When TODO keywords are used as workflow states (@pxref{Workflow
3022states}), you might want to keep track of when a state change occurred
28a16a1b 3023and maybe take a note about this change. Since it is normally too much
a7808fba 3024to record a note for every state, Org mode expects configuration on a
28a16a1b
CD
3025per-keyword basis for this. This is achieved by adding special markers
3026@samp{!} (for a time stamp) and @samp{@@} (for a note) in parenthesis
3027after each keyword. For example, with the setting
dbc28aaa
CD
3028
3029@lisp
28a16a1b
CD
3030(setq org-todo-keywords
3031 '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
dbc28aaa
CD
3032@end lisp
3033
3034@noindent
28a16a1b
CD
3035you not only define global TODO keywords and fast access keys, but also
3036request that a time is recorded when the entry is turned into
a7808fba 3037DONE@footnote{It is possible that Org mode will record two time stamps
28a16a1b
CD
3038when you are using both @code{org-log-done} and state change logging.
3039However, it will never prompt for two notes - if you have configured
3040both, the state change recording note will take precedence and cancel
3041the @samp{Closing Note}.}, and that a note is recorded when switching to
3042WAIT or CANCELED. The setting for WAIT is even more special: The
3043@samp{!} after the slash means that in addition to the note taken when
3044entering the state, a time stamp should be recorded when @i{leaving} the
3045WAIT state, if and only if the @i{target} state does not configure
3046logging for entering it. So it has no effect when switching from WAIT
3047to DONE, because DONE is configured to record a timestamp only. But
3048when switching from WAIT back to TODO, the @samp{/!} in the WAIT
3049setting now triggers a timestamp even though TODO has no logging
3050configured.
3051
3052You can use the exact same syntax for setting logging preferences local
3053to a buffer:
3054@example
3055#+SEQ_TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
3056@end example
3057
3058In order to define logging settings that are local to a subtree or a
3059single item, define a LOGGING property in this entry. Any non-empty
3060LOGGING property resets all logging settings to nil. You may then turn
3061on logging for this specific tree using STARTUP keywords like
3062@code{lognotedone} or @code{logrepeat}, as well as adding state specific
3063settings like @code{TODO(!)}. For example
3064
3065@example
3066* TODO Log each state with only a time
3067 :PROPERTIES:
3068 :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
3069 :END:
3070* TODO Only log when switching to WAIT, and when repeating
3071 :PROPERTIES:
3072 :LOGGING: WAIT(@@) logrepeat
3073 :END:
3074* TODO No logging at all
3075 :PROPERTIES:
3076 :LOGGING: nil
3077 :END:
dbc28aaa
CD
3078@end example
3079
dbc28aaa 3080
a7808fba 3081@node Priorities, Breaking down tasks, Progress logging, TODO Items
4009494e
GM
3082@section Priorities
3083@cindex priorities
3084
a7808fba 3085If you use Org mode extensively, you may end up enough TODO items that
dbc28aaa
CD
3086it starts to make sense to prioritize them. Prioritizing can be done by
3087placing a @emph{priority cookie} into the headline of a TODO item, like
3088this
4009494e
GM
3089
3090@example
3091*** TODO [#A] Write letter to Sam Fortune
3092@end example
3093
3094@noindent
a7808fba 3095By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
dbc28aaa
CD
3096@samp{C}. @samp{A} is the highest priority. An entry without a cookie
3097is treated as priority @samp{B}. Priorities make a difference only in
a7808fba
CD
3098the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
3099no inherent meaning to Org mode.
dbc28aaa
CD
3100
3101Priorities can be attached to any outline tree entries; they do not need
3102to be TODO items.
4009494e
GM
3103
3104@table @kbd
3105@kindex @kbd{C-c ,}
3106@item @kbd{C-c ,}
3107Set the priority of the current headline. The command prompts for a
3108priority character @samp{A}, @samp{B} or @samp{C}. When you press
3109@key{SPC} instead, the priority cookie is removed from the headline.
3110The priorities can also be changed ``remotely'' from the timeline and
3111agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
3112@c
3113@kindex S-@key{up}
3114@kindex S-@key{down}
3115@item S-@key{up}
3116@itemx S-@key{down}
dbc28aaa
CD
3117Increase/decrease priority of current headline@footnote{See also the
3118option @code{org-priority-start-cycle-with-default'}.}. Note that these
3119keys are also used to modify time stamps (@pxref{Creating timestamps}).
a7808fba 3120Furthermore, these keys are also used by CUA mode (@pxref{Conflicts}).
4009494e
GM
3121@end table
3122
3123You can change the range of allowed priorities by setting the variables
3124@code{org-highest-priority}, @code{org-lowest-priority}, and
3125@code{org-default-priority}. For an individual buffer, you may set
3126these values (highest, lowest, default) like this (please make sure that
3127the highest priority is earlier in the alphabet than the lowest
3128priority):
3129
3130@example
3131#+PRIORITIES: A C B
3132@end example
3133
a7808fba 3134@node Breaking down tasks, Checkboxes, Priorities, TODO Items
4009494e
GM
3135@section Breaking tasks down into subtasks
3136@cindex tasks, breaking down
3137
3138It is often advisable to break down large tasks into smaller, manageable
3139subtasks. You can do this by creating an outline tree below a TODO
3140item, with detailed subtasks on the tree@footnote{To keep subtasks out
3141of the global TODO list, see the
3142@code{org-agenda-todo-list-sublevels}.}. Another possibility is the use
3143of checkboxes to identify (a hierarchy of) a large number of subtasks
3144(@pxref{Checkboxes}).
3145
3146
a7808fba 3147@node Checkboxes, , Breaking down tasks, TODO Items
4009494e
GM
3148@section Checkboxes
3149@cindex checkboxes
3150
dbc28aaa
CD
3151Every item in a plain list (@pxref{Plain lists}) can be made into a
3152checkbox by starting it with the string @samp{[ ]}. This feature is
a7808fba 3153similar to TODO items (@pxref{TODO Items}), but is more lightweight.
dbc28aaa
CD
3154Checkboxes are not included into the global TODO list, so they are often
3155great to split a task into a number of simple steps. Or you can use
3156them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or
3157use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
3158
3159Here is an example of a checkbox list.
4009494e
GM
3160
3161@example
28a16a1b
CD
3162* TODO Organize party [2/4]
3163 - [-] call people [1/3]
4009494e
GM
3164 - [ ] Peter
3165 - [X] Sarah
3166 - [ ] Sam
3167 - [X] order food
3168 - [ ] think about what music to play
3169 - [X] talk to the neighbors
3170@end example
3171
28a16a1b
CD
3172Checkboxes work hierarchically, so if a checkbox item has children that
3173are checkboxes, toggling one of the children checkboxes will make the
3174parent checkbox reflect if none, some, or all of the children are
3175checked.
3176
4009494e
GM
3177@cindex statistics, for checkboxes
3178@cindex checkbox statistics
28a16a1b 3179The @samp{[2/4]} and @samp{[1/3]} in the first and second line are
dbc28aaa
CD
3180cookies indicating how many checkboxes present in this entry have been
3181checked off, and the total number of checkboxes are present. This can
3182give you an idea on how many checkboxes remain, even without opening a
3183folded entry. The cookies can be placed into a headline or into (the
3184first line of) a plain list item. Each cookie covers all checkboxes
3185structurally below the headline/item on which the cookie appear. You
3186have to insert the cookie yourself by typing either @samp{[/]} or
3187@samp{[%]}. With @samp{[/]} you get an @samp{n out of m} result, as in
3188the examples above. With @samp{[%]} you get information about the
4009494e 3189percentage of checkboxes checked (in the above example, this would be
dbc28aaa 3190@samp{[50%]} and @samp{[33%]}, respectively).
4009494e
GM
3191
3192@noindent The following commands work with checkboxes:
3193
3194@table @kbd
3195@kindex C-c C-c
3196@item C-c C-c
a7808fba 3197Toggle checkbox at point. With a prefix argument, set it to @samp{[-]},
4009494e
GM
3198which is considered to be an intermediate state.
3199@kindex C-c C-x C-b
3200@item C-c C-x C-b
3201Toggle checkbox at point.
3202@itemize @minus
3203@item
3204If there is an active region, toggle the first checkbox in the region
3205and set all remaining boxes to the same status as the first. If you
3206want to toggle all boxes in the region independently, use a prefix
3207argument.
3208@item
3209If the cursor is in a headline, toggle checkboxes in the region between
3210this headline and the next (so @emph{not} the entire subtree).
3211@item
3212If there is no active region, just toggle the checkbox at point.
3213@end itemize
3214@kindex M-S-@key{RET}
3215@item M-S-@key{RET}
3216Insert a new item with a checkbox.
3217This works only if the cursor is already in a plain list item
3218(@pxref{Plain lists}).
3219@kindex C-c #
3220@item C-c #
3221Update the checkbox statistics in the current outline entry. When
3222called with a @kbd{C-u} prefix, update the entire file. Checkbox
3223statistic cookies are updated automatically if you toggle checkboxes
3224with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}. If you
3225delete boxes or add/change them by hand, use this command to get things
3226back into synch. Or simply toggle any checkbox twice with @kbd{C-c C-c}.
3227@end table
3228
a7808fba 3229@node Tags, Properties and Columns, TODO Items, Top
4009494e
GM
3230@chapter Tags
3231@cindex tags
3232@cindex headline tagging
3233@cindex matching, tags
3234@cindex sparse tree, tag based
3235
dbc28aaa 3236An excellent way to implement labels and contexts for cross-correlating
a7808fba 3237information is to assign @i{tags} to headlines. Org mode has extensive
dbc28aaa 3238support for tags.
4009494e 3239
dbc28aaa
CD
3240Every headline can contain a list of tags; they occur at the end of the
3241headline. Tags are normal words containing letters, numbers, @samp{_},
3242and @samp{@@}. Tags must be preceded and followed by a single colon,
3243e.g., @samp{:WORK:}. Several tags can be specified, as in
3244@samp{:work:URGENT:}.
4009494e
GM
3245
3246@menu
3247* Tag inheritance:: Tags use the tree structure of the outline
3248* Setting tags:: How to assign tags to a headline
3249* Tag searches:: Searching for combinations of tags
3250@end menu
3251
3252@node Tag inheritance, Setting tags, Tags, Tags
3253@section Tag inheritance
dbc28aaa 3254@cindex tag inheritance
4009494e
GM
3255@cindex inheritance, of tags
3256@cindex sublevels, inclusion into tags match
3257
3258@i{Tags} make use of the hierarchical structure of outline trees. If a
3259heading has a certain tag, all subheadings will inherit the tag as
3260well. For example, in the list
3261
3262@example
dbc28aaa
CD
3263* Meeting with the French group :work:
3264** Summary by Frank :boss:notes:
3265*** TODO Prepare slides for him :action:
4009494e
GM
3266@end example
3267
3268@noindent
dbc28aaa
CD
3269the final heading will have the tags @samp{:work:}, @samp{:boss:},
3270@samp{:notes:}, and @samp{:action:} even though the final heading is not
3271explicitly marked with those tags. When executing tag searches and
a7808fba 3272Org mode finds that a certain headline matches the search criterion, it
dbc28aaa
CD
3273will not check any sublevel headline, assuming that these also match and
3274that the list of matches could become very long because of that. If you
a7808fba
CD
3275do want the sublevels be tested and listed as well, you may set the
3276variable @code{org-tags-match-list-sublevels}. To limit tag inheritance
3277to specific tags, or to turn it off entirely, use the variable
3278@code{org-use-tag-inheritance}.
4009494e
GM
3279
3280@node Setting tags, Tag searches, Tag inheritance, Tags
3281@section Setting tags
3282@cindex setting tags
3283@cindex tags, setting
3284
3285@kindex M-@key{TAB}
3286Tags can simply be typed into the buffer at the end of a headline.
3287After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
3288also a special command for inserting tags:
3289
3290@table @kbd
3291@kindex C-c C-c
3292@item C-c C-c
3293@cindex completion, of tags
a7808fba 3294Enter new tags for the current headline. Org mode will either offer
4009494e
GM
3295completion or a special single-key interface for setting tags, see
3296below. After pressing @key{RET}, the tags will be inserted and aligned
3297to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all
3298tags in the current buffer will be aligned to that column, just to make
3299things look nice. TAGS are automatically realigned after promotion,
3300demotion, and TODO state changes (@pxref{TODO basics}).
3301@end table
3302
3303Org will support tag insertion based on a @emph{list of tags}. By
3304default this list is constructed dynamically, containing all tags
3305currently used in the buffer. You may also globally specify a hard list
3306of tags with the variable @code{org-tag-alist}. Finally you can set
3307the default tags for a given file with lines like
3308
3309@example
dbc28aaa
CD
3310#+TAGS: @@work @@home @@tennisclub
3311#+TAGS: laptop car pc sailboat
4009494e
GM
3312@end example
3313
3314If you have globally defined your preferred set of tags using the
3315variable @code{org-tag-alist}, but would like to use a dynamic tag list
dbc28aaa 3316in a specific file, add an empty TAGS option line to that file:
4009494e
GM
3317
3318@example
3319#+TAGS:
3320@end example
3321
a7808fba
CD
3322By default Org mode uses the standard minibuffer completion facilities for
3323entering tags. However, it also implements another, quicker, tag selection
3324method called @emph{fast tag selection}. This allows you to select and
3325deselect tags with just a single key press. For this to work well you should
3326assign unique letters to most of your commonly used tags. You can do this
3327globally by configuring the variable @code{org-tag-alist} in your
3328@file{.emacs} file. For example, you may find the need to tag many items in
3329different files with @samp{:@@home:}. In this case you can set something
3330like:
4009494e
GM
3331
3332@lisp
dbc28aaa 3333(setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
4009494e
GM
3334@end lisp
3335
a7808fba
CD
3336@noindent If the tag is only relevant to the file you are working on then you
3337can, instead, set the TAGS option line as:
4009494e
GM
3338
3339@example
dbc28aaa 3340#+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
4009494e
GM
3341@end example
3342
3343@noindent
a7808fba
CD
3344You can also group together tags that are mutually exclusive. By using
3345braces, as in:
4009494e
GM
3346
3347@example
dbc28aaa 3348#+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
4009494e
GM
3349@end example
3350
dbc28aaa 3351@noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
a7808fba 3352and @samp{@@tennisclub} should be selected. Multiple such groups are allowed.
4009494e
GM
3353
3354@noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
3355these lines to activate any changes.
3356
a7808fba
CD
3357@noindent
3358To set these mutually exclusive groups in the variable @code{org-mode-alist}
3359you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
3360of the braces. The previous example would be set globally by the following
3361configuration:
3362
3363@lisp
3364(setq org-tag-alist '((:startgroup . nil)
3365 ("@@work" . ?w) ("@@home" . ?h)
3366 ("@@tennisclub" . ?t)
3367 (:endgroup . nil)
3368 ("laptop" . ?l) ("pc" . ?p)))
3369@end lisp
3370
3371If at least one tag has a selection key then pressing @kbd{C-c C-c} will
3372automatically present you with a special interface, listing inherited tags,
3373the tags of the current headline, and a list of all valid tags with
3374corresponding keys@footnote{Keys will automatically be assigned to tags which
3375have no configured keys.}. In this interface, you can use the following
3376keys:
4009494e
GM
3377
3378@table @kbd
3379@item a-z...
3380Pressing keys assigned to tags will add or remove them from the list of
3381tags in the current line. Selecting a tag in a group of mutually
3382exclusive tags will turn off any other tags from that group.
3383@kindex @key{TAB}
3384@item @key{TAB}
3385Enter a tag in the minibuffer, even if the tag is not in the predefined
3386list. You will be able to complete on all tags present in the buffer.
3387@kindex @key{SPC}
3388@item @key{SPC}
3389Clear all tags for this line.
3390@kindex @key{RET}
3391@item @key{RET}
3392Accept the modified set.
3393@item C-g
3394Abort without installing changes.
3395@item q
3396If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
3397@item !
3398Turn off groups of mutually exclusive tags. Use this to (as an
3399exception) assign several tags from such a group.
3400@item C-c
3401Toggle auto-exit after the next change (see below).
3402If you are using expert mode, the first @kbd{C-c} will display the
3403selection window.
3404@end table
3405
3406@noindent
3407This method lets you assign tags to a headline with very few keys. With
dbc28aaa
CD
3408the above setup, you could clear the current tags and set @samp{@@home},
3409@samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
3410C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to
3411@samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
4009494e
GM
3412alternatively with @kbd{C-c C-c C-c w}. Adding the non-predefined tag
3413@samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
3414@key{RET} @key{RET}}.
3415
a7808fba 3416If you find that most of the time, you need only a single key press to
4009494e
GM
3417modify your list of tags, set the variable
3418@code{org-fast-tag-selection-single-key}. Then you no longer have to
3419press @key{RET} to exit fast tag selection - it will immediately exit
3420after the first change. If you then occasionally need more keys, press
3421@kbd{C-c} to turn off auto-exit for the current tag selection process
3422(in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
3423C-c}). If you set the variable to the value @code{expert}, the special
3424window is not even shown for single-key tag selection, it comes up only
3425when you press an extra @kbd{C-c}.
3426
3427@node Tag searches, , Setting tags, Tags
3428@section Tag searches
3429@cindex tag searches
3430@cindex searching for tags
3431
dbc28aaa 3432Once a system of tags has been set up, it can be used to collect related
4009494e
GM
3433information into special lists.
3434
3435@table @kbd
3436@kindex C-c \
dbc28aaa 3437@kindex C-c / T
4009494e 3438@item C-c \
dbc28aaa 3439@itemx C-c / T
4009494e
GM
3440Create a sparse tree with all headlines matching a tags search. With a
3441@kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
3442@kindex C-c a m
3443@item C-c a m
3444Create a global list of tag matches from all agenda files.
3445@xref{Matching tags and properties}.
3446@kindex C-c a M
3447@item C-c a M
3448Create a global list of tag matches from all agenda files, but check
3449only TODO items and force checking subitems (see variable
3450@code{org-tags-match-list-sublevels}).
3451@end table
3452
3453@cindex Boolean logic, for tag searches
3454A @i{tags} search string can use Boolean operators @samp{&} for AND and
3455@samp{|} for OR. @samp{&} binds more strongly than @samp{|}.
3456Parenthesis are currently not implemented. A tag may also be preceded
3457by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
3458positive selection. The AND operator @samp{&} is optional when @samp{+}
3459or @samp{-} is present. Examples:
3460
3461@table @samp
dbc28aaa
CD
3462@item +work-boss
3463Select headlines tagged @samp{:work:}, but discard those also tagged
3464@samp{:boss:}.
3465@item work|laptop
3466Selects lines tagged @samp{:work:} or @samp{:laptop:}.
3467@item work|laptop&night
3468Like before, but require the @samp{:laptop:} lines to be tagged also
3469@samp{:night:}.
4009494e
GM
3470@end table
3471
3472@cindex TODO keyword matching, with tags search
3473If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
3474can be useful to also match on the TODO keyword. This can be done by
3475adding a condition after a slash to a tags match. The syntax is similar
3476to the tag matches, but should be applied with consideration: For
3477example, a positive selection on several TODO keywords can not
3478meaningfully be combined with boolean AND. However, @emph{negative
3479selection} combined with AND can be meaningful. To make sure that only
3480lines are checked that actually have any TODO keyword, use @kbd{C-c a
a7808fba 3481M}, or equivalently start the TODO part after the slash with @samp{!}.
4009494e
GM
3482Examples:
3483
3484@table @samp
dbc28aaa
CD
3485@item work/WAITING
3486Select @samp{:work:}-tagged TODO lines with the specific TODO
4009494e 3487keyword @samp{WAITING}.
dbc28aaa
CD
3488@item work/!-WAITING-NEXT
3489Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
4009494e 3490nor @samp{NEXT}
dbc28aaa
CD
3491@item work/+WAITING|+NEXT
3492Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
4009494e
GM
3493@samp{NEXT}.
3494@end table
3495
3496@cindex regular expressions, with tags search
3497Any element of the tag/todo match can be a regular expression - in this
3498case it must be enclosed in curly braces. For example,
dbc28aaa
CD
3499@samp{work+@{^boss.*@}} matches headlines that contain the tag
3500@samp{:work:} and any tag @i{starting} with @samp{boss}.
3501
3502@cindex level, require for tags/property match
3503@cindex category, require for tags/property match
3504You can also require a headline to be of a certain level or category, by
3505writing instead of any TAG an expression like @samp{LEVEL=3} or
3506@samp{CATEGORY="work"}, respectively. For example, a search
3507@samp{+LEVEL=3+boss/-DONE} lists all level three headlines that have the
a7808fba 3508tag @samp{boss} and are @emph{not} marked with the TODO keyword DONE.
dbc28aaa 3509
a7808fba 3510@node Properties and Columns, Dates and Times, Tags, Top
4009494e
GM
3511@chapter Properties and Columns
3512@cindex properties
3513
3514Properties are a set of key-value pairs associated with an entry. There
a7808fba 3515are two main applications for properties in Org mode. First, properties
dbc28aaa 3516are like tags, but with a value. Second, you can use properties to
a7808fba 3517implement (very basic) database capabilities in an Org buffer. For
dbc28aaa
CD
3518an example of the first application, imagine maintaining a file where
3519you document bugs and plan releases of a piece of software. Instead of
3520using tags like @code{:release_1:}, @code{:release_2:}, one can use a
3521property, say @code{:Release:}, that in different subtrees has different
3522values, such as @code{1.0} or @code{2.0}. For an example of the second
a7808fba 3523application of properties, imagine keeping track of your music CD's,
dbc28aaa
CD
3524where properties could be things such as the album artist, date of
3525release, number of tracks, and so on.
3526
28a16a1b 3527Properties can be conveniently edited and viewed in column view
dbc28aaa
CD
3528(@pxref{Column view}).
3529
3530Properties are like tags, but with a value. For example, in a file
3531where you document bugs and plan releases of a piece of software,
3532instead of using tags like @code{:release_1:}, @code{:release_2:}, it
3533can be more efficient to use a property @code{:Release:} with a value
3534@code{1.0} or @code{2.0}. Second, you can use properties to implement
a7808fba 3535(very basic) database capabilities in an Org buffer, for example to
dbc28aaa 3536create a list of Music CD's you own. You can edit and view properties
4009494e
GM
3537conveniently in column view (@pxref{Column view}).
3538
3539@menu
3540* Property syntax:: How properties are spelled out
a7808fba 3541* Special properties:: Access to other Org mode features
4009494e 3542* Property searches:: Matching property values
dbc28aaa 3543* Property inheritance:: Passing values down the tree
4009494e
GM
3544* Column view:: Tabular viewing and editing
3545* Property API:: Properties for Lisp programmers
3546@end menu
3547
a7808fba
CD
3548@node Property syntax, Special properties, Properties and Columns, Properties and Columns
3549@section Property syntax
4009494e
GM
3550@cindex property syntax
3551@cindex drawer, for properties
3552
3553Properties are key-value pairs. They need to be inserted into a special
3554drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property
3555is specified on a single line, with the key (surrounded by colons)
3556first, and the value after it. Here is an example:
3557
3558@example
3559* CD collection
3560** Classic
3561*** Goldberg Variations
3562 :PROPERTIES:
3563 :Title: Goldberg Variations
3564 :Composer: J.S. Bach
28a16a1b 3565 :Artist: Glen Gould
4009494e
GM
3566 :Publisher: Deutsche Grammphon
3567 :NDisks: 1
28a16a1b 3568 :END:
4009494e
GM
3569@end example
3570
dbc28aaa
CD
3571You may define the allowed values for a particular property @samp{:Xyz:}
3572by setting a property @samp{:Xyz_ALL:}. This special property is
4009494e
GM
3573@emph{inherited}, so if you set it in a level 1 entry, it will apply to
3574the entire tree. When allowed values are defined, setting the
3575corresponding property becomes easier and is less prone to typing
3576errors. For the example with the CD collection, we can predefine
3577publishers and the number of disks in a box like this:
3578
3579@example
3580* CD collection
3581 :PROPERTIES:
3582 :NDisks_ALL: 1 2 3 4
3583 :Publisher_ALL: "Deutsche Grammophon" Phillips EMI
3584 :END:
3585@end example
3586
3587If you want to set properties that can be inherited by any entry in a
3588file, use a line like
3589
3590@example
3591#+PROPERTY: NDisks_ALL 1 2 3 4
3592@end example
3593
3594Property values set with the global variable
3595@code{org-global-properties} can be inherited by all entries in all
a7808fba 3596Org files.
4009494e
GM
3597
3598@noindent
3599The following commands help to work with properties:
3600
3601@table @kbd
3602@kindex M-@key{TAB}
3603@item M-@key{TAB}
3604After an initial colon in a line, complete property keys. All keys used
3605in the current file will be offered as possible completions.
dbc28aaa
CD
3606@kindex C-c C-x p
3607@item C-c C-x p
3608Set a property. This prompts for a property name and a value. If
3609necessary, the property drawer is created as well.
4009494e
GM
3610@item M-x org-insert-property-drawer
3611Insert a property drawer into the current entry. The drawer will be
3612inserted early in the entry, but after the lines with planning
3613information like deadlines.
3614@kindex C-c C-c
3615@item C-c C-c
3616With the cursor in a property drawer, this executes property commands.
3617@item C-c C-c s
3618Set a property in the current entry. Both the property and the value
3619can be inserted using completion.
3620@kindex S-@key{right}
3621@kindex S-@key{left}
3622@item S-@key{left}/@key{right}
3623Switch property at point to the next/previous allowed value.
3624@item C-c C-c d
3625Remove a property from the current entry.
3626@item C-c C-c D
3627Globally remove a property, from all entries in the current file.
dbc28aaa
CD
3628@item C-c C-c c
3629Compute the property at point, using the operator and scope from the
3630nearest column format definition.
4009494e
GM
3631@end table
3632
a7808fba
CD
3633@node Special properties, Property searches, Property syntax, Properties and Columns
3634@section Special properties
4009494e
GM
3635@cindex properties, special
3636
a7808fba 3637Special properties provide alternative access method to Org mode
4009494e
GM
3638features discussed in the previous chapters, like the TODO state or the
3639priority of an entry. This interface exists so that you can include
dbc28aaa
CD
3640these states into columns view (@pxref{Column view}), or to use them in
3641queries. The following property names are special and should not be
3642used as keys in the properties drawer:
4009494e
GM
3643
3644@example
3645TODO @r{The TODO keyword of the entry.}
3646TAGS @r{The tags defined directly in the headline.}
3647ALLTAGS @r{All tags, including inherited ones.}
3648PRIORITY @r{The priority of the entry, a string with a single letter.}
3649DEADLINE @r{The deadline time string, without the angular brackets.}
3650SCHEDULED @r{The scheduling time stamp, without the angular brackets.}
dbc28aaa
CD
3651TIMESTAMP @r{The first keyword-less time stamp in the entry.}
3652TIMESTAMP_IA @r{The first inactive time stamp in the entry.}
3653CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}}
3654 @r{must be run first to compute the values.}
4009494e
GM
3655@end example
3656
a7808fba 3657@node Property searches, Property inheritance, Special properties, Properties and Columns
4009494e
GM
3658@section Property searches
3659@cindex properties, searching
dbc28aaa 3660@cindex searching, of properties
4009494e 3661
a7808fba
CD
3662To create sparse trees and special lists with selection based on properties,
3663the same commands are used as for tag searches (@pxref{Tag searches}), and
3664the same logic applies. For example, here is a search string:
4009494e
GM
3665
3666@example
a7808fba 3667+work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2+With=@{Sarah\|Denny@}
4009494e
GM
3668@end example
3669
3670@noindent
a7808fba
CD
3671If the comparison value is a plain number, a numerical comparison is done,
3672and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=},
3673@samp{>=}, and @samp{<>}. If the comparison value is enclosed in double
3674quotes, a string comparison is done, and the same operators are allowed. If
3675the comparison value is enclosed in curly braces, a regexp match is
3676performed, with @samp{=} meaning that the regexp matches the property value,
3677and @samp{<>} meaning that it does not match. So the search string in the
3678example finds entries tagged @samp{:work:} but not @samp{:boss:}, which also
3679have a priority value @samp{A}, a @samp{:Coffee:} property with the value
3680@samp{unlimited}, an @samp{Effort} property that is numerically smaller than
36812, and a @samp{:With:} property that is matched by the regular expression
3682@samp{Sarah\|Denny}.
3683
3684You can configure Org mode to use property inheritance during a search, but
3685beware that this can slow down searches considerably. See @ref{Property
3686inheritance} for details.
dbc28aaa
CD
3687
3688There is also a special command for creating sparse trees based on a
3689single property:
3690
3691@table @kbd
3692@kindex C-c / p
3693@item C-c / p
3694Create a sparse tree based on the value of a property. This first
3695prompts for the name of a property, and then for a value. A sparse tree
3696is created with all entries that define this property with the given
3697value. If you enclose the value into curly braces, it is interpreted as
3698a regular expression and matched against the property values.
3699@end table
3700
a7808fba 3701@node Property inheritance, Column view, Property searches, Properties and Columns
dbc28aaa 3702@section Property Inheritance
a7808fba
CD
3703@cindex properties, inheritance
3704@cindex inheritance, of properties
dbc28aaa 3705
a7808fba 3706The outline structure of Org mode documents lends itself for an
dbc28aaa 3707inheritance model of properties: If the parent in a tree has a certain
a7808fba 3708property, the children can inherit this property. Org mode does not
dbc28aaa
CD
3709turn this on by default, because it can slow down property searches
3710significantly and is often not needed. However, if you find inheritance
3711useful, you can turn it on by setting the variable
3712@code{org-use-property-inheritance}. It may be set to @code{t}, to make
a7808fba
CD
3713all properties inherited from the parent, to a list of properties
3714that should be inherited, or to a regular expression that matches
3715inherited properties.
dbc28aaa 3716
a7808fba 3717Org mode has a few properties for which inheritance is hard-coded, at
dbc28aaa
CD
3718least for the special applications for which they are used:
3719
3720@table @code
3721@item COLUMNS
3722The @code{:COLUMNS:} property defines the format of column view
3723(@pxref{Column view}). It is inherited in the sense that the level
3724where a @code{:COLUMNS:} property is defined is used as the starting
3725point for a column view table, independently of the location in the
3726subtree from where columns view is turned on.
3727@item CATEGORY
3728For agenda view, a category set through a @code{:CATEGORY:} property
3729applies to the entire subtree.
3730@item ARCHIVE
3731For archiving, the @code{:ARCHIVE:} property may define the archive
3732location for the entire subtree (@pxref{Moving subtrees}).
28a16a1b
CD
3733@item LOGGING
3734The LOGGING property may define logging settings for an entry or a
3735subtree (@pxref{Tracking TODO state changes}).
dbc28aaa
CD
3736@end table
3737
a7808fba
CD
3738@node Column view, Property API, Property inheritance, Properties and Columns
3739@section Column view
4009494e
GM
3740
3741A great way to view and edit properties in an outline tree is
3742@emph{column view}. In column view, each outline item is turned into a
3743table row. Columns in this table provide access to properties of the
a7808fba 3744entries. Org mode implements columns by overlaying a tabular structure
4009494e
GM
3745over the headline of each item. While the headlines have been turned
3746into a table row, you can still change the visibility of the outline
3747tree. For example, you get a compact table by switching to CONTENTS
3748view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
3749is active), but you can still open, read, and edit the entry below each
3750headline. Or, you can switch to column view after executing a sparse
3751tree command and in this way get a table only for the selected items.
a7808fba 3752Column view also works in agenda buffers (@pxref{Agenda Views}) where
4009494e
GM
3753queries have collected selected items, possibly from a number of files.
3754
3755@menu
3756* Defining columns:: The COLUMNS format property
3757* Using column view:: How to create and use column view
a7808fba 3758* Capturing column view:: A dynamic block for column view
4009494e
GM
3759@end menu
3760
3761@node Defining columns, Using column view, Column view, Column view
a7808fba 3762@subsection Defining columns
4009494e
GM
3763@cindex column view, for properties
3764@cindex properties, column view
3765
3766Setting up a column view first requires defining the columns. This is
3767done by defining a column format line.
3768
3769@menu
3770* Scope of column definitions:: Where defined, where valid?
3771* Column attributes:: Appearance and content of a column
3772@end menu
3773
3774@node Scope of column definitions, Column attributes, Defining columns, Defining columns
3775@subsubsection Scope of column definitions
3776
3777To define a column format for an entire file, use a line like
3778
3779@example
3780#+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3781@end example
3782
dbc28aaa
CD
3783To specify a format that only applies to a specific tree, add a
3784@code{:COLUMNS:} property to the top node of that tree, for example:
3785
4009494e
GM
3786@example
3787** Top node for columns view
3788 :PROPERTIES:
3789 :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
3790 :END:
3791@end example
3792
dbc28aaa 3793If a @code{:COLUMNS:} property is present in an entry, it defines columns
4009494e
GM
3794for the entry itself, and for the entire subtree below it. Since the
3795column definition is part of the hierarchical structure of the document,
3796you can define columns on level 1 that are general enough for all
3797sublevels, and more specific columns further down, when you edit a
3798deeper part of the tree.
3799
3800@node Column attributes, , Scope of column definitions, Defining columns
3801@subsubsection Column attributes
3802A column definition sets the attributes of a column. The general
3803definition looks like this:
3804
3805@example
3806 %[width]property[(title)][@{summary-type@}]
3807@end example
3808
3809@noindent
3810Except for the percent sign and the property name, all items are
3811optional. The individual parts have the following meaning:
3812
3813@example
3814width @r{An integer specifying the width of the column in characters.}
3815 @r{If omitted, the width will be determined automatically.}
3816property @r{The property that should be edited in this column.}
3817(title) @r{The header text for the column. If omitted, the}
3818 @r{property name is used.}
3819@{summary-type@} @r{The summary type. If specified, the column values for}
3820 @r{parent nodes are computed from the children.}
3821 @r{Supported summary types are:}
dbc28aaa
CD
3822 @{+@} @r{Sum numbers in this column.}
3823 @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.}
3824 @{$@} @r{Currency, short for @samp{+;%.2f}.}
3825 @{:@} @r{Sum times, HH:MM:SS, plain numbers are hours.}
3826 @{X@} @r{Checkbox status, [X] if all children are [X].}
28a16a1b
CD
3827 @{X/@} @r{Checkbox status, [n/m].}
3828 @{X%@} @r{Checkbox status, [n%].}
4009494e
GM
3829@end example
3830
3831@noindent
3832Here is an example for a complete columns definition, along with allowed
3833values.
3834
3835@example
dbc28aaa
CD
3836: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.}
3837 %10Time_Estimate@{:@} %CLOCKSUM
4009494e
GM
3838:Owner_ALL: Tammy Mark Karl Lisa Don
3839:Status_ALL: "In progress" "Not started yet" "Finished" ""
3840:Approved_ALL: "[ ]" "[X]"
3841@end example
3842
3843The first column, @samp{%25ITEM}, means the first 25 characters of the
3844item itself, i.e. of the headline. You probably always should start the
28a16a1b
CD
3845column definition with the @samp{ITEM} specifier. The other specifiers
3846create columns @samp{Owner} with a list of names as allowed values, for
4009494e
GM
3847@samp{Status} with four different possible values, and for a checkbox
3848field @samp{Approved}. When no width is given after the @samp{%}
3849character, the column will be exactly as wide as it needs to be in order
3850to fully display all values. The @samp{Approved} column does have a
3851modified title (@samp{Approved?}, with a question mark). Summaries will
dbc28aaa 3852be created for the @samp{Time_Estimate} column by adding time duration
4009494e 3853expressions like HH:MM, and for the @samp{Approved} column, by providing
dbc28aaa
CD
3854an @samp{[X]} status if all children have been checked. The
3855@samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
3856in the subtree.
4009494e 3857
a7808fba
CD
3858@node Using column view, Capturing column view, Defining columns, Column view
3859@subsection Using column view
4009494e
GM
3860
3861@table @kbd
3862@tsubheading{Turning column view on and off}
3863@kindex C-c C-x C-c
3864@item C-c C-x C-c
3865Create the column view for the local environment. This command searches
dbc28aaa 3866the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
4009494e 3867a format. When one is found, the column view table is established for
dbc28aaa 3868the entire tree, starting from the entry that contains the @code{:COLUMNS:}
4009494e
GM
3869property. If none is found, the format is taken from the @code{#+COLUMNS}
3870line or from the variable @code{org-columns-default-format}, and column
3871view is established for the current entry and its subtree.
28a16a1b
CD
3872@kindex r
3873@item r
a7808fba 3874Recreate the column view, to include recent changes made in the buffer.
28a16a1b
CD
3875@kindex g
3876@item g
3877Same as @kbd{r}.
4009494e
GM
3878@kindex q
3879@item q
3880Exit column view.
3881@tsubheading{Editing values}
3882@item @key{left} @key{right} @key{up} @key{down}
3883Move through the column view from field to field.
3884@kindex S-@key{left}
3885@kindex S-@key{right}
3886@item S-@key{left}/@key{right}
3887Switch to the next/previous allowed value of the field. For this, you
3888have to have specified allowed values for a property.
3889@kindex n
3890@kindex p
3891@itemx n / p
3892Same as @kbd{S-@key{left}/@key{right}}
3893@kindex e
3894@item e
3895Edit the property at point. For the special properties, this will
3896invoke the same interface that you normally use to change that
3897property. For example, when editing a TAGS property, the tag completion
3898or fast selection interface will pop up.
dbc28aaa
CD
3899@kindex C-c C-c
3900@item C-c C-c
3901When there is a checkbox at point, toggle it.
4009494e
GM
3902@kindex v
3903@item v
3904View the full value of this property. This is useful if the width of
3905the column is smaller than that of the value.
3906@kindex a
3907@item a
3908Edit the list of allowed values for this property. If the list is found
3909in the hierarchy, the modified values is stored there. If no list is
3910found, the new value is stored in the first entry that is part of the
3911current column view.
3912@tsubheading{Modifying the table structure}
3913@kindex <
3914@kindex >
3915@item < / >
3916Make the column narrower/wider by one character.
3917@kindex S-M-@key{right}
3918@item S-M-@key{right}
3919Insert a new column, to the right of the current column.
3920@kindex S-M-@key{left}
3921@item S-M-@key{left}
3922Delete the current column.
3923@end table
3924
a7808fba
CD
3925@node Capturing column view, , Using column view, Column view
3926@subsection Capturing column view
dbc28aaa
CD
3927
3928Since column view is just an overlay over a buffer, it cannot be
3929exported or printed directly. If you want to capture a column view, use
a7808fba 3930this @code{columnview} dynamic block (@pxref{Dynamic blocks}). The frame
28a16a1b 3931of this block looks like this:
dbc28aaa
CD
3932
3933@example
3934* The column view
3935#+BEGIN: columnview :hlines 1 :id "label"
3936
3937#+END:
3938@end example
3939
3940@noindent This dynamic block has the following parameters:
3941
3942@table @code
3943@item :id
3944This is most important parameter. Column view is a feature that is
3945often localized to a certain (sub)tree, and the capture block might be
3946in a different location in the file. To identify the tree whose view to
3947capture, you can use 3 values:
3948@example
3949local @r{use the tree in which the capture block is located}
3950global @r{make a global view, including all headings in the file}
3951"label" @r{call column view in the tree that has and @code{:ID:}}
3952 @r{property with the value @i{label}}
3953@end example
3954@item :hlines
3955When @code{t}, insert a hline after every line. When a number N, insert
3956a hline before each headline with level @code{<= N}.
3957@item :vlines
3958When set to @code{t}, enforce column groups to get vertical lines.
28a16a1b
CD
3959@item :maxlevel
3960When set to a number, don't capture entries below this level.
3961@item :skip-empty-rows
3962When set to @code{t}, skip row where the only non-empty specifier of the
3963column view is @code{ITEM}.
3964
dbc28aaa
CD
3965@end table
3966
3967@noindent
3968The following commands insert or update the dynamic block:
3969
3970@table @kbd
3971@kindex C-c C-x r
3972@item C-c C-x r
3973Insert a dynamic block capturing a column view. You will be prompted
3974for the scope or id of the view.
3975@kindex C-c C-c
3976@item C-c C-c
3977@kindex C-c C-x C-u
3978@itemx C-c C-x C-u
3979Update dynamical block at point. The cursor needs to be in the
3980@code{#+BEGIN} line of the dynamic block.
3981@kindex C-u C-c C-x C-u
3982@item C-u C-c C-x C-u
3983Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
a7808fba 3984you have several clock table blocks in a buffer.
dbc28aaa
CD
3985@end table
3986
a7808fba 3987@node Property API, , Column view, Properties and Columns
4009494e
GM
3988@section The Property API
3989@cindex properties, API
3990@cindex API, for properties
3991
3992There is a full API for accessing and changing properties. This API can
3993be used by Emacs Lisp programs to work with properties and to implement
3994features based on them. For more information see @ref{Using the
3995property API}.
3996
a7808fba 3997@node Dates and Times, Remember, Properties and Columns, Top
dbc28aaa
CD
3998@chapter Dates and Times
3999@cindex dates
4000@cindex times
4009494e
GM
4001@cindex time stamps
4002@cindex date stamps
4003
dbc28aaa
CD
4004To assist project planning, TODO items can be labeled with a date and/or
4005a time. The specially formatted string carrying the date and time
a7808fba 4006information is called a @emph{timestamp} in Org mode. This may be a
dbc28aaa 4007little confusing because timestamp is often used as indicating when
a7808fba 4008something was created or last changed. However, in Org mode this term
dbc28aaa 4009is used in a much wider sense.
4009494e
GM
4010
4011@menu
a7808fba 4012* Timestamps:: Assigning a time to a tree entry
4009494e
GM
4013* Creating timestamps:: Commands which insert timestamps
4014* Deadlines and scheduling:: Planning your work
a7808fba
CD
4015* Clocking work time:: Tracking how long you spend on a task
4016* Effort estimates:: Planning work effort in advance
4009494e
GM
4017@end menu
4018
4019
a7808fba
CD
4020@node Timestamps, Creating timestamps, Dates and Times, Dates and Times
4021@section Timestamps, deadlines and scheduling
4009494e
GM
4022@cindex time stamps
4023@cindex ranges, time
4024@cindex date stamps
4025@cindex deadlines
4026@cindex scheduling
4027
4028A time stamp is a specification of a date (possibly with time or a range
4029of times) in a special format, either @samp{<2003-09-16 Tue>} or
4030@samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
dbc28aaa
CD
403112:00-12:30>}@footnote{This is the standard ISO date/time format. To
4032use an alternative format, see @ref{Custom time format}.}. A time stamp
a7808fba 4033can appear anywhere in the headline or body of an Org tree entry. Its
dbc28aaa 4034presence causes entries to be shown on specific dates in the agenda
a7808fba 4035(@pxref{Weekly/daily agenda}). We distinguish:
4009494e
GM
4036
4037@table @var
dbc28aaa 4038@item Plain time stamp; Event; Appointment
4009494e
GM
4039@cindex timestamp
4040A simple time stamp just assigns a date/time to an item. This is just
dbc28aaa
CD
4041like writing down an appointment or event in a paper agenda. In the
4042timeline and agenda displays, the headline of an entry associated with a
4043plain time stamp will be shown exactly on that date.
4009494e
GM
4044
4045@example
4046* Meet Peter at the movies <2006-11-01 Wed 19:15>
4047* Discussion on climate change <2006-11-02 Thu 20:00-22:00>
4048@end example
4049
4050@item Time stamp with repeater interval
4051@cindex timestamp, with repeater interval
4052A time stamp may contain a @emph{repeater interval}, indicating that it
4053applies not only on the given date, but again and again after a certain
4054interval of N days (d), weeks (w), months(m), or years(y). The
4055following will show up in the agenda every Wednesday:
4056
4057@example
4058* Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
4059@end example
4060
4061@item Diary-style sexp entries
a7808fba 4062For more complex date specifications, Org mode supports using the
4009494e
GM
4063special sexp diary entries implemented in the Emacs calendar/diary
4064package. For example
4065
4066@example
4067* The nerd meeting on every 2nd Thursday of the month
4068 <%%(diary-float t 4 2)>
4069@end example
4070
4071@item Time/Date range
4072@cindex timerange
4073@cindex date range
4074Two time stamps connected by @samp{--} denote a range. The headline
4075will be shown on the first and last day of the range, and on any dates
4076that are displayed and fall in the range. Here is an example:
4077
4078@example
4079** Meeting in Amsterdam
4080 <2004-08-23 Mon>--<2004-08-26 Thu>
4081@end example
4082
4083@item Inactive time stamp
4084@cindex timestamp, inactive
4085@cindex inactive timestamp
4086Just like a plain time stamp, but with square brackets instead of
4087angular ones. These time stamps are inactive in the sense that they do
4088@emph{not} trigger an entry to show up in the agenda.
4089
4090@example
4091* Gillian comes late for the fifth time [2006-11-01 Wed]
4092@end example
4093
4094@end table
4095
a7808fba 4096@node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
4009494e
GM
4097@section Creating timestamps
4098@cindex creating timestamps
4099@cindex timestamps, creating
4100
a7808fba 4101For Org mode to recognize time stamps, they need to be in the specific
4009494e
GM
4102format. All commands listed below produce time stamps in the correct
4103format.
4104
4105@table @kbd
4106@kindex C-c .
4107@item C-c .
4108Prompt for a date and insert a corresponding time stamp. When the
4109cursor is at a previously used time stamp, it is updated to NOW. When
4110this command is used twice in succession, a time range is inserted.
4111@c
4112@kindex C-u C-c .
4113@item C-u C-c .
4114Like @kbd{C-c .}, but use the alternative format which contains date
4115and time. The default time can be rounded to multiples of 5 minutes,
4116see the option @code{org-time-stamp-rounding-minutes}.
4117@c
4118@kindex C-c !
4119@item C-c !
4120Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
4121an agenda entry.
4122@c
4123@kindex C-c <
4124@item C-c <
4125Insert a time stamp corresponding to the cursor date in the Calendar.
4126@c
4127@kindex C-c >
4128@item C-c >
4129Access the Emacs calendar for the current date. If there is a
a7808fba 4130timestamp in the current line, go to the corresponding date
4009494e
GM
4131instead.
4132@c
4133@kindex C-c C-o
4134@item C-c C-o
4135Access the agenda for the date given by the time stamp or -range at
a7808fba 4136point (@pxref{Weekly/daily agenda}).
4009494e
GM
4137@c
4138@kindex S-@key{left}
4139@kindex S-@key{right}
4140@item S-@key{left}
4141@itemx S-@key{right}
4142Change date at cursor by one day. These key bindings conflict with
a7808fba 4143CUA mode (@pxref{Conflicts}).
4009494e
GM
4144@c
4145@kindex S-@key{up}
4146@kindex S-@key{down}
4147@item S-@key{up}
4148@itemx S-@key{down}
4149Change the item under the cursor in a timestamp. The cursor can be on a
4150year, month, day, hour or minute. Note that if the cursor is in a
4151headline and not at a time stamp, these same keys modify the priority of
4152an item. (@pxref{Priorities}). The key bindings also conflict with
a7808fba 4153CUA mode (@pxref{Conflicts}).
4009494e
GM
4154@c
4155@kindex C-c C-y
4156@cindex evaluate time range
4157@item C-c C-y
a7808fba
CD
4158Evaluate a time range by computing the difference between start and end.
4159With a prefix argument, insert result after the time range (in a table: into
4160the following column).
4009494e
GM
4161@end table
4162
4163
4164@menu
a7808fba
CD
4165* The date/time prompt:: How Org mode helps you entering date and time
4166* Custom time format:: Making dates look different
4009494e
GM
4167@end menu
4168
4169@node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
4170@subsection The date/time prompt
4171@cindex date, reading in minibuffer
4172@cindex time, reading in minibuffer
4173
a7808fba 4174When Org mode prompts for a date/time, the default is shown as an ISO
dbc28aaa
CD
4175date, and the prompt therefore seems to ask for an ISO date. But it
4176will in fact accept any string containing some date and/or time
4177information, and it is really smart about interpreting your input. You
4178can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
a7808fba 4179copied from an email message. Org mode will find whatever information
dbc28aaa
CD
4180is in there and derive anything you have not specified from the
4181@emph{default date and time}. The default is usually the current date
4182and time, but when modifying an existing time stamp, or when entering
4183the second stamp of a range, it is taken from the stamp in the buffer.
a7808fba 4184When filling in information, Org mode assumes that most of the time you
dbc28aaa
CD
4185will want to enter a date in the future: If you omit the month/year and
4186the given day/month is @i{before} today, it will assume that you mean a
4187future date@footnote{See the variable
4188@code{org-read-date-prefer-future}.}.
4189
4190For example, lets assume that today is @b{June 13, 2006}. Here is how
a7808fba 4191various inputs will be interpreted, the items filled in by Org mode are
dbc28aaa
CD
4192in @b{bold}.
4193
4194@example
41953-2-5 --> 2003-02-05
419614 --> @b{2006}-@b{06}-14
419712 --> @b{2006}-@b{07}-12
4198Fri --> nearest Friday (defaultdate or later)
4199sep 15 --> @b{2006}-11-15
4200feb 15 --> @b{2007}-02-15
4201sep 12 9 --> 2009-09-12
420212:45 --> @b{2006}-@b{06}-@b{13} 12:45
420322 sept 0:34 --> @b{2006}-09-22 0:34
a7808fba
CD
4204w4 --> ISO week for of the current year @b{2006}
42052012 w4 fri --> Friday of ISO week 4 in 2012
42062012-w04-5 --> Same as above
dbc28aaa
CD
4207@end example
4208
4209Furthermore you can specify a relative date by giving, as the
4210@emph{first} thing in the input: a plus/minus sign, a number and a
4211letter [dwmy] to indicate change in days weeks, months, years. With a
4212single plus or minus, the date is always relative to today. With a
4213double plus or minus, it is relative to the default date. If instead of
4214a single letter, you use the abbreviation of day name, the date will be
4215the nth such day. E.g.
4216
4217@example
4218+4d --> four days from today
4219+4 --> same as above
4220+2w --> two weeks from today
4221++5 --> five days from default date
4222+2tue --> second tuesday from now.
4009494e
GM
4223@end example
4224
4225The function understands English month and weekday abbreviations. If
4226you want to use unabbreviated names and/or other languages, configure
4227the variables @code{parse-time-months} and @code{parse-time-weekdays}.
4228
4229@cindex calendar, for selecting date
4230Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
4231you don't need/want the calendar, configure the variable
4232@code{org-popup-calendar-for-date-prompt}.}. When you exit the date
4233prompt, either by clicking on a date in the calendar, or by pressing
4234@key{RET}, the date selected in the calendar will be combined with the
4235information entered at the prompt. You can control the calendar fully
4236from the minibuffer:
4237
4009494e 4238@kindex <
4009494e 4239@kindex >
4009494e 4240@kindex mouse-1
4009494e 4241@kindex S-@key{right}
4009494e 4242@kindex S-@key{left}
4009494e 4243@kindex S-@key{down}
4009494e 4244@kindex S-@key{up}
4009494e 4245@kindex M-S-@key{right}
4009494e 4246@kindex M-S-@key{left}
4009494e 4247@kindex @key{RET}
dbc28aaa
CD
4248@example
4249> / < @r{Scroll calendar forward/backward by one month.}
4250mouse-1 @r{Select date by clicking on it.}
4251S-@key{right}/@key{left} @r{One day forward/backward.}
4252S-@key{down}/@key{up} @r{One week forward/backward.}
4253M-S-@key{right}/@key{left} @r{One month forward/backward.}
4254@key{RET} @r{Choose date in calendar.}
4255@end example
4256
a7808fba
CD
4257The actions of the date/time prompt may seem complex, but I assure you they
4258will grow on you, and you will start getting annoyed by pretty much any other
4259way of entering a date/time out there. To help you understand what is going
4260on, the current interpretation of your input will be displayed live in the
4261minibuffer@footnote{If you find this distracting, turn the display of with
4262@code{org-read-date-display-live}.}.
4009494e
GM
4263
4264@node Custom time format, , The date/time prompt, Creating timestamps
4265@subsection Custom time format
4266@cindex custom date/time format
4267@cindex time format, custom
4268@cindex date format, custom
4269
a7808fba 4270Org mode uses the standard ISO notation for dates and times as it is
4009494e
GM
4271defined in ISO 8601. If you cannot get used to this and require another
4272representation of date and time to keep you happy, you can get it by
4273customizing the variables @code{org-display-custom-times} and
4274@code{org-time-stamp-custom-formats}.
4275
4276@table @kbd
4277@kindex C-c C-x C-t
4278@item C-c C-x C-t
4279Toggle the display of custom formats for dates and times.
4280@end table
4281
4282@noindent
a7808fba 4283Org mode needs the default format for scanning, so the custom date/time
4009494e
GM
4284format does not @emph{replace} the default format - instead it is put
4285@emph{over} the default format using text properties. This has the
4286following consequences:
4287@itemize @bullet
28a16a1b 4288@item
4009494e
GM
4289You cannot place the cursor onto a time stamp anymore, only before or
4290after.
4291@item
4292The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
4293each component of a time stamp. If the cursor is at the beginning of
4294the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
4295just like @kbd{S-@key{left}/@key{right}}. At the end of the stamp, the
4296time will be changed by one minute.
4297@item
4298If the time stamp contains a range of clock times or a repeater, these
4299will not be overlayed, but remain in the buffer as they were.
4300@item
4301When you delete a time stamp character-by-character, it will only
4302disappear from the buffer after @emph{all} (invisible) characters
4303belonging to the ISO timestamp have been removed.
4304@item
4305If the custom time stamp format is longer than the default and you are
4306using dates in tables, table alignment will be messed up. If the custom
4307format is shorter, things do work as expected.
4308@end itemize
4309
4310
a7808fba
CD
4311@node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
4312@section Deadlines and scheduling
4009494e 4313
dbc28aaa 4314A time stamp may be preceded by special keywords to facilitate planning:
4009494e
GM
4315
4316@table @var
4317@item DEADLINE
4318@cindex DEADLINE keyword
dbc28aaa
CD
4319
4320Meaning: the task (most likely a TODO item, though not necessarily) is supposed
4321to be finished on that date.
4322
4323On the deadline date, the task will be listed in the agenda. In
4324addition, the agenda for @emph{today} will carry a warning about the
4325approaching or missed deadline, starting
4326@code{org-deadline-warning-days} before the due date, and continuing
4327until the entry is marked DONE. An example:
4009494e
GM
4328
4329@example
4330*** TODO write article about the Earth for the Guide
4331 The editor in charge is [[bbdb:Ford Prefect]]
4332 DEADLINE: <2004-02-29 Sun>
4333@end example
4334
4335You can specify a different lead time for warnings for a specific
4336deadlines using the following syntax. Here is an example with a warning
4337period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
4338
4339@item SCHEDULED
4340@cindex SCHEDULED keyword
dbc28aaa
CD
4341
4342Meaning: you are planning to start working on that task on the given
4343date.
4344
4345The headline will be listed under the given date@footnote{It will still
4346be listed on that date after it has been marked DONE. If you don't like
4009494e
GM
4347this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In
4348addition, a reminder that the scheduled date has passed will be present
4349in the compilation for @emph{today}, until the entry is marked DONE.
4350I.e., the task will automatically be forwarded until completed.
4351
4352@example
4353*** TODO Call Trillian for a date on New Years Eve.
4354 SCHEDULED: <2004-12-25 Sat>
4355@end example
dbc28aaa
CD
4356
4357@noindent
a7808fba 4358@b{Important:} Scheduling an item in Org mode should @i{not} be
dbc28aaa
CD
4359understood in the same way that we understand @i{scheduling a meeting}.
4360Setting a date for a meeting is just a simple appointment, you should
4361mark this entry with a simple plain time stamp, to get this item shown
4362on the date where it applies. This is a frequent mis-understanding from
a7808fba 4363Org-users. In Org mode, @i{scheduling} means setting a date when you
dbc28aaa 4364want to start working on an action item.
4009494e
GM
4365@end table
4366
dbc28aaa 4367You may use time stamps with repeaters in scheduling and deadline
a7808fba 4368entries. Org mode will issue early and late warnings based on the
dbc28aaa
CD
4369assumption that the time stamp represents the @i{nearest instance} of
4370the repeater. However, the use of diary sexp entries like
4371@c
4372@code{<%%(diary-float t 42)>}
4373@c
a7808fba 4374in scheduling and deadline timestamps is limited. Org mode does not
dbc28aaa
CD
4375know enough about the internals of each sexp function to issue early and
4376late warnings. However, it will show the item on each day where the
4377sexp entry matches.
4378
4009494e
GM
4379@menu
4380* Inserting deadline/schedule:: Planning items
4381* Repeated tasks:: Items that show up again and again
4382@end menu
4383
4384@node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
a7808fba 4385@subsection Inserting deadlines or schedules
4009494e
GM
4386
4387The following commands allow to quickly insert a deadline or to schedule
4388an item:
4389
4390@table @kbd
4391@c
4392@kindex C-c C-d
4393@item C-c C-d
4394Insert @samp{DEADLINE} keyword along with a stamp. The insertion will
dbc28aaa
CD
4395happen in the line directly following the headline. When called with a
4396prefix arg, an existing deadline will be removed from the entry.
4009494e
GM
4397@c FIXME Any CLOSED timestamp will be removed.????????
4398@c
dbc28aaa 4399@kindex C-c / d
4009494e 4400@cindex sparse tree, for deadlines
dbc28aaa 4401@item C-c / d
4009494e
GM
4402Create a sparse tree with all deadlines that are either past-due, or
4403which will become due within @code{org-deadline-warning-days}.
4404With @kbd{C-u} prefix, show all deadlines in the file. With a numeric
dbc28aaa 4405prefix, check that many days. For example, @kbd{C-1 C-c / d} shows
4009494e
GM
4406all deadlines due tomorrow.
4407@c
4408@kindex C-c C-s
4409@item C-c C-s
4410Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will
4411happen in the line directly following the headline. Any CLOSED
dbc28aaa
CD
4412timestamp will be removed. When called with a prefix argument, remove
4413the scheduling date from the entry.
4009494e
GM
4414@end table
4415
4416@node Repeated tasks, , Inserting deadline/schedule, Deadlines and scheduling
a7808fba 4417@subsection Repeated tasks
4009494e 4418
a7808fba 4419Some tasks need to be repeated again and again. Org mode helps to
28a16a1b
CD
4420organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
4421or plain time stamp. In the following example
4009494e
GM
4422@example
4423** TODO Pay the rent
4424 DEADLINE: <2005-10-01 Sat +1m>
4425@end example
dbc28aaa
CD
4426the @code{+1m} is a repeater; the intended interpretation is that the
4427task has a deadline on <2005-10-01> and repeats itself every (one) month
28a16a1b
CD
4428starting from that time. If you need both a repeater and a special
4429warning period in a deadline entry, the repeater comes first and the
4430warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
4009494e
GM
4431
4432Deadlines and scheduled items produce entries in the agenda when they
4433are over-due, so it is important to be able to mark such an entry as
4434completed once you have done so. When you mark a DEADLINE or a SCHEDULE
a7808fba 4435with the TODO keyword DONE, it will no longer produce entries in the
28a16a1b 4436agenda. The problem with this is, however, that then also the
a7808fba 4437@emph{next} instance of the repeated entry will not be active. Org mode
4009494e
GM
4438deals with this in the following way: When you try to mark such an entry
4439DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
4440time stamp by the repeater interval, and immediately set the entry state
4441back to TODO. In the example above, setting the state to DONE would
4442actually switch the date like this:
4443
4444@example
4445** TODO Pay the rent
4446 DEADLINE: <2005-11-01 Tue +1m>
4447@end example
4448
a7808fba
CD
4449A timestamp@footnote{You can change this using the option
4450@code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
4451@code{lognoterepeat}, and @code{nologrepeat}. With @code{lognoterepeat}, you
4452will aslo be prompted for a note.} will be added under the deadline, to keep
4453a record that you actually acted on the previous instance of this deadline.
4009494e
GM
4454
4455As a consequence of shifting the base date, this entry will no longer be
4456visible in the agenda when checking past dates, but all future instances
4457will be visible.
4458
28a16a1b
CD
4459With the @samp{+1m} cookie, the date shift will always be exactly one
4460month. So if you have not payed the rent for three months, marking this
4461entry DONE will still keep it as an overdue deadline. Depending on the
4462task, this may not be the best way to handle it. For example, if you
4463forgot to call you father for 3 weeks, it does not make sense to call
a7808fba 4464him 3 times in a single day to make up for it. Finally, there are tasks
28a16a1b 4465like changing batteries which should always repeat a certain time
a7808fba
CD
4466@i{after} the last time you did it. For these tasks, Org mode has
4467special repeaters markers with @samp{++} and @samp{.+}. For example:
28a16a1b
CD
4468
4469@example
4470** TODO Call Father
4471 DEADLINE: <2008-02-10 Sun ++1w>
4472 Marking this DONE will shift the date by at least one week,
4473 but also by as many weeks as it takes to get this date into
4474 the future. However, it stays on a Sunday, even if you called
4475 and marked it done on Saturday.
4476** TODO Check the batteries in the smoke detectors
4477 DEADLINE: <2005-11-01 Tue .+1m>
4478 Marking this DONE will shift the date to one month after
4479 today.
4480@end example
4481
4009494e
GM
4482You may have both scheduling and deadline information for a specific
4483task - just make sure that the repeater intervals on both are the same.
4484
a7808fba 4485@node Clocking work time, Effort estimates, Deadlines and scheduling, Dates and Times
dbc28aaa 4486@section Clocking work time
4009494e 4487
a7808fba 4488Org mode allows you to clock the time you spent on specific tasks in a
4009494e
GM
4489project. When you start working on an item, you can start the clock.
4490When you stop working on that task, or when you mark the task done, the
4491clock is stopped and the corresponding time interval is recorded. It
4492also computes the total time spent on each subtree of a project.
4493
4494@table @kbd
4495@kindex C-c C-x C-i
4496@item C-c C-x C-i
4497Start the clock on the current item (clock-in). This inserts the CLOCK
dbc28aaa
CD
4498keyword together with a timestamp. If this is not the first clocking of
4499this item, the multiple CLOCK lines will be wrapped into a
4500@code{:CLOCK:} drawer (see also the variable
a7808fba
CD
4501@code{org-clock-into-drawer}). When called with a @kbd{C-u} prefix argument,
4502select the task from a list of recently clocked tasks. With two @kbd{C-u
4503C-u} prefixes, clock into the task at point and mark it as the default task.
4504The default task will always be available when selecting a clocking task,
4505with letter @kbd{d}.
4009494e
GM
4506@kindex C-c C-x C-o
4507@item C-c C-x C-o
4508Stop the clock (clock-out). The inserts another timestamp at the same
4509location where the clock was last started. It also directly computes
4510the resulting time in inserts it after the time range as @samp{=>
28a16a1b
CD
4511HH:MM}. See the variable @code{org-log-note-clock-out} for the
4512possibility to record an additional note together with the clock-out
4513time stamp@footnote{The corresponding in-buffer setting is:
4514@code{#+STARTUP: lognoteclock-out}}.
4009494e
GM
4515@kindex C-c C-y
4516@item C-c C-y
4517Recompute the time interval after changing one of the time stamps. This
4518is only necessary if you edit the time stamps directly. If you change
4519them with @kbd{S-@key{cursor}} keys, the update is automatic.
4520@kindex C-c C-t
4521@item C-c C-t
4522Changing the TODO state of an item to DONE automatically stops the clock
4523if it is running in this same item.
4524@kindex C-c C-x C-x
4525@item C-c C-x C-x
4526Cancel the current clock. This is useful if a clock was started by
4527mistake, or if you ended up working on something else.
dbc28aaa
CD
4528@kindex C-c C-x C-j
4529@item C-c C-x C-j
a7808fba
CD
4530Jump to the entry that contains the currently running clock. With a
4531@kbd{C-u} prefix arg, select the target task from a list of recently clocked
4532tasks.
4009494e
GM
4533@kindex C-c C-x C-d
4534@item C-c C-x C-d
4535Display time summaries for each subtree in the current buffer. This
4536puts overlays at the end of each headline, showing the total time
4537recorded under that heading, including the time of any subheadings. You
4538can use visibility cycling to study the tree, but the overlays disappear
4539when you change the buffer (see variable
4540@code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
4541@kindex C-c C-x C-r
4542@item C-c C-x C-r
4543Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
a7808fba 4544report as an Org mode table into the current file. When the cursor is
dbc28aaa
CD
4545at an existing clock table, just update it. When called with a prefix
4546argument, jump to the first clock report in the current document and
4547update it.
4009494e 4548@example
dbc28aaa 4549#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
4009494e
GM
4550#+END: clocktable
4551@end example
4552@noindent
dbc28aaa
CD
4553If such a block already exists at point, its content is replaced by the
4554new table. The @samp{BEGIN} line can specify options:
4009494e 4555@example
dbc28aaa 4556:maxlevel @r{Maximum level depth to which times are listed in the table.}
4009494e 4557:emphasize @r{When @code{t}, emphasize level one and level two items}
dbc28aaa
CD
4558:scope @r{The scope to consider. This can be any of the following:}
4559 nil @r{the current buffer or narrowed region}
4560 file @r{the full current buffer}
4561 subtree @r{the subtree where the clocktable is located}
4562 treeN @r{the surrounding level N tree, for example @code{tree3}}
4563 tree @r{the surrounding level 1 tree}
4564 agenda @r{all agenda files}
4565 ("file"..) @r{scan these files}
a7808fba
CD
4566 file-with-archives @r{current file and its archives}
4567 agenda-with-archives @r{all agenda files, including archives}
4568:block @r{The time block to consider. This block is specified either}
4569 @r{absolute, or relative to the current time and may be any of}
4570 @r{these formats:}
4571 2007-12-31 @r{New year eve 2007}
4572 2007-12 @r{December 2007}
4573 2007-W50 @r{ISO-week 50 in 2007}
4574 2007 @r{the year 2007}
4575 today, yesterday, today-N @r{a relative day}
4576 thisweek, lastweek, thisweek-N @r{a relative week}
4577 thismonth, lastmonth, thismonth-N @r{a relative month}
4578 thisyear, lastyear, thisyear-N @r{a relative year}
4579 @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
4009494e
GM
4580:tstart @r{A time string specifying when to start considering times}
4581:tend @r{A time string specifying when to stop considering times}
a7808fba
CD
4582:step @r{@code{week} or @code{day}, to split the table into chunks.}
4583 @r{To use this, @code{:block} or @code{:tstart}, @code{:tend} are needed.}
28a16a1b 4584:link @r{Link the item headlines in the table to their origins}
4009494e 4585@end example
dbc28aaa
CD
4586So to get a clock summary of the current level 1 tree, for the current
4587day, you could write
4009494e 4588@example
a7808fba 4589#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
4009494e
GM
4590#+END: clocktable
4591@end example
4592and to use a specific time range you could write@footnote{Note that all
4593parameters must be specified in a single line - the line is broken here
4594only to fit it onto the manual.}
4595@example
28a16a1b 4596#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
4009494e 4597 :tend "<2006-08-10 Thu 12:00>"
4009494e
GM
4598#+END: clocktable
4599@end example
dbc28aaa
CD
4600@kindex C-c C-c
4601@item C-c C-c
4602@kindex C-c C-x C-u
4603@itemx C-c C-x C-u
4604Update dynamical block at point. The cursor needs to be in the
4605@code{#+BEGIN} line of the dynamic block.
4009494e
GM
4606@kindex C-u C-c C-x C-u
4607@item C-u C-c C-x C-u
4608Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
a7808fba
CD
4609you have several clock table blocks in a buffer.
4610@kindex S-@key{left}
4611@kindex S-@key{right}
4612@item S-@key{left}
4613@itemx S-@key{right}
4614Shift the current @code{:block} interval and update the table. The cursor
4615needs to be in the @code{#+BEGIN: clocktable} line for this command. If
4616@code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
4009494e
GM
4617@end table
4618
4619The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
a7808fba 4620the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
4009494e
GM
4621worked on or closed during a day.
4622
a7808fba
CD
4623@node Effort estimates
4624@section Effort estimates
4625@cindex Effort estimates
4626
4627If you want to plan your work in a very detailed way, or if you need to
4628produce offers with quotations of the estimated work effort, you may want to
4629assign effort estimates to entries. If you are also clocking your work, you
4630may later want to compare the planned effort with the actual working time, a
4631great way to improve planning estimates. Effort estimates are stored in a
4632special property @samp{Effort}@footnote{You may change the property being
4633used with the variable @code{org-effort-property}.}. Clearly the best way to
4634work with effort estimates is through column view (@pxref{Column view}). You
4635should start by setting up discrete values for effort estimates, and a
4636@code{COLUMNS} format that displays these values together with clock sums (if
4637you want to clock your time). For a specific buffer you can use
4638
4639@example
4640#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00
4641#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
4642@end example
4643
4644@noindent
4645or you can set up these values globally by customizing the variables
4646@code{org-global-properties} and @code{org-columns-default-format}. In
4647particular if you want to use this setup also in the agenda, a global setup
4648may be advised.
4649
4650The way to assign estimates to individual items is then to switch to column
4651mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the
4652value. The values you enter will immediately be summed up in the hierarchy.
4653In the column next to it, any clocked time will be displayed.
4654
4655If you switch to column view in the daily/weekly agenda, the effort column
4656will summarize the estimated work effort for each day@footnote{Please note
4657the pitfalls of summing hierarchical data in a flat list (@pxref{Agenda
4658column view}.}, and you can use this to find space in your schedule. To get
4659an overview of the entire part of the day that is committed, you can set the
4660option @code{org-agenda-columns-add-appointments-to-effort-sum}. The
4661appointments on a day that take place over a specified time interval will
4662then also be added to the load estimate of the day.
4663
4664@node Remember, Agenda Views, Dates and Times, Top
dbc28aaa
CD
4665@chapter Remember
4666@cindex @file{remember.el}
4667
4668The @i{Remember} package by John Wiegley lets you store quick notes with
4669little interruption of your work flow. See
4670@uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
4671information. It is an excellent way to add new notes and tasks to
a7808fba 4672Org files. Org significantly expands the possibilities of
dbc28aaa
CD
4673@i{remember}: You may define templates for different note types, and
4674associate target files and headlines with specific templates. It also
4675allows you to select the location where a note should be stored
4676interactively, on the fly.
4677
4678@menu
a7808fba 4679* Setting up Remember:: Some code for .emacs to get things going
dbc28aaa
CD
4680* Remember templates:: Define the outline of different note types
4681* Storing notes:: Directly get the note to where it belongs
4682* Refiling notes:: Moving a note or task to a project
4683@end menu
4684
a7808fba
CD
4685@node Setting up Remember, Remember templates, Remember, Remember
4686@section Setting up Remember
dbc28aaa
CD
4687
4688The following customization will tell @i{remember} to use org files as
a7808fba 4689target, and to create annotations compatible with Org links.
dbc28aaa
CD
4690
4691@example
4692(org-remember-insinuate)
4693(setq org-directory "~/path/to/my/orgfiles/")
4694(setq org-default-notes-file (concat org-directory "/notes.org"))
4695(define-key global-map "\C-cr" 'org-remember)
4696@end example
4697
4698The last line binds the command @code{org-remember} to a global
4699key@footnote{Please select your own key, @kbd{C-c r} is only a
4700suggestion.}. @code{org-remember} basically just calls @code{remember},
4701but it makes a few things easier: If there is an active region, it will
4702automatically copy the region into the remember buffer. It also allows
4703to jump to the buffer and location where remember notes are being
28a16a1b 4704stored: Just call @code{org-remember} with a prefix argument. If you
a7808fba 4705use two prefix arguments, Org jumps to the location where the last
28a16a1b 4706remember note was stored.
dbc28aaa 4707
a7808fba 4708@node Remember templates, Storing notes, Setting up Remember, Remember
dbc28aaa
CD
4709@section Remember templates
4710@cindex templates, for remember
4711
a7808fba 4712In combination with Org, you can use templates to generate
dbc28aaa
CD
4713different types of @i{remember} notes. For example, if you would like
4714to use one template to create general TODO entries, another one for
4715journal entries, and a third one for collecting random ideas, you could
4716use:
4717
4718@example
4719(setq org-remember-templates
4720 '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks")
4721 ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
4722 ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
4723@end example
4724
4725@noindent In these entries, the first string is just a name, and the
4726character specifies how to select the template. It is useful if the
4727character is also the first letter of the name. The next string
4728specifies the template. Two more (optional) strings give the file in
4729which, and the headline under which the new note should be stored. The
4730file (if not present or @code{nil}) defaults to
4731@code{org-default-notes-file}, the heading to
a7808fba
CD
4732@code{org-remember-default-headline}. If the file name is not an
4733absolute path, it will be interpreted relative to @code{org-directory}.
dbc28aaa 4734
28a16a1b
CD
4735An optional sixth element specifies the contexts in which the user can
4736select the template. This element can be either a list of major modes
4737or a function. @code{org-remember} will first check whether the function
a7808fba 4738returns @code{t} or if we are in any of the listed major mode, and select
28a16a1b
CD
4739the template accordingly.
4740
4741So for example:
4742
4743@example
4744(setq org-remember-templates
4745 '(("Bug" ?b "* BUG %?\n %i\n %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
4746 ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" my-check)
4747 ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
4748@end example
4749
4750The first template will only be available when invoking @code{org-remember}
4751from an buffer in @code{emacs-lisp-mode}. The second template will only be
4752available when the function @code{my-check} returns @code{t}. The third
4753template will be proposed in any context.
4754
dbc28aaa
CD
4755When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember
4756something, org will prompt for a key to select the template (if you have
4757more than one template) and then prepare the buffer like
4758@example
4759* TODO
4760 [[file:link to where you called remember]]
4761@end example
4762
4763@noindent
4764During expansion of the template, special @kbd{%}-escapes allow dynamic
4765insertion of content:
4766@example
4767%^@{prompt@} @r{prompt the user for a string and replace this sequence with it.}
4768 @r{You may specify a default value and a completion table with}
4769 @r{%^@{prompt|default|completion2|completion3...@}}
4770 @r{The arrow keys access a prompt-specific history.}
4771%t @r{time stamp, date only}
4772%T @r{time stamp with date and time}
4773%u, %U @r{like the above, but inactive time stamps}
4774%^t @r{like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}}
4775 @r{You may define a prompt like @code{%^@{Birthday@}t}}
4776%n @r{user name (taken from @code{user-full-name})}
4777%a @r{annotation, normally the link created with @code{org-store-link}}
4778%A @r{like @code{%a}, but prompt for the description part}
4779%i @r{initial content, the region when remember is called with C-u.}
4780 @r{The entire text will be indented like @code{%i} itself.}
a7808fba
CD
4781%c @r{Current kill ring head.}
4782%x @r{Content of the X clipboard.}
4783%^C @r{Interactive selection of which kill or clip to use.}
4784%^L @r{Like @code{%^C}, but insert as link.}
dbc28aaa
CD
4785%^g @r{prompt for tags, with completion on tags in target file.}
4786%^G @r{prompt for tags, with completion all tags in all agenda files.}
4787%:keyword @r{specific information for certain link types, see below}
4788%[pathname] @r{insert the contents of the file given by @code{pathname}}
4789%(sexp) @r{evaluate elisp @code{(sexp)} and replace with the result}
4790%! @r{immediately store note after completing the template}
4791 @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
4792@end example
4793
4794@noindent
4795For specific link types, the following keywords will be
4796defined@footnote{If you define your own link types (@pxref{Adding
4797hyperlink types}), any property you store with
4798@code{org-store-link-props} can be accessed in remember templates in a
4799similar way.}:
4800
4801@example
4802Link type | Available keywords
4803-------------------+----------------------------------------------
4804bbdb | %:name %:company
28a16a1b 4805bbdb | %::server %:port %:nick
dbc28aaa
CD
4806vm, wl, mh, rmail | %:type %:subject %:message-id
4807 | %:from %:fromname %:fromaddress
4808 | %:to %:toname %:toaddress
28a16a1b 4809 | %: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
4810gnus | %:group, @r{for messages also all email fields}
4811w3, w3m | %:url
4812info | %:file %:node
4813calendar | %:date"
4814@end example
4815
4816@noindent
4817To place the cursor after template expansion use:
4818
4819@example
4820%? @r{After completing the template, position cursor here.}
4821@end example
4822
4823@noindent
28a16a1b 4824If you change your mind about which template to use, call
dbc28aaa
CD
4825@code{org-remember} in the remember buffer. You may then select a new
4826template that will be filled with the previous context information.
4827
4828@node Storing notes, Refiling notes, Remember templates, Remember
4829@section Storing notes
4830
4831When you are finished preparing a note with @i{remember}, you have to
4832press @kbd{C-c C-c} to file the note away. The handler will store the
4833note in the file and under the headline specified in the template, or it
4834will use the default file and headlines. The window configuration will
4835be restored, sending you back to the working context before the call to
4836@code{remember}. To re-use the location found during the last call to
4837@code{remember}, exit the remember buffer with @kbd{C-u C-u C-c C-c},
4838i.e. specify a double prefix argument to @kbd{C-c C-c}.
4839
4840If you want to store the note directly to a different place, use
4841@kbd{C-u C-c C-c} instead to exit remember@footnote{Configure the
4842variable @code{org-remember-store-without-prompt} to make this behavior
4843the default.}. The handler will then first prompt for a target file -
4844if you press @key{RET}, the value specified for the template is used.
4845Then the command offers the headings tree of the selected file, with the
4846cursor position at the default headline (if you had specified one in the
4847template). You can either immediately press @key{RET} to get the note
4848placed there. Or you can use the following keys to find a different
4849location:
4850@example
4851@key{TAB} @r{Cycle visibility.}
4852@key{down} / @key{up} @r{Next/previous visible headline.}
4853n / p @r{Next/previous visible headline.}
4854f / b @r{Next/previous headline same level.}
4855u @r{One level up.}
4856@c 0-9 @r{Digit argument.}
4857@end example
4858@noindent
4859Pressing @key{RET} or @key{left} or @key{right}
4860then leads to the following result.
4861
4862@multitable @columnfractions 0.2 0.15 0.65
4863@item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
4864@item on headline @tab @key{RET} @tab as sublevel of the heading at cursor, first or last
4865@item @tab @tab depending on @code{org-reverse-note-order}.
4866@item @tab @key{left}/@key{right} @tab as same level, before/after current heading
4867@item buffer-start @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
4868@item @tab @tab depending on @code{org-reverse-note-order}.
4869@item not on headline @tab @key{RET}
4870 @tab at cursor position, level taken from context.
4871@end multitable
4872
4873Before inserting the text into a tree, the function ensures that the
4874text has a headline, i.e. a first line that starts with a @samp{*}. If
4875not, a headline is constructed from the current date and some additional
4876data. If you have indented the text of the note below the headline, the
4877indentation will be adapted if inserting the note into the tree requires
4878demotion from level 1.
4879
4880@node Refiling notes, , Storing notes, Remember
4881@section Refiling notes
4882@cindex refiling notes
4883
4884Remember is usually used to quickly capture notes and tasks into one or
4885a few capture lists. When reviewing the captured data, you may want to
4886refile some of the entries into a different list, for example into a
4887project. Cutting, finding the right location and then pasting the note
4888is cumbersome. To simplify this process, you can use the following
4889special command:
4890
4891@table @kbd
4892@kindex C-c C-w
4893@item C-c C-w
4894Refile the entry at point. This command offers possible locations for
4895refiling the entry and lets you select one with completion. The item is
4896filed below the target heading as a subitem. Depending on
4897@code{org-reverse-note-order}, it will be either the first of last
28a16a1b
CD
4898subitem.@* By default, all level 1 headlines in the current buffer are
4899considered to be targets, but you can have more complex definitions
4900across a number of files. See the variable @code{org-refile-targets}
4901for details.
4902@kindex C-u C-c C-w
4903@item C-u C-c C-w
4904Use the refile interface to jump to a heading.
4905@kindex C-u C-u C-c C-w
a7808fba 4906@item C-u C-u C-c C-w
28a16a1b 4907Jump to the location where @code{org-refile} last moved a tree to.
dbc28aaa
CD
4908@end table
4909
a7808fba 4910@node Agenda Views, Embedded LaTeX, Remember, Top
4009494e
GM
4911@chapter Agenda Views
4912@cindex agenda views
4913
a7808fba 4914Due to the way Org works, TODO items, time-stamped items, and
4009494e 4915tagged headlines can be scattered throughout a file or even a number of
dbc28aaa
CD
4916files. To get an overview of open action items, or of events that are
4917important for a particular date, this information must be collected,
4009494e
GM
4918sorted and displayed in an organized way.
4919
a7808fba 4920Org can select items based on various criteria, and display them
28a16a1b 4921in a separate buffer. Seven different view types are provided:
4009494e
GM
4922
4923@itemize @bullet
4924@item
4925an @emph{agenda} that is like a calendar and shows information
4926for specific dates,
4927@item
4928a @emph{TODO list} that covers all unfinished
4929action items,
4930@item
4931a @emph{tags view}, showings headlines based on
4932the tags associated with them,
4933@item
a7808fba 4934a @emph{timeline view} that shows all events in a single Org file,
4009494e
GM
4935in time-sorted view,
4936@item
28a16a1b
CD
4937a @emph{keyword search view} that shows all entries from multiple files
4938that contain specified keywords.
4939@item
4009494e
GM
4940a @emph{stuck projects view} showing projects that currently don't move
4941along, and
4942@item
4943@emph{custom views} that are special tag/keyword searches and
4944combinations of different views.
4945@end itemize
4946
4947@noindent
4948The extracted information is displayed in a special @emph{agenda
4949buffer}. This buffer is read-only, but provides commands to visit the
a7808fba 4950corresponding locations in the original Org files, and even to
28a16a1b 4951edit these files remotely.
4009494e
GM
4952
4953Two variables control how the agenda buffer is displayed and whether the
4954window configuration is restored when the agenda exits:
4955@code{org-agenda-window-setup} and
4956@code{org-agenda-restore-windows-after-quit}.
4957
4958@menu
4959* Agenda files:: Files being searched for agenda information
4960* Agenda dispatcher:: Keyboard access to agenda views
4961* Built-in agenda views:: What is available out of the box?
4962* Presentation and sorting:: How agenda items are prepared for display
a7808fba 4963* Agenda commands:: Remote editing of Org trees
4009494e 4964* Custom agenda views:: Defining special searches and views
a7808fba 4965* Agenda column view:: Using column view for collected entries
4009494e
GM
4966@end menu
4967
a7808fba 4968@node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
4009494e
GM
4969@section Agenda files
4970@cindex agenda files
4971@cindex files for agenda
4972
dbc28aaa
CD
4973The information to be shown is normally collected from all @emph{agenda
4974files}, the files listed in the variable
4975@code{org-agenda-files}@footnote{If the value of that variable is not a
4976list, but a single file name, then the list of agenda files will be
4977maintained in that external file.}. If a directory is part of this list,
4978all files with the extension @file{.org} in this directory will be part
4979of the list.
4980
a7808fba 4981Thus even if you only work with a single Org file, this file should
dbc28aaa
CD
4982be put into that list@footnote{When using the dispatcher, pressing
4983@kbd{<} before selecting a command will actually limit the command to
4984the current file, and ignore @code{org-agenda-files} until the next
4009494e
GM
4985dispatcher command.}. You can customize @code{org-agenda-files}, but
4986the easiest way to maintain it is through the following commands
4987
4988@cindex files, adding to agenda list
4989@table @kbd
4990@kindex C-c [
4991@item C-c [
4992Add current file to the list of agenda files. The file is added to
4993the front of the list. If it was already in the list, it is moved to
a7808fba 4994the front. With a prefix argument, file is added/moved to the end.
4009494e
GM
4995@kindex C-c ]
4996@item C-c ]
4997Remove current file from the list of agenda files.
4998@kindex C-,
4999@kindex C-'
5000@item C-,
5001@itemx C-'
5002Cycle through agenda file list, visiting one file after the other.
a7808fba
CD
5003@kindex M-x org-iswitchb
5004@item M-x org-iswitchb
5005Command to use an @code{iswitchb}-like interface to switch to and between Org
5006buffers.
4009494e
GM
5007@end table
5008
5009@noindent
5010The Org menu contains the current list of files and can be used
5011to visit any of them.
5012
dbc28aaa
CD
5013If you would like to focus the agenda temporarily onto a file not in
5014this list, or onto just one file in the list or even only a subtree in a
5015file, this can be done in different ways. For a single agenda command,
5016you may press @kbd{<} once or several times in the dispatcher
5017(@pxref{Agenda dispatcher}). To restrict the agenda scope for an
5018extended period, use the following commands:
5019
5020@table @kbd
5021@kindex C-c C-x <
5022@item C-c C-x <
5023Permanently restrict the agenda to the current subtree. When with a
5024prefix argument, or with the cursor before the first headline in a file,
5025the agenda scope is set to the entire file. This restriction remains in
5026effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
5027or @kbd{>} in the agenda dispatcher. If there is a window displaying an
5028agenda view, the new restriction takes effect immediately.
5029@kindex C-c C-x <
5030@item C-c C-x <
5031Remove the permanent restriction created by @kbd{C-c C-x <}.
5032@end table
5033
5034@noindent
5035When working with @file{Speedbar}, you can use the following commands in
a7808fba 5036the Speedbar frame:
dbc28aaa
CD
5037@table @kbd
5038@kindex <
5039@item < @r{in the speedbar frame}
5040Permanently restrict the agenda to the item at the cursor in the
a7808fba 5041Speedbar frame, either an Org file or a subtree in such a file.
dbc28aaa
CD
5042If there is a window displaying an agenda view, the new restriction takes
5043effect immediately.
5044@kindex <
5045@item > @r{in the speedbar frame}
5046Lift the restriction again.
5047@end table
5048
a7808fba 5049@node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
4009494e
GM
5050@section The agenda dispatcher
5051@cindex agenda dispatcher
5052@cindex dispatching agenda commands
5053The views are created through a dispatcher that should be bound to a
5054global key, for example @kbd{C-c a} (@pxref{Installation}). In the
5055following we will assume that @kbd{C-c a} is indeed how the dispatcher
5056is accessed and list keyboard access to commands accordingly. After
5057pressing @kbd{C-c a}, an additional letter is required to execute a
5058command. The dispatcher offers the following default commands:
5059@table @kbd
5060@item a
a7808fba 5061Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
4009494e
GM
5062@item t @r{/} T
5063Create a list of all TODO items (@pxref{Global TODO list}).
5064@item m @r{/} M
5065Create a list of headlines matching a TAGS expression (@pxref{Matching
5066tags and properties}).
5067@item L
5068Create the timeline view for the current buffer (@pxref{Timeline}).
28a16a1b
CD
5069@item s
5070Create a list of entries selected by a boolean expression of keywords
5071and/or regular expressions that must or must not occur in the entry.
dbc28aaa
CD
5072@item /
5073Search for a regular expression in all agenda files and additionally in
5074the files listed in @code{org-agenda-multi-occur-extra-files}. This
5075uses the Emacs command @code{multi-occur}. A prefix argument can be
5076used to specify the number of context lines for each match, default is
50771.
28a16a1b
CD
5078@item # @r{/} !
5079Create a list of stuck projects (@pxref{Stuck projects}).
dbc28aaa
CD
5080@item <
5081Restrict an agenda command to the current buffer@footnote{For backward
5082compatibility, you can also press @kbd{1} to restrict to the current
5083buffer.}. After pressing @kbd{<}, you still need to press the character
5084selecting the command.
5085@item < <
4009494e 5086If there is an active region, restrict the following agenda command to
dbc28aaa
CD
5087the region. Otherwise, restrict it to the current subtree@footnote{For
5088backward compatibility, you can also press @kbd{0} to restrict to the
5089current buffer.}. After pressing @kbd{< <}, you still need to press the
5090character selecting the command.
4009494e
GM
5091@end table
5092
5093You can also define custom commands that will be accessible through the
5094dispatcher, just like the default commands. This includes the
5095possibility to create extended agenda buffers that contain several
5096blocks together, for example the weekly agenda, the global TODO list and
5097a number of special tags matches. @xref{Custom agenda views}.
5098
a7808fba 5099@node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
4009494e
GM
5100@section The built-in agenda views
5101
5102In this section we describe the built-in views.
5103
5104@menu
a7808fba 5105* Weekly/daily agenda:: The calendar page with current tasks
4009494e
GM
5106* Global TODO list:: All unfinished action items
5107* Matching tags and properties:: Structured information with fine-tuned search
5108* Timeline:: Time-sorted view for single file
28a16a1b 5109* Keyword search:: Finding entries by keyword
4009494e
GM
5110* Stuck projects:: Find projects you need to review
5111@end menu
5112
a7808fba 5113@node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
4009494e
GM
5114@subsection The weekly/daily agenda
5115@cindex agenda
5116@cindex weekly agenda
5117@cindex daily agenda
5118
5119The purpose of the weekly/daily @emph{agenda} is to act like a page of a
5120paper agenda, showing all the tasks for the current week or day.
5121
5122@table @kbd
5123@cindex org-agenda, command
5124@kindex C-c a a
5125@item C-c a a
5126Compile an agenda for the current week from a list of org files. The
dbc28aaa
CD
5127agenda shows the entries for each day. With a numeric
5128prefix@footnote{For backward compatibility, the universal prefix
5129@kbd{C-u} causes all TODO entries to be listed before the agenda. This
5130feature is deprecated, use the dedicated TODO list, or a block agenda
5131instead.} (like @kbd{C-u 2 1 C-c a a}) you may set the number of days
5132to be displayed (see also the variable @code{org-agenda-ndays})
4009494e
GM
5133@end table
5134
5135Remote editing from the agenda buffer means, for example, that you can
5136change the dates of deadlines and appointments from the agenda buffer.
5137The commands available in the Agenda buffer are listed in @ref{Agenda
5138commands}.
5139
5140@subsubheading Calendar/Diary integration
5141@cindex calendar integration
5142@cindex diary integration
5143
5144Emacs contains the calendar and diary by Edward M. Reingold. The
5145calendar displays a three-month calendar with holidays from different
5146countries and cultures. The diary allows you to keep track of
5147anniversaries, lunar phases, sunrise/set, recurrent appointments
5148(weekly, monthly) and more. In this way, it is quite complementary to
a7808fba 5149Org. It can be very useful to combine output from Org with
4009494e
GM
5150the diary.
5151
a7808fba 5152In order to include entries from the Emacs diary into Org mode's
4009494e
GM
5153agenda, you only need to customize the variable
5154
5155@lisp
5156(setq org-agenda-include-diary t)
5157@end lisp
5158
5159@noindent After that, everything will happen automatically. All diary
5160entries including holidays, anniversaries etc will be included in the
a7808fba 5161agenda buffer created by Org mode. @key{SPC}, @key{TAB}, and
4009494e
GM
5162@key{RET} can be used from the agenda buffer to jump to the diary
5163file in order to edit existing diary entries. The @kbd{i} command to
5164insert new entries for the current date works in the agenda buffer, as
5165well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
5166Sunrise/Sunset times, show lunar phases and to convert to other
5167calendars, respectively. @kbd{c} can be used to switch back and forth
5168between calendar and agenda.
5169
5170If you are using the diary only for sexp entries and holidays, it is
5171faster to not use the above setting, but instead to copy or even move
a7808fba 5172the entries into an Org file. Org mode evaluates diary-style sexp
4009494e
GM
5173entries, and does it faster because there is no overhead for first
5174creating the diary display. Note that the sexp entries must start at
5175the left margin, no white space is allowed before them. For example,
a7808fba 5176the following segment of an Org file will be processed and entries
4009494e
GM
5177will be made in the agenda:
5178
5179@example
5180* Birthdays and similar stuff
5181#+CATEGORY: Holiday
5182%%(org-calendar-holiday) ; special function for holiday names
5183#+CATEGORY: Ann
5184%%(diary-anniversary 14 5 1956) Arthur Dent is %d years old
5185%%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old
5186@end example
5187
dbc28aaa
CD
5188@subsubheading Appointment reminders
5189@cindex @file{appt.el}
5190@cindex appointment reminders
5191
5192Org can interact with Emacs appointments notification facility.
5193
5194To add all the appointments of your agenda files, use the command
5195@code{org-agenda-to-appt}. This commands also lets you filter through
5196the list of your appointments and add only those belonging to a specific
5197category or matching a regular expression. See the docstring for
5198details.
5199
a7808fba 5200@node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
4009494e
GM
5201@subsection The global TODO list
5202@cindex global TODO list
5203@cindex TODO list, global
5204
5205The global TODO list contains all unfinished TODO items, formatted and
5206collected into a single place.
5207
5208@table @kbd
5209@kindex C-c a t
5210@item C-c a t
5211Show the global TODO list. This collects the TODO items from all
a7808fba 5212agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in
4009494e
GM
5213@code{agenda-mode}, so there are commands to examine and manipulate
5214the TODO entries directly from that buffer (@pxref{Agenda commands}).
5215@kindex C-c a T
5216@item C-c a T
5217@cindex TODO keyword matching
5218Like the above, but allows selection of a specific TODO keyword. You
5219can also do this by specifying a prefix argument to @kbd{C-c a t}. With
5220a @kbd{C-u} prefix you are prompted for a keyword, and you may also
5221specify several keywords by separating them with @samp{|} as boolean OR
5222operator. With a numeric prefix, the Nth keyword in
5223@code{org-todo-keywords} is selected.
5224@kindex r
5225The @kbd{r} key in the agenda buffer regenerates it, and you can give
5226a prefix argument to this command to change the selected TODO keyword,
5227for example @kbd{3 r}. If you often need a search for a specific
5228keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
5229Matching specific TODO keywords can also be done as part of a tags
5230search (@pxref{Tag searches}).
5231@end table
5232
5233Remote editing of TODO items means that you can change the state of a
5234TODO entry with a single key press. The commands available in the
5235TODO list are described in @ref{Agenda commands}.
5236
a7808fba
CD
5237@cindex sublevels, inclusion into TODO list
5238Normally the global TODO list simply shows all headlines with TODO
4009494e
GM
5239keywords. This list can become very long. There are two ways to keep
5240it more compact:
5241@itemize @minus
5242@item
5243Some people view a TODO item that has been @emph{scheduled} for
a7808fba 5244execution (@pxref{Timestamps}) as no longer @emph{open}. Configure the
4009494e
GM
5245variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
5246items from the global TODO list.
5247@item
5248TODO items may have sublevels to break up the task into subtasks. In
5249such cases it may be enough to list only the highest level TODO headline
5250and omit the sublevels from the global list. Configure the variable
5251@code{org-agenda-todo-list-sublevels} to get this behavior.
5252@end itemize
5253
5254@node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
a7808fba 5255@subsection Matching tags and properties
4009494e
GM
5256@cindex matching, of tags
5257@cindex matching, of properties
5258@cindex tags view
5259
5260If headlines in the agenda files are marked with @emph{tags}
5261(@pxref{Tags}), you can select headlines based on the tags that apply
5262to them and collect them into an agenda buffer.
5263
5264@table @kbd
5265@kindex C-c a m
5266@item C-c a m
5267Produce a list of all headlines that match a given set of tags. The
5268command prompts for a selection criterion, which is a boolean logic
dbc28aaa
CD
5269expression with tags, like @samp{+work+urgent-withboss} or
5270@samp{work|home} (@pxref{Tags}). If you often need a specific search,
4009494e
GM
5271define a custom command for it (@pxref{Agenda dispatcher}).
5272@kindex C-c a M
5273@item C-c a M
5274Like @kbd{C-c a m}, but only select headlines that are also TODO items
5275and force checking subitems (see variable
a7808fba 5276@code{org-tags-match-list-sublevels}). Matching specific TODO keywords
4009494e
GM
5277together with a tags match is also possible, see @ref{Tag searches}.
5278@end table
5279
5280The commands available in the tags list are described in @ref{Agenda
5281commands}.
5282
28a16a1b 5283@node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
4009494e
GM
5284@subsection Timeline for a single file
5285@cindex timeline, single file
5286@cindex time-sorted view
5287
a7808fba 5288The timeline summarizes all time-stamped items from a single Org mode
4009494e
GM
5289file in a @emph{time-sorted view}. The main purpose of this command is
5290to give an overview over events in a project.
5291
5292@table @kbd
5293@kindex C-c a L
5294@item C-c a L
5295Show a time-sorted view of the org file, with all time-stamped items.
5296When called with a @kbd{C-u} prefix, all unfinished TODO entries
5297(scheduled or not) are also listed under the current date.
5298@end table
5299
5300@noindent
5301The commands available in the timeline buffer are listed in
5302@ref{Agenda commands}.
5303
28a16a1b
CD
5304@node Keyword search, Stuck projects, Timeline, Built-in agenda views
5305@subsection Keyword search
5306@cindex keyword search
5307@cindex searching, for keywords
5308
a7808fba 5309This agenda view is a general text search facility for Org mode entries.
28a16a1b
CD
5310It is particularly useful to find notes.
5311
5312@table @kbd
5313@kindex C-c a s
5314@item C-c a s
5315This is a special search that lets you select entries by keywords or
5316regular expression, using a boolean logic. For example, the search
5317string
5318
5319@example
5320+computer +wifi -ethernet -@{8\.11[bg]@}
5321@end example
4009494e 5322
28a16a1b
CD
5323@noindent
5324will search for note entries that contain the keywords @code{computer}
5325and @code{wifi}, but not the keyword @code{ethernet}, and which are also
5326not matched by the regular expression @code{8\.11[bg]}, meaning to
5327exclude both 8.11b and 8.11g.
5328
5329Note that in addition to the agenda files, this command will also search
5330the files listed in @code{org-agenda-text-search-extra-files}.
5331@end table
5332
5333@node Stuck projects, , Keyword search, Built-in agenda views
4009494e
GM
5334@subsection Stuck projects
5335
5336If you are following a system like David Allen's GTD to organize your
5337work, one of the ``duties'' you have is a regular review to make sure
5338that all projects move along. A @emph{stuck} project is a project that
5339has no defined next actions, so it will never show up in the TODO lists
a7808fba 5340Org mode produces. During the review, you need to identify such
4009494e
GM
5341projects and define next actions for them.
5342
5343@table @kbd
5344@kindex C-c a #
5345@item C-c a #
5346List projects that are stuck.
5347@kindex C-c a !
5348@item C-c a !
5349Customize the variable @code{org-stuck-projects} to define what a stuck
5350project is and how to find it.
5351@end table
5352
5353You almost certainly will have to configure this view before it will
5354work for you. The built-in default assumes that all your projects are
5355level-2 headlines, and that a project is not stuck if it has at least
a7808fba 5356one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
4009494e 5357
a7808fba
CD
5358Lets assume that you, in your own way of using Org mode, identify
5359projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
4009494e 5360indicate a project that should not be considered yet. Lets further
a7808fba 5361assume that the TODO keyword DONE marks finished projects, and that NEXT
4009494e
GM
5362and TODO indicate next actions. The tag @@SHOP indicates shopping and
5363is a next action even without the NEXT tag. Finally, if the project
5364contains the special word IGNORE anywhere, it should not be listed
5365either. In this case you would start by identifying eligible projects
5366with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
5367TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
5368are not stuck. The correct customization for this is
5369
5370@lisp
5371(setq org-stuck-projects
5372 '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
5373 "\\<IGNORE\\>"))
5374@end lisp
5375
5376
a7808fba 5377@node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
4009494e
GM
5378@section Presentation and sorting
5379@cindex presentation, of agenda items
5380
a7808fba 5381Before displaying items in an agenda view, Org mode visually prepares
4009494e
GM
5382the items and sorts them. Each item occupies a single line. The line
5383starts with a @emph{prefix} that contains the @emph{category}
5384(@pxref{Categories}) of the item and other important information. You can
5385customize the prefix using the option @code{org-agenda-prefix-format}.
5386The prefix is followed by a cleaned-up version of the outline headline
5387associated with the item.
5388
5389@menu
5390* Categories:: Not all tasks are equal
5391* Time-of-day specifications:: How the agenda knows the time
5392* Sorting of agenda items:: The order of things
5393@end menu
5394
5395@node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
5396@subsection Categories
5397
5398@cindex category
5399The category is a broad label assigned to each agenda item. By default,
5400the category is simply derived from the file name, but you can also
dbc28aaa
CD
5401specify it with a special line in the buffer, like this@footnote{For
5402backward compatibility, the following also works: If there are several
5403such lines in a file, each specifies the category for the text below it.
5404The first category also applies to any text before the first CATEGORY
5405line. However, using this method is @emph{strongly} deprecated as it is
5406incompatible with the outline structure of the document. The correct
5407method for setting multiple categories in a buffer is using a
5408property.}:
4009494e
GM
5409
5410@example
5411#+CATEGORY: Thesis
5412@end example
5413
dbc28aaa
CD
5414@noindent
5415If you would like to have a special CATEGORY for a single entry or a
5416(sub)tree, give the entry a @code{:CATEGORY:} property with the location
a7808fba 5417as the value (@pxref{Properties and Columns}).
dbc28aaa
CD
5418
5419@noindent
5420The display in the agenda buffer looks best if the category is not
5421longer than 10 characters.
4009494e
GM
5422
5423@node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
a7808fba 5424@subsection Time-of-day specifications
4009494e
GM
5425@cindex time-of-day specification
5426
a7808fba 5427Org mode checks each agenda item for a time-of-day specification. The
4009494e
GM
5428time can be part of the time stamp that triggered inclusion into the
5429agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time
5430ranges can be specified with two time stamps, like
5431@c
5432@w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
5433
5434In the headline of the entry itself, a time(range) may also appear as
5435plain text (like @samp{12:45} or a @samp{8:30-1pm}. If the agenda
a7808fba 5436integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
4009494e
GM
5437specifications in diary entries are recognized as well.
5438
a7808fba 5439For agenda display, Org mode extracts the time and displays it in a
4009494e
GM
5440standard 24 hour format as part of the prefix. The example times in
5441the previous paragraphs would end up in the agenda like this:
5442
5443@example
5444 8:30-13:00 Arthur Dent lies in front of the bulldozer
5445 12:45...... Ford Prefect arrives and takes Arthur to the pub
5446 19:00...... The Vogon reads his poem
5447 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5448@end example
5449
5450@cindex time grid
5451If the agenda is in single-day mode, or for the display of today, the
5452timed entries are embedded in a time grid, like
5453
5454@example
5455 8:00...... ------------------
5456 8:30-13:00 Arthur Dent lies in front of the bulldozer
5457 10:00...... ------------------
5458 12:00...... ------------------
5459 12:45...... Ford Prefect arrives and takes Arthur to the pub
5460 14:00...... ------------------
5461 16:00...... ------------------
5462 18:00...... ------------------
5463 19:00...... The Vogon reads his poem
5464 20:00...... ------------------
5465 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
5466@end example
5467
5468The time grid can be turned on and off with the variable
5469@code{org-agenda-use-time-grid}, and can be configured with
5470@code{org-agenda-time-grid}.
5471
5472@node Sorting of agenda items, , Time-of-day specifications, Presentation and sorting
5473@subsection Sorting of agenda items
5474@cindex sorting, of agenda items
5475@cindex priorities, of agenda items
5476Before being inserted into a view, the items are sorted. How this is
5477done depends on the type of view.
5478@itemize @bullet
5479@item
5480For the daily/weekly agenda, the items for each day are sorted. The
5481default order is to first collect all items containing an explicit
5482time-of-day specification. These entries will be shown at the beginning
5483of the list, as a @emph{schedule} for the day. After that, items remain
5484grouped in categories, in the sequence given by @code{org-agenda-files}.
5485Within each category, items are sorted by priority (@pxref{Priorities}),
5486which is composed of the base priority (2000 for priority @samp{A}, 1000
5487for @samp{B}, and 0 for @samp{C}), plus additional increments for
5488overdue scheduled or deadline items.
28a16a1b 5489@item
4009494e
GM
5490For the TODO list, items remain in the order of categories, but within
5491each category, sorting takes place according to priority
5492(@pxref{Priorities}).
5493@item
5494For tags matches, items are not sorted at all, but just appear in the
5495sequence in which they are found in the agenda files.
5496@end itemize
5497
5498Sorting can be customized using the variable
a7808fba
CD
5499@code{org-agenda-sorting-strategy}, and may also include criteria based on
5500the estimated effort of an entry.
5501@c FIXME: link!!!!!!!!
4009494e
GM
5502
5503
a7808fba 5504@node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
4009494e
GM
5505@section Commands in the agenda buffer
5506@cindex commands, in agenda buffer
5507
5508Entries in the agenda buffer are linked back to the org file or diary
5509file where they originate. You are not allowed to edit the agenda
5510buffer itself, but commands are provided to show and jump to the
5511original entry location, and to edit the org-files ``remotely'' from
5512the agenda buffer. In this way, all information is stored only once,
5513removing the risk that your agenda and note files may diverge.
5514
5515Some commands can be executed with mouse clicks on agenda lines. For
5516the other commands, the cursor needs to be in the desired line.
5517
5518@table @kbd
5519@tsubheading{Motion}
5520@cindex motion commands in agenda
5521@kindex n
5522@item n
dbc28aaa 5523Next line (same as @key{up} and @kbd{C-p}).
4009494e
GM
5524@kindex p
5525@item p
dbc28aaa 5526Previous line (same as @key{down} and @kbd{C-n}).
a7808fba 5527@tsubheading{View/Go to org file}
4009494e
GM
5528@kindex mouse-3
5529@kindex @key{SPC}
5530@item mouse-3
5531@itemx @key{SPC}
5532Display the original location of the item in another window.
5533@c
5534@kindex L
5535@item L
5536Display original location and recenter that window.
5537@c
5538@kindex mouse-2
5539@kindex mouse-1
5540@kindex @key{TAB}
5541@item mouse-2
5542@itemx mouse-1
5543@itemx @key{TAB}
5544Go to the original location of the item in another window. Under Emacs
554522, @kbd{mouse-1} will also works for this.
5546@c
5547@kindex @key{RET}
5548@itemx @key{RET}
5549Go to the original location of the item and delete other windows.
5550@c
5551@kindex f
5552@item f
5553Toggle Follow mode. In Follow mode, as you move the cursor through
5554the agenda buffer, the other window always shows the corresponding
5555location in the org file. The initial setting for this mode in new
5556agenda buffers can be set with the variable
5557@code{org-agenda-start-with-follow-mode}.
5558@c
5559@kindex b
5560@item b
a7808fba
CD
5561Display the entire subtree of the current item in an indirect buffer. With a
5562numeric prefix argument N, go up to level N and then take that tree. If N is
5563negative, go up that many levels. With a @kbd{C-u} prefix, do not remove the
5564previously used indirect buffer.
4009494e
GM
5565@c
5566@kindex l
5567@item l
5568Toggle Logbook mode. In Logbook mode, entries that where marked DONE while
5569logging was on (variable @code{org-log-done}) are shown in the agenda,
5570as are entries that have been clocked on that day.
a7808fba
CD
5571@c
5572@kindex R
5573@item R
5574Toggle Clockreport mode. In clockreport mode, the daily/weekly agenda will
5575always show a table with the clocked times for the timespan and file scope
5576covered by the current agenda view. The initial setting for this mode in new
5577agenda buffers can be set with the variable
5578@code{org-agenda-start-with-clockreport-mode}.
4009494e
GM
5579
5580@tsubheading{Change display}
5581@cindex display changing, in agenda
5582@kindex o
5583@item o
5584Delete other windows.
5585@c
5586@kindex d
5587@kindex w
5588@kindex m
5589@kindex y
5590@item d w m y
5591Switch to day/week/month/year view. When switching to day or week view,
a7808fba
CD
5592this setting becomes the default for subsequent agenda commands. Since
5593month and year views are slow to create, they do not become the default.
5594A numeric prefix argument may be used to jump directly to a specific day
5595of the year, ISO week, month, or year, respectively. For example,
5596@kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9. When
5597setting day, week, or month view, a year may be encoded in the prefix
5598argument as well. For example, @kbd{200712 w} will jump to week 12 in
55992007. If such a year specification has only one or two digits, it will
5600be mapped to the interval 1938-2037.
4009494e
GM
5601@c
5602@kindex D
5603@item D
a7808fba 5604Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
4009494e 5605@c
28a16a1b
CD
5606@kindex G
5607@item G
4009494e
GM
5608Toggle the time grid on and off. See also the variables
5609@code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
5610@c
5611@kindex r
5612@item r
5613Recreate the agenda buffer, for example to reflect the changes
5614after modification of the time stamps of items with S-@key{left} and
a7808fba 5615S-@key{right}. When the buffer is the global TODO list, a prefix
4009494e
GM
5616argument is interpreted to create a selective list for a specific TODO
5617keyword.
28a16a1b
CD
5618@kindex g
5619@item g
5620Same as @kbd{r}.
4009494e
GM
5621@c
5622@kindex s
dbc28aaa 5623@kindex C-x C-s
4009494e 5624@item s
dbc28aaa 5625@itemx C-x C-s
a7808fba 5626Save all Org buffers in the current Emacs session.
4009494e
GM
5627@c
5628@kindex @key{right}
5629@item @key{right}
5630Display the following @code{org-agenda-ndays} days. For example, if
5631the display covers a week, switch to the following week. With prefix
5632arg, go forward that many times @code{org-agenda-ndays} days.
5633@c
5634@kindex @key{left}
5635@item @key{left}
5636Display the previous dates.
5637@c
5638@kindex .
5639@item .
a7808fba
CD
5640Go to today.
5641@c
5642@kindex C-c C-x C-c
5643@item C-c C-x C-c
5644Invoke column view (@pxref{Column view}) in the agenda buffer. The column
5645view format is taken from the entry at point, or (if there is no entry at
5646point), from the first entry in the agenda view. So whatever the format for
5647that entry would be in the original buffer (taken from a property, from a
5648@code{#+COLUMNS} line, or from the default variable
5649@code{org-columns-default-format}), will be used in the agenda.
4009494e 5650
28a16a1b
CD
5651@tsubheading{Query editing}
5652@cindex query editing, in agenda
5653
5654@kindex [
5655@kindex ]
5656@kindex @{
5657@kindex @}
5658@item [ ] @{ @}
5659In the @i{search view} (@pxref{Keyword search}), these keys add new
5660search words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{}
5661and @kbd{@}}) to the query string. The opening bracket/brace will add a
5662positive search term prefixed by @samp{+}, indicating that this search
5663term @i{must} occur/match in the entry. Closing bracket/brace add a
5664negative search term which @i{must not} occur/match in the entry for it
5665to be selected.
5666
5667
4009494e
GM
5668@tsubheading{Remote editing}
5669@cindex remote editing, from agenda
5670
5671@item 0-9
5672Digit argument.
5673@c
5674@cindex undoing remote-editing events
5675@cindex remote editing, undo
5676@kindex C-_
5677@item C-_
5678Undo a change due to a remote editing command. The change is undone
5679both in the agenda buffer and in the remote buffer.
5680@c
5681@kindex t
5682@item t
5683Change the TODO state of the item, both in the agenda and in the
5684original org file.
5685@c
5686@kindex C-k
5687@item C-k
5688Delete the current agenda item along with the entire subtree belonging
a7808fba 5689to it in the original Org file. If the text to be deleted remotely
4009494e
GM
5690is longer than one line, the kill needs to be confirmed by the user. See
5691variable @code{org-agenda-confirm-kill}.
5692@c
a7808fba
CD
5693@kindex a
5694@item a
5695Toggle the ARCHIVE tag for the current headline.
5696@c
5697@kindex A
5698@item A
5699Move the subtree correspoding to the current entry to its @emph{Archive
5700Sibling}.
5701@c
4009494e
GM
5702@kindex $
5703@item $
a7808fba
CD
5704Archive the subtree corresponding to the current headline. This means the
5705entry will be moved to the configured archive locatin, most likely a
5706different file.
4009494e
GM
5707@c
5708@kindex T
5709@item T
5710Show all tags associated with the current item. Because of
5711inheritance, this may be more than the tags listed in the line itself.
5712@c
5713@kindex :
5714@item :
dbc28aaa
CD
5715Set tags for the current headline. If there is an active region in the
5716agenda, change a tag for all headings in the region.
4009494e 5717@c
4009494e
GM
5718@kindex ,
5719@item ,
a7808fba 5720Set the priority for the current item. Org mode prompts for the
4009494e
GM
5721priority character. If you reply with @key{SPC}, the priority cookie
5722is removed from the entry.
5723@c
5724@kindex P
5725@item P
5726Display weighted priority of current item.
5727@c
5728@kindex +
5729@kindex S-@key{up}
5730@item +
5731@itemx S-@key{up}
5732Increase the priority of the current item. The priority is changed in
5733the original buffer, but the agenda is not resorted. Use the @kbd{r}
5734key for this.
5735@c
5736@kindex -
5737@kindex S-@key{down}
5738@item -
5739@itemx S-@key{down}
5740Decrease the priority of the current item.
5741@c
5742@kindex C-c C-s
5743@item C-c C-s
5744Schedule this item
5745@c
5746@kindex C-c C-d
5747@item C-c C-d
5748Set a deadline for this item.
5749@c
5750@kindex S-@key{right}
5751@item S-@key{right}
a7808fba
CD
5752Change the time stamp associated with the current line by one day into the
5753future. With a numeric prefix argument, change it by that many days. For
5754example, @kbd{3 6 5 S-@key{right}} will change it by a year. The stamp is
5755changed in the original org file, but the change is not directly reflected in
5756the agenda buffer. Use the @kbd{r} key to update the buffer.
4009494e
GM
5757@c
5758@kindex S-@key{left}
5759@item S-@key{left}
5760Change the time stamp associated with the current line by one day
5761into the past.
5762@c
5763@kindex >
5764@item >
5765Change the time stamp associated with the current line to today.
5766The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
5767on my keyboard.
5768@c
5769@kindex I
5770@item I
5771Start the clock on the current item. If a clock is running already, it
5772is stopped first.
5773@c
5774@kindex O
5775@item O
5776Stop the previously started clock.
5777@c
5778@kindex X
5779@item X
5780Cancel the currently running clock.
5781
dbc28aaa
CD
5782@kindex J
5783@item J
5784Jump to the running clock in another window.
5785
4009494e
GM
5786@tsubheading{Calendar commands}
5787@cindex calendar commands, from agenda
5788@kindex c
5789@item c
5790Open the Emacs calendar and move to the date at the agenda cursor.
5791@c
5792@item c
a7808fba 5793When in the calendar, compute and show the Org mode agenda for the
4009494e
GM
5794date at the cursor.
5795@c
5796@cindex diary entries, creating from agenda
5797@kindex i
5798@item i
5799Insert a new entry into the diary. Prompts for the type of entry
5800(day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
5801entry in the diary, just as @kbd{i d} etc. would do in the calendar.
5802The date is taken from the cursor position.
5803@c
5804@kindex M
5805@item M
5806Show the phases of the moon for the three months around current date.
5807@c
5808@kindex S
5809@item S
5810Show sunrise and sunset times. The geographical location must be set
5811with calendar variables, see documentation of the Emacs calendar.
5812@c
5813@kindex C
5814@item C
5815Convert the date at cursor into many other cultural and historic
5816calendars.
5817@c
5818@kindex H
5819@item H
5820Show holidays for three month around the cursor date.
a7808fba
CD
5821
5822@item M-x org-export-icalendar-combine-agenda-files
4009494e 5823Export a single iCalendar file containing entries from all agenda files.
a7808fba 5824This is a globally available command, and also available in the agenda menu.
4009494e
GM
5825
5826@tsubheading{Exporting to a file}
5827@kindex C-x C-w
5828@item C-x C-w
5829@cindex exporting agenda views
5830@cindex agenda views, exporting
5831Write the agenda view to a file. Depending on the extension of the
5832selected file name, the view will be exported as HTML (extension
5833@file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
5834plain text (any other extension). Use the variable
5835@code{org-agenda-exporter-settings} to set options for @file{ps-print}
5836and for @file{htmlize} to be used during export.
5837
5838@tsubheading{Quit and Exit}
5839@kindex q
5840@item q
5841Quit agenda, remove the agenda buffer.
5842@c
5843@kindex x
5844@cindex agenda files, removing buffers
5845@item x
5846Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
5847for the compilation of the agenda. Buffers created by the user to
5848visit org files will not be removed.
5849@end table
5850
5851
a7808fba 5852@node Custom agenda views, Agenda column view, Agenda commands, Agenda Views
4009494e
GM
5853@section Custom agenda views
5854@cindex custom agenda views
5855@cindex agenda views, custom
5856
5857Custom agenda commands serve two purposes: to store and quickly access
5858frequently used TODO and tags searches, and to create special composite
5859agenda buffers. Custom agenda commands will be accessible through the
5860dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
5861
5862@menu
5863* Storing searches:: Type once, use often
5864* Block agenda:: All the stuff you need in a single buffer
5865* Setting Options:: Changing the rules
a7808fba
CD
5866* Exporting Agenda Views:: Writing agendas to files
5867* Using the agenda elsewhere:: Using agenda information in other programs
4009494e
GM
5868@end menu
5869
5870@node Storing searches, Block agenda, Custom agenda views, Custom agenda views
5871@subsection Storing searches
5872
5873The first application of custom searches is the definition of keyboard
5874shortcuts for frequently used searches, either creating an agenda
5875buffer, or a sparse tree (the latter covering of course only the current
5876buffer).
5877@kindex C-c a C
5878Custom commands are configured in the variable
5879@code{org-agenda-custom-commands}. You can customize this variable, for
5880example by pressing @kbd{C-c a C}. You can also directly set it with
5881Emacs Lisp in @file{.emacs}. The following example contains all valid
5882search types:
5883
5884@lisp
5885@group
5886(setq org-agenda-custom-commands
5887 '(("w" todo "WAITING")
5888 ("W" todo-tree "WAITING")
dbc28aaa
CD
5889 ("u" tags "+boss-urgent")
5890 ("v" tags-todo "+boss-urgent")
5891 ("U" tags-tree "+boss-urgent")
5892 ("f" occur-tree "\\<FIXME\\>")
5893 ("h" . "HOME+Name tags searches") ; description for "h" prefix
5894 ("hl" tags "+home+Lisa")
5895 ("hp" tags "+home+Peter")
5896 ("hk" tags "+home+Kim")))
4009494e
GM
5897@end group
5898@end lisp
5899
5900@noindent
dbc28aaa
CD
5901The initial string in each entry defines the keys you have to press
5902after the dispatcher command @kbd{C-c a} in order to access the command.
5903Usually this will be just a single character, but if you have many
5904similar commands, you can also define two-letter combinations where the
5905first character is the same in several combinations and serves as a
5906prefix key@footnote{You can provide a description for a prefix key by
5907inserting a cons cell with the prefix and the description.}. The second
5908parameter is the search type, followed by the string or regular
5909expression to be used for the matching. The example above will
5910therefore define:
4009494e
GM
5911
5912@table @kbd
5913@item C-c a w
5914as a global search for TODO entries with @samp{WAITING} as the TODO
5915keyword
5916@item C-c a W
5917as the same search, but only in the current buffer and displaying the
5918results as a sparse tree
5919@item C-c a u
dbc28aaa
CD
5920as a global tags search for headlines marked @samp{:boss:} but not
5921@samp{:urgent:}
4009494e
GM
5922@item C-c a v
5923as the same search as @kbd{C-c a u}, but limiting the search to
5924headlines that are also TODO items
5925@item C-c a U
5926as the same search as @kbd{C-c a u}, but only in the current buffer and
5927displaying the result as a sparse tree
5928@item C-c a f
5929to create a sparse tree (again: current buffer only) with all entries
dbc28aaa
CD
5930containing the word @samp{FIXME}
5931@item C-c a h
5932as a prefix command for a HOME tags search where you have to press an
5933additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
5934Peter, or Kim) as additional tag to match.
4009494e
GM
5935@end table
5936
5937@node Block agenda, Setting Options, Storing searches, Custom agenda views
5938@subsection Block agenda
5939@cindex block agenda
5940@cindex agenda, with block views
5941
5942Another possibility is the construction of agenda views that comprise
5943the results of @emph{several} commands, each of which creates a block in
5944the agenda buffer. The available commands include @code{agenda} for the
5945daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
a7808fba 5946for the global TODO list (as constructed with @kbd{C-c a t}), and the
4009494e
GM
5947matching commands discussed above: @code{todo}, @code{tags}, and
5948@code{tags-todo}. Here are two examples:
5949
5950@lisp
5951@group
5952(setq org-agenda-custom-commands
5953 '(("h" "Agenda and Home-related tasks"
28a16a1b 5954 ((agenda "")
dbc28aaa
CD
5955 (tags-todo "home")
5956 (tags "garden")))
4009494e 5957 ("o" "Agenda and Office-related tasks"
28a16a1b 5958 ((agenda "")
dbc28aaa
CD
5959 (tags-todo "work")
5960 (tags "office")))))
4009494e
GM
5961@end group
5962@end lisp
5963
5964@noindent
5965This will define @kbd{C-c a h} to create a multi-block view for stuff
5966you need to attend to at home. The resulting agenda buffer will contain
5967your agenda for the current week, all TODO items that carry the tag
dbc28aaa 5968@samp{home}, and also all lines tagged with @samp{garden}. Finally the
4009494e
GM
5969command @kbd{C-c a o} provides a similar view for office tasks.
5970
4009494e 5971@node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
a7808fba 5972@subsection Setting options for custom commands
4009494e
GM
5973@cindex options, for custom agenda views
5974
a7808fba 5975Org mode contains a number of variables regulating agenda construction
4009494e
GM
5976and display. The global variables define the behavior for all agenda
5977commands, including the custom commands. However, if you want to change
5978some settings just for a single custom view, you can do so. Setting
5979options requires inserting a list of variable names and values at the
5980right spot in @code{org-agenda-custom-commands}. For example:
5981
5982@lisp
5983@group
5984(setq org-agenda-custom-commands
5985 '(("w" todo "WAITING"
5986 ((org-agenda-sorting-strategy '(priority-down))
5987 (org-agenda-prefix-format " Mixed: ")))
dbc28aaa 5988 ("U" tags-tree "+boss-urgent"
4009494e 5989 ((org-show-following-heading nil)
28a16a1b
CD
5990 (org-show-hierarchy-above nil)))
5991 ("N" search ""
5992 ((org-agenda-files '("~org/notes.org"))
5993 (org-agenda-text-search-extra-files nil)))))
4009494e
GM
5994@end group
5995@end lisp
5996
5997@noindent
5998Now the @kbd{C-c a w} command will sort the collected entries only by
dbc28aaa 5999priority, and the prefix format is modified to just say @samp{ Mixed: }
4009494e
GM
6000instead of giving the category of the entry. The sparse tags tree of
6001@kbd{C-c a U} will now turn out ultra-compact, because neither the
6002headline hierarchy above the match, nor the headline following the match
28a16a1b
CD
6003will be shown. The command @kbd{C-c a N} will do a text search limited
6004to only a single file.
4009494e
GM
6005
6006For command sets creating a block agenda,
6007@code{org-agenda-custom-commands} has two separate spots for setting
6008options. You can add options that should be valid for just a single
6009command in the set, and options that should be valid for all commands in
6010the set. The former are just added to the command entry, the latter
6011must come after the list of command entries. Going back to the block
6012agenda example (@pxref{Block agenda}), let's change the sorting strategy
6013for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
6014the results for GARDEN tags query in the opposite order,
6015@code{priority-up}. This would look like this:
6016
6017@lisp
6018@group
6019(setq org-agenda-custom-commands
6020 '(("h" "Agenda and Home-related tasks"
6021 ((agenda)
dbc28aaa
CD
6022 (tags-todo "home")
6023 (tags "garden"
4009494e
GM
6024 ((org-agenda-sorting-strategy '(priority-up)))))
6025 ((org-agenda-sorting-strategy '(priority-down))))
6026 ("o" "Agenda and Office-related tasks"
6027 ((agenda)
dbc28aaa
CD
6028 (tags-todo "work")
6029 (tags "office")))))
4009494e
GM
6030@end group
6031@end lisp
6032
6033As you see, the values and parenthesis setting is a little complex.
6034When in doubt, use the customize interface to set this variable - it
6035fully supports its structure. Just one caveat: When setting options in
6036this interface, the @emph{values} are just lisp expressions. So if the
6037value is a string, you need to add the double quotes around the value
6038yourself.
6039
6040
a7808fba 6041@node Exporting Agenda Views, Using the agenda elsewhere, Setting Options, Custom agenda views
4009494e
GM
6042@subsection Exporting Agenda Views
6043@cindex agenda views, exporting
6044
6045If you are away from your computer, it can be very useful to have a
a7808fba 6046printed version of some agenda views to carry around. Org mode can
4009494e 6047export custom agenda views as plain text, HTML@footnote{You need to
28a16a1b
CD
6048install Hrvoje Niksic' @file{htmlize.el}.} postscript, and iCalendar
6049files. If you want to do this only occasionally, use the command
4009494e
GM
6050
6051@table @kbd
6052@kindex C-x C-w
6053@item C-x C-w
6054@cindex exporting agenda views
6055@cindex agenda views, exporting
6056Write the agenda view to a file. Depending on the extension of the
6057selected file name, the view will be exported as HTML (extension
28a16a1b
CD
6058@file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
6059iCalendar (extension @file{.ics}), or plain text (any other extension).
6060Use the variable @code{org-agenda-exporter-settings} to
6061set options for @file{ps-print} and for @file{htmlize} to be used during
6062export, for example
6063
4009494e
GM
6064@lisp
6065(setq org-agenda-exporter-settings
6066 '((ps-number-of-columns 2)
6067 (ps-landscape-mode t)
6068 (htmlize-output-type 'css)))
6069@end lisp
6070@end table
6071
6072If you need to export certain agenda views frequently, you can associate
6073any custom agenda command with a list of output file names
6074@footnote{If you want to store standard views like the weekly agenda
6075or the global TODO list as well, you need to define custom commands for
28a16a1b 6076them in order to be able to specify file names.}. Here is an example
4009494e
GM
6077that first does define custom commands for the agenda and the global
6078todo list, together with a number of files to which to export them.
28a16a1b 6079Then we define two block agenda commands and specify file names for them
4009494e
GM
6080as well. File names can be relative to the current working directory,
6081or absolute.
6082
6083@lisp
6084@group
6085(setq org-agenda-custom-commands
6086 '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
6087 ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
6088 ("h" "Agenda and Home-related tasks"
28a16a1b 6089 ((agenda "")
dbc28aaa
CD
6090 (tags-todo "home")
6091 (tags "garden"))
4009494e
GM
6092 nil
6093 ("~/views/home.html"))
6094 ("o" "Agenda and Office-related tasks"
6095 ((agenda)
dbc28aaa
CD
6096 (tags-todo "work")
6097 (tags "office"))
4009494e 6098 nil
28a16a1b 6099 ("~/views/office.ps" "~/calendars/office.ics"))))
4009494e
GM
6100@end group
6101@end lisp
6102
6103The extension of the file name determines the type of export. If it is
a7808fba 6104@file{.html}, Org mode will use the @file{htmlize.el} package to convert
4009494e
GM
6105the buffer to HTML and save it to this file name. If the extension is
6106@file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
28a16a1b
CD
6107postscript output. If the extension is @file{.ics}, iCalendar export is
6108run export over all files that were used to construct the agenda, and
6109limit the export to entries listed in the agenda now. Any other
6110extension produces a plain ASCII file.
4009494e
GM
6111
6112The export files are @emph{not} created when you use one of those
28a16a1b
CD
6113commands interactively because this might use too much overhead.
6114Instead, there is a special command to produce @emph{all} specified
6115files in one step:
4009494e
GM
6116
6117@table @kbd
6118@kindex C-c a e
6119@item C-c a e
28a16a1b 6120Export all agenda views that have export file names associated with
4009494e
GM
6121them.
6122@end table
6123
6124You can use the options section of the custom agenda commands to also
6125set options for the export commands. For example:
6126
6127@lisp
6128(setq org-agenda-custom-commands
6129 '(("X" agenda ""
6130 ((ps-number-of-columns 2)
6131 (ps-landscape-mode t)
6132 (org-agenda-prefix-format " [ ] ")
6133 (org-agenda-with-colors nil)
6134 (org-agenda-remove-tags t))
6135 ("theagenda.ps"))))
6136@end lisp
6137
6138@noindent
6139This command sets two options for the postscript exporter, to make it
6140print in two columns in landscape format - the resulting page can be cut
6141in two and then used in a paper agenda. The remaining settings modify
6142the agenda prefix to omit category and scheduling information, and
6143instead include a checkbox to check off items. We also remove the tags
6144to make the lines compact, and we don't want to use colors for the
6145black-and-white printer. Settings specified in
6146@code{org-agenda-exporter-settings} will also apply, but the settings
6147in @code{org-agenda-custom-commands} take precedence.
6148
6149@noindent
6150From the command line you may also use
6151@example
6152emacs -f org-batch-store-agenda-views -kill
6153@end example
6154@noindent
6155or, if you need to modify some parameters
6156@example
6157emacs -eval '(org-batch-store-agenda-views \
6158 org-agenda-ndays 30 \
dbc28aaa 6159 org-agenda-start-day "2007-11-01" \
4009494e
GM
6160 org-agenda-include-diary nil \
6161 org-agenda-files (quote ("~/org/project.org")))' \
6162 -kill
6163@end example
6164@noindent
6165which will create the agenda views restricted to the file
6166@file{~/org/project.org}, without diary entries and with 30 days
28a16a1b 6167extent.
4009494e 6168
a7808fba
CD
6169@node Using the agenda elsewhere, , Exporting Agenda Views, Custom agenda views
6170@subsection Using agenda information outside of Org
4009494e
GM
6171@cindex agenda, pipe
6172@cindex Scripts, for agenda processing
6173
a7808fba 6174Org provides commands to access agenda information for the command
4009494e
GM
6175line in emacs batch mode. This extracted information can be sent
6176directly to a printer, or it can be read by a program that does further
6177processing of the data. The first of these commands is the function
6178@code{org-batch-agenda}, that produces an agenda view and sends it as
6179ASCII text to STDOUT. The command takes a single string as parameter.
6180If the string has length 1, it is used as a key to one of the commands
6181you have configured in @code{org-agenda-custom-commands}, basically any
6182key you can use after @kbd{C-c a}. For example, to directly print the
6183current TODO list, you could use
6184
6185@example
6186emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
6187@end example
6188
6189If the parameter is a string with 2 or more characters, it is used as a
6190tags/todo match string. For example, to print your local shopping list
6191(all items with the tag @samp{shop}, but excluding the tag
6192@samp{NewYork}), you could use
6193
6194@example
28a16a1b 6195emacs -batch -l ~/.emacs \
4009494e
GM
6196 -eval '(org-batch-agenda "+shop-NewYork")' | lpr
6197@end example
6198
6199@noindent
6200You may also modify parameters on the fly like this:
6201
6202@example
6203emacs -batch -l ~/.emacs \
6204 -eval '(org-batch-agenda "a" \
6205 org-agenda-ndays 30 \
6206 org-agenda-include-diary nil \
6207 org-agenda-files (quote ("~/org/project.org")))' \
6208 | lpr
6209@end example
6210
6211@noindent
6212which will produce a 30 day agenda, fully restricted to the Org file
6213@file{~/org/projects.org}, not even including the diary.
6214
6215If you want to process the agenda data in more sophisticated ways, you
6216can use the command @code{org-batch-agenda-csv} to get a comma-separated
6217list of values for each agenda item. Each line in the output will
6218contain a number of fields separated by commas. The fields in a line
6219are:
6220
6221@example
6222category @r{The category of the item}
6223head @r{The headline, without TODO kwd, TAGS and PRIORITY}
6224type @r{The type of the agenda entry, can be}
6225 todo @r{selected in TODO match}
6226 tagsmatch @r{selected in tags match}
6227 diary @r{imported from diary}
6228 deadline @r{a deadline}
6229 scheduled @r{scheduled}
6230 timestamp @r{appointment, selected by timestamp}
6231 closed @r{entry was closed on date}
6232 upcoming-deadline @r{warning about nearing deadline}
6233 past-scheduled @r{forwarded scheduled item}
6234 block @r{entry has date block including date}
a7808fba 6235todo @r{The TODO keyword, if any}
4009494e
GM
6236tags @r{All tags including inherited ones, separated by colons}
6237date @r{The relevant date, like 2007-2-14}
6238time @r{The time, like 15:00-16:50}
6239extra @r{String with extra planning info}
6240priority-l @r{The priority letter if any was given}
6241priority-n @r{The computed numerical priority}
6242@end example
6243
6244@noindent
6245Time and date will only be given if a timestamp (or deadline/scheduled)
6246lead to the selection of the item.
6247
6248A CSV list like this is very easy to use in a post processing script.
6249For example, here is a Perl program that gets the TODO list from
a7808fba 6250Emacs/Org and prints all the items, preceded by a checkbox:
4009494e
GM
6251
6252@example
6253@group
6254#!/usr/bin/perl
6255
6256# define the Emacs command to run
6257$cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
6258
6259# run it and capture the output
6260$agenda = qx@{$cmd 2>/dev/null@};
6261
6262# loop over all lines
6263foreach $line (split(/\n/,$agenda)) @{
6264
6265 # get the individual values
6266 ($category,$head,$type,$todo,$tags,$date,$time,$extra,
6267 $priority_l,$priority_n) = split(/,/,$line);
6268
6269 # proccess and print
6270 print "[ ] $head\n";
6271@}
6272@end group
6273@end example
6274
a7808fba
CD
6275@node Agenda column view, , Custom agenda views, Agenda Views
6276@section Using column view in the agenda
6277@cindex column view, in agenda
6278@cindex agenda, column view
6279
6280Column view (@pxref{Column view}) is normally used to view and edit
6281properties embedded in the hierarchical structure of an Org file. It can be
6282quite useful to use column view also from the agenda, where entries are
6283collected by certain criteria.
6284
6285@table @kbd
6286@kindex C-c C-x C-c
6287@item C-c C-x C-c
6288Turn on column view in the agenda.
6289@end table
6290
6291To understand how to use this properly, it is important to realize that the
6292entries in the agenda are no longer in their proper outline environment.
6293This causes the following issues:
6294
6295@enumerate
6296@item
6297Org needs to make a decision which @code{COLUMNS} format to use. Since the
6298entries in the agenda are collected from different files, and different files
6299may have different @code{COLUMNS} formats, this is a non-trivial problem.
6300Org first checks if the variable @code{org-overriding-columns-format} is
6301currently set, and if yes takes the format from there. Otherwise it takes
6302the format associated with the first item in the agenda, or, if that item
6303does not have a specific format (defined in a property, or in it's file), it
6304uses @code{org-columns-default-format}.
6305@item
6306If any of the columns has a summary type defined (@pxref{Column attributes}),
6307turning on column view in the agenda will visit all relevant agenda files and
6308make sure that the computations of this property are up to date. This is
6309also true for the special @code{CLOCKSUM} property. Org will then sum the
6310values displayed in the agenda. In the daily/weekly agenda, the sums will
6311cover a single day, in all other views they cover the entire block. It is
6312vital to realize that the agenda may show the same entry @emph{twice} (for
6313example as scheduled and as a deadline), and it may show two entries from the
6314same hierarchy (for example a @emph{parent} and it's @emph{child}). In these
6315cases, the summation in the agenda will lead to incorrect results because
6316some values will count double.
6317@item
6318When the column view in the agenda shows the @code{CLOCKSUM}, that is always
6319the entire clocked time for this item. So even in the daily/weekly agenda,
6320the clocksum listed in column view may originate from times outside the
6321current view. This has the advantage that you can compare these values with
6322a column listing the planned total effort for a task - one of the major
6323applications for column view in the agenda. If you want information about
6324clocked time in the displayed period use clock table mode (press @kbd{R} in
6325the agenda).
6326@end enumerate
6327
6328
6329@node Embedded LaTeX, Exporting, Agenda Views, Top
4009494e
GM
6330@chapter Embedded LaTeX
6331@cindex @TeX{} interpretation
6332@cindex La@TeX{} interpretation
6333
6334Plain ASCII is normally sufficient for almost all note taking. One
a7808fba
CD
6335exception, however, are scientific notes which need to be able to contain
6336mathematical symbols and the occasional formula. La@TeX{}@footnote{La@TeX{}
6337is a macro system based on Donald E. Knuth's @TeX{} system. Many of the
6338features described here as ``La@TeX{}'' are really from @TeX{}, but for
6339simplicity I am blurring this distinction.} is widely used to typeset
6340scientific documents. Org mode supports embedding La@TeX{} code into its
6341files, because many academics are used to reading La@TeX{} source code, and
6342because it can be readily processed into images for HTML production.
4009494e
GM
6343
6344It is not necessary to mark La@TeX{} macros and code in any special way.
a7808fba 6345If you observe a few conventions, Org mode knows how to find it and what
4009494e
GM
6346to do with it.
6347
6348@menu
6349* Math symbols:: TeX macros for symbols and Greek letters
a7808fba 6350* Subscripts and superscripts:: Simple syntax for raising/lowering text
4009494e
GM
6351* LaTeX fragments:: Complex formulas made easy
6352* Processing LaTeX fragments:: Previewing LaTeX processing
6353* CDLaTeX mode:: Speed up entering of formulas
6354@end menu
6355
a7808fba 6356@node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
4009494e
GM
6357@section Math symbols
6358@cindex math symbols
6359@cindex TeX macros
6360
6361You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
6362to indicate the Greek letter, or @samp{\to} to indicate an arrow.
6363Completion for these macros is available, just type @samp{\} and maybe a
6364few letters, and press @kbd{M-@key{TAB}} to see possible completions.
a7808fba 6365Unlike La@TeX{} code, Org mode allows these macros to be present
4009494e
GM
6366without surrounding math delimiters, for example:
6367
6368@example
6369Angles are written as Greek letters \alpha, \beta and \gamma.
6370@end example
6371
6372During HTML export (@pxref{HTML export}), these symbols are translated
6373into the proper syntax for HTML, for the above examples this is
6374@samp{&alpha;} and @samp{&rarr;}, respectively.
6375
a7808fba
CD
6376@node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
6377@section Subscripts and superscripts
4009494e
GM
6378@cindex subscript
6379@cindex superscript
6380
6381Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
6382and subscripts. Again, these can be used without embedding them in
6383math-mode delimiters. To increase the readability of ASCII text, it is
6384not necessary (but OK) to surround multi-character sub- and superscripts
6385with curly braces. For example
6386
6387@example
6388The mass if the sun is M_sun = 1.989 x 10^30 kg. The radius of
6389the sun is R_@{sun@} = 6.96 x 10^8 m.
6390@end example
6391
6392To avoid interpretation as raised or lowered text, you can quote
6393@samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
6394
6395During HTML export (@pxref{HTML export}), subscript and superscripts
6396are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
6397
a7808fba 6398@node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
4009494e
GM
6399@section LaTeX fragments
6400@cindex LaTeX fragments
6401
6402With symbols, sub- and superscripts, HTML is pretty much at its end when
6403it comes to representing mathematical formulas@footnote{Yes, there is
6404MathML, but that is not yet fully supported by many browsers, and there
6405is no decent converter for turning La@TeX{} or ASCII representations of
6406formulas into MathML. So for the time being, converting formulas into
6407images seems the way to go.}. More complex expressions need a dedicated
a7808fba 6408formula processor. To this end, Org mode can contain arbitrary La@TeX{}
4009494e
GM
6409fragments. It provides commands to preview the typeset result of these
6410fragments, and upon export to HTML, all fragments will be converted to
6411images and inlined into the HTML document@footnote{The La@TeX{} export
6412will not use images for displaying La@TeX{} fragments but include these
6413fragments directly into the La@TeX{} code.}. For this to work you
6414need to be on a system with a working La@TeX{} installation. You also
6415need the @file{dvipng} program, available at
6416@url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
6417will be used when processing a fragment can be configured with the
6418variable @code{org-format-latex-header}.
6419
6420La@TeX{} fragments don't need any special marking at all. The following
6421snippets will be identified as La@TeX{} source code:
6422@itemize @bullet
6423@item
6424Environments of any kind. The only requirement is that the
6425@code{\begin} statement appears on a new line, preceded by only
6426whitespace.
6427@item
6428Text within the usual La@TeX{} math delimiters. To avoid conflicts with
6429currency specifications, single @samp{$} characters are only recognized
6430as math delimiters if the enclosed text contains at most two line breaks,
6431is directly attached to the @samp{$} characters with no whitespace in
6432between, and if the closing @samp{$} is followed by whitespace or
6433punctuation. For the other delimiters, there is no such restriction, so
6434when in doubt, use @samp{\(...\)} as inline math delimiters.
6435@end itemize
6436
6437@noindent For example:
6438
6439@example
6440\begin@{equation@} % arbitrary environments,
6441x=\sqrt@{b@} % even tables, figures
6442\end@{equation@} % etc
6443
6444If $a^2=b$ and \( b=2 \), then the solution must be
6445either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
6446@end example
6447
6448@noindent
6449If you need any of the delimiter ASCII sequences for other purposes, you
6450can configure the option @code{org-format-latex-options} to deselect the
6451ones you do not wish to have interpreted by the La@TeX{} converter.
6452
6453@node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
6454@section Processing LaTeX fragments
6455@cindex LaTeX fragments, preview
6456
6457La@TeX{} fragments can be processed to produce a preview images of the
6458typeset expressions:
6459
6460@table @kbd
6461@kindex C-c C-x C-l
6462@item C-c C-x C-l
6463Produce a preview image of the La@TeX{} fragment at point and overlay it
6464over the source code. If there is no fragment at point, process all
6465fragments in the current entry (between two headlines). When called
6466with a prefix argument, process the entire subtree. When called with
6467two prefix arguments, or when the cursor is before the first headline,
6468process the entire buffer.
6469@kindex C-c C-c
6470@item C-c C-c
6471Remove the overlay preview images.
6472@end table
6473
6474During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
6475converted into images and inlined into the document if the following
6476setting is active:
6477
6478@lisp
6479(setq org-export-with-LaTeX-fragments t)
6480@end lisp
6481
6482@node CDLaTeX mode, , Processing LaTeX fragments, Embedded LaTeX
6483@section Using CDLaTeX to enter math
6484@cindex CDLaTeX
6485
a7808fba 6486CDLaTeX mode is a minor mode that is normally used in combination with a
4009494e 6487major La@TeX{} mode like AUCTeX in order to speed-up insertion of
a7808fba
CD
6488environments and math templates. Inside Org mode, you can make use of
6489some of the features of CDLaTeX mode. You need to install
4009494e
GM
6490@file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
6491AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
a7808fba
CD
6492Don't use CDLaTeX mode itself under Org mode, but use the light
6493version @code{org-cdlatex-mode} that comes as part of Org mode. Turn it
4009494e 6494on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
a7808fba 6495Org files with
4009494e
GM
6496
6497@lisp
6498(add-hook 'org-mode-hook 'turn-on-org-cdlatex)
6499@end lisp
6500
6501When this mode is enabled, the following features are present (for more
a7808fba 6502details see the documentation of CDLaTeX mode):
4009494e
GM
6503@itemize @bullet
6504@kindex C-c @{
6505@item
6506Environment templates can be inserted with @kbd{C-c @{}.
6507@item
6508@kindex @key{TAB}
6509The @key{TAB} key will do template expansion if the cursor is inside a
a7808fba 6510La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
4009494e
GM
6511inside such a fragment, see the documentation of the function
6512@code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will
6513expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
6514correctly inside the first brace. Another @key{TAB} will get you into
6515the second brace. Even outside fragments, @key{TAB} will expand
6516environment abbreviations at the beginning of a line. For example, if
6517you write @samp{equ} at the beginning of a line and press @key{TAB},
6518this abbreviation will be expanded to an @code{equation} environment.
6519To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
6520@item
6521@kindex _
6522@kindex ^
6523Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
6524characters together with a pair of braces. If you use @key{TAB} to move
6525out of the braces, and if the braces surround only a single character or
6526macro, they are removed again (depending on the variable
6527@code{cdlatex-simplify-sub-super-scripts}).
6528@item
6529@kindex `
6530Pressing the backquote @kbd{`} followed by a character inserts math
6531macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds
6532after the backquote, a help window will pop up.
6533@item
6534@kindex '
6535Pressing the normal quote @kbd{'} followed by another character modifies
6536the symbol before point with an accent or a font. If you wait more than
65371.5 seconds after the backquote, a help window will pop up. Character
6538modification will work only inside La@TeX{} fragments, outside the quote
6539is normal.
6540@end itemize
6541
6542@node Exporting, Publishing, Embedded LaTeX, Top
6543@chapter Exporting
6544@cindex exporting
6545
a7808fba 6546Org mode documents can be exported into a variety of other formats. For
4009494e 6547printing and sharing of notes, ASCII export produces a readable and
a7808fba 6548simple version of an Org file. HTML export allows you to publish a
4009494e
GM
6549notes file on the web, while the XOXO format provides a solid base for
6550exchange with a broad range of other applications. La@TeX{} export lets
a7808fba 6551you use Org mode and its structured editing functions to easily create
4009494e
GM
6552La@TeX{} files. To incorporate entries with associated times like
6553deadlines or appointments into a desktop calendar program like iCal,
a7808fba
CD
6554Org mode can also produce extracts in the iCalendar format. Currently
6555Org mode only supports export, not import of these different formats.
4009494e 6556
a7808fba 6557When exporting, Org mode uses special conventions to enrich the output
4009494e
GM
6558produced. @xref{Text interpretation}, for more details.
6559
6560@table @kbd
6561@kindex C-c C-e
6562@item C-c C-e
6563Dispatcher for export and publishing commands. Displays a help-window
6564listing the additional key(s) needed to launch an export or publishing
a7808fba
CD
6565command. The prefix arg is passed through to the exporter. If the option
6566@code{org-export-run-in-background} is set, Org will run the command in the
6567background if that seems useful for the specific command (i.e. commands that
6568write to a file).
6569@kindex C-u C-u C-c C-e
6570@item C-u C-u C-c C-e
6571Call an the exporter, but reverse the setting of
6572@code{org-export-run-in-background}, i.e. request background processing if
6573not set, or force processing in the current Emacs process if st.
4009494e
GM
6574@end table
6575
6576@menu
6577* ASCII export:: Exporting to plain ASCII
6578* HTML export:: Exporting to HTML
6579* LaTeX export:: Exporting to LaTeX
6580* XOXO export:: Exporting to XOXO
6581* iCalendar export:: Exporting in iCalendar format
6582* Text interpretation:: How the exporter looks at the file
6583@end menu
6584
6585@node ASCII export, HTML export, Exporting, Exporting
6586@section ASCII export
6587@cindex ASCII export
6588
a7808fba 6589ASCII export produces a simple and very readable version of an Org mode
4009494e
GM
6590file.
6591
6592@cindex region, active
6593@cindex active region
a7808fba 6594@cindex Transient mark mode
4009494e
GM
6595@table @kbd
6596@kindex C-c C-e a
6597@item C-c C-e a
6598Export as ASCII file. For an org file @file{myfile.org}, the ASCII file
6599will be @file{myfile.txt}. The file will be overwritten without
6600warning. If there is an active region, only the region will be
6601exported. If the selected region is a single tree, the tree head will
6602become the document title. If the tree head entry has or inherits an
dbc28aaa 6603@code{:EXPORT_FILE_NAME:} property, that name will be used for the
28a16a1b 6604export.
4009494e
GM
6605@kindex C-c C-e v a
6606@item C-c C-e v a
6607Export only the visible part of the document.
6608@end table
6609
6610@cindex headline levels, for exporting
6611In the exported version, the first 3 outline levels will become
6612headlines, defining a general document structure. Additional levels
6613will be exported as itemized lists. If you want that transition to occur
6614at a different level, specify it with a prefix argument. For example,
6615
6616@example
6617@kbd{C-1 C-c C-e a}
6618@end example
6619
6620@noindent
6621creates only top level headlines and does the rest as items. When
6622headlines are converted to items, the indentation of the text following
6623the headline is changed to fit nicely under the item. This is done with
a7808fba 6624the assumption that the first body line indicates the base indentation of
4009494e
GM
6625the body text. Any indentation larger than this is adjusted to preserve
6626the layout relative to the first line. Should there be lines with less
6627indentation than the first, these are left alone.
6628
6629@node HTML export, LaTeX export, ASCII export, Exporting
6630@section HTML export
6631@cindex HTML export
6632
a7808fba 6633Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
4009494e
GM
6634HTML formatting, in ways similar to John Grubers @emph{markdown}
6635language, but with additional support for tables.
6636
6637@menu
6638* HTML Export commands:: How to invoke LaTeX export
a7808fba 6639* Quoting HTML tags:: Using direct HTML in Org mode
4009494e
GM
6640* Links:: Transformation of links for HTML
6641* Images:: How to include images
a7808fba
CD
6642* CSS support:: Changing the appearance of the output
6643* Javascript support:: Info and Folding in a web browser
4009494e
GM
6644@end menu
6645
6646@node HTML Export commands, Quoting HTML tags, HTML export, HTML export
6647@subsection HTML export commands
6648
6649@cindex region, active
6650@cindex active region
a7808fba 6651@cindex Transient mark mode
4009494e
GM
6652@table @kbd
6653@kindex C-c C-e h
6654@item C-c C-e h
6655Export as HTML file @file{myfile.html}. For an org file
6656@file{myfile.org}, the ASCII file will be @file{myfile.html}. The file
6657will be overwritten without warning. If there is an active region, only
6658the region will be exported. If the selected region is a single tree,
6659the tree head will become the document title. If the tree head entry
dbc28aaa
CD
6660has or inherits an @code{:EXPORT_FILE_NAME:} property, that name will be
6661used for the export.
4009494e
GM
6662@kindex C-c C-e b
6663@item C-c C-e b
6664Export as HTML file and immediately open it with a browser.
6665@kindex C-c C-e H
6666@item C-c C-e H
6667Export to a temporary buffer, do not create a file.
6668@kindex C-c C-e R
dbc28aaa 6669@item C-c C-e R
a7808fba
CD
6670Export the active region to a temporary buffer. With a prefix argument, do
6671not produce the file header and footer, but just the plain HTML section for
6672the region. This is good for cut-and-paste operations.
4009494e
GM
6673@kindex C-c C-e v h
6674@kindex C-c C-e v b
6675@kindex C-c C-e v H
6676@kindex C-c C-e v R
6677@item C-c C-e v h
6678@item C-c C-e v b
6679@item C-c C-e v H
6680@item C-c C-e v R
6681Export only the visible part of the document.
6682@item M-x org-export-region-as-html
a7808fba 6683Convert the region to HTML under the assumption that it was Org mode
4009494e
GM
6684syntax before. This is a global command that can be invoked in any
6685buffer.
6686@item M-x org-replace-region-by-HTML
a7808fba 6687Replace the active region (assumed to be in Org mode syntax) by HTML
4009494e
GM
6688code.
6689@end table
6690
6691@cindex headline levels, for exporting
a7808fba
CD
6692In the exported version, the first 3 outline levels will become headlines,
6693defining a general document structure. Additional levels will be exported as
6694itemized lists. If you want that transition to occur at a different level,
6695specify it with a numeric prefix argument. For example,
4009494e
GM
6696
6697@example
6698@kbd{C-2 C-c C-e b}
6699@end example
6700
6701@noindent
6702creates two levels of headings and does the rest as items.
6703
6704@node Quoting HTML tags, Links, HTML Export commands, HTML export
6705@subsection Quoting HTML tags
6706
6707Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
6708@samp{&gt;} in HTML export. If you want to include simple HTML tags
6709which should be interpreted as such, mark them with @samp{@@} as in
6710@samp{@@<b>bold text@@</b>}. Note that this really works only for
6711simple tags. For more extensive HTML that should be copied verbatim to
6712the exported file use either
6713
6714@example
6715#+HTML: Literal HTML code for export
6716@end example
6717
6718@noindent or
6719
6720@example
6721#+BEGIN_HTML
6722All lines between these markers are exported literally
6723#+END_HTML
6724@end example
6725
6726
6727@node Links, Images, Quoting HTML tags, HTML export
6728@subsection Links
6729
6730@cindex links, in HTML export
6731@cindex internal links, in HTML export
6732@cindex external links, in HTML export
6733Internal links (@pxref{Internal links}) will continue to work in HTML
6734files only if they match a dedicated @samp{<<target>>}. Automatic links
6735created by radio targets (@pxref{Radio targets}) will also work in the
6736HTML file. Links to external files will still work if the HTML file is
a7808fba 6737in the same directory as the Org file. Links to other @file{.org}
4009494e
GM
6738files will be translated into HTML links under the assumption that an
6739HTML version also exists of the linked file. For information related to
6740linking files while publishing them to a publishing directory see
6741@ref{Publishing links}.
6742
6743@node Images, CSS support, Links, HTML export
6744@subsection Images
6745
6746@cindex images, inline in HTML
6747@cindex inlining images in HTML
a7808fba 6748HTML export can inline images given as links in the Org file, and
4009494e
GM
6749it can make an image the clickable part of a link. By
6750default@footnote{but see the variable
6751@code{org-export-html-inline-images}}, images are inlined if a link does
6752not have a description. So @samp{[[file:myimg.jpg]]} will be inlined,
6753while @samp{[[file:myimg.jpg][the image]]} will just produce a link
6754@samp{the image} that points to the image. If the description part
6755itself is a @code{file:} link or a @code{http:} URL pointing to an
6756image, this image will be inlined and activated so that clicking on the
6757image will activate the link. For example, to include a thumbnail that
6758will link to a high resolution version of the image, you could use:
6759
6760@example
6761[[file:highres.jpg][file:thumb.jpg]]
6762@end example
6763
6764@noindent
6765and you could use @code{http} addresses just as well.
6766
a7808fba 6767@node CSS support, Javascript support, Images, HTML export
4009494e 6768@subsection CSS support
a7808fba
CD
6769@cindex CSS, for HTML export
6770@cindex HTML export, CSS
4009494e
GM
6771
6772You can also give style information for the exported file. The HTML
6773exporter assigns the following CSS classes to appropriate parts of the
6774document - your style specifications may change these:
6775@example
6776.todo @r{TODO keywords}
6777.done @r{the DONE keyword}
6778.timestamp @r{time stamp}
6779.timestamp-kwd @r{keyword associated with a time stamp, like SCHEDULED}
6780.tag @r{tag in a headline}
6781.target @r{target for links}
6782@end example
6783
6784The default style specification can be configured through the option
6785@code{org-export-html-style}. If you want to use a file-local style,
6786you may use file variables, best wrapped into a COMMENT section at the
6787end of the outline tree. For example@footnote{Under Emacs 21, the
6788continuation lines for a variable value should have no @samp{#} at the
6789start of the line.}:
6790
6791@example
6792* COMMENT html style specifications
6793
6794# Local Variables:
6795# org-export-html-style: " <style type=\"text/css\">
6796# p @{font-weight: normal; color: gray; @}
6797# h1 @{color: black; @}
6798# </style>"
6799# End:
6800@end example
6801
6802Remember to execute @kbd{M-x normal-mode} after changing this to make
a7808fba 6803the new style visible to Emacs. This command restarts Org mode for the
4009494e
GM
6804current buffer and forces Emacs to re-evaluate the local variables
6805section in the buffer.
6806
6807@c FIXME: More about header and footer styles
6808@c FIXME: Talk about links and targets.
6809
a7808fba
CD
6810@node Javascript support, , CSS support, HTML export
6811@subsection Javascript supported display of web pages
6812
6813@emph{Sebastian Rose} has written a JavaScript program especially designed to
6814enhance the web viewing experience of HTML files created with Org. This
6815program allows to view large files in two different ways. The first one is
6816an @emph{Info}-like mode where each section is displayed separately and
6817navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
6818as well, press @kbd{?} for an overview of the available keys). The second
6819view type is a @emph{folding} view much like Org provides it inside Emacs.
6820The script is available at @url{http://orgmode.org/org-info.js} and you can
6821find the documentation for it at @url{http://orgmode.org/org-infojs.html}.
6822We are serving the script from our site, but if you use it a lot, you might
6823not want to be dependent on @url{orgmode.org} and prefer to install a local
6824copy on your own web server.
6825
6826To use the script, you need to make sure that the @file{org-infojs.el} module
6827gets loaded. It should be loaded by default, try @kbd{M-x customize-variable
6828@key{RET} org-modules @key{RET}} to convince yourself that this is indeed the
6829case. All it then takes to make use of the program is adding a single line
6830to the Org file:
6831
6832@example
6833#+INFOSJ_OPT: view:info toc:nil
6834@end example
6835
6836@noindent
6837If this line is found, the HTML header will automatically contain the code
6838needed to invoke the script. Using the line above, you can set the following
6839viewing options:
6840
6841@example
6842path: @r{The path to the script. The default is to grab the script from}
6843 @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
6844 @r{a local copy and use a path like @samp{../scripts/org-info.js}.}
6845view: @r{Initial view when website is first shown. Possible values are}
6846 info @r{Info-like interface with one section per page.}
6847 overview @r{Folding interface, initially showing only top-level.}
6848 content @r{Folding interface, starting with all headlines visible.}
6849 showall @r{Folding interface, all headlines and text visible.}
6850sdepth: @r{Maximum headline level that will still become an independent}
6851 @r{section for info and folding modes. The default is taken from}
6852 @r{@code{org-headline-levels} (= the @code{H} switch in @code{#+OPTIONS}).}
6853 @r{If this is smaller than in @code{org-headline-levels}, each}
6854 @r{info/folding section can still contain children headlines.}
6855toc: @r{Should the table of content @emph{initially} be visible?}
6856 @r{Even when @code{nil}, you can always get to the toc with @kbd{i}.}
6857tdepth: @r{The depth of the table of contents. The defaults are taken from}
6858 @r{the variables @code{org-headline-levels} and @code{org-export-with-toc}.}
6859ltoc: @r{Should there be short contents (children) in each section?}
6860mouse: @r{Headings are highlighted when the mouse is over them. Should be}
6861 @r{@samp{underline} (default) or a background color like @samp{#cccccc}.}
6862buttons: @r{Should view-toggle buttons be everywhere? When @code{nil} (the}
6863 @r{default), only one such button will be present.}
6864@end example
6865
6866You can choose default values for these options by customizing the variable
6867@code{org-infojs-options}. If you always want to apply the script to your
6868pages, configure the variable @code{org-export-html-use-infojs}.
6869
4009494e
GM
6870@node LaTeX export, XOXO export, HTML export, Exporting
6871@section LaTeX export
6872@cindex LaTeX export
6873
a7808fba 6874Org mode contains a La@TeX{} exporter written by Bastien Guerry.
4009494e
GM
6875
6876@menu
6877* LaTeX export commands:: How to invoke LaTeX export
6878* Quoting LaTeX code:: Incorporating literal LaTeX code
a7808fba 6879* Sectioning structure:: Changing sectioning in LaTeX output
4009494e
GM
6880@end menu
6881
6882@node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
6883@subsection LaTeX export commands
6884
6885@table @kbd
6886@kindex C-c C-e l
6887@item C-c C-e l
6888Export as La@TeX{} file @file{myfile.tex}.
6889@kindex C-c C-e L
6890@item C-c C-e L
6891Export to a temporary buffer, do not create a file.
6892@kindex C-c C-e v l
6893@kindex C-c C-e v L
6894@item C-c C-e v l
6895@item C-c C-e v L
6896Export only the visible part of the document.
6897@item M-x org-export-region-as-latex
a7808fba 6898Convert the region to La@TeX{} under the assumption that it was Org mode
4009494e
GM
6899syntax before. This is a global command that can be invoked in any
6900buffer.
6901@item M-x org-replace-region-by-latex
a7808fba 6902Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
4009494e
GM
6903code.
6904@end table
6905
6906@cindex headline levels, for exporting
6907In the exported version, the first 3 outline levels will become
6908headlines, defining a general document structure. Additional levels
6909will be exported as description lists. The exporter can ignore them or
6910convert them to a custom string depending on
6911@code{org-latex-low-levels}.
6912
6913If you want that transition to occur at a different level, specify it
a7808fba 6914with a numeric prefix argument. For example,
4009494e
GM
6915
6916@example
6917@kbd{C-2 C-c C-e l}
6918@end example
6919
6920@noindent
6921creates two levels of headings and does the rest as items.
6922
dbc28aaa 6923@node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export
4009494e
GM
6924@subsection Quoting LaTeX code
6925
6926Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
a7808fba 6927inserted into the La@TeX{} file. Furthermore, you can add special code
4009494e
GM
6928that should only be present in La@TeX{} export with the following
6929constructs:
6930
6931@example
6932#+LaTeX: Literal LaTeX code for export
6933@end example
6934
6935@noindent or
6936
6937@example
6938#+BEGIN_LaTeX
6939All lines between these markers are exported literally
6940#+END_LaTeX
6941@end example
dbc28aaa
CD
6942
6943
6944
6945@node Sectioning structure, , Quoting LaTeX code, LaTeX export
6946@subsection Sectioning structure
6947@cindex LaTeX class
6948@cindex LaTeX sectioning structure
6949
6950By default, the La@TeX{} output uses the class @code{article}.
6951
6952You can change this globally by setting a different value for
6953@code{org-export-latex-default-class} or locally by adding an option
6954like @code{#+LaTeX_CLASS: myclass} in your file. The class should be
6955listed in @code{org-export-latex-classes}, where you can also define the
6956sectioning structure for each class.
6957
6958
4009494e
GM
6959@node XOXO export, iCalendar export, LaTeX export, Exporting
6960@section XOXO export
6961@cindex XOXO export
6962
a7808fba 6963Org mode contains an exporter that produces XOXO-style output.
4009494e 6964Currently, this exporter only handles the general outline structure and
a7808fba 6965does not interpret any additional Org mode features.
4009494e
GM
6966
6967@table @kbd
6968@kindex C-c C-e x
6969@item C-c C-e x
6970Export as XOXO file @file{myfile.html}.
6971@kindex C-c C-e v
6972@item C-c C-e v x
6973Export only the visible part of the document.
6974@end table
6975
6976@node iCalendar export, Text interpretation, XOXO export, Exporting
6977@section iCalendar export
6978@cindex iCalendar export
6979
a7808fba 6980Some people like to use Org mode for keeping track of projects, but
4009494e
GM
6981still prefer a standard calendar application for anniversaries and
6982appointments. In this case it can be useful to have deadlines and
a7808fba
CD
6983other time-stamped items in Org files show up in the calendar
6984application. Org mode can export calendar information in the standard
4009494e
GM
6985iCalendar format. If you also want to have TODO entries included in the
6986export, configure the variable @code{org-icalendar-include-todo}.
6987
6988@table @kbd
6989@kindex C-c C-e i
6990@item C-c C-e i
6991Create iCalendar entries for the current file and store them in the same
6992directory, using a file extension @file{.ics}.
6993@kindex C-c C-e I
6994@item C-c C-e I
6995Like @kbd{C-c C-e i}, but do this for all files in
6996@code{org-agenda-files}. For each of these files, a separate iCalendar
6997file will be written.
6998@kindex C-c C-e c
6999@item C-c C-e c
7000Create a single large iCalendar file from all files in
7001@code{org-agenda-files} and write it to the file given by
7002@code{org-combined-agenda-icalendar-file}.
7003@end table
7004
dbc28aaa
CD
7005The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
7006the selected entries have them. If not, the summary will be derived
7007from the headline, and the description from the body (limited to
28a16a1b 7008@code{org-icalendar-include-body} characters).
dbc28aaa 7009
4009494e
GM
7010How this calendar is best read and updated, depends on the application
7011you are using. The FAQ covers this issue.
7012
7013
7014@node Text interpretation, , iCalendar export, Exporting
7015@section Text interpretation by the exporter
7016
a7808fba 7017The exporter backends interpret additional structure in the Org file
4009494e
GM
7018in order to produce better output.
7019
7020@menu
7021* Comment lines:: Some lines will not be exported
7022* Initial text:: Text before the first headline
7023* Footnotes:: Numbers like [1]
a7808fba 7024* Quoted examples:: Inserting quoted chunks of text
4009494e
GM
7025* Enhancing text:: Subscripts, symbols and more
7026* Export options:: How to influence the export settings
7027@end menu
7028
7029@node Comment lines, Initial text, Text interpretation, Text interpretation
7030@subsection Comment lines
7031@cindex comment lines
7032@cindex exporting, not
7033
7034Lines starting with @samp{#} in column zero are treated as comments
7035and will never be exported. Also entire subtrees starting with the
7036word @samp{COMMENT} will never be exported.
7037
7038@table @kbd
7039@kindex C-c ;
7040@item C-c ;
7041Toggle the COMMENT keyword at the beginning of an entry.
7042@end table
7043
7044@node Initial text, Footnotes, Comment lines, Text interpretation
7045@subsection Text before the first headline
7046
a7808fba 7047Org mode normally ignores any text before the first headline when
4009494e
GM
7048exporting, leaving this region for internal links to speed up navigation
7049etc. However, in publishing-oriented files, you might want to have some
7050text before the first headline, like a small introduction, special HTML
7051code with a navigation bar, etc. You can ask to have this part of the
7052file exported as well by setting the variable
7053@code{org-export-skip-text-before-1st-heading} to @code{nil}. On a
7054per-file basis, you can get the same effect with
7055
7056@example
7057#+OPTIONS: skip:nil
7058@end example
7059
7060The text before the first headline will be fully processed
7061(@pxref{Enhancing text}), and the first non-comment line becomes the
7062title of the exported document. If you need to include literal HTML,
7063use the special constructs described in @ref{Quoting HTML tags}. The
7064table of contents is normally inserted directly before the first
7065headline of the file. If you would like to get it to a different
7066location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by
7067itself at the desired location.
7068
7069Finally, if you want to use the space before the first headline for
7070internal purposes, but @emph{still} want to place something before the
7071first headline when exporting the file, you can use the @code{#+TEXT}
7072construct:
7073
7074@example
7075#+OPTIONS: skip:t
7076#+TEXT: This text will go before the *first* headline.
7077#+TEXT: We place the table of contents here:
7078#+TEXT: [TABLE-OF-CONTENTS]
7079#+TEXT: This goes between the table of contents and the first headline
7080@end example
7081
dbc28aaa 7082@node Footnotes, Quoted examples, Initial text, Text interpretation
4009494e
GM
7083@subsection Footnotes
7084@cindex footnotes
7085@cindex @file{footnote.el}
7086
7087Numbers in square brackets are treated as footnotes, so that you can use
7088the Emacs package @file{footnote.el} to create footnotes. For example:
7089
7090@example
a7808fba 7091The Org homepage[1] clearly needs help from
4009494e
GM
7092a good web designer.
7093
dbc28aaa 7094[1] The link is: http://orgmode.org
4009494e
GM
7095@end example
7096
7097@noindent
7098@kindex C-c !
7099Note that the @file{footnote} package uses @kbd{C-c !} to invoke its
a7808fba 7100commands. This binding conflicts with the Org mode command for
4009494e
GM
7101inserting inactive time stamps. You could use the variable
7102@code{footnote-prefix} to switch footnotes commands to another key. Or,
7103if you are too used to this binding, you could use
7104@code{org-replace-disputed-keys} and @code{org-disputed-keys} to change
a7808fba 7105the settings in Org.
4009494e 7106
dbc28aaa
CD
7107@node Quoted examples, Enhancing text, Footnotes, Text interpretation
7108@subsection Quoted examples
7109@cindex quoted examples
7110@cindex examples, quoted
7111@cindex text, fixed width
7112@cindex fixed width text
7113
7114When writing technical documents, you often need to insert examples that
a7808fba 7115are not further interpreted by Org mode. For historical reasons, there
dbc28aaa
CD
7116are several ways to do this:
7117
7118@itemize @bullet
7119@item
7120If a headline starts with the word @samp{QUOTE}, the text below the
7121headline will be typeset as fixed-width, to allow quoting of computer
7122codes etc.
7123@item
28a16a1b 7124Lines starting with @samp{:} are also typeset in fixed-width font.
dbc28aaa
CD
7125@table @kbd
7126@kindex C-c :
7127@item C-c :
7128Toggle fixed-width for entry (QUOTE) or region, see below.
7129@end table
7130@item
7131Finally, text between
7132@example
7133#+BEGIN_EXAMPLE
7134quoted text
7135#+END_EXAMPLE
7136@end example
7137will also be exported in this way.
7138@end itemize
7139
7140
7141@node Enhancing text, Export options, Quoted examples, Text interpretation
4009494e
GM
7142@subsection Enhancing text for export
7143@cindex enhancing text
7144@cindex richer text
7145
a7808fba 7146Some of the export backends of Org mode allow for sophisticated text
4009494e 7147formatting, this is true in particular for the HTML and La@TeX{}
a7808fba 7148backends. Org mode has a number of typing conventions that allow to
4009494e
GM
7149produce a richly formatted output.
7150
7151@itemize @bullet
7152
7153@cindex hand-formatted lists
7154@cindex lists, hand-formatted
7155@item
7156Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
7157or @samp{2)} as enumerator will be recognized and transformed if the
7158backend supports lists. See @xref{Plain lists}.
7159
7160@cindex underlined text
7161@cindex bold text
7162@cindex italic text
dbc28aaa 7163@cindex verbatim text
4009494e 7164@item
dbc28aaa
CD
7165You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
7166and @code{~verbatim~}, and, if you must, @samp{+strikethrough+}. Text
a7808fba 7167in the code and verbatim string is not processed for Org mode specific
dbc28aaa 7168syntax, it is exported verbatim.
4009494e
GM
7169
7170@cindex horizontal rules, in exported files
7171@item
7172A line consisting of only dashes, and at least 5 of them, will be
7173exported as a horizontal line (@samp{<hr/>} in HTML).
7174
7175@cindex LaTeX fragments, export
7176@cindex TeX macros, export
7177@item
7178Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML
7179entities or images (@pxref{Embedded LaTeX}).
7180
7181@cindex tables, export
7182@item
7183Tables are transformed into native tables under the exporter, if the
7184export backend supports this. Data fields before the first horizontal
7185separator line will be formatted as table header fields.
7186
7187@cindex fixed width
7188@item
7189If a headline starts with the word @samp{QUOTE}, the text below the
7190headline will be typeset as fixed-width, to allow quoting of computer
7191codes etc. Lines starting with @samp{:} are also typeset in fixed-width
28a16a1b 7192font.
4009494e
GM
7193@table @kbd
7194@kindex C-c :
7195@item C-c :
7196Toggle fixed-width for entry (QUOTE) or region, see below.
7197@end table
dbc28aaa
CD
7198Finally, text between
7199@example
7200#+BEGIN_EXAMPLE
7201quoted text
7202#+END_EXAMPLE
7203@end example
7204will also be exported in this way.
4009494e
GM
7205
7206@cindex linebreak, forced
28a16a1b 7207@item
4009494e
GM
7208A double backslash @emph{at the end of a line} enforces a line break at
7209this position.
dbc28aaa
CD
7210
7211@cindex HTML entities, LaTeX entities
7212@item
7213Strings like @code{\alpha} will be exported as @code{&alpha;}, in the
7214HTML output. These strings are exported as @code{$\alpha$} in the
7215La@TeX{} output. Similarly, @code{\nbsp} will become @code{&nbsp;} in
7216HTML and in La@TeX{}. This applies for a long list of entities, see
7217the variable @code{org-html-entities} for the complete list.
7218@c FIXME
4009494e
GM
7219@end itemize
7220
7221If these conversions conflict with your habits of typing ASCII text,
7222they can all be turned off with corresponding variables. See the
7223customization group @code{org-export-general}, and the following section
7224which explains how to set export options with special lines in a
7225buffer.
7226
7227
7228@node Export options, , Enhancing text, Text interpretation
7229@subsection Export options
7230@cindex options, for export
7231
7232@cindex completion, of option keywords
7233The exporter recognizes special lines in the buffer which provide
7234additional information. These lines may be put anywhere in the file.
7235The whole set of lines can be inserted into the buffer with @kbd{C-c
7236C-e t}. For individual lines, a good way to make sure the keyword is
7237correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
7238(@pxref{Completion}).
7239
7240@table @kbd
7241@kindex C-c C-e t
7242@item C-c C-e t
7243Insert template with export options, see example below.
7244@end table
7245
7246@example
7247#+TITLE: the title to be shown (default is the buffer name)
7248#+AUTHOR: the author (default taken from @code{user-full-name})
dbc28aaa 7249#+DATE: A date, fixed, of a format string for @code{format-time-string}
4009494e
GM
7250#+EMAIL: his/her email address (default from @code{user-mail-address})
7251#+LANGUAGE: language for HTML, e.g. @samp{en} (@code{org-export-default-language})
7252#+TEXT: Some descriptive text to be inserted at the beginning.
7253#+TEXT: Several lines may be given.
7254#+OPTIONS: H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
7255@end example
7256
7257@noindent
7258The OPTIONS line is a compact form to specify export settings. Here
7259you can:
7260@cindex headline levels
7261@cindex section-numbers
7262@cindex table of contents
7263@cindex linebreak preservation
7264@cindex quoted HTML tags
7265@cindex fixed-width sections
7266@cindex tables
7267@cindex @TeX{}-like syntax for sub- and superscripts
7268@cindex footnotes
dbc28aaa 7269@cindex special strings
4009494e
GM
7270@cindex emphasized text
7271@cindex @TeX{} macros
7272@cindex La@TeX{} fragments
7273@cindex author info, in export
7274@cindex time info, in export
7275@example
7276H: @r{set the number of headline levels for export}
7277num: @r{turn on/off section-numbers}
7278toc: @r{turn on/off table of contents, or set level limit (integer)}
7279\n: @r{turn on/off linebreak-preservation}
7280@@: @r{turn on/off quoted HTML tags}
7281:: @r{turn on/off fixed-width sections}
7282|: @r{turn on/off tables}
7283^: @r{turn on/off @TeX{}-like syntax for sub- and superscripts. If}
7284 @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
7285 @r{the simple @code{a_b} will be left as it is.}
dbc28aaa 7286-: @r{turn on/off conversion of special strings.}
4009494e
GM
7287f: @r{turn on/off foototes like this[1].}
7288*: @r{turn on/off emphasized text (bold, italic, underlined)}
7289TeX: @r{turn on/off simple @TeX{} macros in plain text}
7290LaTeX: @r{turn on/off La@TeX{} fragments}
7291skip: @r{turn on/off skipping the text before the first heading}
7292author: @r{turn on/off inclusion of author name/email into exported file}
7293timestamp: @r{turn on/off inclusion creation time into exported file}
dbc28aaa 7294d: @r{turn on/off inclusion of drawers}
4009494e
GM
7295@end example
7296
7297These options take effect in both the HTML and La@TeX{} export, except
7298for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
7299@code{nil} for the La@TeX{} export.
7300
7301@node Publishing, Miscellaneous, Exporting, Top
7302@chapter Publishing
7303@cindex publishing
7304
a7808fba 7305Org includes@footnote{@file{org-publish.el} is not distributed with
4009494e
GM
7306Emacs 21, if you are still using Emacs 21, you need you need to download
7307this file separately.} a publishing management system that allows you to
7308configure automatic HTML conversion of @emph{projects} composed of
7309interlinked org files. This system is called @emph{org-publish}. You can
7310also configure org-publish to automatically upload your exported HTML
7311pages and related attachments, such as images and source code files, to
a7808fba 7312a web server. Org-publish turns Org into a web-site authoring tool.
4009494e
GM
7313
7314You can also use Org-publish to convert files into La@TeX{}, or even
7315combine HTML and La@TeX{} conversion so that files are available in both
7316formats on the server@footnote{Since La@TeX{} files on a server are not
7317that helpful, you surely want to perform further conversion on them --
7318e.g. convert them to @code{PDF} format.}.
7319
a7808fba 7320Org-publish has been contributed to Org by David O'Toole.
4009494e
GM
7321
7322@menu
7323* Configuration:: Defining projects
7324* Sample configuration:: Example projects
7325* Triggering publication:: Publication commands
7326@end menu
7327
7328@node Configuration, Sample configuration, Publishing, Publishing
7329@section Configuration
7330
7331Publishing needs significant configuration to specify files, destination
7332and many other properties of a project.
7333
7334@menu
7335* Project alist:: The central configuration variable
7336* Sources and destinations:: From here to there
7337* Selecting files:: What files are part of the project?
7338* Publishing action:: Setting the function doing the publishing
7339* Publishing options:: Tweaking HTML export
7340* Publishing links:: Which links keep working after publishing?
7341* Project page index:: Publishing a list of project files
7342@end menu
7343
7344@node Project alist, Sources and destinations, Configuration, Configuration
7345@subsection The variable @code{org-publish-project-alist}
7346@cindex org-publish-project-alist
7347@cindex projects, for publishing
7348
7349Org-publish is configured almost entirely through setting the value of
7350one variable, called @code{org-publish-project-alist}.
7351Each element of the list configures one project, and may be in one of
7352the two following forms:
7353
7354@lisp
dbc28aaa 7355("project-name" :property value :property value ...)
4009494e 7356
28a16a1b
CD
7357@r{or}
7358
dbc28aaa 7359("project-name" :components ("project-name" "project-name" ...))
4009494e
GM
7360
7361@end lisp
7362
7363In both cases, projects are configured by specifying property values.
7364A project defines the set of files that will be published, as well as
7365the publishing configuration to use when publishing those files. When
7366a project takes the second form listed above, the individual members
7367of the ``components'' property are taken to be components of the
7368project, which group together files requiring different publishing
7369options. When you publish such a ``meta-project'' all the components
7370will also publish.
7371
7372@node Sources and destinations, Selecting files, Project alist, Configuration
7373@subsection Sources and destinations for files
7374@cindex directories, for publishing
7375
7376Most properties are optional, but some should always be set. In
7377particular, org-publish needs to know where to look for source files,
7378and where to put published files.
7379
7380@multitable @columnfractions 0.3 0.7
7381@item @code{:base-directory}
7382@tab Directory containing publishing source files
7383@item @code{:publishing-directory}
7384@tab Directory (possibly remote) where output files will be published.
7385@item @code{:preparation-function}
7386@tab Function called before starting publishing process, for example to
7387run @code{make} for updating files to be published.
7388@end multitable
7389@noindent
7390
7391@node Selecting files, Publishing action, Sources and destinations, Configuration
7392@subsection Selecting files
7393@cindex files, selecting for publishing
7394
7395By default, all files with extension @file{.org} in the base directory
7396are considered part of the project. This can be modified by setting the
28a16a1b 7397properties
4009494e
GM
7398@multitable @columnfractions 0.25 0.75
7399@item @code{:base-extension}
7400@tab Extension (without the dot!) of source files. This actually is a
7401regular expression.
7402
28a16a1b 7403@item @code{:exclude}
4009494e
GM
7404@tab Regular expression to match file names that should not be
7405published, even though they have been selected on the basis of their
7406extension.
7407
7408@item @code{:include}
7409@tab List of files to be included regardless of @code{:base-extension}
7410and @code{:exclude}.
7411@end multitable
7412
7413@node Publishing action, Publishing options, Selecting files, Configuration
a7808fba 7414@subsection Publishing action
4009494e
GM
7415@cindex action, for publishing
7416
7417Publishing means that a file is copied to the destination directory and
7418possibly transformed in the process. The default transformation is to
a7808fba 7419export Org files as HTML files, and this is done by the function
4009494e
GM
7420@code{org-publish-org-to-html} which calls the HTML exporter
7421(@pxref{HTML export}). But you also can publish your files in La@TeX{} by
7422using the function @code{org-publish-org-to-latex} instead. Other files
7423like images only need to be copied to the publishing destination. For
a7808fba 7424non-Org files, you need to specify the publishing function.
4009494e
GM
7425
7426
7427@multitable @columnfractions 0.3 0.7
7428@item @code{:publishing-function}
7429@tab Function executing the publication of a file. This may also be a
7430list of functions, which will all be called in turn.
7431@end multitable
7432
7433The function must accept two arguments: a property list containing at
7434least a @code{:publishing-directory} property, and the name of the file
7435to be published. It should take the specified file, make the necessary
7436transformation (if any) and place the result into the destination folder.
7437You can write your own publishing function, but @code{org-publish}
7438provides one for attachments (files that only need to be copied):
7439@code{org-publish-attachment}.
7440
7441@node Publishing options, Publishing links, Publishing action, Configuration
7442@subsection Options for the HTML/LaTeX exporters
7443@cindex options, for publishing
7444
7445The property list can be used to set many export options for the HTML
7446and La@TeX{} exporters. In most cases, these properties correspond to user
a7808fba 7447variables in Org. The table below lists these properties along
4009494e
GM
7448with the variable they belong to. See the documentation string for the
7449respective variable for details.
7450
7451@multitable @columnfractions 0.3 0.7
7452@item @code{:language} @tab @code{org-export-default-language}
7453@item @code{:headline-levels} @tab @code{org-export-headline-levels}
7454@item @code{:section-numbers} @tab @code{org-export-with-section-numbers}
7455@item @code{:table-of-contents} @tab @code{org-export-with-toc}
7456@item @code{:archived-trees} @tab @code{org-export-with-archived-trees}
7457@item @code{:emphasize} @tab @code{org-export-with-emphasize}
7458@item @code{:sub-superscript} @tab @code{org-export-with-sub-superscripts}
dbc28aaa 7459@item @code{:special-strings} @tab @code{org-export-with-special-strings}
4009494e
GM
7460@item @code{:TeX-macros} @tab @code{org-export-with-TeX-macros}
7461@item @code{:LaTeX-fragments} @tab @code{org-export-with-LaTeX-fragments}
7462@item @code{:fixed-width} @tab @code{org-export-with-fixed-width}
7463@item @code{:timestamps} .@tab @code{org-export-with-timestamps}
7464@item @code{:tags} .@tab @code{org-export-with-tags}
7465@item @code{:tables} @tab @code{org-export-with-tables}
7466@item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line}
7467@item @code{:style} @tab @code{org-export-html-style}
7468@item @code{:convert-org-links} @tab @code{org-export-html-link-org-files-as-html}
7469@item @code{:inline-images} @tab @code{org-export-html-inline-images}
7470@item @code{:expand-quoted-html} @tab @code{org-export-html-expand}
7471@item @code{:timestamp} @tab @code{org-export-html-with-timestamp}
7472@item @code{:publishing-directory} @tab @code{org-export-publishing-directory}
7473@item @code{:preamble} @tab @code{org-export-html-preamble}
7474@item @code{:postamble} @tab @code{org-export-html-postamble}
7475@item @code{:auto-preamble} @tab @code{org-export-html-auto-preamble}
7476@item @code{:auto-postamble} @tab @code{org-export-html-auto-postamble}
7477@item @code{:author} @tab @code{user-full-name}
7478@item @code{:email} @tab @code{user-mail-address}
7479@end multitable
7480
dbc28aaa
CD
7481If you use several email addresses, separate them by a semi-column.
7482
4009494e
GM
7483Most of the @code{org-export-with-*} variables have the same effect in
7484both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
7485@code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
7486La@TeX{} export.
7487
dbc28aaa
CD
7488When a property is given a value in @code{org-publish-project-alist},
7489its setting overrides the value of the corresponding user variable (if
7490any) during publishing. Options set within a file (@pxref{Export
4009494e
GM
7491options}), however, override everything.
7492
7493@node Publishing links, Project page index, Publishing options, Configuration
7494@subsection Links between published files
7495@cindex links, publishing
7496
a7808fba 7497To create a link from one Org file to another, you would use
4009494e
GM
7498something like @samp{[[file:foo.org][The foo]]} or simply
7499@samp{file:foo.org.} (@pxref{Hyperlinks}). Upon publishing this link
7500becomes a link to @file{foo.html}. In this way, you can interlink the
7501pages of your "org web" project and the links will work as expected when
7502you publish them to HTML.
7503
7504You may also link to related files, such as images. Provided you are
7505careful with relative pathnames, and provided you have also configured
dbc28aaa 7506@code{org-publish} to upload the related files, these links will work
4009494e
GM
7507too. @ref{Complex example} for an example of this usage.
7508
a7808fba 7509Sometime an Org file to be published may contain links that are
4009494e 7510only valid in your production environment, but not in the publishing
28a16a1b 7511location. In this case, use the property
4009494e
GM
7512
7513@multitable @columnfractions 0.4 0.6
7514@item @code{:link-validation-function}
7515@tab Function to validate links
7516@end multitable
7517
7518@noindent
7519to define a function for checking link validity. This function must
7520accept two arguments, the file name and a directory relative to which
7521the file name is interpreted in the production environment. If this
7522function returns @code{nil}, then the HTML generator will only insert a
7523description into the HTML file, but no link. One option for this
7524function is @code{org-publish-validate-link} which checks if the given
7525file is part of any project in @code{org-publish-project-alist}.
7526
7527@node Project page index, , Publishing links, Configuration
7528@subsection Project page index
7529@cindex index, of published pages
7530
7531The following properties may be used to control publishing of an
7532index of files or summary page for a given project.
7533
7534@multitable @columnfractions 0.25 0.75
7535@item @code{:auto-index}
7536@tab When non-nil, publish an index during org-publish-current-project or
7537org-publish-all.
7538
7539@item @code{:index-filename}
7540@tab Filename for output of index. Defaults to @file{index.org} (which
7541becomes @file{index.html}).
7542
7543@item @code{:index-title}
7544@tab Title of index page. Defaults to name of file.
7545
7546@item @code{:index-function}
a7808fba 7547@tab Plug-in function to use for generation of index.
4009494e
GM
7548Defaults to @code{org-publish-org-index}, which generates a plain list
7549of links to all files in the project.
7550@end multitable
7551
7552@node Sample configuration, Triggering publication, Configuration, Publishing
7553@section Sample configuration
7554
7555Below we provide two example configurations. The first one is a simple
a7808fba 7556project publishing only a set of Org files. The second example is
4009494e
GM
7557more complex, with a multi-component project.
7558
7559@menu
7560* Simple example:: One-component publishing
7561* Complex example:: A multi-component publishing example
7562@end menu
7563
7564@node Simple example, Complex example, Sample configuration, Sample configuration
7565@subsection Example: simple publishing configuration
7566
a7808fba 7567This example publishes a set of Org files to the @file{public_html}
4009494e
GM
7568directory on the local machine.
7569
7570@lisp
7571(setq org-publish-project-alist
28a16a1b 7572 '(("org"
4009494e
GM
7573 :base-directory "~/org/"
7574 :publishing-directory "~/public_html"
7575 :section-numbers nil
7576 :table-of-contents nil
28a16a1b 7577 :style "<link rel=stylesheet
4009494e
GM
7578 href=\"../other/mystyle.css\"
7579 type=\"text/css\">")))
7580@end lisp
7581
7582@node Complex example, , Simple example, Sample configuration
7583@subsection Example: complex publishing configuration
7584
7585This more complicated example publishes an entire website, including
7586org files converted to HTML, image files, emacs lisp source code, and
a7808fba 7587style sheets. The publishing-directory is remote and private files are
4009494e
GM
7588excluded.
7589
7590To ensure that links are preserved, care should be taken to replicate
7591your directory structure on the web server, and to use relative file
7592paths. For example, if your org files are kept in @file{~/org} and your
7593publishable images in @file{~/images}, you'd link to an image with
7594@c
7595@example
7596file:../images/myimage.png
7597@end example
7598@c
7599On the web server, the relative path to the image should be the
7600same. You can accomplish this by setting up an "images" folder in the
a7808fba 7601right place on the web server, and publishing images to it.
4009494e
GM
7602
7603@lisp
7604(setq org-publish-project-alist
7605 '(("orgfiles"
7606 :base-directory "~/org/"
7607 :base-extension "org"
7608 :publishing-directory "/ssh:user@@host:~/html/notebook/"
7609 :publishing-function org-publish-org-to-html
7610 :exclude "PrivatePage.org" ;; regexp
7611 :headline-levels 3
7612 :section-numbers nil
7613 :table-of-contents nil
28a16a1b 7614 :style "<link rel=stylesheet
4009494e
GM
7615 href=\"../other/mystyle.css\" type=\"text/css\">"
7616 :auto-preamble t
7617 :auto-postamble nil)
28a16a1b 7618
4009494e
GM
7619 ("images"
7620 :base-directory "~/images/"
7621 :base-extension "jpg\\|gif\\|png"
7622 :publishing-directory "/ssh:user@@host:~/html/images/"
7623 :publishing-function org-publish-attachment)
28a16a1b 7624
4009494e
GM
7625 ("other"
7626 :base-directory "~/other/"
7627 :base-extension "css\\|el"
7628 :publishing-directory "/ssh:user@@host:~/html/other/"
7629 :publishing-function org-publish-attachment)
7630 ("website" :components ("orgfiles" "images" "other"))))
7631@end lisp
7632
7633@node Triggering publication, , Sample configuration, Publishing
7634@section Triggering publication
7635
7636Once org-publish is properly configured, you can publish with the
28a16a1b 7637following functions:
4009494e
GM
7638
7639@table @kbd
7640@item C-c C-e C
7641Prompt for a specific project and publish all files that belong to it.
7642@item C-c C-e P
7643Publish the project containing the current file.
7644@item C-c C-e F
7645Publish only the current file.
7646@item C-c C-e A
7647Publish all projects.
7648@end table
7649
7650Org uses timestamps to track when a file has changed. The above
7651functions normally only publish changed files. You can override this and
7652force publishing of all files by giving a prefix argument.
7653
7654@node Miscellaneous, Extensions and Hacking, Publishing, Top
7655@chapter Miscellaneous
7656
7657@menu
7658* Completion:: M-TAB knows what you need
a7808fba 7659* Customization:: Adapting Org to your taste
4009494e
GM
7660* In-buffer settings:: Overview of the #+KEYWORDS
7661* The very busy C-c C-c key:: When in doubt, press C-c C-c
7662* Clean view:: Getting rid of leading stars in the outline
a7808fba 7663* TTY keys:: Using Org on a tty
4009494e
GM
7664* Interaction:: Other Emacs packages
7665* Bugs:: Things which do not work perfectly
7666@end menu
7667
7668@node Completion, Customization, Miscellaneous, Miscellaneous
7669@section Completion
7670@cindex completion, of @TeX{} symbols
7671@cindex completion, of TODO keywords
7672@cindex completion, of dictionary words
7673@cindex completion, of option keywords
7674@cindex completion, of tags
7675@cindex completion, of property keys
7676@cindex completion, of link abbreviations
7677@cindex @TeX{} symbol completion
7678@cindex TODO keywords completion
7679@cindex dictionary word completion
7680@cindex option keyword completion
7681@cindex tag completion
7682@cindex link abbreviations, completion of
7683
a7808fba 7684Org supports in-buffer completion. This type of completion does
4009494e
GM
7685not make use of the minibuffer. You simply type a few letters into
7686the buffer and use the key to complete text right there.
7687
7688@table @kbd
7689@kindex M-@key{TAB}
7690@item M-@key{TAB}
7691Complete word at point
7692@itemize @bullet
7693@item
7694At the beginning of a headline, complete TODO keywords.
7695@item
7696After @samp{\}, complete @TeX{} symbols supported by the exporter.
7697@item
7698After @samp{*}, complete headlines in the current buffer so that they
7699can be used in search links like @samp{[[*find this headline]]}.
7700@item
7701After @samp{:} in a headline, complete tags. The list of tags is taken
7702from the variable @code{org-tag-alist} (possibly set through the
7703@samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
7704dynamically from all tags used in the current buffer.
7705@item
7706After @samp{:} and not in a headline, complete property keys. The list
7707of keys is constructed dynamically from all keys used in the current
7708buffer.
7709@item
7710After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
7711@item
7712After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
a7808fba 7713@samp{OPTIONS} which set file-specific options for Org mode. When the
4009494e
GM
7714option keyword is already complete, pressing @kbd{M-@key{TAB}} again
7715will insert example settings for this keyword.
7716@item
7717In the line after @samp{#+STARTUP: }, complete startup keywords,
7718i.e. valid keys for this line.
7719@item
a7808fba 7720Elsewhere, complete dictionary words using Ispell.
4009494e
GM
7721@end itemize
7722@end table
7723
7724@node Customization, In-buffer settings, Completion, Miscellaneous
7725@section Customization
7726@cindex customization
7727@cindex options, for customization
7728@cindex variables, for customization
7729
7730There are more than 180 variables that can be used to customize
a7808fba 7731Org. For the sake of compactness of the manual, I am not
4009494e
GM
7732describing the variables here. A structured overview of customization
7733variables is available with @kbd{M-x org-customize}. Or select
7734@code{Browse Org Group} from the @code{Org->Customization} menu. Many
7735settings can also be activated on a per-file basis, by putting special
7736lines into the buffer (@pxref{In-buffer settings}).
7737
7738@node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
7739@section Summary of in-buffer settings
7740@cindex in-buffer settings
7741@cindex special keywords
7742
a7808fba 7743Org mode uses special lines in the buffer to define settings on a
4009494e
GM
7744per-file basis. These lines start with a @samp{#+} followed by a
7745keyword, a colon, and then individual words defining a setting. Several
7746setting words can be in the same line, but you can also have multiple
7747lines for the keyword. While these settings are described throughout
7748the manual, here is a summary. After changing any of those lines in the
7749buffer, press @kbd{C-c C-c} with the cursor still in the line to
7750activate the changes immediately. Otherwise they become effective only
7751when the file is visited again in a new Emacs session.
7752
7753@table @kbd
7754@item #+ARCHIVE: %s_done::
7755This line sets the archive location for the agenda file. It applies for
7756all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
7757of the file. The first such line also applies to any entries before it.
7758The corresponding variable is @code{org-archive-location}.
7759@item #+CATEGORY:
7760This line sets the category for the agenda file. The category applies
7761for all subsequent lines until the next @samp{#+CATEGORY} line, or the
7762end of the file. The first such line also applies to any entries before it.
7763@item #+COLUMNS: %25ITEM .....
7764Set the default format for columns view. This format applies when
dbc28aaa
CD
7765columns view is invoked in location where no @code{COLUMNS} property
7766applies.
4009494e
GM
7767@item #+CONSTANTS: name1=value1 ...
7768Set file-local values for constants to be used in table formulas. This
7769line set the local variable @code{org-table-formula-constants-local}.
dbc28aaa 7770The global version of this variable is
4009494e 7771@code{org-table-formula-constants}.
dbc28aaa
CD
7772@item #+DRAWERS: NAME1 .....
7773Set the file-local set of drawers. The corresponding global variable is
7774@code{org-drawers}.
4009494e
GM
7775@item #+LINK: linkword replace
7776These lines (several are allowed) specify link abbreviations.
7777@xref{Link abbreviations}. The corresponding variable is
7778@code{org-link-abbrev-alist}.
7779@item #+PRIORITIES: highest lowest default
7780This line sets the limits and the default for the priorities. All three
7781must be either letters A-Z or numbers 0-9. The highest priority must
7782have a lower ASCII number that the lowest priority.
7783@item #+PROPERTY: Property_Name Value
7784This line sets a default inheritance value for entries in the current
7785buffer, most useful for specifying the allowed values of a property.
7786@item #+STARTUP:
a7808fba
CD
7787This line sets options to be used at startup of Org mode, when an
7788Org file is being visited. The first set of options deals with the
4009494e
GM
7789initial visibility of the outline tree. The corresponding variable for
7790global default settings is @code{org-startup-folded}, with a default
7791value @code{t}, which means @code{overview}.
7792@cindex @code{overview}, STARTUP keyword
7793@cindex @code{content}, STARTUP keyword
7794@cindex @code{showall}, STARTUP keyword
7795@example
7796overview @r{top-level headlines only}
7797content @r{all headlines}
7798showall @r{no folding at all, show everything}
7799@end example
7800Then there are options for aligning tables upon visiting a file. This
7801is useful in files containing narrowed table columns. The corresponding
7802variable is @code{org-startup-align-all-tables}, with a default value
28a16a1b 7803@code{nil}.
4009494e
GM
7804@cindex @code{align}, STARTUP keyword
7805@cindex @code{noalign}, STARTUP keyword
7806@example
7807align @r{align all tables}
7808noalign @r{don't align tables on startup}
7809@end example
28a16a1b
CD
7810Logging closing and reinstating TODO items, and clock intervals
7811(variables @code{org-log-done}, @code{org-log-note-clock-out}, and
7812@code{org-log-repeat}) can be configured using these options.
4009494e 7813@cindex @code{logdone}, STARTUP keyword
4009494e 7814@cindex @code{lognotedone}, STARTUP keyword
28a16a1b 7815@cindex @code{nologdone}, STARTUP keyword
4009494e 7816@cindex @code{lognoteclock-out}, STARTUP keyword
28a16a1b 7817@cindex @code{nolognoteclock-out}, STARTUP keyword
4009494e 7818@cindex @code{logrepeat}, STARTUP keyword
28a16a1b 7819@cindex @code{lognoterepeat}, STARTUP keyword
4009494e
GM
7820@cindex @code{nologrepeat}, STARTUP keyword
7821@example
28a16a1b
CD
7822logdone @r{record a timestamp when an item is marked DONE}
7823lognotedone @r{record timestamp and a note when DONE}
7824nologdone @r{don't record when items are marked DONE}
7825logrepeat @r{record a time when reinstating a repeating item}
7826lognoterepeat @r{record a note when reinstating a repeating item}
7827nologrepeat @r{do not record when reinstating repeating item}
7828lognoteclock-out @r{record a note when clocking out}
7829nolognoteclock-out @r{don't record a note when clocking out}
4009494e
GM
7830@end example
7831Here are the options for hiding leading stars in outline headings. The
7832corresponding variables are @code{org-hide-leading-stars} and
7833@code{org-odd-levels-only}, both with a default setting @code{nil}
7834(meaning @code{showstars} and @code{oddeven}).
7835@cindex @code{hidestars}, STARTUP keyword
7836@cindex @code{showstars}, STARTUP keyword
7837@cindex @code{odd}, STARTUP keyword
7838@cindex @code{even}, STARTUP keyword
7839@example
7840hidestars @r{make all but one of the stars starting a headline invisible.}
7841showstars @r{show all stars starting a headline}
7842odd @r{allow only odd outline levels (1,3,...)}
7843oddeven @r{allow all outline levels}
7844@end example
7845To turn on custom format overlays over time stamps (variables
7846@code{org-put-time-stamp-overlays} and
7847@code{org-time-stamp-overlay-formats}), use
7848@cindex @code{customtime}, STARTUP keyword
7849@example
7850customtime @r{overlay custom time format}
7851@end example
7852The following options influence the table spreadsheet (variable
7853@code{constants-unit-system}).
7854@cindex @code{constcgs}, STARTUP keyword
7855@cindex @code{constSI}, STARTUP keyword
7856@example
7857constcgs @r{@file{constants.el} should use the c-g-s unit system}
7858constSI @r{@file{constants.el} should use the SI unit system}
7859@end example
7860@item #+TAGS: TAG1(c1) TAG2(c2)
cad1d376 7861These lines (several such lines are allowed) specify the valid tags in
4009494e
GM
7862this file, and (potentially) the corresponding @emph{fast tag selection}
7863keys. The corresponding variable is @code{org-tag-alist}.
7864@item #+TBLFM:
7865This line contains the formulas for the table directly above the line.
dbc28aaa 7866@item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:
4009494e
GM
7867These lines provide settings for exporting files. For more details see
7868@ref{Export options}.
7869@item #+SEQ_TODO: #+TYP_TODO:
7870These lines set the TODO keywords and their interpretation in the
7871current file. The corresponding variables are @code{org-todo-keywords}
7872and @code{org-todo-interpretation}.
7873@end table
7874
7875@node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
7876@section The very busy C-c C-c key
7877@kindex C-c C-c
7878@cindex C-c C-c, overview
7879
a7808fba 7880The key @kbd{C-c C-c} has many purposes in Org, which are all
4009494e
GM
7881mentioned scattered throughout this manual. One specific function of
7882this key is to add @emph{tags} to a headline (@pxref{Tags}). In many
a7808fba 7883other circumstances it means something like @emph{Hey Org, look
4009494e
GM
7884here and update according to what you see here}. Here is a summary of
7885what this means in different contexts.
7886
7887@itemize @minus
7888@item
7889If there are highlights in the buffer from the creation of a sparse
7890tree, or from clock display, remove these highlights.
7891@item
7892If the cursor is in one of the special @code{#+KEYWORD} lines, this
7893triggers scanning the buffer for these lines and updating the
28a16a1b 7894information.
4009494e
GM
7895@item
7896If the cursor is inside a table, realign the table. This command
7897works even if the automatic table editor has been turned off.
7898@item
7899If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
7900the entire table.
7901@item
7902If the cursor is inside a table created by the @file{table.el} package,
7903activate that table.
7904@item
7905If the current buffer is a remember buffer, close the note and file it.
7906With a prefix argument, file it, without further interaction, to the
7907default location.
7908@item
7909If the cursor is on a @code{<<<target>>>}, update radio targets and
7910corresponding links in this buffer.
7911@item
7912If the cursor is in a property line or at the start or end of a property
7913drawer, offer property commands.
7914@item
7915If the cursor is in a plain list item with a checkbox, toggle the status
7916of the checkbox.
7917@item
7918If the cursor is on a numbered item in a plain list, renumber the
7919ordered list.
dbc28aaa
CD
7920@item
7921If the cursor is on the @code{#+BEGIN} line of a dynamical block, the
7922block is updated.
4009494e
GM
7923@end itemize
7924
7925@node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
7926@section A cleaner outline view
7927@cindex hiding leading stars
7928@cindex clean outline view
7929
a7808fba 7930Some people find it noisy and distracting that the Org headlines
4009494e
GM
7931are starting with a potentially large number of stars. For example
7932the tree from @ref{Headlines}:
7933
7934@example
7935* Top level headline
7936** Second level
7937*** 3rd level
7938 some text
7939*** 3rd level
7940 more text
7941* Another top level headline
7942@end example
7943
7944@noindent
a7808fba 7945Unfortunately this is deeply ingrained into the code of Org and
4009494e
GM
7946cannot be easily changed. You can, however, modify the display in such
7947a way that all leading stars become invisible and the outline more easy
7948to read. To do this, customize the variable
7949@code{org-hide-leading-stars} like this:
7950
7951@lisp
7952(setq org-hide-leading-stars t)
7953@end lisp
7954
7955@noindent
7956or change this on a per-file basis with one of the lines (anywhere in
7957the buffer)
7958
7959@example
7960#+STARTUP: showstars
7961#+STARTUP: hidestars
7962@end example
7963
7964@noindent
7965Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
7966the modifications.
7967
7968With stars hidden, the tree becomes:
7969
7970@example
7971* Top level headline
7972 * Second level
7973 * 3rd level
7974 some text
7975 * 3rd level
7976 more text
7977* Another top level headline
7978@end example
7979
7980@noindent
7981Note that the leading stars are not truly replaced by whitespace, they
7982are only fontified with the face @code{org-hide} that uses the
7983background color as font color. If you are not using either white or
7984black background, you may have to customize this face to get the wanted
7985effect. Another possibility is to set this font such that the extra
7986stars are @i{almost} invisible, for example using the color
7987@code{grey90} on a white background.
7988
7989Things become cleaner still if you skip all the even levels and use only
7990odd levels 1, 3, 5..., effectively adding two stars to go from one
7991outline level to the next:
7992
7993@example
7994* Top level headline
7995 * Second level
7996 * 3rd level
7997 some text
7998 * 3rd level
7999 more text
8000* Another top level headline
8001@end example
8002
8003@noindent
8004In order to make the structure editing and export commands handle this
8005convention correctly, use
8006
8007@lisp
8008(setq org-odd-levels-only t)
8009@end lisp
8010
8011@noindent
8012or set this on a per-file basis with one of the following lines (don't
8013forget to press @kbd{C-c C-c} with the cursor in the startup line to
8014activate changes immediately).
8015
8016@example
8017#+STARTUP: odd
8018#+STARTUP: oddeven
8019@end example
8020
a7808fba 8021You can convert an Org file from single-star-per-level to the
4009494e
GM
8022double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
8023RET} in that file. The reverse operation is @kbd{M-x
8024org-convert-to-oddeven-levels}.
8025
8026@node TTY keys, Interaction, Clean view, Miscellaneous
a7808fba
CD
8027@section Using Org on a tty
8028@cindex tty key bindings
4009494e 8029
a7808fba
CD
8030Because Org contains a large number of commands, by default much of
8031Org's core commands are bound to keys that are generally not
dbc28aaa
CD
8032accessible on a tty, such as the cursor keys (@key{left}, @key{right},
8033@key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
8034together with modifiers like @key{Meta} and/or @key{Shift}. To access
8035these commands on a tty when special keys are unavailable, the following
8036alternative bindings can be used. The tty bindings below will likely be
8037more cumbersome; you may find for some of the bindings below that a
8038customized work-around suits you better. For example, changing a time
8039stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
8040tty you would rather use @kbd{C-c .} to re-insert the timestamp.
4009494e
GM
8041
8042@multitable @columnfractions 0.15 0.2 0.2
8043@item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
8044@item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab
8045@item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{@key{Esc} @key{left}}
8046@item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab
8047@item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{@key{Esc} @key{right}}
8048@item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab
8049@item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{@key{Esc} @key{up}}
8050@item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab
8051@item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{@key{Esc} @key{down}}
8052@item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab
8053@item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab
8054@item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{@key{Esc} @key{RET}}
8055@item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab
8056@item @kbd{S-@key{left}} @tab @kbd{C-c @key{left}} @tab
8057@item @kbd{S-@key{right}} @tab @kbd{C-c @key{right}} @tab
8058@item @kbd{S-@key{up}} @tab @kbd{C-c @key{up}} @tab
8059@item @kbd{S-@key{down}} @tab @kbd{C-c @key{down}} @tab
8060@item @kbd{C-S-@key{left}} @tab @kbd{C-c C-x @key{left}} @tab
8061@item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
8062@end multitable
8063
8064@node Interaction, Bugs, TTY keys, Miscellaneous
8065@section Interaction with other packages
8066@cindex packages, interaction with other
a7808fba 8067Org lives in the world of GNU Emacs and interacts in various ways
4009494e
GM
8068with other code out there.
8069
8070@menu
a7808fba 8071* Cooperation:: Packages Org cooperates with
4009494e
GM
8072* Conflicts:: Packages that lead to conflicts
8073@end menu
8074
8075@node Cooperation, Conflicts, Interaction, Interaction
a7808fba 8076@subsection Packages that Org cooperates with
4009494e
GM
8077
8078@table @asis
8079@cindex @file{calc.el}
8080@item @file{calc.el} by Dave Gillespie
a7808fba
CD
8081Org uses the Calc package for implementing spreadsheet
8082functionality in its tables (@pxref{The spreadsheet}). Org
8083checks for the availability of Calc by looking for the function
8084@code{calc-eval} which should be autoloaded in your setup if Calc has
8085been installed properly. As of Emacs 22, Calc is part of the Emacs
4009494e 8086distribution. Another possibility for interaction between the two
a7808fba
CD
8087packages is using Calc for embedded calculations. @xref{Embedded Mode,
8088, Embedded Mode, Calc, GNU Emacs Calc Manual}.
4009494e
GM
8089@cindex @file{constants.el}
8090@item @file{constants.el} by Carsten Dominik
8091In a table formula (@pxref{The spreadsheet}), it is possible to use
8092names for natural constants or units. Instead of defining your own
8093constants in the variable @code{org-table-formula-constants}, install
8094the @file{constants} package which defines a large number of constants
8095and units, and lets you use unit prefixes like @samp{M} for
8096@samp{Mega} etc. You will need version 2.0 of this package, available
a7808fba 8097at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
4009494e
GM
8098the function @code{constants-get}, which has to be autoloaded in your
8099setup. See the installation instructions in the file
8100@file{constants.el}.
8101@item @file{cdlatex.el} by Carsten Dominik
8102@cindex @file{cdlatex.el}
a7808fba
CD
8103Org mode can make use of the CDLaTeX package to efficiently enter
8104La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
dbc28aaa
CD
8105@item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
8106@cindex @file{imenu.el}
a7808fba
CD
8107Imenu allows menu access to an index of items in a file. Org mode
8108supports Imenu - all you need to do to get the index is the following:
dbc28aaa 8109@lisp
28a16a1b 8110(add-hook 'org-mode-hook
a7808fba 8111 (lambda () (imenu-add-to-menubar "Imenu")))
dbc28aaa
CD
8112@end lisp
8113By default the index is two levels deep - you can modify the depth using
8114the option @code{org-imenu-depth}.
4009494e
GM
8115@item @file{remember.el} by John Wiegley
8116@cindex @file{remember.el}
a7808fba 8117Org cooperates with remember, see @ref{Remember}.
4009494e 8118@file{Remember.el} is not part of Emacs, find it on the web.
dbc28aaa
CD
8119@item @file{speedbar.el} by Eric M. Ludlam
8120@cindex @file{speedbar.el}
8121Speedbar is a package that creates a special frame displaying files and
a7808fba
CD
8122index items in files. Org mode supports Speedbar and allows you to
8123drill into Org files directly from the Speedbar. It also allows to
dbc28aaa 8124restrict the scope of agenda commands to a file or a subtree by using
a7808fba 8125the command @kbd{<} in the Speedbar frame.
4009494e
GM
8126@cindex @file{table.el}
8127@item @file{table.el} by Takaaki Ota
8128@kindex C-c C-c
8129@cindex table editor, @file{table.el}
8130@cindex @file{table.el}
8131
8132Complex ASCII tables with automatic line wrapping, column- and
8133row-spanning, and alignment can be created using the Emacs table
8134package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
8135and also part of Emacs 22).
a7808fba 8136When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
4009494e 8137will call @command{table-recognize-table} and move the cursor into the
a7808fba
CD
8138table. Inside a table, the keymap of Org mode is inactive. In order
8139to execute Org mode-related commands, leave the table.
4009494e
GM
8140
8141@table @kbd
8142@kindex C-c C-c
8143@item C-c C-c
8144Recognize @file{table.el} table. Works when the cursor is in a
8145table.el table.
8146@c
8147@kindex C-c ~
8148@item C-c ~
8149Insert a table.el table. If there is already a table at point, this
a7808fba 8150command converts it between the table.el format and the Org mode
4009494e
GM
8151format. See the documentation string of the command
8152@code{org-convert-table} for the restrictions under which this is
8153possible.
8154@end table
8155@file{table.el} is part of Emacs 22.
8156@cindex @file{footnote.el}
8157@item @file{footnote.el} by Steven L. Baur
a7808fba 8158Org mode recognizes numerical footnotes as provided by this package
4009494e
GM
8159(@pxref{Footnotes}).
8160@end table
8161
8162@node Conflicts, , Cooperation, Interaction
a7808fba 8163@subsection Packages that lead to conflicts with Org mode
4009494e
GM
8164
8165@table @asis
8166
8167@cindex @file{allout.el}
8168@item @file{allout.el} by Ken Manheimer
a7808fba 8169Startup of Org may fail with the error message
4009494e
GM
8170@code{(wrong-type-argument keymapp nil)} when there is an outdated
8171version @file{allout.el} on the load path, for example the version
8172distributed with Emacs 21.x. Upgrade to Emacs 22 and this problem will
8173disappear. If for some reason you cannot do this, make sure that org.el
8174is loaded @emph{before} @file{allout.el}, for example by putting
8175@code{(require 'org)} early enough into your @file{.emacs} file.
8176
8177@cindex @file{CUA.el}
8178@item @file{CUA.el} by Kim. F. Storm
a7808fba
CD
8179Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by
8180CUA mode (as well as pc-select-mode and s-region-mode) to select and
dbc28aaa 8181extend the region. If you want to use one of these packages along with
a7808fba
CD
8182Org, configure the variable @code{org-replace-disputed-keys}. When
8183set, Org will move the following key bindings in Org files, and
dbc28aaa 8184in the agenda buffer (but not during date selection).
4009494e
GM
8185
8186@example
8187S-UP -> M-p S-DOWN -> M-n
8188S-LEFT -> M-- S-RIGHT -> M-+
8189@end example
8190
8191Yes, these are unfortunately more difficult to remember. If you want
8192to have other replacement keys, look at the variable
8193@code{org-disputed-keys}.
8194@item @file{windmove.el} by Hovav Shacham
8195@cindex @file{windmove.el}
8196Also this package uses the @kbd{S-<cursor>} keys, so everything written
8197in the paragraph above about CUA mode also applies here.
8198
8199@cindex @file{footnote.el}
8200@item @file{footnote.el} by Steven L. Baur
a7808fba 8201Org supports the syntax of the footnote package, but only the
4009494e 8202numerical footnote markers. Also, the default key for footnote
a7808fba 8203commands, @kbd{C-c !} is already used by Org. You could use the
4009494e
GM
8204variable @code{footnote-prefix} to switch footnotes commands to another
8205key. Or, you could use @code{org-replace-disputed-keys} and
a7808fba 8206@code{org-disputed-keys} to change the settings in Org.
4009494e
GM
8207
8208@end table
8209
8210
8211@node Bugs, , Interaction, Miscellaneous
8212@section Bugs
8213@cindex bugs
8214
8215Here is a list of things that should work differently, but which I
8216have found too hard to fix.
8217
8218@itemize @bullet
8219@item
8220If a table field starts with a link, and if the corresponding table
8221column is narrowed (@pxref{Narrow columns}) to a width too small to
8222display the link, the field would look entirely empty even though it is
a7808fba 8223not. To prevent this, Org throws an error. The work-around is to
4009494e
GM
8224make the column wide enough to fit the link, or to add some text (at
8225least 2 characters) before the link in the same field.
8226@item
8227Narrowing table columns does not work on XEmacs, because the
8228@code{format} function does not transport text properties.
8229@item
8230Text in an entry protected with the @samp{QUOTE} keyword should not
8231autowrap.
8232@item
8233When the application called by @kbd{C-c C-o} to open a file link fails
8234(for example because the application does not exist or refuses to open
8235the file), it does so silently. No error message is displayed.
8236@item
8237Recalculating a table line applies the formulas from left to right.
8238If a formula uses @emph{calculated} fields further down the row,
8239multiple recalculation may be needed to get all fields consistent. You
8240may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
8241recalculate until convergence.
8242@item
8243A single letter cannot be made bold, for example @samp{*a*}.
8244@item
8245The exporters work well, but could be made more efficient.
8246@end itemize
8247
8248
8249@node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
8250@appendix Extensions, Hooks and Hacking
8251
a7808fba 8252This appendix lists extensions for Org written by other authors.
4009494e 8253It also covers some aspects where users can extend the functionality of
a7808fba 8254Org.
4009494e
GM
8255
8256@menu
a7808fba 8257* Extensions:: Existing 3rd-party extensions
4009494e
GM
8258* Adding hyperlink types:: New custom link types
8259* Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
8260* Dynamic blocks:: Automatically filled blocks
8261* Special agenda views:: Customized views
8262* Using the property API:: Writing programs that use entry properties
8263@end menu
8264
8265@node Extensions, Adding hyperlink types, Extensions and Hacking, Extensions and Hacking
a7808fba 8266@section Third-party extensions for Org
4009494e
GM
8267@cindex extension, third-party
8268
a7808fba
CD
8269There are lots of extensions that have been written by other people. Most of
8270them have either been integrated into Org by now, or they can be found in the
8271Org distribution, in the @file{contrib} directory. The list has gotten too
8272long to cover in any detail here, but there is a seaparate manual for these
8273extensions.
4009494e
GM
8274
8275@node Adding hyperlink types, Tables in arbitrary syntax, Extensions, Extensions and Hacking
8276@section Adding hyperlink types
8277@cindex hyperlinks, adding new types
8278
a7808fba 8279Org has a large number of hyperlink types built-in
4009494e
GM
8280(@pxref{Hyperlinks}). If you would like to add new link types, it
8281provides an interface for doing so. Lets look at an example file
8282@file{org-man.el} that will add support for creating links like
a7808fba 8283@samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
4009494e
GM
8284emacs:
8285
8286@lisp
a7808fba 8287;;; org-man.el - Support for links to manpages in Org
4009494e
GM
8288
8289(require 'org)
8290
8291(org-add-link-type "man" 'org-man-open)
8292(add-hook 'org-store-link-functions 'org-man-store-link)
8293
8294(defcustom org-man-command 'man
8295 "The Emacs command to be used to display a man page."
8296 :group 'org-link
8297 :type '(choice (const man) (const woman)))
8298
8299(defun org-man-open (path)
8300 "Visit the manpage on PATH.
8301PATH should be a topic that can be thrown at the man command."
8302 (funcall org-man-command path))
8303
8304(defun org-man-store-link ()
8305 "Store a link to a manpage."
8306 (when (memq major-mode '(Man-mode woman-mode))
8307 ;; This is a man page, we do make this link
8308 (let* ((page (org-man-get-page-name))
8309 (link (concat "man:" page))
8310 (description (format "Manpage for %s" page)))
8311 (org-store-link-props
8312 :type "man"
8313 :link link
8314 :description description))))
8315
8316(defun org-man-get-page-name ()
8317 "Extract the page name from the buffer name."
8318 ;; This works for both `Man-mode' and `woman-mode'.
8319 (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
8320 (match-string 1 (buffer-name))
8321 (error "Cannot create link to this man page")))
8322
8323(provide 'org-man)
8324
8325;;; org-man.el ends here
8326@end lisp
8327
8328@noindent
8329You would activate this new link type in @file{.emacs} with
8330
8331@lisp
8332(require 'org-man)
8333@end lisp
8334
8335@noindent
8336Lets go through the file and see what it does.
8337@enumerate
28a16a1b 8338@item
4009494e
GM
8339It does @code{(require 'org)} to make sure that @file{org.el} has been
8340loaded.
8341@item
8342The next line calls @code{org-add-link-type} to define a new link type
8343with prefix @samp{man}. The call also contains the name of a function
8344that will be called to follow such a link.
8345@item
8346The next line adds a function to @code{org-store-link-functions}, in
8347order to allow the command @kbd{C-c l} to record a useful link in a
8348buffer displaying a man page.
8349@end enumerate
8350
8351The rest of the file defines the necessary variables and functions.
8352First there is a customization variable that determines which emacs
a7808fba 8353command should be used to display man pages. There are two options,
4009494e
GM
8354@code{man} and @code{woman}. Then the function to follow a link is
8355defined. It gets the link path as an argument - in this case the link
8356path is just a topic for the manual command. The function calls the
8357value of @code{org-man-command} to display the man page.
8358
8359Finally the function @code{org-man-store-link} is defined. When you try
8360to store a link with @kbd{C-c l}, also this function will be called to
8361try to make a link. The function must first decide if it is supposed to
8362create the link for this buffer type, we do this by checking the value
8363of the variable @code{major-mode}. If not, the function must exit and
a7808fba
CD
8364return the value @code{nil}. If yes, the link is created by getting the
8365manual topic from the buffer name and prefixing it with the string
4009494e
GM
8366@samp{man:}. Then it must call the command @code{org-store-link-props}
8367and set the @code{:type} and @code{:link} properties. Optionally you
8368can also set the @code{:description} property to provide a default for
a7808fba 8369the link description when the link is later inserted into an Org
4009494e
GM
8370buffer with @kbd{C-c C-l}.
8371
8372@node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Extensions and Hacking
a7808fba 8373@section Tables and lists in arbitrary syntax
4009494e 8374@cindex tables, in other modes
dbc28aaa 8375@cindex lists, in other modes
a7808fba 8376@cindex Orgtbl mode
4009494e 8377
a7808fba 8378Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
4009494e 8379frequent feature request has been to make it work with native tables in
dbc28aaa
CD
8380specific languages, for example La@TeX{}. However, this is extremely
8381hard to do in a general way, would lead to a customization nightmare,
a7808fba 8382and would take away much of the simplicity of the Orgtbl mode table
dbc28aaa
CD
8383editor.
8384
4009494e 8385
a7808fba 8386This appendix describes a different approach. We keep the Orgtbl mode
4009494e
GM
8387table in its native format (the @i{source table}), and use a custom
8388function to @i{translate} the table to the correct syntax, and to
8389@i{install} it in the right location (the @i{target table}). This puts
8390the burden of writing conversion functions on the user, but it allows
8391for a very flexible system.
8392
dbc28aaa
CD
8393Bastien added the ability to do the same with lists. You can use Org's
8394facilities to edit and structure lists by turning @code{orgstruct-mode}
8395on, then locally exporting such lists in another format (HTML, La@TeX{}
a7808fba 8396or Texinfo.)
dbc28aaa
CD
8397
8398
4009494e
GM
8399@menu
8400* Radio tables:: Sending and receiving
8401* A LaTeX example:: Step by step, almost a tutorial
8402* Translator functions:: Copy and modify
a7808fba 8403* Radio lists:: Doing the same for lists
4009494e
GM
8404@end menu
8405
8406@node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
8407@subsection Radio tables
8408@cindex radio tables
8409
8410To define the location of the target table, you first need to create two
8411lines that are comments in the current mode, but contain magic words for
a7808fba 8412Orgtbl mode to find. Orgtbl mode will insert the translated table
4009494e
GM
8413between these lines, replacing whatever was there before. For example:
8414
8415@example
8416/* BEGIN RECEIVE ORGTBL table_name */
8417/* END RECEIVE ORGTBL table_name */
8418@end example
8419
8420@noindent
8421Just above the source table, we put a special line that tells
a7808fba 8422Orgtbl mode how to translate this table and where to install it. For
4009494e
GM
8423example:
8424@example
8425#+ORGTBL: SEND table_name translation_function arguments....
8426@end example
8427
8428@noindent
8429@code{table_name} is the reference name for the table that is also used
8430in the receiver lines. @code{translation_function} is the Lisp function
8431that does the translation. Furthermore, the line can contain a list of
8432arguments (alternating key and value) at the end. The arguments will be
8433passed as a property list to the translation function for
8434interpretation. A few standard parameters are already recognized and
8435acted upon before the translation function is called:
8436
8437@table @code
8438@item :skip N
8439Skip the first N lines of the table. Hlines do count!
8440@item :skipcols (n1 n2 ...)
8441List of columns that should be skipped. If the table has a column with
8442calculation marks, that column is automatically discarded as well.
8443Please note that the translator function sees the table @emph{after} the
8444removal of these columns, the function never knows that there have been
8445additional columns.
8446@end table
8447
8448@noindent
8449The one problem remaining is how to keep the source table in the buffer
8450without disturbing the normal workings of the file, for example during
8451compilation of a C file or processing of a La@TeX{} file. There are a
8452number of different solutions:
8453
8454@itemize @bullet
8455@item
8456The table could be placed in a block comment if that is supported by the
a7808fba 8457language. For example, in C mode you could wrap the table between
4009494e 8458@samp{/*} and @samp{*/} lines.
28a16a1b 8459@item
4009494e
GM
8460Sometimes it is possible to put the table after some kind of @i{END}
8461statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
8462in La@TeX{}.
8463@item
8464You can just comment the table line by line whenever you want to process
8465the file, and uncomment it whenever you need to edit the table. This
8466only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
8467make this comment-toggling very easy, in particular if you bind it to a
8468key.
8469@end itemize
8470
8471@node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
dbc28aaa 8472@subsection A LaTeX example of radio tables
a7808fba 8473@cindex LaTeX, and Orgtbl mode
4009494e
GM
8474
8475The best way to wrap the source table in La@TeX{} is to use the
8476@code{comment} environment provided by @file{comment.sty}. It has to be
8477activated by placing @code{\usepackage@{comment@}} into the document
a7808fba
CD
8478header. Orgtbl mode can insert a radio table skeleton@footnote{By
8479default this works only for La@TeX{}, HTML, and Texinfo. Configure the
4009494e
GM
8480variable @code{orgtbl-radio-tables} to install templates for other
8481modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will
8482be prompted for a table name, lets say we use @samp{salesfigures}. You
8483will then get the following template:
8484
8485@example
8486% BEGIN RECEIVE ORGTBL salesfigures
8487% END RECEIVE ORGTBL salesfigures
8488\begin@{comment@}
8489#+ORGTBL: SEND salesfigures orgtbl-to-latex
8490| | |
8491\end@{comment@}
8492@end example
8493
8494@noindent
a7808fba 8495The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
4009494e
GM
8496@code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
8497into the receiver location with name @code{salesfigures}. You may now
8498fill in the table, feel free to use the spreadsheet features@footnote{If
8499the @samp{#+TBLFM} line contains an odd number of dollar characters,
a7808fba 8500this may cause problems with font-lock in LaTeX mode. As shown in the
4009494e
GM
8501example you can fix this by adding an extra line inside the
8502@code{comment} environment that is used to balance the dollar
8503expressions. If you are using AUCTeX with the font-latex library, a
8504much better solution is to add the @code{comment} environment to the
8505variable @code{LaTeX-verbatim-environments}.}:
8506
8507@example
8508% BEGIN RECEIVE ORGTBL salesfigures
8509% END RECEIVE ORGTBL salesfigures
8510\begin@{comment@}
8511#+ORGTBL: SEND salesfigures orgtbl-to-latex
8512| Month | Days | Nr sold | per day |
8513|-------+------+---------+---------|
8514| Jan | 23 | 55 | 2.4 |
8515| Feb | 21 | 16 | 0.8 |
8516| March | 22 | 278 | 12.6 |
8517#+TBLFM: $4=$3/$2;%.1f
8518% $ (optional extra dollar to keep font-lock happy, see footnote)
8519\end@{comment@}
8520@end example
8521
8522@noindent
8523When you are done, press @kbd{C-c C-c} in the table to get the converted
8524table inserted between the two marker lines.
8525
8526Now lets assume you want to make the table header by hand, because you
8527want to control how columns are aligned etc. In this case we make sure
8528that the table translator does skip the first 2 lines of the source
8529table, and tell the command to work as a @i{splice}, i.e. to not produce
8530header and footer commands of the target table:
8531
8532@example
8533\begin@{tabular@}@{lrrr@}
8534Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
8535% BEGIN RECEIVE ORGTBL salesfigures
8536% END RECEIVE ORGTBL salesfigures
8537\end@{tabular@}
8538%
8539\begin@{comment@}
8540#+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
8541| Month | Days | Nr sold | per day |
8542|-------+------+---------+---------|
8543| Jan | 23 | 55 | 2.4 |
8544| Feb | 21 | 16 | 0.8 |
8545| March | 22 | 278 | 12.6 |
8546#+TBLFM: $4=$3/$2;%.1f
8547\end@{comment@}
8548@end example
8549
8550The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
a7808fba 8551Orgtbl mode. It uses a @code{tabular} environment to typeset the table
4009494e
GM
8552and marks horizontal lines with @code{\hline}. Furthermore, it
8553interprets the following parameters:
8554
8555@table @code
8556@item :splice nil/t
8557When set to t, return only table body lines, don't wrap them into a
8558tabular environment. Default is nil.
8559
8560@item :fmt fmt
8561A format to be used to wrap each field, should contain @code{%s} for the
8562original field value. For example, to wrap each field value in dollars,
8563you could use @code{:fmt "$%s$"}. This may also be a property list with
8564column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
a7808fba
CD
8565A function of one argument can be used in place of the strings; the
8566function must return a formatted string.
4009494e
GM
8567
8568@item :efmt efmt
8569Use this format to print numbers with exponentials. The format should
8570have @code{%s} twice for inserting mantissa and exponent, for example
8571@code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This
8572may also be a property list with column numbers and formats, for example
8573@code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
8574@code{efmt} has been applied to a value, @code{fmt} will also be
a7808fba
CD
8575applied. Similar to @code{fmt}, functions of two arguments can be
8576supplied instead of strings.
4009494e
GM
8577@end table
8578
dbc28aaa 8579@node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
4009494e 8580@subsection Translator functions
a7808fba 8581@cindex HTML, and Orgtbl mode
4009494e
GM
8582@cindex translator function
8583
a7808fba 8584Orgtbl mode has several translator functions built-in:
4009494e
GM
8585@code{orgtbl-to-latex}, @code{orgtbl-to-html}, and
8586@code{orgtbl-to-texinfo}. Except for @code{orgtbl-to-html}@footnote{The
8587HTML translator uses the same code that produces tables during HTML
8588export.}, these all use a generic translator, @code{orgtbl-to-generic}.
8589For example, @code{orgtbl-to-latex} itself is a very short function that
8590computes the column definitions for the @code{tabular} environment,
8591defines a few field and line separators and then hands over to the
8592generic translator. Here is the entire code:
8593
8594@lisp
8595@group
8596(defun orgtbl-to-latex (table params)
a7808fba 8597 "Convert the Orgtbl mode TABLE to LaTeX."
4009494e
GM
8598 (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
8599 org-table-last-alignment ""))
8600 (params2
8601 (list
8602 :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
8603 :tend "\\end@{tabular@}"
8604 :lstart "" :lend " \\\\" :sep " & "
8605 :efmt "%s\\,(%s)" :hline "\\hline")))
8606 (orgtbl-to-generic table (org-combine-plists params2 params))))
8607@end group
8608@end lisp
8609
8610As you can see, the properties passed into the function (variable
8611@var{PARAMS}) are combined with the ones newly defined in the function
8612(variable @var{PARAMS2}). The ones passed into the function (i.e. the
8613ones set by the @samp{ORGTBL SEND} line) take precedence. So if you
8614would like to use the La@TeX{} translator, but wanted the line endings to
8615be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
8616overrule the default with
8617
8618@example
8619#+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
8620@end example
8621
8622For a new language, you can either write your own converter function in
8623analogy with the La@TeX{} translator, or you can use the generic function
8624directly. For example, if you have a language where a table is started
8625with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
8626started with @samp{!BL!}, ended with @samp{!EL!} and where the field
8627separator is a TAB, you could call the generic translator like this (on
8628a single line!):
8629
8630@example
8631#+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
8632 :lstart "!BL! " :lend " !EL!" :sep "\t"
8633@end example
8634
8635@noindent
8636Please check the documentation string of the function
8637@code{orgtbl-to-generic} for a full list of parameters understood by
8638that function and remember that you can pass each of them into
8639@code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
8640using the generic function.
8641
8642Of course you can also write a completely new function doing complicated
8643things the generic translator cannot do. A translator function takes
8644two arguments. The first argument is the table, a list of lines, each
8645line either the symbol @code{hline} or a list of fields. The second
8646argument is the property list containing all parameters specified in the
8647@samp{#+ORGTBL: SEND} line. The function must return a single string
8648containing the formatted table. If you write a generally useful
8649translator, please post it on @code{emacs-orgmode@@gnu.org} so that
8650others can benefit from your work.
8651
dbc28aaa
CD
8652@node Radio lists, , Translator functions, Tables in arbitrary syntax
8653@subsection Radio lists
8654@cindex radio lists
8655@cindex org-list-insert-radio-list
8656
8657Sending and receiving radio lists works exactly the same way than
8658sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
8659need to load the @code{org-export-latex.el} package to use radio lists
8660since the relevant code is there for now.}. As for radio tables, you
a7808fba 8661can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
dbc28aaa
CD
8662calling @code{org-list-insert-radio-list}.
8663
8664Here are the differences with radio tables:
8665
8666@itemize @minus
8667@item
8668Use @code{ORGLST} instead of @code{ORGTBL}.
8669@item
8670The available translation functions for radio lists don't take
8671parameters.
28a16a1b 8672@item
dbc28aaa
CD
8673`C-c C-c' will work when pressed on the first item of the list.
8674@end itemize
8675
8676Here is a La@TeX{} example. Let's say that you have this in your
8677La@TeX{} file:
8678
8679@example
8680% BEGIN RECEIVE ORGLST to-buy
8681% END RECEIVE ORGLST to-buy
8682\begin@{comment@}
8683#+ORGLIST: SEND to-buy orgtbl-to-latex
8684- a new house
8685- a new computer
8686 + a new keyboard
8687 + a new mouse
8688- a new life
8689\end@{comment@}
8690@end example
8691
8692Pressing `C-c C-c' on @code{a new house} and will insert the converted
8693La@TeX{} list between the two marker lines.
8694
4009494e
GM
8695@node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Extensions and Hacking
8696@section Dynamic blocks
8697@cindex dynamic blocks
8698
a7808fba 8699Org documents can contain @emph{dynamic blocks}. These are
4009494e
GM
8700specially marked regions that are updated by some user-written function.
8701A good example for such a block is the clock table inserted by the
8702command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
8703
8704Dynamic block are enclosed by a BEGIN-END structure that assigns a name
8705to the block and can also specify parameters for the function producing
8706the content of the block.
8707
8708@example
8709#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
8710
8711#+END:
8712@end example
8713
8714Dynamic blocks are updated with the following commands
8715
8716@table @kbd
8717@kindex C-c C-x C-u
8718@item C-c C-x C-u
8719Update dynamic block at point.
8720@kindex C-u C-c C-x C-u
8721@item C-u C-c C-x C-u
8722Update all dynamic blocks in the current file.
8723@end table
8724
8725Updating a dynamic block means to remove all the text between BEGIN and
8726END, parse the BEGIN line for parameters and then call the specific
28a16a1b
CD
8727writer function for this block to insert the new content. If you want
8728to use the original content in the writer function, you can use the
8729extra parameter @code{:content}.
8730
8731For a block with name @code{myblock}, the writer function is
4009494e
GM
8732@code{org-dblock-write:myblock} with as only parameter a property list
8733with the parameters given in the begin line. Here is a trivial example
8734of a block that keeps track of when the block update function was last
8735run:
8736
8737@example
8738#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
8739
8740#+END:
8741@end example
8742
8743@noindent
8744The corresponding block writer function could look like this:
8745
8746@lisp
8747(defun org-dblock-write:block-update-time (params)
8748 (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
8749 (insert "Last block update at: "
8750 (format-time-string fmt (current-time)))))
8751@end lisp
8752
8753If you want to make sure that all dynamic blocks are always up-to-date,
8754you could add the function @code{org-update-all-dblocks} to a hook, for
8755example @code{before-save-hook}. @code{org-update-all-dblocks} is
a7808fba
CD
8756written in a way that is does nothing in buffers that are not in
8757@code{org-mode}.
4009494e
GM
8758
8759@node Special agenda views, Using the property API, Dynamic blocks, Extensions and Hacking
a7808fba 8760@section Special agenda views
4009494e
GM
8761@cindex agenda views, user-defined
8762
a7808fba 8763Org provides a special hook that can be used to narrow down the
4009494e
GM
8764selection made by any of the agenda views. You may specify a function
8765that is used at each match to verify if the match should indeed be part
8766of the agenda view, and if not, how much should be skipped.
8767
8768Let's say you want to produce a list of projects that contain a WAITING
8769tag anywhere in the project tree. Let's further assume that you have
a7808fba
CD
8770marked all tree headings that define a project with the TODO keyword
8771PROJECT. In this case you would run a TODO search for the keyword
4009494e
GM
8772PROJECT, but skip the match unless there is a WAITING tag anywhere in
8773the subtree belonging to the project line.
8774
8775To achieve this, you must write a function that searches the subtree for
8776the tag. If the tag is found, the function must return @code{nil} to
8777indicate that this match should not be skipped. If there is no such
8778tag, return the location of the end of the subtree, to indicate that
8779search should continue from there.
8780
8781@lisp
8782(defun my-skip-unless-waiting ()
8783 "Skip trees that are not waiting"
8784 (let ((subtree-end (save-excursion (org-end-of-subtree t))))
dbc28aaa 8785 (if (re-search-forward ":waiting:" subtree-end t)
4009494e
GM
8786 nil ; tag found, do not skip
8787 subtree-end))) ; tag not found, continue after end of subtree
8788@end lisp
8789
8790Now you may use this function in an agenda custom command, for example
8791like this:
8792
8793@lisp
8794(org-add-agenda-custom-command
8795 '("b" todo "PROJECT"
8796 ((org-agenda-skip-function 'my-org-waiting-projects)
8797 (org-agenda-overriding-header "Projects waiting for something: "))))
8798@end lisp
8799
8800Note that this also binds @code{org-agenda-overriding-header} to get a
8801meaningful header in the agenda view.
8802
a7808fba
CD
8803A general way to create custom searches is to base them on a search for
8804entries with a certain level limit. If you want to study all entries with
8805your custom search function, simply do a search for @samp{LEVEL>0}, and then
8806use @code{org-agenda-skip-function} to select the entries you really want to
8807have.
8808
4009494e
GM
8809You may also put a Lisp form into @code{org-agenda-skip-function}. In
8810particular, you may use the functions @code{org-agenda-skip-entry-if}
8811and @code{org-agenda-skip-subtree-if} in this form, for example:
8812
8813@table @code
8814@item '(org-agenda-skip-entry-if 'scheduled)
8815Skip current entry if it has been scheduled.
8816@item '(org-agenda-skip-entry-if 'notscheduled)
8817Skip current entry if it has not been scheduled.
8818@item '(org-agenda-skip-entry-if 'deadline)
8819Skip current entry if it has a deadline.
8820@item '(org-agenda-skip-entry-if 'scheduled 'deadline)
8821Skip current entry if it has a deadline, or if it is scheduled.
8822@item '(org-agenda-skip-entry 'regexp "regular expression")
dbc28aaa
CD
8823Skip current entry if the regular expression matches in the entry.
8824@item '(org-agenda-skip-entry 'notregexp "regular expression")
8825Skip current entry unless the regular expression matches.
4009494e
GM
8826@item '(org-agenda-skip-subtree-if 'regexp "regular expression")
8827Same as above, but check and skip the entire subtree.
8828@end table
8829
8830Therefore we could also have written the search for WAITING projects
8831like this, even without defining a special function:
8832
8833@lisp
8834(org-add-agenda-custom-command
8835 '("b" todo "PROJECT"
8836 ((org-agenda-skip-function '(org-agenda-skip-subtree-if
dbc28aaa 8837 'regexp ":waiting:"))
4009494e
GM
8838 (org-agenda-overriding-header "Projects waiting for something: "))))
8839@end lisp
8840
4009494e
GM
8841@node Using the property API, , Special agenda views, Extensions and Hacking
8842@section Using the property API
8843@cindex API, for properties
8844@cindex properties, API
8845
8846Here is a description of the functions that can be used to work with
8847properties.
8848
8849@defun org-entry-properties &optional pom which
8850Get all properties of the entry at point-or-marker POM.
8851This includes the TODO keyword, the tags, time strings for deadline,
8852scheduled, and clocking, and any additional properties defined in the
8853entry. The return value is an alist, keys may occur multiple times
8854if the property key was used several times.
8855POM may also be nil, in which case the current entry is used.
8856If WHICH is nil or `all', get all properties. If WHICH is
8857`special' or `standard', only get that subclass.
8858@end defun
8859@defun org-entry-get pom property &optional inherit
a7808fba
CD
8860Get value of PROPERTY for entry at point-or-marker POM. By default,
8861this only looks at properties defined locally in the entry. If INHERIT
8862is non-nil and the entry does not have the property, then also check
8863higher levels of the hierarchy. If INHERIT is the symbol
8864@code{selective}, use inheritance if and only if the setting of
8865@code{org-use-property-inheritance} selects PROPERTY for inheritance.
4009494e
GM
8866@end defun
8867
8868@defun org-entry-delete pom property
8869Delete the property PROPERTY from entry at point-or-marker POM.
8870@end defun
8871
8872@defun org-entry-put pom property value
8873Set PROPERTY to VALUE for entry at point-or-marker POM.
8874@end defun
8875
8876@defun org-buffer-property-keys &optional include-specials
8877Get all property keys in the current buffer.
8878@end defun
8879
8880@defun org-insert-property-drawer
8881Insert a property drawer at point.
8882@end defun
8883
a7808fba
CD
8884@defun org-entry-add-to-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 in this list.
8887@end defun
8888
8889@defun org-entry-remove-from-multivalued-property pom property value
8890Treat the value of the property PROPERTY as a whitespace-separated list of
8891values and make sure that VALUE is @emph{not} in this list.
8892@end defun
8893
8894@defun org-entry-member-in-multivalued-property pom property value
8895Treat the value of the property PROPERTY as a whitespace-separated list of
8896values and check if VALUE is in this list.
8897@end defun
8898
dbc28aaa 8899@node History and Acknowledgments, Main Index, Extensions and Hacking, Top
4009494e
GM
8900@appendix History and Acknowledgments
8901@cindex acknowledgments
8902@cindex history
8903@cindex thanks
8904
a7808fba
CD
8905Org was borne in 2003, out of frustration over the user interface
8906of the Emacs Outline mode. I was trying to organize my notes and
4009494e
GM
8907projects, and using Emacs seemed to be the natural way to go. However,
8908having to remember eleven different commands with two or three keys per
a7808fba 8909command, only to hide and show parts of the outline tree, that seemed
4009494e
GM
8910entirely unacceptable to me. Also, when using outlines to take notes, I
8911constantly want to restructure the tree, organizing it parallel to my
8912thoughts and plans. @emph{Visibility cycling} and @emph{structure
8913editing} were originally implemented in the package
8914@file{outline-magic.el}, but quickly moved to the more general
8915@file{org.el}. As this environment became comfortable for project
8916planning, the next step was adding @emph{TODO entries}, basic @emph{time
8917stamps}, and @emph{table support}. These areas highlight the two main
a7808fba 8918goals that Org still has today: To create a new, outline-based,
4009494e
GM
8919plain text mode with innovative and intuitive editing features, and to
8920incorporate project planning functionality directly into a notes file.
8921
a7808fba
CD
8922A special thanks goes to @i{Bastien Guerry} who has not only writen a large
8923number of extensions to Org (most of them integrated into the core by now),
8924but has also helped the development and maintenance of Org so much that he
8925should be considered co-author of this package.
8926
4009494e
GM
8927Since the first release, literally thousands of emails to me or on
8928@code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
8929reports, feedback, new ideas, and sometimes patches and add-on code.
8930Many thanks to everyone who has helped to improve this package. I am
8931trying to keep here a list of the people who had significant influence
a7808fba 8932in shaping one or more aspects of Org. The list may not be
4009494e
GM
8933complete, if I have forgotten someone, please accept my apologies and
8934let me know.
8935
8936@itemize @bullet
8937
8938@item
8939@i{Russel Adams} came up with the idea for drawers.
8940@item
a7808fba 8941@i{Thomas Baumann} wrote @file{org-bbdb.el} and @file{org-mhe.el}.
4009494e
GM
8942@item
8943@i{Alex Bochannek} provided a patch for rounding time stamps.
8944@item
8945@i{Charles Cave}'s suggestion sparked the implementation of templates
8946for Remember.
8947@item
8948@i{Pavel Chalmoviansky} influenced the agenda treatment of items with
8949specified time.
8950@item
8951@i{Gregory Chernov} patched support for lisp forms into table
8952calculations and improved XEmacs compatibility, in particular by porting
8953@file{nouline.el} to XEmacs.
8954@item
8955@i{Sacha Chua} suggested to copy some linking code from Planner.
8956@item
8957@i{Eddward DeVilla} proposed and tested checkbox statistics. He also
8958came up with the idea of properties, and that there should be an API for
8959them.
8960@item
8961@i{Kees Dullemond} used to edit projects lists directly in HTML and so
8962inspired some of the early development, including HTML export. He also
8963asked for a way to narrow wide table columns.
8964@item
a7808fba 8965@i{Christian Egli} converted the documentation into Texinfo format,
4009494e
GM
8966patched CSS formatting into the HTML exporter, and inspired the agenda.
8967@item
8968@i{David Emery} provided a patch for custom CSS support in exported
8969HTML agendas.
8970@item
8971@i{Nic Ferrier} contributed mailcap and XOXO support.
8972@item
28a16a1b
CD
8973@i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
8974@item
4009494e
GM
8975@i{John Foerch} figured out how to make incremental search show context
8976around a match in a hidden outline tree.
8977@item
dbc28aaa 8978@i{Niels Giesen} had the idea to automatically archive DONE trees.
4009494e 8979@item
a7808fba
CD
8980@i{Bastien Guerry} wrote the La@TeX{} exporter and @file{org-bibtex.el}, and
8981has been prolific with patches, ideas, and bug reports.
4009494e
GM
8982@item
8983@i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
8984@item
a7808fba
CD
8985@i{Bernt Hansen} has driven much of the support for auto-repeating tasks,
8986task state change logging, and the clocktable. His clear explanations have
8987been critical when we started to adopt the GIT version control system.
8988@item
8989@i{Phil Jackson} wrote @file{org-irc.el}.
8990@item
4009494e
GM
8991@i{Scott Jaderholm} proposed footnotes, control over whitespace between
8992folded entries, and column view for properties.
8993@item
a7808fba
CD
8994@i{Tokuya Kameshima} wrote @file{org-wl.el} and @file{org-mew.el}.
8995@item
4009494e
GM
8996@i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also
8997provided frequent feedback and some patches.
8998@item
8999@i{Jason F. McBrayer} suggested agenda export to CSV format.
9000@item
dbc28aaa
CD
9001@i{Max Mikhanosha} came up with the idea of refiling.
9002@item
4009494e
GM
9003@i{Dmitri Minaev} sent a patch to set priority limits on a per-file
9004basis.
9005@item
9006@i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
9007happy.
9008@item
dbc28aaa
CD
9009@i{Rick Moynihan} proposed to allow multiple TODO sequences in a file
9010and to be able to quickly restrict the agenda to a subtree.
4009494e
GM
9011@item
9012@i{Todd Neal} provided patches for links to Info files and elisp forms.
9013@item
9014@i{Tim O'Callaghan} suggested in-file links, search options for general
9015file links, and TAGS.
9016@item
9017@i{Takeshi Okano} translated the manual and David O'Toole's tutorial
9018into Japanese.
9019@item
9020@i{Oliver Oppitz} suggested multi-state TODO items.
9021@item
9022@i{Scott Otterson} sparked the introduction of descriptive text for
9023links, among other things.
9024@item
9025@i{Pete Phillips} helped during the development of the TAGS feature, and
9026provided frequent feedback.
9027@item
9028@i{T.V. Raman} reported bugs and suggested improvements.
9029@item
9030@i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
9031control.
9032@item
9033@i{Kevin Rogers} contributed code to access VM files on remote hosts.
9034@item
a7808fba
CD
9035@i{Sebastian Rose} wrote @file{org-info.js}, a Java script for displaying
9036webpages derived from Org using an Info-like, or a folding interface with
9037single key navigation.
9038@item
4009494e
GM
9039@i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
9040conflict with @file{allout.el}.
9041@item
9042@i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords.
9043@item
a7808fba 9044@i{Philip Rooke} created the Org reference card and provided lots
4009494e
GM
9045of feedback.
9046@item
9047@i{Christian Schlauer} proposed angular brackets around links, among
9048other things.
9049@item
a7808fba 9050Linking to VM/BBDB/Gnus was inspired by @i{Tom Shannon}'s
4009494e
GM
9051@file{organizer-mode.el}.
9052@item
a7808fba
CD
9053@i{Ilya Shlyakhter} proposed the Archive Sibling.
9054@item
4009494e
GM
9055@i{Daniel Sinder} came up with the idea of internal archiving by locking
9056subtrees.
9057@item
9058@i{Dale Smith} proposed link abbreviations.
9059@item
9060@i{Adam Spiers} asked for global linking commands and inspired the link
9061extension system. support mairix.
9062@item
9063@i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
9064chapter about publishing.
9065@item
9066@i{J@"urgen Vollmer} contributed code generating the table of contents
9067in HTML output.
9068@item
9069@i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
9070keyword.
9071@item
9072@i{David Wainberg} suggested archiving, and improvements to the linking
9073system.
9074@item
9075@i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}. The
a7808fba
CD
9076development of Org was fully independent, and both systems are really
9077different beasts in their basic ideas and implementation details. I later
9078looked at John's code, however, and learned from his implementation of (i)
9079links where the link itself is hidden and only a description is shown, and
9080(ii) popping up a calendar to select a date. John has also contributed a
9081number of great ideas and patches directly to Org, including the file
9082@code{org-mac-message.el}'
4009494e
GM
9083@item
9084@i{Carsten Wimmer} suggested some changes and helped fix a bug in
a7808fba 9085linking to Gnus.
4009494e 9086@item
a7808fba 9087@i{Roland Winkler} requested additional key bindings to make Org
4009494e
GM
9088work on a tty.
9089@item
9090@i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
9091and contributed various ideas and code snippets.
9092@end itemize
9093
9094
dbc28aaa
CD
9095@node Main Index, Key Index, History and Acknowledgments, Top
9096@unnumbered The Main Index
4009494e
GM
9097
9098@printindex cp
9099
dbc28aaa 9100@node Key Index, , Main Index, Top
4009494e
GM
9101@unnumbered Key Index
9102
9103@printindex ky
9104
9105@bye
9106
9107@ignore
a7808fba 9108 arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
4009494e 9109@end ignore
a7808fba
CD
9110
9111@c Local variables:
9112@c ispell-local-dictionary: "en_US-w_accents"
9113@c ispell-local-pdict: "./.aspell.org.pws"
9114@c fill-column: 77
9115@c End: